From 297fba2639fd1a2b355b9d2af1b83bae87939c39 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 4 May 2020 11:33:12 +0200 Subject: [PATCH 001/266] adapted editor handling --- class/Fields.php | 2 +- class/Files/Classes/ClassFiles.php | 33 +++++++-- class/Files/Classes/ClassXoopsCode.php | 2 +- class/Files/CreateXoopsCode.php | 8 +-- class/Files/Language/LanguageModinfo.php | 25 +++++-- .../Templates/Admin/TemplatesAdminPages.php | 5 ++ class/Files/Templates/user/Index.php | 72 +++++++++++++++---- class/Files/User/UserXoopsVersion.php | 22 +++++- class/Files/admin/AdminPages.php | 2 +- class/Files/admin/AdminXoopsCode.php | 8 ++- class/Settings.php | 1 - commonfiles/class/Utility.php | 4 +- docs/changelog.txt | 1 + language/english/admin.php | 2 +- testdata/index.php | 10 +-- 15 files changed, 146 insertions(+), 51 deletions(-) diff --git a/class/Fields.php b/class/Fields.php index ee54ada2..e13d24ae 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -228,7 +228,7 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $fieldAttributesSelect->addOptionArray($helper->getHandler('Fieldattributes')->getList()); $form->addElement(new Tdmcreate\Html\FormLabel('' . $fieldAttributesSelect->render() . '')); // Field Null - $value = (1 == $i && 1 == $tableAutoincrement) ? '2' : '2'; + $value = (1 == $i) && (1 == $tableAutoincrement) ? '2' : '2'; $fieldNullSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null[' . $i . ']', $value); $fieldNullSelect->addOptionArray($helper->getHandler('Fieldnull')->getList()); $form->addElement(new Tdmcreate\Html\FormLabel('' . $fieldNullSelect->render() . '')); diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index d2e9410e..cb8bd23c 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -134,7 +134,11 @@ private function getInitVars($fields) case 16: case 17: case 18: - $ret .= $this->getInitVar($fieldName, 'TXTAREA'); + if ((int)$fields[$f]->getVar('field_element') == 4) { + $ret .= $this->getInitVar($fieldName, 'OTHER'); + } else { + $ret .= $this->getInitVar($fieldName, 'TXTAREA'); + } break; case 19: case 20: @@ -380,17 +384,27 @@ private function getValuesInObject($moduleDirname, $table, $fields) $ucfTableName = ucfirst($table->getVar('table_name')); $ret = $pc->getPhpCodeCommentMultiLine(['Get' => 'Values', '@param null $keys' => '', '@param null $format' => '', '@param null$maxDepth' => '', '@return' => 'array'], "\t"); $ucfModuleDirname = ucfirst($moduleDirname); - $getValues = $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); - $getValues .= $xc->getXcEqualsOperator('$ret', '$this->getValues($keys, $format, $maxDepth)', null, "\t\t"); + $getValues = $xc->getXcEqualsOperator('$ret', '$this->getValues($keys, $format, $maxDepth)', null, "\t\t"); $fieldMainTopic = null; + $helper = 0; + $utility = 0; + $header = ''; foreach (array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); switch ($fieldElement) { case 3: + $getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); + $getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}_short']", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); + $utility = 1; + break; case 4: - $getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", false, "\t\t"); + $getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']", 'this', $fieldName, false, "\t\t", ", 'e'"); + $getValues .= $xc->getXcEqualsOperator('$editorMaxchar', $xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); + $truncate = $ucfModuleDirname . "\Utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']", $truncate, false, "\t\t"); + $utility = 1; break; case 6: $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t"); @@ -424,16 +438,23 @@ private function getValuesInObject($moduleDirname, $table, $fields) $getValues .= $xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t"); $fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')"; $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']", $fMainTopic, null, "\t\t"); - + $helper = 1; } else { $getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']", 'this', $fieldName, false, "\t\t"); } break; } } + if ($helper > 0) { + $header .= $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); + } + + if ($utility > 0) { + $header .= $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); + } $getValues .= $this->getSimpleString('return $ret;', "\t\t"); - $ret .= $pc->getPhpCodeFunction('getValues' . $ucfTableName, '$keys = null, $format = null, $maxDepth = null', $getValues, 'public ', false, "\t"); + $ret .= $pc->getPhpCodeFunction('getValues' . $ucfTableName, '$keys = null, $format = null, $maxDepth = null', $header . $getValues, 'public ', false, "\t"); return $ret; } diff --git a/class/Files/Classes/ClassXoopsCode.php b/class/Files/Classes/ClassXoopsCode.php index cdd05ffa..02ff4398 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -287,7 +287,7 @@ public function getClassXoopsFormText($var, $param1, $param2, $param3, $param4, public function getClassXoopsFormTextArea($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") { $area = 'new \XoopsFormTextArea( '; - $getVarTextArea = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true); + $getVarTextArea = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true, '', ", 'e'"); if (false === $isParam) { $ret = "{$t}\${$var} = {$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4} );\n"; } else { diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index fe25117a..3439d64e 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -119,12 +119,12 @@ public function getXcSetVarObj($tableName, $fieldName, $var, $t = '') * * @return string */ - public function getXcGetVar($varLeft = '', $handle = '', $var = '', $isParam = false, $t = '') + public function getXcGetVar($varLeft = '', $handle = '', $var = '', $isParam = false, $t = '', $format = '') { if (!$isParam) { - $ret = "{$t}\${$varLeft} = \${$handle}->getVar('{$var}');\n"; + $ret = "{$t}\${$varLeft} = \${$handle}->getVar('{$var}'{$format});\n"; } else { - $ret = "\${$handle}->getVar('{$var}')"; + $ret = "\${$handle}->getVar('{$var}'{$format})"; } return $ret; @@ -1192,7 +1192,7 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f $ret .= $this->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t); break; default: - $ret .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t); + $ret .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t); break; } } diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index f03725de..9b2f6f0f 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -250,23 +250,30 @@ private function getLanguageUser($language) */ private function getLanguageConfig($language, $tables) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('Config'); - $fieldImage = false; - $fieldFile = false; - $useTag = false; + $df = LanguageDefines::getInstance(); + $ret = $df->getAboveDefines('Config'); + $fieldImage = false; + $fieldFile = false; + $useTag = false; + $fieldEditor = false; // $usePermissions = false; foreach (array_keys($tables) as $i) { $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); + $ucfTablename = ucfirst($tables[$i]->getVar('table_name')); + $stuTablename = mb_strtoupper($ucfTablename); foreach (array_keys($fields) as $f) { $fieldElement = $fields[$f]->getVar('field_element'); + if (3 == $fieldElement) { + $fieldEditor = true; + } if (4 == $fieldElement) { $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $ucfFieldName = ucfirst($rpFieldName); $stuFieldName = mb_strtoupper($rpFieldName); - $ret .= $df->getDefine($language, 'EDITOR_' . $stuFieldName, 'Editor'); - $ret .= $df->getDefine($language, 'EDITOR_' . $stuFieldName . '_DESC', 'Select the Editor ' . $ucfFieldName . ' to use'); + $ret .= $df->getDefine($language, 'EDITOR_' . $stuTablename . '_' . $stuFieldName, 'Editor'); + $ret .= $df->getDefine($language, 'EDITOR_' . $stuTablename . '_' . $stuFieldName . '_DESC', 'Select the editor to use for ' . $ucfTablename . '/'. $ucfFieldName); + $fieldEditor = true; } if (13 == $fieldElement) { $fieldImage = true; @@ -280,6 +287,10 @@ private function getLanguageConfig($language, $tables) } // if (0 != $tables[$i]->getVar('table_permissions')) {$usePermissions = true;} } + if ($fieldEditor) { + $ret .= $df->getDefine($language, 'EDITOR_MAXCHAR', 'Text max characters'); + $ret .= $df->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field in admin area'); + } $ret .= $df->getDefine($language, 'KEYWORDS', 'Keywords'); $ret .= $df->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); /*if (usePermissions) { diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index b3a6904d..274ee8af 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -148,6 +148,11 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t } if (1 == $fields[$f]->getVar('field_inlist')) { switch ($fieldElement) { + case 3: + case 4: + $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $td .= $hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + break; case 5: $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $src = $sc->getSmartyNoSimbol('xoModuleIcons16') . $double . '.png'; diff --git a/class/Files/Templates/user/Index.php b/class/Files/Templates/user/Index.php index dd2b12ad..f557d785 100644 --- a/class/Files/Templates/user/Index.php +++ b/class/Files/Templates/user/Index.php @@ -79,7 +79,7 @@ public function getTemplateUserIndexHeader($moduleDirname) { $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - return $sc->getSmartyIncludeFile($moduleDirname, 'header') . PHP_EOL; + return $sc->getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); } /** @@ -98,7 +98,7 @@ private function getTemplatesUserIndexTable($moduleDirname, $tableName, $tableSo $table = $this->getTemplatesUserIndexTableThead($tableName, $language); $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); - return $hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; + return $hc->getHtmlTable($table, 'table table-' . $single); } /** @@ -114,10 +114,10 @@ private function getTemplatesUserIndexTableThead($tableName, $language) $stuTableName = mb_strtoupper($tableName); $lang = $sc->getSmartyConst($language, $stuTableName); $col = $sc->getSmartySingleVar('numb_col'); - $th = $hc->getHtmlTableHead($lang, '', $col) . PHP_EOL; - $tr = $hc->getHtmlTableRow($th, 'head') . PHP_EOL; + $th = $hc->getHtmlTableHead($lang, '', $col); + $tr = $hc->getHtmlTableRow($th, 'head') ; - return $hc->getHtmlTableThead($tr) . PHP_EOL; + return $hc->getHtmlTableThead($tr); } /** @@ -134,13 +134,13 @@ private function getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $ta $type = $sc->getSmartySingleVar('panel_type'); $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); $div = $hc->getHtmlDiv($include, 'panel panel-' . $type); - $cont = $hc->getHtmlTableData($div) . PHP_EOL; - $html = $hc->getHtmlEmpty('') . PHP_EOL; - $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html) . PHP_EOL; - $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; - $tr = $hc->getHtmlTableRow($foreach) . PHP_EOL; + $cont = $hc->getHtmlTableData($div); + $html = $hc->getHtmlEmpty(''); + $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html); + $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont); + $tr = $hc->getHtmlTableRow($foreach); - return $hc->getHtmlTableTbody($tr) . PHP_EOL; + return $hc->getHtmlTableTbody($tr); } /** @@ -150,10 +150,10 @@ private function getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $ta private function getTemplatesUserIndexTableTfoot() { $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTableData(' ') . PHP_EOL; - $tr = $hc->getHtmlTableRow($td) . PHP_EOL; + $td = $hc->getHtmlTableData(' '); + $tr = $hc->getHtmlTableRow($td); - return $hc->getHtmlTableTfoot($tr) . PHP_EOL; + return $hc->getHtmlTableTfoot($tr); } /** @@ -165,9 +165,50 @@ private function getTemplatesUserIndexTableTfoot() */ public function getTemplatesUserIndexBodyDefault($module, $table, $language) { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); - $ret = <<getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '',"\t\t\t"); + $tr = $hc->getHtmlTableRow($th,'center',"\t\t"); + $thead = $hc->getHtmlTableThead($tr,'', "\t"); + $contTable = $thead; + $li = $hc->getHtmlLi("\"><{\$smarty.const.{$language}INDEX}>",'',"\t\t\t\t\t\t"); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + foreach (array_keys($tables) as $i) { + $tableNameLi = $tables[$i]->getVar('table_name'); + $stuTableNameLi = mb_strtoupper($tableName); + $li .= $hc->getHtmlLi("/{$tableNameLi}.php\"><{\$smarty.const.{$language}{$stuTableNameLi}}>",'',"\t\t\t\t\t\t"); + } + + $ul = $hc->getHtmlUl($li,'menu text-center',"\t\t\t\t\t"); + $td = $hc->getHtmlTableData($ul, 'bold pad5','',"\t\t\t\t", "\n", true); + $tr = $hc->getHtmlTablerow($td, 'center',"\t\t\t"); + + $tbody = $hc->getHtmlTableTbody($tr,'', "\t\t"); + $contTable .= $tbody; + + $tfoot = << + <{if \$adv != ''}> + <{\$adv}> + <{else}> +   + <{/if}> + +EOT; + + + $contTable .= $tfoot; + $contIf = $hc->getHtmlTable($contTable); + $ret = $sc->getSmartyConditions("{$tableName}Count", ' > ', '0', $contIf, false, '','',"\t"); + + + $ret .= ''; + $ret .= '*********************************************************'; + + $ret .= << @@ -332,6 +373,7 @@ public function render() if (in_array(1, $tableCategory, true) && in_array(1, $tableIndex)) { $content .= $this->getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language); } + if (in_array(0, $tableCategory, true) && in_array(1, $tableIndex)) { $content .= $this->getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language); } diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 6afb2ffa..ae05740d 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -497,6 +497,7 @@ private function getXoopsVersionConfig($module, $tables, $language) $moduleDirname = $module->getVar('mod_dirname'); $ret = $this->getDashComment('Config'); + $table_editors = 0; $table_permissions = 0; $table_admin = 0; $table_user = 0; @@ -505,10 +506,13 @@ private function getXoopsVersionConfig($module, $tables, $language) $table_uploadfile = 0; foreach ($tables as $table) { $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $stuTablename = mb_strtoupper($table->getVar('table_name')); foreach (array_keys($fields) as $f) { $fieldElement = (int)$fields[$f]->getVar('field_element'); switch ($fieldElement) { case 3: + $table_editors = 1; + break; case 4: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); @@ -519,14 +523,15 @@ private function getXoopsVersionConfig($module, $tables, $language) $ret .= $xc->getXcEqualsOperator('$editorHandler' . $ucfFieldName, 'XoopsEditorHandler::getInstance()'); $editor = [ 'name' => "'editor_{$rpFieldName}'", - 'title' => "'{$language}EDITOR_{$stuFieldName}'", - 'description' => "'{$language}EDITOR_{$stuFieldName}_DESC'", + 'title' => "'{$language}EDITOR_{$stuTablename}_{$stuFieldName}'", + 'description' => "'{$language}EDITOR_{$stuTablename}_{$stuFieldName}_DESC'", 'formtype' => "'select'", 'valuetype' => "'text'", 'default' => "'dhtml'", 'options' => 'array_flip($editorHandler' . $ucfFieldName . '->getList())', ]; $ret .= $uxc->getUserModVersionArray(2, $editor, 'config'); + $table_editors = 1; break; case 10: case 11: @@ -555,7 +560,18 @@ private function getXoopsVersionConfig($module, $tables, $language) $table_tag = 1; } } - + if (1 === $table_editors) { + $ret .= $pc->getPhpCodeCommentLine('Editor : max characters admin area'); + $maxsize_image = [ + 'name' => "'editor_maxchar'", + 'title' => "'{$language}EDITOR_MAXCHAR'", + 'description' => "'{$language}EDITOR_MAXCHAR_DESC'", + 'formtype' => "'textbox'", + 'valuetype' => "'int'", + 'default' => '50', + ]; + $ret .= $uxc->getUserModVersionArray(2, $maxsize_image, 'config'); + } if (1 === $table_permissions) { $ret .= $pc->getPhpCodeCommentLine('Get groups'); $ret .= $xc->getXcXoopsHandler('member'); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index afd9857b..4e4d7f68 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -288,7 +288,7 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ $ret .= $xc->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t); break; default: - $ret .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t); + $ret .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t); break; } } diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index c270371d..98620d02 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -354,7 +354,7 @@ public function getAxcSetVarPassword($tableName, $fieldName, $t = '') * @param string $t * @return string */ - public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t = '') + public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t = '') { $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); switch ((int)$fieldType){ @@ -375,7 +375,11 @@ public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t = '') case 16: case 17: case 18: - $ret = $xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}', '')", $t); + if ((int)$fieldElement == 4) { + $ret = $xc->getXcSetVarObj($tableName, $fieldName, "Request::getText('{$fieldName}', '')", $t); + } else { + $ret = $xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}', '')", $t); + } break; case 0: default: diff --git a/class/Settings.php b/class/Settings.php index 4d885776..711480bf 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -202,7 +202,6 @@ public function getFormSettings($action = false) $imgtray->addElement($fileseltray); $form->addElement($imgtray); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_AUTHOR_MAIL, 'set_author_mail', 50, 255, $this->getVar('set_author_mail'))); $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_AUTHOR_WEBSITE_URL, 'set_author_website_url', 50, 255, $this->getVar('set_author_website_url'))); $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_AUTHOR_WEBSITE_NAME, 'set_author_website_name', 50, 255, $this->getVar('set_author_website_name'))); diff --git a/commonfiles/class/Utility.php b/commonfiles/class/Utility.php index 0bbfcd5a..d8fdbff7 100644 --- a/commonfiles/class/Utility.php +++ b/commonfiles/class/Utility.php @@ -132,7 +132,9 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } } // add the defined ending to the text - $truncate .= $ending; + if (strlen($truncate) > 0) { + $truncate .= $ending; + } if ($considerHtml) { // close all unclosed html-tags foreach ($open_tags as $tag) { diff --git a/docs/changelog.txt b/docs/changelog.txt index 61f2dff6..c594235d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -25,6 +25,7 @@ - added new field elements SelectStatus, SelectCombo, Password, SelectCountry and SelectLang (goffy) - rebuilt include/search.inc.php (goffy) - added default values for form elements (goffy) +- adapted editor handling (goffy)
3.01 Alpha 2 [WORK IN PROGRESS - NOT RELEASED]
Dev: XOOPS 2.5.11, PHP 7.4.2
diff --git a/language/english/admin.php b/language/english/admin.php index 43e91206..226044b2 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -447,7 +447,7 @@ define('_AM_TDMCREATE_BUILDING_COMMON', "Copied common files and created folder for test data"); define('_AM_TDMCREATE_FIELD_ELE_TEXT', "Textbox"); define('_AM_TDMCREATE_FIELD_ELE_TEXTAREA', "TextArea Field"); -define('_AM_TDMCREATE_FIELD_ELE_DHTMLTEXTAREA', "DhtmlTextArea Field"); +define('_AM_TDMCREATE_FIELD_ELE_DHTMLTEXTAREA', "Selectable Editor (Dhtml)"); define('_AM_TDMCREATE_FIELD_ELE_CHECKBOX', "CheckBox"); define('_AM_TDMCREATE_FIELD_ELE_RADIOYN', "Radio Yes/No"); define('_AM_TDMCREATE_FIELD_ELE_SELECTBOX', "Select Listbox"); diff --git a/testdata/index.php b/testdata/index.php index 72fb343c..9125613e 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -69,11 +69,10 @@ function loadSampleData() foreach ($tables as $table) { $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - if (is_array($tabledata)) { \Xmf\Database\TableLoad::truncateTable($table); \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); } -} + // --- COPY test folder files --------------- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { // $file = __DIR__ . '/../testdata/images/'; @@ -97,12 +96,7 @@ function saveSampleData() $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { - $language = $xoopsConfig['language'] . '/'; - } - - $languageFolder = __DIR__ . '/' . $language; + $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; if (!file_exists($languageFolder . '/')) { Utility::createFolder($languageFolder . '/'); } From 59b573e27ef6c799302d90626e27e089c037f02c Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 4 May 2020 11:36:18 +0200 Subject: [PATCH 002/266] no message --- class/Files/Classes/ClassFiles.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index cb8bd23c..d0360e41 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -448,10 +448,6 @@ private function getValuesInObject($moduleDirname, $table, $fields) if ($helper > 0) { $header .= $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); } - - if ($utility > 0) { - $header .= $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); - } $getValues .= $this->getSimpleString('return $ret;', "\t\t"); $ret .= $pc->getPhpCodeFunction('getValues' . $ucfTableName, '$keys = null, $format = null, $maxDepth = null', $header . $getValues, 'public ', false, "\t"); From 9dbca1f2f7359de43276ab9be067d5c03dfcb097 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 4 May 2020 11:52:01 +0200 Subject: [PATCH 003/266] adapted editor handling 2 --- class/Files/Classes/ClassFiles.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index d0360e41..96f9b073 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -389,6 +389,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) $helper = 0; $utility = 0; $header = ''; + $configMaxchar = 0; foreach (array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); @@ -396,14 +397,24 @@ private function getValuesInObject($moduleDirname, $table, $fields) switch ($fieldElement) { case 3: $getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); - $getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}_short']", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); + if ($configMaxchar == 0) { + $getValues .= $xc->getXcEqualsOperator('$editorMaxchar', $xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); + $configMaxchar = 1; + } + $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']", $truncate, false, "\t\t"); + $helper = 1; $utility = 1; break; case 4: $getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']", 'this', $fieldName, false, "\t\t", ", 'e'"); - $getValues .= $xc->getXcEqualsOperator('$editorMaxchar', $xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); - $truncate = $ucfModuleDirname . "\Utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + if ($configMaxchar == 0) { + $getValues .= $xc->getXcEqualsOperator('$editorMaxchar', $xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); + $configMaxchar = 1; + } + $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']", $truncate, false, "\t\t"); + $helper = 1; $utility = 1; break; case 6: @@ -446,7 +457,10 @@ private function getValuesInObject($moduleDirname, $table, $fields) } } if ($helper > 0) { - $header .= $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); + $header .= $xc->getXcGetInstance('helper ', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); + } + if ($utility > 0) { + $header .= $xc->getXcEqualsOperator('$utility', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\t\t"); } $getValues .= $this->getSimpleString('return $ret;', "\t\t"); From 62713f8f9c326dff69f301105a396203e8ba31fd Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 4 May 2020 16:36:02 +0200 Subject: [PATCH 004/266] remove old "user" folder --- class/Files/Templates/user/Breadcrumbs.php | 100 ----- class/Files/Templates/user/Broken.php | 198 --------- class/Files/Templates/user/Categories.php | 248 ----------- class/Files/Templates/user/CategoriesList.php | 307 -------------- class/Files/Templates/user/DisqusComments.php | 97 ----- .../Files/Templates/user/FacebookComments.php | 97 ----- class/Files/Templates/user/Footer.php | 145 ------- class/Files/Templates/user/Header.php | 133 ------ class/Files/Templates/user/Index.php | 387 ------------------ class/Files/Templates/user/MoreFiles.php | 110 ----- class/Files/Templates/user/Pages.php | 216 ---------- class/Files/Templates/user/PagesList.php | 191 --------- class/Files/Templates/user/Pdf.php | 102 ----- class/Files/Templates/user/Rate.php | 252 ------------ class/Files/Templates/user/Rss.php | 132 ------ class/Files/Templates/user/Search.php | 251 ------------ class/Files/Templates/user/Single.php | 141 ------- class/Files/Templates/user/Submit.php | 151 ------- class/Files/Templates/user/UserPrint.php | 248 ----------- class/files/templates/user/index.html | 1 - 20 files changed, 3507 deletions(-) delete mode 100644 class/Files/Templates/user/Breadcrumbs.php delete mode 100644 class/Files/Templates/user/Broken.php delete mode 100644 class/Files/Templates/user/Categories.php delete mode 100644 class/Files/Templates/user/CategoriesList.php delete mode 100644 class/Files/Templates/user/DisqusComments.php delete mode 100644 class/Files/Templates/user/FacebookComments.php delete mode 100644 class/Files/Templates/user/Footer.php delete mode 100644 class/Files/Templates/user/Header.php delete mode 100644 class/Files/Templates/user/Index.php delete mode 100644 class/Files/Templates/user/MoreFiles.php delete mode 100644 class/Files/Templates/user/Pages.php delete mode 100644 class/Files/Templates/user/PagesList.php delete mode 100644 class/Files/Templates/user/Pdf.php delete mode 100644 class/Files/Templates/user/Rate.php delete mode 100644 class/Files/Templates/user/Rss.php delete mode 100644 class/Files/Templates/user/Search.php delete mode 100644 class/Files/Templates/user/Single.php delete mode 100644 class/Files/Templates/user/Submit.php delete mode 100644 class/Files/Templates/user/UserPrint.php delete mode 100644 class/files/templates/user/index.html diff --git a/class/Files/Templates/user/Breadcrumbs.php b/class/Files/Templates/user/Breadcrumbs.php deleted file mode 100644 index b1d19d03..00000000 --- a/class/Files/Templates/user/Breadcrumbs.php +++ /dev/null @@ -1,100 +0,0 @@ -setModule($module); - $this->setFileName($filename); - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $title = $sc->getSmartyDoubleVar('itm', 'title'); - $titleElse = $sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n") ; - $link = $sc->getSmartyDoubleVar('itm', 'link'); - $glyph = $hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home'], '', false, '', ''); - $anchor = $hc->getHtmlAnchor('<{xoAppUrl index.php}>', $glyph, 'home'); - $into = $hc->getHtmlLi($anchor, 'bc-item', "\t"); - $anchorIf = $hc->getHtmlAnchor($link, $title, $title, '', '', '', "\t\t\t", "\n"); - $breadcrumb = $sc->getSmartyConditions('itm.link', '', '', $anchorIf, $titleElse, false, false, "\t\t", "\n"); - $foreach = $hc->getHtmlLi($breadcrumb, 'bc-item', "\t", "\n", true); - $into .= $sc->getSmartyForeach('itm', 'xoBreadcrumbs', $foreach, 'bcloop', '', "\t"); - - $content = $hc->getHtmlOl($into, 'breadcrumb'); - - $tf->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $tf->renderFile(); - } -} diff --git a/class/Files/Templates/user/Broken.php b/class/Files/Templates/user/Broken.php deleted file mode 100644 index 19635065..00000000 --- a/class/Files/Templates/user/Broken.php +++ /dev/null @@ -1,198 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserBrokenFileHeader - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserBrokenFileHeader($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'header'); - } - - /** - * @private function getTemplatesUserBrokenTableHead - * @param $tableMid - * @param $tableId - * @param $tableAutoincrement - * @param $language - * @return string - */ - private function getTemplatesUserBrokenTableHead($tableMid, $tableId, $tableAutoincrement, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $th = ''; - $fields = $this->getTableFields($tableMid, $tableId); - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $stuFieldName = mb_strtoupper($fieldName); - if ((1 == $tableAutoincrement) || (1 == $fields[$f]->getVar('field_user'))) { - $const = $sc->getSmartyConst($language, $stuFieldName); - $th .= $hc->getHtmlTag('th', ['class' => 'center'], $const, '', "\t\t\t"); - } - } - $tr = $hc->getHtmlTableRow($th, 'head',"\t\t"); - - return $hc->getHtmlTableThead($tr, 'outer', "\t"); - } - - /** - * @private function getTemplatesUserBrokenBody - * @param $moduleDirname - * @param $tableMid - * @param $tableId - * @param $tableName - * @param $tableSoleName - * @param $tableAutoincrement - * @return string - */ - private function getTemplatesUserBrokenBody($moduleDirname, $tableMid, $tableId, $tableName, $tableSoleName, $tableAutoincrement) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = ''; - $fields = $this->getTableFields($tableMid, $tableId); - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldElement = $fields[$f]->getVar('field_element'); - $rpFieldName = $this->getRightString($fieldName); - if ((1 == $tableAutoincrement) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $span = $hc->getHtmlSpan("<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\${$tableSoleName}.{$rpFieldName}}>", "#<{\${$tableSoleName}.{$rpFieldName}}>"); - $ret .= $hc->getHtmlTableData($span, 'center', '', "\t\t\t"); - break; - case 10: - $img = $hc->getHtmlImage("<{xoModuleIcons32}><{\${$tableSoleName}.{$rpFieldName}}>", $tableName); - $ret .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t"); - break; - case 13: - $img = $hc->getHtmlImage("<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\${$tableSoleName}.{$rpFieldName}}>", $tableName); - $ret .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t") ; - break; - default: - $ret .= $hc->getHtmlTableData("<{\${$tableSoleName}.{$rpFieldName}}>", 'center', '', "\t\t\t") ; - break; - } - } - } - $row = $hc->getHtmlTableRow($ret, '<{cycle values="odd, even"}>',"\t\t") ; - $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $row, '', '', "\t\t"); - - return $hc->getHtmlTableTbody($foreach, '', "\t"); - } - - /** - * @private function getTemplatesUserBrokenFileFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserBrokenFileFooter($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); - } - - /** - * @public function render - * @return bool|string - */ - public function render() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $tableAutoincrement = $table->getVar('table_autoincrement'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserBrokenFileHeader($moduleDirname); - $contentTable = $this->getTemplatesUserBrokenTableHead($tableMid, $tableId, $tableAutoincrement, $language); - $contentTable .= $this->getTemplatesUserBrokenBody($moduleDirname, $tableMid, $tableId, $tableName, $tableSoleName, $tableAutoincrement); - $content .= $hc->getHtmlTable($contentTable, 'table table-bordered'); - $content .= $this->getTemplatesUserBrokenFileFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Categories.php b/class/Files/Templates/user/Categories.php deleted file mode 100644 index 5f5f0c01..00000000 --- a/class/Files/Templates/user/Categories.php +++ /dev/null @@ -1,248 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserCategoriesHeader - * @param string $moduleDirname - * @return string - */ - private function getTemplatesUserCategoriesHeader($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'header') . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategoriesTable - * @param string $language - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @return string - */ - private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('table_type'); - $table = $this->getTemplatesAdminPagesTableThead($tableName, $language); - $table .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $language); - - return $hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategoriesThead - * @param string $language - * @param $tableName - * @return string - */ - private function getTemplatesUserCategoriesThead($tableName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $lang = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); - $single = $sc->getSmartySingleVar('numb_col'); - $th = $hc->getHtmlTableHead($lang, '', $single) . PHP_EOL; - $tr = $hc->getHtmlTableRow($th, 'head') . PHP_EOL; - - return $hc->getHtmlTableThead($tr) . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategoriesTbody - * @param string $moduleDirname - * @param $tableName - * @param $tableSoleName - * @return string - */ - private function getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('panel_type'); - $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); - $div = $hc->getHtmlDiv($include, 'panel panel-' . $single); - $cont = $hc->getHtmlTableData($div) . PHP_EOL; - $html = $hc->getHtmlEmpty('') . PHP_EOL; - $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html) . PHP_EOL; - $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; - $tr = $hc->getHtmlTableRow($foreach) . PHP_EOL; - - return $hc->getHtmlTableTbody($tr) . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategoriesTfoot - * @return string - */ - private function getTemplatesUserCategoriesTfoot() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTableData(' ') . PHP_EOL; - $tr = $hc->getHtmlTableRow($td) . PHP_EOL; - - return $hc->getHtmlTableTfoot($tr) . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategories - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return string - */ - private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $tab = $this->getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) . PHP_EOL; - $div = $hc->getHtmlDiv($tab, 'table-responsive') . PHP_EOL; - - return $sc->getSmartyConditions($tableName, ' gt ', '0', $div, false, true) . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategoriesPanel - * @param string $moduleDirname - * @param string $tableName - * @param $tableSoleName - * @param $language - * @return string - */ - private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language) - { - $stuTableName = mb_strtoupper($tableName); - /*$ret = << -
<{\$smarty.const.{$language}{$stuTableName}_TITLE}>
- <{foreach item={$tableSoleName} from=\${$tableName}}> -
- <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableSoleName}}> - <{if \${$tableSoleName}.count is div by \$numb_col}> -
- <{/if}> -
- <{/foreach}> -\n -EOT;*/ - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $incl = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; - $html = $hc->getHtmlEmpty('
') . PHP_EOL; - $incl .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$numb_col', $html) . PHP_EOL; - $const = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); - $div = $hc->getHtmlDiv($const, 'panel-heading') . PHP_EOL; - $cont = $hc->getHtmlDiv($incl, 'panel panel-body') . PHP_EOL; - $div .= $sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; - $panelType = $sc->getSmartySingleVar('panel_type'); - - return $hc->getHtmlDiv($div, 'panel panel-' . $panelType) . PHP_EOL; - } - - /** - * @private function getTemplatesUserCategoriesFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserCategoriesFooter($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); - } - - /** - * @public function render - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserCategoriesHeader($moduleDirname); - $content .= $this->getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language); - $content .= $this->getTemplatesUserCategoriesFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/CategoriesList.php b/class/Files/Templates/user/CategoriesList.php deleted file mode 100644 index 88173928..00000000 --- a/class/Files/Templates/user/CategoriesList.php +++ /dev/null @@ -1,307 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserCategoriesListHeader - * @return string - */ - private function getTemplatesUserCategoriesListStartTable() - { - $ret = << -
\n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserCategoriesListThead - * @param $table - * @return string - */ - private function getTemplatesUserCategoriesListThead($table) - { - $ret = << - \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')) { - if (1 == $fields[$f]->getVar('field_thead')) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; - } - } - } - $ret .= << - \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserCategoriesListTbody - * @param string $moduleDirname - * @param string $table - * - * @return string - */ - private function getTemplatesUserCategoriesListTbody($moduleDirname, $table) - { - $tableName = $table->getVar('table_name'); - $ret = << - \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'); - if (1 == $fields[$f]->getVar('field_user')) { - if (1 == $fields[$f]->getVar('field_tbody')) { - switch ($fieldElement) { - default: - case 10: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $ret .= <<{$tableName}\n -EOT; - break; - case 13: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $ret .= <<{$tableName}\n -EOT; - break; - case 2: - case 3: - case 4: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; - break; - } - } - } - } - $ret .= << - \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserCategoriesListTfoot - * @param string $table - * @return string - */ - private function getTemplatesUserCategoriesListTfoot($table) - { - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - $ret = << - \n -EOT; - - foreach (array_keys($fields) as $f) { - if (1 == $fields[$f]->getVar('field_user')) { - if (1 == $fields[$f]->getVar('field_tfoot')) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; - } - } - } - $ret .= << - \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserCategoriesListEndTable - * @param null - * - * @return string - */ - private function getTemplatesUserCategoriesListEndTable() - { - $ret = << -\n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserCategoriesListPanel - * @param string $moduleDirname - * @param $tableId - * @param $tableMid - * @param $tableName - * @param $tableSoleName - * @return string - */ - private function getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $fields = $this->getTableFields($tableMid, $tableId); - $ret = ''; - $retElem = ''; - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldElement = $fields[$f]->getVar('field_element'); - if (1 == $fields[$f]->getVar('field_user')) { - if (1 == $fields[$f]->getVar('field_tbody')) { - switch ($fieldElement) { - default: - case 2: - $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-2') . PHP_EOL; - break; - case 3: - case 4: - $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-3 justify') . PHP_EOL; - break; - case 10: - $rpFieldName = $this->getRightString($fieldName); - $singleVar = $sc->getSmartySingleVar('xoops_icons32_url'); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - $retElem .= $hc->getHtmlSpan($img, 'col-sm-3') . PHP_EOL; - unset($img); - break; - case 13: - $rpFieldName = $this->getRightString($fieldName); - $singleVar = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); - $retElem .= $hc->getHtmlSpan($img, 'col-sm-3') . PHP_EOL; - unset($img); - break; - } - } - } - } - $ret .= $hc->getHtmlDiv($retElem, 'panel-body') . PHP_EOL; - - return $ret; - } - - /** - * @public function render - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = ''; - foreach (array_keys($tables) as $t) { - $tableId = $tables[$t]->getVar('table_id'); - $tableMid = $tables[$t]->getVar('table_mid'); - $tableName = $tables[$t]->getVar('table_name'); - $tableSoleName = $tables[$t]->getVar('table_solename'); - $tableCategory[] = $tables[$t]->getVar('table_category'); - if (in_array(1, $tableCategory)) { - $content .= $this->getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); - } - } - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/DisqusComments.php b/class/Files/Templates/user/DisqusComments.php deleted file mode 100644 index 39c3388a..00000000 --- a/class/Files/Templates/user/DisqusComments.php +++ /dev/null @@ -1,97 +0,0 @@ -setModule($module); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesCommentCode - * @param null - * - * @return string - */ - private function getTemplatesCommentCode() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - - return $hc->getHtmlEmpty('Please! Enter here your comments code'); - } - - /** - * @public function render - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getTemplatesCommentCode(); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/FacebookComments.php b/class/Files/Templates/user/FacebookComments.php deleted file mode 100644 index 30c530d6..00000000 --- a/class/Files/Templates/user/FacebookComments.php +++ /dev/null @@ -1,97 +0,0 @@ -setModule($module); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesCommentCode - * @param null - * - * @return string - */ - private function getTemplatesCommentCode() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - - return $hc->getHtmlEmpty('Please! Enter here your comments code'); - } - - /** - * @public function render - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getTemplatesCommentCode(); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Footer.php b/class/Files/Templates/user/Footer.php deleted file mode 100644 index 9ff3e74e..00000000 --- a/class/Files/Templates/user/Footer.php +++ /dev/null @@ -1,145 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @public function getTemplateUserFooterFacebookLikeButton - * @param null - * - * @return bool|string - */ - public function getTemplateUserFooterFacebookLikeButton() - { - return "
  • "; - } - - /** - * @public function getTemplateUserFooterFacebookShareButton - * @param null - * - * @return bool|string - */ - public function getTemplateUserFooterFacebookShareButton() - { - return "
  • "; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - private function getTemplateUserFooterContent($moduleDirname, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlDiv('<{$copyright}>', 'pull-left', '', "\n", false); - $ret .= $hc->getHtmlEmpty("\n"); - $contIf = $hc->getHtmlDiv('<{$pagenav}>', 'pull-right', "\t", "\n", false); - $ret .= $sc->getSmartyConditions('pagenav', ' != ', "''", $contIf); - $ret .= $hc->getHtmlEmpty("
    \n"); - $contIf = $hc->getHtmlDiv("<{\$smarty.const.{$language}ADMIN}>", 'text-center bold', "\t", "\n", false); - $ret .= $sc->getSmartyConditions('xoops_isadmin', ' != ', "''", $contIf); - $ret .= $hc->getHtmlEmpty("\n"); - $contIf = $sc->getSmartyIncludeFile('system_comments','flat',false, false,"\t\t\t"); - $contIf .= $this->getSimpleString('<{elseif $comment_mode == "thread"}>',"\t\t"); - $contIf .= $sc->getSmartyIncludeFile('system_comments','thread',false, false,"\t\t\t"); - $contIf .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>',"\t\t"); - $contIf .= $sc->getSmartyIncludeFile('system_comments','nest',false, false,"\t\t\t"); - $contDiv = $sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '','',"\t\t"); - $contIf = $hc->getHtmlDiv($contDiv, 'pad2 marg2', "\t", "\n", true); - $ret .= $sc->getSmartyConditions('comment_mode', '', '', $contIf); - - return $ret; - } - - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplateUserFooterContent($moduleDirname, $language); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Header.php b/class/Files/Templates/user/Header.php deleted file mode 100644 index 23f7b319..00000000 --- a/class/Files/Templates/user/Header.php +++ /dev/null @@ -1,133 +0,0 @@ -tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); - $this->htmlcode = Tdmcreate\Files\CreateHtmlCode::getInstance(); - } - - /** - * @static function getInstance - * @param null - * @return Header - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /** - * @public function write - * @param string $module - * @param string $filename - */ - public function write($module, $filename) - { - $this->setModule($module); - $this->setFileName($filename); - } - - /** - * @public function getTemplatesUserHeader - * @param $moduleDirname - * @return bool|string - */ - public function getTemplatesUserHeader($moduleDirname) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, true, '', "\n\n"); - $var = $sc->getSmartySingleVar('ads', '', ''); - $div = $hc->getHtmlDiv($var, 'center', "\t","\n", false) ; - $ret .= $sc->getSmartyConditions('ads', ' != ', '\'\'', $div); - - return $ret; - } - - /** - * @public function getTemplateFooterFacebbokSDK - * @param null - * - * @return bool|string - */ - public function getTemplateUserHeaderFacebbokSDK() - { - $ret = <<<'EOT' - -
    - -EOT; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - //$language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserHeader($moduleDirname); - - $this->tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->tdmcfile->renderFile(); - } -} diff --git a/class/Files/Templates/user/Index.php b/class/Files/Templates/user/Index.php deleted file mode 100644 index f557d785..00000000 --- a/class/Files/Templates/user/Index.php +++ /dev/null @@ -1,387 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setTables($tables); - $this->setFileName($filename); - } - - /** - * @public function getTemplateUserIndexHeader - * @param $moduleDirname - * @return bool|string - */ - public function getTemplateUserIndexHeader($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); - } - - /** - * @private function getTemplatesUserIndexTable - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return string - */ - private function getTemplatesUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('table_type'); - $table = $this->getTemplatesUserIndexTableThead($tableName, $language); - $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); - - return $hc->getHtmlTable($table, 'table table-' . $single); - } - - /** - * @private function getTemplatesUserIndexThead - * @param string $language - * @param $tableName - * @return string - */ - private function getTemplatesUserIndexTableThead($tableName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $lang = $sc->getSmartyConst($language, $stuTableName); - $col = $sc->getSmartySingleVar('numb_col'); - $th = $hc->getHtmlTableHead($lang, '', $col); - $tr = $hc->getHtmlTableRow($th, 'head') ; - - return $hc->getHtmlTableThead($tr); - } - - /** - * @private function getTemplatesUserIndexTbody - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @return string - */ - private function getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $type = $sc->getSmartySingleVar('panel_type'); - $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); - $div = $hc->getHtmlDiv($include, 'panel panel-' . $type); - $cont = $hc->getHtmlTableData($div); - $html = $hc->getHtmlEmpty('
    '); - $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html); - $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont); - $tr = $hc->getHtmlTableRow($foreach); - - return $hc->getHtmlTableTbody($tr); - } - - /** - * @private function getTemplatesUserIndexTfoot - * @return string - */ - private function getTemplatesUserIndexTableTfoot() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTableData(' '); - $tr = $hc->getHtmlTableRow($td); - - return $hc->getHtmlTableTfoot($tr); - } - - /** - * @public function getTemplatesUserIndexBodyDefault - * @param $module - * @param $table - * @param $language - * @return bool|string - */ - public function getTemplatesUserIndexBodyDefault($module, $table, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $th = $hc->getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '',"\t\t\t"); - $tr = $hc->getHtmlTableRow($th,'center',"\t\t"); - $thead = $hc->getHtmlTableThead($tr,'', "\t"); - $contTable = $thead; - $li = $hc->getHtmlLi("\"><{\$smarty.const.{$language}INDEX}>",'',"\t\t\t\t\t\t"); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - foreach (array_keys($tables) as $i) { - $tableNameLi = $tables[$i]->getVar('table_name'); - $stuTableNameLi = mb_strtoupper($tableName); - $li .= $hc->getHtmlLi("/{$tableNameLi}.php\"><{\$smarty.const.{$language}{$stuTableNameLi}}>",'',"\t\t\t\t\t\t"); - } - - $ul = $hc->getHtmlUl($li,'menu text-center',"\t\t\t\t\t"); - $td = $hc->getHtmlTableData($ul, 'bold pad5','',"\t\t\t\t", "\n", true); - $tr = $hc->getHtmlTablerow($td, 'center',"\t\t\t"); - - $tbody = $hc->getHtmlTableTbody($tr,'', "\t\t"); - $contTable .= $tbody; - - $tfoot = << - <{if \$adv != ''}> - - <{else}> - - <{/if}> - -EOT; - - - $contTable .= $tfoot; - $contIf = $hc->getHtmlTable($contTable); - $ret = $sc->getSmartyConditions("{$tableName}Count", ' > ', '0', $contIf, false, '','',"\t"); - - - $ret .= ''; - $ret .= '*********************************************************'; - - $ret .= << -
    <{\$adv}>
     
    - - - - - - - - - - - - <{if \$adv != ''}> - - <{else}> - - <{/if}> - -
    <{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>
    -
    <{\$adv}>
     
    -<{/if}>\n -EOT; - - return $ret; - } - - /** - * @public function getTemplateUserIndexCategories - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return bool|string - */ - public function getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language) - { - $stuTableName = mb_strtoupper($tableName); - $ret = << 0}> -
    - - - - - - - - - <{foreach item={$tableSoleName} from=\${$tableName}}> - - <{if \${$tableSoleName}.count is div by \$numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
    <{\$smarty.const.{$language}{$stuTableName}}>
    - <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableSoleName}}> -
    <{\$lang_thereare}>
    -
    -<{/if}>\n -EOT; - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('table_type'); - $table = $this->getTemplatesUserIndexTableThead($tableName, $language); - $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); - $table .= $hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; - $div = $hc->getHtmlDiv($table, 'table-responsive') . PHP_EOL; - - return $ret/*$sc->getSmartyConditions($tableName, ' > ', '0', $div, false, true)*/ . PHP_EOL; - } - - /** - * @public function getTemplateUserIndexTable - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return bool|string - */ - public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language) - { - $ret = << 0}> - -
    <{\$smarty.const.{$language}INDEX_LATEST_LIST}>
    - - - - <{section name=i loop=\${$tableName}}> - - <{if \${$tableName}[i].count is div by \$divideby}> - - <{/if}> - <{/section}> - - -
    - <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableName}[i]}> -
    - -<{/if}>\n -EOT; - - return $ret; - } - - /** - * @public function getTemplateUserIndexFooter - * @param $moduleDirname - * @return bool|string - */ - public function getTemplateUserIndexFooter($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplateUserIndexHeader($moduleDirname); - $content .= $this->getTemplatesUserIndexBodyDefault($module, $table, $language); - foreach (array_keys($tables) as $t) { - $tableName = $tables[$t]->getVar('table_name'); - $tableSoleName = $tables[$t]->getVar('table_solename'); - $tableCategory[] = $tables[$t]->getVar('table_category'); - $tableFieldname = $tables[$t]->getVar('table_fieldname'); - $tableIndex[] = $tables[$t]->getVar('table_index'); - if (in_array(1, $tableCategory, true) && in_array(1, $tableIndex)) { - $content .= $this->getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language); - } - - if (in_array(0, $tableCategory, true) && in_array(1, $tableIndex)) { - $content .= $this->getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language); - } - } - $content .= $this->getTemplateUserIndexFooter($moduleDirname); - $tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); - $tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $tdmcfile->renderFile(); - } -} diff --git a/class/Files/Templates/user/MoreFiles.php b/class/Files/Templates/user/MoreFiles.php deleted file mode 100644 index 93a16633..00000000 --- a/class/Files/Templates/user/MoreFiles.php +++ /dev/null @@ -1,110 +0,0 @@ -setModule($module); - $this->setFileName($filename); - $this->folder = $folder; - $this->extension = $extension; - } - - /** - * @private function getTemplatesUserMoreFile - * @param null - * - * @return string - */ - private function getTemplatesUserMoreFile() - { - $ret = <<<'EOT' -
    - Pleace! Enter here your template code here -
    -EOT; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getTemplatesUserMoreFile(); - - $this->create($moduleDirname, $this->folder, $filename . '.' . $this->extension, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Pages.php b/class/Files/Templates/user/Pages.php deleted file mode 100644 index 8d8a2a7f..00000000 --- a/class/Files/Templates/user/Pages.php +++ /dev/null @@ -1,216 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserPagesHeader - * @param string $moduleDirname - * @return string - */ - private function getTemplatesUserPagesHeader($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'header', '','','',"\n\n"); - } - - /** - * @private function getTemplatesUserPagesTable - * @param string $moduleDirname - * @param string $tableName - * @param $tableSoleName - * @param string $language - * @return string - */ - private function getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $tbody = $this->getTemplatesUserPagesTableThead($tableName, $language); - $tbody .= $this->getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName); - $tbody .= $this->getTemplatesUserPagesTableTfoot(); - $single = $sc->getSmartySingleVar('table_type'); - - return $hc->getHtmlTable($tbody, 'table table-' . $single, "\t"); - } - - /** - * @private function getTemplatesUserPagesThead - * @param string $language - * @param $tableName - * @return string - */ - private function getTemplatesUserPagesTableThead($tableName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $single = $sc->getSmartySingleVar('divideby'); - $lang = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); - $th = $hc->getHtmlTableHead($lang, '', $single, "\t\t\t\t"); - $tr = $hc->getHtmlTableRow($th, 'head', "\t\t\t"); - - return $hc->getHtmlTableThead($tr, '', "\t\t"); - } - - /** - * @private function getTemplatesUserPagesTbody - * @param string $moduleDirname - * @param $tableName - * @param $tableSoleName - * @return string - */ - private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('panel_type'); - $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName, "\t\t\t\t\t\t", "\n"); - $div = $hc->getHtmlDiv($include, 'panel panel-' . $single, "\t\t\t\t\t", "\n"); - $cont = $hc->getHtmlTableData($div, '', '', "\t\t\t\t", "\n", true); - $html = $hc->getHtmlEmpty('', "\t\t\t\t\t", "\n"); - $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html, '', '', '',"\t\t\t\t"); - $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont,'','',"\t\t\t\t"); - $tr = $hc->getHtmlTableRow($foreach,'',"\t\t\t"); - - return $hc->getHtmlTableTbody($tr,'',"\t\t"); - } - - /** - * @private function getTemplatesUserPagesTfoot - * @param null - * @return string - */ - private function getTemplatesUserPagesTableTfoot() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTableData(" ", '', '', '', ''); - $tr = $hc->getHtmlTableRow($td, '', '', ''); - - return $hc->getHtmlTableTfoot($tr, '', "\t\t", "\n", false); - } - - /** - * @private function getTemplatesUserPages - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return string - */ - private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $table = $this->getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language); - $div = $hc->getHtmlDiv($table, 'table-responsive'); - - return $sc->getSmartyConditions($tableName . 'Count', ' > ', '0', $div, false, false, true); - } - - /** - * @private function getTemplatesUserPagesFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserPagesFooter($moduleDirname) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlEmpty('', '', "\n"); - $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer'); - - return $ret; - } - - /** - * @public function render - * @param null - * - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserPagesHeader($moduleDirname); - $content .= $this->getTemplatesUserPages($moduleDirname, $tableName, $tableSoleName, $language); - $content .= $this->getTemplatesUserPagesFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/PagesList.php b/class/Files/Templates/user/PagesList.php deleted file mode 100644 index 4752405f..00000000 --- a/class/Files/Templates/user/PagesList.php +++ /dev/null @@ -1,191 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setTables($tables); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserPagesListPanel - * @param string $moduleDirname - * @param $tableId - * @param $tableMid - * @param $tableName - * @param $tableSoleName - * @param $language - * @return string - */ - private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $fields = $this->getTableFields($tableMid, $tableId); - $ret = ''; - $retNumb = ''; - foreach (array_keys($fields) as $f) { - $fieldElement = $fields[$f]->getVar('field_element'); - if (1 == $fields[$f]->getVar('field_user')) { - if (1 == $fields[$f]->getVar('field_thead')) { - switch ($fieldElement) { - default: - case 2: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retNumb = $hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); - break; - } - } - } - } - $ret .= $hc->getHtmlDiv($retNumb, 'panel-heading'); - $retElem = ''; - foreach (array_keys($fields) as $f) { - $fieldElement = $fields[$f]->getVar('field_element'); - if (1 == $fields[$f]->getVar('field_user')) { - if (1 == $fields[$f]->getVar('field_tbody')) { - switch ($fieldElement) { - default: - case 3: - case 4: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); - break; - case 10: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $singleVar = $sc->getSmartySingleVar('xoops_icons32_url'); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - $retElem .= $hc->getHtmlSpan($img, 'col-sm-3', "\t"); - unset($img); - break; - case 13: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $singleVar = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); - $retElem .= $hc->getHtmlSpan($img, 'col-sm-3',"\t"); - unset($img); - break; - } - } - } - } - $ret .= $hc->getHtmlDiv($retElem, 'panel-body'); - $retFoot = ''; - foreach (array_keys($fields) as $f) { - if (1 == $fields[$f]->getVar('field_user')) { - if (1 == $fields[$f]->getVar('field_tfoot')) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $langConst = mb_strtoupper($tableSoleName) . '_' . mb_strtoupper($rpFieldName); - $lang = $sc->getSmartyConst($language, $langConst); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retFoot .= $hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); - } - } - } - $ret .= $hc->getHtmlDiv($retFoot, 'panel-foot'); - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - //$tables = $this->getTables(); - //$tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - $moduleDirname = $module->getVar('mod_dirname'); - $filename = $this->getFileName(); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = ''; - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $tableCategory[] = $table->getVar('table_category'); - //$tableIndex = $table->getVar('table_index'); - if (in_array(0, $tableCategory)) { - $content .= $this->getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); - } - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Pdf.php b/class/Files/Templates/user/Pdf.php deleted file mode 100644 index d97ee048..00000000 --- a/class/Files/Templates/user/Pdf.php +++ /dev/null @@ -1,102 +0,0 @@ -setModule($module); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserPdfBody - * - * @param null - * - * @return string - */ - private function getTemplatesUserPdfBody() - { - $ret = <<<'EOT' -
    <{$pdfoutput}>
    -EOT; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getTemplatesUserPdfBody(); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Rate.php b/class/Files/Templates/user/Rate.php deleted file mode 100644 index d24e065c..00000000 --- a/class/Files/Templates/user/Rate.php +++ /dev/null @@ -1,252 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserRateHeader - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserRateHeader($moduleDirname, $table, $language) - { - $ret = << - - - \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; - } - } - $ret .= << - \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserRateBody - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserRateBody($moduleDirname, $table, $language) - { - $tableName = $table->getVar('table_name'); - $ret = << - <{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'); - $fieldElement = $fields[$f]->getVar('field_element'); - $rpFieldName = $this->getRightString($fieldName); - if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $ret .= <<\t\t\n -EOT; - break; - case 10: - $ret .= <<{$tableName}\n -EOT; - break; - case 13: - $ret .= <<{$tableName}\n -EOT; - break; - default: - $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; - break; - } - } - } - $ret .= << - <{/foreach}> - -
    \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserRateBodyFieldnameEmpty - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, $language) - { - $tableName = $table->getVar('table_name'); - $ret = << - <{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'); - $fieldElement = $fields[$f]->getVar('field_element'); - if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $ret .= <<\n -EOT; - break; - case 13: - $ret .= <<{$tableName}\n -EOT; - break; - default: - $ret .= <<<{\$list.{$fieldName}}>\n -EOT; - break; - } - } - } - $ret .= << - <{/foreach}> - -\n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserRateFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserRateFooter($moduleDirname) - { - $ret = << -EOT; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserRateHeader($moduleDirname, $table, $language); - // Verify if table_fieldname is not empty - if (!empty($tableFieldname)) { - $content .= $this->getTemplatesUserRateBody($moduleDirname, $table, $language); - } else { - $content .= $this->getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, $language); - } - $content .= $this->getTemplatesUserRateFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Rss.php b/class/Files/Templates/user/Rss.php deleted file mode 100644 index 444b0c8e..00000000 --- a/class/Files/Templates/user/Rss.php +++ /dev/null @@ -1,132 +0,0 @@ -setModule($module); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserRssXml - * @param null - * @return string - */ - 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; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserRssXml(); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Search.php b/class/Files/Templates/user/Search.php deleted file mode 100644 index 7d91377f..00000000 --- a/class/Files/Templates/user/Search.php +++ /dev/null @@ -1,251 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserSearchHeader - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserSearchHeader($moduleDirname, $table, $language) - { - $ret = << - - - \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; - } - } - $ret .= << - \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserSearchBody - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserSearchBody($moduleDirname, $table, $language) - { - $tableName = $table->getVar('table_name'); - $ret = << - <{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'); - $fieldElement = $fields[$f]->getVar('field_element'); - $rpFieldName = $this->getRightString($fieldName); - if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $ret .= <<\t\t\n -EOT; - break; - case 10: - $ret .= <<{$tableName}\n -EOT; - break; - case 13: - $ret .= <<{$tableName}\n -EOT; - break; - default: - $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; - break; - } - } - } - $ret .= << - <{/foreach}> - -
    \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserSearchBodyFieldnameEmpty - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table, $language) - { - $tableName = $table->getVar('table_name'); - $ret = << - <{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'); - $fieldElement = $fields[$f]->getVar('field_element'); - if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $ret .= <<\n -EOT; - break; - case 13: - $ret .= <<{$tableName}\n -EOT; - break; - default: - $ret .= <<<{\$list.{$fieldName}}>\n -EOT; - break; - } - } - } - $ret .= << - <{/foreach}> - -\n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserSearchFooter - * @param string $moduleDirname - * @return string - */ - private function getTemplatesUserSearchFooter($moduleDirname) - { - $ret = << -EOT; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserSearchHeader($moduleDirname, $table, $language); - // Verify if table_fieldname is not empty - if (!empty($tableFieldname)) { - $content .= $this->getTemplatesUserSearchBody($moduleDirname, $table, $language); - } else { - $content .= $this->getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table, $language); - } - $content .= $this->getTemplatesUserSearchFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Single.php b/class/Files/Templates/user/Single.php deleted file mode 100644 index 86daffee..00000000 --- a/class/Files/Templates/user/Single.php +++ /dev/null @@ -1,141 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserSingleHeader - * @param $moduleDirname - * @return string - */ - private function getTemplatesUserSingleHeader($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $sc->getSmartyIncludeFile($moduleDirname); - - return $ret; - } - - /** - * @private function getTemplatesUserSingleBody - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserSingleBody($moduleDirname, $table, $language) - { - $tableName = $table->getVar('table_name'); - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $ret = ''; - $ret .= $hc->getHtmlEmpty('', '',"\n"); - $content = $hc->getHtmlHNumb('Services Panels', '2', 'page-header', "\t\t\t"); - $collg12 = $hc->getHtmlDiv($content, 'col-lg-12', "\t\t"); - $row = $hc->getHtmlDiv($collg12, 'row', "\t"); - $ret .= $hc->getHtmlDiv($row, 'container'); - $ret .= $hc->getHtmlEmpty('', '',"\n"); - - return $ret; - } - - /** - * @private function getTemplatesUserSingleFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserSingleFooter($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $sc->getSmartyIncludeFile($moduleDirname, 'footer'); - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserSingleHeader($moduleDirname); - $content .= $this->getTemplatesUserSingleBody($moduleDirname, $table, $language); - $content .= $this->getTemplatesUserSingleFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/Submit.php b/class/Files/Templates/user/Submit.php deleted file mode 100644 index 29f89de1..00000000 --- a/class/Files/Templates/user/Submit.php +++ /dev/null @@ -1,151 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserSubmitHeader - * @param $moduleDirname - * @return string - */ - private function getTemplatesUserSubmitHeader($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'header'); - } - - /** - * @private function getTemplatesUserSubmit - * @param string $moduleDirname - * @param string $language - * - * @return string - */ - private function getTemplatesUserSubmit($moduleDirname, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - $const = $sc->getSmartyConst($language, 'SUBMIT_SUBMITONCE'); - $li = $hc->getHtmlLi($const, '',"\t\t"); - $const = $sc->getSmartyConst($language, 'SUBMIT_ALLPENDING'); - $li .= $hc->getHtmlLi($const, '',"\t\t"); - $const = $sc->getSmartyConst($language, 'SUBMIT_DONTABUSE'); - $li .= $hc->getHtmlLi($const, '',"\t\t"); - $const = $sc->getSmartyConst($language, 'SUBMIT_TAKEDAYS'); - $li .= $hc->getHtmlLi($const, '',"\t\t"); - $ul = $hc->getHtmlUl($li, '', "\t"); - - $ret = $hc->getHtmlEmpty('', '',"\n"); - $ret .= $hc->getHtmlDiv($ul, $moduleDirname . '-tips'); - $single = $sc->getSmartySingleVar('message_error'); - $divError = $hc->getHtmlDiv($single, 'errorMsg', "\t", "\n", false); - $ret .= $sc->getSmartyConditions('message_error', ' != ', '\'\'', $divError); - $single = $sc->getSmartySingleVar('form', "\t", "\n"); - $ret .= $hc->getHtmlDiv($single, $moduleDirname . '-submitform'); - $ret .= $hc->getHtmlEmpty('', '',"\n"); - - return $ret; - } - - /** - * @private function getTemplatesUserSubmitFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserSubmitFooter($moduleDirname) - { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - //$table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - //$tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserSubmitHeader($moduleDirname); - $content .= $this->getTemplatesUserSubmit($moduleDirname, $language); - $content .= $this->getTemplatesUserSubmitFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/Templates/user/UserPrint.php b/class/Files/Templates/user/UserPrint.php deleted file mode 100644 index ca2afc2d..00000000 --- a/class/Files/Templates/user/UserPrint.php +++ /dev/null @@ -1,248 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesUserPrintHeader - * @param string $moduleDirname - * @param string $table - * @param string $language - * - * @return string - */ - private function getTemplatesUserPrintHeader($moduleDirname, $table, $language) - { - $ret = << - - - \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; - } - } - $ret .= << - \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserPrintBody - * @param string $moduleDirname - * @param string $table - * @return string - */ - private function getTemplatesUserPrintBody($moduleDirname, $table) - { - $tableName = $table->getVar('table_name'); - $ret = << - <{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'); - $fieldElement = $fields[$f]->getVar('field_element'); - $rpFieldName = $this->getRightString($fieldName); - if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $ret .= <<\t\t\n -EOT; - break; - case 10: - $ret .= <<{$tableName}\n -EOT; - break; - case 13: - $ret .= <<{$tableName}\n -EOT; - break; - default: - $ret .= <<<{\$list.{$rpFieldName}}>\n -EOT; - break; - } - } - } - $ret .= << - <{/foreach}> - -
    \n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserPrintBodyFieldnameEmpty - * @param string $moduleDirname - * @param $table - * @return string - */ - private function getTemplatesUserPrintBodyFieldnameEmpty($moduleDirname, $table) - { - $tableName = $table->getVar('table_name'); - $ret = << - <{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'); - $fieldElement = $fields[$f]->getVar('field_element'); - if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { - switch ($fieldElement) { - case 9: - $ret .= <<\n -EOT; - break; - case 13: - $ret .= <<{$tableName}\n -EOT; - break; - default: - $ret .= <<<{\$list.{$fieldName}}>\n -EOT; - break; - } - } - } - $ret .= << - <{/foreach}> - -\n -EOT; - - return $ret; - } - - /** - * @private function getTemplatesUserPrintFooter - * @param string $moduleDirname - * - * @return string - */ - private function getTemplatesUserPrintFooter($moduleDirname) - { - $ret = << -EOT; - - return $ret; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getTemplatesUserPrintHeader($moduleDirname, $table, $language); - // Verify if table_fieldname is not empty - if (!empty($tableFieldname)) { - $content .= $this->getTemplatesUserPrintBody($moduleDirname, $table); - } else { - $content .= $this->getTemplatesUserPrintBodyFieldnameEmpty($moduleDirname, $table); - } - $content .= $this->getTemplatesUserPrintFooter($moduleDirname); - - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/files/templates/user/index.html b/class/files/templates/user/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/templates/user/index.html +++ /dev/null @@ -1 +0,0 @@ - From c2d2e039f4a60b6154adb47dc75522c8eb154aec Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 4 May 2020 16:37:33 +0200 Subject: [PATCH 005/266] preparation for new tpl styles --- class/Files/CreateArchitecture.php | 85 +++- .../Blocks/Defstyle/TemplatesBlocks.php | 241 +++++++++++ .../Templates/Blocks/Defstyle/index.html | 1 + .../Templates/User/Defstyle/Breadcrumbs.php | 100 +++++ .../Files/Templates/User/Defstyle/Broken.php | 198 +++++++++ .../Templates/User/Defstyle/Categories.php | 248 +++++++++++ .../User/Defstyle/CategoriesList.php | 307 ++++++++++++++ .../Files/Templates/User/Defstyle/Footer.php | 145 +++++++ .../Files/Templates/User/Defstyle/Header.php | 133 ++++++ class/Files/Templates/User/Defstyle/Index.php | 387 ++++++++++++++++++ .../Templates/User/Defstyle/MoreFiles.php | 110 +++++ class/Files/Templates/User/Defstyle/Pages.php | 216 ++++++++++ .../Templates/User/Defstyle/PagesList.php | 191 +++++++++ class/Files/Templates/User/Defstyle/Pdf.php | 102 +++++ class/Files/Templates/User/Defstyle/Rate.php | 252 ++++++++++++ class/Files/Templates/User/Defstyle/Rss.php | 132 ++++++ .../Files/Templates/User/Defstyle/Search.php | 251 ++++++++++++ .../Files/Templates/User/Defstyle/Single.php | 141 +++++++ .../Files/Templates/User/Defstyle/Submit.php | 151 +++++++ .../Templates/User/Defstyle/UserPrint.php | 248 +++++++++++ .../Files/Templates/User/Defstyle/index.html | 1 + class/Files/Templates/User/index.html | 1 + docs/changelog.txt | 1 + 23 files changed, 3628 insertions(+), 14 deletions(-) create mode 100644 class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php create mode 100644 class/Files/Templates/Blocks/Defstyle/index.html create mode 100644 class/Files/Templates/User/Defstyle/Breadcrumbs.php create mode 100644 class/Files/Templates/User/Defstyle/Broken.php create mode 100644 class/Files/Templates/User/Defstyle/Categories.php create mode 100644 class/Files/Templates/User/Defstyle/CategoriesList.php create mode 100644 class/Files/Templates/User/Defstyle/Footer.php create mode 100644 class/Files/Templates/User/Defstyle/Header.php create mode 100644 class/Files/Templates/User/Defstyle/Index.php create mode 100644 class/Files/Templates/User/Defstyle/MoreFiles.php create mode 100644 class/Files/Templates/User/Defstyle/Pages.php create mode 100644 class/Files/Templates/User/Defstyle/PagesList.php create mode 100644 class/Files/Templates/User/Defstyle/Pdf.php create mode 100644 class/Files/Templates/User/Defstyle/Rate.php create mode 100644 class/Files/Templates/User/Defstyle/Rss.php create mode 100644 class/Files/Templates/User/Defstyle/Search.php create mode 100644 class/Files/Templates/User/Defstyle/Single.php create mode 100644 class/Files/Templates/User/Defstyle/Submit.php create mode 100644 class/Files/Templates/User/Defstyle/UserPrint.php create mode 100644 class/Files/Templates/User/Defstyle/index.html create mode 100644 class/Files/Templates/User/index.html diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index ae9014b1..55c03945 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -202,6 +202,7 @@ public function setFilesToBuilding($module) $tables = $tf->getTableTables($modId); $files = $tf->getTableMoreFiles($modId); $ret = []; + $templateType = 'defstyle'; $table = null; $tableCategory = []; @@ -271,7 +272,11 @@ public function setFilesToBuilding($module) $blocksFiles->write($module, $table, $tableName . '.php'); $ret[] = $blocksFiles->render(); // Templates Blocks Files - $templatesBlocks = Tdmcreate\Files\Templates\Blocks\TemplatesBlocks::getInstance(); + if ($templateType == 'bootstrap') { + $templatesBlocks = Tdmcreate\Files\Templates\Blocks\Bootstrap\TemplatesBlocks::getInstance(); + } else { + $templatesBlocks = Tdmcreate\Files\Templates\Blocks\Defstyle\TemplatesBlocks::getInstance(); + } $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl'); $ret[] = $templatesBlocks->render(); } @@ -296,11 +301,19 @@ public function setFilesToBuilding($module) $userPages->write($module, $table, $tableName . '.php'); $ret[] = $userPages->render(); // User Templates File - $userTemplatesPages = Tdmcreate\Files\Templates\User\Pages::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesPages = Tdmcreate\Files\Templates\User\Bootstrap\Pages::getInstance(); + } else { + $userTemplatesPages = Tdmcreate\Files\Templates\User\Defstyle\Pages::getInstance(); + } $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl'); $ret[] = $userTemplatesPages->render(); // User List Templates File - $userTemplatesPagesList = Tdmcreate\Files\Templates\User\PagesList::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesPagesList = Tdmcreate\Files\Templates\User\Bootstrap\PagesList::getInstance(); + } else { + $userTemplatesPagesList = Tdmcreate\Files\Templates\User\Defstyle\PagesList::getInstance(); + } $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl'); $ret[] = $userTemplatesPagesList->render(); if (1 === (int)$tables[$t]->getVar('table_category')) { @@ -488,15 +501,27 @@ public function setFilesToBuilding($module) if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) { // Creation of user template files // Templates Index File - $userTemplatesIndex = Tdmcreate\Files\Templates\User\Index::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesIndex = Tdmcreate\Files\Templates\User\Bootstrap\Index::getInstance(); + } else { + $userTemplatesIndex = Tdmcreate\Files\Templates\User\Defstyle\Index::getInstance(); + } $userTemplatesIndex->write($module, $table, $tables, $moduleDirname . '_index.tpl'); $ret[] = $userTemplatesIndex->render(); // Templates Footer File - $userTemplatesFooter = Tdmcreate\Files\Templates\User\Footer::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesFooter = Tdmcreate\Files\Templates\User\Bootstrap\Footer::getInstance(); + } else { + $userTemplatesFooter = Tdmcreate\Files\Templates\User\Defstyle\Footer::getInstance(); + } $userTemplatesFooter->write($module, $table, $moduleDirname . '_footer.tpl'); $ret[] = $userTemplatesFooter->render(); // Templates Header File - $userTemplatesHeader = Tdmcreate\Files\Templates\User\Header::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesHeader = Tdmcreate\Files\Templates\User\Bootstrap\Header::getInstance(); + } else { + $userTemplatesHeader = Tdmcreate\Files\Templates\User\Defstyle\Header::getInstance(); + } $userTemplatesHeader->write($module, $moduleDirname . '_header.tpl'); $ret[] = $userTemplatesHeader->render(); @@ -521,7 +546,11 @@ public function setFilesToBuilding($module) $userBroken->write($module, $table, 'broken.php'); $ret[] = $userBroken->render(); // User Templates Broken File - $userTemplatesBroken = Templates\User\Broken::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesBroken = Tdmcreate\Files\Templates\User\Bootstrap\Broken::getInstance(); + } else { + $userTemplatesBroken = Tdmcreate\Files\Templates\User\Defstyle\Broken::getInstance(); + } $userTemplatesBroken->write($module, $table, $moduleDirname . '_broken.tpl'); $ret[] = $userTemplatesBroken->render(); } @@ -531,7 +560,11 @@ public function setFilesToBuilding($module) $userPdf->write($module, $table, 'pdf.php'); $ret[] = $userPdf->render(); // User Templates Pdf File - $userTemplatesPdf = Tdmcreate\Files\Templates\User\Pdf::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesPdf = Tdmcreate\Files\Templates\User\Bootstrap\Pdf::getInstance(); + } else { + $userTemplatesPdf = Tdmcreate\Files\Templates\User\Defstyle\Pdf::getInstance(); + } $userTemplatesPdf->write($module, $moduleDirname . '_pdf.tpl'); $ret[] = $userTemplatesPdf->render(); } @@ -541,7 +574,11 @@ public function setFilesToBuilding($module) $userPrint->write($module, $table, 'print.php'); $ret[] = $userPrint->render(); // User Templates Print File - $userTemplatesPrint = Tdmcreate\Files\Templates\User\UserPrint::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesPrint = Tdmcreate\Files\Templates\User\Bootstrap\UserPrint::getInstance(); + } else { + $userTemplatesPrint = Tdmcreate\Files\Templates\User\Defstyle\UserPrint::getInstance(); + } $userTemplatesPrint->write($module, $table, $moduleDirname . '_print.tpl'); $ret[] = $userTemplatesPrint->render(); } @@ -552,7 +589,11 @@ public function setFilesToBuilding($module) $userRate->write($module, $table, 'rate.php'); $ret[] = $userRate->render(); // User Templates Rate File - $userTemplatesRate = Tdmcreate\Files\Templates\User\Rate::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesRate = Tdmcreate\Files\Templates\User\Bootstrap\Rate::getInstance(); + } else { + $userTemplatesRate = Tdmcreate\Files\Templates\User\Defstyle\Rate::getInstance(); + } $userTemplatesRate->write($module, $table, $moduleDirname . '_rate.tpl'); $ret[] = $userTemplatesRate->render(); } @@ -563,7 +604,11 @@ public function setFilesToBuilding($module) $userRss->write($module, $table, 'rss.php'); $ret[] = $userRss->render(); // User Templates Rss File - $userTemplatesRss = Tdmcreate\Files\Templates\User\Rss::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesRss = Tdmcreate\Files\Templates\User\Bootstrap\Rss::getInstance(); + } else { + $userTemplatesRss = Tdmcreate\Files\Templates\User\Defstyle\Rss::getInstance(); + } $userTemplatesRss->write($module, $moduleDirname . '_rss.tpl'); $ret[] = $userTemplatesRss->render(); } @@ -573,7 +618,11 @@ public function setFilesToBuilding($module) $userSingle->write($module, $table, 'single.php'); $ret[] = $userSingle->render(); // User Templates Single File - $userTemplatesSingle = Tdmcreate\Files\Templates\User\Single::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesSingle = Tdmcreate\Files\Templates\User\Bootstrap\Single::getInstance(); + } else { + $userTemplatesSingle = Tdmcreate\Files\Templates\User\Defstyle\Single::getInstance(); + } $userTemplatesSingle->write($module, $table, $moduleDirname . '_single.tpl'); $ret[] = $userTemplatesSingle->render(); } @@ -584,7 +633,11 @@ public function setFilesToBuilding($module) $userSubmit->write($module, $table, 'submit.php'); $ret[] = $userSubmit->render(); // User Templates Submit File - $userTemplatesSubmit = Tdmcreate\Files\Templates\User\Submit::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesSubmit = Tdmcreate\Files\Templates\User\Bootstrap\Submit::getInstance(); + } else { + $userTemplatesSubmit = Tdmcreate\Files\Templates\User\Defstyle\Submit::getInstance(); + } $userTemplatesSubmit->write($module, $table, $moduleDirname . '_submit.tpl'); $ret[] = $userTemplatesSubmit->render(); } @@ -613,7 +666,11 @@ public function setFilesToBuilding($module) $languageMain->write($module, $tables, 'main.php'); $ret[] = $languageMain->render(); // User Templates Submit File - $userTemplatesUserBreadcrumbs = Templates\User\Breadcrumbs::getInstance(); + if ($templateType == 'bootstrap') { + $userTemplatesUserBreadcrumbs = Tdmcreate\Files\Templates\User\Bootstrap\Breadcrumbs::getInstance(); + } else { + $userTemplatesUserBreadcrumbs = Tdmcreate\Files\Templates\User\Defstyle\Breadcrumbs::getInstance(); + } $userTemplatesUserBreadcrumbs->write($module, $moduleDirname . '_breadcrumbs.tpl'); $ret[] = $userTemplatesUserBreadcrumbs->render(); } diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php new file mode 100644 index 00000000..47b46447 --- /dev/null +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -0,0 +1,241 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesBlocksTableThead + * @param $tableId + * @param $tableMid + * @param string $language + * @param $tableAutoincrement + * @return string + */ + private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $th = ''; + if (1 == $tableAutoincrement) { + $th .= $hc->getHtmlTableHead(' ', '', '', "\t\t\t"); + } + $fields = $this->getTableFields($tableMid, $tableId); + foreach (array_keys($fields) as $f) { + if (1 === (int)$fields[$f]->getVar('field_block')) { + $fieldName = $fields[$f]->getVar('field_name'); + $stuFieldName = mb_strtoupper($fieldName); + $lang = $sc->getSmartyConst($language, $stuFieldName); + $th .= $hc->getHtmlTableHead($lang, 'center', '', "\t\t\t"); + } + } + $tr = $hc->getHtmlTableRow($th, 'head', "\t\t"); + + return $hc->getHtmlTableThead($tr, '', "\t"); + } + + /** + * @private function getTemplatesBlocksTableTbody + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @return string + */ + private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $td = ''; + if (1 == $tableAutoincrement) { + $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); + $td .= $hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + } + $fields = $this->getTableFields($tableMid, $tableId); + foreach (array_keys($fields) as $f) { + if (1 === (int)$fields[$f]->getVar('field_block')) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if (1 == $fields[$f]->getVar('field_inlist')) { + switch ($fieldElement) { + case 9: + // This is to be reviewed, as it was initially to style = "backgroung-color: #" + // Now with HTML5 is not supported inline style in the parameters of the HTML tag + // Old code was ... + $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $span = $hc->getHtmlTag('span', [], $double); + $td .= $hc->getHtmlTableData($span, 'center', '', "\t\t\t"); + /*$ret .= <<    \n + EOT;*/ + break; + case 10: + $src = $sc->getSmartyNoSimbol('xoModuleIcons32'); + $src .= $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); + $td .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t"); + break; + case 13: + $single = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName], '', true, '', ''); + $td .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t"); + break; + default: + if (0 != $f) { + $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $td .= $hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + } + break; + } + } + } + } + // TODO: allow edit only for admins + // $lang = $sc->getSmartyConst('', '_EDIT'); + // $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); + // $src = $sc->getSmartyNoSimbol('xoModuleIcons32 edit.png'); + // $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); + // $anchor = $hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); + // $lang = $sc->getSmartyConst('', '_DELETE'); + // $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); + // $src = $sc->getSmartyNoSimbol('xoModuleIcons32 delete.png'); + // $img = $hc->getHtmlTag('img', ['src' => $src . $double, 'alt' => $tableName], '', true, '', ''); + // $anchor .= $hc->getHtmlTag('a', ['href' => $tableName . ".php?op=delete&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); + // $td .= $hc->getHtmlTag('td', ['class' => 'center'], "\n" . $anchor . "\t\t\t", false, "\t\t\t"); + $cycle = $sc->getSmartyNoSimbol('cycle values="odd, even"'); + $tr = $hc->getHtmlTableRow($td, $cycle, "\t\t"); + $foreach = $sc->getSmartyForeach($tableSoleName, 'block', $tr, '','', "\t\t"); + $tbody = $hc->getHtmlTableTbody($foreach,'' , "\t"); + + return $sc->getSmartyConditions("block", '', '', $tbody, false, true, true, "\t"); + } + + /** + * @private function getTemplatesBlocksTfoot + * @return string + */ + private function getTemplatesBlocksTableTfoot() + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $td = $hc->getHtmlTag('td', [], " ", false, '', ''); + $tr = $hc->getHtmlTag('tr', [], $td, false, '', ''); + + return $hc->getHtmlTag('tfoot', [], $tr, false, "\t"); + } + + /** + * @private function getTemplatesBlocksTable + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param string $language + * @return string + */ + private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $tbody = $this->getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement); + $tbody .= $this->getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement); + $tbody .= $this->getTemplatesBlocksTableTfoot(); + $single = $sc->getSmartySingleVar('table_type'); + + return $hc->getHtmlTable($tbody, 'table table-' . $single); + } + + /** + * @public function render + * @param null + * + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableAutoincrement = $table->getVar('table_autoincrement'); + $language = $this->getLanguage($moduleDirname, 'MB'); + $content = $this->getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); + + $this->create($moduleDirname, 'templates/blocks', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/Blocks/Defstyle/index.html b/class/Files/Templates/Blocks/Defstyle/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/class/Files/Templates/Blocks/Defstyle/index.html @@ -0,0 +1 @@ + diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php new file mode 100644 index 00000000..b3c4de44 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -0,0 +1,100 @@ +setModule($module); + $this->setFileName($filename); + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tf = Tdmcreate\Files\CreateFile::getInstance(); + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $title = $sc->getSmartyDoubleVar('itm', 'title'); + $titleElse = $sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n") ; + $link = $sc->getSmartyDoubleVar('itm', 'link'); + $glyph = $hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home'], '', false, '', ''); + $anchor = $hc->getHtmlAnchor('<{xoAppUrl index.php}>', $glyph, 'home'); + $into = $hc->getHtmlLi($anchor, 'bc-item', "\t"); + $anchorIf = $hc->getHtmlAnchor($link, $title, $title, '', '', '', "\t\t\t", "\n"); + $breadcrumb = $sc->getSmartyConditions('itm.link', '', '', $anchorIf, $titleElse, false, false, "\t\t", "\n"); + $foreach = $hc->getHtmlLi($breadcrumb, 'bc-item', "\t", "\n", true); + $into .= $sc->getSmartyForeach('itm', 'xoBreadcrumbs', $foreach, 'bcloop', '', "\t"); + + $content = $hc->getHtmlOl($into, 'breadcrumb'); + + $tf->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $tf->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Broken.php b/class/Files/Templates/User/Defstyle/Broken.php new file mode 100644 index 00000000..e200170d --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Broken.php @@ -0,0 +1,198 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserBrokenFileHeader + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserBrokenFileHeader($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'header'); + } + + /** + * @private function getTemplatesUserBrokenTableHead + * @param $tableMid + * @param $tableId + * @param $tableAutoincrement + * @param $language + * @return string + */ + private function getTemplatesUserBrokenTableHead($tableMid, $tableId, $tableAutoincrement, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $th = ''; + $fields = $this->getTableFields($tableMid, $tableId); + foreach (array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $stuFieldName = mb_strtoupper($fieldName); + if ((1 == $tableAutoincrement) || (1 == $fields[$f]->getVar('field_user'))) { + $const = $sc->getSmartyConst($language, $stuFieldName); + $th .= $hc->getHtmlTag('th', ['class' => 'center'], $const, '', "\t\t\t"); + } + } + $tr = $hc->getHtmlTableRow($th, 'head',"\t\t"); + + return $hc->getHtmlTableThead($tr, 'outer', "\t"); + } + + /** + * @private function getTemplatesUserBrokenBody + * @param $moduleDirname + * @param $tableMid + * @param $tableId + * @param $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @return string + */ + private function getTemplatesUserBrokenBody($moduleDirname, $tableMid, $tableId, $tableName, $tableSoleName, $tableAutoincrement) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = ''; + $fields = $this->getTableFields($tableMid, $tableId); + foreach (array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if ((1 == $tableAutoincrement) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $span = $hc->getHtmlSpan("<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\${$tableSoleName}.{$rpFieldName}}>", "#<{\${$tableSoleName}.{$rpFieldName}}>"); + $ret .= $hc->getHtmlTableData($span, 'center', '', "\t\t\t"); + break; + case 10: + $img = $hc->getHtmlImage("<{xoModuleIcons32}><{\${$tableSoleName}.{$rpFieldName}}>", $tableName); + $ret .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t"); + break; + case 13: + $img = $hc->getHtmlImage("<{\${$moduleDirname}_upload_url}>/images/{$tableName}/<{\${$tableSoleName}.{$rpFieldName}}>", $tableName); + $ret .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t") ; + break; + default: + $ret .= $hc->getHtmlTableData("<{\${$tableSoleName}.{$rpFieldName}}>", 'center', '', "\t\t\t") ; + break; + } + } + } + $row = $hc->getHtmlTableRow($ret, '<{cycle values="odd, even"}>',"\t\t") ; + $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $row, '', '', "\t\t"); + + return $hc->getHtmlTableTbody($foreach, '', "\t"); + } + + /** + * @private function getTemplatesUserBrokenFileFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserBrokenFileFooter($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); + } + + /** + * @public function render + * @return bool|string + */ + public function render() + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableAutoincrement = $table->getVar('table_autoincrement'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserBrokenFileHeader($moduleDirname); + $contentTable = $this->getTemplatesUserBrokenTableHead($tableMid, $tableId, $tableAutoincrement, $language); + $contentTable .= $this->getTemplatesUserBrokenBody($moduleDirname, $tableMid, $tableId, $tableName, $tableSoleName, $tableAutoincrement); + $content .= $hc->getHtmlTable($contentTable, 'table table-bordered'); + $content .= $this->getTemplatesUserBrokenFileFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php new file mode 100644 index 00000000..4763d59f --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -0,0 +1,248 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserCategoriesHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserCategoriesHeader($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'header') . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesTable + * @param string $language + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $single = $sc->getSmartySingleVar('table_type'); + $table = $this->getTemplatesAdminPagesTableThead($tableName, $language); + $table .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $language); + + return $hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesThead + * @param string $language + * @param $tableName + * @return string + */ + private function getTemplatesUserCategoriesThead($tableName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $stuTableName = mb_strtoupper($tableName); + $lang = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); + $single = $sc->getSmartySingleVar('numb_col'); + $th = $hc->getHtmlTableHead($lang, '', $single) . PHP_EOL; + $tr = $hc->getHtmlTableRow($th, 'head') . PHP_EOL; + + return $hc->getHtmlTableThead($tr) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesTbody + * @param string $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $single = $sc->getSmartySingleVar('panel_type'); + $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); + $div = $hc->getHtmlDiv($include, 'panel panel-' . $single); + $cont = $hc->getHtmlTableData($div) . PHP_EOL; + $html = $hc->getHtmlEmpty('') . PHP_EOL; + $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html) . PHP_EOL; + $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; + $tr = $hc->getHtmlTableRow($foreach) . PHP_EOL; + + return $hc->getHtmlTableTbody($tr) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesTfoot + * @return string + */ + private function getTemplatesUserCategoriesTfoot() + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $td = $hc->getHtmlTableData(' ') . PHP_EOL; + $tr = $hc->getHtmlTableRow($td) . PHP_EOL; + + return $hc->getHtmlTableTfoot($tr) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategories + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $tab = $this->getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) . PHP_EOL; + $div = $hc->getHtmlDiv($tab, 'table-responsive') . PHP_EOL; + + return $sc->getSmartyConditions($tableName, ' gt ', '0', $div, false, true) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesPanel + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language) + { + $stuTableName = mb_strtoupper($tableName); + /*$ret = << +
    <{\$smarty.const.{$language}{$stuTableName}_TITLE}>
    + <{foreach item={$tableSoleName} from=\${$tableName}}> +
    + <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableSoleName}}> + <{if \${$tableSoleName}.count is div by \$numb_col}> +
    + <{/if}> +
    + <{/foreach}> +\n +EOT;*/ + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $incl = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; + $html = $hc->getHtmlEmpty('
    ') . PHP_EOL; + $incl .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$numb_col', $html) . PHP_EOL; + $const = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); + $div = $hc->getHtmlDiv($const, 'panel-heading') . PHP_EOL; + $cont = $hc->getHtmlDiv($incl, 'panel panel-body') . PHP_EOL; + $div .= $sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; + $panelType = $sc->getSmartySingleVar('panel_type'); + + return $hc->getHtmlDiv($div, 'panel panel-' . $panelType) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserCategoriesFooter($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); + } + + /** + * @public function render + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserCategoriesHeader($moduleDirname); + $content .= $this->getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language); + $content .= $this->getTemplatesUserCategoriesFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php new file mode 100644 index 00000000..e82857f7 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -0,0 +1,307 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserCategoriesListHeader + * @return string + */ + private function getTemplatesUserCategoriesListStartTable() + { + $ret = << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserCategoriesListThead + * @param $table + * @return string + */ + private function getTemplatesUserCategoriesListThead($table) + { + $ret = << + \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')) { + if (1 == $fields[$f]->getVar('field_thead')) { + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $ret .= <<<{\$list.{$rpFieldName}}>\n +EOT; + } + } + } + $ret .= << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserCategoriesListTbody + * @param string $moduleDirname + * @param string $table + * + * @return string + */ + private function getTemplatesUserCategoriesListTbody($moduleDirname, $table) + { + $tableName = $table->getVar('table_name'); + $ret = << + \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'); + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_tbody')) { + switch ($fieldElement) { + default: + case 10: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $ret .= <<{$tableName}\n +EOT; + break; + case 13: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $ret .= <<{$tableName}\n +EOT; + break; + case 2: + case 3: + case 4: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $ret .= <<<{\$list.{$rpFieldName}}>\n +EOT; + break; + } + } + } + } + $ret .= << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserCategoriesListTfoot + * @param string $table + * @return string + */ + private function getTemplatesUserCategoriesListTfoot($table) + { + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $ret = << + \n +EOT; + + foreach (array_keys($fields) as $f) { + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_tfoot')) { + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $ret .= <<<{\$list.{$rpFieldName}}>\n +EOT; + } + } + } + $ret .= << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserCategoriesListEndTable + * @param null + * + * @return string + */ + private function getTemplatesUserCategoriesListEndTable() + { + $ret = << +\n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserCategoriesListPanel + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $fields = $this->getTableFields($tableMid, $tableId); + $ret = ''; + $retElem = ''; + foreach (array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_tbody')) { + switch ($fieldElement) { + default: + case 2: + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-2') . PHP_EOL; + break; + case 3: + case 4: + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-3 justify') . PHP_EOL; + break; + case 10: + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retElem .= $hc->getHtmlSpan($img, 'col-sm-3') . PHP_EOL; + unset($img); + break; + case 13: + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); + $retElem .= $hc->getHtmlSpan($img, 'col-sm-3') . PHP_EOL; + unset($img); + break; + } + } + } + } + $ret .= $hc->getHtmlDiv($retElem, 'panel-body') . PHP_EOL; + + return $ret; + } + + /** + * @public function render + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = ''; + foreach (array_keys($tables) as $t) { + $tableId = $tables[$t]->getVar('table_id'); + $tableMid = $tables[$t]->getVar('table_mid'); + $tableName = $tables[$t]->getVar('table_name'); + $tableSoleName = $tables[$t]->getVar('table_solename'); + $tableCategory[] = $tables[$t]->getVar('table_category'); + if (in_array(1, $tableCategory)) { + $content .= $this->getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); + } + } + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php new file mode 100644 index 00000000..8d2539a5 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -0,0 +1,145 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @public function getTemplateUserFooterFacebookLikeButton + * @param null + * + * @return bool|string + */ + public function getTemplateUserFooterFacebookLikeButton() + { + return "
  • "; + } + + /** + * @public function getTemplateUserFooterFacebookShareButton + * @param null + * + * @return bool|string + */ + public function getTemplateUserFooterFacebookShareButton() + { + return "
  • "; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + private function getTemplateUserFooterContent($moduleDirname, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = $hc->getHtmlDiv('<{$copyright}>', 'pull-left', '', "\n", false); + $ret .= $hc->getHtmlEmpty("\n"); + $contIf = $hc->getHtmlDiv('<{$pagenav}>', 'pull-right', "\t", "\n", false); + $ret .= $sc->getSmartyConditions('pagenav', ' != ', "''", $contIf); + $ret .= $hc->getHtmlEmpty("
    \n"); + $contIf = $hc->getHtmlDiv("<{\$smarty.const.{$language}ADMIN}>", 'text-center bold', "\t", "\n", false); + $ret .= $sc->getSmartyConditions('xoops_isadmin', ' != ', "''", $contIf); + $ret .= $hc->getHtmlEmpty("\n"); + $contIf = $sc->getSmartyIncludeFile('system_comments','flat',false, false,"\t\t\t"); + $contIf .= $this->getSimpleString('<{elseif $comment_mode == "thread"}>',"\t\t"); + $contIf .= $sc->getSmartyIncludeFile('system_comments','thread',false, false,"\t\t\t"); + $contIf .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>',"\t\t"); + $contIf .= $sc->getSmartyIncludeFile('system_comments','nest',false, false,"\t\t\t"); + $contDiv = $sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '','',"\t\t"); + $contIf = $hc->getHtmlDiv($contDiv, 'pad2 marg2', "\t", "\n", true); + $ret .= $sc->getSmartyConditions('comment_mode', '', '', $contIf); + + return $ret; + } + + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplateUserFooterContent($moduleDirname, $language); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php new file mode 100644 index 00000000..1c03d287 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -0,0 +1,133 @@ +tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); + $this->htmlcode = Tdmcreate\Files\CreateHtmlCode::getInstance(); + } + + /** + * @static function getInstance + * @param null + * @return Header + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param string $module + * @param string $filename + */ + public function write($module, $filename) + { + $this->setModule($module); + $this->setFileName($filename); + } + + /** + * @public function getTemplatesUserHeader + * @param $moduleDirname + * @return bool|string + */ + public function getTemplatesUserHeader($moduleDirname) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = $sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, true, '', "\n\n"); + $var = $sc->getSmartySingleVar('ads', '', ''); + $div = $hc->getHtmlDiv($var, 'center', "\t","\n", false) ; + $ret .= $sc->getSmartyConditions('ads', ' != ', '\'\'', $div); + + return $ret; + } + + /** + * @public function getTemplateFooterFacebbokSDK + * @param null + * + * @return bool|string + */ + public function getTemplateUserHeaderFacebbokSDK() + { + $ret = <<<'EOT' + +
    + +EOT; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + //$language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserHeader($moduleDirname); + + $this->tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->tdmcfile->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php new file mode 100644 index 00000000..7f254704 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -0,0 +1,387 @@ +setModule($module); + $this->setTable($table); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @public function getTemplateUserIndexHeader + * @param $moduleDirname + * @return bool|string + */ + public function getTemplateUserIndexHeader($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); + } + + /** + * @private function getTemplatesUserIndexTable + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $single = $sc->getSmartySingleVar('table_type'); + $table = $this->getTemplatesUserIndexTableThead($tableName, $language); + $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); + + return $hc->getHtmlTable($table, 'table table-' . $single); + } + + /** + * @private function getTemplatesUserIndexThead + * @param string $language + * @param $tableName + * @return string + */ + private function getTemplatesUserIndexTableThead($tableName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $stuTableName = mb_strtoupper($tableName); + $lang = $sc->getSmartyConst($language, $stuTableName); + $col = $sc->getSmartySingleVar('numb_col'); + $th = $hc->getHtmlTableHead($lang, '', $col); + $tr = $hc->getHtmlTableRow($th, 'head') ; + + return $hc->getHtmlTableThead($tr); + } + + /** + * @private function getTemplatesUserIndexTbody + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $type = $sc->getSmartySingleVar('panel_type'); + $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); + $div = $hc->getHtmlDiv($include, 'panel panel-' . $type); + $cont = $hc->getHtmlTableData($div); + $html = $hc->getHtmlEmpty('
    '); + $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html); + $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont); + $tr = $hc->getHtmlTableRow($foreach); + + return $hc->getHtmlTableTbody($tr); + } + + /** + * @private function getTemplatesUserIndexTfoot + * @return string + */ + private function getTemplatesUserIndexTableTfoot() + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $td = $hc->getHtmlTableData(' '); + $tr = $hc->getHtmlTableRow($td); + + return $hc->getHtmlTableTfoot($tr); + } + + /** + * @public function getTemplatesUserIndexBodyDefault + * @param $module + * @param $table + * @param $language + * @return bool|string + */ + public function getTemplatesUserIndexBodyDefault($module, $table, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $th = $hc->getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '',"\t\t\t"); + $tr = $hc->getHtmlTableRow($th,'center',"\t\t"); + $thead = $hc->getHtmlTableThead($tr,'', "\t"); + $contTable = $thead; + $li = $hc->getHtmlLi("\"><{\$smarty.const.{$language}INDEX}>",'',"\t\t\t\t\t\t"); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + foreach (array_keys($tables) as $i) { + $tableNameLi = $tables[$i]->getVar('table_name'); + $stuTableNameLi = mb_strtoupper($tableName); + $li .= $hc->getHtmlLi("/{$tableNameLi}.php\"><{\$smarty.const.{$language}{$stuTableNameLi}}>",'',"\t\t\t\t\t\t"); + } + + $ul = $hc->getHtmlUl($li,'menu text-center',"\t\t\t\t\t"); + $td = $hc->getHtmlTableData($ul, 'bold pad5','',"\t\t\t\t", "\n", true); + $tr = $hc->getHtmlTablerow($td, 'center',"\t\t\t"); + + $tbody = $hc->getHtmlTableTbody($tr,'', "\t\t"); + $contTable .= $tbody; + + $tfoot = << + <{if \$adv != ''}> + + <{else}> + + <{/if}> + +EOT; + + + $contTable .= $tfoot; + $contIf = $hc->getHtmlTable($contTable); + $ret = $sc->getSmartyConditions("{$tableName}Count", ' > ', '0', $contIf, false, '','',"\t"); + + + $ret .= ''; + $ret .= '*********************************************************'; + + $ret .= << +
    <{\$adv}>
     
    + + + + + + + + + + + + <{if \$adv != ''}> + + <{else}> + + <{/if}> + +
    <{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>
    +
    <{\$adv}>
     
    +<{/if}>\n +EOT; + + return $ret; + } + + /** + * @public function getTemplateUserIndexCategories + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return bool|string + */ + public function getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language) + { + $stuTableName = mb_strtoupper($tableName); + $ret = << 0}> +
    + + + + + + + + + <{foreach item={$tableSoleName} from=\${$tableName}}> + + <{if \${$tableSoleName}.count is div by \$numb_col}> + + <{/if}> + <{/foreach}> + + + + + + + +
    <{\$smarty.const.{$language}{$stuTableName}}>
    + <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableSoleName}}> +
    <{\$lang_thereare}>
    +
    +<{/if}>\n +EOT; + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $single = $sc->getSmartySingleVar('table_type'); + $table = $this->getTemplatesUserIndexTableThead($tableName, $language); + $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); + $table .= $hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; + $div = $hc->getHtmlDiv($table, 'table-responsive') . PHP_EOL; + + return $ret/*$sc->getSmartyConditions($tableName, ' > ', '0', $div, false, true)*/ . PHP_EOL; + } + + /** + * @public function getTemplateUserIndexTable + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return bool|string + */ + public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language) + { + $ret = << 0}> + +
    <{\$smarty.const.{$language}INDEX_LATEST_LIST}>
    + + + + <{section name=i loop=\${$tableName}}> + + <{if \${$tableName}[i].count is div by \$divideby}> + + <{/if}> + <{/section}> + + +
    + <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableName}[i]}> +
    + +<{/if}>\n +EOT; + + return $ret; + } + + /** + * @public function getTemplateUserIndexFooter + * @param $moduleDirname + * @return bool|string + */ + public function getTemplateUserIndexFooter($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplateUserIndexHeader($moduleDirname); + $content .= $this->getTemplatesUserIndexBodyDefault($module, $table, $language); + foreach (array_keys($tables) as $t) { + $tableName = $tables[$t]->getVar('table_name'); + $tableSoleName = $tables[$t]->getVar('table_solename'); + $tableCategory[] = $tables[$t]->getVar('table_category'); + $tableFieldname = $tables[$t]->getVar('table_fieldname'); + $tableIndex[] = $tables[$t]->getVar('table_index'); + if (in_array(1, $tableCategory, true) && in_array(1, $tableIndex)) { + $content .= $this->getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language); + } + + if (in_array(0, $tableCategory, true) && in_array(1, $tableIndex)) { + $content .= $this->getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language); + } + } + $content .= $this->getTemplateUserIndexFooter($moduleDirname); + $tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); + $tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $tdmcfile->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php new file mode 100644 index 00000000..345d6bf4 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -0,0 +1,110 @@ +setModule($module); + $this->setFileName($filename); + $this->folder = $folder; + $this->extension = $extension; + } + + /** + * @private function getTemplatesUserMoreFile + * @param null + * + * @return string + */ + private function getTemplatesUserMoreFile() + { + $ret = <<<'EOT' +
    + Pleace! Enter here your template code here +
    +EOT; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $content = $this->getTemplatesUserMoreFile(); + + $this->create($moduleDirname, $this->folder, $filename . '.' . $this->extension, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php new file mode 100644 index 00000000..89237518 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -0,0 +1,216 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPagesHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserPagesHeader($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'header', '','','',"\n\n"); + } + + /** + * @private function getTemplatesUserPagesTable + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param string $language + * @return string + */ + private function getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $tbody = $this->getTemplatesUserPagesTableThead($tableName, $language); + $tbody .= $this->getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName); + $tbody .= $this->getTemplatesUserPagesTableTfoot(); + $single = $sc->getSmartySingleVar('table_type'); + + return $hc->getHtmlTable($tbody, 'table table-' . $single, "\t"); + } + + /** + * @private function getTemplatesUserPagesThead + * @param string $language + * @param $tableName + * @return string + */ + private function getTemplatesUserPagesTableThead($tableName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $stuTableName = mb_strtoupper($tableName); + $single = $sc->getSmartySingleVar('divideby'); + $lang = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); + $th = $hc->getHtmlTableHead($lang, '', $single, "\t\t\t\t"); + $tr = $hc->getHtmlTableRow($th, 'head', "\t\t\t"); + + return $hc->getHtmlTableThead($tr, '', "\t\t"); + } + + /** + * @private function getTemplatesUserPagesTbody + * @param string $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $single = $sc->getSmartySingleVar('panel_type'); + $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName, "\t\t\t\t\t\t", "\n"); + $div = $hc->getHtmlDiv($include, 'panel panel-' . $single, "\t\t\t\t\t", "\n"); + $cont = $hc->getHtmlTableData($div, '', '', "\t\t\t\t", "\n", true); + $html = $hc->getHtmlEmpty('', "\t\t\t\t\t", "\n"); + $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html, '', '', '',"\t\t\t\t"); + $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont,'','',"\t\t\t\t"); + $tr = $hc->getHtmlTableRow($foreach,'',"\t\t\t"); + + return $hc->getHtmlTableTbody($tr,'',"\t\t"); + } + + /** + * @private function getTemplatesUserPagesTfoot + * @param null + * @return string + */ + private function getTemplatesUserPagesTableTfoot() + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $td = $hc->getHtmlTableData(" ", '', '', '', ''); + $tr = $hc->getHtmlTableRow($td, '', '', ''); + + return $hc->getHtmlTableTfoot($tr, '', "\t\t", "\n", false); + } + + /** + * @private function getTemplatesUserPages + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $table = $this->getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language); + $div = $hc->getHtmlDiv($table, 'table-responsive'); + + return $sc->getSmartyConditions($tableName . 'Count', ' > ', '0', $div, false, false, true); + } + + /** + * @private function getTemplatesUserPagesFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserPagesFooter($moduleDirname) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = $hc->getHtmlEmpty('', '', "\n"); + $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer'); + + return $ret; + } + + /** + * @public function render + * @param null + * + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserPagesHeader($moduleDirname); + $content .= $this->getTemplatesUserPages($moduleDirname, $tableName, $tableSoleName, $language); + $content .= $this->getTemplatesUserPagesFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php new file mode 100644 index 00000000..7a04e9ad --- /dev/null +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -0,0 +1,191 @@ +setModule($module); + $this->setTable($table); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPagesListPanel + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $fields = $this->getTableFields($tableMid, $tableId); + $ret = ''; + $retNumb = ''; + foreach (array_keys($fields) as $f) { + $fieldElement = $fields[$f]->getVar('field_element'); + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_thead')) { + switch ($fieldElement) { + default: + case 2: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retNumb = $hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + break; + } + } + } + } + $ret .= $hc->getHtmlDiv($retNumb, 'panel-heading'); + $retElem = ''; + foreach (array_keys($fields) as $f) { + $fieldElement = $fields[$f]->getVar('field_element'); + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_tbody')) { + switch ($fieldElement) { + default: + case 3: + case 4: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); + break; + case 10: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retElem .= $hc->getHtmlSpan($img, 'col-sm-3', "\t"); + unset($img); + break; + case 13: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); + $retElem .= $hc->getHtmlSpan($img, 'col-sm-3',"\t"); + unset($img); + break; + } + } + } + } + $ret .= $hc->getHtmlDiv($retElem, 'panel-body'); + $retFoot = ''; + foreach (array_keys($fields) as $f) { + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_tfoot')) { + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = mb_strtoupper($tableSoleName) . '_' . mb_strtoupper($rpFieldName); + $lang = $sc->getSmartyConst($language, $langConst); + $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retFoot .= $hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + } + } + } + $ret .= $hc->getHtmlDiv($retFoot, 'panel-foot'); + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + //$tables = $this->getTables(); + //$tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + $moduleDirname = $module->getVar('mod_dirname'); + $filename = $this->getFileName(); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = ''; + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableCategory[] = $table->getVar('table_category'); + //$tableIndex = $table->getVar('table_index'); + if (in_array(0, $tableCategory)) { + $content .= $this->getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); + } + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php new file mode 100644 index 00000000..c64ae20e --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -0,0 +1,102 @@ +setModule($module); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPdfBody + * + * @param null + * + * @return string + */ + private function getTemplatesUserPdfBody() + { + $ret = <<<'EOT' +
    <{$pdfoutput}>
    +EOT; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $content = $this->getTemplatesUserPdfBody(); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php new file mode 100644 index 00000000..596cb4e9 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -0,0 +1,252 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserRateHeader + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserRateHeader($moduleDirname, $table, $language) + { + $ret = << + + + \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; + } + } + $ret .= << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserRateBody + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserRateBody($moduleDirname, $table, $language) + { + $tableName = $table->getVar('table_name'); + $ret = << + <{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'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $ret .= <<\t\t\n +EOT; + break; + case 10: + $ret .= <<{$tableName}\n +EOT; + break; + case 13: + $ret .= <<{$tableName}\n +EOT; + break; + default: + $ret .= <<<{\$list.{$rpFieldName}}>\n +EOT; + break; + } + } + } + $ret .= << + <{/foreach}> + +
    \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserRateBodyFieldnameEmpty + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, $language) + { + $tableName = $table->getVar('table_name'); + $ret = << + <{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'); + $fieldElement = $fields[$f]->getVar('field_element'); + if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $ret .= <<\n +EOT; + break; + case 13: + $ret .= <<{$tableName}\n +EOT; + break; + default: + $ret .= <<<{\$list.{$fieldName}}>\n +EOT; + break; + } + } + } + $ret .= << + <{/foreach}> + +\n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserRateFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserRateFooter($moduleDirname) + { + $ret = << +EOT; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableFieldname = $table->getVar('table_fieldname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserRateHeader($moduleDirname, $table, $language); + // Verify if table_fieldname is not empty + if (!empty($tableFieldname)) { + $content .= $this->getTemplatesUserRateBody($moduleDirname, $table, $language); + } else { + $content .= $this->getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, $language); + } + $content .= $this->getTemplatesUserRateFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Rss.php b/class/Files/Templates/User/Defstyle/Rss.php new file mode 100644 index 00000000..0a9489aa --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -0,0 +1,132 @@ +setModule($module); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserRssXml + * @param null + * @return string + */ + 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; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserRssXml(); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Search.php b/class/Files/Templates/User/Defstyle/Search.php new file mode 100644 index 00000000..e8dfb4c5 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -0,0 +1,251 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserSearchHeader + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserSearchHeader($moduleDirname, $table, $language) + { + $ret = << + + + \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; + } + } + $ret .= << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserSearchBody + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserSearchBody($moduleDirname, $table, $language) + { + $tableName = $table->getVar('table_name'); + $ret = << + <{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'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $ret .= <<\t\t\n +EOT; + break; + case 10: + $ret .= <<{$tableName}\n +EOT; + break; + case 13: + $ret .= <<{$tableName}\n +EOT; + break; + default: + $ret .= <<<{\$list.{$rpFieldName}}>\n +EOT; + break; + } + } + } + $ret .= << + <{/foreach}> + +
    \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserSearchBodyFieldnameEmpty + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table, $language) + { + $tableName = $table->getVar('table_name'); + $ret = << + <{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'); + $fieldElement = $fields[$f]->getVar('field_element'); + if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $ret .= <<\n +EOT; + break; + case 13: + $ret .= <<{$tableName}\n +EOT; + break; + default: + $ret .= <<<{\$list.{$fieldName}}>\n +EOT; + break; + } + } + } + $ret .= << + <{/foreach}> + +\n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserSearchFooter + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserSearchFooter($moduleDirname) + { + $ret = << +EOT; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableFieldname = $table->getVar('table_fieldname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserSearchHeader($moduleDirname, $table, $language); + // Verify if table_fieldname is not empty + if (!empty($tableFieldname)) { + $content .= $this->getTemplatesUserSearchBody($moduleDirname, $table, $language); + } else { + $content .= $this->getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table, $language); + } + $content .= $this->getTemplatesUserSearchFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Single.php b/class/Files/Templates/User/Defstyle/Single.php new file mode 100644 index 00000000..ef1805d4 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Single.php @@ -0,0 +1,141 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserSingleHeader + * @param $moduleDirname + * @return string + */ + private function getTemplatesUserSingleHeader($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = $sc->getSmartyIncludeFile($moduleDirname); + + return $ret; + } + + /** + * @private function getTemplatesUserSingleBody + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserSingleBody($moduleDirname, $table, $language) + { + $tableName = $table->getVar('table_name'); + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $ret = ''; + $ret .= $hc->getHtmlEmpty('', '',"\n"); + $content = $hc->getHtmlHNumb('Services Panels', '2', 'page-header', "\t\t\t"); + $collg12 = $hc->getHtmlDiv($content, 'col-lg-12', "\t\t"); + $row = $hc->getHtmlDiv($collg12, 'row', "\t"); + $ret .= $hc->getHtmlDiv($row, 'container'); + $ret .= $hc->getHtmlEmpty('', '',"\n"); + + return $ret; + } + + /** + * @private function getTemplatesUserSingleFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserSingleFooter($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = $sc->getSmartyIncludeFile($moduleDirname, 'footer'); + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserSingleHeader($moduleDirname); + $content .= $this->getTemplatesUserSingleBody($moduleDirname, $table, $language); + $content .= $this->getTemplatesUserSingleFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/Submit.php b/class/Files/Templates/User/Defstyle/Submit.php new file mode 100644 index 00000000..38ab13a8 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Submit.php @@ -0,0 +1,151 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserSubmitHeader + * @param $moduleDirname + * @return string + */ + private function getTemplatesUserSubmitHeader($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'header'); + } + + /** + * @private function getTemplatesUserSubmit + * @param string $moduleDirname + * @param string $language + * + * @return string + */ + private function getTemplatesUserSubmit($moduleDirname, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + $const = $sc->getSmartyConst($language, 'SUBMIT_SUBMITONCE'); + $li = $hc->getHtmlLi($const, '',"\t\t"); + $const = $sc->getSmartyConst($language, 'SUBMIT_ALLPENDING'); + $li .= $hc->getHtmlLi($const, '',"\t\t"); + $const = $sc->getSmartyConst($language, 'SUBMIT_DONTABUSE'); + $li .= $hc->getHtmlLi($const, '',"\t\t"); + $const = $sc->getSmartyConst($language, 'SUBMIT_TAKEDAYS'); + $li .= $hc->getHtmlLi($const, '',"\t\t"); + $ul = $hc->getHtmlUl($li, '', "\t"); + + $ret = $hc->getHtmlEmpty('', '',"\n"); + $ret .= $hc->getHtmlDiv($ul, $moduleDirname . '-tips'); + $single = $sc->getSmartySingleVar('message_error'); + $divError = $hc->getHtmlDiv($single, 'errorMsg', "\t", "\n", false); + $ret .= $sc->getSmartyConditions('message_error', ' != ', '\'\'', $divError); + $single = $sc->getSmartySingleVar('form', "\t", "\n"); + $ret .= $hc->getHtmlDiv($single, $moduleDirname . '-submitform'); + $ret .= $hc->getHtmlEmpty('', '',"\n"); + + return $ret; + } + + /** + * @private function getTemplatesUserSubmitFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserSubmitFooter($moduleDirname) + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + //$table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + //$tableFieldname = $table->getVar('table_fieldname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserSubmitHeader($moduleDirname); + $content .= $this->getTemplatesUserSubmit($moduleDirname, $language); + $content .= $this->getTemplatesUserSubmitFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php new file mode 100644 index 00000000..4d69e091 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -0,0 +1,248 @@ +setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPrintHeader + * @param string $moduleDirname + * @param string $table + * @param string $language + * + * @return string + */ + private function getTemplatesUserPrintHeader($moduleDirname, $table, $language) + { + $ret = << + + + \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; + } + } + $ret .= << + \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserPrintBody + * @param string $moduleDirname + * @param string $table + * @return string + */ + private function getTemplatesUserPrintBody($moduleDirname, $table) + { + $tableName = $table->getVar('table_name'); + $ret = << + <{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'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $ret .= <<\t\t\n +EOT; + break; + case 10: + $ret .= <<{$tableName}\n +EOT; + break; + case 13: + $ret .= <<{$tableName}\n +EOT; + break; + default: + $ret .= <<<{\$list.{$rpFieldName}}>\n +EOT; + break; + } + } + } + $ret .= << + <{/foreach}> + +
    \n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserPrintBodyFieldnameEmpty + * @param string $moduleDirname + * @param $table + * @return string + */ + private function getTemplatesUserPrintBodyFieldnameEmpty($moduleDirname, $table) + { + $tableName = $table->getVar('table_name'); + $ret = << + <{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'); + $fieldElement = $fields[$f]->getVar('field_element'); + if ((1 == $table->getVar('table_autoincrement')) || (1 == $fields[$f]->getVar('field_user'))) { + switch ($fieldElement) { + case 9: + $ret .= <<\n +EOT; + break; + case 13: + $ret .= <<{$tableName}\n +EOT; + break; + default: + $ret .= <<<{\$list.{$fieldName}}>\n +EOT; + break; + } + } + } + $ret .= << + <{/foreach}> + +\n +EOT; + + return $ret; + } + + /** + * @private function getTemplatesUserPrintFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserPrintFooter($moduleDirname) + { + $ret = << +EOT; + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableFieldname = $table->getVar('table_fieldname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getTemplatesUserPrintHeader($moduleDirname, $table, $language); + // Verify if table_fieldname is not empty + if (!empty($tableFieldname)) { + $content .= $this->getTemplatesUserPrintBody($moduleDirname, $table); + } else { + $content .= $this->getTemplatesUserPrintBodyFieldnameEmpty($moduleDirname, $table); + } + $content .= $this->getTemplatesUserPrintFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/index.html b/class/Files/Templates/User/Defstyle/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/class/Files/Templates/User/Defstyle/index.html @@ -0,0 +1 @@ + diff --git a/class/Files/Templates/User/index.html b/class/Files/Templates/User/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/class/Files/Templates/User/index.html @@ -0,0 +1 @@ + diff --git a/docs/changelog.txt b/docs/changelog.txt index c594235d..95ae75f5 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -26,6 +26,7 @@ - rebuilt include/search.inc.php (goffy) - added default values for form elements (goffy) - adapted editor handling (goffy) +- preparation for new tpl styles (goffy)
    3.01 Alpha 2 [WORK IN PROGRESS - NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.2
    From b7c25b94905ebad9fd1ff316be522a3038ecc8f9 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Tue, 5 May 2020 15:14:07 +0200 Subject: [PATCH 006/266] transfered code: broken from brocken.php to the userpage / submit from submit.php to the userpage (goffy) --- .../class}/Files/User/UserBroken.php | 4 +- .../class}/Files/User/UserSubmit.php | 0 class/Files/Classes/ClassFormElements.php | 1 + class/Files/Classes/ClassSpecialFiles.php | 2 + class/Files/CreateArchitecture.php | 29 -- class/Files/CreateXoopsCode.php | 89 ++++- class/Files/Language/LanguageAdmin.php | 1 + class/Files/Language/LanguageMain.php | 20 +- class/Files/Language/LanguageModinfo.php | 14 +- class/Files/Templates/User/Defstyle/Pages.php | 34 ++ class/Files/User/UserHeader.php | 15 +- class/Files/User/UserPages.php | 356 +++++++++++++++--- class/Files/User/UserXoopsVersion.php | 27 +- class/Files/admin/AdminPages.php | 16 +- class/Files/admin/AdminXoopsCode.php | 34 -- commonfiles/assets/icons/16/status4.png | Bin 0 -> 2296 bytes docs/changelog.txt | 2 + language/english/admin.php | 7 +- 18 files changed, 476 insertions(+), 175 deletions(-) rename {class => _archive/class}/Files/User/UserBroken.php (98%) rename {class => _archive/class}/Files/User/UserSubmit.php (100%) create mode 100644 commonfiles/assets/icons/16/status4.png diff --git a/class/Files/User/UserBroken.php b/_archive/class/Files/User/UserBroken.php similarity index 98% rename from class/Files/User/UserBroken.php rename to _archive/class/Files/User/UserBroken.php index cd60752c..1857718b 100644 --- a/class/Files/User/UserBroken.php +++ b/_archive/class/Files/User/UserBroken.php @@ -162,8 +162,8 @@ public function getUserBrokenSave($moduleDirname, $fields, $tableName, $tableSol $condElse = $pc->getPhpCodeCommentLine('Insert Data', null, $t . "\t"); $insert = $xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); - $redirctHeader = $xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, $t . "\t\t"); - $condElse .= $pc->getPhpCodeConditions($insert, '', '', $redirctHeader, false, $t . "\t"); + $redirectHeader = $xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, $t . "\t\t"); + $condElse .= $pc->getPhpCodeConditions($insert, '', '', $redirectHeader, false, $t . "\t"); $assigne = $xc->getXcXoopsTplAssign('error_message', '$errorMessage', true, $t . "\t"); $ret .= $pc->getPhpCodeConditions('$error', ' === ', 'true', $assigne, $condElse, $t); diff --git a/class/Files/User/UserSubmit.php b/_archive/class/Files/User/UserSubmit.php similarity index 100% rename from class/Files/User/UserSubmit.php rename to _archive/class/Files/User/UserSubmit.php diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 3ff31b95..06e3b653 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -630,6 +630,7 @@ private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "Constants::STATUS_OFFLINE, {$languageShort}STATUS_OFFLINE", $t); $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "Constants::STATUS_SUBMITTED, {$languageShort}STATUS_SUBMITTED", $t); $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "Constants::STATUS_APPROVED, {$languageShort}STATUS_APPROVED", $t); + $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "Constants::STATUS_BROKEN, {$languageShort}STATUS_BROKEN", $t); $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 6c1a7f94..93634e11 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -242,6 +242,8 @@ public function renderConstants() $contentClass .= $pc->getPhpCodeConstant("STATUS_OFFLINE ", 1, "\t"); $contentClass .= $pc->getPhpCodeConstant("STATUS_SUBMITTED", 2, "\t"); $contentClass .= $pc->getPhpCodeConstant("STATUS_APPROVED ", 3, "\t"); + $contentClass .= $pc->getPhpCodeConstant("STATUS_BROKEN ", 4, "\t"); + if (in_array(1, $tablePermissions)) { $constPerm = $pc->getPhpCodeBlankLine(); diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 55c03945..8a2958d7 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -540,20 +540,6 @@ public function setFilesToBuilding($module) $userNotificationUpdate->write($module, 'notification_update.php'); $ret[] = $userNotificationUpdate->render(); } - // User Broken File - if (in_array(1, $tableBroken)) { - $userBroken = Tdmcreate\Files\User\UserBroken::getInstance(); - $userBroken->write($module, $table, 'broken.php'); - $ret[] = $userBroken->render(); - // User Templates Broken File - if ($templateType == 'bootstrap') { - $userTemplatesBroken = Tdmcreate\Files\Templates\User\Bootstrap\Broken::getInstance(); - } else { - $userTemplatesBroken = Tdmcreate\Files\Templates\User\Defstyle\Broken::getInstance(); - } - $userTemplatesBroken->write($module, $table, $moduleDirname . '_broken.tpl'); - $ret[] = $userTemplatesBroken->render(); - } // User Pdf File if (in_array(1, $tablePdf)) { $userPdf = Tdmcreate\Files\User\UserPdf::getInstance(); @@ -626,21 +612,6 @@ public function setFilesToBuilding($module) $userTemplatesSingle->write($module, $table, $moduleDirname . '_single.tpl'); $ret[] = $userTemplatesSingle->render(); } - - // User Submit File - if (in_array(1, $tableSubmit)) { - $userSubmit = Tdmcreate\Files\User\UserSubmit::getInstance(); - $userSubmit->write($module, $table, 'submit.php'); - $ret[] = $userSubmit->render(); - // User Templates Submit File - if ($templateType == 'bootstrap') { - $userTemplatesSubmit = Tdmcreate\Files\Templates\User\Bootstrap\Submit::getInstance(); - } else { - $userTemplatesSubmit = Tdmcreate\Files\Templates\User\Defstyle\Submit::getInstance(); - } - $userTemplatesSubmit->write($module, $table, $moduleDirname . '_submit.tpl'); - $ret[] = $userTemplatesSubmit->render(); - } // User Visit File if (in_array(1, $tableVisit)) { $userVisit = Tdmcreate\Files\User\UserVisit::getInstance(); diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 3439d64e..dae575a5 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -111,12 +111,13 @@ public function getXcSetVarObj($tableName, $fieldName, $var, $t = '') /** * @public function getXcGetVar - * @param $varLeft - * @param $handle - * @param $var - * @param $isParam - * @param $t + * @param string $varLeft + * @param string $handle + * @param string $var + * @param bool $isParam + * @param string $t * + * @param string $format * @return string */ public function getXcGetVar($varLeft = '', $handle = '', $var = '', $isParam = false, $t = '', $format = '') @@ -1674,4 +1675,82 @@ public function getXcXoopsHandler($left, $t = '', $n = "\n") { return "{$t}\${$left}Handler = xoops_getHandler('{$left}');{$n}"; } + + + /*************************************************************/ + /** common components for user and admin pages */ + /*************************************************************/ + + /** + * @public function getXcCommonPagesEdit + * @param $tableName + * @param $ccFieldId + * @param string $t + * @return string + */ + public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $ret = $pc->getPhpCodeCommentLine('Get Form', null, "\t\t"); + $ret .= $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + + return $ret; + } + + /** + * @public function getXcCommonPagesNew + * @param $tableName + * @param string $t + * @return string + */ + public function getXcCommonPagesNew($tableName, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $ret = $pc->getPhpCodeCommentLine('Form Create', null, $t); + $ret .= $xc->getXcHandlerCreateObj($tableName, $t); + $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + + return $ret; + } + + /** + * @public function getXcCommonPagesDelete + * @param $language + * @param $tableName + * @param $fieldId + * @param $fieldMain + * @param string $t + * @return string + */ + public function getXcCommonPagesDelete($language, $tableName, $fieldId, $fieldMain, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $cf = Tdmcreate\Files\CreateFile::getInstance(); + $ccFieldId = $cf->getCamelCase($fieldId, false, true); + $ret = $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', '', $t); + $reqOk = "_REQUEST['ok']"; + $isset = $pc->getPhpCodeIsset($reqOk); + $xoopsSecurityCheck = $xc->getXcXoopsSecurityCheck(); + $xoopsSecurityErrors = $xc->getXcXoopsSecurityErrors(); + $implode = $pc->getPhpCodeImplode(', ', $xoopsSecurityErrors); + $redirectHeaderErrors = $xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t\t"); + $delete = $xc->getXcHandlerDelete($tableName, $tableName, 'Obj', 'Handler'); + $condition = $pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectHeaderErrors, false, $t . "\t"); + $redirectHeaderLanguage = $xc->getXcRedirectHeader($tableName, '', '3', "{$language}FORM_DELETE_OK", true, $t . "\t\t"); + $htmlErrors = $xc->getXcHtmlErrors($tableName, true); + $internalElse = $xc->getXcXoopsTplAssign('error', $htmlErrors, true, $t . "\t\t"); + $condition .= $pc->getPhpCodeConditions($delete, '', '', $redirectHeaderLanguage, $internalElse, $t . "\t"); + $mainElse = $xc->getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, 'delete', $t . "\t"); + $ret .= $pc->getPhpCodeConditions($isset, ' && ', "1 == \${$reqOk}", $condition, $mainElse, $t); + + return $ret; + } } diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 099a6546..9c8ae890 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -238,6 +238,7 @@ public function getLanguageAdminClass($language, $tables) $ret .= $this->defines->getDefine($language, 'STATUS_OFFLINE', 'Offline'); $ret .= $this->defines->getDefine($language, 'STATUS_SUBMITTED', 'Submitted'); $ret .= $this->defines->getDefine($language, 'STATUS_APPROVED', 'Approved'); + $ret .= $this->defines->getDefine($language, 'STATUS_BROKEN', 'Broken'); } if ($fieldSampleListValue > 0) { $ret .= $this->defines->getAboveDefines('Sample List Values'); diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index 14470505..cf82f0cc 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -85,10 +85,13 @@ private function getLanguageMain($module, $language) { /** @var \XoopsModules\Tdmcreate\Utility $utility */ $utility = new \XoopsModules\Tdmcreate\Utility(); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $moduleName = $module->getVar('mod_name'); $tables = $this->getTables(); $ret = $this->defines->getBlankLine(); + $ret .= $pc->getPhpCodeIncludeDir('__DIR__', 'admin', true); + $ret .= $this->defines->getBlankLine(); $ret .= $this->defines->getAboveHeadDefines('Main'); $ret .= $this->defines->getDefine($language, 'INDEX', 'Home'); $ret .= $this->defines->getDefine($language, 'TITLE', (string)$module->getVar('mod_name')); @@ -107,9 +110,13 @@ private function getLanguageMain($module, $language) $ucfTableSoleName = ''; $stuTableSoleName = ''; $tableSoleName = ''; + $tableSubmit = 0; foreach (array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); $tableSoleName = $tables[$i]->getVar('table_solename'); + if (1 === (int)$tables[$i]->getVar('table_submit')) { + $tableSubmit = 1; + } $stuTableName = mb_strtoupper($tableName); $stuTableSoleName = mb_strtoupper($tableSoleName); $ucfTableName = $utility::UcFirstAndToLower($tableName); @@ -140,11 +147,14 @@ private function getLanguageMain($module, $language) $ret .= $this->defines->getDefine($language, 'SUBMIT_RECEIVED', "We have received your {$tableSoleName} info. Thank you !"); $ret .= $this->defines->getDefine($language, 'SUBMIT_SUBMITONCE', "Submit your {$tableSoleName}/script only once."); $ret .= $this->defines->getDefine($language, 'SUBMIT_TAKEDAYS', "This will take many days to see your {$tableSoleName}/script added successfully in our database."); - $ret .= $this->defines->getAboveDefines('Form'); - $ret .= $this->defines->getDefine($language, 'FORM_OK', 'Successfully saved'); - $ret .= $this->defines->getDefine($language, 'FORM_DELETE_OK', 'Successfully deleted'); - $ret .= $this->defines->getDefine($language, 'FORM_SURE_DELETE', "Are you sure to delete: %s ", true); - $ret .= $this->defines->getDefine($language, 'FORM_SURE_RENEW', "Are you sure to update: %s ", true); + if (1 == $tableSubmit) { + $ret .= $this->defines->getAboveDefines('Form'); + $ret .= $this->defines->getDefine($language, 'FORM_OK', 'Successfully saved'); + $ret .= $this->defines->getDefine($language, 'FORM_DELETE_OK', 'Successfully deleted'); + $ret .= $this->defines->getDefine($language, 'FORM_SURE_DELETE', "Are you sure to delete: %s ", true); + $ret .= $this->defines->getDefine($language, 'FORM_SURE_RENEW', "Are you sure to update: %s ", true); + $ret .= $this->defines->getDefine($language, 'INVALID_PARAM', "Invalid parameter", true); + } return $ret; } diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 9b2f6f0f..4e800388 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -162,18 +162,18 @@ private function getLanguageSubmenu($language, $tables) $tableSearch = []; foreach (array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); $tableSearch[] = $tables[$t]->getVar('table_search'); - $desc = ucfirst(mb_strtolower($tableName)); + $ucfTablename = ucfirst(mb_strtolower($tableName)); if (1 == $tables[$t]->getVar('table_submenu')) { - $ret .= $df->getDefine($language, "SMNAME{$i}", $desc); + $ret .= $df->getDefine($language, "SMNAME{$i}", $ucfTablename); } ++$i; + if (1 == $tables[$t]->getVar('table_submit')) { + $ret .= $df->getDefine($language, "SMNAME{$i}", 'Submit ' . $ucfTablename); + ++$i; + } } - if (in_array(1, $tableSubmit)) { - $ret .= $df->getDefine($language, "SMNAME{$i}", 'Submit'); - ++$i; - } + if (in_array(1, $tableSearch)) { $ret .= $df->getDefine($language, "SMNAME{$i}", 'Search'); } diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index 89237518..d8e04706 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -174,6 +174,38 @@ private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleNam return $sc->getSmartyConditions($tableName . 'Count', ' > ', '0', $div, false, false, true); } + /** + * @private function getTemplatesUserPagesForm + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserPagesForm($t = '') + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $var = $sc->getSmartySingleVar('form', "\t", "\n"); + + return $sc->getSmartyConditions('form', '', '', $var, false, false, true); + } + + /** + * @private function getTemplatesUserPagesError + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserPagesError($t = '') + { + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $var = $sc->getSmartySingleVar('error', "\t", "\n"); + + return $sc->getSmartyConditions('error', '', '', $var, false, false, true); + } + /** * @private function getTemplatesUserPagesFooter * @param string $moduleDirname @@ -207,6 +239,8 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getTemplatesUserPagesHeader($moduleDirname); $content .= $this->getTemplatesUserPages($moduleDirname, $tableName, $tableSoleName, $language); + $content .= $this->getTemplatesUserPagesForm(); + $content .= $this->getTemplatesUserPagesError(); $content .= $this->getTemplatesUserPagesFooter($moduleDirname); $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); diff --git a/class/Files/User/UserHeader.php b/class/Files/User/UserHeader.php index 8c48bf11..fc687406 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -90,23 +90,16 @@ private function getUserHeader($moduleDirname) $table = $this->getTable(); $tables = $this->getTables(); - if (is_object($table) && '' != $table->getVar('table_name')) { - $ret .= $xc->getXcHelperGetInstance($moduleDirname); - } + $ret .= $xc->getXcHelperGetInstance($moduleDirname); if (is_array($tables)) { foreach (array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); $ret .= $xc->getXcHandlerLine($tableName); } } - $ret .= $pc->getPhpCodeCommentLine('Permission'); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); - $ret .= $xc->getXcXoopsHandler('groupperm'); - - $condIf = $xc->getXcEqualsOperator('$groups ', '$xoopsUser->getGroups()', null, "\t"); - $condElse = $xc->getXcEqualsOperator('$groups ', 'XOOPS_GROUP_ANONYMOUS', null, "\t"); - - $ret .= $pc->getPhpCodeConditions('is_object($xoopsUser)', '', '', $condIf, $condElse); + if (1 == $table->getVar('table_permissions')) { + $ret .= $xc->getXcHandlerLine('permissions'); + } $ret .= $pc->getPhpCodeCommentLine(); $ret .= $xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); $ret .= $pc->getPhpCodeCommentLine('Default Css Style'); diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 5525f51d..2a24bcd0 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -77,10 +77,12 @@ public function write($module, $table, $filename) */ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ccFieldId = $this->getCamelCase($fieldId, false, true); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $uxc = UserXoopsCode::getInstance(); + + $stuModuleDirname = mb_strtoupper($moduleDirname); + $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); @@ -88,66 +90,277 @@ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId) $ret .= $uxc->getUserTplMain($moduleDirname, $tableName); $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $xc->getXcXoopsRequest('op', 'op', 'list', 'String'); - $ret .= $xc->getXcXoopsRequest($ccFieldId, $fieldId, '0', 'Int'); + $ret .= $xc->getXcXoopsRequest('op ', 'op', 'list', 'String'); $ret .= $xc->getXcXoopsRequest('start', 'start', '0', 'Int'); $userpager = $xc->getXcGetConfig('userpager'); $ret .= $xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int'); + $ret .= $xc->getXcXoopsRequest($ccFieldId, $fieldId, '0', 'Int'); $ret .= $pc->getPhpCodeBlankLine(); $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet'); $ret .= $xc->getXcXoThemeAddStylesheet(); + $ret .= $pc->getPhpCodeBlankLine(); + $ret .= $xc->getXcXoopsTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL'); + $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_url", "{$stuModuleDirname}_URL"); + $ret .= $pc->getPhpCodeBlankLine(); + $ret .= $pc->getPhpCodeArray('keywords', null, false, ''); + $ret .= $pc->getPhpCodeBlankLine(); return $ret; } /** - * @private function getUserPages + * @private function getUserPagesList * @param $moduleDirname * @param $tableName * @param $fieldId * @param $fieldMain * @return string */ - private function getUserPages($moduleDirname, $tableName, $fieldId, $fieldMain) + private function getUserPagesList($tableName, $fieldId, $fieldMain, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $ucfTableName = ucfirst($tableName); $ccFieldId = $this->getCamelCase($fieldId, false, true); - $t = "\t"; - $ret = $pc->getPhpCodeBlankLine(); - $ret .= $xc->getXcXoopsTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL'); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_url", "{$stuModuleDirname}_URL"); - $ret .= $pc->getPhpCodeBlankLine(); - $critName = 'cr' . $ucfTableName; - $ret .= $xc->getXcCriteriaCompo($critName); + $critName = 'cr' . $ucfTableName; + $ret = $xc->getXcCriteriaCompo($critName, $t); $crit = $xc->getXcCriteria('', "'{$fieldId}'", "\${$ccFieldId}",'',true); - $contIf = $xc->getXcCriteriaAdd($critName, $crit, "\t"); - $ret .= $pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contIf); - $ret .= $xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName); - $ret .= $xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count"); - $ret .= $xc->getXcCriteriaSetStart($critName, '$start'); - $ret .= $xc->getXcCriteriaSetLimit($critName, '$limit'); - $ret .= $xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName); - $ret .= $pc->getPhpCodeArray('keywords', null, false, ''); - $condIf = $pc->getPhpCodeArray($tableName, null, false, $t); - $condIf .= $pc->getPhpCodeCommentLine('Get All', $ucfTableName, $t); - $foreach = $xc->getXcGetValues($tableName, $tableName . '[]', 'i', false, $t . "\t"); - $foreach .= $xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, $t . "\t"); - $condIf .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t); - $condIf .= $xc->getXcXoopsTplAssign($tableName, "\${$tableName}", true, $t); - $condIf .= $pc->getPhpCodeUnset($tableName, $t); - $condIf .= $xc->getXcPageNav($tableName, $t); + $contIf = $xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); + $ret .= $pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contIf, false, $t); + $ret .= $xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); + $ret .= $xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count", '', $t); + $ret .= $xc->getXcCriteriaSetStart($critName, '$start', $t); + $ret .= $xc->getXcCriteriaSetLimit($critName, '$limit', $t); + $ret .= $xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t); + $condIf = $pc->getPhpCodeArray($tableName, null, false, $t . "\t"); + $condIf .= $pc->getPhpCodeCommentLine('Get All', $ucfTableName, $t . "\t"); + $foreach = $xc->getXcGetValues($tableName, $tableName . '[]', 'i', false, $t . "\t\t"); + $foreach .= $xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, $t . "\t\t"); + $condIf .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t . "\t"); + $condIf .= $xc->getXcXoopsTplAssign($tableName, "\${$tableName}", true, $t . "\t"); + $condIf .= $pc->getPhpCodeUnset($tableName, $t . "\t"); + $condIf .= $xc->getXcPageNav($tableName, $t . "\t"); $tableType = $xc->getXcGetConfig('table_type'); - $condIf .= $xc->getXcXoopsTplAssign('type', $tableType, true, $t); + $condIf .= $xc->getXcXoopsTplAssign('type', $tableType, true, $t . "\t"); $divideby = $xc->getXcGetConfig('divideby'); - $condIf .= $xc->getXcXoopsTplAssign('divideby', $divideby, true, $t); + $condIf .= $xc->getXcXoopsTplAssign('divideby', $divideby, true, $t . "\t"); $numbCol = $xc->getXcGetConfig('numb_col'); - $condIf .= $xc->getXcXoopsTplAssign('numb_col', $numbCol, true, $t); + $condIf .= $xc->getXcXoopsTplAssign('numb_col', $numbCol, true, $t . "\t"); + + $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, false, $t); + + return $ret; + } + + /** + * @public function getUserSubmitSave + * @param string $moduleDirname + * @param $fields + * @param string $tableName + * @param $tableSoleName + * @param $tableSubmit + * @param $tablePermissions + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, $t = '') + { + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + + $ret = $pc->getPhpCodeCommentLine('Security Check', '', $t); + $xoopsSecurityCheck = $xc->getXcXoopsSecurityCheck(); + $securityError = $xc->getXcXoopsSecurityErrors(); + $implode = $pc->getPhpCodeImplode(',', $securityError); + $redirectError = $xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectError, false, $t); + $ret .= $pc->getPhpCodeCommentLine('Check permissions', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, '_NOPERM', true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); + $ret .= $xc->getXcHandlerCreateObj($tableName, $t); + $ret .= $xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t); + $ret .= $pc->getPhpCodeCommentLine('Insert Data', null, $t); + $insert = $xc->getXcHandlerInsert($tableName, $tableName, 'Obj', 'Handler'); + $countUploader = 0; + $fieldId = ''; + $ccFieldId = ''; + foreach (array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $fieldId = $fieldName; + $ccFieldId = $this->getCamelCase($fieldId, false, true); + } + if ($fields[$f]->getVar('field_type') >= 10 && $fields[$f]->getVar('field_type') <= 14) { + $countUploader++; + } + } + $contentInsert = ''; + if (1 == $tablePermissions) { + $ucfTableName = ucfirst($tableName); + $ucfFieldId = $this->getCamelCase($fieldId, true); + $contentInsert .= $xc->getXcEqualsOperator("\$new{$ucfFieldId}", "\${$tableName}Obj->getNewInsertedId{$ucfTableName}()", null, $t . "\t"); + $contentInsert .= $pc->getPhpCodeTernaryOperator('permId', "isset(\$_REQUEST['{$fieldId}'])", "\${$ccFieldId}", "\$new{$ucfFieldId}", $t . "\t"); + $contentInsert .= $xc->getXcXoopsHandler('groupperm', $t . "\t"); + $contentInsert .= $xc->getXcEqualsOperator('$mid', "\$GLOBALS['xoopsModule']->getVar('mid')", null, $t . "\t"); + $contentInsert .= $this->getPermissionsSave($moduleDirname, 'view_' . $tableName); + $contentInsert .= $this->getPermissionsSave($moduleDirname, 'submit_' . $tableName); + $contentInsert .= $this->getPermissionsSave($moduleDirname, 'approve_' . $tableName); + } + + if ($countUploader > 0) { + $errIf = $xc->getXcRedirectHeader("'{$tableName}.php?op=edit&{$fieldId}=' . \${$ccFieldId}", '', '5', '$uploaderErrors', false, $t . "\t\t"); + $errElse = $xc->getXcRedirectHeader($tableName, '?op=list', '2', "{$language}FORM_OK", true, $t . "\t\t"); + $confirmOk = $pc->getPhpCodeConditions("''", ' !== ', '$uploaderErrors', $errIf, $errElse, $t . "\t"); + } else { + $confirmOk = $xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, $t . "\t"); + } + $contentInsert .= $confirmOk; + $ret .= $pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); + + $ret .= $pc->getPhpCodeCommentLine('Get Form Error', null, $t); + $ret .= $xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, $t); + $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->display()', true, $t); + + return $ret; + } + + /** + * @private function getPermissionsSave + * @param $moduleDirname + * @param string $perm + * + * @return string + */ + private function getPermissionsSave($moduleDirname, $perm = 'view') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $ret = $pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); + $ret .= $xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', '$permId', false, "\t\t\t"); + $content = $xc->getXcAddRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$permId', '$onegroupId', '$mid', false, "\t\t\t\t\t"); + $foreach = $pc->getPhpCodeForeach("_POST['groups_{$perm}']", false, false, 'onegroupId', $content, "\t\t\t\t"); + $ret .= $pc->getPhpCodeConditions("isset(\$_POST['groups_{$perm}'])", null, null, $foreach, false, "\t\t\t"); + + return $ret; + } - $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf); + /** + * @public function getUserPagesNew + * @param $tableName + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesNew($tableName, $language, $t = '') + { + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + + $ret = $pc->getPhpCodeCommentLine('Check permissions', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, '_NOPERM', true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); + $ret .= $xc->getXcCommonPagesNew($tableName, $t); + + return $ret; + } + + /** + * @public function getUserPagesEdit + * @param $tableName + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesEdit($moduleDirname, $tableName, $fieldId, $language, $t = '') + { + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + + $ccFieldId = $this->getCamelCase($fieldId, false, true); + $ret = $pc->getPhpCodeCommentLine('Check permissions', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, '_NOPERM', true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); + $ret .= $pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); + $ret .= $xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t); + + return $ret; + } + + /** + * @private function getUserPagesDelete + * @param $tableName + * @param $language + * @param $fieldId + * @param $fieldMain + * @param string $t + * @return string + */ + private function getUserPagesDelete($tableName, $language, $fieldId, $fieldMain, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $ccFieldId = $this->getCamelCase($fieldId, false, true); + $ret = $pc->getPhpCodeCommentLine('Check permissions', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, '_NOPERM', true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); + $ret .= $pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); + $ret .= $xc->getXcCommonPagesDelete($language, $tableName, $fieldId, $fieldMain, $t); + + return $ret; + } + + /** + * @private function getUserPagesBroken + * @param $tableName + * @param $language + * @param $fieldId + * @param $fieldMain + * @param string $t + * @return string + */ + private function getUserPagesBroken($tableName, $language, $fieldId, $fieldSatus, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $ccFieldId = $this->getCamelCase($fieldId, false, true); + $ret = $pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); + + $ret .= $this->getSimpleString('$error = false;', $t); + $ret .= $this->getSimpleString("\$errorMessage = '';", $t); + $ret .= $pc->getPhpCodeCommentLine('Test first the validation', null, $t); + $ret .= $xc->getXcXoopsLoad('captcha', $t); + $ret .= $xc->getXcXoopsCaptcha($t); + $contIf = $xc->getXcEqualsOperator('$errorMessage', "\$xoopsCaptcha->getMessage().'
    '", '.', $t . "\t"); + $contIf .= $xc->getXcXoopsTplAssign('error_message', '$errorMessage', true, $t . "\t"); + $contIf .= $this->getSimpleString('break;', $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!$xoopsCaptcha->verify()', '', '', $contIf, false, $t); + + $ret .= $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $ret .= $xc->getXcSetVarObj($tableName, $fieldSatus, 'Constants::STATUS_BROKEN', $t); + + $ret .= $pc->getPhpCodeCommentLine('Insert Data', null, $t); + $insert = $xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); + $redirectHeader = $xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions($insert, '', '', $redirectHeader, false, $t); + $ret .= $pc->getPhpCodeBlankLine(); + $ret .= $pc->getPhpCodeCommentLine('Get Form Error', null, $t); + $ret .= $xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, $t); + $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->display()', true, $t); + $ret .= $pc->getPhpCodeBlankLine(); return $ret; } @@ -162,9 +375,10 @@ private function getUserPages($moduleDirname, $tableName, $fieldId, $fieldMain) */ private function getUserPagesFooter($moduleDirname, $tableName, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $uxc = UserXoopsCode::getInstance(); + $stuModuleDirname = mb_strtoupper($moduleDirname); $stuTableName = mb_strtoupper($tableName); $ret = $pc->getPhpCodeBlankLine(); @@ -184,6 +398,38 @@ private function getUserPagesFooter($moduleDirname, $tableName, $language) return $ret; } + /** + * @private function getUserPagesSwitch + * @param $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $tableSubmit + * @param $tablePermissions + * @param $language + * @param $t + * @return string + */ + private function getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldSatus, $language, $t) + { + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $fields = $this->getTableFields($tableMid, $tableId); + $cases['list'] = [$this->getUserPagesList($tableName, $fieldId, $fieldMain, "\t\t")]; + if (1 == $tableSubmit) { + $cases['save'] = [$this->getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, "\t\t")]; + $cases['new'] = [$this->getUserPagesNew($tableName, $language, "\t\t")]; + $cases['edit'] = [$this->getUserPagesEdit($moduleDirname, $tableName, $fieldId, $language, "\t\t")]; + $cases['delete'] = [$this->getUserPagesDelete($tableName, $language, $fieldId, $fieldMain,"\t\t")]; + } + if (1 == $tableBroken) { + $cases['broken'] = [$this->getUserPagesBroken($tableName, $language, $fieldId, $fieldSatus,"\t\t")]; + } + + return $xc->getXcSwitch('op', $cases, true, false); + } + /** * @public function render * @param null @@ -191,15 +437,22 @@ private function getUserPagesFooter($moduleDirname, $tableName, $language) */ public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $tableName = $table->getVar('table_name'); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); + $module = $this->getModule(); + $table = $this->getTable(); + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSubmit = $table->getVar('table_submit'); + $tablePermissions = $table->getVar('table_permissions'); + $tableSoleName = $table->getVar('table_solename'); + $tableBroken = $table->getVar('table_broken'); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); // Fields - $fieldId = ''; - $fieldMain = ''; + $fieldId = ''; + $fieldMain = ''; + $fieldSatus = ''; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); foreach (array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -209,10 +462,13 @@ public function render() if (1 == $fields[$f]->getVar('field_main')) { $fieldMain = $fieldName; // fieldMain = fields parameters main field } + if (16 == $fields[$f]->getVar('field_element')) { + $fieldSatus = $fieldName; // fieldMain = fields parameters main field + } } $content = $this->getHeaderFilesComments($module); $content .= $this->getUserPagesHeader($moduleDirname, $tableName, $fieldId); - $content .= $this->getUserPages($moduleDirname, $tableName, $fieldId, $fieldMain); + $content .= $this->getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldSatus, $language, "\t"); $content .= $this->getUserPagesFooter($moduleDirname, $tableName, $language); $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index ae05740d..41947329 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -299,9 +299,6 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'list'); } $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'breadcrumbs', ''); - if (in_array(1, $tableBroken)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'broken', ''); - } if (in_array(1, $tablePdf)) { $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'pdf', ''); } @@ -320,9 +317,6 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm if (in_array(1, $tableSingle)) { $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'single', ''); } - if (in_array(1, $tableSubmit)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'submit', ''); - } $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', ''); } @@ -381,11 +375,9 @@ private function getXoopsVersionSubmenu($language, $tables) ]; $contentIf = $uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); - $tableSubmit = []; $tableSearch = []; foreach (array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); $tableSearch[] = $tables[$t]->getVar('table_search'); if (1 == $tables[$t]->getVar('table_submenu')) { $contentIf .= $pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); @@ -397,16 +389,17 @@ private function getXoopsVersionSubmenu($language, $tables) unset($item); } ++$i; + if (1 == $tables[$t]->getVar('table_submit')) { + $contentIf .= $pc->getPhpCodeCommentLine('Sub', 'Submit', "\t"); + $descriptions = [ + 'name' => "{$language}SMNAME{$i}", + 'url' => "'{$tableName}.php?op=new'", + ]; + $contentIf .= $uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + ++$i; + } } - if (in_array(1, $tableSubmit)) { - $contentIf .= $pc->getPhpCodeCommentLine('Sub', 'Submit', "\t"); - $descriptions = [ - 'name' => "{$language}SMNAME{$i}", - 'url' => "'submit.php'", - ]; - $contentIf .= $uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); - ++$i; - } + //TODO: after finalizing creation of search.php by User/UserSearch.php this sub menu item can be activated /* if (in_array(1, $tableSearch)) { diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 4e4d7f68..fe0a40e2 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -170,7 +170,6 @@ private function getAdminPagesList($moduleDirname, $table, $language, $fieldInFo */ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $language, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); @@ -183,10 +182,7 @@ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $lan $ret .= $axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); $ret .= $xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); } - $ret .= $pc->getPhpCodeCommentLine('Get Form', null, $t); - $ret .= $xc->getXcHandlerCreateObj($tableName, $t); - $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); - $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + $ret .= $xc->getXcCommonPagesNew($tableName, $t); return $ret; } @@ -336,7 +332,6 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ */ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); @@ -355,10 +350,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $ret .= $axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); $ret .= $xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); } - $ret .= $pc->getPhpCodeCommentLine('Get Form', null, "\t\t"); - $ret .= $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); - $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); - $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + $ret .= $xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t); return $ret; } @@ -374,9 +366,9 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, */ private function getAdminPagesDelete($tableName, $language, $fieldId, $fieldMain, $t = '') { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - return $axc->getAdminCodeCaseDelete($language, $tableName, $fieldId, $fieldMain, $t); + return $xc->getXcCommonPagesDelete($language, $tableName, $fieldId, $fieldMain, $t); } /** diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index 98620d02..277aa9de 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -418,38 +418,4 @@ public function getAxcSetPrefix($anchor, $var, $t = '') { return "{$t}\${$anchor}->setPrefix({$var})"; } - - /** - * @public function getAdminCodeCaseDelete - * @param $language - * @param $tableName - * @param $fieldId - * @param $fieldMain - * @param string $t - * @return string - */ - public function getAdminCodeCaseDelete($language, $tableName, $fieldId, $fieldMain, $t = '') - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cf = Tdmcreate\Files\CreateFile::getInstance(); - $ccFieldId = $cf->getCamelCase($fieldId, false, true); - $ret = $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', '', $t); - $reqOk = "_REQUEST['ok']"; - $isset = $pc->getPhpCodeIsset($reqOk); - $xoopsSecurityCheck = $xc->getXcXoopsSecurityCheck(); - $xoopsSecurityErrors = $xc->getXcXoopsSecurityErrors(); - $implode = $pc->getPhpCodeImplode(', ', $xoopsSecurityErrors); - $redirectHeaderErrors = $xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t\t"); - $delete = $xc->getXcHandlerDelete($tableName, $tableName, 'Obj', 'Handler'); - $condition = $pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectHeaderErrors, false, $t . "\t"); - $redirectHeaderLanguage = $xc->getXcRedirectHeader($tableName, '', '3', "{$language}FORM_DELETE_OK", true, $t . "\t\t"); - $htmlErrors = $xc->getXcHtmlErrors($tableName, true); - $internalElse = $xc->getXcXoopsTplAssign('error', $htmlErrors, true, $t . "\t\t"); - $condition .= $pc->getPhpCodeConditions($delete, '', '', $redirectHeaderLanguage, $internalElse, $t . "\t"); - $mainElse = $xc->getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, 'delete', $t . "\t"); - $ret .= $pc->getPhpCodeConditions($isset, ' && ', "1 == \${$reqOk}", $condition, $mainElse, $t); - - return $ret; - } } diff --git a/commonfiles/assets/icons/16/status4.png b/commonfiles/assets/icons/16/status4.png new file mode 100644 index 0000000000000000000000000000000000000000..c1f0f5766668067f4f6420b1d565fdc63d336f09 GIT binary patch literal 2296 zcmbVO3se(l7ETqcz+&SXyCNvlL43u@wtE;;K*)7f)L(f-VMFRzaa&Putyg&P?W?|Ns8) zyZ8S0-jnT#y0}39$^IM;Comyilf=Hco@eYB_BXWe2b6vJS>u=3IGlh9p63K(-8$L7fn33mak3;5LjVtPDYs zfQJ!HqwI_dWGx+X!D98&lD6S6u>pgfs1+6ogdUd$fdXX$+5D z$C?@D@y3d%X&hxJI+>!(BL|f@Vltpsdk#hk%uFRn1Ld&IdT9@?K^a^HiiKh!B$Tmt zvPgo6#E3Y8FBBs};Sf|y83<#>FF+kVilgTp3|R=F7?*uA=V*@Q@E%wFSFihw znw`_bIpTUlg8?@N-uM4YZ)R`K7kXiDN*d2^i;uLxrP;Btyl4~m$TlcO4}>hcEm+Su zjOiU69i{rQo!q`v-Q1#-Z5P|tU2;RmgAep=JysUia_PeE-bSUO|GaCLU#YBzH>qfo z-%1X-_x{@*r$Z0c5`AA*mXj4zxFwO%?f3F_QilczVPD75hvA#cE|2nQdVgOcbn(cj zFVA%?$=c|Cy7CYb92AWHHL=A1mgqnc>IwqayB*^~=6!!Vyr6V3uj%;s3jUQ_=c+p9 zWBuPF#d);o*@xKX=D)po#&k8$AT9sNF{C}t?XLOfM_2Qs3D=eS3Fj2biun@7KXjWr zFDz-?S$~5pV0Ite*9?BZo4bEg!}*P?Of-{w#$H-~xgESey`V0j{Yux(56;?4qJr+w zsyp9Rzomasy#K?%!gHsBI`ck%?o)qdz`cAyF7L)0K}#EF9dAChD3<77Zo6u&q!;Ph6W@rza)|78Epo%y>0nVI?mo${DWdOn7cJ~BeC7GX<}h@12)}9Eb443@;7=~y`Kq)P+1(PzOt*aW>g|bV zBDwy-A5R6Ae|_41f6sT#jeP?CJ9VM4j~-@Mu3DBl7FpeMaT=CzV&3)s)z@cC3@kXY z81Bq(a>vHpYi(G(fpqJ}l=kds4_G>IZ*6bqEls2({2X& z{GsUS$JsIX8Is>xJH2%cBr5B+hZ~je)-BLtw*sb~3M^}?+EytimUUZ9@$M}5O8Lzd zC#`kcdt3D7)bfGX-j3$!c}f2ocl1H*gDK;=L`CeUh^7$Y?rWUgrUw@;(#fV7?8)or z9?kaa^z+RhSJ?JAXZz*rJ5HR6*XeYJkg~wSIk|=Mo()@T{NJtK`|R1j>!7vT{DD!` zoaCfv%?0V`$3.01 Alpha 2 [WORK IN PROGRESS - NOT RELEASED] Dev: XOOPS 2.5.11, PHP 7.4.2
    diff --git a/language/english/admin.php b/language/english/admin.php index 226044b2..9061f4ae 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -283,9 +283,10 @@ define('_AM_TDMCREATE_FIELD_THEAD', 'User: In Thead'); define('_AM_TDMCREATE_FIELD_TBODY', 'User: In Tbody'); define('_AM_TDMCREATE_FIELD_TFOOT', 'User: In Tfoot'); -define('_AM_TDMCREATE_FIELD_RECOMMENDED', 'It is recommended to create following fields:
    -- %s_date: for sorting items by date it is necessary to have a field, where date of creation/relevant date is stored
    -- %s_submitter: for sorting items by submitter it is necessary to have a field, where user of creation is stored

    '); +define('_AM_TDMCREATE_FIELD_RECOMMENDED', "It is recommended to create following fields:
    +- %s_date: for sorting items by date it is necessary to have a field, where date of creation/relevant date is stored
    +- %s_submitter: for sorting items by submitter it is necessary to have a field, where user of creation is stored
    +- %s_status: for using e.g. functions for broken items you need a 'Select Status'-field

    "); // List in templates define('_AM_TDMCREATE_ID_LIST', 'Id'); define('_AM_TDMCREATE_NAME_LIST', 'Name'); From 54e2440c4d01f4db1a76103cee7c8fa1fe42e65e Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 6 May 2020 08:18:10 +0200 Subject: [PATCH 007/266] added handling broken to admin area --- class/Files/Admin/AdminBroken.php | 195 ++++++++++++++ class/Files/Admin/AdminMenu.php | 7 + class/Files/CreateArchitecture.php | 11 + class/Files/CreateSmartyCode.php | 5 +- class/Files/CreateXoopsCode.php | 4 +- class/Files/Language/LanguageAdmin.php | 11 + class/Files/Language/LanguageModinfo.php | 6 + .../Templates/Admin/TemplatesAdminBroken.php | 254 ++++++++++++++++++ class/Files/User/UserXoopsVersion.php | 5 + commonfiles/assets/icons/32/broken.png | Bin 0 -> 2630 bytes docs/changelog.txt | 1 + testdata/english/tdmcreate_fields.yml | 4 +- testdata/german/tdmcreate_fields.yml | 4 +- 13 files changed, 499 insertions(+), 8 deletions(-) create mode 100644 class/Files/Admin/AdminBroken.php create mode 100644 class/Files/Templates/Admin/TemplatesAdminBroken.php create mode 100644 commonfiles/assets/icons/32/broken.png diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php new file mode 100644 index 00000000..da138138 --- /dev/null +++ b/class/Files/Admin/AdminBroken.php @@ -0,0 +1,195 @@ +setModule($module); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @private function getAdminBrokenHeader + * @param $moduleDirname + * @param $fieldId + * @return string + */ + private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); + $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); + $ret .= $this->getInclude(); + $ret .= $pc->getPhpCodeBlankLine(); + $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet', '', $t); + $ret .= $xc->getXcXoThemeAddStylesheet('style', $t); + $ret .= $axc->getAdminTemplateMain($moduleDirname, $tableName, $t); + $navigation = $axc->getAdminDisplayNavigation($tableName); + $ret .= $xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); + + return $ret; + } + + /** + * @private function getAdminBrokenList + * @param $table + * @param $language + * @param string $t + * @return string + */ + private function getAdminBrokenList($tables, $language, $t = '') + { + $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + + $ret = ''; + foreach (array_keys($tables) as $i) { + if (1 === (int)$tables[$i]->getVar('table_broken')) { + $tableName = $tables[$i]->getVar('table_name'); + $tableSoleName = $tables[$i]->getVar('table_solename'); + $ucfTableName = ucfirst($tableName); + $ret .= $pc->getPhpCodeBlankLine(); + $ret .= $pc->getPhpCodeCommentLine('Check table', $tableName, $t); + $ret .= $xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '0', 'Int', false, $t); + $adminpager = $xc->getXcGetConfig('adminpager'); + $ret .= $xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', false, $t); + $critName = 'cr' . $ucfTableName; + + $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); + $fieldId = ''; + $fieldMain = ''; + $fieldSatus = ''; + foreach (array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $fieldId = $fieldName; + } + if (1 == $fields[$f]->getVar('field_main')) { + $fieldMain = $fieldName; + } + if (16 == $fields[$f]->getVar('field_element')) { + $fieldSatus = $fieldName; + } + } + + $ret .= $xc->getXcCriteriaCompo($critName, $t); + $crit = $xc->getXcCriteria('', "'{$fieldSatus}'", 'Constants::STATUS_BROKEN', '', true); + $ret .= $xc->getXcCriteriaAdd($critName, $crit, $t, "\n"); + $ret .= $xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); + $ret .= $xc->getXcXoopsTplAssign($tableName . '_count', "\${$tableName}Count", true, $t); + $sprintf = $pc->getPhpCodeSprintf($language . 'BROKEN_RESULT', "'{$ucfTableName}'"); + $ret .= $xc->getXcXoopsTplAssign($tableName . '_result', $sprintf, true, $t); + + $ret .= $xc->getXcCriteriaSetStart($critName,'$start', $t); + $ret .= $xc->getXcCriteriaSetLimit($critName,'$limit', $t); + $contIf = $xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", $t . "\t"); + $foreach = $xc->getXcEqualsOperator("\${$tableSoleName}['table']", "'{$ucfTableName}'", '', $t . "\t\t"); + $foreach .= $xc->getXcEqualsOperator("\${$tableSoleName}['key']", "'{$fieldId}'", '', $t . "\t\t"); + $foreach .= $xc->getXcGetVar("{$tableSoleName}['keyval']", "{$tableName}All[\$i]", "{$fieldId}", false, $t . "\t\t"); + $foreach .= $xc->getXcGetVar("{$tableSoleName}['main']", "{$tableName}All[\$i]", "{$fieldMain}", false, $t . "\t\t"); + $foreach .= $xc->getXcXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}", $t . "\t\t"); + $contIf .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t . "\t"); + $contIf .= $xc->getXcPageNav($tableName, $t . "\t", 'start' . $ucfTableName, "'op=list&limit{$ucfTableName}=' . \$limit"); + $sprintf = $pc->getPhpCodeSprintf($language . 'BROKEN_NODATA', "'{$ucfTableName}'"); + $contElse = $xc->getXcXoopsTplAssign('nodata' . $ucfTableName, $sprintf, true, $t . "\t"); + + $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contIf, $contElse, $t); + $ret .= $pc->getPhpCodeUnset($critName, $t); + } + } + + $ret .= $pc->getPhpCodeBlankLine(); + + return $ret; + } + + /** + * @public function render + * @param null + * + * @return bool|string + */ + public function render() + { + $tf = Tdmcreate\Files\CreateFile::getInstance(); + + $module = $this->getModule(); + $tables = $this->getTables(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'AM'); + + $content = $this->getHeaderFilesComments($module); + $content .= $this->getAdminBrokenHeader($moduleDirname, 'broken'); + $content .= $this->getAdminBrokenList($tables, $language); + $content .= $this->getInclude('footer'); + + $tf->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $tf->renderFile(); + } +} diff --git a/class/Files/Admin/AdminMenu.php b/class/Files/Admin/AdminMenu.php index c2b27972..38084768 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -168,14 +168,21 @@ private function getAdminMenuList($module, $language, $langAbout, $menu) $ret = ''; $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $tablePermissions = []; + $tableBroken = []; foreach (array_keys($tables) as $t) { $tablePermissions[] = $tables[$t]->getVar('table_permissions'); + $tableBroken[] = $tables[$t]->getVar('table_broken'); if (1 == $tables[$t]->getVar('table_admin')) { ++$menu; $param1 = ['title' => "{$language}{$menu}", 'link' => "'admin/{$tables[$t]->getVar('table_name')}.php'", 'icon' => "'assets/icons/32/{$tables[$t]->getVar('table_image')}'"]; $ret .= $this->getAdminMenuArray($param1, true); } } + if (in_array(1, $tableBroken)) { + ++$menu; + $param2 = ['title' => "{$language}{$menu}", 'link' => "'admin/broken.php'", 'icon' => "\$sysPathIcon32.'/brokenlink.png'"]; + $ret .= $this->getAdminMenuArray($param2, true); + } if (in_array(1, $tablePermissions)) { ++$menu; $param2 = ['title' => "{$language}{$menu}", 'link' => "'admin/permissions.php'", 'icon' => "\$sysPathIcon32.'/permissions.png'"]; diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 8a2958d7..92de37a3 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -423,6 +423,17 @@ public function setFilesToBuilding($module) $languageBlocks->write($module, $tables, 'blocks.php'); $ret[] = $languageBlocks->render(); } + // Creation of admin broken files + if (in_array(1, $tableBroken)) { + // Admin broken File + $adminPermissions = Tdmcreate\Files\Admin\AdminBroken::getInstance(); + $adminPermissions->write($module, $tables, 'broken.php'); + $ret[] = $adminPermissions->render(); + // Templates Admin broken File + $adminTemplatesPermissions = Tdmcreate\Files\Templates\Admin\TemplatesAdminBroken::getInstance(); + $adminTemplatesPermissions->write($module, $tables, $moduleDirname . '_admin_broken.tpl'); + $ret[] = $adminTemplatesPermissions->render(); + } // Creation of admin permission files if (in_array(1, $tablePermissions)) { // Admin Permissions File diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index e2798789..8c072ed1 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -132,11 +132,12 @@ public function getSmartyNoSimbol($noSimbol = '', $t = '') * @param string $language * @param mixed $const * @param string $t + * @param string $n * @return string */ - public function getSmartyConst($language, $const, $t = '') + public function getSmartyConst($language, $const, $t = '', $n = '') { - return "{$t}<{\$smarty.const.{$language}{$const}}>"; + return "{$t}<{\$smarty.const.{$language}{$const}}>{$n}"; } /** diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index dae575a5..27398061 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1209,13 +1209,13 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f * @param string $t * @return string */ - public function getXcPageNav($tableName, $t = '') + public function getXcPageNav($tableName, $t = '', $paramStart = 'start', $paramOp = "'op=list&limit=' . \$limit") { $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Display Navigation', null, $t); $condition = $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/pagenav', true, false, 'include', $t . "\t"); - $condition .= $cxc->getClassXoopsPageNav('pagenav', $tableName . 'Count', 'limit', 'start', 'start', "'op=list&limit=' . \$limit", false, $t . "\t"); + $condition .= $cxc->getClassXoopsPageNav('pagenav', $tableName . 'Count', 'limit', 'start', $paramStart, $paramOp, false, $t . "\t"); $condition .= $this->getXcXoopsTplAssign('pagenav', '$pagenav->renderNav(4)', true, $t . "\t"); $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '$limit', $condition, false, $t); diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 9c8ae890..15a1c379 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -157,6 +157,7 @@ public function getLanguageAdminClass($language, $tables) $tableId = $tables[$t]->getVar('table_id'); $tableMid = $tables[$t]->getVar('table_mid'); $tableSoleName = $tables[$t]->getVar('table_solename'); + $tableBroken = $tables[$t]->getVar('table_broken'); $ucfTableSoleName = ucfirst($tableSoleName); $fields = $this->getTableFields($tableMid, $tableId); @@ -240,6 +241,16 @@ public function getLanguageAdminClass($language, $tables) $ret .= $this->defines->getDefine($language, 'STATUS_APPROVED', 'Approved'); $ret .= $this->defines->getDefine($language, 'STATUS_BROKEN', 'Broken'); } + if ($tableBroken > 0) { + $ret .= $this->defines->getAboveDefines('Broken'); + $ret .= $this->defines->getDefine($language, 'BROKEN_RESULT', 'Broken items in table %s'); + $ret .= $this->defines->getDefine($language, 'BROKEN_NODATA', 'No broken items in table %s'); + $ret .= $this->defines->getDefine($language, 'BROKEN_TABLE', 'Table'); + $ret .= $this->defines->getDefine($language, 'BROKEN_KEY', 'Key field'); + $ret .= $this->defines->getDefine($language, 'BROKEN_KEYVAL', 'Key value'); + $ret .= $this->defines->getDefine($language, 'BROKEN_MAIN', 'Info main'); + } + if ($fieldSampleListValue > 0) { $ret .= $this->defines->getAboveDefines('Sample List Values'); $ret .= $this->defines->getDefine($language, 'LIST_1', 'Sample List Value 1'); diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 4e800388..11901746 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -111,12 +111,18 @@ private function getLanguageMenu($module, $language) $ret = $df->getAboveHeadDefines('Admin Menu'); $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Dashboard'); $tablePermissions = []; + $tableBroken = []; foreach (array_keys($tables) as $i) { ++$menu; $tablePermissions[] = $tables[$i]->getVar('table_permissions'); + $tableBroken[] = $tables[$i]->getVar('table_broken'); $ucfTableName = ucfirst($tables[$i]->getVar('table_name')); $ret .= $df->getDefine($language, "ADMENU{$menu}", $ucfTableName); } + if (in_array(1, $tableBroken)) { + ++$menu; + $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Broken items'); + } if (in_array(1, $tablePermissions)) { ++$menu; $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Permissions'); diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php new file mode 100644 index 00000000..57b9fa76 --- /dev/null +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -0,0 +1,254 @@ +setModule($module); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesAdminBrokenHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesAdminBrokenHeader($moduleDirname) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $ret = $hc->getHtmlComment('Header', "\n"); + $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); + + return $ret; + } + + /** + * @private function getTemplatesAdminBrokenTableThead + * @param $tableSoleName + * @param $tableAutoincrement + * @param string $fields + * @param string $language + * @return string + */ + private function getTemplatesAdminBrokenTableThead($language, $t) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $th = ''; + + $lang = $sc->getSmartyConst($language, 'BROKEN_TABLE'); + $th .= $hc->getHtmlTableHead($lang, 'center', '', $t . "\t\t"); + $lang = $sc->getSmartyConst($language, 'BROKEN_MAIN'); + $th .= $hc->getHtmlTableHead($lang, 'center', '', $t . "\t\t"); + $lang = $sc->getSmartyConst($language, 'FORM_ACTION'); + $th .= $hc->getHtmlTableHead($lang, 'center width5', '', $t . "\t\t"); + $tr = $hc->getHtmlTableRow($th, 'head', $t . "\t"); + $ret = $hc->getHtmlTableThead($tr, '', $t); + + return $ret; + } + + /** + * @private function getTemplatesAdminBrokenTableTBody + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param string $fields + * @return string + * @internal param string $language + */ + private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $td = ''; + + $doubleKey = $sc->getSmartyDoubleVar($tableSoleName, 'key'); + $doubleVal = $sc->getSmartyDoubleVar($tableSoleName, 'keyval'); + + $double = $sc->getSmartyDoubleVar($tableSoleName, 'table'); + $td .= $hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); + $double = $sc->getSmartyDoubleVar($tableSoleName, 'main'); + $td .= $hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); + $lang = $sc->getSmartyConst('', '_EDIT'); + $src = $sc->getSmartyNoSimbol('xoModuleIcons16 edit.png'); + $img = $hc->getHtmlImage($src, $tableName, '', '', ''); + $anchor = $hc->getHtmlAnchor($tableName . ".php?op=edit&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', "\t\t\t\t\t", "\n"); + $lang = $sc->getSmartyConst('', '_DELETE'); + $src = $sc->getSmartyNoSimbol('xoModuleIcons16 delete.png'); + $img = $hc->getHtmlImage($src, $tableName, '', '', ''); + $anchor .= $hc->getHtmlAnchor($tableName . ".php?op=delete&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', "\t\t\t\t\t", "\n"); + $td .= $hc->getHtmlTableData($anchor, 'center width5', '', "\t\t\t\t", "\n", true); + $cycle = $sc->getSmartyNoSimbol('cycle values=\'odd, even\''); + $tr = $hc->getHtmlTableRow($td, $cycle, "\t\t\t"); + $foreach = $sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '','', "\t\t\t"); + $tbody = $hc->getHtmlTableTbody($foreach,'' , "\t\t"); + + return $tbody; + } + + /** + * @private function getTemplatesAdminBrokenTable + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param string $fields + * @param string $language + * @return string + */ + private function getTemplatesAdminBrokenTable($moduleDirname, $tableName, $tableSoleName, $language) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $tbody = $this->getTemplatesAdminBrokenTableThead($language, "\t\t"); + $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $language, "\t\t"); + $ret .= $hc->getHtmlTable($tbody, 'table table-bordered', "\t"); + + return $ret; + } + + /** + * @private function getTemplatesAdminBrokenList + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param string $fields + * @param string $language + * @return string + */ + private function getTemplatesAdminBrokenList($moduleDirname, $table, $language, $t = '') + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $ucfTableName = ucfirst($tableName); + $double = $sc->getSmartySingleVar($tableName . '_result'); + $ret = $hc->getHtmlHNumb($double, 3, ''); + $htmlTable = $this->getTemplatesAdminBrokenTable($moduleDirname, $tableName, $tableSoleName, $language); + $htmlTable .= $hc->getHtmlDiv(' ', 'clear', $t, "\n", false); + $single = $sc->getSmartySingleVar('pagenav'); + $div = $hc->getHtmlDiv($single, 'xo-pagenav floatright', $t . "\t", "\n", false); + $div .= $hc->getHtmlDiv('', 'clear spacer', $t . "\t" , "\n", false); + $htmlTable .= $sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', $t ); + $noData = $sc->getSmartySingleVar('nodata' . $ucfTableName, $t . "\t\t"); + $src = $sc->getSmartyNoSimbol('xoModuleIcons32 button_ok.png'); + $noData .= $hc->getHtmlImage($src, $tableName,'','',"\n"); + $div = $hc->getHtmlDiv($noData, '', $t . "\t", "\n", true); + $div .= $hc->getHtmlDiv('', 'clear spacer', $t . "\t" , "\n", false); + $div .= $hc->getHtmlBr('2', '', $t . "\t"); + $contElse = $sc->getSmartyConditions('nodata' . $ucfTableName, '', '', $div, false, '', '', $t); + $ret .= $sc->getSmartyConditions($tableName . '_count', '', '', $htmlTable, $contElse); + $ret .= $hc->getHtmlEmpty('', '', "\n"); + + return $ret; + } + + /** + * @private function getTemplatesAdminBrokenFooter + * @param string $moduleDirname + * @return string + */ + private function getTemplatesAdminBrokenFooter($moduleDirname) + { + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $single = $sc->getSmartySingleVar('error'); + $strong = $hc->getHtmlTag('strong', [], $single, false, '', ''); + $div = $hc->getHtmlDiv($strong, 'errorMsg', "\t", "\n"); + $ret = $sc->getSmartyConditions('error', '', '', $div); + $ret .= $hc->getHtmlEmpty('', '', "\n"); + $ret .= $hc->getHtmlComment('Footer', "\n"); + $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); + + return $ret; + } + + /** + * @public function render + * @param null + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $tables = $this->getTables(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'AM'); + $content = $this->getTemplatesAdminBrokenHeader($moduleDirname); + foreach ($tables as $table) { + if (1 === (int)$table->getVar('table_broken')) { + $content .= $this->getTemplatesAdminBrokenList($moduleDirname, $table, $language, "\t"); + } + } + $content .= $this->getTemplatesAdminBrokenFooter($moduleDirname); + + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 41947329..cfac3751 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -262,11 +262,16 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', '', true); $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', '', true); $tablePermissions = []; + $tableBroken = []; foreach (array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $tablePermissions[] = $tables[$t]->getVar('table_permissions'); + $tableBroken[] = $tables[$t]->getVar('table_broken'); $item[] .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, '', true); } + if (in_array(1, $tableBroken)) { + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'broken', '', true); + } if (in_array(1, $tablePermissions)) { $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'permissions', '', true); } diff --git a/commonfiles/assets/icons/32/broken.png b/commonfiles/assets/icons/32/broken.png new file mode 100644 index 0000000000000000000000000000000000000000..44987c06fafd7ff0c62ba2c3626efdcc89f664e8 GIT binary patch literal 2630 zcmV-M3c2-(P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipS_ z4Ja)tR8i&3)XXr7k5WX-u@#1LKoAkjSOhf!O-N!MgoJbgNhh6t zBQr_%oOKQwMsp@QG=7Fh}>IGWTSBHl`F^xsFZ}*({)NT!+%hLGrFQ=~+B? zB0=xH1zrO9X9Zu8zd(V9((u_5e7&9}iwk_ewK025+r|%)x$asqdwLYU2SEq|7z$!> zm>8GBp1o@Pxvd=A_v)$96ra1h%+qgSU9tk-O2d66cr?a07A4Z3TYk^IQg`K*O7i)d zKqP-4seZo~rBHQsR3|26;Gu7;L;Z(#{U*!0n>|Xml`cVnuczSiJ*dYH@Y>buZd}p* z(L0cdDU?L#omSLL2UP8&0BZJ~2*gmRTm$+2`{m{De#bu?=dyn(ar}=e@YOVYp#+b> z!2ACGquq0tE`^x_NQ4MACF~epQ;vxsU^)y5qlk=Y(SRZo1W+g2=6EdltE zM3E@Nv{ET+{_@LtU(aG$6HhC~Cm;$zDa5v^*4N8V9{Ogm&5E)eLgim)ufsf_{A+Rk zY0YITu4>6OLH}V0t6&&Z=QQ#3*%5hl&u-=W{u?vZ@R4H3%aJe!RI6aeiq4XlyKm!A z^Zbu3yZh6z%ny2zH;+OPqO`_JrPPMoZZoHT`qLNg^SSaZP6Oaeb#O(JbeEVfZdkV- z_U(i5b4aO3wLZh+#}9F+|8QZf?0vSkB6lAM*#1Vy=p4=TuLBCpEb`C#9Q&2+=T@d; zx0~a6jQt0oQh~`yn3+N4r%A?>Dj;0YoEjzBjb~dXdg{iBfS1Q?^J~ ztNeU*xBOd*!3`D*0dBT09!_WK*))0eGVyMIe$lOK= zZoVmc&}RH?9st-FQ@>c3ZesfI5yrv**AF?la*^yh&_DevpEcV8P67;s7a?zCv%PG| z51e@oQhf7u<*0zNs^WFEG5Qbxh~M`D-ei$-#UWjCRIxspYzxZ2d$^7P^NV$m5I(%D z`&~@z-NzdmBA|WQVqQIRK)n|6sh0wV-zi~@HL}_4S=d|9z63`Os7OKC5MuKe$ZwOj z8tZ#8SZbL@w`nLZ49Sm;vACyQ`a(YW?kTqF|1LsRj9V52ksJ}>I4~N)lr1vi1pQCA zJavH;!BK>i z<10~Y_CHU3CH&1(JqAmseD0LLLG5O>iOk-X=De8?(KqLtmVUywbDD$g&db zNX=1wZyf#gmI5FAyF$sDs5)O7O{XaVA<$8BsJHCI4fxF(Ab^gT(i8wsAeBsTx;VqZ zDqHW!TuA<06Pvt-`rdIZQk>4KNQ3||tQfD<<#_4D$yfRuK5#=l;p5;YqG;r7%)(Qe zvVwD-N7jn5P_x(sII5LVmRe8;3d}GhA4P2U8N~mCvfRjK$!2=ps49M`qO<~05VLG{ zCNuO6pWb`0!iGW>|Am>FjE-ceY*}pyrSJsGVTh$|Ovu)5SA-x47*#N=pe(}bFa)T+ zEm6%;o6U5x*9<*zJx>|48PzgP_S;EzoEqPK&|&RJmA9205tLXqE-CMxaTU|^>m!Io(4?R{mE@f7b3A0k1V~2Vp0RYIvju1Z ztT14z8kftv=YQh9Vm>ha>Z3iTAqJ7s2o?~x3}T|#SMqmnb6I=zBIE$iCiv8%%PxmK zuanX+F9My2wBAgLg3n$l{-7%I4ZKdNy3F8AV=|8E60r+I4CHEZJL z_TQYCL_?PHLF_Y@%Zqtax`C_ig0%M=T*aFRq`w1#1BmsuDyLhGe*8ZRo5C` z+k=KBD;c})CiWg5%rA0^rH6`~F4ZCtAhs#aHFqSr|Jsy(`idLZbuT?vzF~UkY<(OK_?Uldv1>)PVf8(BjMHb%a8}i_qb*?DHgvV( z#!ZS*m0+fX_8el$AlcqZBHcjB3#Hh%Lj?v@1yTxHk}38#O1y? z*TtB-5caRkG_>5C%P>7~lDq*W1xcV$pk9O7kRxhoMp-d%J=DkuPQJv90r}acIioal zb6K`omOMFjRz^(j+~)G*r6wE+{>WT#W1P-*c&<~~OFq-xE)6G!mGAp#%fPZNbT$KZ zbzsLpYX}0wby39vQL#kehX@MQ(Z*xrlk6-Oydi^4+gu)BX~ApNOPGvSm}Hh&{7-|! zM>Z_%VC}pHlI1cIMyN~%vRTMvY6uk<$|a;!Mnxec;_MuokY|scP-o&C8xrp7^VqrE zgx7;h9L?@Y!owA~HNmYp_>Y{+^7pj0vV38uv@U2-*{)8QKMzbBrY0$#9O3M#Q*vx@ zNbMLH;G7Pp&JulhhsOis5#{sUe#yh>Y8&>|%CT`vg7tCO+$3sER$Fu9ftXeVS}6hz z<*F}5gTj3.01 Alpha 2 [WORK IN PROGRESS - NOT RELEASED] Dev: XOOPS 2.5.11, PHP 7.4.2
    diff --git a/testdata/english/tdmcreate_fields.yml b/testdata/english/tdmcreate_fields.yml index b9ada263..b8b99a67 100644 --- a/testdata/english/tdmcreate_fields.yml +++ b/testdata/english/tdmcreate_fields.yml @@ -254,13 +254,13 @@ field_tid: '2' field_order: '6' field_name: art_online - field_type: '3' + field_type: '2' field_value: '1' field_attribute: '1' field_null: '2' field_default: '0' field_key: '1' - field_element: '6' + field_element: '16' field_parent: '0' field_admin: '1' field_inlist: '1' diff --git a/testdata/german/tdmcreate_fields.yml b/testdata/german/tdmcreate_fields.yml index b9ada263..b8b99a67 100644 --- a/testdata/german/tdmcreate_fields.yml +++ b/testdata/german/tdmcreate_fields.yml @@ -254,13 +254,13 @@ field_tid: '2' field_order: '6' field_name: art_online - field_type: '3' + field_type: '2' field_value: '1' field_attribute: '1' field_null: '2' field_default: '0' field_key: '1' - field_element: '6' + field_element: '16' field_parent: '0' field_admin: '1' field_inlist: '1' From 65c8a80ce61abc672ccc2c56ea52a72f33c71ec9 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 6 May 2020 09:54:07 +0200 Subject: [PATCH 008/266] removed unused files --- _TODO.txt | 15 - {class => _archive/class}/AddFiles.php | 0 {class => _archive/class}/AddFilesHandler.php | 0 .../class}/Files/User/UserSingle.php | 0 .../class}/Files/User/UserVisit.php | 0 docs/changelog.txt | 355 +++++++++--------- 6 files changed, 179 insertions(+), 191 deletions(-) rename {class => _archive/class}/AddFiles.php (100%) rename {class => _archive/class}/AddFilesHandler.php (100%) rename {class => _archive/class}/Files/User/UserSingle.php (100%) rename {class => _archive/class}/Files/User/UserVisit.php (100%) diff --git a/_TODO.txt b/_TODO.txt index 82801835..63503501 100644 --- a/_TODO.txt +++ b/_TODO.txt @@ -30,22 +30,7 @@ this file currently is not rating ***************************** Open questions: *************** -Addfiles: -are the files class/Addfiles.php and Addfileshandler.php still needed? search.php: what should this file do, additionally to regular search? UserSearch has to be adapted - - -single.php: -what should this file show? -what should it be used for? - - -visit.php: -what should this file show? -what should it be used for? - - - diff --git a/class/AddFiles.php b/_archive/class/AddFiles.php similarity index 100% rename from class/AddFiles.php rename to _archive/class/AddFiles.php diff --git a/class/AddFilesHandler.php b/_archive/class/AddFilesHandler.php similarity index 100% rename from class/AddFilesHandler.php rename to _archive/class/AddFilesHandler.php diff --git a/class/Files/User/UserSingle.php b/_archive/class/Files/User/UserSingle.php similarity index 100% rename from class/Files/User/UserSingle.php rename to _archive/class/Files/User/UserSingle.php diff --git a/class/Files/User/UserVisit.php b/_archive/class/Files/User/UserVisit.php similarity index 100% rename from class/Files/User/UserVisit.php rename to _archive/class/Files/User/UserVisit.php diff --git a/docs/changelog.txt b/docs/changelog.txt index f509812e..b4b924ac 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,49 +1,52 @@
    3.02 Alpha 1 [WORK IN PROGRESS - NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.2
    -- added implementation of common files (goffy) -- changed modversion from xoops_version.php into arrays (goffy) -- changed submenu in xoops_version.php (goffy) -- splitted class files into class and classhandler (goffy) -- added usage of namespaces in created modules (goffy) -- added sample data (goffy) -- rebuild install, uninstall and update (goffy) -- implememted feedback (goffy) -- replaced Xmf\Request::... by use Xmf\Request + Request::... (goffy) -- implemented image resizer (goffy) -- rebuild language defines for upload in forms (goffy) -- fixed bug with multiple upload formfields in one form (goffy) -- updated permissions to handle multiple permissions (goffy) -- added permissions class and permissions handler (goffy) -- cosmetics (goffy) -- fixed bugs in getXoopsFormSelectFile and getClassGetTableSolenameById (goffy) -- added save/load group permissions to sample data (goffy) -- rebuild blocks file (goffy) -- splitted CreateHtmlSmartycodes into CreateHtmlcode/CreateSmartycode for better handling (goffy) -- added images for checkbox and status in lists in admin area (goffy) -- fixed bugs at building (goffy) -- renamed functions for better sorting (goffy) -- added new field elements SelectStatus, SelectCombo, Password, SelectCountry and SelectLang (goffy) -- rebuilt include/search.inc.php (goffy) -- added default values for form elements (goffy) -- adapted editor handling (goffy) -- preparation for new tpl styles (goffy) -- transfered code broken from brocken.php to the userpage (goffy) -- transfered code broken from submit.php to the userpage (goffy) -- added handling broken to admin area (goffy) +work done by goffy: + - added implementation of common files + - changed modversion from xoops_version.php into arrays + - changed submenu in xoops_version.php + - splitted class files into class and classhandler + - added usage of namespaces in created modules + - added sample data + - rebuild install, uninstall and update + - implememted feedback + - replaced Xmf\Request::... by use Xmf\Request + Request::... + - implemented image resizer + - rebuild language defines for upload in forms + - fixed bug with multiple upload formfields in one form + - updated permissions to handle multiple permissions + - added permissions class and permissions handler + - cosmetics + - fixed bugs in getXoopsFormSelectFile and getClassGetTableSolenameById + - added save/load group permissions to sample data + - rebuild blocks file + - splitted CreateHtmlSmartycodes into CreateHtmlcode/CreateSmartycode for better handling + - added images for checkbox and status in lists in admin area + - fixed bugs at building + - renamed functions for better sorting + - added new field elements SelectStatus, SelectCombo, Password, SelectCountry and SelectLang + - rebuilt include/search.inc.php + - added default values for form elements + - adapted editor handling + - preparation for new tpl styles + - transfered code broken from brocken.php to the corresponding table page + - transfered code submit from submit.php to the corresponding table page + - added handling broken to admin area + - removed class/Addfiles.php and Addfileshandler.php (duplication of morefiles) + - removed class/Files/User/UserSingle.php and UserVisit.php
    3.01 Alpha 2 [WORK IN PROGRESS - NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.2
    -- code cosmetics (mamba) -- added "Build" icons to Modules and Tables tabs - time saver (mamba) -- cosmetics admin area (goffy) -- fixed problems with test data (goffy) -- fixed bug with upload file/images in admin pages (goffy) -- fixed bug with save permissions in admin pages (goffy) -- fixed bugs in tpl creation (goffy) -- improved tpl creation (goffy) -- added check for upload permission to form class (goffy) -- removed fb and disqus comments preferences (goffy) -- fixed bug in print.php (goffy) + - code cosmetics (mamba) + - added "Build" icons to Modules and Tables tabs - time saver (mamba) + - cosmetics admin area (goffy) + - fixed problems with test data (goffy) + - fixed bug with upload file/images in admin pages (goffy) + - fixed bug with save permissions in admin pages (goffy) + - fixed bugs in tpl creation (goffy) + - improved tpl creation (goffy) + - added check for upload permission to form class (goffy) + - removed fb and disqus comments preferences (goffy) + - fixed bug in print.php (goffy) ************************************************************* THIS IS LAST VERSION WHICH CREATES MODULES WITHOUT NAMESPACES @@ -51,280 +54,280 @@ THIS IS LAST VERSION WHICH CREATES MODULES WITHOUT NAMESPACES
    3.01 Alpha 1 [2020-01-01]
    Dev: XOOPS 2.5.11, PHP 7.4.1
    -- namespaces (mamba) -- class autoloading (mamba) -- added feedback page (mamba) -- PSR12 cosmetics (mamba) -- fixed sorting of fields (mamba) -- updated Scrutinizer config (mamba) -- added Config (mamba) -- moved icons to /images (mamba) + - namespaces (mamba) + - class autoloading (mamba) + - added feedback page (mamba) + - PSR12 cosmetics (mamba) + - fixed sorting of fields (mamba) + - updated Scrutinizer config (mamba) + - added Config (mamba) + - moved icons to /images (mamba) ================================================= 2018/03/27: Version 1.91 alpha 3.6 [NOT RELEASED] ================================================= -- change from adminMenu to adminObject (mamba) -- buttons on left (mamba) -- replace static calls (mamba) -- fix statistics (mamba) -- implemented yoda in file creation (goffy) -- css corrections (goffy) -- yoda corrections (goffy) -- corrected css for templates admin tables/fields (goffy) -- replace < br /> by < br >; changed also function TDMCreateHTMLCode, TDMCreateHTMLSmartyCode (goffy) -- corrected typing errors (e.g. getVat) (goffy) -- removed unnecessary semicolons in js (goffy) -- added PHPDocs (goffy) -- replace double quote in language define by single quote; changed also function getXcTplDisplay, getDefine (goffy) -- removed unnecessary closing tag (img) (goffy) -- changed getXcLoadLanguage (include moduledir) (goffy) -- cosmetics (goffy) -- changed comparision to stict (===) (goffy) -- solved wrong string concatenate (goffy) -- Update README.md (timgno) -- fixed notification of no return value from php code inspection (goffy) -- XoopsFormTextDateSelect: created var for isNew was not used (goffy) -- Class files - getValues... function: changed from {fieldname} to {tablename}Obj (goffy) -- Class files - getForm: added field names to comment lines (goffy) -- Creation of xoopsversion.php: config was based on last table (goffy) -- config name for xoopseditorhandler was too long (goffy) -- corrected case mismatch: xoops_gethandler into xoops_getHandler (goffy) -- unnecessary parentheses: removed brackets (goffy) -- unnecessary double quotes (goffy) -- fixed bug in function getValuesInObject (wrong object name) (goffy) -- creation of form: replaced XoopsFormButton by XoopsFormButtonTray (goffy) -- LanguageModinfo.php: Config items have been created only by fields of last table; changed to all tables (goffy) + - change from adminMenu to adminObject (mamba) + - buttons on left (mamba) + - replace static calls (mamba) + - fix statistics (mamba) + - implemented yoda in file creation (goffy) + - css corrections (goffy) + - yoda corrections (goffy) + - corrected css for templates admin tables/fields (goffy) + - replace < br /> by < br >; changed also function TDMCreateHTMLCode, TDMCreateHTMLSmartyCode (goffy) + - corrected typing errors (e.g. getVat) (goffy) + - removed unnecessary semicolons in js (goffy) + - added PHPDocs (goffy) + - replace double quote in language define by single quote; changed also function getXcTplDisplay, getDefine (goffy) + - removed unnecessary closing tag (img) (goffy) + - changed getXcLoadLanguage (include moduledir) (goffy) + - cosmetics (goffy) + - changed comparision to stict (===) (goffy) + - solved wrong string concatenate (goffy) + - Update README.md (timgno) + - fixed notification of no return value from php code inspection (goffy) + - XoopsFormTextDateSelect: created var for isNew was not used (goffy) + - Class files - getValues... function: changed from {fieldname} to {tablename}Obj (goffy) + - Class files - getForm: added field names to comment lines (goffy) + - Creation of xoopsversion.php: config was based on last table (goffy) + - config name for xoopseditorhandler was too long (goffy) + - corrected case mismatch: xoops_gethandler into xoops_getHandler (goffy) + - unnecessary parentheses: removed brackets (goffy) + - unnecessary double quotes (goffy) + - fixed bug in function getValuesInObject (wrong object name) (goffy) + - creation of form: replaced XoopsFormButton by XoopsFormButtonTray (goffy) + - LanguageModinfo.php: Config items have been created only by fields of last table; changed to all tables (goffy) ================================= 1.91 alpha 3.5 [NOT RELEASED] ================================= -- cosmetics, PHP 7 (mamba) -- admin/settings.php: bug in xoopsSecurity during save (goffy) -- created tdmxoops_logo.png (copy of tdmxoops_logo.gif) in .../assets/images/logos/ in order to fix error when building new module -- adoption in module creation procedure (goffy) - -- changed module logo creator - module name will be used instead of module dir name - -- class/files/header/AdminHeader.php: - --- adopted to XMF - --- some tabs in if-conditions were not set - -- class/files/language/LanguageAdmin.php: if the last field in a table is not in form for admin, then in language/admin.php the defines for "{$ucfTableSoleName} add/edit" are not created (goffy) - -- fixed bug in helper.php/function getConfig: adopted for case when config is an array - -- fixed bug in xoopsverion: release date must be format Y/m/d, otherwise moduladmin.php causes an error - -- fixed various cases of wrong number of indentions/tabs) -- changed buttons from right to left (mamba) -- renamed $adminMenu to $adminObject (mamba) + - cosmetics, PHP 7 (mamba) + - admin/settings.php: bug in xoopsSecurity during save (goffy) + - created tdmxoops_logo.png (copy of tdmxoops_logo.gif) in .../assets/images/logos/ in order to fix error when building new module + - adoption in module creation procedure (goffy) + -- changed module logo creator - module name will be used instead of module dir name + -- class/files/header/AdminHeader.php: + --- adopted to XMF + --- some tabs in if-conditions were not set + -- class/files/language/LanguageAdmin.php: if the last field in a table is not in form for admin, then in language/admin.php the defines for "{$ucfTableSoleName} add/edit" are not created (goffy) + -- fixed bug in helper.php/function getConfig: adopted for case when config is an array + -- fixed bug in xoopsverion: release date must be format Y/m/d, otherwise moduladmin.php causes an error + -- fixed various cases of wrong number of indentions/tabs) + - changed buttons from right to left (mamba) + - renamed $adminMenu to $adminObject (mamba) ================================= 2016/01/28: Version 1.91 alpha 3.x ================================= -- Refactoring Classes with Php Functions in place of Heredoc -- Alpha Contribute & Testers (Timgno, Mamba, Goffy) -- fixes for calls to "getXcEqualsOperator" from tdmcreate\class\files\user\UserXoopsVersion.php (mamba) + - Refactoring Classes with Php Functions in place of Heredoc + - Alpha Contribute & Testers (Timgno, Mamba, Goffy) + - fixes for calls to "getXcEqualsOperator" from tdmcreate\class\files\user\UserXoopsVersion.php (mamba) ================================= 2015/06/01: Version 1.91 alpha 3 ================================= -- Added templates breacrumbs -- Added index in tables form to put code in user/index.php -- Added more functions in classes -- Added more field database in tables form + - Added templates breacrumbs + - Added index in tables form to put code in user/index.php + - Added more functions in classes + - Added more field database in tables form ================================= 2015/04/27: Version 1.91 alpha 2 ================================= -- Added templates item for tables & fields -- Added sortable table for tables & fields -- Added more parameters in tables form -- Added more parameters in fields form -- Added more field database in tables form -- Added more field database in fields form -- Added checkAll checkbox in modules & tables form -- Added more files for user side -- Added autoload file for all classes -- Added settings to customize module informations + - Added templates item for tables & fields + - Added sortable table for tables & fields + - Added more parameters in tables form + - Added more parameters in fields form + - Added more field database in tables form + - Added more field database in fields form + - Added checkAll checkbox in modules & tables form + - Added more files for user side + - Added autoload file for all classes + - Added settings to customize module informations ================================= 2014/01/02: Version 1.91 alpha 1 ================================= -- Refactoring -- Rewritten from scratch -- Added templates admin -- Added fields table -- Added more parameters in fields form + - Refactoring + - Rewritten from scratch + - Added templates admin + - Added fields table + - Added more parameters in fields form ================================= 2013/09/02: Version 1.91 alpha 1 ================================= -- Skipped to versione 1.91 alpha 1 + - Skipped to versione 1.91 alpha 1 ================================= 2013/05/12: Version 1.39 RC 1 ================================= -- Added minimum php textbox in admin/modules.php -- Added minimum xoops textbox in admin/modules.php -- Added minimum admin textbox in admin/modules.php -- Added minimum mysql textbox in admin/modules.php -- fixed bugs + - Added minimum php textbox in admin/modules.php + - Added minimum xoops textbox in admin/modules.php + - Added minimum admin textbox in admin/modules.php + - Added minimum mysql textbox in admin/modules.php + - fixed bugs ================================= 2013/04/01: Version 1.39 Beta 4 ================================= -- fixed several error notices and bugs + - fixed several error notices and bugs ================================= 2013/03/28: Version 1.39 Beta 3 ================================= -- fixed several error notices and bugs + - fixed several error notices and bugs ================================= 2013/03/25: Version 1.39 Beta 2 ================================= -- fixed several error notices and bugs + - fixed several error notices and bugs ================================= 2013/03/22: Version 1.39 Beta 1 ================================= -- fixed several error notices and bugs + - fixed several error notices and bugs ================================= 2013/02/23: Version 1.38.6 Beta 1 ================================= -- added: fields notifications, paypal button and subversion in modules -- added: fields notifications in tables -- modified: file const_header.php for subversion -- modified: file const_admin_about.php for paypal button -- added: module info pulled from Preferences -- fixed several error notices and bugs + - added: fields notifications, paypal button and subversion in modules + - added: fields notifications in tables + - modified: file const_header.php for subversion + - modified: file const_admin_about.php for paypal button + - added: module info pulled from Preferences + - fixed several error notices and bugs ================================= 2012/09/24: Version 1.38.1 Beta 1 ================================= -- added: option to rename module and tables -- added: generated tables start with "mod_" -- added: logo image generator -- added: user info stored in Preferences -- added: module info pulled from Preferences -- added: plugins for Waiting module -- clean-up of English translations, and constants -- fixed several error notices and bugs + - added: option to rename module and tables + - added: generated tables start with "mod_" + - added: logo image generator + - added: user info stored in Preferences + - added: module info pulled from Preferences + - added: plugins for Waiting module + - clean-up of English translations, and constants + - fixed several error notices and bugs ================================= 2012/07/13: Version 1.38 Final ================================= -- Fixed bug (Timgno) -- Release only for xoops 2.5.5 (Timgno) + - Fixed bug (Timgno) + - Release only for xoops 2.5.5 (Timgno) ================================= 2012/01/29: Version 1.37 Final ================================= -- Fixed bug default string in sql file (Timgno) -- Added class for const_architecture.php (Timgno) -- Release only for xoops 2.5.x (Timgno) + - Fixed bug default string in sql file (Timgno) + - Added class for const_architecture.php (Timgno) + - Release only for xoops 2.5.x (Timgno) ================================= 2011/10/10: Version 1.37 RC 3 ================================= -- Fixed default and optional button paypal in admin/about.php (Timgno) -- Fixed default image module string in $module_name_slogo (Timgno) -- Deleted code creations folders deco & admin in file const_architecture.php (Timgno) -- Release only for xoops 2.5.x (Timgno) + - Fixed default and optional button paypal in admin/about.php (Timgno) + - Fixed default image module string in $module_name_slogo (Timgno) + - Deleted code creations folders deco & admin in file const_architecture.php (Timgno) + - Release only for xoops 2.5.x (Timgno) ================================= 2011/10/03: Version 1.37 RC 2 ================================= -- Bugfixed directory select images tables from & upload to Frameworks (Timgno) -- Added in mysql options fields, decimal/float/enum (Timgno) + - Bugfixed directory select images tables from & upload to Frameworks (Timgno) + - Added in mysql options fields, decimal/float/enum (Timgno) ================================= 2011/09/15: Version 1.37 RC 1 ================================= -- Added code directory select images tables from & upload to Frameworks (Timgno) + - Added code directory select images tables from & upload to Frameworks (Timgno) ================================= 2011/09/07: Version 1.37 beta 4 ================================= -- Added buttons New Table, New Categories & List Table (Timgno) + - Added buttons New Table, New Categories & List Table (Timgno) ================================= 2011/08/24: Version 1.37 beta 3 ================================= -- Added buttons New Table, New Categories & List Table (Timgno) + - Added buttons New Table, New Categories & List Table (Timgno) ================================= 2011/08/08: Version 1.37 beta 2 ================================= -- Added buttons New Module & List Module (Timgno) + - Added buttons New Module & List Module (Timgno) ================================= 2011/08/07: Version 1.37 beta 1 ================================= -- Added class constArch (Timgno) + - Added class constArch (Timgno) ================================= 2011/06/27: Version 1.36 beta ================================= -- fixed (Mamba) + - fixed (Mamba) ================================= 2011/04/22: Version 1.18 ================================= -- Added field forum url (Timgno) -- Added field forum title (Timgno) -- Added function createFile (Timgno) -- Changes code lines all files in cost folder for create file with function createFile (Timgno) + - Added field forum url (Timgno) + - Added field forum title (Timgno) + - Added function createFile (Timgno) + - Changes code lines all files in cost folder for create file with function createFile (Timgno) ================================= 2011/03/07: Version 1.15 ================================= -- Email Author (timgno) -- Advertise in const_xoops_version.php (timgno) -- Keywords for SEO in const_xoops_version.php (timgno) -- Datetime php function, copyright autoincrement years in const_entete.php (timgno) -- Defines in language pack (timgno) -- Added const_changelog.php (timgno) -- Added const_templates.php (timgno) -- Added const_main_language.php (timgno) + - Email Author (timgno) + - Advertise in const_xoops_version.php (timgno) + - Keywords for SEO in const_xoops_version.php (timgno) + - Datetime php function, copyright autoincrement years in const_entete.php (timgno) + - Defines in language pack (timgno) + - Added const_changelog.php (timgno) + - Added const_templates.php (timgno) + - Added const_main_language.php (timgno) ================================= 2010/12/25: Version 1.11 ================================= -- changes admin gui for xoops 2.5.x (Mamba) -- internationalization - the created module will local language based (mamba) -- added changelog (mamba) -- updated English translations (Mamba) -- replaced GIF images to PNG (Mamba) + - changes admin gui for xoops 2.5.x (Mamba) + - internationalization - the created module will local language based (mamba) + - added changelog (mamba) + - updated English translations (Mamba) + - replaced GIF images to PNG (Mamba) ================================= 2009/07/23: Version 1.1 ================================= -- Base changes (TDM) + - Base changes (TDM) ================================= 2009/07/17: Version 1.0 ================================= -- Original release (TDM) + - Original release (TDM) From c21229ef30379605563969c502e6207539505e3d Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 6 May 2020 10:01:04 +0200 Subject: [PATCH 009/266] removed unused files --- .../class/Files/Templates/User}/Broken.php | 0 .../class/Files/Templates/User}/Single.php | 0 .../class/Files/Templates/User}/Submit.php | 0 admin/PUBLISHER_ROOT_PATH | 0 admin/addmymodule.php | 144 -- admin/moremymodule.php | 142 -- class/Files/CreateArchitecture.php | 20 - .../Templates/Admin/TemplatesAdminBroken.php | 2 +- .../Templates/Blocks/TemplatesBlocks.php | 241 --- .../Exports-2020-04-15-08-25-04/index.html | 1 - .../tdmcreate_fieldattributes.yml | 20 - .../tdmcreate_fieldelements.yml | 108 -- .../tdmcreate_fieldkey.yml | 24 - .../tdmcreate_fieldnull.yml | 12 - .../tdmcreate_fields.yml | 1426 ----------------- .../tdmcreate_fieldtype.yml | 92 -- .../tdmcreate_languages.yml | 1 - .../tdmcreate_modules.yml | 80 - .../tdmcreate_morefiles.yml | 1 - .../tdmcreate_settings.yml | 41 - .../tdmcreate_tables.yml | 180 --- 21 files changed, 1 insertion(+), 2534 deletions(-) rename {class/Files/Templates/User/Defstyle => _archive/class/Files/Templates/User}/Broken.php (100%) rename {class/Files/Templates/User/Defstyle => _archive/class/Files/Templates/User}/Single.php (100%) rename {class/Files/Templates/User/Defstyle => _archive/class/Files/Templates/User}/Submit.php (100%) delete mode 100644 admin/PUBLISHER_ROOT_PATH delete mode 100644 admin/addmymodule.php delete mode 100644 admin/moremymodule.php delete mode 100644 class/Files/Templates/Blocks/TemplatesBlocks.php delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/index.html delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldattributes.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldelements.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldkey.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldnull.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fields.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldtype.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_languages.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_modules.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_morefiles.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_settings.yml delete mode 100644 testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_tables.yml diff --git a/class/Files/Templates/User/Defstyle/Broken.php b/_archive/class/Files/Templates/User/Broken.php similarity index 100% rename from class/Files/Templates/User/Defstyle/Broken.php rename to _archive/class/Files/Templates/User/Broken.php diff --git a/class/Files/Templates/User/Defstyle/Single.php b/_archive/class/Files/Templates/User/Single.php similarity index 100% rename from class/Files/Templates/User/Defstyle/Single.php rename to _archive/class/Files/Templates/User/Single.php diff --git a/class/Files/Templates/User/Defstyle/Submit.php b/_archive/class/Files/Templates/User/Submit.php similarity index 100% rename from class/Files/Templates/User/Defstyle/Submit.php rename to _archive/class/Files/Templates/User/Submit.php diff --git a/admin/PUBLISHER_ROOT_PATH b/admin/PUBLISHER_ROOT_PATH deleted file mode 100644 index e69de29b..00000000 diff --git a/admin/addmymodule.php b/admin/addmymodule.php deleted file mode 100644 index 8c582983..00000000 --- a/admin/addmymodule.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - */ -$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_addmymodule.tpl'; - -include __DIR__ . '/header.php'; -// Recovered value of argument op in the URL $ -$op = \Xmf\Request::getString('op', 'list'); - -$fileId = \Xmf\Request::getInt('file_id'); - -switch ($op) { - case 'list': - default: - $start = \Xmf\Request::getInt('start', 0); - $limit = \Xmf\Request::getInt('limit', $helper->getConfig('addmymodule_adminpager')); - // Define main template - // $templateMain = 'tdmcreate_addmymodule.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addmymodule.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_FILE, 'addmymodule.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); - $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL); - $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); - $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); - $modulesCount = $helper->getHandler('Modules')->getCountModules(); - // Redirect if there aren't modules - if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOT_MODULES); - } - $addmymoduleCount = $helper->getHandler('Addmymodule')->getCountAddMymodule(); - $addmymoduleAll = $helper->getHandler('Addmymodule')->getAllAddMymodule($start, $limit); - // Display addmymodule list - if ($addmymoduleCount > 0) { - foreach (array_keys($addmymoduleAll) as $i) { - $mymodule = $addmymoduleAll[$i]->getAddMymoduleValues(); - $GLOBALS['xoopsTpl']->append('mymodule_list', $mymodule); - unset($mymodule); - } - if ($addmymoduleCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($addmymoduleCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MODULES); - } - break; - case 'new': - // Define main template - // $templateMain = 'tdmcreate_addmymodule.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addmymodule.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADDMYMODULE_LIST, 'addmymodule.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - - $addmymoduleObj = $helper->getHandler('Addmymodule')->create(); - $form = $addmymoduleObj->getFormAddMymodule(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('addmymodule.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($fileId)) { - $addmymoduleObj = $helper->getHandler('Addmymodule')->get($fileId); - } else { - $addmymoduleObj = $helper->getHandler('Addmymodule')->create(); - } - // Form file save - $addmymoduleObj->setVars( - [ - 'file_mid' => \Xmf\Request::getString('file_mid', '', 'POST'), - 'file_name' => \Xmf\Request::getString('file_name', '', 'POST'), - 'file_extension' => \Xmf\Request::getString('file_extension', '', 'POST'), - 'file_infolder' => \Xmf\Request::getString('file_infolder', '', 'POST'), - ] - ); - - if ($helper->getHandler('Addmymodule')->insert($addmymoduleObj)) { - if ($addmymoduleObj->isNew()) { - redirect_header('addmymodule.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_CREATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); - } else { - redirect_header('addmymodule.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_UPDATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); - } - } - - $GLOBALS['xoopsTpl']->assign('error', $addmymoduleObj->getHtmlErrors()); - $form = $addmymoduleObj->getFormAddMymodule(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'edit': - // Define main template - // $templateMain = 'tdmcreate_addmymodule.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addmymodule.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'addmymodule.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_ADDMYMODULE_LIST, 'addmymodule.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - - $addmymoduleObj = $helper->getHandler('Addmymodule')->get($fileId); - $form = $addmymoduleObj->getFormAddMymodule(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'delete': - $addmymoduleObj = $helper->getHandler('Addmymodule')->get($fileId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('addmymodule.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($helper->getHandler('Addmymodule')->delete($addmymoduleObj)) { - redirect_header('addmymodule.php', 3, _AM_TDMCREATE_FORM_DELETED_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $addmymoduleObj->getHtmlErrors()); - } - } else { - xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORM_SURE_DELETE, $addmymoduleObj->getVar('file_name'))); - } - break; -} - -include __DIR__ . '/footer.php'; diff --git a/admin/moremymodule.php b/admin/moremymodule.php deleted file mode 100644 index d8b7571c..00000000 --- a/admin/moremymodule.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - */ - -// Define main template -$templateMain = 'tdmcreate_moremymodule.tpl'; - -include __DIR__ . '/header.php'; -// Recovered value of argument op in the URL $ -$op = \Xmf\Request::getString('op', 'list'); - -$fileId = \Xmf\Request::getInt('file_id'); - -switch ($op) { - case 'list': - default: - $start = \Xmf\Request::getInt('start', 0); - $limit = \Xmf\Request::getInt('limit', $helper->getConfig('moremymodule_adminpager')); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('moremymodule.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MORE_FILE, 'moremymodule.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); - $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL); - $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); - $GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); - $modulesCount = $helper->getHandler('Modules')->getCountModules(); - // Redirect if there aren't modules - if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); - } - $moremymoduleCount = $helper->getHandler('Moremymodule')->getCountMoreMymodule(); - $moremymoduleAll = $helper->getHandler('Moremymodule')->getAllMoreMymodule($start, $limit); - // Display moremymodule list - if ($moremymoduleCount > 0) { - foreach (array_keys($moremymoduleAll) as $i) { - $mymodule = $moremymoduleAll[$i]->getValuesMoreMymodule(); - $GLOBALS['xoopsTpl']->append('mymodule_list', $mymodule); - unset($mymodule); - } - if ($moremymoduleCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($moremymoduleCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MORE_MYMODULE); - } - break; - case 'new': - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('moremymodule.php')); - $adminObject->addItemButton(_AM_TDMCREATE_MORE_MYMODULE_LIST, 'moremymodule.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - - $moremymoduleObj = $helper->getHandler('Moremymodule')->create(); - $form = $moremymoduleObj->getFormMoreMymodule(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('moremymodule.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($fileId)) { - $moremymoduleObj = $helper->getHandler('Moremymodule')->get($fileId); - } else { - $moremymoduleObj = $helper->getHandler('Moremymodule')->create(); - } - // Form file save - $moremymoduleObj->setVars( - [ - 'file_mid' => \Xmf\Request::getInt('file_mid', 0, 'POST'), - 'file_name' => \Xmf\Request::getString('file_name', '', 'POST'), - 'file_extension' => \Xmf\Request::getString('file_extension', '', 'POST'), - 'file_infolder' => \Xmf\Request::getString('file_infolder', '', 'POST'), - ] - ); - - if ($helper->getHandler('Moremymodule')->insert($moremymoduleObj)) { - if ($moremymoduleObj->isNew()) { - redirect_header('moremymodule.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_CREATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); - } else { - redirect_header('moremymodule.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_UPDATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); - } - } - - $GLOBALS['xoopsTpl']->assign('error', $moremymoduleObj->getHtmlErrors()); - $form = $moremymoduleObj->getFormMoreMymodule(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'edit': - // Define main template - // $templateMain = 'tdmcreate_moremymodule.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('moremymodule.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'moremymodule.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_MORE_MYMODULE_LIST, 'moremymodule.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - - $moremymoduleObj = $helper->getHandler('Moremymodule')->get($fileId); - $form = $moremymoduleObj->getFormMoreMymodule(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'delete': - $moremymoduleObj = $helper->getHandler('Moremymodule')->get($fileId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('moremymodule.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($helper->getHandler('Moremymodule')->delete($moremymoduleObj)) { - redirect_header('moremymodule.php', 3, _AM_TDMCREATE_FORM_DELETED_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $moremymoduleObj->getHtmlErrors()); - } - } else { - xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORM_SURE_DELETE, $moremymoduleObj->getVar('file_name'))); - } - break; -} - -include __DIR__ . '/footer.php'; diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 92de37a3..01fa980a 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -609,26 +609,6 @@ public function setFilesToBuilding($module) $userTemplatesRss->write($module, $moduleDirname . '_rss.tpl'); $ret[] = $userTemplatesRss->render(); } - // User Single File - if (in_array(1, $tableSingle)) { - $userSingle = Tdmcreate\Files\User\UserSingle::getInstance(); - $userSingle->write($module, $table, 'single.php'); - $ret[] = $userSingle->render(); - // User Templates Single File - if ($templateType == 'bootstrap') { - $userTemplatesSingle = Tdmcreate\Files\Templates\User\Bootstrap\Single::getInstance(); - } else { - $userTemplatesSingle = Tdmcreate\Files\Templates\User\Defstyle\Single::getInstance(); - } - $userTemplatesSingle->write($module, $table, $moduleDirname . '_single.tpl'); - $ret[] = $userTemplatesSingle->render(); - } - // User Visit File - if (in_array(1, $tableVisit)) { - $userVisit = Tdmcreate\Files\User\UserVisit::getInstance(); - $userVisit->write($module, $table, 'visit.php'); - $ret[] = $userVisit->render(); - } // User Tag Files if (in_array(1, $tableTag)) { diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index 57b9fa76..8dec2190 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -164,7 +164,7 @@ private function getTemplatesAdminBrokenTable($moduleDirname, $tableName, $table $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); $tbody = $this->getTemplatesAdminBrokenTableThead($language, "\t\t"); $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $language, "\t\t"); - $ret .= $hc->getHtmlTable($tbody, 'table table-bordered', "\t"); + $ret = $hc->getHtmlTable($tbody, 'table table-bordered', "\t"); return $ret; } diff --git a/class/Files/Templates/Blocks/TemplatesBlocks.php b/class/Files/Templates/Blocks/TemplatesBlocks.php deleted file mode 100644 index 0fe0b086..00000000 --- a/class/Files/Templates/Blocks/TemplatesBlocks.php +++ /dev/null @@ -1,241 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getTemplatesBlocksTableThead - * @param $tableId - * @param $tableMid - * @param string $language - * @param $tableAutoincrement - * @return string - */ - private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $th = ''; - if (1 == $tableAutoincrement) { - $th .= $hc->getHtmlTableHead(' ', '', '', "\t\t\t"); - } - $fields = $this->getTableFields($tableMid, $tableId); - foreach (array_keys($fields) as $f) { - if (1 === (int)$fields[$f]->getVar('field_block')) { - $fieldName = $fields[$f]->getVar('field_name'); - $stuFieldName = mb_strtoupper($fieldName); - $lang = $sc->getSmartyConst($language, $stuFieldName); - $th .= $hc->getHtmlTableHead($lang, 'center', '', "\t\t\t"); - } - } - $tr = $hc->getHtmlTableRow($th, 'head', "\t\t"); - - return $hc->getHtmlTableThead($tr, '', "\t"); - } - - /** - * @private function getTemplatesBlocksTableTbody - * @param string $moduleDirname - * @param $tableId - * @param $tableMid - * @param $tableName - * @param $tableSoleName - * @param $tableAutoincrement - * @return string - */ - private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $td = ''; - if (1 == $tableAutoincrement) { - $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); - $td .= $hc->getHtmlTableData($double, 'center', '', "\t\t\t"); - } - $fields = $this->getTableFields($tableMid, $tableId); - foreach (array_keys($fields) as $f) { - if (1 === (int)$fields[$f]->getVar('field_block')) { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldElement = $fields[$f]->getVar('field_element'); - $rpFieldName = $this->getRightString($fieldName); - if (1 == $fields[$f]->getVar('field_inlist')) { - switch ($fieldElement) { - case 9: - // This is to be reviewed, as it was initially to style = "backgroung-color: #" - // Now with HTML5 is not supported inline style in the parameters of the HTML tag - // Old code was ... - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $span = $hc->getHtmlTag('span', [], $double); - $td .= $hc->getHtmlTableData($span, 'center', '', "\t\t\t"); - /*$ret .= <<    \n - EOT;*/ - break; - case 10: - $src = $sc->getSmartyNoSimbol('xoModuleIcons32'); - $src .= $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); - $td .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t"); - break; - case 13: - $single = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName], '', true, '', ''); - $td .= $hc->getHtmlTableData($img, 'center', '', "\t\t\t"); - break; - default: - if (0 != $f) { - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $td .= $hc->getHtmlTableData($double, 'center', '', "\t\t\t"); - } - break; - } - } - } - } - // TODO: allow edit only for admins - // $lang = $sc->getSmartyConst('', '_EDIT'); - // $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); - // $src = $sc->getSmartyNoSimbol('xoModuleIcons32 edit.png'); - // $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); - // $anchor = $hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); - // $lang = $sc->getSmartyConst('', '_DELETE'); - // $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); - // $src = $sc->getSmartyNoSimbol('xoModuleIcons32 delete.png'); - // $img = $hc->getHtmlTag('img', ['src' => $src . $double, 'alt' => $tableName], '', true, '', ''); - // $anchor .= $hc->getHtmlTag('a', ['href' => $tableName . ".php?op=delete&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t"); - // $td .= $hc->getHtmlTag('td', ['class' => 'center'], "\n" . $anchor . "\t\t\t", false, "\t\t\t"); - $cycle = $sc->getSmartyNoSimbol('cycle values="odd, even"'); - $tr = $hc->getHtmlTableRow($td, $cycle, "\t\t"); - $foreach = $sc->getSmartyForeach($tableSoleName, 'block', $tr, '','', "\t\t"); - $tbody = $hc->getHtmlTableTbody($foreach,'' , "\t"); - - return $sc->getSmartyConditions("block", '', '', $tbody, false, true, true, "\t"); - } - - /** - * @private function getTemplatesBlocksTfoot - * @return string - */ - private function getTemplatesBlocksTableTfoot() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTag('td', [], " ", false, '', ''); - $tr = $hc->getHtmlTag('tr', [], $td, false, '', ''); - - return $hc->getHtmlTag('tfoot', [], $tr, false, "\t"); - } - - /** - * @private function getTemplatesBlocksTable - * @param string $moduleDirname - * @param $tableId - * @param $tableMid - * @param string $tableName - * @param $tableSoleName - * @param $tableAutoincrement - * @param string $language - * @return string - */ - private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $tbody = $this->getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement); - $tbody .= $this->getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement); - $tbody .= $this->getTemplatesBlocksTableTfoot(); - $single = $sc->getSmartySingleVar('table_type'); - - return $hc->getHtmlTable($tbody, 'table table-' . $single); - } - - /** - * @public function render - * @param null - * - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $tableAutoincrement = $table->getVar('table_autoincrement'); - $language = $this->getLanguage($moduleDirname, 'MB'); - $content = $this->getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); - - $this->create($moduleDirname, 'templates/blocks', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/testdata/german/Exports-2020-04-15-08-25-04/index.html b/testdata/german/Exports-2020-04-15-08-25-04/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldattributes.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldattributes.yml deleted file mode 100644 index aba8a4b2..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldattributes.yml +++ /dev/null @@ -1,20 +0,0 @@ -- - fieldattribute_id: '1' - fieldattribute_name: ... - fieldattribute_value: '' -- - fieldattribute_id: '2' - fieldattribute_name: BINARY - fieldattribute_value: BINARY -- - fieldattribute_id: '3' - fieldattribute_name: UNSIGNED - fieldattribute_value: UNSIGNED -- - fieldattribute_id: '4' - fieldattribute_name: UNSIGNED_ZEROFILL - fieldattribute_value: UNSIGNED_ZEROFILL -- - fieldattribute_id: '5' - fieldattribute_name: CURRENT_TIMESTAMP - fieldattribute_value: CURRENT_TIMESTAMP diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldelements.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldelements.yml deleted file mode 100644 index e2c0b7dd..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldelements.yml +++ /dev/null @@ -1,108 +0,0 @@ -- - fieldelement_id: '1' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: ... - fieldelement_value: '' -- - fieldelement_id: '2' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: Text - fieldelement_value: XoopsFormText -- - fieldelement_id: '3' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: TextArea - fieldelement_value: XoopsFormTextArea -- - fieldelement_id: '4' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: DhtmlTextArea - fieldelement_value: XoopsFormDhtmlTextArea -- - fieldelement_id: '5' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: CheckBox - fieldelement_value: XoopsFormCheckBox -- - fieldelement_id: '6' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: RadioYN - fieldelement_value: XoopsFormRadioYN -- - fieldelement_id: '7' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectBox - fieldelement_value: XoopsFormSelect -- - fieldelement_id: '8' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectUser - fieldelement_value: XoopsFormSelectUser -- - fieldelement_id: '9' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: ColorPicker - fieldelement_value: XoopsFormColorPicker -- - fieldelement_id: '10' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: ImageList - fieldelement_value: XoopsFormImageList -- - fieldelement_id: '11' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectFile - fieldelement_value: XoopsFormSelectFile -- - fieldelement_id: '12' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: UrlFile - fieldelement_value: XoopsFormUrlFile -- - fieldelement_id: '13' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: UploadImage - fieldelement_value: XoopsFormUploadImage -- - fieldelement_id: '14' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: UploadFile - fieldelement_value: XoopsFormUploadFile -- - fieldelement_id: '15' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: TextDateSelect - fieldelement_value: XoopsFormTextDateSelect -- - fieldelement_id: '16' - fieldelement_mid: '1' - fieldelement_tid: '1' - fieldelement_name: 'Table : Categories' - fieldelement_value: XoopsFormTables-Categories -- - fieldelement_id: '17' - fieldelement_mid: '1' - fieldelement_tid: '2' - fieldelement_name: 'Table : Articles' - fieldelement_value: XoopsFormTables-Articles -- - fieldelement_id: '18' - fieldelement_mid: '1' - fieldelement_tid: '3' - fieldelement_name: 'Table : Miscfields' - fieldelement_value: XoopsFormTables-Miscfields diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldkey.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldkey.yml deleted file mode 100644 index 1f967fae..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldkey.yml +++ /dev/null @@ -1,24 +0,0 @@ -- - fieldkey_id: '1' - fieldkey_name: ... - fieldkey_value: '' -- - fieldkey_id: '2' - fieldkey_name: PRIMARY - fieldkey_value: PRIMARY -- - fieldkey_id: '3' - fieldkey_name: UNIQUE - fieldkey_value: UNIQUE -- - fieldkey_id: '4' - fieldkey_name: KEY - fieldkey_value: KEY -- - fieldkey_id: '5' - fieldkey_name: INDEX - fieldkey_value: INDEX -- - fieldkey_id: '6' - fieldkey_name: FULLTEXT - fieldkey_value: FULLTEXT diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldnull.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldnull.yml deleted file mode 100644 index 2ca74967..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldnull.yml +++ /dev/null @@ -1,12 +0,0 @@ -- - fieldnull_id: '1' - fieldnull_name: ... - fieldnull_value: '' -- - fieldnull_id: '2' - fieldnull_name: 'NOT NULL' - fieldnull_value: 'NOT NULL' -- - fieldnull_id: '3' - fieldnull_name: 'NULL' - fieldnull_value: 'NULL' diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fields.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fields.yml deleted file mode 100644 index 849f33c7..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fields.yml +++ /dev/null @@ -1,1426 +0,0 @@ -- - field_id: '1' - field_mid: '1' - field_tid: '1' - field_order: '1' - field_name: cat_id - field_type: '2' - field_value: '8' - field_attribute: '3' - field_null: '2' - field_default: '' - field_key: '2' - field_element: '' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '2' - field_mid: '1' - field_tid: '1' - field_order: '2' - field_name: cat_name - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '2' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '1' - field_search: '0' - field_required: '1' -- - field_id: '3' - field_mid: '1' - field_tid: '1' - field_order: '3' - field_name: cat_logo - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '13' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '4' - field_mid: '1' - field_tid: '1' - field_order: '4' - field_name: cat_created - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '15' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '1' -- - field_id: '5' - field_mid: '1' - field_tid: '1' - field_order: '5' - field_name: cat_submitter - field_type: '2' - field_value: '8' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '8' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '6' - field_mid: '1' - field_tid: '2' - field_order: '1' - field_name: art_id - field_type: '2' - field_value: '8' - field_attribute: '3' - field_null: '2' - field_default: '' - field_key: '2' - field_element: '' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '7' - field_mid: '1' - field_tid: '2' - field_order: '2' - field_name: art_cat - field_type: '2' - field_value: '8' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '16' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '1' - field_required: '1' -- - field_id: '8' - field_mid: '1' - field_tid: '2' - field_order: '3' - field_name: art_title - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '2' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '1' - field_search: '1' - field_required: '1' -- - field_id: '9' - field_mid: '1' - field_tid: '2' - field_order: '4' - field_name: art_descr - field_type: '17' - field_value: '' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '4' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '1' - field_required: '1' -- - field_id: '10' - field_mid: '1' - field_tid: '2' - field_order: '5' - field_name: art_img - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '3' - field_default: '''''' - field_key: '1' - field_element: '13' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '11' - field_mid: '1' - field_tid: '2' - field_order: '6' - field_name: art_online - field_type: '3' - field_value: '1' - field_attribute: '1' - field_null: '2' - field_default: '0' - field_key: '1' - field_element: '6' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '1' -- - field_id: '12' - field_mid: '1' - field_tid: '2' - field_order: '7' - field_name: art_file - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '14' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '13' - field_mid: '1' - field_tid: '2' - field_order: '8' - field_name: art_created - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '15' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '14' - field_mid: '1' - field_tid: '2' - field_order: '9' - field_name: art_submitter - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '8' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '15' - field_mid: '1' - field_tid: '3' - field_order: '1' - field_name: tf_id - field_type: '2' - field_value: '8' - field_attribute: '3' - field_null: '2' - field_default: '' - field_key: '2' - field_element: '' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '16' - field_mid: '1' - field_tid: '3' - field_order: '2' - field_name: tf_text - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '2' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '1' - field_search: '0' - field_required: '0' -- - field_id: '17' - field_mid: '1' - field_tid: '3' - field_order: '3' - field_name: tf_textarea - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '3' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '18' - field_mid: '1' - field_tid: '3' - field_order: '4' - field_name: tf_dhtml - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '4' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '19' - field_mid: '1' - field_tid: '3' - field_order: '5' - field_name: tf_checkbox - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '5' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '20' - field_mid: '1' - field_tid: '3' - field_order: '6' - field_name: tf_yesno - field_type: '2' - field_value: '1' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '6' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '21' - field_mid: '1' - field_tid: '3' - field_order: '7' - field_name: tf_selectbox - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '7' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '22' - field_mid: '1' - field_tid: '3' - field_order: '8' - field_name: tf_user - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '8' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '23' - field_mid: '1' - field_tid: '3' - field_order: '9' - field_name: tf_color - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '9' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '24' - field_mid: '1' - field_tid: '3' - field_order: '10' - field_name: tf_imagelist - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '10' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '25' - field_mid: '1' - field_tid: '3' - field_order: '11' - field_name: tf_urlfile - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '12' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '26' - field_mid: '1' - field_tid: '3' - field_order: '12' - field_name: tf_uplimage - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '13' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '27' - field_mid: '1' - field_tid: '3' - field_order: '13' - field_name: tf_uplfile - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '14' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '28' - field_mid: '1' - field_tid: '3' - field_order: '14' - field_name: tf_textdateselect - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '15' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '29' - field_mid: '2' - field_tid: '4' - field_order: '1' - field_name: cat_id - field_type: '2' - field_value: '8' - field_attribute: '3' - field_null: '2' - field_default: '' - field_key: '2' - field_element: '' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '30' - field_mid: '2' - field_tid: '4' - field_order: '2' - field_name: cat_name - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '2' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '1' - field_search: '0' - field_required: '1' -- - field_id: '31' - field_mid: '2' - field_tid: '4' - field_order: '3' - field_name: cat_logo - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '13' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '32' - field_mid: '2' - field_tid: '4' - field_order: '4' - field_name: cat_created - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '15' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '1' -- - field_id: '33' - field_mid: '2' - field_tid: '4' - field_order: '5' - field_name: cat_submitter - field_type: '2' - field_value: '8' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '8' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '34' - field_mid: '2' - field_tid: '5' - field_order: '1' - field_name: art_id - field_type: '2' - field_value: '8' - field_attribute: '3' - field_null: '2' - field_default: '' - field_key: '2' - field_element: '' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '35' - field_mid: '2' - field_tid: '5' - field_order: '2' - field_name: art_cat - field_type: '2' - field_value: '8' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '16' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '1' - field_required: '1' -- - field_id: '36' - field_mid: '2' - field_tid: '5' - field_order: '3' - field_name: art_title - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '2' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '1' - field_search: '1' - field_required: '1' -- - field_id: '37' - field_mid: '2' - field_tid: '5' - field_order: '4' - field_name: art_descr - field_type: '17' - field_value: '' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '4' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '1' - field_required: '1' -- - field_id: '38' - field_mid: '2' - field_tid: '5' - field_order: '5' - field_name: art_img - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '3' - field_default: '''''' - field_key: '1' - field_element: '13' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '39' - field_mid: '2' - field_tid: '5' - field_order: '6' - field_name: art_online - field_type: '3' - field_value: '1' - field_attribute: '1' - field_null: '2' - field_default: '0' - field_key: '1' - field_element: '6' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '1' -- - field_id: '40' - field_mid: '2' - field_tid: '5' - field_order: '7' - field_name: art_file - field_type: '14' - field_value: '200' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '14' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '41' - field_mid: '2' - field_tid: '5' - field_order: '8' - field_name: art_created - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '15' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '42' - field_mid: '2' - field_tid: '5' - field_order: '9' - field_name: art_submitter - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '8' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '1' - field_tbody: '1' - field_tfoot: '1' - field_block: '1' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '43' - field_mid: '2' - field_tid: '6' - field_order: '1' - field_name: tf_id - field_type: '2' - field_value: '8' - field_attribute: '3' - field_null: '2' - field_default: '' - field_key: '2' - field_element: '' - field_parent: '0' - field_admin: '0' - field_inlist: '0' - field_inform: '0' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '44' - field_mid: '2' - field_tid: '6' - field_order: '2' - field_name: tf_text - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '2' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '1' - field_search: '0' - field_required: '0' -- - field_id: '45' - field_mid: '2' - field_tid: '6' - field_order: '3' - field_name: tf_textarea - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '3' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '46' - field_mid: '2' - field_tid: '6' - field_order: '4' - field_name: tf_dhtml - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '4' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '47' - field_mid: '2' - field_tid: '6' - field_order: '5' - field_name: tf_checkbox - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '5' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '48' - field_mid: '2' - field_tid: '6' - field_order: '6' - field_name: tf_yesno - field_type: '2' - field_value: '1' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '6' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '49' - field_mid: '2' - field_tid: '6' - field_order: '7' - field_name: tf_selectbox - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '7' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '50' - field_mid: '2' - field_tid: '6' - field_order: '8' - field_name: tf_user - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '8' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '51' - field_mid: '2' - field_tid: '6' - field_order: '9' - field_name: tf_color - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '9' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '52' - field_mid: '2' - field_tid: '6' - field_order: '10' - field_name: tf_imagelist - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '10' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '53' - field_mid: '2' - field_tid: '6' - field_order: '11' - field_name: tf_urlfile - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '12' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '54' - field_mid: '2' - field_tid: '6' - field_order: '12' - field_name: tf_uplimage - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '13' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '55' - field_mid: '2' - field_tid: '6' - field_order: '13' - field_name: tf_uplfile - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '14' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '56' - field_mid: '2' - field_tid: '6' - field_order: '14' - field_name: tf_textdateselect - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '15' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '57' - field_mid: '2' - field_tid: '6' - field_order: '15' - field_name: tf_selectfile - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '11' - field_parent: '0' - field_admin: '1' - field_inlist: '1' - field_inform: '1' - field_user: '0' - field_thead: '0' - field_tbody: '0' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' - \ No newline at end of file diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldtype.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldtype.yml deleted file mode 100644 index d08e73c6..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_fieldtype.yml +++ /dev/null @@ -1,92 +0,0 @@ -- - fieldtype_id: '1' - fieldtype_name: ... - fieldtype_value: '' -- - fieldtype_id: '2' - fieldtype_name: INT - fieldtype_value: INT -- - fieldtype_id: '3' - fieldtype_name: TINYINT - fieldtype_value: TINYINT -- - fieldtype_id: '4' - fieldtype_name: MEDIUMINT - fieldtype_value: MEDIUMINT -- - fieldtype_id: '5' - fieldtype_name: SMALLINT - fieldtype_value: SMALLINT -- - fieldtype_id: '6' - fieldtype_name: FLOAT - fieldtype_value: FLOAT -- - fieldtype_id: '7' - fieldtype_name: DOUBLE - fieldtype_value: DOUBLE -- - fieldtype_id: '8' - fieldtype_name: DECIMAL - fieldtype_value: DECIMAL -- - fieldtype_id: '9' - fieldtype_name: SET - fieldtype_value: SET -- - fieldtype_id: '10' - fieldtype_name: ENUM - fieldtype_value: ENUM -- - fieldtype_id: '11' - fieldtype_name: EMAIL - fieldtype_value: EMAIL -- - fieldtype_id: '12' - fieldtype_name: URL - fieldtype_value: URL -- - fieldtype_id: '13' - fieldtype_name: CHAR - fieldtype_value: CHAR -- - fieldtype_id: '14' - fieldtype_name: VARCHAR - fieldtype_value: VARCHAR -- - fieldtype_id: '15' - fieldtype_name: TEXT - fieldtype_value: TEXT -- - fieldtype_id: '16' - fieldtype_name: TINYTEXT - fieldtype_value: TINYTEXT -- - fieldtype_id: '17' - fieldtype_name: MEDIUMTEXT - fieldtype_value: MEDIUMTEXT -- - fieldtype_id: '18' - fieldtype_name: LONGTEXT - fieldtype_value: LONGTEXT -- - fieldtype_id: '19' - fieldtype_name: DATE - fieldtype_value: DATE -- - fieldtype_id: '20' - fieldtype_name: DATETIME - fieldtype_value: DATETIME -- - fieldtype_id: '21' - fieldtype_name: TIMESTAMP - fieldtype_value: TIMESTAMP -- - fieldtype_id: '22' - fieldtype_name: TIME - fieldtype_value: TIME -- - fieldtype_id: '23' - fieldtype_name: YEAR - fieldtype_value: YEAR diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_languages.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_languages.yml deleted file mode 100644 index f7bcb871..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_languages.yml +++ /dev/null @@ -1 +0,0 @@ -{ } \ No newline at end of file diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_modules.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_modules.yml deleted file mode 100644 index 9ffa1368..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_modules.yml +++ /dev/null @@ -1,80 +0,0 @@ -- - mod_id: '1' - mod_name: 'My Module' - mod_dirname: mymodule - mod_version: '1.0' - mod_since: '1.0' - mod_min_php: '7.0' - mod_min_xoops: 2.5.9 - mod_min_admin: '1.2' - mod_min_mysql: '5.6' - mod_description: 'This module is for doing following...' - mod_author: 'TDM XOOPS' - mod_author_mail: info@email.com - mod_author_website_url: 'http://xoops.org' - mod_author_website_name: 'XOOPS Project' - mod_credits: 'XOOPS Development Team' - mod_license: 'GPL 2.0 or later' - mod_release_info: release_info - mod_release_file: 'release_info file' - mod_manual: 'link to manual file' - mod_manual_file: install.txt - mod_image: MyModule_logo.png - mod_demo_site_url: 'https://xoops.org' - mod_demo_site_name: 'XOOPS Demo Site' - mod_support_url: 'https://xoops.org/modules/newbb' - mod_support_name: 'Support Forum' - mod_website_url: www.xoops.org - mod_website_name: 'XOOPS Project' - mod_release: '2017-12-02' - mod_status: 'Beta 1' - mod_admin: '1' - mod_user: '1' - mod_blocks: '1' - mod_search: '1' - mod_comments: '1' - mod_notifications: '1' - mod_permissions: '1' - mod_inroot_copy: '1' - mod_donations: 6KJ7RW5DR3VTJ - mod_subversion: '13070' -- - mod_id: '2' - mod_name: 'My Module 2' - mod_dirname: mymodule2 - mod_version: '1.0' - mod_since: '1.0' - mod_min_php: '7.0' - mod_min_xoops: 2.5.9 - mod_min_admin: '1.2' - mod_min_mysql: '5.6' - mod_description: 'This module is for doing following...' - mod_author: 'TDM XOOPS' - mod_author_mail: info@email.com - mod_author_website_url: 'http://xoops.org' - mod_author_website_name: 'XOOPS Project' - mod_credits: 'XOOPS Development Team' - mod_license: 'GPL 2.0 or later' - mod_release_info: release_info - mod_release_file: 'release_info file' - mod_manual: 'link to manual file' - mod_manual_file: install.txt - mod_image: MyModule_logo.png - mod_demo_site_url: 'https://xoops.org' - mod_demo_site_name: 'XOOPS Demo Site' - mod_support_url: 'https://xoops.org/modules/newbb' - mod_support_name: 'Support Forum' - mod_website_url: www.xoops.org - mod_website_name: 'XOOPS Project' - mod_release: '2017-12-02' - mod_status: 'Beta 1' - mod_admin: '1' - mod_user: '1' - mod_blocks: '1' - mod_search: '1' - mod_comments: '1' - mod_notifications: '1' - mod_permissions: '1' - mod_inroot_copy: '1' - mod_donations: 6KJ7RW5DR3VTJ - mod_subversion: '13070' diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_morefiles.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_morefiles.yml deleted file mode 100644 index f7bcb871..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_morefiles.yml +++ /dev/null @@ -1 +0,0 @@ -{ } \ No newline at end of file diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_settings.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_settings.yml deleted file mode 100644 index e188e0f1..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_settings.yml +++ /dev/null @@ -1,41 +0,0 @@ -- - set_id: '1' - set_name: 'My Module' - set_dirname: mymoduledirname - set_version: '1.0' - set_since: '1.0' - set_min_php: '7.0' - set_min_xoops: 2.5.9 - set_min_admin: '1.2' - set_min_mysql: '5.6' - set_description: 'This module is for doing following...' - set_author: 'TDM XOOPS' - set_author_mail: info@email.com - set_author_website_url: 'http://xoops.org' - set_author_website_name: 'XOOPS Project' - set_credits: 'XOOPS Development Team' - set_license: 'GPL 2.0 or later' - set_release_info: release_info - set_release_file: 'release_info file' - set_manual: 'link to manual file' - set_manual_file: install.txt - set_image: empty.png - set_demo_site_url: 'https://xoops.org' - set_demo_site_name: 'XOOPS Demo Site' - set_support_url: 'https://xoops.org/modules/newbb' - set_support_name: 'Support Forum' - set_website_url: www.xoops.org - set_website_name: 'XOOPS Project' - set_release: '2017-12-02' - set_status: 'Beta 1' - set_admin: '1' - set_user: '1' - set_blocks: '1' - set_search: '0' - set_comments: '0' - set_notifications: '0' - set_permissions: '0' - set_inroot_copy: '0' - set_donations: 6KJ7RW5DR3VTJ - set_subversion: '13070' - set_type: '1' diff --git a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_tables.yml b/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_tables.yml deleted file mode 100644 index c2263957..00000000 --- a/testdata/german/Exports-2020-04-15-08-25-04/tdmcreate_tables.yml +++ /dev/null @@ -1,180 +0,0 @@ -- - table_id: '1' - table_mid: '1' - table_category: '1' - table_name: categories - table_solename: category - table_fieldname: cat - table_nbfields: '5' - table_order: '1' - table_image: category.png - table_autoincrement: '1' - table_install: '1' - table_index: '0' - table_blocks: '0' - table_admin: '1' - table_user: '0' - table_submenu: '0' - table_submit: '0' - table_tag: '0' - table_broken: '0' - table_search: '0' - table_comments: '0' - table_notifications: '0' - table_permissions: '0' - table_rate: '0' - table_print: '0' - table_pdf: '0' - table_rss: '0' - table_single: '0' - table_visit: '0' -- - table_id: '2' - table_mid: '1' - table_category: '0' - table_name: articles - table_solename: article - table_fieldname: art - table_nbfields: '9' - table_order: '1' - table_image: penguin.png - table_autoincrement: '1' - table_install: '1' - table_index: '1' - table_blocks: '1' - table_admin: '1' - table_user: '1' - table_submenu: '1' - table_submit: '1' - table_tag: '1' - table_broken: '1' - table_search: '1' - table_comments: '1' - table_notifications: '1' - table_permissions: '1' - table_rate: '1' - table_print: '1' - table_pdf: '1' - table_rss: '1' - table_single: '1' - table_visit: '1' -- - table_id: '3' - table_mid: '1' - table_category: '0' - table_name: testfields - table_solename: testfield - table_fieldname: tf - table_nbfields: '14' - table_order: '1' - table_image: alert.png - table_autoincrement: '1' - table_install: '1' - table_index: '1' - table_blocks: '1' - table_admin: '1' - table_user: '1' - table_submenu: '1' - table_submit: '1' - table_tag: '1' - table_broken: '1' - table_search: '1' - table_comments: '1' - table_notifications: '1' - table_permissions: '1' - table_rate: '1' - table_print: '1' - table_pdf: '1' - table_rss: '1' - table_single: '1' - table_visit: '1' -- - table_id: '4' - table_mid: '2' - table_category: '1' - table_name: categories - table_solename: category - table_fieldname: cat - table_nbfields: '5' - table_order: '1' - table_image: category.png - table_autoincrement: '1' - table_install: '1' - table_index: '0' - table_blocks: '0' - table_admin: '1' - table_user: '0' - table_submenu: '0' - table_submit: '0' - table_tag: '0' - table_broken: '0' - table_search: '0' - table_comments: '0' - table_notifications: '0' - table_permissions: '0' - table_rate: '0' - table_print: '0' - table_pdf: '0' - table_rss: '0' - table_single: '0' - table_visit: '0' -- - table_id: '5' - table_mid: '2' - table_category: '0' - table_name: articles - table_solename: article - table_fieldname: art - table_nbfields: '9' - table_order: '1' - table_image: penguin.png - table_autoincrement: '1' - table_install: '1' - table_index: '1' - table_blocks: '1' - table_admin: '1' - table_user: '1' - table_submenu: '1' - table_submit: '1' - table_tag: '1' - table_broken: '1' - table_search: '1' - table_comments: '1' - table_notifications: '1' - table_permissions: '1' - table_rate: '1' - table_print: '1' - table_pdf: '1' - table_rss: '1' - table_single: '1' - table_visit: '1' -- - table_id: '6' - table_mid: '2' - table_category: '0' - table_name: testfields - table_solename: testfield - table_fieldname: tf - table_nbfields: '15' - table_order: '1' - table_image: alert.png - table_autoincrement: '1' - table_install: '1' - table_index: '1' - table_blocks: '1' - table_admin: '1' - table_user: '1' - table_submenu: '1' - table_submit: '1' - table_tag: '1' - table_broken: '1' - table_search: '1' - table_comments: '1' - table_notifications: '1' - table_permissions: '1' - table_rate: '1' - table_print: '1' - table_pdf: '1' - table_rss: '1' - table_single: '1' - table_visit: '1' From ca1fb00c57b47a0d0d52f0db03ba7a37421a6e81 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 9 May 2020 08:46:42 +0200 Subject: [PATCH 010/266] adapted hardcoded creation of templates into new way (next steps) --- _TODO.txt | 4 +- class/Files/CreateHtmlCode.php | 4 +- class/Files/CreateSmartyCode.php | 43 ++- .../Templates/Admin/TemplatesAdminAbout.php | 6 +- .../Templates/Admin/TemplatesAdminBroken.php | 4 +- .../Templates/Admin/TemplatesAdminIndex.php | 6 +- .../Templates/Admin/TemplatesAdminPages.php | 4 +- class/Files/Templates/User/Defstyle/Index.php | 297 ++++-------------- .../Templates/User/Defstyle/PagesList.php | 8 +- 9 files changed, 97 insertions(+), 279 deletions(-) diff --git a/_TODO.txt b/_TODO.txt index 63503501..87c476c0 100644 --- a/_TODO.txt +++ b/_TODO.txt @@ -12,7 +12,9 @@ TODOs: implement constants interface - +Broken files: +Notification for broken files in xoops_version adapt? +add initiate event when click on broken file Notifications: diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index babeaa67..45373a2f 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -114,9 +114,9 @@ public function getHtmlEmpty($empty = '', $t = '', $n = '') * @param string $n * @return string */ - public function getHtmlComment($htmlComment = '', $n = '') + public function getHtmlComment($htmlComment = '', $t = '', $n = '') { - return "{$n}"; + return "{$t}{$n}"; } /** diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index 8c072ed1..78508314 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -201,9 +201,9 @@ public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admi * @param string $n * @return string */ - public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $tableFieldName, $t = '', $n = '') + public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $itemName, $arrayName, $t = '', $n = '') { - return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}[i]}>{$n}"; + return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$itemName}=\${$arrayName}[i]}>{$n}"; } /** @@ -233,31 +233,28 @@ public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tabl * @param string $n * @return string */ - public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '', $n = "\n") + public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '', $n = "\n", $split = true) { - if (!$contentElse) { - if (!$count) { - $ret = "{$t}<{if \${$condition}{$operator}{$type}}>{$n}"; - } elseif (!$noSimbol) { - $ret = "{$t}<{if {$condition}{$operator}{$type}}>{$n}"; - } else { - $ret = "{$t}<{if count(\${$condition}){$operator}{$type}}>{$n}"; - } - $ret .= "{$contentIf}"; - $ret .= "{$t}<{/if}>{$n}"; + $ns = ''; + $ts = ''; + if ($split) { + $ns = $n; + $ts = $t; + } + if (!$count) { + $ret = "{$t}<{if \${$condition}{$operator}{$type}}>{$ns}"; + } elseif (!$noSimbol) { + $ret = "{$t}<{if {$condition}{$operator}{$type}}>{$ns}"; } else { - if (!$count) { - $ret = "{$t}<{if \${$condition}{$operator}{$type}}>{$n}"; - } elseif (!$noSimbol) { - $ret = "{$t}<{if {$condition}{$operator}{$type}}>{$n}"; - } else { - $ret = "{$t}<{if count(\${$condition}){$operator}{$type}}>{$n}"; - } - $ret .= "{$contentIf}"; - $ret .= "{$t}<{else}>{$n}"; + $ret = "{$t}<{if count(\${$condition}){$operator}{$type}}>{$ns}"; + } + $ret .= "{$contentIf}"; + if ($contentElse) { + $ret .= "{$ts}<{else}>{$ns}"; $ret .= "{$contentElse}"; - $ret .= "{$t}<{/if}>{$n}"; } + $ret .= "{$ts}<{/if}>{$n}"; + return $ret; } diff --git a/class/Files/Templates/Admin/TemplatesAdminAbout.php b/class/Files/Templates/Admin/TemplatesAdminAbout.php index 8e43daef..6ec51f14 100644 --- a/class/Files/Templates/Admin/TemplatesAdminAbout.php +++ b/class/Files/Templates/Admin/TemplatesAdminAbout.php @@ -77,12 +77,12 @@ public function render() $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $hc->getHtmlComment('Header') . PHP_EOL; + $content = $hc->getHtmlComment('Header', '', "\n"); $content .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, true) . PHP_EOL; - $content .= $hc->getHtmlComment('About Page') . PHP_EOL; + $content .= $hc->getHtmlComment('About Page', '', "\n"); $single = $sc->getSmartySingleVar('about'); $content .= $hc->getHtmlTag('div', ['class' => 'top'], $single) . PHP_EOL; - $content .= $hc->getHtmlComment('Footer') . PHP_EOL; + $content .= $hc->getHtmlComment('Footer', '', "\n"); $content .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index 8dec2190..14449626 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -77,7 +77,7 @@ private function getTemplatesAdminBrokenHeader($moduleDirname) { $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlComment('Header', "\n"); + $ret = $hc->getHtmlComment('Header', '',"\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); return $ret; @@ -221,7 +221,7 @@ private function getTemplatesAdminBrokenFooter($moduleDirname) $div = $hc->getHtmlDiv($strong, 'errorMsg', "\t", "\n"); $ret = $sc->getSmartyConditions('error', '', '', $div); $ret .= $hc->getHtmlEmpty('', '', "\n"); - $ret .= $hc->getHtmlComment('Footer', "\n"); + $ret .= $hc->getHtmlComment('Footer', '', "\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); return $ret; diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index ac557047..2c4fc60c 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -78,12 +78,12 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $hc->getHtmlComment('Header') . PHP_EOL; + $content = $hc->getHtmlComment('Header', '', "\n") ; $content .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, true) . PHP_EOL; - $content .= $hc->getHtmlComment('Index Page') . PHP_EOL; + $content .= $hc->getHtmlComment('Index Page', '', "\n") ; $single = $sc->getSmartySingleVar('index'); $content .= $hc->getHtmlTag('div', ['class' => 'top'], $single) . PHP_EOL; - $content .= $hc->getHtmlComment('Footer') . PHP_EOL; + $content .= $hc->getHtmlComment('Footer', '', "\n"); $content .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 274ee8af..d77136d3 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -77,7 +77,7 @@ private function getTemplatesAdminPagesHeader($moduleDirname) { $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlComment('Header', "\n"); + $ret = $hc->getHtmlComment('Header', '',"\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); return $ret; @@ -273,7 +273,7 @@ private function getTemplatesAdminPagesFooter($moduleDirname) { $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlComment('Footer', "\n"); + $ret = $hc->getHtmlComment('Footer', '', "\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); return $ret; diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 7f254704..26281eb2 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -82,257 +82,83 @@ public function getTemplateUserIndexHeader($moduleDirname) return $sc->getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); } - /** - * @private function getTemplatesUserIndexTable - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return string - */ - private function getTemplatesUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('table_type'); - $table = $this->getTemplatesUserIndexTableThead($tableName, $language); - $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); - - return $hc->getHtmlTable($table, 'table table-' . $single); - } - - /** - * @private function getTemplatesUserIndexThead - * @param string $language - * @param $tableName - * @return string - */ - private function getTemplatesUserIndexTableThead($tableName, $language) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $lang = $sc->getSmartyConst($language, $stuTableName); - $col = $sc->getSmartySingleVar('numb_col'); - $th = $hc->getHtmlTableHead($lang, '', $col); - $tr = $hc->getHtmlTableRow($th, 'head') ; - - return $hc->getHtmlTableThead($tr); - } - - /** - * @private function getTemplatesUserIndexTbody - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @return string - */ - private function getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName) - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $type = $sc->getSmartySingleVar('panel_type'); - $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); - $div = $hc->getHtmlDiv($include, 'panel panel-' . $type); - $cont = $hc->getHtmlTableData($div); - $html = $hc->getHtmlEmpty(''); - $cont .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html); - $foreach = $sc->getSmartyForeach($tableSoleName, $tableName, $cont); - $tr = $hc->getHtmlTableRow($foreach); - - return $hc->getHtmlTableTbody($tr); - } - - /** - * @private function getTemplatesUserIndexTfoot - * @return string - */ - private function getTemplatesUserIndexTableTfoot() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTableData(' '); - $tr = $hc->getHtmlTableRow($td); - - return $hc->getHtmlTableTfoot($tr); - } - /** * @public function getTemplatesUserIndexBodyDefault * @param $module - * @param $table * @param $language * @return bool|string */ - public function getTemplatesUserIndexBodyDefault($module, $table, $language) + public function getTemplatesUserIndexIntro($module, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $th = $hc->getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '',"\t\t\t"); - $tr = $hc->getHtmlTableRow($th,'center',"\t\t"); - $thead = $hc->getHtmlTableThead($tr,'', "\t"); + $ret = $hc->getHtmlEmpty('','',"\n"); + $ret .= $hc->getHtmlComment('Start index list','', "\n"); + //Table head + $th = $hc->getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '',"\t\t\t"); + $tr = $hc->getHtmlTableRow($th,'center',"\t\t"); + $thead = $hc->getHtmlTableThead($tr,'', "\t"); $contTable = $thead; - $li = $hc->getHtmlLi("\"><{\$smarty.const.{$language}INDEX}>",'',"\t\t\t\t\t\t"); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + //Table body + $li = $hc->getHtmlLi("<{\$smarty.const.{$language}INDEX}>",'',"\t\t\t\t\t"); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); foreach (array_keys($tables) as $i) { - $tableNameLi = $tables[$i]->getVar('table_name'); - $stuTableNameLi = mb_strtoupper($tableName); - $li .= $hc->getHtmlLi("/{$tableNameLi}.php\"><{\$smarty.const.{$language}{$stuTableNameLi}}>",'',"\t\t\t\t\t\t"); + if (1 == $tables[$i]->getVar('table_index')) { + $tableNameLi = $tables[$i]->getVar('table_name'); + $tableName = $tables[$i]->getVar('table_name'); + $stuTableNameLi = mb_strtoupper($tableName); + $li .= $hc->getHtmlLi("<{\$smarty.const.{$language}{$stuTableNameLi}}>", '', "\t\t\t\t\t"); + } } - - $ul = $hc->getHtmlUl($li,'menu text-center',"\t\t\t\t\t"); - $td = $hc->getHtmlTableData($ul, 'bold pad5','',"\t\t\t\t", "\n", true); - $tr = $hc->getHtmlTablerow($td, 'center',"\t\t\t"); - - $tbody = $hc->getHtmlTableTbody($tr,'', "\t\t"); + $ul = $hc->getHtmlUl($li,'menu text-center',"\t\t\t\t"); + $td = $hc->getHtmlTableData($ul, 'bold pad5','',"\t\t\t", "\n", true); + $tr = $hc->getHtmlTablerow($td, 'center',"\t\t"); + $tbody = $hc->getHtmlTableTbody($tr,'', "\t"); $contTable .= $tbody; - - $tfoot = << - <{if \$adv != ''}> - <{\$adv}> - <{else}> -   - <{/if}> - -EOT; - - + //Table foot + $single = $sc->getSmartySingleVar('adv'); + $cond = $sc->getSmartyConditions('adv','','', $single, false, '','', "\t\t\t\t", "\n", false); + $td = $hc->getHtmlTableData($cond, 'bold pad5','',"\t\t\t", "\n", true); + $tr = $hc->getHtmlTablerow($td, 'center',"\t\t"); + $tfoot = $hc->getHtmlTableTfoot($tr,'', "\t"); $contTable .= $tfoot; - $contIf = $hc->getHtmlTable($contTable); - $ret = $sc->getSmartyConditions("{$tableName}Count", ' > ', '0', $contIf, false, '','',"\t"); - - $ret .= ''; - $ret .= '*********************************************************'; - - $ret .= << - - - - - - - - - - - - - <{if \$adv != ''}> - - <{else}> - - <{/if}> - -
    <{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>
    -
    <{\$adv}>
     
    -<{/if}>\n -EOT; + $ret .= $hc->getHtmlTable($contTable); + $ret .= $hc->getHtmlComment('End index list','', "\n"); + $ret .= $hc->getHtmlEmpty('','',"\n"); return $ret; } - /** - * @public function getTemplateUserIndexCategories - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return bool|string - */ - public function getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language) - { - $stuTableName = mb_strtoupper($tableName); - $ret = << 0}> -
    - - - - - - - - - <{foreach item={$tableSoleName} from=\${$tableName}}> - - <{if \${$tableSoleName}.count is div by \$numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
    <{\$smarty.const.{$language}{$stuTableName}}>
    - <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableSoleName}}> -
    <{\$lang_thereare}>
    -
    -<{/if}>\n -EOT; - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $single = $sc->getSmartySingleVar('table_type'); - $table = $this->getTemplatesUserIndexTableThead($tableName, $language); - $table .= $this->getTemplatesUserIndexTableTBody($moduleDirname, $tableName, $tableSoleName); - $table .= $hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; - $div = $hc->getHtmlDiv($table, 'table-responsive') . PHP_EOL; - - return $ret/*$sc->getSmartyConditions($tableName, ' > ', '0', $div, false, true)*/ . PHP_EOL; - } - /** * @public function getTemplateUserIndexTable * @param $moduleDirname * @param $tableName * @param $tableSoleName * @param $language + * @param string $t * @return bool|string */ - public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language) + public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language, $t = '') { - $ret = << 0}> - -
    <{\$smarty.const.{$language}INDEX_LATEST_LIST}>
    - - - - <{section name=i loop=\${$tableName}}> - - <{if \${$tableName}[i].count is div by \$divideby}> - - <{/if}> - <{/section}> - - -
    - <{include file="db:{$moduleDirname}_{$tableName}_list.tpl" {$tableSoleName}=\${$tableName}[i]}> -
    - -<{/if}>\n -EOT; + $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + + $double = $sc->getSmartyConst($language, 'INDEX_LATEST_LIST'); + $ret = $hc->getHtmlDiv($double, "{$moduleDirname}-linetitle", $t, "\n", false); + $table = $hc->getHtmlComment("Start show new {$tableName} in index",$t . "\t", "\n"); + $include = $sc->getSmartyIncludeFileListSection($moduleDirname, $tableName, $tableSoleName, $tableName, $t . "\t\t\t\t\t", "\n"); + $td = $hc->getHtmlTableData($include, "col_width<{\$numb_col}> top center", '', $t . "\t\t\t\t", "\n", true); + $tr = $hc->getHtmlEmpty('', $t . "\t\t\t\t\t", "\n"); + $td .= $sc->getSmartyConditions($tableName . '[i].count', ' is div by ', '$divideby', $tr, false, false, false, $t . "\t\t\t\t"); + $section = $hc->getHtmlComment('Start new link loop',$t . "\t\t\t", "\n"); + $section .= $sc->getSmartySection('i', $tableName, $td, '', '', $t . "\t\t\t"); + $section .= $hc->getHtmlComment('End new link loop',$t . "\t\t\t", "\n"); + $tr = $hc->getHtmlTableRow($section, '',$t . "\t\t"); + $table .= $hc->getHtmlTable($tr, 'table table-<{$table_type}>', $t . "\t"); + $ret .= $sc->getSmartyConditions($tableName . 'Count', ' > ','0',$table); return $ret; } @@ -357,31 +183,24 @@ public function getTemplateUserIndexFooter($moduleDirname) public function render() { $module = $this->getModule(); - $table = $this->getTable(); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getTemplateUserIndexHeader($moduleDirname); - $content .= $this->getTemplatesUserIndexBodyDefault($module, $table, $language); + $content .= $this->getTemplatesUserIndexIntro($module, $language); foreach (array_keys($tables) as $t) { - $tableName = $tables[$t]->getVar('table_name'); - $tableSoleName = $tables[$t]->getVar('table_solename'); - $tableCategory[] = $tables[$t]->getVar('table_category'); - $tableFieldname = $tables[$t]->getVar('table_fieldname'); - $tableIndex[] = $tables[$t]->getVar('table_index'); - if (in_array(1, $tableCategory, true) && in_array(1, $tableIndex)) { - $content .= $this->getTemplateUserIndexCategories($moduleDirname, $tableName, $tableSoleName, $language); - } - - if (in_array(0, $tableCategory, true) && in_array(1, $tableIndex)) { + $tableName = $tables[$t]->getVar('table_name'); + $tableSoleName = $tables[$t]->getVar('table_solename'); + $tableIndex = $tables[$t]->getVar('table_index'); + if (1 == $tableIndex) { $content .= $this->getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language); } } $content .= $this->getTemplateUserIndexFooter($moduleDirname); - $tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); - $tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - return $tdmcfile->renderFile(); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + + return $this->renderFile(); } } diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index 7a04e9ad..c6e8ec5f 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -93,11 +93,11 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_thead')) { switch ($fieldElement) { default: - case 2: + //case 2: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retNumb = $hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + $retNumb .= $hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; } } @@ -111,8 +111,8 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_tbody')) { switch ($fieldElement) { default: - case 3: - case 4: + //case 3: + //case 4: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); From 4f5770b33023ce26dd7d874fc9af6b917b56a136 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 9 May 2020 15:42:58 -0400 Subject: [PATCH 011/266] rename to ModuleBuilder --- .travis.yml | 22 +- README.md | 38 +- _archive/Preloads/PreloadsCore.php | 12 +- _archive/class/AddFiles.php | 26 +- _archive/class/AddFilesHandler.php | 4 +- .../class/Files/CreateHtmlSmartyCodes.php | 8 +- .../class/Files/Templates/User/Broken.php | 26 +- .../Files/Templates/User/DisqusComments.php | 12 +- .../Files/Templates/User/FacebookComments.php | 12 +- .../class/Files/Templates/User/Single.php | 16 +- .../class/Files/Templates/User/Submit.php | 18 +- _archive/class/Files/User/UserBroken.php | 24 +- _archive/class/Files/User/UserObjects.php | 8 +- _archive/class/Files/User/UserSingle.php | 18 +- _archive/class/Files/User/UserSubmit.php | 30 +- _archive/class/Files/User/UserVisit.php | 16 +- admin/about.php | 2 +- admin/addfiles.php | 38 +- admin/building.php | 24 +- admin/feedback.php | 2 +- admin/fields.php | 48 +- admin/footer.php | 2 +- admin/header.php | 8 +- admin/index.php | 18 +- admin/logo.php | 6 +- admin/menu.php | 22 +- admin/migrate.php | 10 +- admin/modules.php | 34 +- admin/morefiles.php | 34 +- admin/settings.php | 26 +- admin/tables.php | 40 +- assets/css/admin/style.css | 4 +- assets/css/style.css | 4 +- assets/images/logoModule.png | Bin 5565 -> 8351 bytes assets/js/functions.js | 4 +- class/Building.php | 14 +- class/Common/Breadcrumb.php | 8 +- class/Common/Configurator.php | 2 +- class/Common/FilesManagement.php | 2 +- class/Common/Migrate.php | 4 +- class/Common/ModuleFeedback.php | 2 +- class/Common/ModuleStats.php | 4 +- class/Common/Resizer.php | 2 +- class/Common/ServerStats.php | 2 +- class/Common/VersionChecks.php | 2 +- class/FieldElements.php | 6 +- class/FieldElementsHandler.php | 10 +- class/Fieldattributes.php | 6 +- class/FieldattributesHandler.php | 8 +- class/Fieldkey.php | 6 +- class/FieldkeyHandler.php | 8 +- class/Fieldnull.php | 6 +- class/FieldnullHandler.php | 8 +- class/Fields.php | 198 ++--- class/FieldsHandler.php | 6 +- class/Fieldtype.php | 6 +- class/FieldtypeHandler.php | 8 +- class/Files/Admin/AdminBroken.php | 22 +- class/Files/Admin/AdminHeader.php | 14 +- class/Files/Admin/AdminIndex.php | 16 +- class/Files/Admin/AdminMenu.php | 14 +- class/Files/Admin/AdminPermissions.php | 24 +- .../Files/Assets/Css/Admin/CssAdminStyles.php | 8 +- class/Files/Assets/Css/CssSelectors.php | 4 +- class/Files/Assets/Css/CssStyles.php | 8 +- class/Files/Assets/Js/JavascriptJQuery.php | 10 +- class/Files/Assets/Js/JsJquery.php | 10 +- class/Files/Blocks/BlocksFiles.php | 20 +- class/Files/Classes/ClassFiles.php | 48 +- class/Files/Classes/ClassFormElements.php | 192 ++--- class/Files/Classes/ClassHandlerFiles.php | 42 +- class/Files/Classes/ClassSpecialFiles.php | 28 +- class/Files/Classes/ClassXoopsCode.php | 20 +- class/Files/Config/ConfigConfig.php | 12 +- class/Files/CreateAbstractClass.php | 12 +- class/Files/CreateArchitecture.php | 190 ++--- class/Files/CreateClone.php | 4 +- class/Files/CreateCodeIndents.php | 2 +- class/Files/CreateFile.php | 10 +- class/Files/CreateHtmlCode.php | 6 +- class/Files/CreateMoreFiles.php | 8 +- class/Files/CreatePhpCode.php | 6 +- class/Files/CreateSmartyCode.php | 8 +- class/Files/CreateStructure.php | 10 +- class/Files/CreateTableFields.php | 18 +- class/Files/CreateXoopsCode.php | 64 +- class/Files/Docs/DocsChangelog.php | 10 +- class/Files/Docs/DocsFiles.php | 12 +- .../Includes/IncludeCommentFunctions.php | 14 +- class/Files/Includes/IncludeComments.php | 28 +- class/Files/Includes/IncludeCommon.php | 16 +- class/Files/Includes/IncludeFunctions.php | 18 +- class/Files/Includes/IncludeJquery.php | 12 +- class/Files/Includes/IncludeNotifications.php | 14 +- class/Files/Includes/IncludeSearch.php | 18 +- class/Files/Language/LanguageAdmin.php | 14 +- class/Files/Language/LanguageBlocks.php | 10 +- class/Files/Language/LanguageDefines.php | 8 +- class/Files/Language/LanguageHelp.php | 14 +- class/Files/Language/LanguageMailTpl.php | 10 +- class/Files/Language/LanguageMain.php | 18 +- class/Files/Language/LanguageModinfo.php | 14 +- class/Files/Sql/SqlFile.php | 12 +- .../Templates/Admin/TemplatesAdminAbout.php | 14 +- .../Templates/Admin/TemplatesAdminBroken.php | 32 +- .../Templates/Admin/TemplatesAdminFooter.php | 14 +- .../Templates/Admin/TemplatesAdminHeader.php | 14 +- .../Templates/Admin/TemplatesAdminIndex.php | 14 +- .../Templates/Admin/TemplatesAdminPages.php | 32 +- .../Admin/TemplatesAdminPermissions.php | 18 +- .../Blocks/Defstyle/TemplatesBlocks.php | 24 +- .../Templates/User/Defstyle/Breadcrumbs.php | 18 +- .../Templates/User/Defstyle/Categories.php | 38 +- .../User/Defstyle/CategoriesList.php | 16 +- .../Files/Templates/User/Defstyle/Footer.php | 14 +- .../Files/Templates/User/Defstyle/Header.php | 18 +- class/Files/Templates/User/Defstyle/Index.php | 22 +- .../Templates/User/Defstyle/MoreFiles.php | 10 +- class/Files/Templates/User/Defstyle/Pages.php | 38 +- .../Templates/User/Defstyle/PagesList.php | 14 +- class/Files/Templates/User/Defstyle/Pdf.php | 10 +- class/Files/Templates/User/Defstyle/Rate.php | 10 +- class/Files/Templates/User/Defstyle/Rss.php | 10 +- .../Files/Templates/User/Defstyle/Search.php | 10 +- .../Templates/User/Defstyle/UserPrint.php | 10 +- class/Files/User/UserFooter.php | 14 +- class/Files/User/UserHeader.php | 14 +- class/Files/User/UserIndex.php | 28 +- class/Files/User/UserListTag.php | 12 +- class/Files/User/UserNotificationUpdate.php | 12 +- class/Files/User/UserPages.php | 48 +- class/Files/User/UserPdf.php | 14 +- class/Files/User/UserPrint.php | 16 +- class/Files/User/UserRate.php | 16 +- class/Files/User/UserRss.php | 16 +- class/Files/User/UserSearch.php | 16 +- class/Files/User/UserViewTag.php | 12 +- class/Files/User/UserXoopsCode.php | 18 +- class/Files/User/UserXoopsVersion.php | 44 +- class/Files/admin/AdminAbout.php | 14 +- class/Files/admin/AdminFooter.php | 14 +- class/Files/admin/AdminPages.php | 44 +- class/Files/admin/AdminXoopsCode.php | 26 +- class/Form/FormRadio.php | 2 +- class/Form/FormRaw.php | 2 +- class/Form/FormTab.php | 4 +- class/Form/FormTabTray.php | 12 +- class/Form/SimpleForm.php | 2 +- class/Helper.php | 4 +- class/Html/FormLabel.php | 2 +- class/Logo.php | 4 +- class/LogoGenerator.php | 12 +- class/Modules.php | 94 +-- class/ModulesHandler.php | 4 +- class/MoreFiles.php | 26 +- class/MoreFilesHandler.php | 4 +- class/Session.php | 6 +- class/Settings.php | 80 +- class/SettingsHandler.php | 4 +- class/SplClassLoader.php | 2 +- class/Tables.php | 60 +- class/TablesHandler.php | 8 +- class/Utility.php | 14 +- class/autoload.php | 6 +- class/form/themeform.php | 4 +- class/helper0.php | 8 +- commonfiles/admin/feedback.php | 2 +- commonfiles/class/Common/Breadcrumb.php | 8 +- commonfiles/class/Common/Configurator.php | 2 +- commonfiles/class/Common/FilesManagement.php | 2 +- commonfiles/class/Common/Migrate.php | 4 +- commonfiles/class/Common/ModuleFeedback.php | 2 +- commonfiles/class/Common/ModuleStats.php | 4 +- commonfiles/class/Common/Resizer.php | 2 +- commonfiles/class/Common/ServerStats.php | 2 +- commonfiles/class/Common/VersionChecks.php | 2 +- commonfiles/class/Helper.php | 4 +- commonfiles/class/Utility.php | 14 +- commonfiles/include/install.php | 24 +- commonfiles/include/uninstall.php | 16 +- commonfiles/include/update.php | 22 +- commonfiles/include/xoops_version.inc.php | 2 +- commonfiles/preloads/core.php | 4 +- commonfiles/testdata/index.php | 12 +- docs/changelog.txt | 8 +- docs/readme.txt | 4 +- include/common.php | 4 +- include/functions.php | 8 +- include/install.php | 24 +- include/update.php | 126 ++-- language/english/admin.php | 714 +++++++++--------- language/english/help/help.html | 20 +- language/english/modinfo.php | 150 ++-- language/lang.diff | 46 +- language/update language 1.0 to 1.1.txt | 46 +- language/update language 1.1 to 1.15.txt | 56 +- language/update language 1.1 to 1.37.txt | 76 +- language/update language 1.15 to 1.37.txt | 80 +- language/update language 1.37 to 1.38.txt | 186 ++--- language/update language 1.38 to 1.39.txt | 178 ++--- preloads/core.php | 4 +- ...ate.yml => modulebuilder_3.02_migrate.yml} | 22 +- sql/mysql.sql | 58 +- templates/admin/modulebuilder_about.tpl | 6 + ...ddfiles.tpl => modulebuilder_addfiles.tpl} | 16 +- ...dule.tpl => modulebuilder_addmymodule.tpl} | 16 +- ...uilding.tpl => modulebuilder_building.tpl} | 14 +- ...te_fields.tpl => modulebuilder_fields.tpl} | 42 +- ...item.tpl => modulebuilder_fields_item.tpl} | 54 +- ...te_footer.tpl => modulebuilder_footer.tpl} | 2 +- ...te_header.tpl => modulebuilder_header.tpl} | 0 templates/admin/modulebuilder_index.tpl | 6 + ..._modules.tpl => modulebuilder_modules.tpl} | 78 +- ...efiles.tpl => modulebuilder_morefiles.tpl} | 16 +- ...ule.tpl => modulebuilder_moremymodule.tpl} | 16 +- ...ettings.tpl => modulebuilder_settings.tpl} | 26 +- ...te_tables.tpl => modulebuilder_tables.tpl} | 78 +- ...item.tpl => modulebuilder_tables_item.tpl} | 48 +- templates/admin/tdmcreate_about.tpl | 6 - templates/admin/tdmcreate_index.tpl | 6 - ....yml => modulebuilder_fieldattributes.yml} | 0 ...ts.yml => modulebuilder_fieldelements.yml} | 0 ...ieldkey.yml => modulebuilder_fieldkey.yml} | 0 ...ldnull.yml => modulebuilder_fieldnull.yml} | 0 ...te_fields.yml => modulebuilder_fields.yml} | 0 ...ldtype.yml => modulebuilder_fieldtype.yml} | 0 ...guages.yml => modulebuilder_languages.yml} | 0 ..._modules.yml => modulebuilder_modules.yml} | 0 ...efiles.yml => modulebuilder_morefiles.yml} | 0 ...ettings.yml => modulebuilder_settings.yml} | 0 ...te_tables.yml => modulebuilder_tables.yml} | 0 ....yml => modulebuilder_fieldattributes.yml} | 0 ...ts.yml => modulebuilder_fieldelements.yml} | 0 ...ieldkey.yml => modulebuilder_fieldkey.yml} | 0 ...ldnull.yml => modulebuilder_fieldnull.yml} | 0 ...te_fields.yml => modulebuilder_fields.yml} | 0 ...ldtype.yml => modulebuilder_fieldtype.yml} | 0 ...guages.yml => modulebuilder_languages.yml} | 0 ..._modules.yml => modulebuilder_modules.yml} | 0 ...efiles.yml => modulebuilder_morefiles.yml} | 0 ...ettings.yml => modulebuilder_settings.yml} | 0 ...te_tables.yml => modulebuilder_tables.yml} | 0 testdata/images/modules/logoModule.png | Bin 0 -> 1693 bytes testdata/images/repository/blank.gif | Bin 0 -> 43 bytes testdata/images/repository/empty.png | Bin 0 -> 2711 bytes testdata/images/repository/index.html | 1 + testdata/index.php | 12 +- testdata/mymodule/docs/readme.txt | 4 +- .../mymodule/language/english/help/help.html | 4 +- testdata/mymodule/language/english/main.php | 2 +- .../mymodule/language/german/help/help.html | 4 +- testdata/mymodule/language/german/main.php | 2 +- testdata/mymodule2/docs/readme.txt | 4 +- .../mymodule2/language/english/help/help.html | 4 +- testdata/mymodule2/language/english/main.php | 2 +- .../mymodule2/language/german/help/help.html | 4 +- testdata/mymodule2/language/german/main.php | 2 +- testdata/mymodule3/docs/readme.txt | 4 +- .../mymodule3/language/english/help/help.html | 4 +- testdata/mymodule3/language/english/main.php | 2 +- .../mymodule3/language/german/help/help.html | 4 +- testdata/mymodule3/language/german/main.php | 2 +- xoops_version.php | 248 +++--- 263 files changed, 2915 insertions(+), 2910 deletions(-) rename sql/{tdmcreate_3.02_migrate.yml => modulebuilder_3.02_migrate.yml} (98%) create mode 100644 templates/admin/modulebuilder_about.tpl rename templates/admin/{tdmcreate_addfiles.tpl => modulebuilder_addfiles.tpl} (72%) rename templates/admin/{tdmcreate_addmymodule.tpl => modulebuilder_addmymodule.tpl} (72%) rename templates/admin/{tdmcreate_building.tpl => modulebuilder_building.tpl} (78%) rename templates/admin/{tdmcreate_fields.tpl => modulebuilder_fields.tpl} (83%) rename templates/admin/{tdmcreate_fields_item.tpl => modulebuilder_fields_item.tpl} (83%) rename templates/admin/{tdmcreate_footer.tpl => modulebuilder_footer.tpl} (85%) rename templates/admin/{tdmcreate_header.tpl => modulebuilder_header.tpl} (100%) create mode 100644 templates/admin/modulebuilder_index.tpl rename templates/admin/{tdmcreate_modules.tpl => modulebuilder_modules.tpl} (74%) rename templates/admin/{tdmcreate_morefiles.tpl => modulebuilder_morefiles.tpl} (72%) rename templates/admin/{tdmcreate_moremymodule.tpl => modulebuilder_moremymodule.tpl} (73%) rename templates/admin/{tdmcreate_settings.tpl => modulebuilder_settings.tpl} (72%) rename templates/admin/{tdmcreate_tables.tpl => modulebuilder_tables.tpl} (81%) rename templates/admin/{tdmcreate_tables_item.tpl => modulebuilder_tables_item.tpl} (83%) delete mode 100644 templates/admin/tdmcreate_about.tpl delete mode 100644 templates/admin/tdmcreate_index.tpl rename testdata/english/{tdmcreate_fieldattributes.yml => modulebuilder_fieldattributes.yml} (100%) rename testdata/english/{tdmcreate_fieldelements.yml => modulebuilder_fieldelements.yml} (100%) rename testdata/english/{tdmcreate_fieldkey.yml => modulebuilder_fieldkey.yml} (100%) rename testdata/english/{tdmcreate_fieldnull.yml => modulebuilder_fieldnull.yml} (100%) rename testdata/english/{tdmcreate_fields.yml => modulebuilder_fields.yml} (100%) rename testdata/english/{tdmcreate_fieldtype.yml => modulebuilder_fieldtype.yml} (100%) rename testdata/english/{tdmcreate_languages.yml => modulebuilder_languages.yml} (100%) rename testdata/english/{tdmcreate_modules.yml => modulebuilder_modules.yml} (100%) rename testdata/english/{tdmcreate_morefiles.yml => modulebuilder_morefiles.yml} (100%) rename testdata/english/{tdmcreate_settings.yml => modulebuilder_settings.yml} (100%) rename testdata/english/{tdmcreate_tables.yml => modulebuilder_tables.yml} (100%) rename testdata/german/{tdmcreate_fieldattributes.yml => modulebuilder_fieldattributes.yml} (100%) rename testdata/german/{tdmcreate_fieldelements.yml => modulebuilder_fieldelements.yml} (100%) rename testdata/german/{tdmcreate_fieldkey.yml => modulebuilder_fieldkey.yml} (100%) rename testdata/german/{tdmcreate_fieldnull.yml => modulebuilder_fieldnull.yml} (100%) rename testdata/german/{tdmcreate_fields.yml => modulebuilder_fields.yml} (100%) rename testdata/german/{tdmcreate_fieldtype.yml => modulebuilder_fieldtype.yml} (100%) rename testdata/german/{tdmcreate_languages.yml => modulebuilder_languages.yml} (100%) rename testdata/german/{tdmcreate_modules.yml => modulebuilder_modules.yml} (100%) rename testdata/german/{tdmcreate_morefiles.yml => modulebuilder_morefiles.yml} (100%) rename testdata/german/{tdmcreate_settings.yml => modulebuilder_settings.yml} (100%) rename testdata/german/{tdmcreate_tables.yml => modulebuilder_tables.yml} (100%) create mode 100644 testdata/images/modules/logoModule.png create mode 100644 testdata/images/repository/blank.gif create mode 100644 testdata/images/repository/empty.png create mode 100644 testdata/images/repository/index.html diff --git a/.travis.yml b/.travis.yml index 77fe1295..1decd55a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,14 @@ env: - DB=mysql before_script: - - mysql -e 'create database tdmcreate_settings' - - mysql -e 'create database tdmcreate_modules' - - mysql -e 'create database tdmcreate_tables' - - mysql -e 'create database tdmcreate_fields' - - mysql -e 'create database tdmcreate_languages' - - mysql -e 'create database tdmcreate_fieldtype' - - mysql -e 'create database tdmcreate_fieldattributes' - - mysql -e 'create database tdmcreate_fieldnull' - - mysql -e 'create database tdmcreate_fieldkey' - - mysql -e 'create database tdmcreate_fieldelements' - - mysql -e 'create database tdmcreate_morefiles' + - mysql -e 'create database modulebuilder_settings' + - mysql -e 'create database modulebuilder_modules' + - mysql -e 'create database modulebuilder_tables' + - mysql -e 'create database modulebuilder_fields' + - mysql -e 'create database modulebuilder_languages' + - mysql -e 'create database modulebuilder_fieldtype' + - mysql -e 'create database modulebuilder_fieldattributes' + - mysql -e 'create database modulebuilder_fieldnull' + - mysql -e 'create database modulebuilder_fieldkey' + - mysql -e 'create database modulebuilder_fieldelements' + - mysql -e 'create database modulebuilder_morefiles' diff --git a/README.md b/README.md index eb30f954..1e651d66 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ # Support Support -If you liked the tdmcreate module 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 Xoops.org +If you liked the modulebuilder module 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 Xoops.org -# TDMCreate version 1.91 +# ModuleBuilder version 1.91 -[![Build Status](https://scrutinizer-ci.com/g/txmodxoops/tdmcreate/badges/build.png?b=master)](https://travis-ci.org/txmodxoops/tdmcreate) -[![Jenkins coverage](https://img.shields.io/jenkins/c/https/jenkins.qa.ubuntu.com/address-book-service-utopic-i386-ci.svg)](https://github.com/txmodxoops/tdmcreate) +[![Build Status](https://scrutinizer-ci.com/g/txmodxoops/modulebuilder/badges/build.png?b=master)](https://travis-ci.org/txmodxoops/modulebuilder) +[![Jenkins coverage](https://img.shields.io/jenkins/c/https/jenkins.qa.ubuntu.com/address-book-service-utopic-i386-ci.svg)](https://github.com/txmodxoops/modulebuilder) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](docs/license.txt) -[![Quality Score](https://img.shields.io/scrutinizer/g/txmodxoops/tdmcreate.svg?style=flat)](https://scrutinizer-ci.com/g/txmodxoops/tdmcreate) -[![Gem](https://img.shields.io/gem/dt/rails.svg)](txmodxoops/tdmcreate) -[![Latest Version](https://img.shields.io/github/release/txmodxoops/tdmcreate.svg?style=flat)](https://github.com/txmodxoops/TDMCreate-1.91/releases/latest) +[![Quality Score](https://img.shields.io/scrutinizer/g/txmodxoops/modulebuilder.svg?style=flat)](https://scrutinizer-ci.com/g/txmodxoops/modulebuilder) +[![Gem](https://img.shields.io/gem/dt/rails.svg)](txmodxoops/modulebuilder) +[![Latest Version](https://img.shields.io/github/release/txmodxoops/modulebuilder.svg?style=flat)](https://github.com/txmodxoops/ModuleBuilder-1.91/releases/latest)

    -Issue Stats -Issue Stats - +Issue Stats +Issue Stats +

    -> **Note:** This repository contains the code of the tdmcreate module +> **Note:** This repository contains the code of the modulebuilder module It's under development currently. If you want to build with developers this version of module or create a base modules, you can use the last version of this module at [Txmod XOOPS Web Site](http://www.txmodxoops.org), and visit the main discussion forum at [XOOPS Web Site](https://xoops.org/modules/newbb/viewtopic.php?topic_id=76746) for more information. Screenshot:

    - TDMCreate 1.9.1 dashboard + ModuleBuilder 1.9.1 dashboard

    Clear version @@ -43,13 +43,13 @@ Clear version - Added: filed_tfoot field in fields # Info -TDMCreate is a module that create other basic modules for XOOPS CMS. +ModuleBuilder is a module that create other basic modules for XOOPS CMS. Tested with XOOPS 2.5.9, you can not use it with earlier versions, unless because you don't fit some core files in the background and after some tests. That is ahead XOOPS versions, and goes to 2.6.0, you should download XOOPS 2.5.7.2 and use with this latest version. -Therefore recommended not to use tdmcreate 1.91, with previous versions of XOOPS 2.5.7 +Therefore recommended not to use modulebuilder 1.91, with previous versions of XOOPS 2.5.7 # System - Tests PHP = 5.5.15, 5.6.19, 5.7.0 @@ -63,9 +63,9 @@ XOOPS = 2.5.7.1, 2.5.7.2, 2.5.8 Codeception = 2.0.13 Selenium IDE = 2.9.0 -[![Stories in Ready](https://badge.waffle.io/txmodxoops/tdmcreate.svg?label=ready&title=Ready)](http://waffle.io/txmodxoops/tdmcreate) -[![Stories in Work in Progress](https://badge.waffle.io/txmodxoops/tdmcreate.svg?label=Work in Progress&title=Work in Progress)](http://waffle.io/txmodxoops/tdmcreate) -[![Stories in Done](https://badge.waffle.io/txmodxoops/tdmcreate.svg?label=done&title=Done)](http://waffle.io/txmodxoops/tdmcreate) -[![Stories in Roadmap](https://badge.waffle.io/txmodxoops/tdmcreate.svg?label=roadmap&title=Roadmap)](http://waffle.io/txmodxoops/tdmcreate) +[![Stories in Ready](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=ready&title=Ready)](http://waffle.io/txmodxoops/modulebuilder) +[![Stories in Work in Progress](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=Work in Progress&title=Work in Progress)](http://waffle.io/txmodxoops/modulebuilder) +[![Stories in Done](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=done&title=Done)](http://waffle.io/txmodxoops/modulebuilder) +[![Stories in Roadmap](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=roadmap&title=Roadmap)](http://waffle.io/txmodxoops/modulebuilder) -[![Throughput Graph](https://graphs.waffle.io/txmodxoops/tdmcreate/throughput.svg)](https://waffle.io/txmodxoops/tdmcreate/metrics) +[![Throughput Graph](https://graphs.waffle.io/txmodxoops/modulebuilder/throughput.svg)](https://waffle.io/txmodxoops/modulebuilder/metrics) diff --git a/_archive/Preloads/PreloadsCore.php b/_archive/Preloads/PreloadsCore.php index b3380cd6..ba4e308d 100644 --- a/_archive/Preloads/PreloadsCore.php +++ b/_archive/Preloads/PreloadsCore.php @@ -1,9 +1,9 @@ tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); + $this->tdmcfile = Modulebuilder\Files\CreateFile::getInstance(); } /** @@ -101,7 +101,7 @@ function eventCoreYourNameStart(\$args) } EOT; - $this->tdmcfile->create($moduleDirname, 'preloads', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'preloads', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); } diff --git a/_archive/class/AddFiles.php b/_archive/class/AddFiles.php index 8b4f907f..b471fdeb 100644 --- a/_archive/class/AddFiles.php +++ b/_archive/class/AddFiles.php @@ -1,8 +1,8 @@ helper = Tdmcreate\Helper::getInstance(); + $this->helper = Modulebuilder\Helper::getInstance(); $this->initVar('file_id', XOBJ_DTYPE_INT); $this->initVar('file_mid', XOBJ_DTYPE_INT); @@ -102,7 +102,7 @@ public function getFormAddFiles($action = false) } $isNew = $this->isNew(); - $title = $isNew ? sprintf(_AM_TDMCREATE_ADDFILES_NEW) : sprintf(_AM_TDMCREATE_ADDFILES_EDIT); + $title = $isNew ? sprintf(_AM_MODULEBUILDER_ADDFILES_NEW) : sprintf(_AM_MODULEBUILDER_ADDFILES_EDIT); xoops_load('XoopsFormLoader'); @@ -110,23 +110,23 @@ public function getFormAddFiles($action = false) $form->setExtra('enctype="multipart/form-data"'); $modules = $this->helper->getHandler('modules')->getObjects(null); - $modulesSelect = new \XoopsFormSelect(_AM_TDMCREATE_ADDFILES_MODULES, 'file_mid', $this->getVar('file_mid')); - $modulesSelect->addOption('', _AM_TDMCREATE_ADDFILES_MODULE_SELECT); + $modulesSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_ADDFILES_MODULES, 'file_mid', $this->getVar('file_mid')); + $modulesSelect->addOption('', _AM_MODULEBUILDER_ADDFILES_MODULE_SELECT); foreach ($modules as $mod) { $modulesSelect->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); } $form->addElement($modulesSelect, true); - $modName = new \XoopsFormText(_AM_TDMCREATE_ADDFILES_NAME, 'file_name', 50, 255, $this->getVar('file_name')); - $modName->setDescription(_AM_TDMCREATE_ADDFILES_NAME_DESC); + $modName = new \XoopsFormText(_AM_MODULEBUILDER_ADDFILES_NAME, 'file_name', 50, 255, $this->getVar('file_name')); + $modName->setDescription(_AM_MODULEBUILDER_ADDFILES_NAME_DESC); $form->addElement($modName, true); - $fileEstension = new \XoopsFormText(_AM_TDMCREATE_ADDFILES_EXTENSION, 'file_extension', 50, 255, $this->getVar('file_extension')); - $fileEstension->setDescription(_AM_TDMCREATE_ADDFILES_EXTENSION_DESC); + $fileEstension = new \XoopsFormText(_AM_MODULEBUILDER_ADDFILES_EXTENSION, 'file_extension', 50, 255, $this->getVar('file_extension')); + $fileEstension->setDescription(_AM_MODULEBUILDER_ADDFILES_EXTENSION_DESC); $form->addElement($fileEstension, true); - $fileInfolder = new \XoopsFormText(_AM_TDMCREATE_ADDFILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); - $fileInfolder->setDescription(_AM_TDMCREATE_ADDFILES_INFOLDER_DESC); + $fileInfolder = new \XoopsFormText(_AM_MODULEBUILDER_ADDFILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); + $fileInfolder->setDescription(_AM_MODULEBUILDER_ADDFILES_INFOLDER_DESC); $form->addElement($fileInfolder, true); $form->addElement(new \XoopsFormHidden('op', 'save')); diff --git a/_archive/class/AddFilesHandler.php b/_archive/class/AddFilesHandler.php index 0b7495d7..01b8f9e4 100644 --- a/_archive/class/AddFilesHandler.php +++ b/_archive/class/AddFilesHandler.php @@ -1,6 +1,6 @@ getSmartyIncludeFile($moduleDirname, 'header'); } @@ -92,8 +92,8 @@ private function getTemplatesUserBrokenFileHeader($moduleDirname) */ private function getTemplatesUserBrokenTableHead($tableMid, $tableId, $tableAutoincrement, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $th = ''; $fields = $this->getTableFields($tableMid, $tableId); foreach (array_keys($fields) as $f) { @@ -121,8 +121,8 @@ private function getTemplatesUserBrokenTableHead($tableMid, $tableId, $tableAuto */ private function getTemplatesUserBrokenBody($moduleDirname, $tableMid, $tableId, $tableName, $tableSoleName, $tableAutoincrement) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $ret = ''; $fields = $this->getTableFields($tableMid, $tableId); foreach (array_keys($fields) as $f) { @@ -163,7 +163,7 @@ private function getTemplatesUserBrokenBody($moduleDirname, $tableMid, $tableId, */ private function getTemplatesUserBrokenFileFooter($moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); } @@ -174,7 +174,7 @@ private function getTemplatesUserBrokenFileFooter($moduleDirname) */ public function render() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $module = $this->getModule(); $table = $this->getTable(); $filename = $this->getFileName(); @@ -191,7 +191,7 @@ public function render() $content .= $hc->getHtmlTable($contentTable, 'table table-bordered'); $content .= $this->getTemplatesUserBrokenFileFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/Templates/User/DisqusComments.php b/_archive/class/Files/Templates/User/DisqusComments.php index 39c3388a..6472f1c2 100644 --- a/_archive/class/Files/Templates/User/DisqusComments.php +++ b/_archive/class/Files/Templates/User/DisqusComments.php @@ -1,9 +1,9 @@ getHtmlEmpty('Please! Enter here your comments code'); } @@ -90,7 +90,7 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getTemplatesCommentCode(); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/Templates/User/FacebookComments.php b/_archive/class/Files/Templates/User/FacebookComments.php index 30c530d6..716ad70b 100644 --- a/_archive/class/Files/Templates/User/FacebookComments.php +++ b/_archive/class/Files/Templates/User/FacebookComments.php @@ -1,9 +1,9 @@ getHtmlEmpty('Please! Enter here your comments code'); } @@ -90,7 +90,7 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getTemplatesCommentCode(); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/Templates/User/Single.php b/_archive/class/Files/Templates/User/Single.php index ef1805d4..7f76dfc2 100644 --- a/_archive/class/Files/Templates/User/Single.php +++ b/_archive/class/Files/Templates/User/Single.php @@ -1,9 +1,9 @@ getSmartyIncludeFile($moduleDirname); return $ret; @@ -92,7 +92,7 @@ private function getTemplatesUserSingleHeader($moduleDirname) private function getTemplatesUserSingleBody($moduleDirname, $table, $language) { $tableName = $table->getVar('table_name'); - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $ret = ''; $ret .= $hc->getHtmlEmpty('', '',"\n"); $content = $hc->getHtmlHNumb('Services Panels', '2', 'page-header', "\t\t\t"); @@ -112,7 +112,7 @@ private function getTemplatesUserSingleBody($moduleDirname, $table, $language) */ private function getTemplatesUserSingleFooter($moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $ret = $sc->getSmartyIncludeFile($moduleDirname, 'footer'); return $ret; @@ -134,7 +134,7 @@ public function render() $content .= $this->getTemplatesUserSingleBody($moduleDirname, $table, $language); $content .= $this->getTemplatesUserSingleFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/Templates/User/Submit.php b/_archive/class/Files/Templates/User/Submit.php index 38ab13a8..95277d80 100644 --- a/_archive/class/Files/Templates/User/Submit.php +++ b/_archive/class/Files/Templates/User/Submit.php @@ -1,9 +1,9 @@ getSmartyIncludeFile($moduleDirname, 'header'); } @@ -89,8 +89,8 @@ private function getTemplatesUserSubmitHeader($moduleDirname) */ private function getTemplatesUserSubmit($moduleDirname, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $const = $sc->getSmartyConst($language, 'SUBMIT_SUBMITONCE'); $li = $hc->getHtmlLi($const, '',"\t\t"); @@ -122,7 +122,7 @@ private function getTemplatesUserSubmit($moduleDirname, $language) */ private function getTemplatesUserSubmitFooter($moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); } @@ -144,7 +144,7 @@ public function render() $content .= $this->getTemplatesUserSubmit($moduleDirname, $language); $content .= $this->getTemplatesUserSubmitFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/User/UserBroken.php b/_archive/class/Files/User/UserBroken.php index 1857718b..e3e57a62 100644 --- a/_archive/class/Files/User/UserBroken.php +++ b/_archive/class/Files/User/UserBroken.php @@ -1,9 +1,9 @@ getXcSaveFieldId($fields); $ccFieldId = $this->getCamelCase($fieldId, false, true); @@ -108,8 +108,8 @@ public function getUserBrokenHeader($moduleDirname, $fields) */ public function getUserBrokenForm($tableName, $language, $t) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Navigation','', $t); $ret .= $xc->getXcEqualsOperator('$navigation', "{$language}SUBMIT_PROPOSER", null, $t); @@ -140,8 +140,8 @@ public function getUserBrokenForm($tableName, $language, $t) */ public function getUserBrokenSave($moduleDirname, $fields, $tableName, $tableSoleName, $language, $t) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Security Check','',$t); $xoopsSecurityCheck = $xc->getXcXoopsSecurityCheck(); $securityError = $xc->getXcXoopsSecurityErrors(); @@ -185,7 +185,7 @@ public function getUserBrokenSave($moduleDirname, $fields, $tableName, $tableSol */ private function getUserBrokenSwitch($moduleDirname, $tableName, $tableSoleName, $language) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $table = $this->getTable(); $tableId = $table->getVar('table_id'); $tableMid = $table->getVar('table_mid'); @@ -220,7 +220,7 @@ public function render() $content .= $this->getUserBrokenSwitch($moduleDirname, $tableName, $tableSoleName, $language); $content .= $this->getInclude('footer'); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/User/UserObjects.php b/_archive/class/Files/User/UserObjects.php index 20770a35..b391173f 100644 --- a/_archive/class/Files/User/UserObjects.php +++ b/_archive/class/Files/User/UserObjects.php @@ -1,9 +1,9 @@ getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); @@ -135,8 +135,8 @@ public function getUserSingleBody($moduleDirname, $tableName, $language) */ private function getUserSingleFooter($moduleDirname, $tableName, $language) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $stuTableName = mb_strtoupper($tableName); @@ -175,7 +175,7 @@ public function render() $content .= $this->getUserSingleHeader($moduleDirname, $table, $fields); $content .= $this->getUserSingleBody($module, $tableName, $language); $content .= $this->getUserSingleFooter($moduleDirname, $tableName, $language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/User/UserSubmit.php b/_archive/class/Files/User/UserSubmit.php index db074d9d..4603f5bf 100644 --- a/_archive/class/Files/User/UserSubmit.php +++ b/_archive/class/Files/User/UserSubmit.php @@ -1,9 +1,9 @@ getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); @@ -113,8 +113,8 @@ public function getUserSubmitHeader($moduleDirname, $tablePermissions) */ public function getUserSubmitForm($tableName, $language, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Navigation', '', $t); $ret .= $xc->getXcEqualsOperator('$navigation', "{$language}SUBMIT_PROPOSER", '', $t); @@ -147,8 +147,8 @@ public function getUserSubmitForm($tableName, $language, $t = '') */ public function getUserSubmitSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Security Check', '', $t); $xoopsSecurityCheck = $xc->getXcXoopsSecurityCheck(); $securityError = $xc->getXcXoopsSecurityErrors(); @@ -212,7 +212,7 @@ public function getUserSubmitSave($moduleDirname, $fields, $tableName, $tableSol */ public function getUserSubmitFooter($language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); $ret .= $uxc->getUserBreadcrumbs($language, 'SUBMIT'); @@ -236,7 +236,7 @@ public function getUserSubmitFooter($language) */ private function getUserSubmitSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, $t) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $fields = $this->getTableFields($tableMid, $tableId); $cases = [ 'form' => [$this->getUserSubmitForm($tableName, $language, $t . "\t")], @@ -255,8 +255,8 @@ private function getUserSubmitSwitch($moduleDirname, $tableId, $tableMid, $table */ private function getPermissionsSave($moduleDirname, $perm = 'view') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); $ret .= $xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', '$permId', false, "\t\t\t"); @@ -298,7 +298,7 @@ public function render() $content .= $this->getUserSubmitSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, "\t"); $content .= $this->getUserSubmitFooter($language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/_archive/class/Files/User/UserVisit.php b/_archive/class/Files/User/UserVisit.php index 14da010b..4cb6505a 100644 --- a/_archive/class/Files/User/UserVisit.php +++ b/_archive/class/Files/User/UserVisit.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->uxc = UserXoopsCode::getInstance(); } @@ -96,7 +96,7 @@ public function write($module, $table, $filename) */ private function getUserVisitHeader($table, $fields) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $moduleDirname = $module->getVar('mod_dirname'); $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); @@ -184,7 +184,7 @@ public function render() $content .= $this->getUserVisitCheckLimit(); $content .= $this->getUserVisitCheckHost(); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/admin/about.php b/admin/about.php index cf9b5f43..17a09382 100644 --- a/admin/about.php +++ b/admin/about.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) diff --git a/admin/addfiles.php b/admin/addfiles.php index 09676dcc..d834664c 100644 --- a/admin/addfiles.php +++ b/admin/addfiles.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -21,7 +21,7 @@ * @author Txmod Xoops * */ -$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_addfiles.tpl'; +$GLOBALS['xoopsOption']['template_main'] = 'modulebuilder_addfiles.tpl'; include __DIR__ . '/header.php'; // Recovered value of argument op in the URL $ @@ -35,11 +35,11 @@ $start = \Xmf\Request::getInt('start', 0); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('addfiles_adminpager')); // Define main template - // $templateMain = 'tdmcreate_addfiles.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + // $templateMain = 'modulebuilder_addfiles.tpl'; + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addfiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_FILE, 'addfiles.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_FILE, 'addfiles.php?op=new', 'add'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL); @@ -48,7 +48,7 @@ $modulesCount = $helper->getHandler('Modules')->getCountModules(); // Redirect if there aren't modules if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOT_MODULES); + redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOT_MODULES); } $addfilesCount = $helper->getHandler('Addfiles')->getCountAddFiles(); $addfilesAll = $helper->getHandler('Addfiles')->getAllAddFiles($start, $limit); @@ -65,15 +65,15 @@ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MODULES); + $GLOBALS['xoopsTpl']->assign('error', _AM_MODULEBUILDER_THEREARENT_MODULES); } break; case 'new': // Define main template - // $templateMain = 'tdmcreate_addfiles.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + // $templateMain = 'modulebuilder_addfiles.tpl'; + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addfiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADDFILES_LIST, 'addfiles.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADDFILES_LIST, 'addfiles.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $addfilesObj = $helper->getHandler('Addfiles')->create(); @@ -101,9 +101,9 @@ if ($helper->getHandler('Addfiles')->insert($addfilesObj)) { if ($addfilesObj->isNew()) { - redirect_header('addfiles.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_CREATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); + redirect_header('addfiles.php', 5, sprintf(_AM_MODULEBUILDER_FILE_FORM_CREATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); } else { - redirect_header('addfiles.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_UPDATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); + redirect_header('addfiles.php', 5, sprintf(_AM_MODULEBUILDER_FILE_FORM_UPDATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); } } @@ -113,11 +113,11 @@ break; case 'edit': // Define main template - // $templateMain = 'tdmcreate_addfiles.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + // $templateMain = 'modulebuilder_addfiles.tpl'; + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addfiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'addfiles.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_ADDFILES_LIST, 'addfiles.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'addfiles.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADDFILES_LIST, 'addfiles.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $addfilesObj = $helper->getHandler('Addfiles')->get($fileId); @@ -131,12 +131,12 @@ redirect_header('addfiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if ($helper->getHandler('Addfiles')->delete($addfilesObj)) { - redirect_header('addfiles.php', 3, _AM_TDMCREATE_FORM_DELETED_OK); + redirect_header('addfiles.php', 3, _AM_MODULEBUILDER_FORM_DELETED_OK); } else { $GLOBALS['xoopsTpl']->assign('error', $addfilesObj->getHtmlErrors()); } } else { - xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORM_SURE_DELETE, $addfilesObj->getVar('file_name'))); + xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORM_SURE_DELETE, $addfilesObj->getVar('file_name'))); } break; } diff --git a/admin/building.php b/admin/building.php index 599d7ceb..7619248a 100644 --- a/admin/building.php +++ b/admin/building.php @@ -1,6 +1,6 @@ getHandler('Modules')->get($mid); -$cachePath = XOOPS_VAR_PATH . '/caches/tdmcreate_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)); @@ -56,14 +56,14 @@ // include_once TDMC_CLASS_PATH . '/building.php'; if (isset($moduleDirname)) { // Clear this module if it's in repository - $building = Tdmcreate\Building::getInstance(); + $building = Modulebuilder\Building::getInstance(); if (is_dir($fromDir)) { $building->clearDir($fromDir); } } // Structure // include_once TDMC_CLASS_PATH . '/files/Architecture.php'; - $handler = Tdmcreate\Files\CreateArchitecture::getInstance(); + $handler = Modulebuilder\Files\CreateArchitecture::getInstance(); // Creation of the structure of folders and files $baseArchitecture = $handler->setBaseFoldersFiles($moduleObj); if (false !== $baseArchitecture) { @@ -84,17 +84,17 @@ // Get common files $resCommon = $handler->setCommonFiles($moduleObj); - $build['list'] = _AM_TDMCREATE_BUILDING_COMMON; + $build['list'] = _AM_MODULEBUILDER_BUILDING_COMMON; $GLOBALS['xoopsTpl']->append('builds', $build); unset($build); // Directory to saved all files - $building_directory = sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY, $moduleDirname); + $building_directory = sprintf(_AM_MODULEBUILDER_BUILDING_DIRECTORY, $moduleDirname); // Copy this module in root modules if (1 === $inroot_copy) { - $building = Tdmcreate\Building::getInstance(); + $building = Modulebuilder\Building::getInstance(); if (isset($moduleDirname)) { // Clear this module if it's in root/modules // Warning: If you have an older operating module with the same name, @@ -105,7 +105,7 @@ } } $building->copyDir($fromDir, $toDir); - $building_directory .= sprintf(_AM_TDMCREATE_BUILDING_DIRECTORY_INROOT, $toDir); + $building_directory .= sprintf(_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT, $toDir); } $GLOBALS['xoopsTpl']->assign('building_directory', $building_directory); break; @@ -115,11 +115,11 @@ // Redirect if there aren't modules $nbModules = $helper->getHandler('Modules')->getCount(); if (0 == $nbModules) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES); } unset($nbModules); // include_once TDMC_CLASS_PATH . '/building.php'; - $building = Tdmcreate\Building::getInstance(); + $building = Modulebuilder\Building::getInstance(); $form = $building->getForm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; diff --git a/admin/feedback.php b/admin/feedback.php index 124f7e43..806505bc 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -25,7 +25,7 @@ $adminObject = \Xmf\Module\Admin::getInstance(); -$feedback = new \XoopsModules\Tdmcreate\Common\ModuleFeedback(); +$feedback = new \XoopsModules\Modulebuilder\Common\ModuleFeedback(); // It recovered the value of argument op in URL$ $op = Request::getString('op', 'list'); diff --git a/admin/fields.php b/admin/fields.php index eaf4e8f3..54f72771 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -20,7 +20,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -32,7 +32,7 @@ */ // Define main template -$templateMain = 'tdmcreate_fields.tpl'; +$templateMain = 'modulebuilder_fields.tpl'; include __DIR__ . '/header.php'; // Recovered value of arguments op in the URL $ @@ -48,24 +48,24 @@ default: $start = \Xmf\Request::getInt('start', 0); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('tables_adminpager')); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/sortable.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/sortable.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); // Redirect if there aren't modules $modulesCount = $helper->getHandler('Modules')->getCountModules(); if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES); } unset($modulesCount); // Redirect if there aren't tables $tablesCount = $helper->getHandler('Tables')->getCountTables(); if (0 == $tablesCount) { - redirect_header('tables.php?op=new', 2, _AM_TDMCREATE_NOTTABLES); + redirect_header('tables.php?op=new', 2, _AM_MODULEBUILDER_NOTTABLES); } // Get the list of tables $tablesAll = $helper->getHandler('Tables')->getAllTables($start, $limit, 'table_order'); @@ -105,16 +105,16 @@ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_FIELDS); + $GLOBALS['xoopsTpl']->assign('error', _AM_MODULEBUILDER_THEREARENT_FIELDS); } break; case 'new': - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php')); - $adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); - $adminObject->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_LIST, 'tables.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_FIELDS_LIST, 'fields.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); // Form Add $fieldsObj = $helper->getHandler('Fields')->create(); @@ -172,10 +172,10 @@ // Set field elements if ($fieldsObj->isNew()) { // Redirect to field.php if saved - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_SAVED_OK, $tableName)); + redirect_header('fields.php', 2, sprintf(_AM_MODULEBUILDER_FIELDS_FORM_SAVED_OK, $tableName)); } else { // Redirect to field.php if updated - (Needed code from table name by field_tid) - redirect_header('fields.php', 2, sprintf(_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK, $tableName)); + redirect_header('fields.php', 2, sprintf(_AM_MODULEBUILDER_FIELDS_FORM_UPDATED_OK, $tableName)); } $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); @@ -183,13 +183,13 @@ $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'edit': - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); - $adminObject->addItemButton(_AM_TDMCREATE_FIELDS_LIST, 'fields.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_LIST, 'tables.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_FIELDS_LIST, 'fields.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); // Form Edit $fieldId = \Xmf\Request::getInt('field_id'); @@ -212,7 +212,7 @@ ++$i; } } - redirect_header('fields.php', 5, _AM_TDMCREATE_FIELD_ORDER_ERROR); + redirect_header('fields.php', 5, _AM_MODULEBUILDER_FIELD_ORDER_ERROR); unset($i); } exit; @@ -224,12 +224,12 @@ redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if ($helper->getHandler('Tables')->delete($tablesObj)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_FORMDELOK); + redirect_header('fields.php', 3, _AM_MODULEBUILDER_FORMDELOK); } else { echo $tablesObj->getHtmlErrors(); } } else { - xoops_confirm(['ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORMSUREDEL, $tablesObj->getVar('table_name'))); + xoops_confirm(['ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $tablesObj->getVar('table_name'))); } break; case 'display': @@ -244,7 +244,7 @@ } } if ($helper->getHandler('Fields')->insert($fieldsObj)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); + redirect_header('fields.php', 3, _AM_MODULEBUILDER_TOGGLE_SUCCESS); } $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); } diff --git a/admin/footer.php b/admin/footer.php index 8bd0b22d..c991ad49 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) diff --git a/admin/header.php b/admin/header.php index 3f2bc7e7..ffb093b2 100644 --- a/admin/header.php +++ b/admin/header.php @@ -10,7 +10,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -34,9 +34,9 @@ $modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons32'); //$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -/** @var \XoopsModules\Tdmcreate\Helper $helper */ -$helper = \XoopsModules\Tdmcreate\Helper::getInstance(); -$utility = new \XoopsModules\Tdmcreate\Utility(); +/** @var \XoopsModules\Modulebuilder\Helper $helper */ +$helper = \XoopsModules\Modulebuilder\Helper::getInstance(); +$utility = new \XoopsModules\Modulebuilder\Utility(); // MyTextSanitizer $myts = MyTextSanitizer::getInstance(); diff --git a/admin/index.php b/admin/index.php index 79976ec8..740ce505 100644 --- a/admin/index.php +++ b/admin/index.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -21,7 +21,7 @@ * @author Txmod Xoops http://www.txmodxoops.org * */ -$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_index.tpl'; +$GLOBALS['xoopsOption']['template_main'] = 'modulebuilder_index.tpl'; include __DIR__ . '/header.php'; $countSettings = $helper->getHandler('Settings')->getCount(); @@ -31,13 +31,13 @@ $countFiles = $helper->getHandler('Morefiles')->getCount(); unset($criteria); -//$templateMain = 'tdmcreate_index.tpl'; -$adminObject->addInfoBox(_AM_TDMCREATE_ADMIN_NUMMODULES); -$adminObject->addInfoBoxLine(sprintf('', $countSettings), 'Blue'); -$adminObject->addInfoBoxLine(sprintf('', $countModules), 'Green'); -$adminObject->addInfoBoxLine(sprintf('', $countTables), 'Orange'); -$adminObject->addInfoBoxLine(sprintf('', $countFields), 'Gray'); -$adminObject->addInfoBoxLine(sprintf('', $countFiles), 'Red'); +//$templateMain = 'modulebuilder_index.tpl'; +$adminObject->addInfoBox(_AM_MODULEBUILDER_ADMIN_NUMMODULES); +$adminObject->addInfoBoxLine(sprintf('', $countSettings), 'Blue'); +$adminObject->addInfoBoxLine(sprintf('', $countModules), 'Green'); +$adminObject->addInfoBoxLine(sprintf('', $countTables), 'Orange'); +$adminObject->addInfoBoxLine(sprintf('', $countFields), 'Gray'); +$adminObject->addInfoBoxLine(sprintf('', $countFiles), 'Red'); // Upload Folders $folder = [ TDMC_UPLOAD_PATH, diff --git a/admin/logo.php b/admin/logo.php index 9cb82bed..1bffc0f1 100644 --- a/admin/logo.php +++ b/admin/logo.php @@ -1,6 +1,6 @@ createLogo($iconName, $caption); + $ret = Modulebuilder\Logo::getInstance()->createLogo($iconName, $caption); phpFunction($ret); } else { redirect_header('logo.php', 3, 'Method Not Exist'); diff --git a/admin/menu.php b/admin/menu.php index ce75c3d7..e65e7be0 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -26,8 +26,8 @@ $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -/** @var \XoopsModules\Tdmcreate\Helper $helper */ -$helper = \XoopsModules\Tdmcreate\Helper::getInstance(); +/** @var \XoopsModules\Modulebuilder\Helper $helper */ +$helper = \XoopsModules\Modulebuilder\Helper::getInstance(); $helper->loadLanguage('common'); $helper->loadLanguage('feedback'); @@ -43,43 +43,43 @@ $modPathIcon32 = $moduleInfo->getInfo('modicons32'); $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU1, + 'title' => _MI_MODULEBUILDER_ADMENU1, 'link' => 'admin/index.php', 'icon' => $pathIcon32 . '/dashboard.png', ]; $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU2, + 'title' => _MI_MODULEBUILDER_ADMENU2, 'link' => 'admin/settings.php', 'icon' => $modPathIcon32 . '/settings.png', ]; $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU3, + 'title' => _MI_MODULEBUILDER_ADMENU3, 'link' => 'admin/modules.php', 'icon' => $modPathIcon32 . '/addmodule.png', ]; $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU4, + 'title' => _MI_MODULEBUILDER_ADMENU4, 'link' => 'admin/tables.php', 'icon' => $modPathIcon32 . '/addtable.png', ]; $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU5, + 'title' => _MI_MODULEBUILDER_ADMENU5, 'link' => 'admin/fields.php', 'icon' => $modPathIcon32 . '/fields.png', ]; $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU6, + 'title' => _MI_MODULEBUILDER_ADMENU6, 'link' => 'admin/morefiles.php', 'icon' => $modPathIcon32 . '/files.png', ]; $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ADMENU7, + 'title' => _MI_MODULEBUILDER_ADMENU7, 'link' => 'admin/building.php', 'icon' => $modPathIcon32 . '/builder.png', ]; @@ -100,7 +100,7 @@ } $adminmenu[] = [ - 'title' => _MI_TDMCREATE_ABOUT, + 'title' => _MI_MODULEBUILDER_ABOUT, 'link' => 'admin/about.php', 'icon' => $pathIcon32 . 'about.png', ]; diff --git a/admin/migrate.php b/admin/migrate.php index aa2fad7a..4e8182ff 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -30,7 +30,7 @@ // ------------------------------------------------------------------------- // use Xmf\Request; -use XoopsModules\Tdmcreate; +use XoopsModules\Modulebuilder; require_once __DIR__ . '/header.php'; //xoops_cp_header(); @@ -53,11 +53,11 @@ //XoopsLoad::load('migrate', 'newbb'); -/** @var Tdmcreate\Common\Configurator $configurator */ -$configurator = new Tdmcreate\Common\Configurator(); +/** @var Modulebuilder\Common\Configurator $configurator */ +$configurator = new Modulebuilder\Common\Configurator(); -/** @var \XoopsModules\Tdmcreate\Common\Migrate $migrator */ -$migrator = new \XoopsModules\Tdmcreate\Common\Migrate($configurator); +/** @var \XoopsModules\Modulebuilder\Common\Migrate $migrator */ +$migrator = new \XoopsModules\Modulebuilder\Common\Migrate($configurator); $op = Request::getCmd('op', 'default'); $opShow = Request::getCmd('show', null, 'POST'); diff --git a/admin/modules.php b/admin/modules.php index e4144805..d494daff 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -23,7 +23,7 @@ */ // Define main template -$templateMain = 'tdmcreate_modules.tpl'; +$templateMain = 'modulebuilder_modules.tpl'; include __DIR__ . '/header.php'; // Recovered value of argument op in the URL $ @@ -35,10 +35,10 @@ default: $start = \Xmf\Request::getInt('start', 0); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('modules_adminpager')); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'modules.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'modules.php?op=new', 'add'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); @@ -47,7 +47,7 @@ $modulesAll = $helper->getHandler('Modules')->getAllModules($start, $limit); // Redirect if there aren't modules if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES); } // Display modules list if ($modulesCount > 0) { @@ -62,14 +62,14 @@ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MODULES); + $GLOBALS['xoopsTpl']->assign('error', _AM_MODULEBUILDER_THEREARENT_MODULES); } break; case 'new': - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); - $adminObject->addItemButton(_AM_TDMCREATE_MODULES_LIST, 'modules.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $modulesObj = $helper->getHandler('Modules')->create(); @@ -153,9 +153,9 @@ if ($helper->getHandler('Modules')->insert($modulesObj)) { if ($modulesObj->isNew()) { - redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_MODULE_FORM_CREATED_OK, \Xmf\Request::getString('mod_name', '', 'POST'))); + redirect_header('tables.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_CREATED_OK, \Xmf\Request::getString('mod_name', '', 'POST'))); } else { - redirect_header('modules.php', 5, sprintf(_AM_TDMCREATE_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('mod_name', '', 'POST'))); + redirect_header('modules.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('mod_name', '', 'POST'))); } } @@ -164,10 +164,10 @@ $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'edit': - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'modules.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_MODULES_LIST, 'modules.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'modules.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $modulesObj = $helper->getHandler('Modules')->get($modId); @@ -181,12 +181,12 @@ redirect_header('modules.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if ($helper->getHandler('Modules')->delete($modulesObj)) { - redirect_header('modules.php', 3, _AM_TDMCREATE_FORMDELOK); + redirect_header('modules.php', 3, _AM_MODULEBUILDER_FORMDELOK); } else { $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } } else { - xoops_confirm(['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORMSUREDEL, $modulesObj->getVar('mod_name'))); + xoops_confirm(['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $modulesObj->getVar('mod_name'))); } break; @@ -202,7 +202,7 @@ } } if ($helper->getHandler('Modules')->insert($modulesObj)) { - redirect_header('modules.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); + redirect_header('modules.php', 3, _AM_MODULEBUILDER_TOGGLE_SUCCESS); } $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } diff --git a/admin/morefiles.php b/admin/morefiles.php index c6b1d4f3..56712ada 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -23,7 +23,7 @@ */ // Define main template -$templateMain = 'tdmcreate_morefiles.tpl'; +$templateMain = 'modulebuilder_morefiles.tpl'; include __DIR__ . '/header.php'; // Recovered value of argument op in the URL $ @@ -36,10 +36,10 @@ default: $start = \Xmf\Request::getInt('start', 0); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('morefiles_adminpager')); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MORE_FILE, 'morefiles.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MORE_FILE, 'morefiles.php?op=new', 'add'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL); @@ -48,7 +48,7 @@ $modulesCount = $helper->getHandler('Modules')->getCountModules(); // Redirect if there aren't modules if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 2, _AM_TDMCREATE_NOTMODULES); + redirect_header('modules.php?op=new', 2, _AM_MODULEBUILDER_NOTMODULES); } $morefilesCount = $helper->getHandler('Morefiles')->getCountMoreFiles(); $morefilesAll = $helper->getHandler('Morefiles')->getAllMoreFiles($start, $limit); @@ -65,13 +65,13 @@ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_MORE_FILES); + $GLOBALS['xoopsTpl']->assign('error', _AM_MODULEBUILDER_THEREARENT_MORE_FILES); } break; case 'new': - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_MORE_FILES_LIST, 'morefiles.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_MORE_FILES_LIST, 'morefiles.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $morefilesObj = $helper->getHandler('Morefiles')->create(); @@ -99,9 +99,9 @@ if ($helper->getHandler('Morefiles')->insert($morefilesObj)) { if ($morefilesObj->isNew()) { - redirect_header('morefiles.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_CREATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); + redirect_header('morefiles.php', 5, sprintf(_AM_MODULEBUILDER_FILE_FORM_CREATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); } else { - redirect_header('morefiles.php', 5, sprintf(_AM_TDMCREATE_FILE_FORM_UPDATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); + redirect_header('morefiles.php', 5, sprintf(_AM_MODULEBUILDER_FILE_FORM_UPDATED_OK, \Xmf\Request::getString('file_name', '', 'POST'))); } } @@ -111,11 +111,11 @@ break; case 'edit': // Define main template - // $templateMain = 'tdmcreate_morefiles.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + // $templateMain = 'modulebuilder_morefiles.tpl'; + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_MODULE, 'morefiles.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_MORE_FILES_LIST, 'morefiles.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_MODULE, 'morefiles.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_MORE_FILES_LIST, 'morefiles.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $morefilesObj = $helper->getHandler('Morefiles')->get($fileId); @@ -129,12 +129,12 @@ redirect_header('morefiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if ($helper->getHandler('Morefiles')->delete($morefilesObj)) { - redirect_header('morefiles.php', 3, _AM_TDMCREATE_FORM_DELETED_OK); + redirect_header('morefiles.php', 3, _AM_MODULEBUILDER_FORM_DELETED_OK); } else { $GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors()); } } else { - xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORM_SURE_DELETE, $morefilesObj->getVar('file_name'))); + xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORM_SURE_DELETE, $morefilesObj->getVar('file_name'))); } break; } diff --git a/admin/settings.php b/admin/settings.php index 5e6caab7..9dc7b2c1 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -23,7 +23,7 @@ */ // Define main template -$templateMain = 'tdmcreate_settings.tpl'; +$templateMain = 'modulebuilder_settings.tpl'; include __DIR__ . '/header.php'; @@ -36,10 +36,10 @@ default: $start = \Xmf\Request::getInt('start', 0); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('settings_adminpager')); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_SETTING, 'settings.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_SETTING, 'settings.php?op=new', 'add'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); @@ -60,13 +60,13 @@ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_SETTINGS); + $GLOBALS['xoopsTpl']->assign('error', _AM_MODULEBUILDER_THEREARENT_SETTINGS); } break; case 'new': - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); - $adminObject->addItemButton(_AM_TDMCREATE_SETTINGS_LIST, 'settings.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_LIST, 'settings.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $settingsObj = $helper->getHandler('Settings')->create(); @@ -138,7 +138,7 @@ } if ($helper->getHandler('Settings')->insert($settingsObj)) { - redirect_header('settings.php', 5, sprintf(_AM_TDMCREATE_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST'))); + redirect_header('settings.php', 5, sprintf(_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST'))); } $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); @@ -147,8 +147,8 @@ break; case 'edit': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_SETTING, 'settings.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_SETTINGS_LIST, 'settings.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_SETTING, 'settings.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_SETTINGS_LIST, 'settings.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $settingsObj = $helper->getHandler('Settings')->get($setId); $form = $settingsObj->getFormSettings(); @@ -161,12 +161,12 @@ redirect_header('settings.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if ($helper->getHandler('Settings')->delete($settingsObj)) { - redirect_header('settings.php', 3, _AM_TDMCREATE_FORMDELOK); + redirect_header('settings.php', 3, _AM_MODULEBUILDER_FORMDELOK); } else { $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); } } else { - xoops_confirm(['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORMSUREDEL, $settingsObj->getVar('set_name'))); + xoops_confirm(['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $settingsObj->getVar('set_name'))); } break; case 'display': diff --git a/admin/tables.php b/admin/tables.php index 267f1211..82518f6d 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -11,7 +11,7 @@ */ /** - * tdmcreate module. + * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) @@ -23,7 +23,7 @@ */ // Define main template -$templateMain = 'tdmcreate_tables.tpl'; +$templateMain = 'modulebuilder_tables.tpl'; include __DIR__ . '/header.php'; // Recovered value of arguments op in the URL $ @@ -42,12 +42,12 @@ default: $start = \Xmf\Request::getInt('start', 0); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('modules_adminpager')); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/sortable.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); + $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/sortable.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); @@ -55,13 +55,13 @@ $modulesCount = $helper->getHandler('Modules')->getCountModules(); // Redirect if there aren't modules if (0 == $modulesCount) { - redirect_header('modules.php?op=new', 10, _AM_TDMCREATE_NOTMODULES); + redirect_header('modules.php?op=new', 10, _AM_MODULEBUILDER_NOTMODULES); } $modulesAll = $helper->getHandler('Modules')->getAllModules($start, $limit); $tablesCount = $helper->getHandler('Tables')->getObjects(null); // Redirect if there aren't tables if (0 == $tablesCount) { - redirect_header('tables.php?op=new', 10, _AM_TDMCREATE_NOTTABLES); + redirect_header('tables.php?op=new', 10, _AM_MODULEBUILDER_NOTTABLES); } unset($tablesCount); // Display modules list @@ -94,12 +94,12 @@ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); } } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_TDMCREATE_THEREARENT_TABLES); + $GLOBALS['xoopsTpl']->assign('error', _AM_MODULEBUILDER_THEREARENT_TABLES); } break; case 'new': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php')); - $adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_LIST, 'tables.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $tablesObj = $helper->getHandler('Tables')->create(); @@ -125,7 +125,7 @@ //unset($criteria); foreach (array_keys($tableNameSearch) as $t) { if ($tableNameSearch[$t]->getVar('table_name') === \Xmf\Request::getString('table_name', '', 'POST')) { - redirect_header('tables.php?op=new', 3, sprintf(_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST, \Xmf\Request::getString('table_name', '', 'POST'))); + redirect_header('tables.php?op=new', 3, sprintf(_AM_MODULEBUILDER_ERROR_TABLE_NAME_EXIST, \Xmf\Request::getString('table_name', '', 'POST'))); } } $tablesObj = $tables->create(); @@ -198,9 +198,9 @@ if (!$helper->getHandler('Fieldelements')->insert($fieldelementObj)) { $GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element'); } - redirect_header('fields.php?op=new' . $tableAction, 5, sprintf(_AM_TDMCREATE_TABLE_FORM_CREATED_OK, \Xmf\Request::getString('table_name', '', 'POST'))); + redirect_header('fields.php?op=new' . $tableAction, 5, sprintf(_AM_MODULEBUILDER_TABLE_FORM_CREATED_OK, \Xmf\Request::getString('table_name', '', 'POST'))); } else { - redirect_header('tables.php', 5, sprintf(_AM_TDMCREATE_TABLE_FORM_UPDATED_OK, \Xmf\Request::getString('table_name', '', 'POST'))); + redirect_header('tables.php', 5, sprintf(_AM_MODULEBUILDER_TABLE_FORM_UPDATED_OK, \Xmf\Request::getString('table_name', '', 'POST'))); } } @@ -210,8 +210,8 @@ break; case 'edit': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADD_TABLE, 'tables.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_TABLES_LIST, 'tables.php?op=list', 'list'); + $adminObject->addItemButton(_AM_MODULEBUILDER_ADD_TABLE, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(_AM_MODULEBUILDER_TABLES_LIST, 'tables.php?op=list', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $tablesObj = $helper->getHandler('Tables')->get($tableId); @@ -233,7 +233,7 @@ ++$i; } } - redirect_header('tables.php', 5, _AM_TDMCREATE_TABLE_ORDER_ERROR); + redirect_header('tables.php', 5, _AM_MODULEBUILDER_TABLE_ORDER_ERROR); unset($i); } exit; @@ -254,12 +254,12 @@ } unset($fieldElementsObj); } - redirect_header('tables.php', 3, _AM_TDMCREATE_FORMDELOK); + redirect_header('tables.php', 3, _AM_MODULEBUILDER_FORMDELOK); } else { $GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors()); } } else { - xoops_confirm(['ok' => 1, 'table_id' => $tableId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_TDMCREATE_FORMSUREDEL, $tablesObj->getVar('table_name'))); + xoops_confirm(['ok' => 1, 'table_id' => $tableId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $tablesObj->getVar('table_name'))); } break; case 'display': @@ -274,7 +274,7 @@ } } if ($helper->getHandler('Modules')->insert($modulesObj)) { - redirect_header('modules.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); + redirect_header('modules.php', 3, _AM_MODULEBUILDER_TOGGLE_SUCCESS); } $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } @@ -289,7 +289,7 @@ } } if ($helper->getHandler('Tables')->insert($tablesObj)) { - redirect_header('tables.php', 3, _AM_TDMCREATE_TOGGLE_SUCCESS); + redirect_header('tables.php', 3, _AM_MODULEBUILDER_TOGGLE_SUCCESS); } $GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors()); } diff --git a/assets/css/admin/style.css b/assets/css/admin/style.css index 7cf26a06..fe1a3284 100644 --- a/assets/css/admin/style.css +++ b/assets/css/admin/style.css @@ -9,11 +9,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** - * tdmcreate module + * modulebuilder module * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) - * @package tdmcreate + * @package modulebuilder * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org */ diff --git a/assets/css/style.css b/assets/css/style.css index 3f5edd32..9be18948 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -8,11 +8,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** - * tdmcreate module + * modulebuilder module * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) - * @package tdmcreate + * @package modulebuilder * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org */ diff --git a/assets/images/logoModule.png b/assets/images/logoModule.png index df7d38c9e055b16f1ef1ef7d0ad0846c25764200..c294fabc5f1086b0701133e0f3a70c5fdce02e2b 100644 GIT binary patch literal 8351 zcmb7qbyQSuyEYvHA}I_hjl?hm3=GoUozgMDPy@rzEg(ut2m;b24bmMV2uL?bNH>Ud z`QiJ%zjMwXXPvdaz1H4Otoyp|>$zk9vDbd9sjfiu2=E9E4UI@iQC9n5Gt`BH5G*Jm}S4(S07>dyfW(Ri>V>)W-U}A*Zh%p%ms`070%E0X5ioQsg zj<33|wXdT!)P_kyoKe(Uz!VebV<752K#q{6} zX=5v*Ei3;YUk@uWCVLdhRRjq1^77*K;^##m?SLRC6#AC~4CZ;T;BohHL0Nk9xVSU_ z!ypTDw?@KUQE-F{<6lNgD})D1jOjt?zmMSTs;2f|#4hgt3DiT#fZmp_KoBn<(AoL# zx&CGCj?#wxw~YVQ+FjSj6$aFXxg$J~)(`oxW&Q{J5WD}|(O<&{H6j{F_(M`Gon#T# z9?mcql#;9%lZOY~MnsrjN7RPG@P^1_00{}B97-~%PE z%>x!HD+re5mx4mUU?~ttPD)ykPf!XB77~;P%Yo$N!T(^DT-;HXF4nNWPXA)z|BV&? zKd~Y*NSGxGfz(AHoc>9_rac0MaJNUeGRo)(G8({LY!F`Ve>3y%gUZ5?a8HsI-8r6d%)nur~kS;Q~G=0sbwD z|4}6WY&}%o-|2sq{KMkEng-_b&?(4=mKdGXH$p?Bol%mN()FI-_rt9+HSjrX805Uj zbRTgZe_!UpGN_1j>W5gY&3^VK?G0-TM|&1Kh?UUqhrY&=m`d(+oX(=Ei1vG&EZT`Q zL2?xXUhhUi)n}@0WsGCASkjPb=IOWGF+G2??}uVlByx-O4!S(}5fNx=5pR#bl2Z3) zy=luV(*&3uu+eQEI#jgRya|7{hLIW_Yvgm{#p^h3Lg!pc!>mtt$@pz^XNTkHL=C;% zOnUZ%X|j9Ke4T1Dg+h;l(_tVS1 zu?o4+1?#hRmC{4qMbe3Xd&$ZfqfAt-lmZ z+Jfsbgwm%Nw~$F`t@n#56CD%TFEA)kGN5nekkRdW%RtRLv*qIS5H}ve3_cBaud1npHNX_$Zzx?(?1@ zwu5^tg!lshmq~_X)KKFCqW$i1negQxZ3;)NA z%t^c5=s~%+@`}v`f(xyso~$QvvYcmLTldee+ncVKE2tFH#9pm3ZfSp3BE!U4ky1W+ z!s`1b31pM+H7Xh<7JL){dzu+|!l_&0!ENHfrf(JqeH8xcnyrTHQKvINjMm9i@w_^4sCv7~*hNo=y-Bj+Q|66z4Ru<&5hIrAeGz{g z4s`h{amZ^i6n@lIfUw3s`*L|*^an4!qJuK8RKM$KKl`>6bC`mg!8je}Za!hjmWqX6$LPehONQ5)dO4oxf&o(}#Xl7Q6rVj?8qAWDFY*CtGpD*g6fjFm+<4LR5b z)v=H*=XJ{4doNR503BPtxj&HuG(AIp^^ZJZ+BAKBH`_oQbi43}#xG6?)NISI@8rvn z%tO`L+Wxrr!ntob=t_##yaqos1LyjV(36&26LT_@@VQLN>g8|-hZ&0Gv$R+;j+U^P z0A^C`M$P=18__!#RhnTZe1lsTFHX5yX8N{jj~Z{W_-R*&Vp{@YZt(<^!kmdJ;u_Mb zlZaN1)7V>WdU0~dS*u1z^U#cV9t33HH;ennp+xH5FG@GB_rw~$4~ojCXM zX`r$TL$9I`K|dE)U$Dxsc?@orNc2e;oYu^r>X~U)LW-7{z0Q2mZ*1Mz0|VV8sRpuG zpQoKK>DeQyWh;!qBU9N6@?=zwO65Y;P6tVLCN9KR1LUrB3tY;i!H znqLv&HEmQ8BKL(?pZ9yVlC$MV#UpY# zrzS(ScA36EiMhZv+ujmhlf2HS>#9|$;C*I@Imqe!`{ZuGkF3m8N^H-*qe)Vkvzm2Y zMf7qj=+#;QfkkB?ZmT|-xYqGo$(R~ZqnXf(s@0m5ik>{&^IXsSuXyIOm|m@~z8|CA zrs5>;->~T~`g56Co5f?*&7Vg1SxtK8udFQ6C}Vj5h@C4}Zz-VIW@RK8t5<_a?~&$v z*^~BbCkkSc{XJfe)kt@ON26uw&dX2v~x zUvwFhUKz4D6IcJqbV3#|6-dPMUISztwtblh~qwA6bSck%P$BL=6 z26ffPj0v_0eFI*ql*BbVJr{#abo6*3dtVQGTs9}|1Sg72b4)jrk#JRQP9 z{CX4B=OyTh>Shj=YrNTc9=MZ0x>@ZGT3KkH&Ei)Rl1HHls**_<&@sSDa3FfU4VpVF9cClT#6R z!4hdG8z|p~wCQU~_R%`59l?)SH{X#R-z| za8vTQ9UPfHE?Tazm`FbnP7(bmL{P?k(`eUi5NayE&4R`*KYJ^lxGb-T4LdKNCM=E@ z2VmW)B0W2DN}C4C>2wAKXbVU@i9YzwEiH19z9Uw@QC>@_65kn2uDheM@ms!kAv0&4 zs%`2VoP8NA*IZLS#)fWUgaEP`nOYW2Nq16cR-y2Q0?6$5Q)RQet=vOC*F=~7Eh&I_nfP7Wp9JQJ}RT$!8S zfhv##$~+|Ba~ZlF*lmAkzeH#20kHX8f_RW_S~bBd*~bH#<2= zEA+eB0-D{m-q;wzUF9UlZ0Lv?7 z=lalflQTCII>-DrWgRE!iK!6ZT2Ekmc>OPe3D_!fpaBwCXKlh*$EVVicyc4met>^+ z!;kyYuv2^yWrVK6$;eaFP0JSHkNS<*E;r!!&TNDkIAgyiGF$7U88d}nH-?&$3ZdfH zwl1o;I*+cI$v(PAFr{T}py7~IU&L7R+aHO@8;t0!Jo+~0BX^>kJe^L~`GNIP-vc;o z769obTHz;4a&4a+kmfv1*{PK`!Sc4G6dw%p5gQ9shqN-?vicb3n@Ii%7$2~!pw$ZW z%9gC%Rx?tz;zDhmtlKQ3QB$d(Maxfe7GUUx_<;4wi4unx4^kbJ6F*ZEc~8uMc@ho_ zPWolH3`byy!!HZ^=UiFFo}zoOw(uvFhT&$sFX!Wg-Xkwdx9nV93q!XuM5f1_>;2nQ z;9Q-?&a44yfNlV*+t2GW;feCxjwalU4Qo6~B1RKPw1pdfNNV64+wLXmOp(Im zJOb$a<(lWH2Os^Tm09MSu0pZwj!8>nvl==2BaUK9U$_wJ_Jp4Tut-?3q}kK5gL5eI z({gV(?F7m463g#oslLBp6oo-TD$dQ0L_n z`{z3JItmkCbCB7=FCv!Y7pQJVxi9){?1gw@#-iyH(Rg(^HI$yxunIqRmAlB)3r#!X zItcqrv4T9Esu0o(DM1tHw=-u5+<#3|wVn#>8ooYG8J2Oy=`z!OB@uVe7i0Hr%5s*i zyjIKsFGlhGh{8SLk@pSuw=xqY3M{tR>UPe>F8Km=*Bvv+_TFdJqJE{q>i3V86|#OT zWD{&#|2{#VisPE0q-Zps)9T}2N4ecO(w<@u*0KLO9wgeh`V?|vo#%j4xofrf+3;un z+cDni%$n^-k)@YJ*YkAdEk&eXgG=Aq1u^7}?X6*%euJbjb$vErpGSUR^!#LNMfkbr zk(l64P+sm0(^|aY8``!Mgwedd$0>UFfe-zB9nLO4&!q4uHL~l{P2}L{%FW57hKh^6 ziA*0NYe&r*0D@+8MkMW4^|K-dC)(>y_jk$-$NjMl?knR~IdBC6$v=qa?BtudROuwS zpr>c6K+QW54nraW2S4BD3EswqvkGQE8mzVDHVHTnPT1`5&W(KAuNd$mD3F1Y+|-wg zzI}Mgmc39K^S&$3L=7qRIZ*4dqr!;;dUv7Q6jV-7%e)|~WA9y&6kojx;br}iz^_N_ z=a^e#k3F2Qv(ZYE4?^q%lY-~L8gKiGFht$5E9{MSNgR?Jy*}r$Iq0=(XxU1Be%hHa z^fWqPRqjS)IBXwqF6BvZ- zcoh&7Uia1dvPt8P-XYIgxVvDZ`b&~4hB&_*L;K4-*#_ZnkC|S6P~`D;g0&SD*DgDx zRCf+pIoD_F{t$9wS<6*b^Yv&B#ms-V(L}2^-fi>+N?YOMeQ!?y%-YUY9g`Tq9w)fH zTge1W$85SC40PG#Y>-T9UE5n@Qv2KGhW4EcxPIX31RK1&DH0X^Ton5>w)R)MAZuAx zih;r_ZI?p8YSvXb*-LNt9AeKww(@Oe8Q40kCbE9jT>ZNRqA8Seaf2G;W>uF!BX;I^ z^FFZ5JxUqV_zXfBg9tw>Ce9+ebH1|R#_)MFi`h1jfkvH zFwOZVv?Uolr}Kr0%kPVVL-IVa)zV-{f5`Ai;liOAp zSC#7`blXN{Rs&976!MYJ%^^XO&pec;ey1p^yo$-Z$s)OIr%6ASqfKsHhnF2B9X`nt zF>9nQ8M@Ns5cfknRL_N>zya(L3suzEqV4@QO_nW+K0aJKvDp6Jj?Gd1{d!gUSvjox zB?c{Gp`_gC=g-SgCUH(HyOGrdF2+jl^)h|Uutm|x!ZsGDWx{8p;az2}h?O7E` zHigfVsu}lpsjr4jApC&mAE`G8#+6CrBa;0d&X+{bm3DPEKMR*gf z(T{QegFxMDJQ0rv}hBIO{-P=lUmTE?f}1>b%YXVm;{1^FT8T)XS7ONZX94#>%I znqanXFe-phT~B5tt?tz`DYVknZ;Zd$4ZuTI|_k4#(G#E2Bp-W{#WdyUuWjPYYdb)ZHq`^9>lq>CA6 zQA%);i(5F>bdkU}tqcT>g`BjryI%Ls(y4L<^gG5Ps1FwZ)^fLScAv(|vT!KS{pV(E z?ntiP#`_&RV5rP+G)El?x_c9{goJx$B+vOQ?+LBk`;mLsS7`34U3_Vlp|?L+jvrH7 zMt?My7c(h?gkE#UW{@SWAuB1!R}=!)Z@=VIq~O#PV*?A5G&8&bXO!<0(Z%JAYztEJ zEK8p_0np#5#JLQ2wYNZTju+6966_Q9jm`h6|;1s2Ig-mxnEpY!6j_I3mG*y8}Ll#ef$ zs0Q^k$tqu0#Eh1#ap%2{77fO}M?>HT;z7COBK&JnzY*r!4dRP6~())r@(4 zZD#C6rr1irT3#=X!T+O75-e%VmY1=5a2aN>*s5&4zau7->A?U_MnZ>RSx9Vwyk>xm zX{~(y)avz6IVVZ%o0S1I?xCM%7u*6)CBN_{15zm;rHT}$VJ(;Byi4!Y^?OtM!$RCy z$KN9>;arQb0*@tptf+1Dg^V=w=yT5CHz0yfzK^G-^8|W!ooPJcG#sq+SUV$fmPnO( z9RU0lY&h|5Iad9Isual>AXVr70=Iqa=~(u!X?Oc-HQ)1llU6~~Q+`9W@LINA`m;W3 z%{xIzj$ac;S{>b-O)6Z)bDO3_HO2)=?iNE*|NX98F@*k73K>6DG#%k$k0zuqKBx4% zZdZP@P_1m>7oCJ4NNks|=VCWEOxmhi{V+;1bP`zFazxGMMbq5>0h>h~-=Pw9q1=QJ z1^m2OPe%Bz<{h5BQS5}YXlm{1YbCX_itL>a?yq|%V7PM$6V~Q)0r`&WaEyGjGD z*_j(Hzrwdbi%eH8ZIfaS*l3KBdZ``b&(f(-e8a5IB=+mFB}G$PM&)^wMaHJDYxlt; z*9@Wj5yV^w`oiuKmq64bCM%29uF@~uW_rDyo#Qv+Lr#9RGo18(Fu6lc;;c6AVD_$ae3lIULw!RM|rmj zvdks?7;T>~N%1ja1v;T~0S9-}Fhxi8s+RF3Y;l|yIVFlL{u^h)t|K>7R;*@e@a=_{`9@;{as6X z->(r!+VBHO@Om90{-wNODRLz6yr%!6rNQOv9kFQk5^%YZq``mRn!TXXuo`2=BtQ^i z7U-kB6}d6!wx%Y;>T|&$9K3+&xXVYlHJ;Bq+TEFT1hx$~A@`ICFkwlX5p5$#4w$zdB#e94!_oNzF89DwuBNLX$1$LBpS>#etjWx0Z$ zJgYERy`q7zSWB38te#3KpF*s>6B?${8A+dKsIyEETJr?|ms_#ur)ZlU6tcyLHXjX&;XL2SflPIz9NKC>g|lCX z^<`kpJm<|Xv1=~Fo;&4~#jbj6e)OBC_gg@JM5o;VOpX9N`a;+bqkZ(XqU(3P7o2BX z)W_C!(2@1juU)s4TMr+7B2QIL6v^K%T#3{O42{}F}m)i1c{kTEh2>a^dH5=|%&*)6;E(J5nE;pyv_fdyp;vRe@Q(q zvQvYneuwQexR-&7_ZD3qFr zm`KiR(IdsT=xdCb_x+XqNT%3s`&wR{c*zo{$8LixGF>_Gwqe=RI6=K!aW~$(87ZKy zLabM~(YC*Ayx5y}F$3 zUHO`~GW{lnm8Qnjgciw-Fd7Y)kWII}${V;;HpFrqtOul#DQom1C_KF;Vq0(%ZXzhV&Im<@f;d%4P;AW^0*p0Ea&#b#q|D8V4s?O&FSyoL8R z1heTvi2KWA9^*g-boz)0hQLeT;og+6nPt362|PQ37|q}y)6V4DKU|$?zw8(o&UGI9 R{{3Y@Nlsn1LfYch{{xx&(BS|8 delta 5544 zcmV;Z6<6w?LA@)GBn<>-K}|sb0I$e51&ZmBAt!$oPf0{URCwC#TWOFT)p`2ylW!9HVkv{*fxc*r_BxLJ^AmaLS>8s#KOgMo=ad zDrH7Eu`2|EAX3aGp#@2UM$(L=(P&1q@5@{I=AQfdcHi#TZ^WViKXgl1-S_tG?R?)o z-}!%Tzp?(TV<8H_y0dk-eER6Wjds1$fr+8h__9lJO+DsEhw}Cd7YiB0F}q;Hvgc9X ze2II6=YFzlT-efgZVbQs!@t}1Ui^_?G2t z;caD&IPD0JJ8iF8{&pm!kL`%pjutp4cMpH>zTUIs?#m)(Cy^N+MtY!ip9_@GV8I3bhq(+tzK{YiEPU?XYwFeZt)ex6S)<+q~ze+mra4?N{FR z{blcsEE%zm9_!xpix;1NcVOV$k)3xuz21AdaKIJF@W8ef0o;mM4yb|Skpc!%$NYa_ z=eD^%q~>5xj7X5r!5SSvjhI7QLp82yYsFQoS0E8DQigcq#SU~ewjw54rQ!pRGsM&Y{b}&Pxgh zaNz*J|Kw%WzV72#^!Fe&x|2EHV84= zkMi^++Nw*@zH%9^x&0Q@R+Ot}&1SQhnwrAgEKpHVf!69W93DA`c#Wi$NYn?6Fo7eW zC;+VO2UeJX+S-G2Z5Y+B< zs<+OuAlQ}*v<5rZhVm|_9q}8+76BtDcb4O3#vvw$6~HC4BWS6J7j&tYEAsUUUno6bQ?1-pitqrw^_ML^Dk#I&Mp4S;uKF@1y6Ij2u`ha%Y2pogs z(Jq(3FoY~GU-lCe@4o$|mU&IQD$al6u^AJSS+TznjjYy6{)tO9a%G(3>s^z zP@X-3sku2si_2UL@;uz3jWC1c0d9vI1Li(FFZUV1=|9ogg_tuZ4Um5=*P~s4T~D{% z=`I|v)N~^pYM>|kX~wyx(?^gq65#k~FXGdKsE^EIeN#2A-MAbZ*L@wyL_DV~=I7Dh z->(2nCX=dfP69|Twk1l5L_z^f&@IdJ61JDr*P*4X2zy5cQQVl6wzhnr20dI9+PD1% zGAYCly3;m57BFUkK`(y_aFMay2NsSJfWhCEfZj7ToJdixIG41#mV z_v80kBY5EcZ=k8J+U4P~u`vvsol>9{7Z+n;VL^e+eHH>;Qc{BH>1hQx`)L>&B_5Bf zu>`-SrUq-4)Z)G4{Ycj|%X>$C9xg%yUtr(PR~|v5n8DZtTsVJ#i$Z|I06d492%#3E zUjvIAke2D;u1DvngsQ{ccRZXbXL&=F0{h63Bg%s-D=QU{8cYI5a0w`1hCI!pd76Fc zbXpmTfRkEy9ZfCEo9dA`co=p%tN2S41S~MeJb1EfbdE&&bSc+YT4&&}yZdB@mpp}=GD~~2<1eIWxm6a**XJ=>K zeU2w*(*S%aj;D8P9@mCh+E|aeXd1nfa(roJ9;Flp-Vd%Fk$8Dt;LP6-^f{8zR3;)+nFKuE7c7M@Xc`=z z4NywHGI0%I1(G7&*51qgh(DmJWX9ld%Zgznn?%>iUfj^WUI9+eEiEm@bi!s}lWkoDG~AS{~{dP*qihb(c2cwcpCXTen=^JE~sV12LZ_!n{A+;{)Jh zaas|E2y`jMMb^OEOnP9X)c$0}GIYAvuW7{dZf_PSbrF~Rec}vmzV=E5k`9Orc=TxQ z6HHAdJWg-d0P`C3ZpuYg8ir$8d7Pz1>h|)?aZG=uGBVxG_f!*9Q27q$Z82EMws2=F1D|__f zqmX|<;0*Ebd@uL$wIKn$w&f;3F5ob{Iue`}&aq@IdQL8&yZ0T1&kjv^ zLZ}46{V>2q+AavVM=O>WNDU6R4gKw&8=!v=D{Ra3JX3;WJ!i0H`7*`bI)fY>98?CV zm4MOvxg8oBQXtd&3Hr#$h#E^H5NH~R`#NdTNz#p%x1yqV9Fz)UB4GJf z4B^p;g%C;!7$o8@ayc_XsTq0I;(C7^?B0vX=~>rP2{?fxUsJtkURHn&537E1H-YEA zRwo3Q2H{L#KZB=;q%oE~jfLq-)FqoySyGOocoes9T!q$}1fG6*7xoUaQxoo4_?UH!D5O zQe9o`u9=WRXbe&csfXT9@6M#ssH<(1z{)XJ5mK2s%%;XLy)c1jM5>>nN_38VfSJ@d zeh1&d@`fw$y*t{m{~vZDo2XZ7=Lpf*2$g{OG-GwPyv;=<=ODdKlj#8u-(%5wMI$V3{|6=#KZp12= z8w?>rRsw}@HPGa3PY!}{62U61Rl7iL^QeGa%O?6&)onkO;l8eBRwZE zG&+uwL`(%o(hKQ=05b@ZKG;W|r!fe=HU^EvbBYtiGT7GO^vqtIp57xbosbF75R%af zw3N3?ub#k>vG=4ToWc6a>(N{)rKr4CqCAGXHgCWO+do7)-Y9<)q(oumVJsh*0K@Ql zz`s1}d2QJ8tQE-VL%iHuXR-2SqdCS%iY#O8+%gQ6+fSf>3^?A?hqWu3@bSkVqpht? z1wDdI8AyN$?6PIc(9_eSK&RJJJ`(iYhlsdZGDxN7FrFI5tn}=t701<;n{i#;-ALI| zn`dTmdg^`jP8@$gZ*d!n(ICA)Dd|T(|H3q~((x=iYj|YXI*GYnVy=OUK!WK9yl|#z zkawYMGsxpQL(TVS?>yaS%1XUIlPW=H*J*6r(58STUC^U>jKPvhMW^fJZ30|ZSEtlW zPCD8$crrNKSYG-yl*gKIVD#T{Ztkc8acU-|-e!J&L}q`Thp?-!8w1nt}mwp1V4ystJsIfxKi2_!ipuz(^K%`|<{GU(<056gL=Yf6FTUP=VOb=PJL z17;#M`0&t4eE-3m`p`)W*GH&Q2sX1(22E;mUWe+0d`_C-n2Cuo%+61up`;m&u{DTg zeuJJ-Ng;nTbC{|gmeMqWBO|X$S(ZUjEQ+4_-B^}tmz;hxn(8WKpp9T5osu3N^@A4z ze4fS*$tV%Ba1{#pqF$Z{x)u5f&II4&_@G92lc8uOx=weauYX9XliuE5MJWWI86>@& zZ5GlBfu~XQ2MBICD@Mjfm(q=-mhdT=>?*7x!}4t3LtgFw{&i zxEdlxJ;v}<1V@jZlB!{i;$})eQU-z6iH%-2F@dH+p@-)_G7q6FQH$P%4=|WHf!4Cs zXexhMCzGE(oSxl_@}g>NsQNbAtG}xNT(D;lFG}FueLa}9>rs@o6g@3Q5n*790$>Nd zy8xvatA@UIxMDG9M1Eim7$C^y?pPu9auWMLI*!}6Y{Z&1YgDl0v?b8`YdrU8i$WNav^Rf{|mDJe0l zt7Nh?gx!12Ad=Xa%SVEN(FbN&Fbs^%qn1#>?GTT)LW~d|K!c#0THf#3`u^rD(5s8p z*nhZBQbq1F8`TFro7BuxQ4F2b;`Fs)8CDzB~92^^8QLbT)x2$`jFrO>0!&_KI!{nZH*D+U1fDXH-$$or=JBi7-ow>bj^KaNWzACE zEJayK8Kx#@q+^v}A)CSn`w!vej^AR>VM#~DD-n^YzxqLf)a^`s)Hg!khnpZTe{#=u zz1tTwvmz95;jR;gQHuxxUEkF7b`bzx7#Lgb!|>dNbeZJw9^8LV?wIZT{EncKyIFP0 zPswQh2#9i#GhpA5NxXBU25)~K7(+{a589TOqrRqCW}-1AFOMGY$Kj*H7@R1PyxoLI zdO^NFF)l_VCV|eH9vv0{KLOZ5D#`n5pS279^U)Ox6ksbW&xhxsS_!EEWa&JYWZqHvqTo#eU~r5OjnE(tvgs@Fzn4 z^ZnpkGR;5Tw}7r=GV8o%y`l>3x zbF(TEM@o>-D-lgrNg01wjc8Go1i91$Ppxfd3-WX!iFZD*1;Rc+to$xcz4(CAvHIs^ zUsj<9@7g8#c49zcb(#B%D$)llpN)MClGNT@cR7CiI8L29rGDsHTV9Gk{i7yjjLOPY zXlQ6qOT7Fl#95%f41H0B&zqLn>&(ooYCrYVR>bfXDhz@Qd|iKCU8+s3O@Ju@`SpkT zyR)+s-QC>^V7?G}o3fCBl`@g(J_9Sk*1t*oG95@4X2Kq&d_@ZBV#$&v*t>VH0+h4v zz<~oedGaI%1_qR8Q=!mXSFT*C*2Sq#Xc+2o9{Z{m{h2TpoC05V(Ld~b>7|zxhtq=z z>Z(<%6wvf$0!x2B*FR(asumN^3+CaJY6tf3&+Bh#ZB@r6WM$dV-tK-bW1-iwt^3UO zrcImFGAzA<;FEjz?c0app&^$x_RD+fYx7>Mt*!2LPRVMP&0Dtk?yJYLy#3Z&dCy+y zJjY_!`K%s}#~*)ONS+juBR^B!(a|A{KYnoQUqA7L*s_0Ri`%ZQsuIsW^Nf4mwr$(g z7~S5wb*t~Vu9CNX*SV^_UGri zUfr=nZG(U1x#yl!p7x>ia9-z?jt=*jzBac{KKW$mGwJ8j_vFlY>+QGQK0Su#=<9Vj z_b7CoPfI8HKa=taBI>84fNcz z&#LOX)(bD-p>5mLHN%V>EQPM~X%$NTYT*S8oVI`Sao1bC_uAxRw#mmV_uO+2Bqia% z!GpMG>()>{B`_wKL1VDe2&U)r9Bn*3)AaZ^ckWdCl2-7DG^Cltn9s_6bsguK9)9GJ zPmKjN_?PD4D!59CM{wxX40M|}Z&tKI58w9CL+*NsSqS#YK=3jt<#`Dl&oMop0h+YX zVHkfwQx<8BhShYoSlO^)1Ah6+E2@5$!VlYDIN)m9OK-n67&#vo* z@bLe49sZ)^O;*weJ%ygg7u7P6{q!W>n_GX<%}qDo?4Hl5Jmz?&rXjA4n-uWy!w=*B z`|g8OIcf}J!@c+3>t5sdi4)4h|NG51)jjkWdbw_g6+S1gtIM#Is-L##wBAkbC<{3? zxd?QzT)1Mcq3EQCiYvx1setExtra('enctype="multipart/form-data"'); $moduleObj = $helper->getHandler('modules')->getObjects(null); - $mod_select = new \XoopsFormSelect(_AM_TDMCREATE_CONST_MODULES, 'mod_id', 'mod_id'); - $mod_select->addOption('', _AM_TDMCREATE_BUILD_MODSELOPT); + $mod_select = new \XoopsFormSelect(_AM_MODULEBUILDER_CONST_MODULES, 'mod_id', 'mod_id'); + $mod_select->addOption('', _AM_MODULEBUILDER_BUILD_MODSELOPT); foreach ($moduleObj as $mod) { $mod_select->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); } $form->addElement($mod_select, true); - $form->addElement(new \XoopsFormRadioYN(_AM_TDMCREATE_MODULE_INROOT_COPY, 'inroot_copy', $helper->getConfig('inroot_copy'))); + $form->addElement(new \XoopsFormRadioYN(_AM_MODULEBUILDER_MODULE_INROOT_COPY, 'inroot_copy', $helper->getConfig('inroot_copy'))); $form->addElement(new \XoopsFormHidden('op', 'build')); $form->addElement(new \XoopsFormButton(_REQUIRED . ' *', 'submit', _SUBMIT, 'submit')); diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 29b08f7a..c1758d89 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -1,6 +1,6 @@ - * @package Tdmcreate + * @package Modulebuilder * * Example: * $breadcrumb = new Common\Breadcrumb(); @@ -28,8 +28,8 @@ * echo $breadcrumb->render(); */ -use XoopsModules\Tdmcreate; -use XoopsModules\Tdmcreate\Common; +use XoopsModules\Modulebuilder; +use XoopsModules\Modulebuilder\Common; defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 2f06d4b5..46a36d7d 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,6 +1,6 @@ isNew(); - $title = $isNew ? sprintf(_AM_TDMCREATE_FIELDS_NEW) : sprintf(_AM_TDMCREATE_FIELDS_EDIT); + $title = $isNew ? sprintf(_AM_MODULEBUILDER_FIELDS_NEW) : sprintf(_AM_MODULEBUILDER_FIELDS_EDIT); - $form = new Tdmcreate\Form\ThemeForm(null, 'form', $action, 'post', true); + $form = new Modulebuilder\Form\ThemeForm(null, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); // New Object HtmlTable - $form->addElement(new Tdmcreate\Html\FormLabel(str_replace('%s', $prefix, _AM_TDMCREATE_FIELD_RECOMMENDED))); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel(str_replace('%s', $prefix, _AM_MODULEBUILDER_FIELD_RECOMMENDED))); + $form->addElement(new Modulebuilder\Html\FormLabel('
    ' . $title . '
    ' . _AM_TDMCREATE_FIELD_ID . '' . _AM_TDMCREATE_FIELD_NAME . '' . _AM_TDMCREATE_FIELD_ELEMENT . '' . _AM_TDMCREATE_FIELD_TYPE . '' . _AM_TDMCREATE_FIELD_VALUE . '')); - $form->addElement(new Tdmcreate\Html\FormLabel('' . _AM_TDMCREATE_FIELD_ATTRIBUTE . '')); - $form->addElement(new Tdmcreate\Html\FormLabel('' . _AM_TDMCREATE_FIELD_NULL . '')); - $form->addElement(new Tdmcreate\Html\FormLabel('' . _AM_TDMCREATE_FIELD_DEFAULT . '')); - $form->addElement(new Tdmcreate\Html\FormLabel('' . _AM_TDMCREATE_FIELD_KEY . '')); - $form->addElement(new Tdmcreate\Html\FormLabel('' . _AM_TDMCREATE_FIELD_PARAMETERS . '')); - $form->addElement(new Tdmcreate\Html\FormLabel('
    ')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); return $form; } @@ -146,7 +146,7 @@ private function getHeaderForm($prefix, $action = false) */ public function getFormNew($fieldMid = null, $fieldTid = null, $fieldNumb = null, $fieldName = null, $action = false) { - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); // Get handler tables $tableObj = $helper->getHandler('Tables'); // Header function class @@ -179,7 +179,7 @@ public function getFormNew($fieldMid = null, $fieldTid = null, $fieldNumb = null */ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $tableAutoincrement) { - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); $fieldElements = $helper->getHandler('Fieldelements')->getAll(); foreach ($fieldElements as $fe) { $form->addElement(new \XoopsFormHidden('fe_defaulttype[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_deftype'))); @@ -189,125 +189,125 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $form->addElement(new \XoopsFormHidden('field_mid', $fieldMid)); $form->addElement(new \XoopsFormHidden('field_tid', $fieldTid)); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Index ID - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Name $thisFieldName = (!empty($fName) ? ((1 == $i) ? $fName . '_id' : $fName . '_') : ''); - $fieldName = new \XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name[' . $i . ']', 15, 255, $thisFieldName); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $fieldName = new \XoopsFormText(_AM_MODULEBUILDER_FIELD_NAME, 'field_name[' . $i . ']', 15, 255, $thisFieldName); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Element if ((1 == $i) && (1 == $tableAutoincrement)) { - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); } else { // Field Elements $crElement = new \CriteriaCompo(); $crElement->add(new \Criteria('fieldelement_tid', 0)); $crTable = new \CriteriaCompo(); $crTable->add(new \Criteria('fieldelement_mid', $fieldMid)); - $fieldElementsSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element[' . $i . ']'); + $fieldElementsSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_ELEMENT_NAME, 'field_element[' . $i . ']'); $fieldElementsSelect->addOptionArray($helper->getHandler('Fieldelements')->getFieldElementsList($crElement)); $fieldElementsSelect->addOptionArray($helper->getHandler('Fieldelements')->getList($crTable)); $fieldElementsSelect->setExtra(" onchange='presetField(". $i . ")' "); unset($crElement, $crTable); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); unset($fieldElementsSelect); } // Field Type $value = (1 == $i) && (1 == $tableAutoincrement) ? '2' : ''; - $fieldTypeSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type[' . $i . ']', $value); + $fieldTypeSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_TYPE, 'field_type[' . $i . ']', $value); $fieldTypeSelect->addOptionArray($helper->getHandler('Fieldtype')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Value $value = (1 == $i) && (1 == $tableAutoincrement) ? '8' : ''; - $fieldValue = new \XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value[' . $i . ']', 10, 200, $value); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $fieldValue = new \XoopsFormText(_AM_MODULEBUILDER_FIELD_VALUE, 'field_value[' . $i . ']', 10, 200, $value); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Attributes $value = (1 == $i) && (1 == $tableAutoincrement) ? '3' : ''; - $fieldAttributesSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute[' . $i . ']', $value); + $fieldAttributesSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_TYPE, 'field_attribute[' . $i . ']', $value); $fieldAttributesSelect->addOptionArray($helper->getHandler('Fieldattributes')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Null $value = (1 == $i) && (1 == $tableAutoincrement) ? '2' : '2'; - $fieldNullSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null[' . $i . ']', $value); + $fieldNullSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_NULL, 'field_null[' . $i . ']', $value); $fieldNullSelect->addOptionArray($helper->getHandler('Fieldnull')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Default - $fieldDefault = new \XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default[' . $i . ']', 15, 25); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $fieldDefault = new \XoopsFormText(_AM_MODULEBUILDER_FIELD_DEFAULT, 'field_default[' . $i . ']', 15, 25); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Key $value = (1 == $i) && (1 == $tableAutoincrement) ? '2' : ''; - $fieldKeySelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key[' . $i . ']', $value); + $fieldKeySelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_KEY, 'field_key[' . $i . ']', $value); $fieldKeySelect->addOptionArray($helper->getHandler('Fieldkey')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Void if ((1 == $i) && (1 == $tableAutoincrement)) { - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); } else { // Box header row $parametersTray = new \XoopsFormElementTray('', '
    '); $field_parent = 0; $checkFieldParent = new \XoopsFormCheckBox(' ', 'field_parent[' . $i . ']', $field_parent); - $checkFieldParent->addOption(1, _AM_TDMCREATE_FIELD_PARENT); + $checkFieldParent->addOption(1, _AM_MODULEBUILDER_FIELD_PARENT); $parametersTray->addElement($checkFieldParent); $field_admin = 0; $checkFieldAdmin = new \XoopsFormCheckBox(' ', 'field_admin[' . $i . ']', $field_admin); - $checkFieldAdmin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); + $checkFieldAdmin->addOption(1, _AM_MODULEBUILDER_FIELD_ADMIN); $parametersTray->addElement($checkFieldAdmin); $field_inlist = 0; $checkFieldInList = new \XoopsFormCheckBox(' ', 'field_inlist[' . $i . ']', $field_inlist); - $checkFieldInList->addOption(1, _AM_TDMCREATE_FIELD_INLIST); + $checkFieldInList->addOption(1, _AM_MODULEBUILDER_FIELD_INLIST); $parametersTray->addElement($checkFieldInList); $field_inform = 0; $checkFieldInForm = new \XoopsFormCheckBox(' ', 'field_inform[' . $i . ']', $field_inform); - $checkFieldInForm->addOption(1, _AM_TDMCREATE_FIELD_INFORM); + $checkFieldInForm->addOption(1, _AM_MODULEBUILDER_FIELD_INFORM); $parametersTray->addElement($checkFieldInForm); $field_user = 0; $checkFieldUser = new \XoopsFormCheckBox(' ', 'field_user[' . $i . ']', $field_user); - $checkFieldUser->addOption(1, _AM_TDMCREATE_FIELD_USER); + $checkFieldUser->addOption(1, _AM_MODULEBUILDER_FIELD_USER); $parametersTray->addElement($checkFieldUser); $field_thead = 0; $checkFieldThead = new \XoopsFormCheckBox(' ', 'field_thead[' . $i . ']', $field_thead); - $checkFieldThead->addOption(1, _AM_TDMCREATE_FIELD_THEAD); + $checkFieldThead->addOption(1, _AM_MODULEBUILDER_FIELD_THEAD); $parametersTray->addElement($checkFieldThead); $field_tbody = 0; $checkFieldTbody = new \XoopsFormCheckBox(' ', 'field_tbody[' . $i . ']', $field_tbody); - $checkFieldTbody->addOption(1, _AM_TDMCREATE_FIELD_TBODY); + $checkFieldTbody->addOption(1, _AM_MODULEBUILDER_FIELD_TBODY); $parametersTray->addElement($checkFieldTbody); $field_tfoot = 0; $checkFieldTfoot = new \XoopsFormCheckBox(' ', 'field_tfoot[' . $i . ']', $field_tfoot); - $checkFieldTfoot->addOption(1, _AM_TDMCREATE_FIELD_TFOOT); + $checkFieldTfoot->addOption(1, _AM_MODULEBUILDER_FIELD_TFOOT); $parametersTray->addElement($checkFieldTfoot); $field_block = 0; $checkFieldBlock = new \XoopsFormCheckBox('', 'field_block[' . $i . ']', $field_block); - $checkFieldBlock->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); + $checkFieldBlock->addOption(1, _AM_MODULEBUILDER_FIELD_BLOCK); $parametersTray->addElement($checkFieldBlock); $field_search = 0; $check_field_search = new \XoopsFormCheckBox(' ', 'field_search[' . $i . ']', $field_search); - $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); + $check_field_search->addOption(1, _AM_MODULEBUILDER_FIELD_SEARCH); $parametersTray->addElement($check_field_search); $field_required = 0; $checkFieldRequired = new \XoopsFormCheckBox(' ', 'field_required[' . $i . ']', $field_required); - $checkFieldRequired->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); + $checkFieldRequired->addOption(1, _AM_MODULEBUILDER_FIELD_REQUIRED); $parametersTray->addElement($checkFieldRequired); $fieldMain = (1 == $tableAutoincrement) ? 2 : 1; - $checkFieldMain = new Tdmcreate\Form\FormRadio('', 'field_main', $fieldMain); - $checkFieldMain->addOption($i, _AM_TDMCREATE_FIELD_MAIN); + $checkFieldMain = new Modulebuilder\Form\FormRadio('', 'field_main', $fieldMain); + $checkFieldMain->addOption($i, _AM_MODULEBUILDER_FIELD_MAIN); $parametersTray->addElement($checkFieldMain); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); } } @@ -321,7 +321,7 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, */ public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false) { - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); $tablesHandler = $helper->getHandler('Tables'); $tables = $tablesHandler->get($fieldTid); $prefix = $tables->getVar('table_fieldname'); @@ -357,108 +357,108 @@ public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false) // show field with settings $form->addElement(new \XoopsFormHidden('field_id[' . $id . ']', $fieldId)); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Index ID - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Name - $fieldName = new \XoopsFormText(_AM_TDMCREATE_FIELD_NAME, 'field_name[' . $id . ']', 15, 255, $field->getVar('field_name')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $fieldName = new \XoopsFormText(_AM_MODULEBUILDER_FIELD_NAME, 'field_name[' . $id . ']', 15, 255, $field->getVar('field_name')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Element if ((1 == $id) && (1 == $tableAutoincrement)) { - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); } else { // Field Elements $crElement = new \CriteriaCompo(); $crElement->add(new \Criteria('fieldelement_tid', 0)); $crTable = new \CriteriaCompo(); $crTable->add(new \Criteria('fieldelement_mid', $fieldMid)); - $fieldElementsSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element[' . $id . ']', $field->getVar('field_element')); + $fieldElementsSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_ELEMENT_NAME, 'field_element[' . $id . ']', $field->getVar('field_element')); $fieldElementsSelect->addOptionArray($helper->getHandler('Fieldelements')->getFieldElementsList($crElement)); $fieldElementsSelect->addOptionArray($helper->getHandler('Fieldelements')->getList($crTable)); $fieldElementsSelect->setExtra(" onchange='presetField(". $id . ")' "); unset($crElement, $crTable); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); unset($fieldElementsSelect); } // Field Type - $fieldTypeSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_type[' . $id . ']', $field->getVar('field_type')); + $fieldTypeSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_TYPE, 'field_type[' . $id . ']', $field->getVar('field_type')); $fieldTypeSelect->addOptionArray($helper->getHandler('Fieldtype')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Value - $fieldValue = new \XoopsFormText(_AM_TDMCREATE_FIELD_VALUE, 'field_value[' . $id . ']', 10, 200, $field->getVar('field_value')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $fieldValue = new \XoopsFormText(_AM_MODULEBUILDER_FIELD_VALUE, 'field_value[' . $id . ']', 10, 200, $field->getVar('field_value')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Attributes - $fieldAttributesSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_TYPE, 'field_attribute[' . $id . ']', $field->getVar('field_attribute')); + $fieldAttributesSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_TYPE, 'field_attribute[' . $id . ']', $field->getVar('field_attribute')); $fieldAttributesSelect->addOptionArray($helper->getHandler('Fieldattributes')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Null - $fieldNullSelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_NULL, 'field_null[' . $id . ']', $field->getVar('field_null')); + $fieldNullSelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_NULL, 'field_null[' . $id . ']', $field->getVar('field_null')); $fieldNullSelect->addOptionArray($helper->getHandler('Fieldnull')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Default - $fieldDefault = new \XoopsFormText(_AM_TDMCREATE_FIELD_DEFAULT, 'field_default[' . $id . ']', 15, 25, $field->getVar('field_default')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $fieldDefault = new \XoopsFormText(_AM_MODULEBUILDER_FIELD_DEFAULT, 'field_default[' . $id . ']', 15, 25, $field->getVar('field_default')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Key - $fieldKeySelect = new \XoopsFormSelect(_AM_TDMCREATE_FIELD_KEY, 'field_key[' . $id . ']', $field->getVar('field_key')); + $fieldKeySelect = new \XoopsFormSelect(_AM_MODULEBUILDER_FIELD_KEY, 'field_key[' . $id . ']', $field->getVar('field_key')); $fieldKeySelect->addOptionArray($helper->getHandler('Fieldkey')->getList()); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Void if ((1 == $id) && (1 == $tableAutoincrement)) { - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); } else { // Box header row $parametersTray = new \XoopsFormElementTray('', '
    '); $checkFieldParent = new \XoopsFormCheckBox(' ', 'field_parent[' . $id . ']', $field->getVar('field_parent')); - $checkFieldParent->addOption(1, _AM_TDMCREATE_FIELD_PARENT); + $checkFieldParent->addOption(1, _AM_MODULEBUILDER_FIELD_PARENT); $parametersTray->addElement($checkFieldParent); $checkFieldAdmin = new \XoopsFormCheckBox(' ', 'field_admin[' . $id . ']', $field->getVar('field_admin')); - $checkFieldAdmin->addOption(1, _AM_TDMCREATE_FIELD_ADMIN); + $checkFieldAdmin->addOption(1, _AM_MODULEBUILDER_FIELD_ADMIN); $parametersTray->addElement($checkFieldAdmin); $checkFieldInList = new \XoopsFormCheckBox(' ', 'field_inlist[' . $id . ']', $field->getVar('field_inlist')); - $checkFieldInList->addOption(1, _AM_TDMCREATE_FIELD_INLIST); + $checkFieldInList->addOption(1, _AM_MODULEBUILDER_FIELD_INLIST); $parametersTray->addElement($checkFieldInList); $checkFieldInForm = new \XoopsFormCheckBox(' ', 'field_inform[' . $id . ']', $field->getVar('field_inform')); - $checkFieldInForm->addOption(1, _AM_TDMCREATE_FIELD_INFORM); + $checkFieldInForm->addOption(1, _AM_MODULEBUILDER_FIELD_INFORM); $parametersTray->addElement($checkFieldInForm); $checkFieldUser = new \XoopsFormCheckBox(' ', 'field_user[' . $id . ']', $field->getVar('field_user')); - $checkFieldUser->addOption(1, _AM_TDMCREATE_FIELD_USER); + $checkFieldUser->addOption(1, _AM_MODULEBUILDER_FIELD_USER); $parametersTray->addElement($checkFieldUser); $checkFieldThead = new \XoopsFormCheckBox(' ', 'field_thead[' . $id . ']', $field->getVar('field_thead')); - $checkFieldThead->addOption(1, _AM_TDMCREATE_FIELD_THEAD); + $checkFieldThead->addOption(1, _AM_MODULEBUILDER_FIELD_THEAD); $parametersTray->addElement($checkFieldThead); $checkFieldTbody = new \XoopsFormCheckBox(' ', 'field_tbody[' . $id . ']', $field->getVar('field_tbody')); - $checkFieldTbody->addOption(1, _AM_TDMCREATE_FIELD_TBODY); + $checkFieldTbody->addOption(1, _AM_MODULEBUILDER_FIELD_TBODY); $parametersTray->addElement($checkFieldTbody); $checkFieldTfoot = new \XoopsFormCheckBox(' ', 'field_tfoot[' . $id . ']', $field->getVar('field_tfoot')); - $checkFieldTfoot->addOption(1, _AM_TDMCREATE_FIELD_TFOOT); + $checkFieldTfoot->addOption(1, _AM_MODULEBUILDER_FIELD_TFOOT); $parametersTray->addElement($checkFieldTfoot); $checkFieldBlock = new \XoopsFormCheckBox('', 'field_block[' . $id . ']', $field->getVar('field_block')); - $checkFieldBlock->addOption(1, _AM_TDMCREATE_FIELD_BLOCK); + $checkFieldBlock->addOption(1, _AM_MODULEBUILDER_FIELD_BLOCK); $parametersTray->addElement($checkFieldBlock); $check_field_search = new \XoopsFormCheckBox(' ', 'field_search[' . $id . ']', $field->getVar('field_search')); - $check_field_search->addOption(1, _AM_TDMCREATE_FIELD_SEARCH); + $check_field_search->addOption(1, _AM_MODULEBUILDER_FIELD_SEARCH); $parametersTray->addElement($check_field_search); $checkFieldRequired = new \XoopsFormCheckBox(' ', 'field_required[' . $id . ']', $field->getVar('field_required')); - $checkFieldRequired->addOption(1, _AM_TDMCREATE_FIELD_REQUIRED); + $checkFieldRequired->addOption(1, _AM_MODULEBUILDER_FIELD_REQUIRED); $parametersTray->addElement($checkFieldRequired); $fieldMain = (1 == $field->getVar('field_main')) ? $id : 1; - $checkFieldMain = new Tdmcreate\Form\FormRadio('', 'field_main', $fieldMain); - $checkFieldMain->addOption($id, _AM_TDMCREATE_FIELD_MAIN); + $checkFieldMain = new Modulebuilder\Form\FormRadio('', 'field_main', $fieldMain); + $checkFieldMain->addOption($id, _AM_MODULEBUILDER_FIELD_MAIN); $parametersTray->addElement($checkFieldMain); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); } } ++$id; @@ -486,13 +486,13 @@ public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false) private function getFooterForm($form) { // Send Form Data - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); $formHidden = new \XoopsFormHidden('op', 'save'); $formButton = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('')); - $form->addElement(new Tdmcreate\Html\FormLabel('
    ' . $title . '
    ' . _AM_MODULEBUILDER_FIELD_ID . '' . _AM_MODULEBUILDER_FIELD_NAME . '' . _AM_MODULEBUILDER_FIELD_ELEMENT . '' . _AM_MODULEBUILDER_FIELD_TYPE . '' . _AM_MODULEBUILDER_FIELD_VALUE . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . _AM_MODULEBUILDER_FIELD_ATTRIBUTE . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . _AM_MODULEBUILDER_FIELD_NULL . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . _AM_MODULEBUILDER_FIELD_DEFAULT . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . _AM_MODULEBUILDER_FIELD_KEY . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . _AM_MODULEBUILDER_FIELD_PARAMETERS . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('
    ' . $i . '' . $i . '' . $fieldName->render() . '' . $fieldName->render() . '  ' . $fieldElementsSelect->render() . '' . $fieldElementsSelect->render() . '' . $fieldTypeSelect->render() . '' . $fieldTypeSelect->render() . '' . $fieldValue->render() . '' . $fieldValue->render() . '' . $fieldAttributesSelect->render() . '' . $fieldAttributesSelect->render() . '' . $fieldNullSelect->render() . '' . $fieldNullSelect->render() . '' . $fieldDefault->render() . '' . $fieldDefault->render() . '' . $fieldKeySelect->render() . '' . $fieldKeySelect->render() . ' 
     
    ' . _AM_TDMCREATE_FIELD_PARAMETERS_LIST . '
    ' . $parametersTray->render() . '
    ' . _AM_MODULEBUILDER_FIELD_PARAMETERS_LIST . '
    ' . $parametersTray->render() . '
    ' . $id . '' . $id . '' . $fieldName->render() . '' . $fieldName->render() . '  ' . $fieldElementsSelect->render() . '' . $fieldElementsSelect->render() . '' . $fieldTypeSelect->render() . '' . $fieldTypeSelect->render() . '' . $fieldValue->render() . '' . $fieldValue->render() . '' . $fieldAttributesSelect->render() . '' . $fieldAttributesSelect->render() . '' . $fieldNullSelect->render() . '' . $fieldNullSelect->render() . '' . $fieldDefault->render() . '' . $fieldDefault->render() . '' . $fieldKeySelect->render() . '' . $fieldKeySelect->render() . ' 
     
    ' . _AM_TDMCREATE_FIELD_PARAMETERS_LIST . '
    ' . $parametersTray->render() . '
    ' . _AM_MODULEBUILDER_FIELD_PARAMETERS_LIST . '
    ' . $parametersTray->render() . '
    ' . $formHidden->render() . '' . $formButton->render() . '
    ')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . $formHidden->render() . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . $formButton->render() . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); return $form; } diff --git a/class/FieldsHandler.php b/class/FieldsHandler.php index 38428df5..6fb7a1cc 100644 --- a/class/FieldsHandler.php +++ b/class/FieldsHandler.php @@ -1,6 +1,6 @@ getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); @@ -103,8 +103,8 @@ private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '') */ private function getAdminBrokenList($tables, $language, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = ''; foreach (array_keys($tables) as $i) { @@ -175,7 +175,7 @@ private function getAdminBrokenList($tables, $language, $t = '') */ public function render() { - $tf = Tdmcreate\Files\CreateFile::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); $module = $this->getModule(); $tables = $this->getTables(); @@ -188,7 +188,7 @@ public function render() $content .= $this->getAdminBrokenList($tables, $language); $content .= $this->getInclude('footer'); - $tf->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $tf->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $tf->renderFile(); } diff --git a/class/Files/Admin/AdminHeader.php b/class/Files/Admin/AdminHeader.php index 0619de5f..a8b8f62c 100644 --- a/class/Files/Admin/AdminHeader.php +++ b/class/Files/Admin/AdminHeader.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -161,7 +161,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getAdminHeader($moduleDirname); - $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index f94fe617..7c97deb1 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -1,9 +1,9 @@ getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $language = $this->getLanguage($moduleDirname, 'AM'); @@ -162,7 +162,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getAdminIndex($module); - $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Admin/AdminMenu.php b/class/Files/Admin/AdminMenu.php index 38084768..12f51d81 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -1,9 +1,9 @@ getSimpleString("\$adminmenu[] = ["); @@ -136,7 +136,7 @@ private function getAdminMenuDashboard($language, $menu) */ private function getAdminMenuImagesPath($tables, $t) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = ''; $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); foreach (array_keys($fields) as $f) { @@ -216,7 +216,7 @@ public function render() $content .= $this->getAdminMenuDashboard($language, $menu); $content .= $this->getAdminMenuList($module, $language, $langAbout, $menu); - $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index 72c9b37f..26db35a4 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -1,9 +1,9 @@ getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id')); $tableNames = []; @@ -133,7 +133,7 @@ private function getPermissionsHeader($module, $language) */ private function getPermissionsSwitch($module, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id')); @@ -184,8 +184,8 @@ private function getPermissionsSwitch($module, $language) */ private function getPermissionsBody($module, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $tables = $this->getTableTables($module->getVar('mod_id')); $ret = $xc->getXcGetVar('moduleId', 'xoopsModule', 'mid'); @@ -255,7 +255,7 @@ public function render() $content .= $this->getPermissionsBody($module, $language); $content .= $this->getInclude('footer'); - $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Assets/Css/Admin/CssAdminStyles.php b/class/Files/Assets/Css/Admin/CssAdminStyles.php index 1d56d98e..62e831bb 100644 --- a/class/Files/Assets/Css/Admin/CssAdminStyles.php +++ b/class/Files/Assets/Css/Admin/CssAdminStyles.php @@ -1,8 +1,8 @@ create($moduleDirname, 'assets/css/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $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/CssSelectors.php b/class/Files/Assets/Css/CssSelectors.php index 604bae69..b9ad6a67 100644 --- a/class/Files/Assets/Css/CssSelectors.php +++ b/class/Files/Assets/Css/CssSelectors.php @@ -1,6 +1,6 @@ create($moduleDirname, 'assets/css', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'assets/css', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Assets/Js/JavascriptJQuery.php b/class/Files/Assets/Js/JavascriptJQuery.php index c70e48ae..84cc0b21 100644 --- a/class/Files/Assets/Js/JavascriptJQuery.php +++ b/class/Files/Assets/Js/JavascriptJQuery.php @@ -1,9 +1,9 @@ getJavascriptJQueryButtons(); $content .= $this->getJavascriptJQueryPrint(); - $this->create($moduleDirname, 'assets/js', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'assets/js', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Assets/Js/JsJquery.php b/class/Files/Assets/Js/JsJquery.php index 622d3a58..ea0bbe2f 100644 --- a/class/Files/Assets/Js/JsJquery.php +++ b/class/Files/Assets/Js/JsJquery.php @@ -1,9 +1,9 @@ tdmcfile->create($moduleDirname, 'assets/js', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $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/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 0d15ec81..9520178e 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -1,9 +1,9 @@ getModule(); $filename = $this->getFileName(); $table = $this->getTable(); @@ -319,7 +319,7 @@ public function render() $content .= $this->getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fields, $fieldId, $fieldParent); $content .= $this->getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $language); - $this->create($moduleDirname, 'blocks', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'blocks', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 96f9b073..cf563757 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -1,9 +1,9 @@ getClassInitVar($fieldName, $type); } @@ -162,9 +162,9 @@ private function getInitVars($fields) */ private function getClassObject($module, $table, $fields) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); $ucfTableName = ucfirst($tableName); @@ -235,8 +235,8 @@ private function getClassObject($module, $table, $fields) */ private function getNewInsertId($table) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); $ucfTableName = ucfirst($tableName); $ret = $pc->getPhpCodeCommentMultiLine(['The new inserted' => '$Id', '@return' => 'inserted id'], "\t"); @@ -260,9 +260,9 @@ private function getNewInsertId($table) */ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $fe = ClassFormElements::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); @@ -326,9 +326,9 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) */ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $permissionApprove = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_APPROVE'); $permissionSubmit = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_SUBMIT'); $permissionView = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_VIEW'); @@ -378,9 +378,9 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) */ private function getValuesInObject($moduleDirname, $table, $fields) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucfTableName = ucfirst($table->getVar('table_name')); $ret = $pc->getPhpCodeCommentMultiLine(['Get' => 'Values', '@param null $keys' => '', '@param null $format' => '', '@param null$maxDepth' => '', '@return' => 'array'], "\t"); $ucfModuleDirname = ucfirst($moduleDirname); @@ -478,8 +478,8 @@ private function getValuesInObject($moduleDirname, $table, $fields) */ private function getToArrayInObject($table) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); $ucfTableName = ucfirst($tableName); $multiLineCom = ['Returns an array representation' => 'of the object', '' => '', '@return' => 'array']; @@ -505,8 +505,8 @@ private function getToArrayInObject($table) */ private function getOptionsCheck($table) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $tableName = $table->getVar('table_name'); $ucfTableName = ucfirst($tableName); $ret = $pc->getPhpCodeCommentMultiLine(['Get' => 'Options'], "\t"); @@ -541,7 +541,7 @@ private function getOptionsCheck($table) */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $table = $this->getTable(); $filename = $this->getFileName(); @@ -553,7 +553,7 @@ public function render() $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); $content .= $this->getClassObject($module, $table, $fields); - $this->create($moduleDirname, 'class', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'class', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 06e3b653..de1974b7 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -1,8 +1,8 @@ getCamelCase($fieldName, false, true); if ('' != $fieldDefault) { $ret = $pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); @@ -98,9 +98,9 @@ private function getXoopsFormText($language, $fieldName, $fieldDefault, $require */ private function getXoopsFormTextArea($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $ret = $pc->getPhpCodeCommentLine('Form Editor', 'TextArea ' . $ccFieldName, "\t\t"); $formTextArea = $cxc->getClassXoopsFormTextArea('', $language, $fieldName, 4, 47, true); @@ -120,10 +120,10 @@ private function getXoopsFormTextArea($language, $fieldName, $required = 'false' */ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $rpFieldName = $tf->getRightString($fieldName); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $ret = $pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t"); @@ -159,10 +159,10 @@ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'f */ private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fieldElementId, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $stuTableSoleName = mb_strtoupper($tableSoleName); $ucfFieldName = $tf->getCamelCase($fieldName, true); $ccFieldName = $tf->getCamelCase($fieldName, false, true); @@ -198,9 +198,9 @@ private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fi */ private function getXoopsFormHidden($fieldName) { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $ret = $pc->getPhpCodeCommentLine('Form Hidden', $ccFieldName, "\t\t"); $formHidden = $cxc->getClassXoopsFormHidden('', $fieldName, $fieldName, true, true); @@ -222,10 +222,10 @@ private function getXoopsFormHidden($fieldName) */ private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ucfFieldName = $tf->getCamelCase($fieldName, true); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; @@ -276,10 +276,10 @@ private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $r */ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ucfFieldName = $tf->getCamelCase($fieldName, true); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; @@ -332,10 +332,10 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $ */ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; @@ -365,10 +365,10 @@ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fie */ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ucfFieldName = $tf->getCamelCase($fieldName, true); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; @@ -426,10 +426,10 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, */ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; $t = "\t\t\t"; @@ -468,10 +468,10 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $ */ private function getXoopsFormColorPicker($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $t = "\t\t"; $ret = $pc->getPhpCodeCommentLine('Form Color', 'Picker ' . $ccFieldName, $t); @@ -494,10 +494,10 @@ private function getXoopsFormColorPicker($language, $fieldName, $required = 'fal */ private function getXoopsFormSelectBox($language, $tableName, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ucfTableName = ucfirst($tableName); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -522,9 +522,9 @@ private function getXoopsFormSelectBox($language, $tableName, $fieldName, $requi */ private function getXoopsFormSelectUser($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $t = "\t\t"; $ret = $pc->getPhpCodeCommentLine('Form Select', 'User ' . $ccFieldName, $t); @@ -545,9 +545,9 @@ private function getXoopsFormSelectUser($language, $fieldName, $required = 'fals */ private function getXoopsFormRadioYN($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $t = "\t\t"; $ret = $pc->getPhpCodeCommentLine('Form Radio', 'Yes/No ' . $ccFieldName, $t); @@ -569,9 +569,9 @@ private function getXoopsFormRadioYN($language, $fieldName, $required = 'false') */ private function getXoopsFormTextDateSelect($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; $ccFieldName = $tf->getCamelCase($fieldName, false, true); $ret = $pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); @@ -593,9 +593,9 @@ private function getXoopsFormTextDateSelect($language, $fieldName, $required = ' */ private function getXoopsFormDateTime($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; $ccFieldName = $tf->getCamelCase($fieldName, false, true); $ret = $pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); @@ -618,9 +618,9 @@ private function getXoopsFormDateTime($language, $fieldName, $required = 'false' */ private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; @@ -647,9 +647,9 @@ private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, */ private function getXoopsFormPassword($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; $ccFieldName = $tf->getCamelCase($fieldName, false, true); $ret = $pc->getPhpCodeCommentLine('Form Text', 'Enter Password ' . $ccFieldName, $t); @@ -670,10 +670,10 @@ private function getXoopsFormPassword($language, $fieldName, $required = 'false' */ private function getXoopsFormSelectCountry($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $t = "\t\t"; $ret = $pc->getPhpCodeCommentLine('Form Select', 'Country ' . $ccFieldName, $t); @@ -697,10 +697,10 @@ private function getXoopsFormSelectCountry($language, $fieldName, $required = 'f */ private function getXoopsFormSelectLang($language, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $t = "\t\t"; $ret = $pc->getPhpCodeCommentLine('Form Select', 'Lang ' . $ccFieldName, $t); @@ -725,9 +725,9 @@ private function getXoopsFormSelectLang($language, $fieldName, $required = 'fals */ private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; @@ -756,10 +756,10 @@ private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $requi */ private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ucfTableName = ucfirst($tableName); $ccFieldName = $tf->getCamelCase($fieldName, false, true); $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; @@ -789,11 +789,11 @@ private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, */ private function getXoopsFormTable($language,$fieldName, $fieldElement, $required = 'false') { - $tc = Tdmcreate\Helper::getInstance(); - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; $ret = ''; @@ -821,10 +821,10 @@ private function getXoopsFormTable($language,$fieldName, $fieldElement, $require */ private function getXoopsFormTopic($language, $topicTableName, $fieldId, $fieldPid, $fieldMain) { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ucfTopicTableName = ucfirst($topicTableName); $stlTopicTableName = mb_strtolower($topicTableName); $ccFieldPid = $tf->getCamelCase($fieldPid, false, true); @@ -855,9 +855,9 @@ private function getXoopsFormTopic($language, $topicTableName, $fieldId, $fieldP */ private function getXoopsFormTag($fieldId, $required = 'false') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; $ret = $pc->getPhpCodeCommentLine('Use tag', 'module', $t); $isDir = $pc->getPhpCodeIsDir("XOOPS_ROOT_PATH . '/modules/tag'"); @@ -879,9 +879,9 @@ private function getXoopsFormTag($fieldId, $required = 'false') */ public function renderElements() { - $tc = Tdmcreate\Helper::getInstance(); - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $ttf = Tdmcreate\Files\CreateTableFields::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $ttf = Modulebuilder\Files\CreateTableFields::getInstance(); $module = $this->getModule(); $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index b46be306..8cbaf52f 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -1,9 +1,9 @@ getVar('table_name'); $tableFieldName = $table->getVar('table_fieldname'); $ucfTableName = ucfirst($tableName); @@ -120,7 +120,7 @@ private function getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldN */ private function getClassCreate() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentMultiLine(['@param bool' => '$isNew', '' => '', '@return' => 'object'], "\t"); $cClhc = $this->getSimpleString('return parent::create($isNew);', "\t\t"); @@ -136,7 +136,7 @@ private function getClassCreate() */ private function getClassGet() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentMultiLine(['retrieve a' => 'field', '' => '', '@param int' => '$i field id', '@param null' => 'fields', '@return mixed reference to the' => '{@link Get} object'], "\t"); $cClhg = $this->getSimpleString('return parent::get($i, $fields);', "\t\t"); @@ -152,7 +152,7 @@ private function getClassGet() */ private function getClassGetInsertId() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentMultiLine(['get inserted' => 'id', '' => '', '@param' => 'null', '@return integer reference to the' => '{@link Get} object'], "\t"); $cClhgid = $this->getSimpleString('return $this->db->getInsertId();', "\t\t"); @@ -172,8 +172,8 @@ private function getClassGetInsertId() */ private function getClassCounter($tableName, $fieldId, $fieldMain) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucfTableName = ucfirst($tableName); $ret = $pc->getPhpCodeCommentMultiLine(['Get Count ' . $ucfTableName => 'in the database', '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'int'], "\t"); @@ -199,8 +199,8 @@ private function getClassCounter($tableName, $fieldId, $fieldMain) */ private function getClassAll($tableName, $fieldId, $fieldMain) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucfTableName = ucfirst($tableName); $ret = $pc->getPhpCodeCommentMultiLine(['Get All ' . $ucfTableName => 'in the database', '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'array'], "\t"); @@ -229,9 +229,9 @@ private function getClassAll($tableName, $fieldId, $fieldMain) */ private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, $fieldId, $fieldName, $fieldMain, $fieldElement) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucfTableName = ucfirst($tableName); $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); $fieldElementName = $fieldElements->getVar('fieldelement_name'); @@ -271,8 +271,8 @@ private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, */ private function getClassCriteria($tableName) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucfTableName = ucfirst($tableName); $ret = $pc->getPhpCodeCommentMultiLine(['Get' => 'Criteria ' . $ucfTableName, '@param ' => "\$cr{$ucfTableName}", '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'int'], "\t"); @@ -298,8 +298,8 @@ private function getClassCriteria($tableName) */ private function getClassGetTableSolenameById($table, $fieldMain) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); $ucfTableSoleName = ucfirst($tableSoleName); @@ -328,8 +328,8 @@ private function getClassGetTableSolenameById($table, $fieldMain) */ public function render() { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $tc = Modulebuilder\Helper::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $table = $this->getTable(); $filename = $this->getFileName(); @@ -362,7 +362,7 @@ public function render() $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); $content .= $this->getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldName, $fieldMain, $fieldParentId, $fieldElement); - $this->create($moduleDirname, 'class', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'class', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 93634e11..5402c72c 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -1,9 +1,9 @@ getModule(); $moduleDirname = $module->getVar('mod_dirname'); @@ -154,8 +154,8 @@ public function getGlobalPerms($permId) */ public function renderClass() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -175,7 +175,7 @@ public function renderClass() $cCl .= $pc->getPhpCodeFunction('getInstance', '', $getInstance, 'public static ', false, "\t"); $content .= $pc->getPhpCodeClass($this->className, $cCl, '\XoopsObject'); - $this->create($moduleDirname, 'class', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'class', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); @@ -190,7 +190,7 @@ public function renderClass() */ public function renderPermissionsHandler() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -208,7 +208,7 @@ public function renderPermissionsHandler() $functions .= $this->getGlobalPerms(16); $content .= $pc->getPhpCodeClass($this->className, $functions, '\XoopsPersistableObjectHandler'); - $this->create($moduleDirname, 'class', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'class', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } @@ -221,7 +221,7 @@ public function renderPermissionsHandler() */ public function renderConstants() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); @@ -257,14 +257,14 @@ public function renderConstants() $contentClass .= $pc->getPhpCodeBlankLine(); $contentFile .= $pc->getPhpCodeClass($this->className, $contentClass); - $this->create($moduleDirname, 'class', $filename, $contentFile, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'class', $filename, $contentFile, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } public function renderConstantsTestInterface() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); @@ -298,7 +298,7 @@ public function renderConstantsTestInterface() $contentFile .= $pc->getPhpCodeInterface($this->className, $contentClass); - $this->create($moduleDirname, 'class', $filename, $contentFile, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'class', $filename, $contentFile, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Classes/ClassXoopsCode.php b/class/Files/Classes/ClassXoopsCode.php index 02ff4398..aecacce4 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -1,8 +1,8 @@ getXcGetVar('', 'this', $param2, true); + $getVarHidden = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true); $ret = ''; if (false === $isParam) { $ret .= "{$t}\${$var} = {$hidden}{$param1}, {$getVarHidden} );\n"; @@ -287,7 +287,7 @@ public function getClassXoopsFormText($var, $param1, $param2, $param3, $param4, public function getClassXoopsFormTextArea($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") { $area = 'new \XoopsFormTextArea( '; - $getVarTextArea = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true, '', ", 'e'"); + $getVarTextArea = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true, '', ", 'e'"); if (false === $isParam) { $ret = "{$t}\${$var} = {$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4} );\n"; } else { @@ -337,7 +337,7 @@ public function getClassXoopsFormColorPicker($var, $param1, $param2, $param3, $i public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") { $user = 'new \XoopsFormSelectUser( '; - $getVarSelectUser = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); + $getVarSelectUser = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); if (false === $isParam) { $ret = "{$t}\${$var} = {$user}{$param1}, '{$param2}', {$param3}, {$getVarSelectUser} );\n"; } else { @@ -363,7 +363,7 @@ public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $pa public function getClassXoopsFormTextDateSelect($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") { $tdate = 'new \XoopsFormTextDateSelect( '; - $getVarTextDateSelect = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); + $getVarTextDateSelect = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); if (false === $isParam) { $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect} );\n"; } else { @@ -389,7 +389,7 @@ public function getClassXoopsFormTextDateSelect($var, $param1, $param2, $param3, public function getClassXoopsFormDateTime($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") { $tdate = 'new \XoopsFormDateTime( '; - $getVarTextDateSelect = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); + $getVarTextDateSelect = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); if (false === $isParam) { $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect} );\n"; } else { @@ -589,7 +589,7 @@ public function getClassXoopsFormButton($var, $param1, $param2, $param3, $param4 public function getClassXoopsFormPassword($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") { $tpassword = 'new \XoopsFormPassword( '; - $getVarPassword = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); + $getVarPassword = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); if (false === $isParam) { $ret = "{$t}\${$var} = {$tpassword}{$param1}, '{$param2}', '', {$getVarPassword} );\n"; } else { @@ -659,7 +659,7 @@ public function getClassXoopsObjectTree($var, $param1, $param2, $param3, $t = '' */ public function getClassXoopsMakeSelBox($var, $anchor, $param1, $param2, $param3, $param4, $t = '') { - $getVar = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); + $getVar = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); $ret = "{$t}\${$var} = \${$anchor}->makeSelBox( '{$param1}', '{$param2}', '{$param3}', {$getVar}, true );\n"; return $ret; diff --git a/class/Files/Config/ConfigConfig.php b/class/Files/Config/ConfigConfig.php index 590cb7ec..650e2705 100644 --- a/class/Files/Config/ConfigConfig.php +++ b/class/Files/Config/ConfigConfig.php @@ -1,9 +1,9 @@ getTables(); $ret = $this->getSimpleString(''); @@ -148,7 +148,7 @@ public function render() $filename = $this->getFileName(); $content = $this->getHeaderFilesComments($module); $content .= $this->getConfigCode(); - $this->create($moduleDirname, 'config', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'config', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/CreateAbstractClass.php b/class/Files/CreateAbstractClass.php index 15e7c1d0..00b8fc67 100644 --- a/class/Files/CreateAbstractClass.php +++ b/class/Files/CreateAbstractClass.php @@ -1,8 +1,8 @@ module = $module; } } @@ -87,7 +87,7 @@ public function getModule() */ public function setTable($table) { - if (is_object($table) && ($table instanceof Tdmcreate\Tables)) { + if (is_object($table) && ($table instanceof Modulebuilder\Tables)) { $this->table = $table; } } @@ -131,7 +131,7 @@ public function getTables() */ public function setFields($fields) { - if (is_object($fields) && ($fields instanceof Tdmcreate\Fields)) { + if (is_object($fields) && ($fields instanceof Modulebuilder\Fields)) { $this->fields = $fields; } } diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 01fa980a..81b16f6a 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -1,8 +1,8 @@ getVar('mod_id'); // Id of tables @@ -193,8 +193,8 @@ public function setBaseFoldersFiles($module) */ public function setFilesToBuilding($module) { - $helper = Tdmcreate\Helper::getInstance(); - $tf = Tdmcreate\Files\CreateFile::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); // Module $modId = $module->getVar('mod_id'); $moduleDirname = $module->getVar('mod_dirname'); @@ -257,25 +257,25 @@ public function setFilesToBuilding($module) // Creation of admin files if (1 === (int)$tables[$t]->getVar('table_admin')) { // Admin Pages File - $adminPages = Tdmcreate\Files\Admin\AdminPages::getInstance(); + $adminPages = Modulebuilder\Files\Admin\AdminPages::getInstance(); $adminPages->write($module, $table, $tableName . '.php'); $ret[] = $adminPages->render(); // Admin Templates File - $adminTemplatesPages = Tdmcreate\Files\Templates\Admin\TemplatesAdminPages::getInstance(); + $adminTemplatesPages = Modulebuilder\Files\Templates\Admin\TemplatesAdminPages::getInstance(); $adminTemplatesPages->write($module, $table, $moduleDirname . '_admin_' . $tableName . '.tpl'); $ret[] = $adminTemplatesPages->render(); } // Creation of blocks if (1 === (int)$tables[$t]->getVar('table_blocks')) { // Blocks Files - $blocksFiles = Tdmcreate\Files\Blocks\BlocksFiles::getInstance(); + $blocksFiles = Modulebuilder\Files\Blocks\BlocksFiles::getInstance(); $blocksFiles->write($module, $table, $tableName . '.php'); $ret[] = $blocksFiles->render(); // Templates Blocks Files if ($templateType == 'bootstrap') { - $templatesBlocks = Tdmcreate\Files\Templates\Blocks\Bootstrap\TemplatesBlocks::getInstance(); + $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Bootstrap\TemplatesBlocks::getInstance(); } else { - $templatesBlocks = Tdmcreate\Files\Templates\Blocks\Defstyle\TemplatesBlocks::getInstance(); + $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Defstyle\TemplatesBlocks::getInstance(); } $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl'); $ret[] = $templatesBlocks->render(); @@ -283,36 +283,36 @@ public function setFilesToBuilding($module) // Creation of classes if (1 === (int)$tables[$t]->getVar('table_admin') || 1 === (int)$tables[$t]->getVar('table_user')) { // Class Files - $classFiles = Tdmcreate\Files\Classes\ClassFiles::getInstance(); + $classFiles = Modulebuilder\Files\Classes\ClassFiles::getInstance(); $classFiles->write($module, $table, $tables, ucfirst($tableName) . '.php'); $ret[] = $classFiles->render(); } // Creation of classhandlers if (1 === (int)$tables[$t]->getVar('table_admin') || 1 === (int)$tables[$t]->getVar('table_user')) { // Class Files - $classFiles = Tdmcreate\Files\Classes\ClassHandlerFiles::getInstance(); + $classFiles = Modulebuilder\Files\Classes\ClassHandlerFiles::getInstance(); $classFiles->write($module, $table, $tables, ucfirst($tableName) . 'handler.php'); $ret[] = $classFiles->render(); } // Creation of user files if (1 === (int)$tables[$t]->getVar('table_user')) { // User Pages File - $userPages = Tdmcreate\Files\User\UserPages::getInstance(); + $userPages = Modulebuilder\Files\User\UserPages::getInstance(); $userPages->write($module, $table, $tableName . '.php'); $ret[] = $userPages->render(); // User Templates File if ($templateType == 'bootstrap') { - $userTemplatesPages = Tdmcreate\Files\Templates\User\Bootstrap\Pages::getInstance(); + $userTemplatesPages = Modulebuilder\Files\Templates\User\Bootstrap\Pages::getInstance(); } else { - $userTemplatesPages = Tdmcreate\Files\Templates\User\Defstyle\Pages::getInstance(); + $userTemplatesPages = Modulebuilder\Files\Templates\User\Defstyle\Pages::getInstance(); } $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl'); $ret[] = $userTemplatesPages->render(); // User List Templates File if ($templateType == 'bootstrap') { - $userTemplatesPagesList = Tdmcreate\Files\Templates\User\Bootstrap\PagesList::getInstance(); + $userTemplatesPagesList = Modulebuilder\Files\Templates\User\Bootstrap\PagesList::getInstance(); } else { - $userTemplatesPagesList = Tdmcreate\Files\Templates\User\Defstyle\PagesList::getInstance(); + $userTemplatesPagesList = Modulebuilder\Files\Templates\User\Defstyle\PagesList::getInstance(); } $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl'); $ret[] = $userTemplatesPagesList->render(); @@ -330,7 +330,7 @@ public function setFilesToBuilding($module) } // Creation of constants - $classSpecialFiles = Tdmcreate\Files\Classes\ClassSpecialFiles::getInstance(); + $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance(); $classSpecialFiles->write($module, '', $tables, ucfirst('constants') . '.php'); $classSpecialFiles->className = 'Constants'; $ret[] = $classSpecialFiles->renderConstants(); @@ -338,13 +338,13 @@ public function setFilesToBuilding($module) // Creation of permissions if (in_array(1, $tablePermissions)) { // Creation of classes - $classSpecialFiles = Tdmcreate\Files\Classes\ClassSpecialFiles::getInstance(); + $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance(); $classSpecialFiles->write($module, '', null, ucfirst('permissions') . '.php'); $classSpecialFiles->className = 'Permissions'; $ret[] = $classSpecialFiles->renderClass(); // Creation of classhandlers - $classSpecialFiles = Tdmcreate\Files\Classes\ClassSpecialFiles::getInstance(); + $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance(); $classSpecialFiles->write($module, '', $permTables, ucfirst('permissionshandler') . '.php'); $classSpecialFiles->className = 'Permissionshandler'; $ret[] = $classSpecialFiles->renderPermissionsHandler(); @@ -355,53 +355,53 @@ public function setFilesToBuilding($module) $fileExtension = $files[$t]->getVar('file_extension'); $fileInfolder = $files[$t]->getVar('file_infolder'); // More File - $moreFiles = Tdmcreate\MoreFiles::getInstance(); + $moreFiles = Modulebuilder\MoreFiles::getInstance(); $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension); $ret[] = $moreFiles->render(); } // Language Modinfo File - $languageModinfo = Tdmcreate\Files\Language\LanguageModinfo::getInstance(); + $languageModinfo = Modulebuilder\Files\Language\LanguageModinfo::getInstance(); $languageModinfo->write($module, $table, 'modinfo.php'); $ret[] = $languageModinfo->render(); if (1 == $module->getVar('mod_admin')) { // Admin Header File - $adminHeader = Tdmcreate\Files\Admin\AdminHeader::getInstance(); + $adminHeader = Modulebuilder\Files\Admin\AdminHeader::getInstance(); $adminHeader->write($module, $table, $tables, 'header.php'); $ret[] = $adminHeader->render(); // Admin Index File - $adminIndex = Tdmcreate\Files\Admin\AdminIndex::getInstance(); + $adminIndex = Modulebuilder\Files\Admin\AdminIndex::getInstance(); $adminIndex->write($module, $tables, 'index.php'); $ret[] = $adminIndex->render(); // Admin Menu File - $adminObject = Tdmcreate\Files\Admin\AdminMenu::getInstance(); + $adminObject = Modulebuilder\Files\Admin\AdminMenu::getInstance(); $adminObject->write($module, 'menu.php'); $ret[] = $adminObject->render(); // Admin About File - $adminAbout = Tdmcreate\Files\Admin\AdminAbout::getInstance(); + $adminAbout = Modulebuilder\Files\Admin\AdminAbout::getInstance(); $adminAbout->write($module, 'about.php'); $ret[] = $adminAbout->render(); // Admin Footer File - $adminFooter = Tdmcreate\Files\Admin\AdminFooter::getInstance(); + $adminFooter = Modulebuilder\Files\Admin\AdminFooter::getInstance(); $adminFooter->write($module, 'footer.php'); $ret[] = $adminFooter->render(); // Templates Admin About File - $adminTemplatesAbout = Tdmcreate\Files\Templates\Admin\TemplatesAdminAbout::getInstance(); + $adminTemplatesAbout = Modulebuilder\Files\Templates\Admin\TemplatesAdminAbout::getInstance(); $adminTemplatesAbout->write($module, $moduleDirname . '_admin_about.tpl'); $ret[] = $adminTemplatesAbout->render(); // Templates Admin Index File - $adminTemplatesIndex = Tdmcreate\Files\Templates\Admin\TemplatesAdminIndex::getInstance(); + $adminTemplatesIndex = Modulebuilder\Files\Templates\Admin\TemplatesAdminIndex::getInstance(); $adminTemplatesIndex->write($module, $moduleDirname . '_admin_index.tpl'); $ret[] = $adminTemplatesIndex->render(); // Templates Admin Footer File - $adminTemplatesFooter = Tdmcreate\Files\Templates\Admin\TemplatesAdminFooter::getInstance(); + $adminTemplatesFooter = Modulebuilder\Files\Templates\Admin\TemplatesAdminFooter::getInstance(); $adminTemplatesFooter->write($module, $moduleDirname . '_admin_footer.tpl'); $ret[] = $adminTemplatesFooter->render(); // Templates Admin Header File - $adminTemplatesHeader = Tdmcreate\Files\Templates\Admin\TemplatesAdminHeader::getInstance(); + $adminTemplatesHeader = Modulebuilder\Files\Templates\Admin\TemplatesAdminHeader::getInstance(); $adminTemplatesHeader->write($module, $moduleDirname . '_admin_header.tpl'); $ret[] = $adminTemplatesHeader->render(); // Language Admin File - $languageAdmin = Tdmcreate\Files\Language\LanguageAdmin::getInstance(); + $languageAdmin = Modulebuilder\Files\Language\LanguageAdmin::getInstance(); $languageAdmin->write($module, $table, $tables, 'admin.php'); $ret[] = $languageAdmin->render(); } @@ -409,7 +409,7 @@ public function setFilesToBuilding($module) // Class Helper File ==> setCommonFiles // Include Functions File - $includeFunctions = Tdmcreate\Files\Includes\IncludeFunctions::getInstance(); + $includeFunctions = Modulebuilder\Files\Includes\IncludeFunctions::getInstance(); $includeFunctions->write($module, 'functions.php'); $ret[] = $includeFunctions->render(); @@ -419,47 +419,47 @@ public function setFilesToBuilding($module) if (in_array(1, $tableBlocks)) { // Language Blocks File - $languageBlocks = Tdmcreate\Files\Language\LanguageBlocks::getInstance(); + $languageBlocks = Modulebuilder\Files\Language\LanguageBlocks::getInstance(); $languageBlocks->write($module, $tables, 'blocks.php'); $ret[] = $languageBlocks->render(); } // Creation of admin broken files if (in_array(1, $tableBroken)) { // Admin broken File - $adminPermissions = Tdmcreate\Files\Admin\AdminBroken::getInstance(); + $adminPermissions = Modulebuilder\Files\Admin\AdminBroken::getInstance(); $adminPermissions->write($module, $tables, 'broken.php'); $ret[] = $adminPermissions->render(); // Templates Admin broken File - $adminTemplatesPermissions = Tdmcreate\Files\Templates\Admin\TemplatesAdminBroken::getInstance(); + $adminTemplatesPermissions = Modulebuilder\Files\Templates\Admin\TemplatesAdminBroken::getInstance(); $adminTemplatesPermissions->write($module, $tables, $moduleDirname . '_admin_broken.tpl'); $ret[] = $adminTemplatesPermissions->render(); } // Creation of admin permission files if (in_array(1, $tablePermissions)) { // Admin Permissions File - $adminPermissions = Tdmcreate\Files\Admin\AdminPermissions::getInstance(); + $adminPermissions = Modulebuilder\Files\Admin\AdminPermissions::getInstance(); $adminPermissions->write($module, $tables, 'permissions.php'); $ret[] = $adminPermissions->render(); // Templates Admin Permissions File - $adminTemplatesPermissions = Tdmcreate\Files\Templates\Admin\TemplatesAdminPermissions::getInstance(); + $adminTemplatesPermissions = Modulebuilder\Files\Templates\Admin\TemplatesAdminPermissions::getInstance(); $adminTemplatesPermissions->write($module, $moduleDirname . '_admin_permissions.tpl'); $ret[] = $adminTemplatesPermissions->render(); } // Creation of notifications files if (in_array(1, $tableNotifications)) { // Include Notifications File - $includeNotifications = Tdmcreate\Files\Includes\IncludeNotifications::getInstance(); + $includeNotifications = Modulebuilder\Files\Includes\IncludeNotifications::getInstance(); $includeNotifications->write($module, $tables, 'notifications.inc.php'); $ret[] = $includeNotifications->render(); // Language Mail Template Category File - $languageMailTpl = Tdmcreate\Files\Language\LanguageMailTpl::getInstance(); + $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance(); $languageMailTpl->write($module, 'category_new_notify.tpl'); $ret[] = $languageMailTpl->render(); } // Creation of sql file if (null != $table->getVar('table_name')) { // Sql File - $sqlFile = Tdmcreate\Files\Sql\SqlFile::getInstance(); + $sqlFile = Modulebuilder\Files\Sql\SqlFile::getInstance(); $sqlFile->write($module, 'mysql.sql'); $ret[] = $sqlFile->render(); } @@ -468,12 +468,12 @@ public function setFilesToBuilding($module) // Search File //TODO: UserSearch has to be adapted /* - $userSearch = Tdmcreate\Files\User\UserSearch::getInstance(); + $userSearch = Modulebuilder\Files\User\UserSearch::getInstance(); $userSearch->write($module, $table, 'search.php'); $ret[] = $userSearch->render(); */ // Include Search File - $includeSearch = Tdmcreate\Files\Includes\IncludeSearch::getInstance(); + $includeSearch = Modulebuilder\Files\Includes\IncludeSearch::getInstance(); $includeSearch->write($module, $tables, 'search.inc.php'); $ret[] = $includeSearch->render(); } @@ -482,29 +482,29 @@ public function setFilesToBuilding($module) /* * TODO: are this comment files required? // Include Comments File - $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance(); + $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance(); $includeComments->write($module, $table); $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit'); // Include Comments File - $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance(); + $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance(); $includeComments->write($module, $table); $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_delete'); // Include Comments File - $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance(); + $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance(); $includeComments->write($module, $table); $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_post'); // Include Comments File - $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance(); + $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance(); $includeComments->write($module, $table); $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_reply'); // Include Comments File - $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance(); + $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance(); $includeComments->write($module, $table); $ret[] = $includeComments->renderCommentsNew($module, 'comment_new'); */ // Include Comment Functions File - $includeCommentFunctions = Tdmcreate\Files\Includes\IncludeCommentFunctions::getInstance(); + $includeCommentFunctions = Modulebuilder\Files\Includes\IncludeCommentFunctions::getInstance(); $includeCommentFunctions->write($module, $table, 'comment_functions.php'); $ret[] = $includeCommentFunctions->render(); } @@ -513,68 +513,68 @@ public function setFilesToBuilding($module) // Creation of user template files // Templates Index File if ($templateType == 'bootstrap') { - $userTemplatesIndex = Tdmcreate\Files\Templates\User\Bootstrap\Index::getInstance(); + $userTemplatesIndex = Modulebuilder\Files\Templates\User\Bootstrap\Index::getInstance(); } else { - $userTemplatesIndex = Tdmcreate\Files\Templates\User\Defstyle\Index::getInstance(); + $userTemplatesIndex = Modulebuilder\Files\Templates\User\Defstyle\Index::getInstance(); } $userTemplatesIndex->write($module, $table, $tables, $moduleDirname . '_index.tpl'); $ret[] = $userTemplatesIndex->render(); // Templates Footer File if ($templateType == 'bootstrap') { - $userTemplatesFooter = Tdmcreate\Files\Templates\User\Bootstrap\Footer::getInstance(); + $userTemplatesFooter = Modulebuilder\Files\Templates\User\Bootstrap\Footer::getInstance(); } else { - $userTemplatesFooter = Tdmcreate\Files\Templates\User\Defstyle\Footer::getInstance(); + $userTemplatesFooter = Modulebuilder\Files\Templates\User\Defstyle\Footer::getInstance(); } $userTemplatesFooter->write($module, $table, $moduleDirname . '_footer.tpl'); $ret[] = $userTemplatesFooter->render(); // Templates Header File if ($templateType == 'bootstrap') { - $userTemplatesHeader = Tdmcreate\Files\Templates\User\Bootstrap\Header::getInstance(); + $userTemplatesHeader = Modulebuilder\Files\Templates\User\Bootstrap\Header::getInstance(); } else { - $userTemplatesHeader = Tdmcreate\Files\Templates\User\Defstyle\Header::getInstance(); + $userTemplatesHeader = Modulebuilder\Files\Templates\User\Defstyle\Header::getInstance(); } $userTemplatesHeader->write($module, $moduleDirname . '_header.tpl'); $ret[] = $userTemplatesHeader->render(); // Creation of user files // User Footer File - $userFooter = Tdmcreate\Files\User\UserFooter::getInstance(); + $userFooter = Modulebuilder\Files\User\UserFooter::getInstance(); $userFooter->write($module, 'footer.php'); $ret[] = $userFooter->render(); // User Header File - $userHeader = Tdmcreate\Files\User\UserHeader::getInstance(); + $userHeader = Modulebuilder\Files\User\UserHeader::getInstance(); $userHeader->write($module, $table, $tables, 'header.php'); $ret[] = $userHeader->render(); // User Notification Update File if ((1 == $module->getVar('mod_notifications')) && in_array(1, $tableNotifications)) { - $userNotificationUpdate = Tdmcreate\Files\User\UserNotificationUpdate::getInstance(); + $userNotificationUpdate = Modulebuilder\Files\User\UserNotificationUpdate::getInstance(); $userNotificationUpdate->write($module, 'notification_update.php'); $ret[] = $userNotificationUpdate->render(); } // User Pdf File if (in_array(1, $tablePdf)) { - $userPdf = Tdmcreate\Files\User\UserPdf::getInstance(); + $userPdf = Modulebuilder\Files\User\UserPdf::getInstance(); $userPdf->write($module, $table, 'pdf.php'); $ret[] = $userPdf->render(); // User Templates Pdf File if ($templateType == 'bootstrap') { - $userTemplatesPdf = Tdmcreate\Files\Templates\User\Bootstrap\Pdf::getInstance(); + $userTemplatesPdf = Modulebuilder\Files\Templates\User\Bootstrap\Pdf::getInstance(); } else { - $userTemplatesPdf = Tdmcreate\Files\Templates\User\Defstyle\Pdf::getInstance(); + $userTemplatesPdf = Modulebuilder\Files\Templates\User\Defstyle\Pdf::getInstance(); } $userTemplatesPdf->write($module, $moduleDirname . '_pdf.tpl'); $ret[] = $userTemplatesPdf->render(); } // User Print File if (in_array(1, $tablePrint)) { - $userPrint = Tdmcreate\Files\User\UserPrint::getInstance(); + $userPrint = Modulebuilder\Files\User\UserPrint::getInstance(); $userPrint->write($module, $table, 'print.php'); $ret[] = $userPrint->render(); // User Templates Print File if ($templateType == 'bootstrap') { - $userTemplatesPrint = Tdmcreate\Files\Templates\User\Bootstrap\UserPrint::getInstance(); + $userTemplatesPrint = Modulebuilder\Files\Templates\User\Bootstrap\UserPrint::getInstance(); } else { - $userTemplatesPrint = Tdmcreate\Files\Templates\User\Defstyle\UserPrint::getInstance(); + $userTemplatesPrint = Modulebuilder\Files\Templates\User\Defstyle\UserPrint::getInstance(); } $userTemplatesPrint->write($module, $table, $moduleDirname . '_print.tpl'); $ret[] = $userTemplatesPrint->render(); @@ -582,14 +582,14 @@ public function setFilesToBuilding($module) // User Rate File //TODO: UserSearch has to be adapted if (in_array(1, $tableRate)) { - $userRate = Tdmcreate\Files\User\UserRate::getInstance(); + $userRate = Modulebuilder\Files\User\UserRate::getInstance(); $userRate->write($module, $table, 'rate.php'); $ret[] = $userRate->render(); // User Templates Rate File if ($templateType == 'bootstrap') { - $userTemplatesRate = Tdmcreate\Files\Templates\User\Bootstrap\Rate::getInstance(); + $userTemplatesRate = Modulebuilder\Files\Templates\User\Bootstrap\Rate::getInstance(); } else { - $userTemplatesRate = Tdmcreate\Files\Templates\User\Defstyle\Rate::getInstance(); + $userTemplatesRate = Modulebuilder\Files\Templates\User\Defstyle\Rate::getInstance(); } $userTemplatesRate->write($module, $table, $moduleDirname . '_rate.tpl'); $ret[] = $userTemplatesRate->render(); @@ -597,14 +597,14 @@ public function setFilesToBuilding($module) // User Rss File if (in_array(1, $tableRss)) { - $userRss = Tdmcreate\Files\User\UserRss::getInstance(); + $userRss = Modulebuilder\Files\User\UserRss::getInstance(); $userRss->write($module, $table, 'rss.php'); $ret[] = $userRss->render(); // User Templates Rss File if ($templateType == 'bootstrap') { - $userTemplatesRss = Tdmcreate\Files\Templates\User\Bootstrap\Rss::getInstance(); + $userTemplatesRss = Modulebuilder\Files\Templates\User\Bootstrap\Rss::getInstance(); } else { - $userTemplatesRss = Tdmcreate\Files\Templates\User\Defstyle\Rss::getInstance(); + $userTemplatesRss = Modulebuilder\Files\Templates\User\Defstyle\Rss::getInstance(); } $userTemplatesRss->write($module, $moduleDirname . '_rss.tpl'); $ret[] = $userTemplatesRss->render(); @@ -612,60 +612,60 @@ public function setFilesToBuilding($module) // User Tag Files if (in_array(1, $tableTag)) { - $userListTag = Tdmcreate\Files\User\UserListTag::getInstance(); + $userListTag = Modulebuilder\Files\User\UserListTag::getInstance(); $userListTag->write($module, 'list.tag.php'); $ret[] = $userListTag->render(); - $userViewTag = Tdmcreate\Files\User\UserViewTag::getInstance(); + $userViewTag = Modulebuilder\Files\User\UserViewTag::getInstance(); $userViewTag->write($module, 'view.tag.php'); $ret[] = $userViewTag->render(); } // User Index File - $userIndex = Tdmcreate\Files\User\UserIndex::getInstance(); + $userIndex = Modulebuilder\Files\User\UserIndex::getInstance(); $userIndex->write($module, $table, 'index.php'); $ret[] = $userIndex->render(); // Language Main File - $languageMain = Tdmcreate\Files\Language\LanguageMain::getInstance(); + $languageMain = Modulebuilder\Files\Language\LanguageMain::getInstance(); $languageMain->write($module, $tables, 'main.php'); $ret[] = $languageMain->render(); // User Templates Submit File if ($templateType == 'bootstrap') { - $userTemplatesUserBreadcrumbs = Tdmcreate\Files\Templates\User\Bootstrap\Breadcrumbs::getInstance(); + $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Bootstrap\Breadcrumbs::getInstance(); } else { - $userTemplatesUserBreadcrumbs = Tdmcreate\Files\Templates\User\Defstyle\Breadcrumbs::getInstance(); + $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Defstyle\Breadcrumbs::getInstance(); } $userTemplatesUserBreadcrumbs->write($module, $moduleDirname . '_breadcrumbs.tpl'); $ret[] = $userTemplatesUserBreadcrumbs->render(); } // Css Admin Styles File - $cssStyles = Tdmcreate\Files\Assets\Css\Admin\CssAdminStyles::getInstance(); + $cssStyles = Modulebuilder\Files\Assets\Css\Admin\CssAdminStyles::getInstance(); $cssStyles->write($module, 'style.css'); $ret[] = $cssStyles->render(); // Css Styles File - $cssStyles = Tdmcreate\Files\Assets\Css\CssStyles::getInstance(); + $cssStyles = Modulebuilder\Files\Assets\Css\CssStyles::getInstance(); $cssStyles->write($module, 'style.css'); $ret[] = $cssStyles->render(); // Include Jquery File - $JavascriptJQuery = Tdmcreate\Files\Assets\Js\JavascriptJQuery::getInstance(); + $JavascriptJQuery = Modulebuilder\Files\Assets\Js\JavascriptJQuery::getInstance(); $JavascriptJQuery->write($module, 'functions.js'); $ret[] = $JavascriptJQuery->render(); // Include Common File - $includeCommon = Tdmcreate\Files\Includes\IncludeCommon::getInstance(); + $includeCommon = Modulebuilder\Files\Includes\IncludeCommon::getInstance(); $includeCommon->write($module, $table, 'common.php'); $ret[] = $includeCommon->render(); // Common Config File - $includeConfig = Tdmcreate\Files\Config\ConfigConfig::getInstance(); + $includeConfig = Modulebuilder\Files\Config\ConfigConfig::getInstance(); $includeConfig->write($module, $tables, 'config.php'); $ret[] = $includeConfig->render(); // Docs Changelog File - $docsChangelog = Tdmcreate\Files\Docs\DocsChangelog::getInstance(); + $docsChangelog = Modulebuilder\Files\Docs\DocsChangelog::getInstance(); $docsChangelog->write($module, 'changelog.txt'); $ret[] = $docsChangelog->render(); // Language Help File - $languageHelp = Tdmcreate\Files\Language\LanguageHelp::getInstance(); + $languageHelp = Modulebuilder\Files\Language\LanguageHelp::getInstance(); $languageHelp->write($module, 'help.html'); $ret[] = $languageHelp->render(); // User Xoops Version File - $userXoopsVersion = Tdmcreate\Files\User\UserXoopsVersion::getInstance(); + $userXoopsVersion = Modulebuilder\Files\User\UserXoopsVersion::getInstance(); $userXoopsVersion->write($module, $table, $tables, 'xoops_version.php'); $ret[] = $userXoopsVersion->render(); @@ -682,14 +682,14 @@ public function setCommonFiles($module) { $moduleName = $module->getVar('mod_dirname'); - //$src_path = XOOPS_ROOT_PATH . '/modules/tdmcreate/files'; - //$tmp_path = XOOPS_UPLOAD_PATH . '/tdmcreate/temp'; + //$src_path = XOOPS_ROOT_PATH . '/modules/modulebuilder/files'; + //$tmp_path = XOOPS_UPLOAD_PATH . '/modulebuilder/temp'; $upl_path = TDMC_UPLOAD_REPOSITORY_PATH . '/' . mb_strtolower($moduleName); $patterns = [ - mb_strtolower('tdmcreate') => mb_strtolower($moduleName), - mb_strtoupper('tdmcreate') => mb_strtoupper($moduleName), - ucfirst(mb_strtolower('tdmcreate')) => ucfirst(mb_strtolower($moduleName)), + mb_strtolower('modulebuilder') => mb_strtolower($moduleName), + mb_strtoupper('modulebuilder') => mb_strtoupper($moduleName), + ucfirst(mb_strtolower('modulebuilder')) => ucfirst(mb_strtolower($moduleName)), ]; $patKeys = array_keys($patterns); @@ -702,7 +702,7 @@ public function setCommonFiles($module) 'rcode' => true ]; foreach ($cloneFolders as $folder) { - Tdmcreate\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues); + Modulebuilder\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues); } unset($cloneFolders); @@ -730,7 +730,7 @@ public function setCommonFiles($module) 'rcode' => false ]; foreach ($cloneFolders as $folder) { - Tdmcreate\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues); + Modulebuilder\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues); } unset($cloneFolders); } @@ -755,7 +755,7 @@ public function setCommonFiles($module) 'rcode' => true ]; foreach ($cloneFiles as $file) { - Tdmcreate\Files\CreateClone::cloneFile($file['src'] . $file['file'], $file['dst'] . $file['file'], $file['rcode'], $patKeys, $patValues); + Modulebuilder\Files\CreateClone::cloneFile($file['src'] . $file['file'], $file['dst'] . $file['file'], $file['rcode'], $patKeys, $patValues); } unset($cloneFiles); } diff --git a/class/Files/CreateClone.php b/class/Files/CreateClone.php index 776c1245..6367c287 100644 --- a/class/Files/CreateClone.php +++ b/class/Files/CreateClone.php @@ -1,7 +1,7 @@ getVar('mod_name'); $dirname = $module->getVar('mod_dirname'); $version = $module->getVar('mod_version'); diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index 45373a2f..810dc542 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -1,8 +1,8 @@ create($moduleDirname, $this->folder, $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, $this->folder, $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/CreatePhpCode.php b/class/Files/CreatePhpCode.php index 957edccf..8775f47f 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -1,8 +1,8 @@ add(new \Criteria('table_mid', $mId)); // $mId = module Id $criteria->setSort($sort); $criteria->setOrder($order); - $tables = Tdmcreate\Helper::getInstance()->getHandler('tables')->getObjects($criteria); + $tables = Modulebuilder\Helper::getInstance()->getHandler('tables')->getObjects($criteria); unset($criteria); return $tables; @@ -91,7 +91,7 @@ public function getTableFields($mId, $tId, $sort = 'field_id ASC, field_name', $ $criteria->add(new \Criteria('field_tid', $tId)); // $tId = table Id $criteria->setSort($sort); $criteria->setOrder($order); - $fields = Tdmcreate\Helper::getInstance()->getHandler('fields')->getObjects($criteria); + $fields = Modulebuilder\Helper::getInstance()->getHandler('fields')->getObjects($criteria); unset($criteria); return $fields; @@ -120,7 +120,7 @@ public function getTableFieldElements($mId = null, $tId = null, $sort = 'fieldel $criteria->setSort($sort); $criteria->setOrder($order); } - $fieldElements = Tdmcreate\Helper::getInstance()->getHandler('fieldelements')->getObjects($criteria); + $fieldElements = Modulebuilder\Helper::getInstance()->getHandler('fieldelements')->getObjects($criteria); unset($criteria); return $fieldElements; @@ -141,7 +141,7 @@ public function getTableMoreFiles($mId, $sort = 'file_id ASC, file_name', $order $criteria->add(new \Criteria('file_mid', $mId)); // $mId = module Id $criteria->setSort($sort); $criteria->setOrder($order); - $morefiles = Tdmcreate\Helper::getInstance()->getHandler('morefiles')->getObjects($criteria); + $morefiles = Modulebuilder\Helper::getInstance()->getHandler('morefiles')->getObjects($criteria); unset($criteria); return $morefiles; diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 27398061..0b0f9c8a 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1,8 +1,8 @@ getPhpCodeCaseSwitch($cases, $defaultAfterCase, $default, $t . "\t"); return $pc->getPhpCodeSwitch($op, $contentSwitch, $t); @@ -185,7 +185,7 @@ public function getXcGetItemIds($var = '', $anchor = '', $param1 = null, $param2 */ public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t = '') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); $rightField = $tf->getRightString($fieldName); $ucfRightField = ucfirst($rightField); $value = "date_create_from_format(_SHORTDATESTRING, Request::getString('{$fieldName}'))"; @@ -205,7 +205,7 @@ public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName */ public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t = '') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); $rightField = $tf->getRightString($fieldName); $ucfRightField = ucfirst($rightField); $request = "Request::getArray('{$fieldName}')"; @@ -340,7 +340,7 @@ public function getXcFormatTimeStamp($left, $value, $format = 's', $t = '') */ public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); $fieldParent = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldNameParent, true, ''); $ret .= $this->getXcHandlerGet($rpFieldName, $fieldParent, '', $tableNameTopic . 'Handler', false, $t); @@ -362,7 +362,7 @@ public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableN */ public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableSoleNameTopic, $tableNameTopic, $fieldNameParent, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $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'); @@ -384,7 +384,7 @@ public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $ */ public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldName, $t); $getVarFromID = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true, ''); $rightGet = $this->getXcAnchorFunction($anchor . 'Handler', 'get' . $var . 'FromId', $getVarFromID); @@ -404,7 +404,7 @@ public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, */ public function getXcGetVarUploadImage($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldName, $t); $ret .= $this->getXcGetVar($fieldName, "\${$tableName}All[\$i]", $fieldName, false, ''); $ret .= $pc->getPhpCodeTernaryOperator("{$lpFieldName}['{$rpFieldName}']", "\${$fieldName}", "\${$fieldName}", "'blank.gif'", $t); @@ -436,7 +436,7 @@ public function getXcGetVarUrlFile($lpFieldName, $rpFieldName, $tableName, $fiel */ public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $getVar = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true, ''); return $t . $pc->getPhpCodeStripTags("{$lpFieldName}['{$rpFieldName}']", $getVar, false, $t); @@ -490,7 +490,7 @@ public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, $t = '' */ public function getXcUserHeader($moduleDirname, $tableName) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeIncludeDir('__DIR__', 'header'); $ret .= $this->getXcXoopsOptionTemplateMain($moduleDirname, $tableName); $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); @@ -505,7 +505,7 @@ public function getXcUserHeader($moduleDirname, $tableName) */ public function getXcPermissionsHeader() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Permission'); $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); $ret .= $this->getXcXoopsHandler('groupperm'); @@ -584,7 +584,7 @@ public function getXcGetFieldParentId($fields) */ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName, $fields) { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ret = ''; $fieldMain = ''; $countUploader = 0; @@ -887,7 +887,7 @@ public function getXcGetValues($tableName, $tableSoleName, $index = 'i', $noArra */ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $fields) { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ret = ''; $fieldMain = ''; $countUploader = 0; @@ -942,7 +942,7 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, */ public function getXcSecurity($tableName, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $securityError = $this->getXcXoopsSecurityErrors(); $implode = $pc->getPhpCodeImplode(',', $securityError); $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '', 3, $implode, $t); @@ -960,7 +960,7 @@ public function getXcSecurity($tableName, $t = '') */ public function getXcInsertData($tableName, $language, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '?op=list', 2, "{$language}FORM_OK"); $handlerInsert = $this->getXcHandlerInsert($tableName, $tableName, 'Obj'); @@ -1003,8 +1003,8 @@ public function getXcRedirectHeader($directory, $options, $numb, $var, $isString public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $options = 'delete', $t = '') { $stuOptions = mb_strtoupper($options); - $ccFieldId = Tdmcreate\Files\CreateFile::getInstance()->getCamelCase($fieldId, false, true); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $ccFieldId = Modulebuilder\Files\CreateFile::getInstance()->getCamelCase($fieldId, false, true); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $array = "array('ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'op' => '{$options}')"; $server = $pc->getPhpCodeGlobalsVariables('REQUEST_URI', 'SERVER'); $getVar = $this->getXcGetVar('', $tableName . 'Obj', $fieldMain, true, ''); @@ -1065,7 +1065,7 @@ public function getXcGetForm($left, $tableName, $obj = '', $t = '') */ public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, $t = '') { - $ret = Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); + $ret = Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); $paramGet = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldNameParent, true, ''); $ret .= $this->getXcHandlerGet($rpFieldName, $paramGet, '', $tableNameTopic . 'Handler', false, $t); $ret .= $this->getXcGetVar("\${$lpFieldName}['{$rpFieldName}']", "\${$rpFieldName}", $fieldNameTopic, false, $t); @@ -1084,7 +1084,7 @@ public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNam */ public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldName, $t); $ret .= $this->getXcGetVar($fieldName, "\${$tableName}All[\$i]", $fieldName, false, ''); $ret .= $pc->getPhpCodeTernaryOperator('uploadImage', "\${$fieldName}", "\${$fieldName}", "'blank.gif'", $t); @@ -1144,7 +1144,7 @@ public function getXcSaveFieldMain($fields) */ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t = '') { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ret = ''; $fieldMain = ''; $countUploader = 0; @@ -1211,8 +1211,8 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f */ public function getXcPageNav($tableName, $t = '', $paramStart = 'start', $paramOp = "'op=list&limit=' . \$limit") { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Display Navigation', null, $t); $condition = $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/pagenav', true, false, 'include', $t . "\t"); $condition .= $cxc->getClassXoopsPageNav('pagenav', $tableName . 'Count', 'limit', 'start', $paramStart, $paramOp, false, $t . "\t"); @@ -1690,8 +1690,8 @@ public function getXcXoopsHandler($left, $t = '', $n = "\n") */ public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\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); @@ -1709,8 +1709,8 @@ public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') */ public function getXcCommonPagesNew($tableName, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\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); @@ -1731,9 +1731,9 @@ public function getXcCommonPagesNew($tableName, $t = '') */ public function getXcCommonPagesDelete($language, $tableName, $fieldId, $fieldMain, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cf = Tdmcreate\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $cf = Modulebuilder\Files\CreateFile::getInstance(); $ccFieldId = $cf->getCamelCase($fieldId, false, true); $ret = $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', '', $t); $reqOk = "_REQUEST['ok']"; diff --git a/class/Files/Docs/DocsChangelog.php b/class/Files/Docs/DocsChangelog.php index 7199a0cf..b96a070c 100644 --- a/class/Files/Docs/DocsChangelog.php +++ b/class/Files/Docs/DocsChangelog.php @@ -1,9 +1,9 @@ getVar('mod_author')}) EOT; - $this->create($moduleDirname, 'docs', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $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 c0277b96..46d1b0cf 100644 --- a/class/Files/Docs/DocsFiles.php +++ b/class/Files/Docs/DocsFiles.php @@ -1,9 +1,9 @@ getLangDiffFile($mod_version); break; } - $this->create($moduleDirname, 'docs', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'docs', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Includes/IncludeCommentFunctions.php b/class/Files/Includes/IncludeCommentFunctions.php index 6b088bba..b4d6e63e 100644 --- a/class/Files/Includes/IncludeCommentFunctions.php +++ b/class/Files/Includes/IncludeCommentFunctions.php @@ -1,9 +1,9 @@ getVar('mod_dirname'); $tableName = $table->getVar('table_name'); @@ -117,7 +117,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getCommentBody($module, $table); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Includes/IncludeComments.php b/class/Files/Includes/IncludeComments.php index a3fc8ba5..6ff6c05c 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -1,9 +1,9 @@ getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); $content .= $pc->getPhpCodeIncludeDir("__DIR__ . '/../../../mainfile.php'",'',true, true); $content .= $pc->getPhpCodeIncludeDir("XOOPS_ROOT_PATH.'/include/{$filename}.php'",'',true, true); - $this->create($moduleDirname, 'include', $filename . '.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename . '.php', $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } @@ -95,8 +95,8 @@ public function renderCommentsIncludes($module, $filename) */ public function renderCommentsNew($module, $filename) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $table = $this->getTable(); $moduleDirname = mb_strtolower($module->getVar('mod_dirname')); $tableName = $table->getVar('table_name'); @@ -118,7 +118,7 @@ public function renderCommentsNew($module, $filename) $contIf .= $pc->getPhpCodeIncludeDir("XOOPS_ROOT_PATH.'/include/{$filename}.php'",'',true, true, '',"\t"); $content .= $pc->getPhpCodeConditions('$com_itemid',' > ', '0', $contIf); - $this->create($moduleDirname, 'include', $filename . '.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename . '.php', $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } @@ -137,27 +137,27 @@ public function renderCommentsNew($module, $filename) switch($filename) { case 'comment_edit.php': $content .= $this->getCommentsIncludes('comment_edit'); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->render(); break; case 'comment_delete.php': $content .= $this->getCommentsIncludes('comment_delete'); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->render(); break; case 'comment_post.php': $content .= $this->getCommentsIncludes('comment_post'); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->render(); break; case 'comment_reply.php': $content .= $this->getCommentsIncludes('comment_reply'); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->render(); break; case 'comment_new.php': $content .= $this->getCommentsNew($moduleDirname, 'comment_new'); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->render(); break; } diff --git a/class/Files/Includes/IncludeCommon.php b/class/Files/Includes/IncludeCommon.php index 105d0956..5180949d 100644 --- a/class/Files/Includes/IncludeCommon.php +++ b/class/Files/Includes/IncludeCommon.php @@ -1,9 +1,9 @@ getTable(); $moduleDirname = $module->getVar('mod_dirname'); $stuModuleDirname = mb_strtoupper($moduleDirname); @@ -151,7 +151,7 @@ public function render() $filename = $this->getFileName(); $content = $this->getHeaderFilesComments($module); $content .= $this->getCommonCode($module); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Includes/IncludeFunctions.php b/class/Files/Includes/IncludeFunctions.php index 0c387057..26d6664c 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -1,9 +1,9 @@ getPhpCodeCommentMultiLine(['function' => 'add selected cats to block', '' => '', '@param $cats' => '', '@return' => 'string']); @@ -101,8 +101,8 @@ private function getFunctionBlock($moduleDirname) */ private function getFunctionGetMyItemIds($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $t = "\t"; $ret = $pc->getPhpCodeCommentMultiLine(['Get the permissions ids' => '', '' => '', '@param $permtype' => '', '@param $dirname' => '', '@return' => 'mixed $itemIds']); @@ -422,7 +422,7 @@ public function render() $content .= $this->getRewriteUrl($moduleDirname, $tableName); $content .= $this->getRewriteFilter($moduleDirname, $tableName); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Includes/IncludeJquery.php b/class/Files/Includes/IncludeJquery.php index aa4c028d..1c6434b9 100644 --- a/class/Files/Includes/IncludeJquery.php +++ b/class/Files/Includes/IncludeJquery.php @@ -1,9 +1,9 @@ tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); + $this->tdmcfile = Modulebuilder\Files\CreateFile::getInstance(); } /** @@ -91,7 +91,7 @@ public function render() $( ".toolbar" ).css("color","#000").buttonset(); }); EOT; - $this->tdmcfile->create($moduleDirname, 'assets/js', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $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 36c8981f..c789cfb2 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -1,9 +1,9 @@ getTables(); $t = "\t"; @@ -160,7 +160,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getNotificationsFunction($moduleDirname); - $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index 58d4bc16..32783619 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -1,9 +1,9 @@ tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); + $this->tdmcfile = Modulebuilder\Files\CreateFile::getInstance(); } /** @@ -82,8 +82,8 @@ public function write($module, $tables, $filename) */ public function getSearchFunction($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucfModuleDirname = ucfirst($moduleDirname); $tables = $this->getTables(); $t = "\t"; @@ -191,7 +191,7 @@ public function getSearchFunction($moduleDirname) */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -199,7 +199,7 @@ public function render() $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); $content .= $this->getSearchFunction($moduleDirname); - $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); } diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 15a1c379..32a85020 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -1,9 +1,9 @@ defines->getBlankLine(); $ret .= $pc->getPhpCodeIncludeDir("'common.php'",'', true, true, 'include'); $ret .= $this->defines->getBlankLine(); @@ -183,7 +183,7 @@ public function getLanguageAdminClass($language, $tables) $rpFieldName = $this->getRightString($fieldName); if ($fieldElement > 16) { - $fieldElements = Tdmcreate\Helper::getInstance()->getHandler('fieldelements')->get($fieldElement); + $fieldElements = Modulebuilder\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); @@ -329,7 +329,7 @@ public function render() } $content .= $this->getLanguageAdminFoot($language); - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index 65c1e1ee..33837d5d 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -1,9 +1,9 @@ getLanguageBlock($language); $content .= $this->getLanguageFooter(); - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Language/LanguageDefines.php b/class/Files/Language/LanguageDefines.php index aed1d68e..4eb030c2 100644 --- a/class/Files/Language/LanguageDefines.php +++ b/class/Files/Language/LanguageDefines.php @@ -1,8 +1,8 @@

    Features

    - The TDMCreate module continues to expand, to get to the conditions to create modules, more and more sophisticated.
    + 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

    @@ -114,9 +114,9 @@ public function render() EOT; if ('english' !== $language) { - $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); } - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/help', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/help', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Language/LanguageMailTpl.php b/class/Files/Language/LanguageMailTpl.php index e467b1cc..b516bcdd 100644 --- a/class/Files/Language/LanguageMailTpl.php +++ b/class/Files/Language/LanguageMailTpl.php @@ -1,9 +1,9 @@ create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/mail_template', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/mail_template', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index cf82f0cc..970419e0 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -1,9 +1,9 @@ getVar('mod_name'); $tables = $this->getTables(); @@ -100,7 +100,7 @@ private function getLanguageMain($module, $language) $language, 'INDEX_DESC', "Welcome to the homepage of your new module {$moduleName}!
    -As you can see, you have created a page with a list of links at the top to navigate between the pages of your module. This description is only visible on the homepage of this module, the other pages you will see the content you created when you built this module with the module TDMCreate, and after creating new content in admin of this module. In order to expand this module with other resources, just add the code you need to extend the functionality of the same. The files are grouped by type, from the header to the footer to see how divided the source code.

    If you see this message, it is because you have not created content for this module. Once you have created any type of content, you will not see this message.

    If you liked the module TDMCreate 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 TDMCreate and make a donation using this button Button Donations
    Thanks!

    Use the link below to go to the admin and create content.", +As you can see, you have created a page with a list of links at the top to navigate between the pages of your module. This description is only visible on the homepage of this module, the other pages you will see the content you created when you built this module with the module ModuleBuilder, and after creating new content in admin of this module. In order to expand this module with other resources, just add the code you need to extend the functionality of the same. The files are grouped by type, from the header to the footer to see how divided the source code.

    If you see this message, it is because you have not created content for this module. Once you have created any type of content, you will not see this message.

    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!

    Use the link below to go to the admin and create content.", true ); $ret .= $this->defines->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); @@ -189,7 +189,7 @@ public function render() $content .= $this->getLanguageMain($module, $language); $content .= $this->getLanguageMainFooter($language); - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 11901746..f3f62c76 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -1,9 +1,9 @@ getBlankLine(); $ret .= $pc->getPhpCodeIncludeDir("'common.php'",'', true, true, 'include'); $ret .= $df->getBlankLine(); @@ -105,7 +105,7 @@ private function getLanguageMain($language, $module) */ private function getLanguageMenu($module, $language) { - $df = Tdmcreate\Files\Language\LanguageDefines::getInstance(); + $df = Modulebuilder\Files\Language\LanguageDefines::getInstance(); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $menu = 1; $ret = $df->getAboveHeadDefines('Admin Menu'); @@ -529,7 +529,7 @@ public function render() } $content .= $this->getLanguageFooter(); - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Sql/SqlFile.php b/class/Files/Sql/SqlFile.php index 591ef6c3..bc81510a 100644 --- a/class/Files/Sql/SqlFile.php +++ b/class/Files/Sql/SqlFile.php @@ -1,9 +1,9 @@ getHeaderSqlComments($moduleName); $content .= $this->getDatabaseTables($module); - $this->create($moduleDirname, 'sql', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'sql', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminAbout.php b/class/Files/Templates/Admin/TemplatesAdminAbout.php index 6ec51f14..72f4d43d 100644 --- a/class/Files/Templates/Admin/TemplatesAdminAbout.php +++ b/class/Files/Templates/Admin/TemplatesAdminAbout.php @@ -1,9 +1,9 @@ getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -85,7 +85,7 @@ public function render() $content .= $hc->getHtmlComment('Footer', '', "\n"); $content .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index 14449626..b7233214 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -1,9 +1,9 @@ getHtmlComment('Header', '',"\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); @@ -93,8 +93,8 @@ private function getTemplatesAdminBrokenHeader($moduleDirname) */ private function getTemplatesAdminBrokenTableThead($language, $t) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $th = ''; $lang = $sc->getSmartyConst($language, 'BROKEN_TABLE'); @@ -121,8 +121,8 @@ private function getTemplatesAdminBrokenTableThead($language, $t) */ private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $td = ''; $doubleKey = $sc->getSmartyDoubleVar($tableSoleName, 'key'); @@ -161,7 +161,7 @@ private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $ */ private function getTemplatesAdminBrokenTable($moduleDirname, $tableName, $tableSoleName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $tbody = $this->getTemplatesAdminBrokenTableThead($language, "\t\t"); $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $language, "\t\t"); $ret = $hc->getHtmlTable($tbody, 'table table-bordered', "\t"); @@ -181,8 +181,8 @@ private function getTemplatesAdminBrokenTable($moduleDirname, $tableName, $table */ private function getTemplatesAdminBrokenList($moduleDirname, $table, $language, $t = '') { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); $ucfTableName = ucfirst($tableName); @@ -214,8 +214,8 @@ private function getTemplatesAdminBrokenList($moduleDirname, $table, $language, */ private function getTemplatesAdminBrokenFooter($moduleDirname) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $single = $sc->getSmartySingleVar('error'); $strong = $hc->getHtmlTag('strong', [], $single, false, '', ''); $div = $hc->getHtmlDiv($strong, 'errorMsg', "\t", "\n"); @@ -247,7 +247,7 @@ public function render() } $content .= $this->getTemplatesAdminBrokenFooter($moduleDirname); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminFooter.php b/class/Files/Templates/Admin/TemplatesAdminFooter.php index bc70e4b6..ab75659e 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -1,9 +1,9 @@ getModule(); $filename = $this->getFileName(); $moduleName = $module->getVar('mod_name'); @@ -89,7 +89,7 @@ public function render() $tree .= $hc->getHtmlTag('a', ['href' => '<{$maintainedby}>', 'title' => 'Visit ' . $supportName, 'class' => 'tooltip', 'rel' => 'external'], $supportName); $content .= $hc->getHtmlTag('div', ['class' => 'center smallsmall italic pad5'], "\n\t" . $tree); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminHeader.php b/class/Files/Templates/Admin/TemplatesAdminHeader.php index 74a92b81..ee79a49e 100644 --- a/class/Files/Templates/Admin/TemplatesAdminHeader.php +++ b/class/Files/Templates/Admin/TemplatesAdminHeader.php @@ -1,9 +1,9 @@ getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -85,7 +85,7 @@ public function render() $due .= $sc->getSmartyConditions('buttons', '', '', $right, '', '', '', "\t", "\n"); $content = $hc->getHtmlDiv($due, 'top'); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index 2c4fc60c..9c58e118 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -1,9 +1,9 @@ getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); @@ -86,7 +86,7 @@ public function render() $content .= $hc->getHtmlComment('Footer', '', "\n"); $content .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index d77136d3..d2d6bcb7 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -1,9 +1,9 @@ getHtmlComment('Header', '',"\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); @@ -93,8 +93,8 @@ private function getTemplatesAdminPagesHeader($moduleDirname) */ private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $th = ''; $langHeadId = mb_strtoupper($tableSoleName) . '_ID'; if (1 == $tableAutoincrement) { @@ -131,8 +131,8 @@ private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincr */ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $td = ''; if (1 == $tableAutoincrement) { $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); @@ -225,7 +225,7 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t */ private function getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $tbody = $this->getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language); $tbody .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields); @@ -244,8 +244,8 @@ private function getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableS */ private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $htmlTable = $this->getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language); $htmlTable .= $hc->getHtmlTag('div', ['class' => 'clear'], ' ', false, "\t"); $single = $sc->getSmartySingleVar('pagenav'); @@ -271,8 +271,8 @@ private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleNa */ private function getTemplatesAdminPagesFooter($moduleDirname) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $ret = $hc->getHtmlComment('Footer', '', "\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); @@ -296,7 +296,7 @@ public function render() $content .= $this->getTemplatesAdminPages($moduleDirname, $table->getVar('table_name'), $table->getVar('table_solename'), $table->getVar('table_autoincrement'), $fields, $language); $content .= $this->getTemplatesAdminPagesFooter($moduleDirname); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Admin/TemplatesAdminPermissions.php b/class/Files/Templates/Admin/TemplatesAdminPermissions.php index 25e09d2c..b66ceab8 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -1,9 +1,9 @@ getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); } @@ -86,8 +86,8 @@ private function getTemplatesAdminPermissionsHeader($moduleDirname) */ private function getTemplatesAdminPermissions() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $form = $sc->getSmartySingleVar('form'); $ret = $hc->getHtmlTag('div', ['class' => 'spacer'], $form, '', '', "\n\n"); return $ret; @@ -101,7 +101,7 @@ private function getTemplatesAdminPermissions() */ private function getTemplatesAdminPermissionsFooter($moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); return $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); } @@ -119,7 +119,7 @@ public function render() $content .= $this->getTemplatesAdminPermissions(); $content .= $this->getTemplatesAdminPermissionsFooter($moduleDirname); - $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 47b46447..77020860 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -1,9 +1,9 @@ getHtmlTableHead(' ', '', '', "\t\t\t"); @@ -110,8 +110,8 @@ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $t */ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $td = ''; if (1 == $tableAutoincrement) { $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); @@ -184,7 +184,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi */ private function getTemplatesBlocksTableTfoot() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $td = $hc->getHtmlTag('td', [], " ", false, '', ''); $tr = $hc->getHtmlTag('tr', [], $td, false, '', ''); @@ -204,8 +204,8 @@ private function getTemplatesBlocksTableTfoot() */ private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $tbody = $this->getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement); $tbody .= $this->getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement); $tbody .= $this->getTemplatesBlocksTableTfoot(); @@ -234,7 +234,7 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MB'); $content = $this->getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); - $this->create($moduleDirname, 'templates/blocks', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates/blocks', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index b3c4de44..2b4b6e24 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -1,10 +1,10 @@ getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $title = $sc->getSmartyDoubleVar('itm', 'title'); $titleElse = $sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n") ; $link = $sc->getSmartyDoubleVar('itm', 'link'); @@ -93,7 +93,7 @@ public function render() $content = $hc->getHtmlOl($into, 'breadcrumb'); - $tf->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $tf->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $tf->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index 4763d59f..b37e1b47 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -1,10 +1,10 @@ getSmartyIncludeFile($moduleDirname, 'header') . PHP_EOL; } @@ -91,8 +91,8 @@ private function getTemplatesUserCategoriesHeader($moduleDirname) */ private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $single = $sc->getSmartySingleVar('table_type'); $table = $this->getTemplatesAdminPagesTableThead($tableName, $language); $table .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $language); @@ -108,8 +108,8 @@ private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $ta */ private function getTemplatesUserCategoriesThead($tableName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $stuTableName = mb_strtoupper($tableName); $lang = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); $single = $sc->getSmartySingleVar('numb_col'); @@ -128,8 +128,8 @@ private function getTemplatesUserCategoriesThead($tableName, $language) */ private function getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $single = $sc->getSmartySingleVar('panel_type'); $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); $div = $hc->getHtmlDiv($include, 'panel panel-' . $single); @@ -148,7 +148,7 @@ private function getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $ta */ private function getTemplatesUserCategoriesTfoot() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $td = $hc->getHtmlTableData(' ') . PHP_EOL; $tr = $hc->getHtmlTableRow($td) . PHP_EOL; @@ -165,8 +165,8 @@ private function getTemplatesUserCategoriesTfoot() */ private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSoleName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $tab = $this->getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) . PHP_EOL; $div = $hc->getHtmlDiv($tab, 'table-responsive') . PHP_EOL; @@ -197,8 +197,8 @@ private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $ta <{/foreach}> \n EOT;*/ - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $incl = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; $html = $hc->getHtmlEmpty('
    ') . PHP_EOL; $incl .= $sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$numb_col', $html) . PHP_EOL; @@ -219,7 +219,7 @@ private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $ta */ private function getTemplatesUserCategoriesFooter($moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); } @@ -241,7 +241,7 @@ public function render() $content .= $this->getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language); $content .= $this->getTemplatesUserCategoriesFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php index e82857f7..8f0759f8 100644 --- a/class/Files/Templates/User/Defstyle/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -1,10 +1,10 @@ getTableFields($tableMid, $tableId); $ret = ''; $retElem = ''; @@ -300,7 +300,7 @@ public function render() } } - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index 8d2539a5..eef5fa52 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -1,9 +1,9 @@ getHtmlDiv('<{$copyright}>', 'pull-left', '', "\n", false); $ret .= $hc->getHtmlEmpty("\n"); $contIf = $hc->getHtmlDiv('<{$pagenav}>', 'pull-right', "\t", "\n", false); @@ -138,7 +138,7 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getTemplateUserFooterContent($moduleDirname, $language); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php index 1c03d287..5d5682dd 100644 --- a/class/Files/Templates/User/Defstyle/Header.php +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -1,9 +1,9 @@ tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); - $this->htmlcode = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $this->tdmcfile = Modulebuilder\Files\CreateFile::getInstance(); + $this->htmlcode = Modulebuilder\Files\CreateHtmlCode::getInstance(); } /** @@ -80,8 +80,8 @@ public function write($module, $filename) */ public function getTemplatesUserHeader($moduleDirname) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $ret = $sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, true, '', "\n\n"); $var = $sc->getSmartySingleVar('ads', '', ''); $div = $hc->getHtmlDiv($var, 'center', "\t","\n", false) ; @@ -126,7 +126,7 @@ public function render() //$language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getTemplatesUserHeader($moduleDirname); - $this->tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->tdmcfile->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 26281eb2..afd7e669 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -1,9 +1,9 @@ getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); } @@ -90,8 +90,8 @@ public function getTemplateUserIndexHeader($moduleDirname) */ public function getTemplatesUserIndexIntro($module, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $ret = $hc->getHtmlEmpty('','',"\n"); @@ -143,8 +143,8 @@ public function getTemplatesUserIndexIntro($module, $language) */ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language, $t = '') { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $double = $sc->getSmartyConst($language, 'INDEX_LATEST_LIST'); $ret = $hc->getHtmlDiv($double, "{$moduleDirname}-linetitle", $t, "\n", false); @@ -170,7 +170,7 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole */ public function getTemplateUserIndexFooter($moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); return $sc->getSmartyIncludeFile($moduleDirname, 'footer'); } @@ -199,7 +199,7 @@ public function render() } $content .= $this->getTemplateUserIndexFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php index 345d6bf4..e422ebd7 100644 --- a/class/Files/Templates/User/Defstyle/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -1,9 +1,9 @@ getVar('mod_dirname'); $content = $this->getTemplatesUserMoreFile(); - $this->create($moduleDirname, $this->folder, $filename . '.' . $this->extension, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, $this->folder, $filename . '.' . $this->extension, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index d8e04706..ab5692e2 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -1,9 +1,9 @@ getSmartyIncludeFile($moduleDirname, 'header', '','','',"\n\n"); } @@ -90,8 +90,8 @@ private function getTemplatesUserPagesHeader($moduleDirname) */ private function getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $tbody = $this->getTemplatesUserPagesTableThead($tableName, $language); $tbody .= $this->getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName); $tbody .= $this->getTemplatesUserPagesTableTfoot(); @@ -108,8 +108,8 @@ private function getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSo */ private function getTemplatesUserPagesTableThead($tableName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $stuTableName = mb_strtoupper($tableName); $single = $sc->getSmartySingleVar('divideby'); $lang = $sc->getSmartyConst($language, $stuTableName . '_TITLE'); @@ -128,8 +128,8 @@ private function getTemplatesUserPagesTableThead($tableName, $language) */ private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $single = $sc->getSmartySingleVar('panel_type'); $include = $sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName, "\t\t\t\t\t\t", "\n"); $div = $hc->getHtmlDiv($include, 'panel panel-' . $single, "\t\t\t\t\t", "\n"); @@ -149,7 +149,7 @@ private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $ta */ private function getTemplatesUserPagesTableTfoot() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); $td = $hc->getHtmlTableData(" ", '', '', '', ''); $tr = $hc->getHtmlTableRow($td, '', '', ''); @@ -166,8 +166,8 @@ private function getTemplatesUserPagesTableTfoot() */ private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleName, $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $table = $this->getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language); $div = $hc->getHtmlDiv($table, 'table-responsive'); @@ -184,7 +184,7 @@ private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleNam */ private function getTemplatesUserPagesForm($t = '') { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $var = $sc->getSmartySingleVar('form', "\t", "\n"); return $sc->getSmartyConditions('form', '', '', $var, false, false, true); @@ -200,7 +200,7 @@ private function getTemplatesUserPagesForm($t = '') */ private function getTemplatesUserPagesError($t = '') { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $var = $sc->getSmartySingleVar('error', "\t", "\n"); return $sc->getSmartyConditions('error', '', '', $var, false, false, true); @@ -214,8 +214,8 @@ private function getTemplatesUserPagesError($t = '') */ private function getTemplatesUserPagesFooter($moduleDirname) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); + $hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); $ret = $hc->getHtmlEmpty('', '', "\n"); $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer'); @@ -243,7 +243,7 @@ public function render() $content .= $this->getTemplatesUserPagesError(); $content .= $this->getTemplatesUserPagesFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index c6e8ec5f..d1dbf3bb 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -1,9 +1,9 @@ getTableFields($tableMid, $tableId); $ret = ''; $retNumb = ''; @@ -184,7 +184,7 @@ public function render() $content .= $this->getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); } - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php index c64ae20e..149017de 100644 --- a/class/Files/Templates/User/Defstyle/Pdf.php +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -1,9 +1,9 @@ getVar('mod_dirname'); $content = $this->getTemplatesUserPdfBody(); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php index 596cb4e9..d837403d 100644 --- a/class/Files/Templates/User/Defstyle/Rate.php +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -1,9 +1,9 @@ getTemplatesUserRateFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Rss.php b/class/Files/Templates/User/Defstyle/Rss.php index 0a9489aa..f9ed4eca 100644 --- a/class/Files/Templates/User/Defstyle/Rss.php +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -1,9 +1,9 @@ getLanguage($moduleDirname, 'MA'); $content = $this->getTemplatesUserRssXml(); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/Search.php b/class/Files/Templates/User/Defstyle/Search.php index e8dfb4c5..c8715451 100644 --- a/class/Files/Templates/User/Defstyle/Search.php +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -1,9 +1,9 @@ getTemplatesUserSearchFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index 4d69e091..9cba5b6c 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -1,9 +1,9 @@ getTemplatesUserPrintFooter($moduleDirname); - $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserFooter.php b/class/Files/User/UserFooter.php index 17659e54..9609953f 100644 --- a/class/Files/User/UserFooter.php +++ b/class/Files/User/UserFooter.php @@ -1,9 +1,9 @@ getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs', true, "\t"); $ret = $pc->getPhpCodeConditions('count($xoBreadcrumbs)', ' > ', '1', $xoBreadcrumbs); @@ -105,7 +105,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getUserFooter($moduleDirname); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserHeader.php b/class/Files/User/UserHeader.php index fc687406..7d42199e 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -1,9 +1,9 @@ getPhpCodeIncludeDir('dirname(dirname(__DIR__))', 'mainfile'); $ret .= $pc->getPhpCodeIncludeDir('__DIR__', 'include/common'); @@ -131,7 +131,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getUserHeader($moduleDirname); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index e9346d3f..54f3eafc 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -1,9 +1,9 @@ getInclude(); $ret .= $uxc->getUserTplMain($moduleDirname); @@ -107,8 +107,8 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS $fieldParentId[] = $fields[$f]->getVar('field_parent'); } $ret = ''; - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); if (in_array(1, $fieldParentId)) { $ret .= $xc->getXcHandlerCountObj($tableName); $ret .= $pc->getPhpCodeCommentLine('If there are ', $tableName); @@ -145,8 +145,8 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS */ private function getBodyPagesIndex($moduleDirname, $tableName, $tableSoleName, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $ucfTableName = ucfirst($tableName); $ret = $pc->getPhpCodeCommentLine(); @@ -204,8 +204,8 @@ private function getBodyPagesIndex($moduleDirname, $tableName, $tableSoleName, $ */ private function getUserIndexFooter($moduleDirname, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); @@ -230,7 +230,7 @@ private function getUserIndexFooter($moduleDirname, $language) */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $filename = $this->getFileName(); @@ -258,7 +258,7 @@ public function render() } $content .= $this->getUserIndexFooter($moduleDirname, $language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserListTag.php b/class/Files/User/UserListTag.php index 34b2c732..d020ea0c 100644 --- a/class/Files/User/UserListTag.php +++ b/class/Files/User/UserListTag.php @@ -1,9 +1,9 @@ pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -98,7 +98,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getUserListTag(); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserNotificationUpdate.php b/class/Files/User/UserNotificationUpdate.php index f6d6fbf2..11ba1249 100644 --- a/class/Files/User/UserNotificationUpdate.php +++ b/class/Files/User/UserNotificationUpdate.php @@ -1,9 +1,9 @@ pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -86,7 +86,7 @@ public function render() $content .= $this->pc->getPhpCodeIncludeDir('dirname(dirname(__DIR__))', 'mainfile'); $content .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'include/notification_update'); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 2a24bcd0..372e3d5f 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -1,9 +1,9 @@ getCamelCase($fieldId, false, true); @@ -168,8 +168,8 @@ private function getUserPagesList($tableName, $fieldId, $fieldMain, $t = '') */ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Security Check', '', $t); $xoopsSecurityCheck = $xc->getXcXoopsSecurityCheck(); @@ -237,8 +237,8 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole */ private function getPermissionsSave($moduleDirname, $perm = 'view') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); $ret .= $xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', '$permId', false, "\t\t\t"); @@ -258,8 +258,8 @@ private function getPermissionsSave($moduleDirname, $perm = 'view') */ public function getUserPagesNew($tableName, $language, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Check permissions', '', $t); $contIf = $xc->getXcRedirectHeader($tableName, '?op=list', 3, '_NOPERM', true, $t . "\t"); @@ -278,8 +278,8 @@ public function getUserPagesNew($tableName, $language, $t = '') */ public function getUserPagesEdit($moduleDirname, $tableName, $fieldId, $language, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $pc->getPhpCodeCommentLine('Check permissions', '', $t); @@ -304,8 +304,8 @@ public function getUserPagesEdit($moduleDirname, $tableName, $fieldId, $language */ private function getUserPagesDelete($tableName, $language, $fieldId, $fieldMain, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $pc->getPhpCodeCommentLine('Check permissions', '', $t); @@ -330,8 +330,8 @@ private function getUserPagesDelete($tableName, $language, $fieldId, $fieldMain, */ private function getUserPagesBroken($tableName, $language, $fieldId, $fieldSatus, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $pc->getPhpCodeCommentLine('Check params', '', $t); @@ -375,8 +375,8 @@ private function getUserPagesBroken($tableName, $language, $fieldId, $fieldSatus */ private function getUserPagesFooter($moduleDirname, $tableName, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); @@ -413,7 +413,7 @@ private function getUserPagesFooter($moduleDirname, $tableName, $language) */ private function getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldSatus, $language, $t) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $fields = $this->getTableFields($tableMid, $tableId); $cases['list'] = [$this->getUserPagesList($tableName, $fieldId, $fieldMain, "\t\t")]; @@ -471,7 +471,7 @@ public function render() $content .= $this->getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldSatus, $language, "\t"); $content .= $this->getUserPagesFooter($moduleDirname, $tableName, $language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index d653e90a..86cecd23 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->uxc = UserXoopsCode::getInstance(); } @@ -246,7 +246,7 @@ public function render() $content .= $this->getUserPdfTcpdf($moduleDirname, $tableName, $fields); $content .= $this->getUserPdfFooter($moduleDirname, $tableName); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 8b960d70..7cc6ce1e 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->uxc = UserXoopsCode::getInstance(); } @@ -95,7 +95,7 @@ public function write($module, $table, $filename) */ public function getUserPrint($moduleDirname, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $table = $this->getTable(); $tableName = $table->getVar('table_name'); @@ -183,7 +183,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getUserPrint($moduleDirname, $language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index db1af079..c4920fff 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->uxc = UserXoopsCode::getInstance(); } @@ -100,7 +100,7 @@ public function write($module, $table, $filename) */ public function getUserRateHeader($moduleDirname, $tableName) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); @@ -235,7 +235,7 @@ public function render() //$content .= $this->getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); //$content .= $this->getUserRateFooter($moduleDirname, $language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserRss.php b/class/Files/User/UserRss.php index d640e913..398f860f 100644 --- a/class/Files/User/UserRss.php +++ b/class/Files/User/UserRss.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->uxc = UserXoopsCode::getInstance(); } @@ -93,7 +93,7 @@ public function write($module, $table, $filename) */ public function getUserRss($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $table = $this->getTable(); $tableName = $table->getVar('table_name'); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); @@ -213,7 +213,7 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module); $content .= $this->getUserRss($moduleDirname); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index 76eea160..c2f124b9 100644 --- a/class/Files/User/UserSearch.php +++ b/class/Files/User/UserSearch.php @@ -1,9 +1,9 @@ xoopscode = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->phpcode = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xoopscode = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->phpcode = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->usercode = UserXoopsCode::getInstance(); } @@ -92,7 +92,7 @@ public function write($module, $table, $filename) */ private function getUserSearchHeader($moduleDirname, $table, $fields) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); @@ -186,7 +186,7 @@ public function render() $content .= $this->getUserSearch($moduleDirname, $tableName, $language); $content .= $this->getUserSearchFooter($moduleDirname, $tableName, $language); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserViewTag.php b/class/Files/User/UserViewTag.php index 5c5365df..31892c16 100644 --- a/class/Files/User/UserViewTag.php +++ b/class/Files/User/UserViewTag.php @@ -1,9 +1,9 @@ pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -98,7 +98,7 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getUserViewTag(); - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index 9627df29..6ecd416c 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -1,8 +1,8 @@ getPhpCodeStripTags('', $language . $stuTableName, true); @@ -89,7 +89,7 @@ public function getUserAddMeta($type, $language, $tableName, $t = '') */ public function getUserMetaKeywords($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $implode = $pc->getPhpCodeImplode(',', '$keywords'); return "{$moduleDirname}MetaKeywords(\$helper->getConfig('keywords').', '. {$implode});\n"; @@ -120,7 +120,7 @@ public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') */ public function getUserBreadcrumbs($language, $tableName = 'index', $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $stuTableName = mb_strtoupper($tableName); $title = ["'title'" => "{$language}{$stuTableName}"]; @@ -137,7 +137,7 @@ public function getUserBreadcrumbs($language, $tableName = 'index', $t = '') */ public function getUserBreadcrumbsHeaderFile($moduleDirname, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); $ret .= $pc->getPhpCodeArray('xoBreadcrumbs', null, false, ''); @@ -154,8 +154,8 @@ public function getUserBreadcrumbsHeaderFile($moduleDirname, $language) */ public function getUserBreadcrumbsFooterFile() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $cond = $xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs'); $ret = $pc->getPhpCodeConditions('count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index cfac3751..fd87b9b7 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -1,9 +1,9 @@ getSimpleString(''); - $ret .= Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine(); + $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine(); $ret .= $xc->getXcEqualsOperator('$moduleDirName ', 'basename(__DIR__)'); $ret .= $xc->getXcEqualsOperator('$moduleDirNameUpper', 'mb_strtoupper($moduleDirName)'); $ret .= $this->getDashComment('Informations'); @@ -191,7 +191,7 @@ private function getXoopsVersionMySQL($moduleDirname, $table, $tables) $ret .= $this->getDashComment('Mysql'); $description = "'sql/mysql.sql'"; $ret .= $uxc->getUserModVersionText(2, $description, 'sqlfile', "'mysql'"); - $ret .= Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Tables'); + $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Tables'); foreach (array_keys($tables) as $t) { $items[] = "'{$moduleDirname}_{$tables[$t]->getVar('table_name')}'"; @@ -233,7 +233,7 @@ private function getXoopsVersionComments($moduleDirname) $ret = $this->getDashComment('Comments'); $ret .= $uxc->getUserModVersionText(2, "'comments.php'", 'comments', "'pageName'"); $ret .= $uxc->getUserModVersionText(2, "'com_id'", 'comments', "'itemName'"); - $ret .= Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Comment callback functions'); + $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Comment callback functions'); $ret .= $uxc->getUserModVersionText(2, "'include/comment_functions.php'", 'comments', "'callbackFile'"); $descriptions = ['approve' => "'{$moduleDirname}CommentsApprove'", 'update' => "'{$moduleDirname}CommentsUpdate'"]; $ret .= $uxc->getUserModVersionArray(2, $descriptions, 'comments', "'callback'"); @@ -253,7 +253,7 @@ private function getXoopsVersionComments($moduleDirname) private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $admin, $user) { $uxc = UserXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $this->getDashComment('Templates'); $item = []; if ($admin) { @@ -364,7 +364,7 @@ private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '' */ private function getXoopsVersionSubmenu($language, $tables) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $ret = $this->getDashComment('Menu'); @@ -460,7 +460,7 @@ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) */ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $stuTableName = mb_strtoupper($tableName); $ucfTableName = ucfirst($tableName); @@ -489,8 +489,8 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable */ private function getXoopsVersionConfig($module, $tables, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $ret = $this->getDashComment('Config'); @@ -811,7 +811,7 @@ private function getXoopsVersionConfig($module, $tables, $language) /* * removed, as there are no system templates in xoops core for fb or disqus comments - * tdmcreate currently is also not creatings tpl files for this + * modulebuilder currently is also not creatings tpl files for this $ret .= $pc->getPhpCodeCommentLine('Facebook Comments'); $facebookComments = [ 'name' => "'facebook_comments'", @@ -874,7 +874,7 @@ private function getXoopsVersionConfig($module, $tables, $language) */ private function getNotificationsType($language, $type, $tableName, $notifyFile, $item, $typeOfNotify) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $stuTableName = mb_strtoupper($tableName); $stuTypeOfNotify = mb_strtoupper($typeOfNotify); @@ -1017,7 +1017,7 @@ private function getXoopsVersionNotifications($module, $language) */ private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from, $num) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $title = mb_strtoupper($title); $implodeFrom = implode(".php', '", $from); @@ -1047,7 +1047,7 @@ private function getXoopsVersionNotificationGlobal($language, $type, $name, $tit */ private function getXoopsVersionNotificationCategory($language, $type, $name, $title, $file, $item, $allow, $num) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $title = mb_strtoupper($title); $impFile = implode(".php', '", $file); @@ -1080,7 +1080,7 @@ private function getXoopsVersionNotificationCategory($language, $type, $name, $t */ private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $file, $item, $allow, $num) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $stuTitle = mb_strtoupper($title); $ucfTitle = ucfirst($title); @@ -1113,7 +1113,7 @@ private function getXoopsVersionNotificationTableName($language, $type, $name, $ */ private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin, $title, $mail, $num) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $uxc = UserXoopsCode::getInstance(); $title = mb_strtoupper($title); $ucfTitle = ucfirst($title); @@ -1141,8 +1141,8 @@ private function getXoopsVersionNotificationCodeComplete($language, $type, $name */ private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ucModuleDirname = mb_strtoupper($moduleDirname); $ret = $pc->getPhpCodeCommentLine('create increment steps for file size'); @@ -1222,7 +1222,7 @@ public function render() if (in_array(1, $tableNotifications)) { $content .= $this->getXoopsVersionNotifications($module, $language); } - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/admin/AdminAbout.php b/class/Files/admin/AdminAbout.php index c85c325b..1e1a12e0 100644 --- a/class/Files/admin/AdminAbout.php +++ b/class/Files/admin/AdminAbout.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); } /** @@ -97,7 +97,7 @@ public function render() $content .= $this->xc->getXcXoopsTplAssign('about', "\$adminObject->renderAbout(false)"); $content .= $this->getInclude('footer'); - $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/admin/AdminFooter.php b/class/Files/admin/AdminFooter.php index fa7bee7a..428b4754 100644 --- a/class/Files/admin/AdminFooter.php +++ b/class/Files/admin/AdminFooter.php @@ -1,9 +1,9 @@ xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -93,7 +93,7 @@ public function render() $content .= $this->pc->getPhpCodeConditions($isset, '', '', $display, false, '') . PHP_EOL; $content .= $this->xc->getXcXoopsCPFooter(); - $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index fe0a40e2..24a0955b 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -1,9 +1,9 @@ getCamelCase($fieldId, false, true); $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); @@ -100,7 +100,7 @@ private function getAdminPagesHeader($moduleDirname, $fieldId) */ private function getAdminPagesSwitch($cases = []) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, true, false, "\t"); return $pc->getPhpCodeSwitch('op', $contentSwitch); @@ -117,9 +117,9 @@ private function getAdminPagesSwitch($cases = []) */ private function getAdminPagesList($moduleDirname, $table, $language, $fieldInForm, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $tableName = $table->getVar('table_name'); @@ -170,8 +170,8 @@ private function getAdminPagesList($moduleDirname, $table, $language, $fieldInFo */ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $language, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $stuTableName = mb_strtoupper($tableName); $ret = $axc->getAdminTemplateMain($moduleDirname, $tableName, $t); @@ -196,8 +196,8 @@ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $lan */ private function getPermissionsSave($moduleDirname, $perm = 'view') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); $ret .= $xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', '$permId', false, "\t\t\t"); @@ -223,9 +223,9 @@ private function getPermissionsSave($moduleDirname, $perm = 'view') */ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $pc->getPhpCodeCommentLine('Security Check','', $t); @@ -332,8 +332,8 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ */ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); @@ -366,7 +366,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, */ private function getAdminPagesDelete($tableName, $language, $fieldId, $fieldMain, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); return $xc->getXcCommonPagesDelete($language, $tableName, $fieldId, $fieldMain, $t); } @@ -379,7 +379,7 @@ private function getAdminPagesDelete($tableName, $language, $fieldId, $fieldMain */ public function render() { - $tf = Tdmcreate\Files\CreateFile::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); $new = $save = $edit = ''; $module = $this->getModule(); @@ -424,7 +424,7 @@ public function render() $content .= $this->getAdminPagesSwitch($cases); $content .= $this->getInclude('footer'); - $tf->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $tf->create($moduleDirname, 'admin', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); return $tf->renderFile(); } diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index 277aa9de..c94a46f3 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -1,8 +1,8 @@ getPhpCodeCommentLine('Set Var', $fieldName, $t); $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); $xRootPath = "XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'"; @@ -210,8 +210,8 @@ public function getAxcSetVarImageList($tableName, $fieldName, $t = '', $countUpl */ public function getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, $t = '', $countUploader = 0) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $stuModuleDirname = mb_strtoupper($moduleDirname); $ucfModuleDirname = ucfirst($moduleDirname); $ret = $pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); @@ -291,8 +291,8 @@ public function getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, $ */ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $formatUrl = false, $t = '', $countUploader = 0, $fieldMain = '', $mimetype = 'mimetypes_image', $maxsize = 'maxsize_image') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = ''; $files = ''; $contIf = ''; @@ -334,9 +334,9 @@ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $format */ public function getAxcSetVarPassword($tableName, $fieldName, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cf = Tdmcreate\Files\CreateFile::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $cf = Modulebuilder\Files\CreateFile::getInstance(); $ccFieldId = $cf->getCamelCase($fieldName, false, true); $ret = $xc->getXcEqualsOperator("\${$ccFieldId}", "Request::getString('{$fieldName}', '')", '',$t); $contIf = $xc->getXcSetVarObj($tableName, $fieldName, "password_hash(\${$ccFieldId}, PASSWORD_DEFAULT)", $t . "\t"); @@ -356,7 +356,7 @@ public function getAxcSetVarPassword($tableName, $fieldName, $t = '') */ public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); switch ((int)$fieldType){ case 2: case 3: diff --git a/class/Form/FormRadio.php b/class/Form/FormRadio.php index d6dab75c..2395a48b 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -1,6 +1,6 @@ getName() . '">' . NWLINE; $ret .= ''; $html .= '
      '; - $html .= '
    • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; + $html .= '
    • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . \XOOPS_ROOT_PATH . ''; $html .= '
    '; $html .= '
    '; $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; diff --git a/files/commonfiles/class/Common/SysUtility.php b/files/commonfiles/class/Common/SysUtility.php index cd92ba69..70267d39 100644 --- a/files/commonfiles/class/Common/SysUtility.php +++ b/files/commonfiles/class/Common/SysUtility.php @@ -34,10 +34,17 @@ */ class SysUtility { - use VersionChecks; //checkVerXoops, checkVerPhp Traits - use ServerStats; // getServerStats Trait - use FilesManagement; // Files Management Trait + use VersionChecks; + //checkVerXoops, checkVerPhp Traits + + use ServerStats; + + // getServerStats Trait + + use FilesManagement; + + // Files Management Trait /** * Access the only instance of this class @@ -72,12 +79,12 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac { if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text - if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { + if (\mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { return $text; } // splits all html-tags to scanable lines - \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); - $total_length = mb_strlen($ending); + \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); + $total_length = \mb_strlen($ending); $open_tags = []; $truncate = ''; foreach ($lines as $line_matchings) { @@ -102,25 +109,25 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac $truncate .= $line_matchings[1]; } // calculate the length of the plain text part of the line; handle entities as one character - $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); + $content_length = \mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); if ($total_length + $content_length > $length) { // the number of characters which are left $left = $length - $total_length; $entities_length = 0; // search for html entities - if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) { + if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { // calculate the real length of all entities in the legal range foreach ($entities[0] as $entity) { if ($left >= $entity[1] + 1 - $entities_length) { $left--; - $entities_length += mb_strlen($entity[0]); + $entities_length += \mb_strlen($entity[0]); } else { // no more characters left break; } } } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); + $truncate .= \mb_substr($line_matchings[2], 0, $left + $entities_length); // maximum lenght is reached, so get off the loop break; } @@ -133,10 +140,10 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } } } else { - if (mb_strlen($text) <= $length) { + if (\mb_strlen($text) <= $length) { return $text; } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); + $truncate = \mb_substr($text, 0, $length - mb_strlen($ending)); } // if the words shouldn't be cut in the middle... if (!$exact) { @@ -144,7 +151,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac $spacepos = \mb_strrpos($truncate, ' '); if (isset($spacepos)) { // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); + $truncate = \mb_substr($truncate, 0, $spacepos); } } // add the defined ending to the text @@ -204,7 +211,7 @@ public static function getEditor($helper = null, $options = null) * * @return bool */ - function fieldExists($fieldname, $table) + public function fieldExists($fieldname, $table) { global $xoopsDB; $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); diff --git a/files/commonfiles/class/Common/TableChecker.php b/files/commonfiles/class/Common/TableChecker.php index 3ed7cabe..d2c2defd 100644 --- a/files/commonfiles/class/Common/TableChecker.php +++ b/files/commonfiles/class/Common/TableChecker.php @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use \XoopsModules\Modulebuilder\Common; +use XoopsModules\Modulebuilder\Common; /** * Class to compare current DB table structure with sql/mysql.sql @@ -46,10 +46,9 @@ class TableChecker extends \XoopsObject * @var mixed */ private $checktype = null; - - const CHECKTYPE_REPORT = 0; //report only - const CHECKTYPE_UPDATE = 1; //update only - const CHECKTYPE_UPDATE_REPORT = 2; //update and report + public const CHECKTYPE_REPORT = 0; //report only + public const CHECKTYPE_UPDATE = 1; //update only + public const CHECKTYPE_UPDATE_REPORT = 2; //update and report /** @@ -89,7 +88,7 @@ public function processSQL() if ($this->result = $GLOBALS['xoopsDB']->queryF($sql)) { $this->result[] = 'Table created:' . $table; } else { - xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); + \xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $this->result[] = 'Error creating table:' . $table; } } else { @@ -110,15 +109,15 @@ private function readSQLFile() { $tabledefs = []; - $modhandler = \xoops_getHandler('module'); - $module = $modhandler->getByDirname($this->mydirname); + $moduleHandler = \xoops_getHandler('module'); + $module = $moduleHandler->getByDirname($this->mydirname); $module->loadInfoAsVar($this->mydirname); $sqlfile = $module->getInfo('sqlfile'); - $sql_file_path = \XOOPS_ROOT_PATH . '/modules/' . $this->mydirname . '/' . $sqlfile[XOOPS_DB_TYPE]; + $sql_file_path = \XOOPS_ROOT_PATH . '/modules/' . $this->mydirname . '/' . $sqlfile[\XOOPS_DB_TYPE]; if (\file_exists($sql_file_path)) { - include_once \XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; - $sqlutil = new \SqlUtility; + require_once \XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; + $sqlutil = new \SqlUtility(); $pieces = []; $sql_query = \trim(file_get_contents($sql_file_path)); $sqlutil->splitMySqlFile($pieces, $sql_query); @@ -126,7 +125,7 @@ private function readSQLFile() $countTable = 0; foreach ($pieces as $piece) { $singleSql = $sqlutil->prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); - $lines = preg_split('/\r\n|\n|\r/', $piece); + $lines = \preg_split('/\r\n|\n|\r/', $piece); //var_dump($lines); $needle1 = 'create table'; if ($needle1 == \mb_strtolower($singleSql[1])) { @@ -139,11 +138,11 @@ private function readSQLFile() $needle2 = 'primary key'; $needle3 = 'unique key'; $needle4 = 'key'; - if ($needle2 == \mb_strtolower(\substr(\trim($line), 0, \strlen($needle2)))) { + if (0 === \stripos(\trim($line), $needle2)) { $tabledefs[$countTable][$needle2] = $line; - } elseif ($needle3 == \mb_strtolower(\substr(\trim($line), 0, \strlen($needle3)))) { + } elseif (0 === \stripos(\trim($line), $needle3)) { $tabledefs[$countTable][$needle3] = $line; - } elseif ($needle4 == \mb_strtolower(\substr(\trim($line), 0, \strlen($needle4)))) { + } elseif (0 === \stripos(\trim($line), $needle4)) { $tabledefs[$countTable][$needle4] = $line; } else { if (\strpos($line, '`') > 0) { @@ -235,7 +234,7 @@ private function checkTableFields($table, $fields) if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { $this->result[] = 'Field added:' . $fieldname; } else { - xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); + \xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $this->result[] = "Error when adding '$fieldname' to table '$table'."; } } else { diff --git a/files/commonfiles/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php index e1a0cd7e..39488d25 100644 --- a/files/commonfiles/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -29,7 +29,7 @@ trait VersionChecks */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { - $moduleDirName = \basename(dirname(__DIR__, 2)); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); @@ -38,7 +38,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = \xoops_loadLanguage('common', $moduleDirName); //check for minimum XOOPS version - $currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string + $currentVer = \mb_substr(\XOOPS_VERSION, 6); // get the numeric part of string if (null === $requiredVer) { $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string } @@ -61,7 +61,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = */ public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = \basename(dirname(__DIR__, 2)); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); @@ -70,7 +70,7 @@ public static function checkVerPhp(\XoopsModule $module = null) // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; + $verNum = \PHP_VERSION; $reqVer = &$module->getInfo('min_php'); if (false !== $reqVer && '' !== $reqVer) { @@ -94,7 +94,7 @@ public static function checkVerPhp(\XoopsModule $module = null) */ public static function checkVerModule($helper, $source = 'github', $default = 'master') { - $moduleDirName = \basename(dirname(__DIR__, 2)); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; $repository = 'XoopsModules25x/' . $moduleDirName; @@ -103,10 +103,10 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { - \curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl); - \curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); - \curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false); - \curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); + \curl_setopt($curlHandle, \CURLOPT_URL, $infoReleasesUrl); + \curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true); + \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, false); + \curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { \trigger_error(\curl_error($curlHandle)); @@ -114,7 +114,7 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm \trigger_error('Repository Not Found: ' . $infoReleasesUrl); } else { $file = \json_decode($curlReturn, false); - $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); + $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? \reset($file)->tag_name : $default); $latestVersion = $file[0]->tag_name; $prerelease = $file[0]->prerelease; if ('master' !== $latestVersionLink) { diff --git a/files/commonfiles/class/Common/XoopsConfirm.php b/files/commonfiles/class/Common/XoopsConfirm.php index c3efb15b..10f6cee5 100644 --- a/files/commonfiles/class/Common/XoopsConfirm.php +++ b/files/commonfiles/class/Common/XoopsConfirm.php @@ -20,7 +20,7 @@ * @package Modulebuilder * @since 1.0 * @min_xoops 2.5.9 - * @author Goffy - Email: - Website: + * @author Goffy - Email: - Website: */ use XoopsModules\Modulebuilder; @@ -62,9 +62,9 @@ public function __construct($hiddens, $action, $object, $title = '', $label = '' public function getFormXoopsConfirm() { //in order to be accessable from user and admin area this should be place in language common.php - if (!defined('CO_MODULEBUILDER_DELETE_CONFIRM')) { - \define('CO_MODULEBUILDER_DELETE_CONFIRM', 'Confirm delete'); - \define('CO_MODULEBUILDER_DELETE_LABEL', 'Do you really want to delete:'); + if (!\defined('CO_MYMODULE_DELETE_CONFIRM')) { + \define('CO_MYMODULE_DELETE_CONFIRM', 'Confirm delete'); + \define('CO_MYMODULE_DELETE_LABEL', 'Do you really want to delete:'); } // Get Theme Form @@ -72,11 +72,11 @@ public function getFormXoopsConfirm() $this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } if ('' === $this->title) { - $this->title = CO_MODULEBUILDER_DELETE_CONFIRM; + $this->title = CO_MYMODULE_DELETE_CONFIRM; } if ('' === $this->label) { - $this->label = CO_MODULEBUILDER_DELETE_LABEL; + $this->label = CO_MYMODULE_DELETE_LABEL; } \xoops_load('XoopsFormLoader'); @@ -96,4 +96,4 @@ public function getFormXoopsConfirm() $form->addElement($buttonTray); return $form; } -} \ No newline at end of file +} diff --git a/files/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php index 19c29016..650b6281 100644 --- a/files/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -83,4 +83,3 @@ public function getHandler($name) return $ret; } } -//require __DIR__ . '/../../mainfile.php'; diff --git a/files/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php index cd25b6de..a181cf74 100644 --- a/files/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -56,12 +56,12 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac { if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text - if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { + if (\mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { return $text; } // splits all html-tags to scanable lines - \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); - $total_length = mb_strlen($ending); + \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); + $total_length = \mb_strlen($ending); $open_tags = []; $truncate = ''; foreach ($lines as $line_matchings) { @@ -92,7 +92,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac $left = $length - $total_length; $entities_length = 0; // search for html entities - if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) { + if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { // calculate the real length of all entities in the legal range foreach ($entities[0] as $entity) { if ($left >= $entity[1] + 1 - $entities_length) { @@ -104,7 +104,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } } } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); + $truncate .= \mb_substr($line_matchings[2], 0, $left + $entities_length); // maximum lenght is reached, so get off the loop break; } @@ -117,10 +117,10 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } } } else { - if (mb_strlen($text) <= $length) { + if (\mb_strlen($text) <= $length) { return $text; } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); + $truncate = \mb_substr($text, 0, $length - mb_strlen($ending)); } // if the words shouldn't be cut in the middle... if (!$exact) { @@ -128,11 +128,11 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac $spacepos = \mb_strrpos($truncate, ' '); if (isset($spacepos)) { // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); + $truncate = \mb_substr($truncate, 0, $spacepos); } } // add the defined ending to the text - if (\strlen($truncate) > 0) { + if ('' != $truncate) { $truncate .= $ending; } if ($considerHtml) { @@ -191,13 +191,13 @@ public static function makeDonationForm($about) $donationform = [ 0 => '', 1 => '
    ' - . _AM_MODULEBUILDER_ABOUT_MAKE_DONATION + . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
    ' - . _AM_MODULEBUILDER_DONATION_AMOUNT + . \_AM_MODULEBUILDER_DONATION_AMOUNT . '*
    ', 2 => '', 'D' => '', @@ -226,7 +226,7 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; $donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), - XOOPS_LICENSE_KEY, + \XOOPS_LICENSE_KEY, \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') ); @@ -234,11 +234,11 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; } } $aboutRes = ''; - $istart = mb_strpos($about, $paypalform[0], 1); - $iend = mb_strpos($about, $paypalform[5], $istart + 1) + mb_strlen($paypalform[5]) - 1; - $aboutRes .= mb_substr($about, 0, $istart - 1); + $istart = \mb_strpos($about, $paypalform[0], 1); + $iend = \mb_strpos($about, $paypalform[5], $istart + 1) + mb_strlen($paypalform[5]) - 1; + $aboutRes .= \mb_substr($about, 0, $istart - 1); $aboutRes .= \implode("\n", $donationform); - $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); + $aboutRes .= \mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); return $aboutRes; } diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index 58a0b298..e17ecfac 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -16,7 +16,7 @@ * @license GPL 2.0 or later * @package Modulebuilder * @since 1.0 - * @min_xoops 2.5.9 + * @min_xoops 2.5.11 * @author Wedega - Email: - Website: XOOPS Project (www.xoops.org) $ */ @@ -30,7 +30,7 @@ function xoops_module_pre_install_modulebuilder(\XoopsModule $module) { require \dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Modulebuilder\Utility $utility */ + $utility = new Modulebuilder\Utility(); //check for minimum XOOPS version @@ -51,7 +51,7 @@ function xoops_module_pre_install_modulebuilder(\XoopsModule $module) /** * @param \XoopsModule $module - * @return bool|string + * @return bool */ function xoops_module_install_modulebuilder(\XoopsModule $module) { diff --git a/files/commonfiles/include/uninstall.php b/files/commonfiles/include/uninstall.php index 4293cb49..c8dd909e 100644 --- a/files/commonfiles/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -34,10 +34,9 @@ function xoops_module_uninstall_modulebuilder(\XoopsModule $module) $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); - /** @var Modulebuilder\Helper $helper */ + $helper = Modulebuilder\Helper::getInstance(); - /** @var Modulebuilder\Utility $utility */ $utility = new Modulebuilder\Utility(); $success = true; @@ -67,7 +66,7 @@ function xoops_module_uninstall_modulebuilder(\XoopsModule $module) $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); if (is_file($xmlfile)) { if (false === ($delOk = \unlink($xmlfile))) { - $module->setErrors(\sprintf(_AM_MODULEBUILDER_ERROR_BAD_REMOVE, $xmlfile)); + $module->setErrors(\sprintf(\_AM_MODULEBUILDER_ERROR_BAD_REMOVE, $xmlfile)); } } // return $success && $delOk; // use this if you're using this routine diff --git a/files/commonfiles/include/update.php b/files/commonfiles/include/update.php index 8c8e84f2..69efc843 100644 --- a/files/commonfiles/include/update.php +++ b/files/commonfiles/include/update.php @@ -16,7 +16,7 @@ * @param null|mixed $prev_version * @package Modulebuilder * @since 1.0 - * @min_xoops 2.5.9 + * @min_xoops 2.5.11 * @author Wedega - Email: - Website: * @version $Id: 1.0 update.php 1 Mon 2018-03-19 10:04:53Z XOOPS Project (www.xoops.org) $ * @copyright module for xoops @@ -39,12 +39,12 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) $ret = modulebuilder_check_db($module); //check upload directory - include_once __DIR__ . '/install.php'; + require_once __DIR__ . '/install.php'; $ret = xoops_module_install_modulebuilder($module); $errors = $module->getErrors(); if (!empty($errors)) { - print_r($errors); + \print_r($errors); } return $ret; @@ -64,7 +64,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 (false !== (list($tplid) = $xoopsDB->fetchRow($result))) { + while (list($tplid) = $xoopsDB->fetchRow($result)) { $tplids[] = $tplid; } if (\count($tplids) > 0) { @@ -84,7 +84,7 @@ function update_modulebuilder_v10($module) return false; } $ret = []; - while (false !== ($myrow = $xoopsDB->fetchArray($result))) { + while ($myrow = $xoopsDB->fetchArray($result)) { $ret[] = $myrow; } if (!empty($ret)) { diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php index 8cc04688..1750e879 100644 --- a/files/commonfiles/include/xoops_version.inc.php +++ b/files/commonfiles/include/xoops_version.inc.php @@ -24,7 +24,7 @@ */ function modulebuilderReturnBytes($val) { - switch (mb_substr($val, -1)) { + switch (\mb_substr($val, -1)) { case 'K': case 'k': return (int)$val * 1024; diff --git a/files/commonfiles/language/english/common.php b/files/commonfiles/language/english/common.php index aa6bdd94..a83e255d 100644 --- a/files/commonfiles/language/english/common.php +++ b/files/commonfiles/language/english/common.php @@ -18,7 +18,7 @@ * @since 3.23 * @author Xoops Development Team */ -$moduleDirName = \basename(\dirname(\dirname(__DIR__))); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); @@ -56,7 +56,7 @@ \define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); //Help -\define('CO_' . $moduleDirNameUpper . '_DIRNAME', \basename(\dirname(\dirname(__DIR__)))); +\define('CO_' . $moduleDirNameUpper . '_DIRNAME', \basename(\dirname(__DIR__, 2))); \define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); \define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); \define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); diff --git a/files/commonfiles/language/english/feedback.php b/files/commonfiles/language/english/feedback.php index 16fe93e6..7b3d120c 100644 --- a/files/commonfiles/language/english/feedback.php +++ b/files/commonfiles/language/english/feedback.php @@ -16,10 +16,10 @@ * @license GPL 2.0 or later * @package general * @since 1.0 - * @min_xoops 2.5.9 + * @min_xoops 2.5.11 * @author XOOPS - Website: */ -$moduleDirName = \basename(\dirname(\dirname(__DIR__))); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); diff --git a/files/commonfiles/preloads/autoloader.php b/files/commonfiles/preloads/autoloader.php index a3607c51..041829fc 100644 --- a/files/commonfiles/preloads/autoloader.php +++ b/files/commonfiles/preloads/autoloader.php @@ -9,17 +9,17 @@ static function ($class) { $prefix = 'XoopsModules\\' . \ucfirst(\basename(\dirname(__DIR__))); // base directory for the namespace prefix - $baseDir = __DIR__ . '/../class/'; + $baseDir = \dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? - $len = mb_strlen($prefix); + $len = \mb_strlen($prefix); - if (0 !== strncmp($prefix, $class, $len)) { + if (0 !== \strncmp($prefix, $class, $len)) { return; } // get the relative class name - $relativeClass = mb_substr($class, $len); + $relativeClass = \mb_substr($class, $len); // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append diff --git a/files/commonfiles/preloads/core.php b/files/commonfiles/preloads/core.php index 7fd305f0..3ec985a1 100644 --- a/files/commonfiles/preloads/core.php +++ b/files/commonfiles/preloads/core.php @@ -28,6 +28,6 @@ class ModulebuilderCorePreload extends \XoopsPreloadItem */ public static function eventCoreIncludeCommonEnd($args) { - include __DIR__ . '/autoloader.php'; + require __DIR__ . '/autoloader.php'; } } diff --git a/files/commonfiles/testdata/index.php b/files/commonfiles/testdata/index.php index 77924a2b..e49aa104 100644 --- a/files/commonfiles/testdata/index.php +++ b/files/commonfiles/testdata/index.php @@ -10,7 +10,7 @@ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package - * @since 2.5.9 + * @since 2.5.11 * @author Michael Beck (aka Mamba) */ @@ -87,7 +87,6 @@ function loadSampleData() // --- COPY test folder files --------------- if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) { - // $file = __DIR__ . '/../testdata/images/'; foreach (\array_keys($configurator->copyTestFolders) as $i) { $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; diff --git a/files/ratingfiles/class/Ratings.php b/files/ratingfiles/class/Ratings.php index 105fb870..3486cbfe 100644 --- a/files/ratingfiles/class/Ratings.php +++ b/files/ratingfiles/class/Ratings.php @@ -36,13 +36,13 @@ class Ratings extends \XoopsObject */ public function __construct() { - $this->initVar('rate_id', XOBJ_DTYPE_INT); - $this->initVar('rate_source', XOBJ_DTYPE_INT); - $this->initVar('rate_itemid', XOBJ_DTYPE_INT); - $this->initVar('rate_value', XOBJ_DTYPE_INT); - $this->initVar('rate_uid', XOBJ_DTYPE_INT); - $this->initVar('rate_ip', XOBJ_DTYPE_TXTBOX); - $this->initVar('rate_date', XOBJ_DTYPE_INT); + $this->initVar('rate_id', \XOBJ_DTYPE_INT); + $this->initVar('rate_source', \XOBJ_DTYPE_INT); + $this->initVar('rate_itemid', \XOBJ_DTYPE_INT); + $this->initVar('rate_value', \XOBJ_DTYPE_INT); + $this->initVar('rate_uid', \XOBJ_DTYPE_INT); + $this->initVar('rate_ip', \XOBJ_DTYPE_TXTBOX); + $this->initVar('rate_date', \XOBJ_DTYPE_INT); } /** diff --git a/files/ratingfiles/class/RatingsHandler.php b/files/ratingfiles/class/RatingsHandler.php index e543ef7a..ac20d530 100644 --- a/files/ratingfiles/class/RatingsHandler.php +++ b/files/ratingfiles/class/RatingsHandler.php @@ -53,7 +53,7 @@ public function create($isNew = true) * * @param int $i field id * @param array $fields - * @return mixed reference to the {@link Get} object + * @return \XoopsObject|null reference to the {@link Get} object */ public function get($i = null, $fields = null) { @@ -85,7 +85,7 @@ public function getItemRating($itemid = 0, $source = 0) $ItemRating['nb_ratings'] = 0; $uid = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; $voted = false; - $ip = getenv('REMOTE_ADDR'); + $ip = \getenv('REMOTE_ADDR'); $current_rating = 0; if (Constants::RATING_5STARS === (int)$helper->getConfig('ratingbars') @@ -108,7 +108,7 @@ public function getItemRating($itemid = 0, $source = 0) foreach ($ratingObjs as $ratingObj) { $current_rating += $ratingObj->getVar('rate_value'); - if (($ratingObj->getVar('rate_ip') == $ip && $uid == 0) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { + if (($ratingObj->getVar('rate_ip') == $ip && 0 == $uid) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { $voted = true; $ItemRating['id'] = $ratingObj->getVar('rate_id'); } @@ -118,14 +118,14 @@ public function getItemRating($itemid = 0, $source = 0) $ItemRating['avg_rate_value'] = 0; if ($count > 0) { - $ItemRating['avg_rate_value'] = number_format($current_rating / $count, 2); + $ItemRating['avg_rate_value'] = \number_format($current_rating / $count, 2); } if (1 == $count) { - $text = \str_replace('%c', $ItemRating['avg_rate_value'], _MA_MODULEBUILDER_RATING_CURRENT_1); - $shorttext = \str_replace('%c', $ItemRating['avg_rate_value'], _MA_MODULEBUILDER_RATING_CURRENT_SHORT_1); + $text = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_1); + $shorttext = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_SHORT_1); } else { - $text = \str_replace('%c', $ItemRating['avg_rate_value'], _MA_MODULEBUILDER_RATING_CURRENT_X); - $shorttext = \str_replace('%c', $ItemRating['avg_rate_value'], _MA_MODULEBUILDER_RATING_CURRENT_SHORT_X); + $text = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_X); + $shorttext = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_SHORT_X); } $text = \str_replace('%m', $max_units, $text); $text = \str_replace('%t', $ItemRating['nb_ratings'], $text); @@ -145,7 +145,7 @@ public function getItemRating($itemid = 0, $source = 0) foreach ($ratingObjs as $ratingObj) { $current_rating += $ratingObj->getVar('rate_value'); - if (($ratingObj->getVar('rate_ip') == $ip && $uid == 0) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { + if (($ratingObj->getVar('rate_ip') == $ip && 0 == $uid) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { $voted = true; $ItemRating['id'] = $ratingObj->getVar('rate_id'); } @@ -164,7 +164,7 @@ public function getItemRating($itemid = 0, $source = 0) $current_rating = 0; foreach ($ratingObjs as $ratingObj) { $current_rating += $ratingObj->getVar('rate_value'); - if (($ratingObj->getVar('rate_ip') == $ip && $uid == 0) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { + if (($ratingObj->getVar('rate_ip') == $ip && 0 == $uid) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { $voted = true; $ItemRating['id'] = $ratingObj->getVar('rate_id'); } diff --git a/include/common.php b/include/common.php index b31d4faf..4273cf05 100644 --- a/include/common.php +++ b/include/common.php @@ -22,7 +22,7 @@ */ use XoopsModules\Modulebuilder; -include \dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); //$capsDirName @@ -31,14 +31,14 @@ $dirname = $GLOBALS['xoopsModule']->getVar('dirname'); // Root Frameworks icons 32x32 directory if (!\defined('XOOPS_ICONS32_PATH')) { - \define('XOOPS_ICONS32_PATH', XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'); + \define('XOOPS_ICONS32_PATH', \XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'); } if (!\defined('XOOPS_ICONS32_URL')) { - \define('XOOPS_ICONS32_URL', XOOPS_URL . '/Frameworks/moduleclasses/icons/32'); + \define('XOOPS_ICONS32_URL', \XOOPS_URL . '/Frameworks/moduleclasses/icons/32'); } // Local Directories -\define('TDMC_PATH', XOOPS_ROOT_PATH . '/modules/' . $dirname); -\define('TDMC_URL', XOOPS_URL . '/modules/' . $dirname); +\define('TDMC_PATH', \XOOPS_ROOT_PATH . '/modules/' . $dirname); +\define('TDMC_URL', \XOOPS_URL . '/modules/' . $dirname); \define('TDMC_CLASS_PATH', TDMC_PATH . '/class'); \define('TDMC_CLASS_URL', TDMC_URL . '/class'); \define('TDMC_DOCS_PATH', TDMC_PATH . '/docs'); @@ -53,8 +53,8 @@ \define('TDMC_ICONS_URL', TDMC_URL . '/assets/icons'); \define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', TDMC_URL . '/assets/images/logoModule.png'); // Uploads Directories -\define('TDMC_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $dirname); -\define('TDMC_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $dirname); +\define('TDMC_UPLOAD_PATH', \XOOPS_UPLOAD_PATH . '/' . $dirname); +\define('TDMC_UPLOAD_URL', \XOOPS_UPLOAD_URL . '/' . $dirname); \define('TDMC_UPLOAD_REPOSITORY_PATH', TDMC_UPLOAD_PATH . '/repository'); \define('TDMC_UPLOAD_REPOSITORY_URL', TDMC_UPLOAD_URL . '/repository'); \define('TDMC_UPLOAD_IMGMOD_PATH', TDMC_UPLOAD_PATH . '/images/modules'); @@ -64,6 +64,4 @@ \define('TDMC_UPLOAD_TEMP_PATH', TDMC_UPLOAD_PATH . '/temp'); \define('TDMC_UPLOAD_FILES_PATH', TDMC_UPLOAD_PATH . '/files'); // Xoops Request -include_once XOOPS_ROOT_PATH . '/class/xoopsrequest.php'; -//include_once TDMC_PATH . '/include/functions.php'; - +require_once \XOOPS_ROOT_PATH . '/class/xoopsrequest.php'; diff --git a/include/functions.php b/include/functions.php index dd539a79..ddfcc2cd 100644 --- a/include/functions.php +++ b/include/functions.php @@ -33,13 +33,13 @@ function ModuleBuilder_MakeDonationForm($about) $donationform = [ 0 => '
    ', 1 => '
    ' - . _AM_MODULEBUILDER_ABOUT_MAKE_DONATION + . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
    ' - . _AM_MODULEBUILDER_DONATION_AMOUNT + . \_AM_MODULEBUILDER_DONATION_AMOUNT . '*
    ', 2 => '
    ', 'D' => '', @@ -68,7 +68,7 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; $donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), - XOOPS_LICENSE_KEY, + \XOOPS_LICENSE_KEY, \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') ); diff --git a/include/install.php b/include/install.php index a3860819..dcad07df 100644 --- a/include/install.php +++ b/include/install.php @@ -16,7 +16,7 @@ * @license GPL 2.0 or later * @package Modulebuilder * @since 1.0 - * @min_xoops 2.5.9 + * @min_xoops 2.5.11 * @author Wedega - Email: - Website: XOOPS Project (www.xoops.org) $ */ diff --git a/include/update.php b/include/update.php index 020f813a..a7ae0c88 100644 --- a/include/update.php +++ b/include/update.php @@ -47,7 +47,7 @@ function xoops_module_update_modulebuilder(&$module, $prev_version = null) } //check upload directory - include_once __DIR__ . '/install.php'; + require_once __DIR__ . '/install.php'; xoops_module_install_modulebuilder($module); $errors = $module->getErrors(); @@ -717,15 +717,15 @@ function modulebuilder_check_db($module) function clean_index_files() { $files = []; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/admin/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/assets/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/class/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/include/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/language/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/preloads/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/assets/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/class/index.php'; - $files[] = XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/templates/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/admin/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/assets/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/class/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/include/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/language/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/preloads/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/assets/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/class/index.php'; + $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/templates/index.php'; foreach($files as $file) { if (\file_exists($file)) { diff --git a/language/english/admin.php b/language/english/admin.php index 1c25d4fb..89a5d539 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -330,7 +330,7 @@ \define('_AM_MODULEBUILDER_BUILDING_CHECK_SOLVE', 'Please solve these problems and try again'); \define('_AM_MODULEBUILDER_BUILDING_CHECK_BROKEN1', "The table '%t' should use broken functionality, but the table do not have a 'Select Status' field, which is obligatory for this function"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS1', "The field '%f' in table '%t' have no params selected, but each field must have minimum one parameter"); -\define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS2', "The field '%f' in table '%t' should be used on user side: Param '" . _AM_MODULEBUILDER_FIELD_USER . "' is selected, but no selection is made, where it should be shown ('User index:...' or 'User file:...')"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS2', "The field '%f' in table '%t' should be used on user side: Param '" . \_AM_MODULEBUILDER_FIELD_USER . "' is selected, but no selection is made, where it should be shown ('User index:...' or 'User file:...')"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS3', "The field '%f' in table '%t' should be used on user side, but you made multiple decision where ('header' and/or 'body' and/or 'footer'). It is recommended to select only one section per index or item file"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS4', "The table '%t' should contains field in index file on user side, but no selection is made, which fields (field params 'User index:...')"); \define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS5', "The field '%f' in table '%t' should be used in index file on user side, but option 'Add in User Index Files' in table setting is deactivated)"); diff --git a/language/english/common.php b/language/english/common.php index f1e6b588..f52d1502 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -57,7 +57,7 @@ \define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); //Help -\define('CO_' . $moduleDirNameUpper . '_DIRNAME', \basename(\dirname(\dirname(__DIR__)))); +\define('CO_' . $moduleDirNameUpper . '_DIRNAME', \basename(\dirname(__DIR__, 2))); \define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); \define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); \define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); diff --git a/language/english/directorychecker.php b/language/english/directorychecker.php index 9253064f..46d9b61e 100644 --- a/language/english/directorychecker.php +++ b/language/english/directorychecker.php @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -$moduleDirName = \basename(\dirname(\dirname(__DIR__))); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE', "Available"); diff --git a/language/english/feedback.php b/language/english/feedback.php index ee72f18c..c91faa03 100644 --- a/language/english/feedback.php +++ b/language/english/feedback.php @@ -16,7 +16,7 @@ * @license GPL 2.0 or later * @package general * @since 1.0 - * @min_xoops 2.5.9 + * @min_xoops 2.5.11 * @author XOOPS - Website: */ diff --git a/language/english/filechecker.php b/language/english/filechecker.php index 3ed8d787..13b2747a 100644 --- a/language/english/filechecker.php +++ b/language/english/filechecker.php @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -$moduleDirName = \basename(\dirname(\dirname(__DIR__))); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE', "Available"); diff --git a/preloads/core.php b/preloads/core.php index 7fd305f0..3ec985a1 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -28,6 +28,6 @@ class ModulebuilderCorePreload extends \XoopsPreloadItem */ public static function eventCoreIncludeCommonEnd($args) { - include __DIR__ . '/autoloader.php'; + require __DIR__ . '/autoloader.php'; } } diff --git a/testdata/english/modulebuilder_modules.yml b/testdata/english/modulebuilder_modules.yml index cfa3065a..cdf4a55f 100644 --- a/testdata/english/modulebuilder_modules.yml +++ b/testdata/english/modulebuilder_modules.yml @@ -4,14 +4,14 @@ mod_dirname: mymodule mod_version: '1.0' mod_since: '1.0' - mod_min_php: '7.0' - mod_min_xoops: 2.5.9 + mod_min_php: '7.3' + mod_min_xoops: 2.5.11 mod_min_admin: '1.2' mod_min_mysql: '5.6' mod_description: 'This module is for doing following...' mod_author: 'TDM XOOPS' mod_author_mail: info@email.com - mod_author_website_url: 'http://xoops.org' + mod_author_website_url: 'https://xoops.org' mod_author_website_name: 'XOOPS Project' mod_credits: 'XOOPS Development Team' mod_license: 'GPL 2.0 or later' @@ -44,14 +44,14 @@ mod_dirname: mymoduledirty mod_version: '1.0' mod_since: '1.0' - mod_min_php: '7.0' - mod_min_xoops: 2.5.9 + mod_min_php: '7.3' + mod_min_xoops: 2.5.11 mod_min_admin: '1.2' mod_min_mysql: '5.6' mod_description: 'This module is for doing following...' mod_author: 'TDM XOOPS' mod_author_mail: info@email.com - mod_author_website_url: 'http://xoops.org' + mod_author_website_url: 'https://xoops.org' mod_author_website_name: 'XOOPS Project' mod_credits: 'XOOPS Development Team' mod_license: 'GPL 2.0 or later' diff --git a/testdata/index.php b/testdata/index.php index 77924a2b..e49aa104 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -10,7 +10,7 @@ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package - * @since 2.5.9 + * @since 2.5.11 * @author Michael Beck (aka Mamba) */ @@ -87,7 +87,6 @@ function loadSampleData() // --- COPY test folder files --------------- if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) { - // $file = __DIR__ . '/../testdata/images/'; foreach (\array_keys($configurator->copyTestFolders) as $i) { $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; diff --git a/xoops_version.php b/xoops_version.php index 196b7453..8f93c687 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -19,6 +19,7 @@ * * @author Txmod Xoops http://www.txmodxoops.org */ + \defined('XOOPS_ROOT_PATH') || die('Restricted access'); $moduleDirName = \basename(__DIR__); @@ -27,8 +28,8 @@ $modversion['version'] = 3.05; $modversion['module_status'] = 'RC1'; $modversion['release_date'] = '2020/11/11'; -$modversion['name'] = _MI_MODULEBUILDER_NAME; -$modversion['description'] = _MI_MODULEBUILDER_DESC; +$modversion['name'] = \_MI_MODULEBUILDER_NAME; +$modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; $modversion['author_website_url'] = 'https://xoops.org/'; $modversion['author_website_name'] = 'Xoops Team Developers Module'; @@ -109,8 +110,8 @@ $modversion['config'][] = [ 'name' => 'break' . $c, - 'title' => '_MI_MODULEBUILDER_CONFIG_BREAK_GENERAL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_BREAK_GENERAL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'head', @@ -121,8 +122,8 @@ $modversion['config'][] = [ 'name' => 'modulebuilder_editor', - 'title' => '_MI_MODULEBUILDER_CONFIG_EDITOR', - 'description' => '_MI_MODULEBUILDER_CONFIG_EDITOR_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_EDITOR', + 'description' => '\_MI_MODULEBUILDER_CONFIG_EDITOR_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'dhtml', @@ -132,8 +133,8 @@ $modversion['config'][] = [ //Uploads : mimetypes 'name' => 'mimetypes_image', - 'title' => '_MI_MODULEBUILDER_CONFIG_MIMETYPES_IMAGE', - 'description' => '_MI_MODULEBUILDER_CONFIG_MIMETYPES_IMAGE_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIMETYPES_IMAGE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MIMETYPES_IMAGE_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'gif|jpeg|pjpeg|png', @@ -142,8 +143,8 @@ $modversion['config'][] = [ //Uploads : maxsize 'name' => 'maxsize_image', - 'title' => '_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE', - 'description' => '_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => '5000000', @@ -151,8 +152,8 @@ $modversion['config'][] = [ 'name' => 'settings_adminpager', - 'title' => '_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER', - 'description' => '_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -160,8 +161,8 @@ $modversion['config'][] = [ 'name' => 'modules_adminpager', - 'title' => '_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER', - 'description' => '_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -169,8 +170,8 @@ $modversion['config'][] = [ 'name' => 'tables_adminpager', - 'title' => '_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER', - 'description' => '_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -178,8 +179,8 @@ $modversion['config'][] = [ 'name' => 'fields_adminpager', - 'title' => '_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER', - 'description' => '_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -187,8 +188,8 @@ $modversion['config'][] = [ 'name' => 'morefiles_adminpager', - 'title' => '_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER', - 'description' => '_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -197,8 +198,8 @@ ++$c; $modversion['config'][] = [ 'name' => 'break' . $c, - 'title' => '_MI_MODULEBUILDER_CONFIG_BREAK_REQUIRED', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_BREAK_REQUIRED', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'head', @@ -206,8 +207,8 @@ $modversion['config'][] = [ 'name' => 'name', - 'title' => '_MI_MODULEBUILDER_CONFIG_NAME', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'My Module', @@ -215,8 +216,8 @@ $modversion['config'][] = [ 'name' => 'dirname', - 'title' => '_MI_MODULEBUILDER_CONFIG_DIRNAME', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DIRNAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'mymoduledirname', @@ -224,8 +225,8 @@ $modversion['config'][] = [ 'name' => 'version', - 'title' => '_MI_MODULEBUILDER_CONFIG_VERSION', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_VERSION', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '1.0', @@ -233,8 +234,8 @@ $modversion['config'][] = [ 'name' => 'since', - 'title' => '_MI_MODULEBUILDER_CONFIG_SINCE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SINCE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '1.0', @@ -242,8 +243,8 @@ $modversion['config'][] = [ 'name' => 'min_php', - 'title' => '_MI_MODULEBUILDER_CONFIG_MIN_PHP', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_PHP', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '5.5', @@ -251,17 +252,17 @@ $modversion['config'][] = [ 'name' => 'min_xoops', - 'title' => '_MI_MODULEBUILDER_CONFIG_MIN_XOOPS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_XOOPS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', - 'default' => '2.5.9', + 'default' => '2.5.11', ]; $modversion['config'][] = [ 'name' => 'min_admin', - 'title' => '_MI_MODULEBUILDER_CONFIG_MIN_ADMIN', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_ADMIN', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '1.2', @@ -269,8 +270,8 @@ $modversion['config'][] = [ 'name' => 'min_mysql', - 'title' => '_MI_MODULEBUILDER_CONFIG_MIN_MYSQL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_MYSQL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '5.5', @@ -278,8 +279,8 @@ $modversion['config'][] = [ 'name' => 'description', - 'title' => '_MI_MODULEBUILDER_CONFIG_DESCRIPTION', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DESCRIPTION', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => 'This module is for doing following...', @@ -287,8 +288,8 @@ $modversion['config'][] = [ 'name' => 'author', - 'title' => '_MI_MODULEBUILDER_CONFIG_AUTHOR', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Development Team', @@ -296,8 +297,8 @@ $modversion['config'][] = [ 'name' => 'image', - 'title' => '_MI_MODULEBUILDER_CONFIG_IMAGE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_IMAGE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'empty.png', @@ -305,8 +306,8 @@ $modversion['config'][] = [ 'name' => 'display_admin', - 'title' => '_MI_MODULEBUILDER_CONFIG_DISPLAY_ADMIN_SIDE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DISPLAY_ADMIN_SIDE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, @@ -314,8 +315,8 @@ $modversion['config'][] = [ 'name' => 'display_user', - 'title' => '_MI_MODULEBUILDER_CONFIG_DISPLAY_USER_SIDE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DISPLAY_USER_SIDE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, @@ -323,8 +324,8 @@ $modversion['config'][] = [ 'name' => 'active_blocks', - 'title' => '_MI_MODULEBUILDER_CONFIG_ACTIVE_BLOCKS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_BLOCKS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, @@ -332,8 +333,8 @@ $modversion['config'][] = [ 'name' => 'active_search', - 'title' => '_MI_MODULEBUILDER_CONFIG_ACTIVE_SEARCH', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_SEARCH', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -341,8 +342,8 @@ $modversion['config'][] = [ 'name' => 'active_comments', - 'title' => '_MI_MODULEBUILDER_CONFIG_ACTIVE_COMMENTS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_COMMENTS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -350,8 +351,8 @@ $modversion['config'][] = [ 'name' => 'active_notifications', - 'title' => '_MI_MODULEBUILDER_CONFIG_ACTIVE_NOTIFICATIONS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_NOTIFICATIONS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -359,8 +360,8 @@ $modversion['config'][] = [ 'name' => 'active_permissions', - 'title' => '_MI_MODULEBUILDER_CONFIG_ACTIVE_PERMISSIONS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_PERMISSIONS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -368,8 +369,8 @@ $modversion['config'][] = [ 'name' => 'inroot_copy', - 'title' => '_MI_MODULEBUILDER_CONFIG_INROOT_COPY', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_INROOT_COPY', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -378,8 +379,8 @@ ++$c; $modversion['config'][] = [ 'name' => 'break' . $c, - 'title' => '_MI_MODULEBUILDER_CONFIG_BREAK_OPTIONAL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_BREAK_OPTIONAL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'head', @@ -387,8 +388,8 @@ $modversion['config'][] = [ 'name' => 'author_email', - 'title' => '_MI_MODULEBUILDER_CONFIG_AUTHOR_EMAIL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR_EMAIL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'name@site.com', @@ -396,8 +397,8 @@ $modversion['config'][] = [ 'name' => 'author_website_url', - 'title' => '_MI_MODULEBUILDER_CONFIG_AUTHOR_WEBSITE_URL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR_WEBSITE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://xoops.org', @@ -405,8 +406,8 @@ $modversion['config'][] = [ 'name' => 'author_website_name', - 'title' => '_MI_MODULEBUILDER_CONFIG_AUTHOR_WEBSITE_NAME', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR_WEBSITE_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Project', @@ -414,8 +415,8 @@ $modversion['config'][] = [ 'name' => 'credits', - 'title' => '_MI_MODULEBUILDER_CONFIG_CREDITS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_CREDITS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Development Team', @@ -423,8 +424,8 @@ $modversion['config'][] = [ 'name' => 'license', - 'title' => '_MI_MODULEBUILDER_CONFIG_LICENSE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_LICENSE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'GPL 2.0 or later', @@ -432,8 +433,8 @@ $modversion['config'][] = [ 'name' => 'license_url', - 'title' => '_MI_MODULEBUILDER_CONFIG_LICENSE_URL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_LICENSE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.html', @@ -441,8 +442,8 @@ $modversion['config'][] = [ 'name' => 'repository', - 'title' => '_MI_MODULEBUILDER_CONFIG_REPOSITORY', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_REPOSITORY', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://github.com/txmodxoops/ModuleBuilder-1.91', @@ -450,8 +451,8 @@ $modversion['config'][] = [ 'name' => 'release_info', - 'title' => '_MI_MODULEBUILDER_CONFIG_RELEASE_INFO', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_RELEASE_INFO', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'release_info', @@ -459,8 +460,8 @@ $modversion['config'][] = [ 'name' => 'release_file', - 'title' => '_MI_MODULEBUILDER_CONFIG_RELEASE_FILE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_RELEASE_FILE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'release_info file', @@ -468,8 +469,8 @@ $modversion['config'][] = [ 'name' => 'manual', - 'title' => '_MI_MODULEBUILDER_CONFIG_MANUAL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MANUAL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'link to manual file', @@ -477,8 +478,8 @@ $modversion['config'][] = [ 'name' => 'manual_file', - 'title' => '_MI_MODULEBUILDER_CONFIG_MANUAL_FILE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MANUAL_FILE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'install.txt', @@ -486,8 +487,8 @@ $modversion['config'][] = [ 'name' => 'demo_site_url', - 'title' => '_MI_MODULEBUILDER_CONFIG_DEMO_SITE_URL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DEMO_SITE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://xoops.org', @@ -495,8 +496,8 @@ $modversion['config'][] = [ 'name' => 'demo_site_name', - 'title' => '_MI_MODULEBUILDER_CONFIG_DEMO_SITE_NAME', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DEMO_SITE_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Demo Site', @@ -504,8 +505,8 @@ $modversion['config'][] = [ 'name' => 'support_url', - 'title' => '_MI_MODULEBUILDER_CONFIG_SUPPORT_URL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SUPPORT_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://xoops.org/modules/newbb', @@ -513,8 +514,8 @@ $modversion['config'][] = [ 'name' => 'support_name', - 'title' => '_MI_MODULEBUILDER_CONFIG_SUPPORT_NAME', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SUPPORT_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'Support Forum', @@ -522,8 +523,8 @@ $modversion['config'][] = [ 'name' => 'website_url', - 'title' => '_MI_MODULEBUILDER_CONFIG_WEBSITE_URL', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_WEBSITE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'www.xoops.org', @@ -531,8 +532,8 @@ $modversion['config'][] = [ 'name' => 'website_name', - 'title' => '_MI_MODULEBUILDER_CONFIG_WEBSITE_NAME', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_WEBSITE_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Project', @@ -540,8 +541,8 @@ $modversion['config'][] = [ 'name' => 'release_date', - 'title' => '_MI_MODULEBUILDER_CONFIG_RELEASE_DATE', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_RELEASE_DATE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => date(_DBDATESTRING), @@ -549,8 +550,8 @@ $modversion['config'][] = [ 'name' => 'status', - 'title' => '_MI_MODULEBUILDER_CONFIG_STATUS', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_STATUS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'Beta 1', @@ -558,8 +559,8 @@ $modversion['config'][] = [ 'name' => 'donations', - 'title' => '_MI_MODULEBUILDER_CONFIG_PAYPAL_BUTTON', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_PAYPAL_BUTTON', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '6KJ7RW5DR3VTJ', @@ -567,8 +568,8 @@ $modversion['config'][] = [ 'name' => 'subversion', - 'title' => '_MI_MODULEBUILDER_CONFIG_SUBVERSION', - 'description' => '_MI_MODULEBUILDER_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SUBVERSION', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '13040', From 48cdb7b2ed976778d4445c7e4272926dd9ec1b30 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 20 Jun 2021 18:49:03 -0400 Subject: [PATCH 141/266] cosmetics --- LICENSE | 6 +++--- admin/about.php | 2 +- admin/building.php | 2 +- admin/devtools.php | 2 +- admin/feedback.php | 2 +- admin/fields.php | 2 +- admin/footer.php | 2 +- admin/header.php | 2 +- admin/index.php | 2 +- admin/logo.php | 2 +- admin/menu.php | 2 +- admin/modules.php | 2 +- admin/morefiles.php | 2 +- admin/settings.php | 2 +- admin/tables.php | 2 +- assets/css/admin/style.css | 2 +- assets/css/style.css | 2 +- class/Building.php | 2 +- class/Common/DirectoryChecker.php | 2 +- class/Common/FileChecker.php | 2 +- class/Common/Migrate.php | 2 +- class/Common/ModuleFeedback.php | 2 +- class/Common/ModuleStats.php | 2 +- class/Fieldattributes.php | 2 +- class/FieldattributesHandler.php | 2 +- class/Fieldelements.php | 2 +- class/FieldelementsHandler.php | 2 +- class/Fieldkey.php | 2 +- class/FieldkeyHandler.php | 2 +- class/Fieldnull.php | 2 +- class/FieldnullHandler.php | 2 +- class/Fields.php | 2 +- class/FieldsHandler.php | 2 +- class/Fieldtype.php | 2 +- class/FieldtypeHandler.php | 2 +- class/Files/Admin/AdminBroken.php | 2 +- class/Files/Admin/AdminHeader.php | 2 +- class/Files/Admin/AdminIndex.php | 2 +- class/Files/Admin/AdminMenu.php | 2 +- class/Files/Admin/AdminPermissions.php | 2 +- class/Files/Assets/Css/Admin/CssAdminStyles.php | 2 +- class/Files/Assets/Css/CssSelectors.php | 2 +- class/Files/Assets/Css/CssStyles.php | 2 +- class/Files/Assets/Js/JavascriptJQuery.php | 2 +- class/Files/Assets/Js/JsJquery.php | 2 +- class/Files/Blocks/BlocksFiles.php | 2 +- class/Files/CheckData.php | 2 +- class/Files/Classes/ClassFiles.php | 2 +- class/Files/Classes/ClassFormElements.php | 2 +- class/Files/Classes/ClassHandlerFiles.php | 2 +- class/Files/Classes/ClassSpecialFiles.php | 2 +- class/Files/Classes/ClassXoopsCode.php | 2 +- class/Files/Config/ConfigConfig.php | 2 +- class/Files/CreateAbstractClass.php | 2 +- class/Files/CreateArchitecture.php | 2 +- class/Files/CreateFile.php | 2 +- class/Files/CreateMoreFiles.php | 2 +- class/Files/CreatePhpCode.php | 2 +- class/Files/CreateSmartyCode.php | 2 +- class/Files/CreateStructure.php | 2 +- class/Files/CreateTableFields.php | 2 +- class/Files/CreateXoopsCode.php | 2 +- class/Files/Docs/DocsChangelog.php | 2 +- class/Files/Docs/DocsFiles.php | 2 +- class/Files/Includes/IncludeCommentFunctions.php | 2 +- class/Files/Includes/IncludeComments.php | 2 +- class/Files/Includes/IncludeCommon.php | 2 +- class/Files/Includes/IncludeFunctions.php | 2 +- class/Files/Includes/IncludeJquery.php | 2 +- class/Files/Includes/IncludeNotifications.php | 2 +- class/Files/Includes/IncludeSearch.php | 2 +- class/Files/Language/LanguageAdmin.php | 2 +- class/Files/Language/LanguageBlocks.php | 2 +- class/Files/Language/LanguageDefines.php | 2 +- class/Files/Language/LanguageHelp.php | 2 +- class/Files/Language/LanguageMailTpl.php | 2 +- class/Files/Language/LanguageMain.php | 2 +- class/Files/Language/LanguageModinfo.php | 2 +- class/Files/Sql/SqlFile.php | 2 +- class/Files/Templates/Admin/TemplatesAdminAbout.php | 2 +- class/Files/Templates/Admin/TemplatesAdminBroken.php | 2 +- class/Files/Templates/Admin/TemplatesAdminFooter.php | 2 +- class/Files/Templates/Admin/TemplatesAdminHeader.php | 2 +- class/Files/Templates/Admin/TemplatesAdminIndex.php | 2 +- class/Files/Templates/Admin/TemplatesAdminPages.php | 2 +- .../Templates/Admin/TemplatesAdminPermissions.php | 2 +- .../Templates/Blocks/Defstyle/TemplatesBlocks.php | 2 +- class/Files/Templates/User/Defstyle/Breadcrumbs.php | 2 +- class/Files/Templates/User/Defstyle/Categories.php | 2 +- class/Files/Templates/User/Defstyle/CategoriesList.php | 2 +- class/Files/Templates/User/Defstyle/Footer.php | 2 +- class/Files/Templates/User/Defstyle/Header.php | 2 +- class/Files/Templates/User/Defstyle/Index.php | 2 +- class/Files/Templates/User/Defstyle/MoreFiles.php | 2 +- class/Files/Templates/User/Defstyle/Pages.php | 2 +- class/Files/Templates/User/Defstyle/PagesItem.php | 2 +- class/Files/Templates/User/Defstyle/PagesList.php | 2 +- class/Files/Templates/User/Defstyle/Pdf.php | 2 +- class/Files/Templates/User/Defstyle/Rate.php | 2 +- class/Files/Templates/User/Defstyle/Rss.php | 2 +- class/Files/Templates/User/Defstyle/Search.php | 2 +- class/Files/Templates/User/Defstyle/UserPrint.php | 2 +- class/Files/User/UserFooter.php | 2 +- class/Files/User/UserHeader.php | 2 +- class/Files/User/UserIndex.php | 2 +- class/Files/User/UserListTag.php | 2 +- class/Files/User/UserNotificationUpdate.php | 2 +- class/Files/User/UserPages.php | 2 +- class/Files/User/UserPdf.php | 2 +- class/Files/User/UserPrint.php | 2 +- class/Files/User/UserRate.php | 2 +- class/Files/User/UserRss.php | 2 +- class/Files/User/UserSearch.php | 2 +- class/Files/User/UserViewTag.php | 2 +- class/Files/User/UserXoopsCode.php | 2 +- class/Files/User/UserXoopsVersion.php | 4 ++-- class/Files/admin/AdminAbout.php | 2 +- class/Files/admin/AdminFooter.php | 2 +- class/Files/admin/AdminPages.php | 2 +- class/Files/admin/AdminXoopsCode.php | 2 +- class/Form/FormRadio.php | 4 ++-- class/Form/FormRaw.php | 2 +- class/Form/FormTab.php | 2 +- class/Form/FormTabTray.php | 2 +- class/Form/SimpleForm.php | 2 +- class/Form/ThemeForm.php | 2 +- class/Helper.php | 10 ++++------ class/Html/FormLabel.php | 2 +- class/Logo.php | 2 +- class/LogoGenerator.php | 2 +- class/Modules.php | 2 +- class/ModulesHandler.php | 2 +- class/Morefiles.php | 2 +- class/MorefilesHandler.php | 2 +- class/Settings.php | 2 +- class/SettingsHandler.php | 2 +- class/Tables.php | 2 +- class/TablesHandler.php | 2 +- class/autoload.php | 2 +- files/commonfiles/admin/feedback.php | 2 +- files/commonfiles/class/Common/Breadcrumb.php | 2 +- files/commonfiles/class/Common/DirectoryChecker.php | 2 +- files/commonfiles/class/Common/FileChecker.php | 2 +- files/commonfiles/class/Common/Migrate.php | 2 +- files/commonfiles/class/Common/ModuleFeedback.php | 2 +- files/commonfiles/class/Common/ModuleStats.php | 2 +- files/commonfiles/class/Common/Resizer.php | 4 ++-- files/commonfiles/class/Helper.php | 8 +++----- files/commonfiles/include/xoops_version.inc.php | 6 ++---- files/commonfiles/preloads/core.php | 3 +-- files/commonfiles/testdata/index.php | 4 ++-- include/common.php | 2 +- include/functions.php | 2 +- include/update.php | 2 +- language/english/admin.php | 2 +- language/english/common.php | 2 +- language/english/feedback.php | 2 +- language/english/modinfo.php | 2 +- preloads/autoloader.php | 2 +- preloads/core.php | 3 +-- testdata/index.php | 2 +- xoops_version.php | 6 +++--- 162 files changed, 176 insertions(+), 184 deletions(-) diff --git a/LICENSE b/LICENSE index 114f15c8..90c008d9 100644 --- a/LICENSE +++ b/LICENSE @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. 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, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/admin/about.php b/admin/about.php index c47c8f16..1c509f18 100644 --- a/admin/about.php +++ b/admin/about.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/building.php b/admin/building.php index 77ffefa1..1349a5c1 100644 --- a/admin/building.php +++ b/admin/building.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/devtools.php b/admin/devtools.php index 4019411b..4067ebbb 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/admin/feedback.php b/admin/feedback.php index d47f06fe..2fb28cbd 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -13,7 +13,7 @@ * Feedback plugin for xoops modules * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 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 1f4f8ce7..8785a352 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -23,7 +23,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/footer.php b/admin/footer.php index c991ad49..09cdf644 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/header.php b/admin/header.php index 12d85323..9be7db0f 100644 --- a/admin/header.php +++ b/admin/header.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/index.php b/admin/index.php index ea708711..a3b386b5 100644 --- a/admin/index.php +++ b/admin/index.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/logo.php b/admin/logo.php index 8060cb67..86a407cd 100644 --- a/admin/logo.php +++ b/admin/logo.php @@ -15,7 +15,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/admin/menu.php b/admin/menu.php index 45cba73a..ac021303 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/admin/modules.php b/admin/modules.php index 78376292..653220c8 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/admin/morefiles.php b/admin/morefiles.php index 58f3ae18..de8e71ca 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/admin/settings.php b/admin/settings.php index bb7bbdc4..e2e98596 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/admin/tables.php b/admin/tables.php index 180df74d..b0314461 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/assets/css/admin/style.css b/assets/css/admin/style.css index fe1a3284..710008ff 100644 --- a/assets/css/admin/style.css +++ b/assets/css/admin/style.css @@ -12,7 +12,7 @@ * modulebuilder module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package modulebuilder * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org diff --git a/assets/css/style.css b/assets/css/style.css index 9be18948..aab3a889 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -11,7 +11,7 @@ * modulebuilder module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package modulebuilder * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org diff --git a/class/Building.php b/class/Building.php index a180d42c..6ea687ca 100644 --- a/class/Building.php +++ b/class/Building.php @@ -18,7 +18,7 @@ * Building class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.x * diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 9791289c..1788f4d0 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -16,7 +16,7 @@ * Modulebuilder module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Xoops Development Team */ diff --git a/class/Common/FileChecker.php b/class/Common/FileChecker.php index 127b2303..d0d870f7 100644 --- a/class/Common/FileChecker.php +++ b/class/Common/FileChecker.php @@ -16,7 +16,7 @@ * Modulebuilder module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Xoops Development Team */ diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index b78e59c5..42dd2113 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -20,7 +20,7 @@ * @category Migrate * @author Richard Griffith * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ diff --git a/class/Common/ModuleFeedback.php b/class/Common/ModuleFeedback.php index 92a5cace..747d2451 100644 --- a/class/Common/ModuleFeedback.php +++ b/class/Common/ModuleFeedback.php @@ -16,7 +16,7 @@ * Feedback plugin for xoops modules * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Michael Beck * @author Wedega - Email: * @author Fernando Santos (topet05) diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index c3593ba0..68534add 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -16,7 +16,7 @@ * Feedback plugin for xoops modules * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Michael Beck */ trait ModuleStats diff --git a/class/Fieldattributes.php b/class/Fieldattributes.php index c034f4db..20e62279 100644 --- a/class/Fieldattributes.php +++ b/class/Fieldattributes.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/FieldattributesHandler.php b/class/FieldattributesHandler.php index 4a982036..8339af83 100644 --- a/class/FieldattributesHandler.php +++ b/class/FieldattributesHandler.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/Fieldelements.php b/class/Fieldelements.php index 23067fdd..e55bc2e1 100644 --- a/class/Fieldelements.php +++ b/class/Fieldelements.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/FieldelementsHandler.php b/class/FieldelementsHandler.php index 120c627e..40ce8220 100644 --- a/class/FieldelementsHandler.php +++ b/class/FieldelementsHandler.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/Fieldkey.php b/class/Fieldkey.php index 9785a7e5..4d7b61e0 100644 --- a/class/Fieldkey.php +++ b/class/Fieldkey.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/FieldkeyHandler.php b/class/FieldkeyHandler.php index 72ece899..9711aee9 100644 --- a/class/FieldkeyHandler.php +++ b/class/FieldkeyHandler.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/Fieldnull.php b/class/Fieldnull.php index 66c8f79a..c45ced00 100644 --- a/class/Fieldnull.php +++ b/class/Fieldnull.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/FieldnullHandler.php b/class/FieldnullHandler.php index 93ff97a6..c4358abb 100644 --- a/class/FieldnullHandler.php +++ b/class/FieldnullHandler.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/Fields.php b/class/Fields.php index 48bd8e6c..e1a1cd21 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -18,7 +18,7 @@ * modulebuilderreate module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/FieldsHandler.php b/class/FieldsHandler.php index a7a8e473..c426e2c4 100644 --- a/class/FieldsHandler.php +++ b/class/FieldsHandler.php @@ -16,7 +16,7 @@ * modulebuilderreate module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/Fieldtype.php b/class/Fieldtype.php index 0938cdf3..67c310e8 100644 --- a/class/Fieldtype.php +++ b/class/Fieldtype.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/FieldtypeHandler.php b/class/FieldtypeHandler.php index bea512e4..4b930ebc 100644 --- a/class/FieldtypeHandler.php +++ b/class/FieldtypeHandler.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index 76518db6..2b6e0374 100644 --- a/class/Files/Admin/AdminBroken.php +++ b/class/Files/Admin/AdminBroken.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Admin/AdminHeader.php b/class/Files/Admin/AdminHeader.php index 97dc5e2b..4a4c1b66 100644 --- a/class/Files/Admin/AdminHeader.php +++ b/class/Files/Admin/AdminHeader.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index 7558acb2..4a782e98 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Admin/AdminMenu.php b/class/Files/Admin/AdminMenu.php index 9089cd0a..c3afe460 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index d49c1b8e..216753d6 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Assets/Css/Admin/CssAdminStyles.php b/class/Files/Assets/Css/Admin/CssAdminStyles.php index 856453e0..f5ac545a 100644 --- a/class/Files/Assets/Css/Admin/CssAdminStyles.php +++ b/class/Files/Assets/Css/Admin/CssAdminStyles.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Assets/Css/CssSelectors.php b/class/Files/Assets/Css/CssSelectors.php index 914ecf10..e038af90 100644 --- a/class/Files/Assets/Css/CssSelectors.php +++ b/class/Files/Assets/Css/CssSelectors.php @@ -15,7 +15,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Assets/Css/CssStyles.php b/class/Files/Assets/Css/CssStyles.php index 81ad0a16..51f909de 100644 --- a/class/Files/Assets/Css/CssStyles.php +++ b/class/Files/Assets/Css/CssStyles.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Assets/Js/JavascriptJQuery.php b/class/Files/Assets/Js/JavascriptJQuery.php index 822eee1a..9316eed9 100644 --- a/class/Files/Assets/Js/JavascriptJQuery.php +++ b/class/Files/Assets/Js/JavascriptJQuery.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Assets/Js/JsJquery.php b/class/Files/Assets/Js/JsJquery.php index db8b7ece..209922d3 100644 --- a/class/Files/Assets/Js/JsJquery.php +++ b/class/Files/Assets/Js/JsJquery.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 83708ad2..de45396f 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -19,7 +19,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CheckData.php b/class/Files/CheckData.php index 5876bc9a..73814e3f 100644 --- a/class/Files/CheckData.php +++ b/class/Files/CheckData.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index a079bb81..9e279739 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -18,7 +18,7 @@ * tc module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 582d1603..0080f075 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -18,7 +18,7 @@ * tc module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 3093d7f4..6a7ab677 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -18,7 +18,7 @@ * tc module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 1c6bccab..d0e2870c 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -18,7 +18,7 @@ * tc module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Classes/ClassXoopsCode.php b/class/Files/Classes/ClassXoopsCode.php index ae53c8a9..aac94da5 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Config/ConfigConfig.php b/class/Files/Config/ConfigConfig.php index 7d6b61bf..9d5c6332 100644 --- a/class/Files/Config/ConfigConfig.php +++ b/class/Files/Config/ConfigConfig.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateAbstractClass.php b/class/Files/CreateAbstractClass.php index eb0dcc9a..c301c887 100644 --- a/class/Files/CreateAbstractClass.php +++ b/class/Files/CreateAbstractClass.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 951fd3ef..030aa6b6 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index cb32696e..98d4bac9 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateMoreFiles.php b/class/Files/CreateMoreFiles.php index 354fc791..2360c549 100644 --- a/class/Files/CreateMoreFiles.php +++ b/class/Files/CreateMoreFiles.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreatePhpCode.php b/class/Files/CreatePhpCode.php index 4722056f..20d6ef6c 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index e1fd2455..9a4de641 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateStructure.php b/class/Files/CreateStructure.php index 587627f6..0ea7804e 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateTableFields.php b/class/Files/CreateTableFields.php index 34581127..f6a6d984 100644 --- a/class/Files/CreateTableFields.php +++ b/class/Files/CreateTableFields.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 062e19f4..e47278c7 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Docs/DocsChangelog.php b/class/Files/Docs/DocsChangelog.php index 62589c8e..9232b7fb 100644 --- a/class/Files/Docs/DocsChangelog.php +++ b/class/Files/Docs/DocsChangelog.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Docs/DocsFiles.php b/class/Files/Docs/DocsFiles.php index 113cb045..8b711093 100644 --- a/class/Files/Docs/DocsFiles.php +++ b/class/Files/Docs/DocsFiles.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeCommentFunctions.php b/class/Files/Includes/IncludeCommentFunctions.php index 592e476d..ca34deec 100644 --- a/class/Files/Includes/IncludeCommentFunctions.php +++ b/class/Files/Includes/IncludeCommentFunctions.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeComments.php b/class/Files/Includes/IncludeComments.php index 71de78cd..842ab399 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeCommon.php b/class/Files/Includes/IncludeCommon.php index acc0b1f2..167a99f4 100644 --- a/class/Files/Includes/IncludeCommon.php +++ b/class/Files/Includes/IncludeCommon.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeFunctions.php b/class/Files/Includes/IncludeFunctions.php index 627d6508..31359d1a 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeJquery.php b/class/Files/Includes/IncludeJquery.php index d6aa804c..51d9c060 100644 --- a/class/Files/Includes/IncludeJquery.php +++ b/class/Files/Includes/IncludeJquery.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeNotifications.php b/class/Files/Includes/IncludeNotifications.php index 29e1b77d..6400e49b 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index c91a8d84..45aff471 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 23a5c81b..13ddeb29 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index 91bdefb0..77a908cf 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageDefines.php b/class/Files/Language/LanguageDefines.php index aaaf35bd..5bb007a7 100644 --- a/class/Files/Language/LanguageDefines.php +++ b/class/Files/Language/LanguageDefines.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 5bc35062..68b33cd0 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageMailTpl.php b/class/Files/Language/LanguageMailTpl.php index 5d985e01..0deaccc5 100644 --- a/class/Files/Language/LanguageMailTpl.php +++ b/class/Files/Language/LanguageMailTpl.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index b0b9de88..38ce656a 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index c7759fac..8371d3de 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Sql/SqlFile.php b/class/Files/Sql/SqlFile.php index 586d82a8..59e9f178 100644 --- a/class/Files/Sql/SqlFile.php +++ b/class/Files/Sql/SqlFile.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminAbout.php b/class/Files/Templates/Admin/TemplatesAdminAbout.php index ee121567..7bd8519a 100644 --- a/class/Files/Templates/Admin/TemplatesAdminAbout.php +++ b/class/Files/Templates/Admin/TemplatesAdminAbout.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index 6856e96b..ea5a6b41 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminFooter.php b/class/Files/Templates/Admin/TemplatesAdminFooter.php index b4ecfe9a..95595f45 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminHeader.php b/class/Files/Templates/Admin/TemplatesAdminHeader.php index e855e553..0460174a 100644 --- a/class/Files/Templates/Admin/TemplatesAdminHeader.php +++ b/class/Files/Templates/Admin/TemplatesAdminHeader.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index 3edb7b86..33ec56f3 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 3bb05f84..f006279f 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Admin/TemplatesAdminPermissions.php b/class/Files/Templates/Admin/TemplatesAdminPermissions.php index a783a5b9..03459bcf 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 5f2acd21..b1f3fadb 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index b770c332..ce18f4f5 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -19,7 +19,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index d6b3441c..87c77841 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -19,7 +19,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php index 3fec6bcc..73385262 100644 --- a/class/Files/Templates/User/Defstyle/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -19,7 +19,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index 025d392d..7cfe1454 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php index 4091ac9f..9dbd65e8 100644 --- a/class/Files/Templates/User/Defstyle/Header.php +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index e63f94cb..85a1e9a1 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php index 2fa4407e..95293e60 100644 --- a/class/Files/Templates/User/Defstyle/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index 84284ee8..7cacd5b1 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 16397185..2138d0cc 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index eefdd949..74f25e78 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php index a675fe95..dd010c78 100644 --- a/class/Files/Templates/User/Defstyle/Pdf.php +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php index b7431cb4..c1e45e4a 100644 --- a/class/Files/Templates/User/Defstyle/Rate.php +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Rss.php b/class/Files/Templates/User/Defstyle/Rss.php index e4a87ae5..e6b87ffa 100644 --- a/class/Files/Templates/User/Defstyle/Rss.php +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/Search.php b/class/Files/Templates/User/Defstyle/Search.php index cb0af818..903b23c5 100644 --- a/class/Files/Templates/User/Defstyle/Search.php +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index c44562c5..9544d70a 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserFooter.php b/class/Files/User/UserFooter.php index e477dc67..6fd44354 100644 --- a/class/Files/User/UserFooter.php +++ b/class/Files/User/UserFooter.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserHeader.php b/class/Files/User/UserHeader.php index 5546b627..1392b2ee 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index e031ed17..024ca975 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserListTag.php b/class/Files/User/UserListTag.php index c4a3dd27..d752a5ec 100644 --- a/class/Files/User/UserListTag.php +++ b/class/Files/User/UserListTag.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserNotificationUpdate.php b/class/Files/User/UserNotificationUpdate.php index b4d5f417..10d2789e 100644 --- a/class/Files/User/UserNotificationUpdate.php +++ b/class/Files/User/UserNotificationUpdate.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index cd82a86f..259785d0 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index 0fb461f9..67cc040e 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 3e4c1b43..ee075770 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index 79a77b3b..154f6243 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserRss.php b/class/Files/User/UserRss.php index 684ec76a..1866c2e7 100644 --- a/class/Files/User/UserRss.php +++ b/class/Files/User/UserRss.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index 1eb8209e..6051088d 100644 --- a/class/Files/User/UserSearch.php +++ b/class/Files/User/UserSearch.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserViewTag.php b/class/Files/User/UserViewTag.php index a0758b24..44bb1bad 100644 --- a/class/Files/User/UserViewTag.php +++ b/class/Files/User/UserViewTag.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index f47e79fd..99cddc62 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 863c618c..8e43fc1e 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * @@ -148,7 +148,7 @@ private function getXoopsVersionHeader($module, $language) 'author_website_name' => "'{$module->getVar('mod_author_website_name')}'", 'credits' => "'{$module->getVar('mod_credits')}'", 'license' => "'{$module->getVar('mod_license')}'", - 'license_url' => "'http://www.gnu.org/licenses/gpl-3.0.en.html'", + 'license_url' => "'https://www.gnu.org/licenses/gpl-3.0.en.html'", 'help' => "'page=help'", 'release_info' => "'{$module->getVar('mod_release_info')}'", 'release_file' => "\XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_release_file')}'", diff --git a/class/Files/admin/AdminAbout.php b/class/Files/admin/AdminAbout.php index 636a5f20..100db6a3 100644 --- a/class/Files/admin/AdminAbout.php +++ b/class/Files/admin/AdminAbout.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/admin/AdminFooter.php b/class/Files/admin/AdminFooter.php index e8d32869..a11be556 100644 --- a/class/Files/admin/AdminFooter.php +++ b/class/Files/admin/AdminFooter.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 81cf9772..0cf5031c 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -21,7 +21,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index 8ebeb0aa..78a33c06 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -17,7 +17,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Form/FormRadio.php b/class/Form/FormRadio.php index 2395a48b..b99be6c3 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -12,8 +12,8 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS project https://xoops.org/ - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @copyright The XOOPS Project (https://xoops.org) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 1.91 * diff --git a/class/Form/FormRaw.php b/class/Form/FormRaw.php index 6f996562..13d31d01 100644 --- a/class/Form/FormRaw.php +++ b/class/Form/FormRaw.php @@ -22,7 +22,7 @@ * * @author trabis * @copyright 2012-2014 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 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 a1fb813d..7ca65cd9 100644 --- a/class/Form/FormTab.php +++ b/class/Form/FormTab.php @@ -18,7 +18,7 @@ * * @author trabis * @copyright 2012-2014 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.0.0 diff --git a/class/Form/FormTabTray.php b/class/Form/FormTabTray.php index cf18a3af..1c752600 100644 --- a/class/Form/FormTabTray.php +++ b/class/Form/FormTabTray.php @@ -20,7 +20,7 @@ * * @author trabis * @copyright 2012-2014 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 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 b0ba2c3a..be516480 100644 --- a/class/Form/SimpleForm.php +++ b/class/Form/SimpleForm.php @@ -13,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.0.0 * diff --git a/class/Form/ThemeForm.php b/class/Form/ThemeForm.php index cc005ed7..c6cfd88f 100644 --- a/class/Form/ThemeForm.php +++ b/class/Form/ThemeForm.php @@ -15,7 +15,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.5 * diff --git a/class/Helper.php b/class/Helper.php index c40c3ecb..2c3ca0cf 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -13,11 +13,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @copyright XOOPS Project (https://xoops.org) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author XOOPS Development Team */ //\defined('XOOPS_ROOT_PATH') || die('Restricted access'); @@ -70,7 +68,7 @@ public function getDirname() */ public function getHandler($name) { - $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; + $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } diff --git a/class/Html/FormLabel.php b/class/Html/FormLabel.php index 125b3a90..edd7cb1f 100644 --- a/class/Html/FormLabel.php +++ b/class/Html/FormLabel.php @@ -13,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.0.0 * diff --git a/class/Logo.php b/class/Logo.php index 910fc0cd..c360f4fc 100644 --- a/class/Logo.php +++ b/class/Logo.php @@ -16,7 +16,7 @@ * modules class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/LogoGenerator.php b/class/LogoGenerator.php index b5cbc390..41cd8181 100644 --- a/class/LogoGenerator.php +++ b/class/LogoGenerator.php @@ -15,7 +15,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/class/Modules.php b/class/Modules.php index 67636efe..806f386a 100644 --- a/class/Modules.php +++ b/class/Modules.php @@ -18,7 +18,7 @@ * modules class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/ModulesHandler.php b/class/ModulesHandler.php index 1474b722..cab75f83 100644 --- a/class/ModulesHandler.php +++ b/class/ModulesHandler.php @@ -16,7 +16,7 @@ * modules class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/Morefiles.php b/class/Morefiles.php index bc95455c..096db1d0 100644 --- a/class/Morefiles.php +++ b/class/Morefiles.php @@ -18,7 +18,7 @@ * morefiles class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/MorefilesHandler.php b/class/MorefilesHandler.php index 36c8a199..d0b51f47 100644 --- a/class/MorefilesHandler.php +++ b/class/MorefilesHandler.php @@ -16,7 +16,7 @@ * morefiles class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/Settings.php b/class/Settings.php index d89d247e..87dde86b 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -18,7 +18,7 @@ * settings class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/SettingsHandler.php b/class/SettingsHandler.php index da2f47d7..540434a6 100644 --- a/class/SettingsHandler.php +++ b/class/SettingsHandler.php @@ -16,7 +16,7 @@ * settings class. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/Tables.php b/class/Tables.php index c3d2e66a..7f8b3c45 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/TablesHandler.php b/class/TablesHandler.php index 9a80df23..3029f188 100644 --- a/class/TablesHandler.php +++ b/class/TablesHandler.php @@ -18,7 +18,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * diff --git a/class/autoload.php b/class/autoload.php index df6c5262..9127cb3b 100644 --- a/class/autoload.php +++ b/class/autoload.php @@ -15,7 +15,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/files/commonfiles/admin/feedback.php b/files/commonfiles/admin/feedback.php index ff6ff81d..cac7e71f 100644 --- a/files/commonfiles/admin/feedback.php +++ b/files/commonfiles/admin/feedback.php @@ -13,7 +13,7 @@ * Feedback plugin for xoops modules * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 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 a4e3f8b9..bcab7155 100644 --- a/files/commonfiles/class/Common/Breadcrumb.php +++ b/files/commonfiles/class/Common/Breadcrumb.php @@ -15,7 +15,7 @@ /** * Breadcrumb Class * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author lucio * @package Modulebuilder diff --git a/files/commonfiles/class/Common/DirectoryChecker.php b/files/commonfiles/class/Common/DirectoryChecker.php index 9791289c..1788f4d0 100644 --- a/files/commonfiles/class/Common/DirectoryChecker.php +++ b/files/commonfiles/class/Common/DirectoryChecker.php @@ -16,7 +16,7 @@ * Modulebuilder module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Xoops Development Team */ diff --git a/files/commonfiles/class/Common/FileChecker.php b/files/commonfiles/class/Common/FileChecker.php index 127b2303..d0d870f7 100644 --- a/files/commonfiles/class/Common/FileChecker.php +++ b/files/commonfiles/class/Common/FileChecker.php @@ -16,7 +16,7 @@ * Modulebuilder module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Xoops Development Team */ diff --git a/files/commonfiles/class/Common/Migrate.php b/files/commonfiles/class/Common/Migrate.php index b78e59c5..42dd2113 100644 --- a/files/commonfiles/class/Common/Migrate.php +++ b/files/commonfiles/class/Common/Migrate.php @@ -20,7 +20,7 @@ * @category Migrate * @author Richard Griffith * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ diff --git a/files/commonfiles/class/Common/ModuleFeedback.php b/files/commonfiles/class/Common/ModuleFeedback.php index 92a5cace..747d2451 100644 --- a/files/commonfiles/class/Common/ModuleFeedback.php +++ b/files/commonfiles/class/Common/ModuleFeedback.php @@ -16,7 +16,7 @@ * Feedback plugin for xoops modules * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 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/ModuleStats.php b/files/commonfiles/class/Common/ModuleStats.php index c3593ba0..68534add 100644 --- a/files/commonfiles/class/Common/ModuleStats.php +++ b/files/commonfiles/class/Common/ModuleStats.php @@ -16,7 +16,7 @@ * Feedback plugin for xoops modules * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 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 c87b384b..106fa07d 100644 --- a/files/commonfiles/class/Common/Resizer.php +++ b/files/commonfiles/class/Common/Resizer.php @@ -65,8 +65,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; diff --git a/files/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php index 650b6281..760e0b68 100644 --- a/files/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -13,11 +13,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @copyright XOOPS Project (https://xoops.org) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author XOOPS Development Team */ //\defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php index 1750e879..15757bdc 100644 --- a/files/commonfiles/include/xoops_version.inc.php +++ b/files/commonfiles/include/xoops_version.inc.php @@ -10,11 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @author XOOPS Development Team * @param mixed $val */ diff --git a/files/commonfiles/preloads/core.php b/files/commonfiles/preloads/core.php index 3ec985a1..1644fa5a 100644 --- a/files/commonfiles/preloads/core.php +++ b/files/commonfiles/preloads/core.php @@ -11,7 +11,7 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @author XOOPS Project */ \defined('XOOPS_ROOT_PATH') || die('Restricted access.'); @@ -22,7 +22,6 @@ class ModulebuilderCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader - /** * @param $args */ diff --git a/files/commonfiles/testdata/index.php b/files/commonfiles/testdata/index.php index e49aa104..33ecf71c 100644 --- a/files/commonfiles/testdata/index.php +++ b/files/commonfiles/testdata/index.php @@ -7,8 +7,8 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @copyright XOOPS Project (https://xoops.org) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package * @since 2.5.11 * @author Michael Beck (aka Mamba) diff --git a/include/common.php b/include/common.php index 4273cf05..87de8a74 100644 --- a/include/common.php +++ b/include/common.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/include/functions.php b/include/functions.php index ddfcc2cd..3de2ddb6 100644 --- a/include/functions.php +++ b/include/functions.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/include/update.php b/include/update.php index a7ae0c88..13864c5f 100644 --- a/include/update.php +++ b/include/update.php @@ -14,7 +14,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/language/english/admin.php b/language/english/admin.php index 89a5d539..7d90b076 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/language/english/common.php b/language/english/common.php index f52d1502..fa2b5813 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -13,7 +13,7 @@ * Wfdownloads module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package wfdownload * @since 3.23 * @author Xoops Development Team diff --git a/language/english/feedback.php b/language/english/feedback.php index c91faa03..0845cf08 100644 --- a/language/english/feedback.php +++ b/language/english/feedback.php @@ -20,7 +20,7 @@ * @author XOOPS - Website: */ -$moduleDirName = \basename(dirname(__DIR__, 2)); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index dc7e1220..026dc602 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * diff --git a/preloads/autoloader.php b/preloads/autoloader.php index a3607c51..f921da66 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -9,7 +9,7 @@ static function ($class) { $prefix = 'XoopsModules\\' . \ucfirst(\basename(\dirname(__DIR__))); // base directory for the namespace prefix - $baseDir = __DIR__ . '/../class/'; + $baseDir = dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? $len = mb_strlen($prefix); diff --git a/preloads/core.php b/preloads/core.php index 3ec985a1..1644fa5a 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -11,7 +11,7 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @author XOOPS Project */ \defined('XOOPS_ROOT_PATH') || die('Restricted access.'); @@ -22,7 +22,6 @@ class ModulebuilderCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader - /** * @param $args */ diff --git a/testdata/index.php b/testdata/index.php index e49aa104..5ad5f8d8 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -8,7 +8,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package * @since 2.5.11 * @author Michael Beck (aka Mamba) diff --git a/xoops_version.php b/xoops_version.php index 8f93c687..01b791ad 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -13,7 +13,7 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.7 * @@ -54,7 +54,7 @@ $modversion['targetdir'] = XOOPS_UPLOAD_PATH . "/{$moduleDirName}/repository/"; $modversion['module_website_url'] = 'https://github.com/XoopsModules25x/modulebuilder'; $modversion['module_website_name'] = 'GitHub Xoops'; -$modversion['min_php'] = '7.2'; +$modversion['min_php'] = '7.3'; $modversion['min_xoops'] = '2.5.11-Beta 2'; $modversion['min_admin'] = '1.2'; $modversion['min_db'] = ['mysql' => '5.5']; @@ -437,7 +437,7 @@ 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', - 'default' => 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.html', + 'default' => 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', ]; $modversion['config'][] = [ From 1eea234120368fb1aa9b50b65f5952c9fe79a62f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 20 Jun 2021 19:08:37 -0400 Subject: [PATCH 142/266] fix for $contElseInt --- class/Files/admin/AdminXoopsCode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index 78a33c06..911beb70 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -326,7 +326,7 @@ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $format $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; $ifelse .= $t . "\t{$fetchMedia};\n"; $contIf = $this->xc->getXcSetVarObj($tableName, $fieldName, '$uploader->getSavedFileName()', $t . "\t\t"); - $contElseInt .= $this->xc->getXcEqualsOperator('$uploaderErrors', "'
    ' . \$uploader->getErrors()", '.', $t . "\t\t"); + $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"); From b1b2b336874081568761b3a64b02d7bbe307c346 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 23 Jun 2021 12:10:11 +0200 Subject: [PATCH 143/266] - added clone feature for items --- admin/about.php | 3 +- admin/building.php | 3 +- admin/fields.php | 3 +- admin/footer.php | 3 +- admin/header.php | 3 +- admin/index.php | 3 +- admin/menu.php | 3 +- admin/tables.php | 3 +- admin/test.php | 5 ++- class/Common/TableChecker.php | 2 +- class/Fieldattributes.php | 2 +- class/FieldattributesHandler.php | 2 +- class/Fields.php | 2 +- class/FieldsHandler.php | 2 +- class/Files/Admin/AdminBroken.php | 3 +- class/Files/Admin/AdminHeader.php | 3 +- class/Files/Admin/AdminIndex.php | 3 +- class/Files/Admin/AdminMenu.php | 3 +- class/Files/Admin/AdminPermissions.php | 3 +- .../Files/Assets/Css/Admin/CssAdminStyles.php | 3 +- class/Files/Assets/Css/CssSelectors.php | 3 +- class/Files/Assets/Css/CssStyles.php | 3 +- class/Files/Assets/Js/JavascriptJQuery.php | 3 +- class/Files/Assets/Js/JsJquery.php | 3 +- class/Files/Blocks/BlocksFiles.php | 3 +- class/Files/CheckData.php | 3 +- class/Files/Classes/ClassFiles.php | 3 +- class/Files/Classes/ClassFormElements.php | 3 +- class/Files/Classes/ClassHandlerFiles.php | 3 +- class/Files/Classes/ClassSpecialFiles.php | 3 +- class/Files/Classes/ClassXoopsCode.php | 3 +- class/Files/Config/ConfigConfig.php | 3 +- class/Files/CreateAbstractClass.php | 3 +- class/Files/CreateArchitecture.php | 3 +- class/Files/CreateFile.php | 3 +- class/Files/CreateHtmlCode.php | 5 ++- class/Files/CreateMoreFiles.php | 3 +- class/Files/CreatePhpCode.php | 3 +- class/Files/CreateSmartyCode.php | 3 +- class/Files/CreateStructure.php | 3 +- class/Files/CreateTableFields.php | 3 +- class/Files/CreateXoopsCode.php | 25 ++++++++++- class/Files/Docs/DocsChangelog.php | 3 +- class/Files/Docs/DocsFiles.php | 3 +- .../Includes/IncludeCommentFunctions.php | 3 +- class/Files/Includes/IncludeComments.php | 3 +- class/Files/Includes/IncludeCommon.php | 3 +- class/Files/Includes/IncludeFunctions.php | 3 +- class/Files/Includes/IncludeJquery.php | 3 +- class/Files/Includes/IncludeNotifications.php | 3 +- class/Files/Includes/IncludeSearch.php | 3 +- class/Files/Language/LanguageAdmin.php | 3 +- class/Files/Language/LanguageBlocks.php | 3 +- class/Files/Language/LanguageDefines.php | 3 +- class/Files/Language/LanguageHelp.php | 3 +- class/Files/Language/LanguageMailTpl.php | 3 +- class/Files/Language/LanguageMain.php | 13 +++--- class/Files/Language/LanguageModinfo.php | 3 +- class/Files/Sql/SqlFile.php | 5 ++- .../Templates/Admin/TemplatesAdminAbout.php | 3 +- .../Templates/Admin/TemplatesAdminBroken.php | 3 +- .../Templates/Admin/TemplatesAdminFooter.php | 3 +- .../Templates/Admin/TemplatesAdminHeader.php | 3 +- .../Templates/Admin/TemplatesAdminIndex.php | 3 +- .../Templates/Admin/TemplatesAdminPages.php | 8 +++- .../Admin/TemplatesAdminPermissions.php | 3 +- .../Blocks/Defstyle/TemplatesBlocks.php | 3 +- .../Templates/User/Defstyle/Breadcrumbs.php | 3 +- .../Templates/User/Defstyle/Categories.php | 3 +- .../User/Defstyle/CategoriesList.php | 3 +- .../Files/Templates/User/Defstyle/Footer.php | 3 +- .../Files/Templates/User/Defstyle/Header.php | 3 +- class/Files/Templates/User/Defstyle/Index.php | 3 +- .../Templates/User/Defstyle/MoreFiles.php | 3 +- class/Files/Templates/User/Defstyle/Pages.php | 3 +- .../Templates/User/Defstyle/PagesItem.php | 23 +++++----- .../Templates/User/Defstyle/PagesList.php | 3 +- class/Files/Templates/User/Defstyle/Pdf.php | 3 +- class/Files/Templates/User/Defstyle/Rate.php | 3 +- class/Files/Templates/User/Defstyle/Rss.php | 3 +- .../Files/Templates/User/Defstyle/Search.php | 3 +- .../Templates/User/Defstyle/UserPrint.php | 3 +- class/Files/User/UserFooter.php | 3 +- class/Files/User/UserHeader.php | 3 +- class/Files/User/UserIndex.php | 3 +- class/Files/User/UserListTag.php | 3 +- class/Files/User/UserNotificationUpdate.php | 3 +- class/Files/User/UserPages.php | 33 +++++++++++++- class/Files/User/UserPdf.php | 3 +- class/Files/User/UserPrint.php | 3 +- class/Files/User/UserRate.php | 3 +- class/Files/User/UserRss.php | 3 +- class/Files/User/UserSearch.php | 3 +- class/Files/User/UserViewTag.php | 3 +- class/Files/User/UserXoopsCode.php | 3 +- class/Files/User/UserXoopsVersion.php | 3 +- class/Files/admin/AdminAbout.php | 3 +- class/Files/admin/AdminFooter.php | 3 +- class/Files/admin/AdminPages.php | 43 ++++++++++++++++--- class/Files/admin/AdminXoopsCode.php | 3 +- class/Form/FormRadio.php | 2 +- class/Helper.php | 8 ++-- class/Logo.php | 2 +- class/Modules.php | 2 +- class/ModulesHandler.php | 2 +- class/Morefiles.php | 2 +- class/MorefilesHandler.php | 2 +- class/Tables.php | 2 +- class/TablesHandler.php | 2 +- class/Utility.php | 4 +- class/autoload.php | 3 +- config/config.php | 2 +- docs/changelog.txt | 1 + files/commonfiles/class/Common/Breadcrumb.php | 2 +- files/commonfiles/class/Common/Resizer.php | 4 +- .../commonfiles/class/Common/TableChecker.php | 2 +- files/commonfiles/class/Helper.php | 6 ++- files/commonfiles/class/Utility.php | 4 +- .../commonfiles/include/xoops_version.inc.php | 6 ++- files/commonfiles/language/english/common.php | 2 +- files/commonfiles/preloads/core.php | 1 + files/commonfiles/testdata/index.php | 2 +- include/common.php | 3 +- include/functions.php | 7 +-- include/update.php | 3 +- language/english/admin.php | 3 +- language/english/feedback.php | 2 +- language/english/help/help.html | 2 +- language/english/modinfo.php | 3 +- preloads/autoloader.php | 2 +- preloads/core.php | 1 + xoops_version.php | 5 ++- 132 files changed, 362 insertions(+), 160 deletions(-) diff --git a/admin/about.php b/admin/about.php index 1c509f18..6810ce60 100644 --- a/admin/about.php +++ b/admin/about.php @@ -18,7 +18,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org */ require __DIR__ . '/header.php'; diff --git a/admin/building.php b/admin/building.php index 1349a5c1..5ff7601e 100644 --- a/admin/building.php +++ b/admin/building.php @@ -17,7 +17,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/admin/fields.php b/admin/fields.php index 8785a352..0133bf3c 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -27,7 +27,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/admin/footer.php b/admin/footer.php index 09cdf644..635f2013 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -18,7 +18,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ $pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); diff --git a/admin/header.php b/admin/header.php index 9be7db0f..e0db23f5 100644 --- a/admin/header.php +++ b/admin/header.php @@ -17,7 +17,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ require \dirname(__DIR__) . '/preloads/autoloader.php'; diff --git a/admin/index.php b/admin/index.php index a3b386b5..d5d95135 100644 --- a/admin/index.php +++ b/admin/index.php @@ -18,7 +18,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/admin/menu.php b/admin/menu.php index ac021303..87bcf462 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -18,7 +18,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ require \dirname(__DIR__) . '/preloads/autoloader.php'; diff --git a/admin/tables.php b/admin/tables.php index b0314461..ef32a0e6 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -18,7 +18,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/admin/test.php b/admin/test.php index 686713fc..5602d766 100644 --- a/admin/test.php +++ b/admin/test.php @@ -14,11 +14,12 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index d2c2defd..7b00512c 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -20,7 +20,7 @@ * @category Table Checker * @author Goffy * @copyright 2021 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ diff --git a/class/Fieldattributes.php b/class/Fieldattributes.php index 20e62279..b7366d37 100644 --- a/class/Fieldattributes.php +++ b/class/Fieldattributes.php @@ -21,7 +21,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/FieldattributesHandler.php b/class/FieldattributesHandler.php index 8339af83..a4da21c3 100644 --- a/class/FieldattributesHandler.php +++ b/class/FieldattributesHandler.php @@ -21,7 +21,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/Fields.php b/class/Fields.php index e1a1cd21..6a8fd9a3 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -22,7 +22,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/FieldsHandler.php b/class/FieldsHandler.php index c426e2c4..e4d26e76 100644 --- a/class/FieldsHandler.php +++ b/class/FieldsHandler.php @@ -20,7 +20,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index 2b6e0374..290fb60d 100644 --- a/class/Files/Admin/AdminBroken.php +++ b/class/Files/Admin/AdminBroken.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Admin/AdminHeader.php b/class/Files/Admin/AdminHeader.php index 4a4c1b66..8f3b4a91 100644 --- a/class/Files/Admin/AdminHeader.php +++ b/class/Files/Admin/AdminHeader.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index 4a782e98..0471e333 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Admin/AdminMenu.php b/class/Files/Admin/AdminMenu.php index c3afe460..c82d0c0d 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index 216753d6..5586feba 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Assets/Css/Admin/CssAdminStyles.php b/class/Files/Assets/Css/Admin/CssAdminStyles.php index f5ac545a..20551f14 100644 --- a/class/Files/Assets/Css/Admin/CssAdminStyles.php +++ b/class/Files/Assets/Css/Admin/CssAdminStyles.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Assets/Css/CssSelectors.php b/class/Files/Assets/Css/CssSelectors.php index e038af90..0978d400 100644 --- a/class/Files/Assets/Css/CssSelectors.php +++ b/class/Files/Assets/Css/CssSelectors.php @@ -19,7 +19,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Assets/Css/CssStyles.php b/class/Files/Assets/Css/CssStyles.php index 51f909de..2a12ff4c 100644 --- a/class/Files/Assets/Css/CssStyles.php +++ b/class/Files/Assets/Css/CssStyles.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Assets/Js/JavascriptJQuery.php b/class/Files/Assets/Js/JavascriptJQuery.php index 9316eed9..202181d7 100644 --- a/class/Files/Assets/Js/JavascriptJQuery.php +++ b/class/Files/Assets/Js/JavascriptJQuery.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Assets/Js/JsJquery.php b/class/Files/Assets/Js/JsJquery.php index 209922d3..7c8742c6 100644 --- a/class/Files/Assets/Js/JsJquery.php +++ b/class/Files/Assets/Js/JsJquery.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ \defined('XOOPS_ROOT_PATH') || exit('Restricted access'); diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index de45396f..8e9a392d 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -23,7 +23,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CheckData.php b/class/Files/CheckData.php index 73814e3f..2199ff8a 100644 --- a/class/Files/CheckData.php +++ b/class/Files/CheckData.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 9e279739..2477249f 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 0080f075..68692bf7 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 6a7ab677..a857981e 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index d0e2870c..53d24dea 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Classes/ClassXoopsCode.php b/class/Files/Classes/ClassXoopsCode.php index aac94da5..1dc0f6fa 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Config/ConfigConfig.php b/class/Files/Config/ConfigConfig.php index 9d5c6332..9b5ba9a3 100644 --- a/class/Files/Config/ConfigConfig.php +++ b/class/Files/Config/ConfigConfig.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateAbstractClass.php b/class/Files/CreateAbstractClass.php index c301c887..04c972b6 100644 --- a/class/Files/CreateAbstractClass.php +++ b/class/Files/CreateAbstractClass.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 030aa6b6..1f839a98 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 98d4bac9..61ec80ab 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ \xoops_load('XoopsFile'); diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index 995906e5..c227a4e3 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -17,11 +17,12 @@ * modulebuilder module. * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateMoreFiles.php b/class/Files/CreateMoreFiles.php index 2360c549..8cc8bfe8 100644 --- a/class/Files/CreateMoreFiles.php +++ b/class/Files/CreateMoreFiles.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreatePhpCode.php b/class/Files/CreatePhpCode.php index 20d6ef6c..ac88197f 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index 9a4de641..f0c12650 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateStructure.php b/class/Files/CreateStructure.php index 0ea7804e..d9d9fb23 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateTableFields.php b/class/Files/CreateTableFields.php index f6a6d984..4e48dd70 100644 --- a/class/Files/CreateTableFields.php +++ b/class/Files/CreateTableFields.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index e47278c7..08cc3c49 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -1784,6 +1785,28 @@ public function getXcCommonPagesNew($tableName, $t = '') return $ret; } + /** + * @public function getXcCommonPagesClone + * @param $tableName + * @param $ccFieldId + * @param string $t + * @return string + */ + public function getXcCommonPagesClone($tableName, $ccFieldId, $t = '') + { + $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); + $ret .= $xc->getXcEqualsOperator('$' . $tableName . 'Obj', '$' . $tableName . 'ObjSource->xoopsClone()', null, $t); + $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + + return $ret; + } + + /** * @public function getXcCommonPagesDelete * @param $language diff --git a/class/Files/Docs/DocsChangelog.php b/class/Files/Docs/DocsChangelog.php index 9232b7fb..e0124720 100644 --- a/class/Files/Docs/DocsChangelog.php +++ b/class/Files/Docs/DocsChangelog.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Docs/DocsFiles.php b/class/Files/Docs/DocsFiles.php index 8b711093..b2a845dc 100644 --- a/class/Files/Docs/DocsFiles.php +++ b/class/Files/Docs/DocsFiles.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Includes/IncludeCommentFunctions.php b/class/Files/Includes/IncludeCommentFunctions.php index ca34deec..7928515d 100644 --- a/class/Files/Includes/IncludeCommentFunctions.php +++ b/class/Files/Includes/IncludeCommentFunctions.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Includes/IncludeComments.php b/class/Files/Includes/IncludeComments.php index 842ab399..9327f01b 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Includes/IncludeCommon.php b/class/Files/Includes/IncludeCommon.php index 167a99f4..f5fdb982 100644 --- a/class/Files/Includes/IncludeCommon.php +++ b/class/Files/Includes/IncludeCommon.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Includes/IncludeFunctions.php b/class/Files/Includes/IncludeFunctions.php index 31359d1a..07746a1e 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Includes/IncludeJquery.php b/class/Files/Includes/IncludeJquery.php index 51d9c060..977231f5 100644 --- a/class/Files/Includes/IncludeJquery.php +++ b/class/Files/Includes/IncludeJquery.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ \defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/class/Files/Includes/IncludeNotifications.php b/class/Files/Includes/IncludeNotifications.php index 6400e49b..5e904b4c 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index 45aff471..c54b1424 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 13ddeb29..7c24974f 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index 77a908cf..7be01d88 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Language/LanguageDefines.php b/class/Files/Language/LanguageDefines.php index 5bb007a7..1f2dbd45 100644 --- a/class/Files/Language/LanguageDefines.php +++ b/class/Files/Language/LanguageDefines.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 68b33cd0..9cb785d3 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Language/LanguageMailTpl.php b/class/Files/Language/LanguageMailTpl.php index 0deaccc5..8fc17156 100644 --- a/class/Files/Language/LanguageMailTpl.php +++ b/class/Files/Language/LanguageMailTpl.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index 38ce656a..71906067 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -105,7 +106,7 @@ private function getLanguageMain($module, $language) $language, 'INDEX_DESC', "Welcome to the homepage of your new module {$moduleName}!
    -As you can see, you have created a page with a list of links at the top to navigate between the pages of your module. This description is only visible on the homepage of this module, the other pages you will see the content you created when you built this module with the module ModuleBuilder, and after creating new content in admin of this module. In order to expand this module with other resources, just add the code you need to extend the functionality of the same. The files are grouped by type, from the header to the footer to see how divided the source code.

    If you see this message, it is because you have not created content for this module. Once you have created any type of content, you will not see this message.

    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!

    Use the link below to go to the admin and create content.", +As you can see, you have created a page with a list of links at the top to navigate between the pages of your module. This description is only visible on the homepage of this module, the other pages you will see the content you created when you built this module with the module ModuleBuilder, and after creating new content in admin of this module. In order to expand this module with other resources, just add the code you need to extend the functionality of the same. The files are grouped by type, from the header to the footer to see how divided the source code.

    If you see this message, it is because you have not created content for this module. Once you have created any type of content, you will not see this message.

    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!

    Use the link below to go to the admin and create content.", true ); $ret .= $this->ld->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); @@ -144,16 +145,16 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getAboveDefines($ucfTableSoleName); $ret .= $this->ld->getDefine($language, $stuTableSoleName, $ucfTableSoleName); if (1 === $tableSubmit) { - $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_ADD", "Add {$ucfTableName}"); - $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_EDIT", "Edit {$ucfTableName}"); - $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_DELETE", "Delete {$ucfTableName}"); + $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_ADD", "Add {$ucfTableSoleName}"); + $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_EDIT", "Edit {$ucfTableSoleName}"); + $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_DELETE", "Delete {$ucfTableSoleName}"); + $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_CLONE", "Clone {$ucfTableSoleName}"); } $ret .= $this->ld->getDefine($language, $stuTableName, $ucfTableName); $ret .= $this->ld->getDefine($language, "{$stuTableName}_LIST", "List of {$ucfTableName}"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_TITLE", "{$ucfTableName} title"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_DESC", "{$ucfTableName} description"); - $ret .= $this->ld->getAboveDefines("Caption of {$ucfTableSoleName}"); $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); foreach (\array_keys($fields) as $f) { diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 8371d3de..08512ecb 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Sql/SqlFile.php b/class/Files/Sql/SqlFile.php index 59e9f178..2fb77d7f 100644 --- a/class/Files/Sql/SqlFile.php +++ b/class/Files/Sql/SqlFile.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -255,7 +256,7 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa case 12: $type = $fieldTypeName . '(' . $fieldValue . ')'; if (empty($fieldDefault)) { - $default = "DEFAULT 'http:\\'"; + $default = "DEFAULT 'https:\\'"; } else { $default = "DEFAULT '{$fieldDefault}'"; } diff --git a/class/Files/Templates/Admin/TemplatesAdminAbout.php b/class/Files/Templates/Admin/TemplatesAdminAbout.php index 7bd8519a..29a33c03 100644 --- a/class/Files/Templates/Admin/TemplatesAdminAbout.php +++ b/class/Files/Templates/Admin/TemplatesAdminAbout.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index ea5a6b41..4fb6af68 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/Admin/TemplatesAdminFooter.php b/class/Files/Templates/Admin/TemplatesAdminFooter.php index 95595f45..9cc8fa14 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/Admin/TemplatesAdminHeader.php b/class/Files/Templates/Admin/TemplatesAdminHeader.php index 0460174a..772e1a38 100644 --- a/class/Files/Templates/Admin/TemplatesAdminHeader.php +++ b/class/Files/Templates/Admin/TemplatesAdminHeader.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index 33ec56f3..b3ba9f0b 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index f006279f..aad62274 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -209,6 +210,11 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 edit.png'); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); + $lang = $this->sc->getSmartyConst('', '_CLONE'); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); + $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 editcopy.png'); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); + $anchor .= $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=clone&{$fieldId}_source=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_DELETE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 delete.png'); diff --git a/class/Files/Templates/Admin/TemplatesAdminPermissions.php b/class/Files/Templates/Admin/TemplatesAdminPermissions.php index 03459bcf..1c19096a 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index b1f3fadb..9786cceb 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index ce18f4f5..72c25e31 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -23,7 +23,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index 87c77841..82192619 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -23,7 +23,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php index 73385262..5ab8698b 100644 --- a/class/Files/Templates/User/Defstyle/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -23,7 +23,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index 7cfe1454..cc311d53 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php index 9dbd65e8..dbdaf034 100644 --- a/class/Files/Templates/User/Defstyle/Header.php +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 85a1e9a1..95ffae55 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php index 95293e60..0239ff2f 100644 --- a/class/Files/Templates/User/Defstyle/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index 7cacd5b1..8d5f33d3 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 2138d0cc..25496855 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -180,17 +181,19 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table } } - $anchors = ''; - $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); - $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=list&#{$ccFieldId}_" . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); - $lang = $this->sc->getSmartyConst($language, 'DETAILS'); + $anchors = ''; + $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); + $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=list&#{$ccFieldId}_" . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $lang = $this->sc->getSmartyConst($language, 'DETAILS'); $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); $anchors .= $this->sc->getSmartyConditions('showItem', '', '', $contIf, $contElse, '', '', "\t\t"); - $lang = $this->sc->getSmartyConst('', '_EDIT'); - $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); - $lang = $this->sc->getSmartyConst('', '_DELETE'); - $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-danger right', '', "\t\t\t", "\n"); - $anchors .= $this->sc->getSmartyConditions('permEdit', '', '', $contIf, false, '', '', "\t\t"); + $lang = $this->sc->getSmartyConst('', '_EDIT'); + $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); + $lang = $this->sc->getSmartyConst('', '_CLONE'); + $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=clone&{$fieldId}_source=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); + $lang = $this->sc->getSmartyConst('', '_DELETE'); + $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-danger right', '', "\t\t\t", "\n"); + $anchors .= $this->sc->getSmartyConditions('permEdit', '', '', $contIf, false, '', '', "\t\t"); if (1 == $tableBroken) { $lang = $this->sc->getSmartyConst($language, 'BROKEN'); $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index 74f25e78..cccaf20a 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php index dd010c78..7d53906e 100644 --- a/class/Files/Templates/User/Defstyle/Pdf.php +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php index c1e45e4a..c8a7fedd 100644 --- a/class/Files/Templates/User/Defstyle/Rate.php +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Rss.php b/class/Files/Templates/User/Defstyle/Rss.php index e6b87ffa..d34fe849 100644 --- a/class/Files/Templates/User/Defstyle/Rss.php +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/Search.php b/class/Files/Templates/User/Defstyle/Search.php index 903b23c5..9978a23a 100644 --- a/class/Files/Templates/User/Defstyle/Search.php +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index 9544d70a..f3940100 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserFooter.php b/class/Files/User/UserFooter.php index 6fd44354..d313d87d 100644 --- a/class/Files/User/UserFooter.php +++ b/class/Files/User/UserFooter.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserHeader.php b/class/Files/User/UserHeader.php index 1392b2ee..2cd8e058 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index 024ca975..ef70ba4f 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserListTag.php b/class/Files/User/UserListTag.php index d752a5ec..552e9648 100644 --- a/class/Files/User/UserListTag.php +++ b/class/Files/User/UserListTag.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserNotificationUpdate.php b/class/Files/User/UserNotificationUpdate.php index 10d2789e..0aed41ff 100644 --- a/class/Files/User/UserNotificationUpdate.php +++ b/class/Files/User/UserNotificationUpdate.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 259785d0..74b10f10 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -426,6 +427,35 @@ public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, return $ret; } + /** + * @public function getUserPagesClone + * @param $tableName + * @param $tableSoleName + * @param $tablePermissions + * @param $fieldId + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t = '') + { + $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'clone', '', "\t\t"); + $ccFieldId = $this->getCamelCase($fieldId, false, true); + if (1 == $tablePermissions) { + $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); + $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->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"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}Source", ' == ', '0', $contIf, false, $t); + $ret .= $this->xc->getXcCommonPagesClone($tableName, $ccFieldId, $t); + + return $ret; + } + /** * @private function getUserPagesDelete * @param $tableName @@ -573,6 +603,7 @@ private function getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableN $cases['save'] = [$this->getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, $t . "\t")]; $cases['new'] = [$this->getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, $t . "\t")]; $cases['edit'] = [$this->getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t . "\t")]; + $cases['clone'] = [$this->getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t . "\t")]; $cases['delete'] = [$this->getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications,$t . "\t")]; } if (1 == $tableBroken) { diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index 67cc040e..a2a4a28a 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index ee075770..e88acaf1 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index 154f6243..49d94a72 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserRss.php b/class/Files/User/UserRss.php index 1866c2e7..b788f0ce 100644 --- a/class/Files/User/UserRss.php +++ b/class/Files/User/UserRss.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index 6051088d..1c59bbd8 100644 --- a/class/Files/User/UserSearch.php +++ b/class/Files/User/UserSearch.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserViewTag.php b/class/Files/User/UserViewTag.php index 44bb1bad..61499ae9 100644 --- a/class/Files/User/UserViewTag.php +++ b/class/Files/User/UserViewTag.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index 99cddc62..9e56b50f 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 8e43fc1e..0716534f 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/admin/AdminAbout.php b/class/Files/admin/AdminAbout.php index 100db6a3..7765beac 100644 --- a/class/Files/admin/AdminAbout.php +++ b/class/Files/admin/AdminAbout.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/admin/AdminFooter.php b/class/Files/admin/AdminFooter.php index a11be556..e98915d9 100644 --- a/class/Files/admin/AdminFooter.php +++ b/class/Files/admin/AdminFooter.php @@ -22,7 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 0cf5031c..09269cca 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -25,7 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ @@ -199,6 +200,36 @@ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $lan return $ret; } + /** + * @private function getAdminPagesClone + * @param $moduleDirname + * @param $tableName + * @param $fieldInForm + * @param $language + * @param string $t + * @return string + */ + private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $fieldInForm, $fieldId, $language, $t = '') + { + $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); + $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); + + if (\in_array(1, $fieldInForm)) { + $ret .= $this->axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); + $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->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', false, $t); + $ret .= $this->xc->getXcCommonPagesClone($tableName, $ccFieldId, $t); + + return $ret; + } + /** * @private function getPermissionsSave * @param $moduleDirname @@ -390,7 +421,7 @@ private function getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, public function render() { $tf = Modulebuilder\Files\CreateFile::getInstance(); - $new = $save = $edit = ''; + $new = $clone = $save = $edit = ''; $module = $this->getModule(); $table = $this->getTable(); @@ -419,15 +450,17 @@ public function render() $content .= $this->getAdminPagesHeader($moduleDirname, $fieldId); $list = $this->getAdminPagesList($moduleDirname, $table, $language, $fieldInForm, "\t\t"); if (\in_array(1, $fieldInForm)) { - $new = $this->getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $language, "\t\t"); - $save = $this->getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, "\t\t"); - $edit = $this->getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, "\t\t"); + $new = $this->getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $language, "\t\t"); + $clone = $this->getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $fieldInForm, $fieldId, $language, "\t\t"); + $save = $this->getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, "\t\t"); + $edit = $this->getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, "\t\t"); } $delete = $this->getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, $language, $fieldId, $fieldMain, $tableNotifications, "\t\t"); $cases = [ 'list' => [$list], 'new' => [$new], + 'clone' => [$clone], 'save' => [$save], 'edit' => [$edit], 'delete' => [$delete], diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index 911beb70..bc9cc277 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -21,7 +21,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/class/Form/FormRadio.php b/class/Form/FormRadio.php index b99be6c3..4626a2be 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -12,7 +12,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project (https://xoops.org) + * @copyright The XOOPS project https://xoops.org/ * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * * @since 1.91 diff --git a/class/Helper.php b/class/Helper.php index 2c3ca0cf..8edff652 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -13,9 +13,11 @@ */ /** - * @copyright XOOPS Project (https://xoops.org) + * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author XOOPS Development Team + * @package + * @since + * @author XOOPS Development Team */ //\defined('XOOPS_ROOT_PATH') || die('Restricted access'); @@ -68,7 +70,7 @@ public function getDirname() */ public function getHandler($name) { - $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; + $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } diff --git a/class/Logo.php b/class/Logo.php index c360f4fc..2f302b63 100644 --- a/class/Logo.php +++ b/class/Logo.php @@ -20,7 +20,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/Modules.php b/class/Modules.php index 806f386a..d21ab979 100644 --- a/class/Modules.php +++ b/class/Modules.php @@ -22,7 +22,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/ModulesHandler.php b/class/ModulesHandler.php index cab75f83..dfcf2cff 100644 --- a/class/ModulesHandler.php +++ b/class/ModulesHandler.php @@ -20,7 +20,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/Morefiles.php b/class/Morefiles.php index 096db1d0..f43ad5be 100644 --- a/class/Morefiles.php +++ b/class/Morefiles.php @@ -22,7 +22,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/MorefilesHandler.php b/class/MorefilesHandler.php index d0b51f47..ec429caa 100644 --- a/class/MorefilesHandler.php +++ b/class/MorefilesHandler.php @@ -20,7 +20,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/Tables.php b/class/Tables.php index 7f8b3c45..47bbf2bc 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -22,7 +22,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/TablesHandler.php b/class/TablesHandler.php index 3029f188..01993a32 100644 --- a/class/TablesHandler.php +++ b/class/TablesHandler.php @@ -22,7 +22,7 @@ * * @since 2.5.7 * - * @author Txmod Xoops - + * @author Txmod Xoops - * */ diff --git a/class/Utility.php b/class/Utility.php index f618e21c..a389ac3c 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -43,7 +43,7 @@ class Utility extends Common\SysUtility public static function makeDonationForm($about) { $donationform = [ - 0 => '
    ', + 0 => '', 1 => '
    ' . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
    ' @@ -53,7 +53,7 @@ public static function makeDonationForm($about) . '" title="' . \_SUBMIT . '" type="submit">
    ', - 2 => '
    ', + 2 => '', 'D' => '', 3 => '', 4 => ' diff --git a/class/autoload.php b/class/autoload.php index 9127cb3b..4ca947e3 100644 --- a/class/autoload.php +++ b/class/autoload.php @@ -19,7 +19,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ \defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/config/config.php b/config/config.php index 5a6ef663..80967764 100644 --- a/config/config.php +++ b/config/config.php @@ -11,7 +11,7 @@ /** * @copyright XOOPS Project https://xoops.org/ - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package * @since * @author XOOPS Development Team diff --git a/docs/changelog.txt b/docs/changelog.txt index 71a01a7e..54d00aea 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -28,6 +28,7 @@ - fixed bug in test data (mjoel/goffy) - added clone feature (mjoel/goffy) - updates for code quality (mamba/goffy) + - added clone feature for items (mjoel/goffy)
    3.04 Final [2020-11-11]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    diff --git a/files/commonfiles/class/Common/Breadcrumb.php b/files/commonfiles/class/Common/Breadcrumb.php index bcab7155..a4e3f8b9 100644 --- a/files/commonfiles/class/Common/Breadcrumb.php +++ b/files/commonfiles/class/Common/Breadcrumb.php @@ -15,7 +15,7 @@ /** * Breadcrumb Class * - * @copyright XOOPS Project (https://xoops.org) + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author lucio * @package Modulebuilder diff --git a/files/commonfiles/class/Common/Resizer.php b/files/commonfiles/class/Common/Resizer.php index 106fa07d..c87b384b 100644 --- a/files/commonfiles/class/Common/Resizer.php +++ b/files/commonfiles/class/Common/Resizer.php @@ -65,8 +65,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; diff --git a/files/commonfiles/class/Common/TableChecker.php b/files/commonfiles/class/Common/TableChecker.php index d2c2defd..7b00512c 100644 --- a/files/commonfiles/class/Common/TableChecker.php +++ b/files/commonfiles/class/Common/TableChecker.php @@ -20,7 +20,7 @@ * @category Table Checker * @author Goffy * @copyright 2021 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ diff --git a/files/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php index 760e0b68..007c8d6f 100644 --- a/files/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -13,9 +13,11 @@ */ /** - * @copyright XOOPS Project (https://xoops.org) + * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author XOOPS Development Team + * @package + * @since + * @author XOOPS Development Team */ //\defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/files/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php index a181cf74..6bbb8579 100644 --- a/files/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -189,7 +189,7 @@ public static function getEditor($helper = null, $options = null) public static function makeDonationForm($about) { $donationform = [ - 0 => '
    ', + 0 => '', 1 => '
    ' . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
    ' @@ -199,7 +199,7 @@ public static function makeDonationForm($about) . '" title="' . \_SUBMIT . '" type="submit">
    ', - 2 => '
    ', + 2 => '', 'D' => '', 3 => '', 4 => ' diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php index 15757bdc..1750e879 100644 --- a/files/commonfiles/include/xoops_version.inc.php +++ b/files/commonfiles/include/xoops_version.inc.php @@ -10,9 +10,11 @@ */ /** - * @copyright XOOPS Project (https://xoops.org) + * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author XOOPS Development Team + * @package + * @since + * @author XOOPS Development Team * @param mixed $val */ diff --git a/files/commonfiles/language/english/common.php b/files/commonfiles/language/english/common.php index a83e255d..67cb7ccc 100644 --- a/files/commonfiles/language/english/common.php +++ b/files/commonfiles/language/english/common.php @@ -13,7 +13,7 @@ * Wfdownloads module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package wfdownload * @since 3.23 * @author Xoops Development Team diff --git a/files/commonfiles/preloads/core.php b/files/commonfiles/preloads/core.php index 1644fa5a..e6d22fd3 100644 --- a/files/commonfiles/preloads/core.php +++ b/files/commonfiles/preloads/core.php @@ -22,6 +22,7 @@ class ModulebuilderCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader + /** * @param $args */ diff --git a/files/commonfiles/testdata/index.php b/files/commonfiles/testdata/index.php index 33ecf71c..5ad5f8d8 100644 --- a/files/commonfiles/testdata/index.php +++ b/files/commonfiles/testdata/index.php @@ -7,7 +7,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright XOOPS Project (https://xoops.org) + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package * @since 2.5.11 diff --git a/include/common.php b/include/common.php index 87de8a74..8e94a6f3 100644 --- a/include/common.php +++ b/include/common.php @@ -17,7 +17,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/include/functions.php b/include/functions.php index 3de2ddb6..d10b5b83 100644 --- a/include/functions.php +++ b/include/functions.php @@ -17,7 +17,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ \defined('XOOPS_ROOT_PATH') || exit('Restricted access'); @@ -31,7 +32,7 @@ function ModuleBuilder_MakeDonationForm($about) { $donationform = [ - 0 => '
    ', + 0 => '', 1 => '
    ' . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
    ' @@ -41,7 +42,7 @@ function ModuleBuilder_MakeDonationForm($about) . '" title="' . \_SUBMIT . '" type="submit">
    ', - 2 => '
    ', + 2 => '', 'D' => '', 3 => '', 4 => ' diff --git a/include/update.php b/include/update.php index 13864c5f..841f5849 100644 --- a/include/update.php +++ b/include/update.php @@ -18,7 +18,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * * @param mixed $module * @param null|mixed $prev_version diff --git a/language/english/admin.php b/language/english/admin.php index 7d90b076..010c5de0 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -17,7 +17,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ // diff --git a/language/english/feedback.php b/language/english/feedback.php index 0845cf08..c91faa03 100644 --- a/language/english/feedback.php +++ b/language/english/feedback.php @@ -20,7 +20,7 @@ * @author XOOPS - Website: */ -$moduleDirName = \basename(\dirname(__DIR__, 2)); +$moduleDirName = \basename(dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); diff --git a/language/english/help/help.html b/language/english/help/help.html index f40875c0..81b4da8b 100644 --- a/language/english/help/help.html +++ b/language/english/help/help.html @@ -35,7 +35,7 @@

    Features

    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

    diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 026dc602..d10f960c 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -18,7 +18,8 @@ * @since 2.5.0 * * @author Xoops Team Developement Modules - https://xoops.org - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org * */ diff --git a/preloads/autoloader.php b/preloads/autoloader.php index f921da66..a3607c51 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -9,7 +9,7 @@ static function ($class) { $prefix = 'XoopsModules\\' . \ucfirst(\basename(\dirname(__DIR__))); // base directory for the namespace prefix - $baseDir = dirname(__DIR__) . '/class/'; + $baseDir = __DIR__ . '/../class/'; // does the class use the namespace prefix? $len = mb_strlen($prefix); diff --git a/preloads/core.php b/preloads/core.php index 1644fa5a..e6d22fd3 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -22,6 +22,7 @@ class ModulebuilderCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader + /** * @param $args */ diff --git a/xoops_version.php b/xoops_version.php index 01b791ad..4ea6539d 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -17,7 +17,8 @@ * * @since 2.5.7 * - * @author Txmod Xoops http://www.txmodxoops.org + * @author Txmod Xoops https://xoops.org + * Goffy https://myxoops.org */ \defined('XOOPS_ROOT_PATH') || die('Restricted access'); @@ -54,7 +55,7 @@ $modversion['targetdir'] = XOOPS_UPLOAD_PATH . "/{$moduleDirName}/repository/"; $modversion['module_website_url'] = 'https://github.com/XoopsModules25x/modulebuilder'; $modversion['module_website_name'] = 'GitHub Xoops'; -$modversion['min_php'] = '7.3'; +$modversion['min_php'] = '7.2'; $modversion['min_xoops'] = '2.5.11-Beta 2'; $modversion['min_admin'] = '1.2'; $modversion['min_db'] = ['mysql' => '5.5']; From da8be570cfd64ead3953f741a2f2465e5f2068ab Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 23 Jun 2021 13:24:10 +0200 Subject: [PATCH 144/266] - update test data --- docs/changelog.txt | 1 + testdata/english/modulebuilder_fields.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 54d00aea..51f9d6ab 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -29,6 +29,7 @@ - added clone feature (mjoel/goffy) - updates for code quality (mamba/goffy) - added clone feature for items (mjoel/goffy) + - update test data (mamba/goffy)

    3.04 Final [2020-11-11]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    diff --git a/testdata/english/modulebuilder_fields.yml b/testdata/english/modulebuilder_fields.yml index 70ba4b5e..b8d819ef 100644 --- a/testdata/english/modulebuilder_fields.yml +++ b/testdata/english/modulebuilder_fields.yml @@ -70,7 +70,7 @@ field_parent: '0' field_admin: '1' field_inlist: '1' - field_inform: '0' + field_inform: '1' field_user: '0' field_ihead: '0' field_ibody: '0' From b5d48bf9b5d9a0288066e2df39358f4fb59c5537 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 1 Jul 2021 16:26:46 +0200 Subject: [PATCH 145/266] - added start/limit handling --- class/Files/Classes/ClassFiles.php | 7 ++++++- class/Files/CreateXoopsCode.php | 4 +++- .../Templates/Admin/TemplatesAdminPages.php | 2 +- .../Files/Templates/User/Defstyle/PagesItem.php | 8 ++++---- class/Files/User/UserPages.php | 15 +++++++++------ class/Files/admin/AdminPages.php | 16 +++++++++------- docs/changelog.txt | 1 + 7 files changed, 33 insertions(+), 20 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 2477249f..0d4249e5 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -222,7 +222,10 @@ private function getClassObject($module, $table, $fields) $cCl .= $this->pc->getPhpCodeVariableClass('private', 'options', $options); } unset($optionsFieldName); - + $cCl .= $this->pc->getPhpCodeCommentMultiLine(['@var' => 'int'], "\t"); + $cCl .= $this->pc->getPhpCodeVariableClass('public', 'start', '0', "\t"); + $cCl .= $this->pc->getPhpCodeCommentMultiLine(['@var' => 'int'], "\t"); + $cCl .= $this->pc->getPhpCodeVariableClass('public', 'limit', '0', "\t"); $cCl .= $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); $constr = $this->getInitVars($fields); $cCl .= $this->pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); @@ -321,6 +324,8 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) $getForm .= $this->pc->getPhpCodeCommentLine('To Save', '', "\t\t"); //$hiddenSave = $cc->getClassXoopsFormHidden('', "'op'", "'save'", true, false); $getForm .= $this->cxc->getClassAddElement('form', "new \XoopsFormHidden('op', 'save')"); + $getForm .= $this->cxc->getClassAddElement('form', "new \XoopsFormHidden('start', \$this->start)"); + $getForm .= $this->cxc->getClassAddElement('form', "new \XoopsFormHidden('limit', \$this->limit)"); $getForm .= $this->cxc->getClassAddElement('form', "new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)"); $getForm .= $this->getSimpleString('return $form;', "\t\t"); diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 08cc3c49..7671ef2e 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1031,7 +1031,7 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); - $array = "['ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'op' => '{$options}']"; + $array = "['ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'start' => \$start, 'limit' => \$limit, 'op' => '{$options}']"; $server = $pc->getPhpCodeGlobalsVariables('REQUEST_URI', 'SERVER'); $getVar = $this->getXcGetVar('', $tableName . 'Obj', $fieldMain, true, ''); $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, $getVar); @@ -1760,6 +1760,8 @@ public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') $ret = $pc->getPhpCodeCommentLine('Get Form', null, "\t\t"); $ret .= $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $ret .= $xc->getXcEqualsOperator("\${$tableName}Obj->start", '$start', null, $t); + $ret .= $xc->getXcEqualsOperator("\${$tableName}Obj->limit", '$limit', null, $t); $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index aad62274..38db6744 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -209,7 +209,7 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 edit.png'); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); - $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); + $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double . '&start=<{$start}>&limit=<{$limit}>', 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_CLONE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 editcopy.png'); diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 25496855..475928b9 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -183,12 +183,12 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $anchors = ''; $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); - $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=list&#{$ccFieldId}_" . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $contIf = $this->hc->getHtmlAnchor($tableName . '.php?op=list&start=<{$start}>&limit=<{$limit}>#' .$ccFieldId . '_' . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst($language, 'DETAILS'); - $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); $anchors .= $this->sc->getSmartyConditions('showItem', '', '', $contIf, $contElse, '', '', "\t\t"); $lang = $this->sc->getSmartyConst('', '_EDIT'); - $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); + $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_CLONE'); $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=clone&{$fieldId}_source=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_DELETE'); @@ -196,7 +196,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $anchors .= $this->sc->getSmartyConditions('permEdit', '', '', $contIf, false, '', '', "\t\t"); if (1 == $tableBroken) { $lang = $this->sc->getSmartyConst($language, 'BROKEN'); - $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); + $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); } $retFoot .= $this->hc->getHtmlDiv($anchors, 'col-sm-12 right',"\t", "\n"); $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 74b10f10..be5234bb 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -113,10 +113,12 @@ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $table $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'header', true); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcXoopsRequest('op ', 'op', 'list', 'Cmd'); + $ret .= $this->xc->getXcXoopsRequest($ccFieldId, $fieldId, '0', 'Int'); $ret .= $this->xc->getXcXoopsRequest('start', 'start', '0', 'Int'); $userpager = $this->xc->getXcGetConfig('userpager'); $ret .= $this->xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int'); - $ret .= $this->xc->getXcXoopsRequest($ccFieldId, $fieldId, '0', 'Int'); + $ret .= $this->xc->getXcXoopsTplAssign('start', '$start'); + $ret .= $this->xc->getXcXoopsTplAssign('limit', '$limit'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet'); $ret .= $this->xc->getXcXoThemeAddStylesheet(); @@ -180,8 +182,9 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contIf, false, $t); $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count", '', $t); - $ret .= $this->xc->getXcCriteriaSetStart($critName, '$start', $t); - $ret .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t); + $contIf = $this->xc->getXcCriteriaSetStart($critName, '$start', $t . "\t"); + $contIf .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' === ', '0', $contIf, false, $t); $ret .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t); $condIf = $this->pc->getPhpCodeArray($tableName, null, false, $t . "\t"); $condIf .= $this->xc->getXcEqualsOperator("\${$ccFieldMain}", "''",'', $t . "\t"); @@ -343,10 +346,10 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole $contentInsert .= $this->pc->getPhpCodeCommentLine('redirect after insert', null, $t . "\t"); if ($countUploader > 0) { $errIf = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=edit&{$fieldId}=' . \$new{$ucfFieldId}", '', '5', '$uploaderErrors', false, $t . "\t\t"); - $errElse = $this->xc->getXcRedirectHeader($tableName, '?op=list', '2', "{$language}FORM_OK", true, $t . "\t\t"); + $errElse = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); $confirmOk = $this->pc->getPhpCodeConditions('$uploaderErrors', ' !== ', "''", $errIf, $errElse, $t . "\t"); } else { - $confirmOk = $this->xc->getXcRedirectHeader($tableName, '', '2', "{$language}FORM_OK", true, $t . "\t"); + $confirmOk = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); } $contentInsert .= $confirmOk; $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); @@ -531,7 +534,7 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl $contInsert .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_broken', \$tags);", $t . "\t\t"); $contInsert .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \${$ccFieldId}, '{$tableSoleName}_broken', \$tags);", $t . "\t\t"); } - $contInsert .= $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}FORM_OK", true, $t . "\t\t"); + $contInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); $htmlErrors = $this->xc->getXcHtmlErrors($tableName, true); $internalElse = $this->xc->getXcXoopsTplAssign('error', $htmlErrors, true, $t . "\t\t"); $condition .= $this->pc->getPhpCodeConditions($insert, '', '', $contInsert, $internalElse, $t . "\t"); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 09269cca..06ba25f2 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -105,10 +105,15 @@ private function getAdminPagesHeader($moduleDirname, $fieldId) $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants'], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); $ret .= $this->getRequire(); - $ret .= $this->pc->getPhpCodeCommentLine('It recovered the value of argument op in URL$'); + $ret .= $this->pc->getPhpCodeCommentLine('Get all request values'); $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'list', 'Cmd'); - $ret .= $this->pc->getPhpCodeCommentLine("Request {$fieldId}"); $ret .= $this->xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int'); + $ret .= $this->xc->getXcXoopsRequest('start', 'start', '0', 'Int', false); + $config = $this->xc->getXcGetConfig('adminpager'); + $ret .= $this->xc->getXcXoopsRequest('limit', 'limit', $config, 'Int', false); + $ret .= $this->xc->getXcXoopsTplAssign('start', '$start'); + $ret .= $this->xc->getXcXoopsTplAssign('limit', '$limit'); + $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; } @@ -145,9 +150,6 @@ private function getAdminPagesList($moduleDirname, $table, $language, $fieldInFo $ret = $this->pc->getPhpCodeCommentLine('Define Stylesheet', '', $t); $ret .= $this->xc->getXcXoThemeAddStylesheet('style', $t); - $ret .= $this->xc->getXcXoopsRequest('start', 'start', '0', 'Int', false, $t); - $adminpager = $this->xc->getXcGetConfig('adminpager'); - $ret .= $this->xc->getXcXoopsRequest('limit', 'limit', $adminpager, 'Int', false, $t); $ret .= $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); $navigation = $this->axc->getAdminDisplayNavigation($tableName); $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); @@ -345,10 +347,10 @@ 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, '?op=list', '2', "{$language}FORM_OK", true, $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"); } else { - $contentInsert .= $this->xc->getXcRedirectHeader($tableName . '', '?op=list', '2', "{$language}FORM_OK", true, $t . "\t"); + $contentInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); } $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); $ret .= $this->pc->getPhpCodeCommentLine('Get Form', null, $t); diff --git a/docs/changelog.txt b/docs/changelog.txt index 51f9d6ab..07a01a3c 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -30,6 +30,7 @@ - updates for code quality (mamba/goffy) - added clone feature for items (mjoel/goffy) - update test data (mamba/goffy) + - added start/limit handling (goffy)
    3.04 Final [2020-11-11]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    From 2f3f99a8bd597a2b899864a7ba748e64eb48723f Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 1 Jul 2021 17:02:41 +0200 Subject: [PATCH 146/266] replace tab by 4 spaces during creation --- class/Files/CreateFile.php | 8 +++++++- docs/changelog.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 61ec80ab..7a92428c 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -32,6 +32,11 @@ */ class CreateFile extends CreateTableFields { + /** + * @var string + */ + private $tab = ' '; + /** * @var mixed */ @@ -213,7 +218,8 @@ public function getFileName() */ private function setContent($content) { - $this->content = $content; + //replace tabs by 4 spaces + $this->content = preg_replace('/\t/', $this->tab, $content); } /** diff --git a/docs/changelog.txt b/docs/changelog.txt index 07a01a3c..78d9e6c1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -31,6 +31,7 @@ - added clone feature for items (mjoel/goffy) - update test data (mamba/goffy) - added start/limit handling (goffy) + - replace tab by 4 spaces during creation (goffy)
    3.04 Final [2020-11-11]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    From 219b502a7d85a3f886344d8fbe891a02a679a762 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 15 Jul 2021 18:31:48 +0200 Subject: [PATCH 147/266] remove double br --- class/Files/Classes/ClassFormElements.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 68692bf7..3eb33e3d 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -367,7 +367,7 @@ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fie $languageShort = \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); + $ret .= $this->cxc->getClassXoopsFormElementTray('formUrlFile', $language, '
    ', $t); $ret .= $this->pc->getPhpCodeTernaryOperator('formUrl', '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", $t); $ret .= $this->cxc->getClassXoopsFormText('formText', $language . '_UPLOADS', $fieldName, 75, 255, 'formUrl', false, $t); $ret .= $this->cxc->getClassAddElement('formUrlFile', '$formText' . $required, $t); From e8928c5437b632e79215b8ba712558d25f17faa5 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 12 Aug 2021 00:08:59 -0400 Subject: [PATCH 148/266] TestdataButtons --- admin/index.php | 78 ++++-------------- class/Common/TestdataButtons.php | 76 +++++++++++++++++ language/english/common.php | 18 ++-- testdata/index.php | 137 +++++++++++++++++-------------- 4 files changed, 180 insertions(+), 129 deletions(-) create mode 100644 class/Common/TestdataButtons.php diff --git a/admin/index.php b/admin/index.php index e4f37321..4b71a5c7 100644 --- a/admin/index.php +++ b/admin/index.php @@ -23,7 +23,15 @@ * */ -use XoopsModules\Modulebuilder\Common; +use Xmf\Module\Admin; +use Xmf\Request; +use XoopsModules\Modulebuilder\{ + Common, + Common\TestdataButtons, + Forms, + Helper, + Utility +}; $GLOBALS['xoopsOption']['template_main'] = 'modulebuilder_index.tpl'; @@ -61,76 +69,24 @@ $adminObject->displayNavigation(\basename(__FILE__)); -//------------- Test Data ---------------------------- - +//------------- Test Data Buttons ---------------------------- if ($helper->getConfig('displaySampleButton')) { - $yamlFile = \dirname(__DIR__) . '/config/admin.yml'; - $config = loadAdminConfig($yamlFile); - $displaySampleButton = $config['displaySampleButton']; - - if (1 == $displaySampleButton) { - \xoops_loadLanguage('admin/modulesadmin', 'system'); - require __DIR__ . '/../testdata/index.php'; - - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add'); - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add'); - // $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add'); - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); - } else { - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); - $displaySampleButton = $config['displaySampleButton']; - } + TestdataButtons::loadButtonConfig($adminObject); $adminObject->displayButton('left', ''); } - -//------------- End Test Data ---------------------------- - -$adminObject->displayIndex(); - -/** - * @param $yamlFile - * @return array|bool - */ -function loadAdminConfig($yamlFile) -{ - $config = \Xmf\Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps - return $config; -} - -/** - * @param $yamlFile - */ -function hideButtons($yamlFile) -{ - $app['displaySampleButton'] = 0; - \Xmf\Yaml::save($app, $yamlFile); - \redirect_header('index.php', 0, ''); -} - -/** - * @param $yamlFile - */ -function showButtons($yamlFile) -{ - $app['displaySampleButton'] = 1; - \Xmf\Yaml::save($app, $yamlFile); - \redirect_header('index.php', 0, ''); -} - -$op = \Xmf\Request::getString('op', 0, 'GET'); - +$op = Request::getString('op', 0, 'GET'); switch ($op) { case 'hide_buttons': - hideButtons($yamlFile); + TestdataButtons::hideButtons(); break; case 'show_buttons': - showButtons($yamlFile); + TestdataButtons::showButtons(); break; } +//------------- End Test Data Buttons ---------------------------- +$adminObject->displayIndex(); echo $utility::getServerStats(); -//$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('index.php')); -//$GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex()); - +//codeDump(__FILE__); require __DIR__ . '/footer.php'; diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php new file mode 100644 index 00000000..b6eacaac --- /dev/null +++ b/class/Common/TestdataButtons.php @@ -0,0 +1,76 @@ + + * @copyright {@link https://xoops.org/ XOOPS Project} + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + */ + +use Xmf\Request; +use Xmf\Yaml; +use XoopsModules\Modulebuilder\Helper; +/** @var Helper $helper */ + +/** + * Class SysUtility + */ +class TestdataButtons +{ + + //functions for import buttons + public static function loadButtonConfig($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(); + + if (1 == $displaySampleButton) { + \xoops_loadLanguage('admin/modulesadmin', 'system'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert'); + // $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); + } else { + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); + // $displaySampleButton = $config['displaySampleButton']; + } + } + + public static function hideButtons() + { + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $app = []; + $app['displaySampleButton'] = 0; + Yaml::save($app, $yamlFile); + \redirect_header('index.php', 0, ''); + } + + public static function showButtons() + { + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $app = []; + $app['displaySampleButton'] = 1; + Yaml::save($app, $yamlFile); + \redirect_header('index.php', 0, ''); + } +} diff --git a/language/english/common.php b/language/english/common.php index fa2b5813..9b76bc82 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -70,19 +70,21 @@ \define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); //Sample Data -\define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); -\define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Data imported successfully'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS', 'Sample Date saved successfully'); \define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); \define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); -\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_ERROR', 'ERROR: Export of Tables to YAML failed'); -\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); -\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA', 'Clear the Sample Data'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK', 'The Sample Data has been cleared'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_CONFIRM', 'Are you sure to Clear Sample Data? (It will delete ALL current data)'); \define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); \define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); \define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); -\define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); -\define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons'); -\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); \define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); //letter choice diff --git a/testdata/index.php b/testdata/index.php index 5ad5f8d8..fb0a9092 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -15,57 +15,63 @@ */ use Xmf\Database\TableLoad; -use Xmf\Module\Helper; +//use Xmf\Module\Helper; use Xmf\Request; use Xmf\Yaml; -use XoopsModules\Modulebuilder; use XoopsModules\Modulebuilder\{ - Common, + Helper, + Common\Configurator, Utility }; +/** @var Helper $helper */ +/** @var Utility $utility */ +/** @var Configurator $configurator */ require_once dirname(__DIR__, 3) . '/include/cp_header.php'; require \dirname(__DIR__) . '/preloads/autoloader.php'; -$op = \Xmf\Request::getCmd('op', ''); +$op = Request::getCmd('op', ''); $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -$helper = Modulebuilder\Helper::getInstance(); +$helper = Helper::getInstance(); // Load language files $helper->loadLanguage('common'); switch ($op) { case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { if (!$GLOBALS['xoopsSecurity']->check()) { - \redirect_header('../admin/index.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); xoops_cp_footer(); } break; case 'save': saveSampleData(); break; + case 'clear': + clearSampleData(); + break; } // XMF TableLoad for SAMPLE data + function loadSampleData() { global $xoopsConfig; - $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); - $utility = new Modulebuilder\Utility(); - $configurator = new Common\Configurator(); + $utility = new Utility(); + $configurator = new Configurator(); - $tables = Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); $language = 'english/'; if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { @@ -82,30 +88,28 @@ function loadSampleData() // load permissions $table = 'group_permission'; $tabledata = Yaml::readWrapped($language . $table . '.yml'); - $mid = Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); + $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); // --- COPY test folder files --------------- if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) { + // $file = dirname(__DIR__) . '/testdata/images/'; foreach (\array_keys($configurator->copyTestFolders) as $i) { $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; $utility::rcopy($src, $dest); } } - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); } function saveSampleData() { global $xoopsConfig; - - $configurator = new Common\Configurator(); - $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); - - $tables = Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $helper = Helper::getInstance(); + $tables = $helper->getModule()->getInfo('tables'); $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; if (!\file_exists($languageFolder . '/')) { @@ -120,39 +124,29 @@ function saveSampleData() } // save permissions - $skipColumns = []; $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('gperm_modid', Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); + $criteria->add(new \Criteria('gperm_modid', $helper->getModule()->getVar('mid'))); $skipColumns[] = 'gperm_id'; TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); unset($criteria); - // --- COPY test folder files --------------- - if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) { - foreach (\array_keys($configurator->copyTestFolders) as $i) { - $src = $configurator->copyTestFolders[$i][1]; - $dest = $configurator->copyTestFolders[$i][0]; - Utility::rcopy($src, $dest); - } - } \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); } function exportSchema() { $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); try { // TODO set exportSchema - // $migrate = new Modulebuilder\Migrate($moduleDirName); + // $migrate = new Migrate($moduleDirName); // $migrate->saveCurrentSchema(); // - // \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); - } catch (\Exception $e) { - exit(\constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); + // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); + } catch (\Throwable $e) { + exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); } - } /** @@ -169,36 +163,59 @@ function exportSchema() */ function loadTableFromArrayWithReplace($table, $data, $search, $replace) { - /** @var \XoopsDatabase */ + /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $prefixedTable = $db->prefix($table); - $count = 0; + $count = 0; + $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); - $db->queryF($sql); - foreach ($data as $row) { - $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; - $valueClause = ' VALUES ('; - $first = true; - foreach ($row as $column => $value) { - if ($first) { - $first = false; - } else { - $insertInto .= ', '; - $valueClause .= ', '; + + $result = $db->queryF($sql); + + if ($result) { + foreach ($data as $row) { + $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; + $valueClause = ' VALUES ('; + $first = true; + foreach ($row as $column => $value) { + if ($first) { + $first = false; + } else { + $insertInto .= ', '; + $valueClause .= ', '; + } + + $insertInto .= $column; + if ($search === $column) { + $valueClause .= $db->quote($replace); + } else { + $valueClause .= $db->quote($value); + } } - $insertInto .= $column; - if ($search === $column) { - $valueClause .= $db->quote($replace); - } else { - $valueClause .= $db->quote($value); + + $sql = $insertInto . ') ' . $valueClause . ')'; + + $result = $db->queryF($sql); + if (false !== $result) { + ++$count; } } - $sql = $insertInto . ') ' . $valueClause . ')'; - $result = $db->queryF($sql); - if (false !== $result) { - ++$count; - } } - return $count; } + +function clearSampleData() +{ + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $helper = Helper::getInstance(); + // Load language files + $helper->loadLanguage('common'); + $tables = $helper->getModule()->getInfo('tables'); + // truncate module tables + foreach ($tables as $table) { + \Xmf\Database\TableLoad::truncateTable($table); + } + redirect_header($helper->url('admin/index.php'), 1, constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK')); +} From bd9e99c0688a86c21b66d2a22bb6a64d92e1232e Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 13 Oct 2021 19:19:51 +0200 Subject: [PATCH 149/266] - added feature to clone module --- admin/modules.php | 188 +++++++++++++++++----- assets/images/icons/32/page_copy.png | Bin 0 -> 958 bytes docs/changelog.txt | 5 + include/install.php | 8 + language/english/admin.php | 2 + templates/admin/modulebuilder_modules.tpl | 13 +- xoops_version.php | 2 +- 7 files changed, 170 insertions(+), 48 deletions(-) create mode 100644 assets/images/icons/32/page_copy.png diff --git a/admin/modules.php b/admin/modules.php index 653220c8..99641b77 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -22,19 +22,21 @@ * */ +use Xmf\Request; + // Define main template $templateMain = 'modulebuilder_modules.tpl'; require __DIR__ . '/header.php'; // Recovered value of argument op in the URL $ -$op = \Xmf\Request::getString('op', 'list'); -$modId = \Xmf\Request::getInt('mod_id'); +$op = Request::getString('op', 'list'); +$modId = Request::getInt('mod_id'); switch ($op) { case 'list': default: - $start = \Xmf\Request::getInt('start', 0); - $limit = \Xmf\Request::getInt('limit', $helper->getConfig('modules_adminpager')); + $start = Request::getInt('start', 0); + $limit = Request::getInt('limit', $helper->getConfig('modules_adminpager')); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); @@ -89,29 +91,29 @@ } else { $modulesObj = $helper->getHandler('Modules')->create(); } - $moduleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower(\Xmf\Request::getString('mod_dirname', '', 'POST'))); + $moduleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower(Request::getString('mod_dirname', '', 'POST'))); //Form module save $modulesObj->setVars( [ - 'mod_name' => \Xmf\Request::getString('mod_name', '', 'POST'), + 'mod_name' => Request::getString('mod_name', '', 'POST'), 'mod_dirname' => $moduleDirname, - 'mod_version' => \Xmf\Request::getString('mod_version', '', 'POST'), - 'mod_since' => \Xmf\Request::getString('mod_since', '', 'POST'), - 'mod_min_php' => \Xmf\Request::getString('mod_min_php', '', 'POST'), - 'mod_min_xoops' => \Xmf\Request::getString('mod_min_xoops', '', 'POST'), - 'mod_min_admin' => \Xmf\Request::getString('mod_min_admin', '', 'POST'), - 'mod_min_mysql' => \Xmf\Request::getString('mod_min_mysql', '', 'POST'), - 'mod_description' => \Xmf\Request::getString('mod_description', '', 'POST'), - 'mod_author' => \Xmf\Request::getString('mod_author', '', 'POST'), - 'mod_author_mail' => \Xmf\Request::getString('mod_author_mail', '', 'POST'), - 'mod_author_website_url' => \Xmf\Request::getString('mod_author_website_url', '', 'POST'), - 'mod_author_website_name' => \Xmf\Request::getString('mod_author_website_name', '', 'POST'), - 'mod_credits' => \Xmf\Request::getString('mod_credits', '', 'POST'), - 'mod_license' => \Xmf\Request::getString('mod_license', '', 'POST'), - 'mod_release_info' => \Xmf\Request::getString('mod_release_info', '', 'POST'), - 'mod_release_file' => \Xmf\Request::getString('mod_release_file', '', 'POST'), - 'mod_manual' => \Xmf\Request::getString('mod_manual', '', 'POST'), - 'mod_manual_file' => \Xmf\Request::getString('mod_manual_file', '', 'POST'), + 'mod_version' => Request::getString('mod_version', '', 'POST'), + 'mod_since' => Request::getString('mod_since', '', 'POST'), + 'mod_min_php' => Request::getString('mod_min_php', '', 'POST'), + 'mod_min_xoops' => Request::getString('mod_min_xoops', '', 'POST'), + 'mod_min_admin' => Request::getString('mod_min_admin', '', 'POST'), + 'mod_min_mysql' => Request::getString('mod_min_mysql', '', 'POST'), + 'mod_description' => Request::getString('mod_description', '', 'POST'), + 'mod_author' => Request::getString('mod_author', '', 'POST'), + 'mod_author_mail' => Request::getString('mod_author_mail', '', 'POST'), + 'mod_author_website_url' => Request::getString('mod_author_website_url', '', 'POST'), + 'mod_author_website_name' => Request::getString('mod_author_website_name', '', 'POST'), + 'mod_credits' => Request::getString('mod_credits', '', 'POST'), + 'mod_license' => Request::getString('mod_license', '', 'POST'), + 'mod_release_info' => Request::getString('mod_release_info', '', 'POST'), + 'mod_release_file' => Request::getString('mod_release_file', '', 'POST'), + 'mod_manual' => Request::getString('mod_manual', '', 'POST'), + 'mod_manual_file' => Request::getString('mod_manual_file', '', 'POST'), ] ); //Form mod_image @@ -128,24 +130,24 @@ $modulesObj->setVar('mod_image', $uploader->getSavedFileName()); } } else { - $modulesObj->setVar('mod_image', \Xmf\Request::getString('mod_image', '', 'POST')); + $modulesObj->setVar('mod_image', Request::getString('mod_image', '', 'POST')); } //Form module save $modulesObj->setVars( [ - 'mod_demo_site_url' => \Xmf\Request::getString('mod_demo_site_url', '', 'POST'), - 'mod_demo_site_name' => \Xmf\Request::getString('mod_demo_site_name', '', 'POST'), - 'mod_support_url' => \Xmf\Request::getString('mod_support_url', '', 'POST'), - 'mod_support_name' => \Xmf\Request::getString('mod_support_name', '', 'POST'), - 'mod_website_url' => \Xmf\Request::getString('mod_website_url', '', 'POST'), - 'mod_website_name' => \Xmf\Request::getString('mod_website_name', '', 'POST'), - 'mod_release' => \Xmf\Request::getString('mod_release', '', 'POST'), - 'mod_status' => \Xmf\Request::getString('mod_status', '', 'POST'), - 'mod_donations' => \Xmf\Request::getString('mod_donations', '', 'POST'), - 'mod_subversion' => \Xmf\Request::getString('mod_subversion', '', 'POST'), + 'mod_demo_site_url' => Request::getString('mod_demo_site_url', '', 'POST'), + 'mod_demo_site_name' => Request::getString('mod_demo_site_name', '', 'POST'), + 'mod_support_url' => Request::getString('mod_support_url', '', 'POST'), + 'mod_support_name' => Request::getString('mod_support_name', '', 'POST'), + 'mod_website_url' => Request::getString('mod_website_url', '', 'POST'), + 'mod_website_name' => Request::getString('mod_website_name', '', 'POST'), + 'mod_release' => Request::getString('mod_release', '', 'POST'), + 'mod_status' => Request::getString('mod_status', '', 'POST'), + 'mod_donations' => Request::getString('mod_donations', '', 'POST'), + 'mod_subversion' => Request::getString('mod_subversion', '', 'POST'), ] ); - $moduleOption = \Xmf\Request::getArray('module_option', []); + $moduleOption = Request::getArray('module_option', []); $modulesObj->setVar('mod_admin', \in_array('admin', $moduleOption)); $modulesObj->setVar('mod_user', \in_array('user', $moduleOption)); $modulesObj->setVar('mod_blocks', \in_array('blocks', $moduleOption)); @@ -157,9 +159,9 @@ if ($helper->getHandler('Modules')->insert($modulesObj)) { if ($modulesObj->isNew()) { - \redirect_header('tables.php', 5, \sprintf(\_AM_MODULEBUILDER_MODULE_FORM_CREATED_OK, \Xmf\Request::getString('mod_name', '', 'POST'))); + \redirect_header('tables.php', 5, \sprintf(\_AM_MODULEBUILDER_MODULE_FORM_CREATED_OK, Request::getString('mod_name', '', 'POST'))); } else { - \redirect_header('modules.php', 5, \sprintf(\_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('mod_name', '', 'POST'))); + \redirect_header('modules.php', 5, \sprintf(\_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, Request::getString('mod_name', '', 'POST'))); } } @@ -208,7 +210,7 @@ } else { $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm( ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], - \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), + Request::getString('REQUEST_URI', '', 'SERVER'), $modulesObj->getVar('mod_name') ); $form = $xoopsconfirm->getFormXoopsConfirm(); @@ -217,7 +219,7 @@ break; case 'display': $modFieldArray = ['admin', 'user', 'blocks', 'search', 'comments', 'notifications', 'permissions']; - $id = \Xmf\Request::getInt('mod_id', 0, 'POST'); + $id = Request::getInt('mod_id', 0, 'POST'); if ($id > 0) { $modulesObj = $helper->getHandler('Modules')->get($id); foreach ($modFieldArray as $moduleField) { @@ -231,8 +233,114 @@ } $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } + break; + case 'clone': + $modIdSource = Request::getInt('mod_id', 0); + if ($modIdSource > 0) { + //clone data table modules + $modulesHandler = $helper->getHandler('Modules'); + $tablesHandler = $helper->getHandler('Tables'); + $fieldsHandler = $helper->getHandler('Fields'); + $moduleSource = $modulesHandler->get($modIdSource); + $moduleTarget = $modulesHandler->create(); + $sourceVars = $moduleSource->getVars(); + foreach ($sourceVars as $varKey => $varArray) { + if ('mod_id' !== $varKey) { + if (in_array($varKey, ['mod_name', 'mod_dirname'])) { + for ($i = 1; $i <= 10; $i++) { + $uniqValue = $varArray['value'] . $i; + $result = $GLOBALS['xoopsDB']->query( + 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_modules') . " as ms WHERE ms.{$varKey} = '{$uniqValue}'" + ); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows == 0) { + break; + } + } + $moduleTarget->setVar($varKey, $uniqValue); + } else { + $moduleTarget->setVar($varKey, $varArray['value']); + } + } + } + + if ($modulesHandler->insert($moduleTarget)) { + //get new mod_id + $modIdTarget = $GLOBALS['xoopsDB']->getInsertId(); + } else { + \redirect_header('modules.php', 5, \_AM_MODULEBUILDER_MODULE_CLONE_ERROR); + } + + //clone data table tables + $resultTables = $GLOBALS['xoopsDB']->query( + 'SELECT table_id FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_tables') . " as ts WHERE ts.table_mid = '{$modIdSource}'" + ); + $num_rows1 = $GLOBALS['xoopsDB']->getRowsNum($resultTables); + if ($num_rows1 > 0) { + while (false !== ($myTables = $GLOBALS['xoopsDB']->fetchArray($resultTables))) { + $tableIdSource = $myTables['table_id']; + $tableSource = $tablesHandler->get($tableIdSource); + $tableTarget = $tablesHandler->create(); + $sourceVars = $tableSource->getVars(); + foreach ($sourceVars as $varKey => $varArray) { + //skip table_id + if ('table_id' !== $varKey) { + //replace mod_id by new mod_id + if ('table_mid' === $varKey) { + $tableTarget->setVar($varKey, $modIdTarget); + } else { + $tableTarget->setVar($varKey, $varArray['value']); + } + } + } + if ($tablesHandler->insert($tableTarget)) { + //get new table_id + $tableIdTarget = $GLOBALS['xoopsDB']->getInsertId(); + } else { + \redirect_header('modules.php', 5, \_AM_MODULEBUILDER_MODULE_CLONE_ERROR); + } + + //clone data table fields + $resultFields = $GLOBALS['xoopsDB']->query( + 'SELECT field_id FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_fields') . " as fs WHERE fs.field_tid = '{$tableIdSource}'" + ); + $num_rows2 = $GLOBALS['xoopsDB']->getRowsNum($resultFields); + if ($num_rows2 > 0) { + while (false !== ($myField = $GLOBALS['xoopsDB']->fetchArray($resultFields))) { + $fieldIdSource = $myField['field_id']; + $fieldsSource = $fieldsHandler->get($fieldIdSource); + $fieldsTarget = $fieldsHandler->create(); + $sourceVars = $fieldsSource->getVars(); + foreach ($sourceVars as $varKey => $varArray) { + //skip field_id + if ('field_id' !== $varKey) { + if ('field_mid' === $varKey) { + //replace mod_id by new mod_id + $fieldsTarget->setVar($varKey, $modIdTarget); + } elseif ('field_tid' === $varKey) { + //replace table_id by new table_id + $fieldsTarget->setVar($varKey, $tableIdTarget); + } else { + $fieldsTarget->setVar($varKey, $varArray['value']); + } + } + } + if (!$fieldsHandler->insert($fieldsTarget)) { + \redirect_header('modules.php', 5, \_AM_MODULEBUILDER_MODULE_CLONE_ERROR); + } + } + } + } + } + + \redirect_header('modules.php', 5, \_AM_MODULEBUILDER_MODULE_CLONE_SUCCESS); + } + + + + + break; } require __DIR__ . '/footer.php'; - diff --git a/assets/images/icons/32/page_copy.png b/assets/images/icons/32/page_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..7e387d63bf612473af159692d2aaf860cd4c975d GIT binary patch literal 958 zcmV;v13~qm^7{7mY zU=XI}v#$rPMX3a{hqD31G=w_NAg*aj$~Jk;z5`+D_a0pDY=QCN%RTjvQ_IwR~fZmNgx zP9>&?FC|Zm&aQ+3!PN>NO%VMkU~xdk@Rbh0hf_9Bgd~TsIFU0&3$-LDw?hNqOp_HZ z0wBYr#vgyO@b>O`E4`7oi5!bm0nMs_KLEK_Yngpmr9@X{m6T zfo?SLIlT#)oB@Vu7W>9fcXCjq(%Ba(h$0#CfTQNWeKnf z-%xy@a08>kHAH1y%L1V189pS&YJ5XAqN59@klnCK0P2jmW_tsc*wzUjljCj+zIC=e z0t0CFSiS;9XbJ!ln%F%)I@fR@nOQ*v@^YT~<@1ImsluE(la1EW$+;ja_ckf6KJ$evu=gkyo7h@Kd35jr$v?O{IQikES<)P!l!fJTmzz6_p;TssO0=4iB3=g0d zz9FBH4GVyLV~2dBu^Qj-)1kEN`2O~n9l9GsjNe4r5x_V6LVinbP%ejgfbM*N#3Bet gmhB&9_P+oF0Ct^ns4mFfxBvhE07*qoM6N<$g3q|IKL7v# literal 0 HcmV?d00001 diff --git a/docs/changelog.txt b/docs/changelog.txt index 78d9e6c1..f76dca3b 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,8 @@ +
    3.05 RC2 [2021-10-13]
    Dev: XOOPS 2.5.11, PHP 7.4.5 +
    + - added icon for clone (goffy) + - added feature to clone module (mamba/goffy) +
    3.05 RC1 [2020-11-11]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    - fixed bug with l\trim (alain/goffy) diff --git a/include/install.php b/include/install.php index dcad07df..ade633a5 100644 --- a/include/install.php +++ b/include/install.php @@ -99,5 +99,13 @@ 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'; + if (!\file_exists($dest)) { + $file = \dirname(__DIR__) . '/assets/images/icons/32/page_copy.png'; + $utility::copyFile($file, $dest); + } + return true; } diff --git a/language/english/admin.php b/language/english/admin.php index 010c5de0..0e186a3c 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -195,6 +195,8 @@ \define('_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK', "The module %s is successfully updated"); \define('_AM_MODULEBUILDER_MODULE_BUTTON_NEW_LOGO', 'Create new Logo'); \define('_AM_MODULEBUILDER_MODULE_NOACTSET', 'Error: No active setting found'); +\define('_AM_MODULEBUILDER_MODULE_CLONE_SUCCESS', 'Module successfully cloned'); +\define('_AM_MODULEBUILDER_MODULE_CLONE_ERROR', 'An error occured when cloning module'); // // ------------------- Tables --------------------------------- // // buttons diff --git a/templates/admin/modulebuilder_modules.tpl b/templates/admin/modulebuilder_modules.tpl index 39cb63a9..e777d53c 100644 --- a/templates/admin/modulebuilder_modules.tpl +++ b/templates/admin/modulebuilder_modules.tpl @@ -74,14 +74,13 @@ - <{$smarty.const._EDIT}> - + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> - - <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> + <{$smarty.const._DELETE}> + + <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> + + <{$smarty.const._CLONE}> <{/foreach}> diff --git a/xoops_version.php b/xoops_version.php index 4ea6539d..2e64a23b 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -27,7 +27,7 @@ $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $modversion['version'] = 3.05; -$modversion['module_status'] = 'RC1'; +$modversion['module_status'] = 'RC2'; $modversion['release_date'] = '2020/11/11'; $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; From 51c7d0b42d3f2fdadcc8b407606f591ac64ba294 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:29:11 -0400 Subject: [PATCH 150/266] $pathIconXX int to string --- admin/footer.php | 2 +- class/Common/DirectoryChecker.php | 2 +- class/Common/FileChecker.php | 2 +- config/icons.php | 2 +- files/commonfiles/class/Common/DirectoryChecker.php | 2 +- files/commonfiles/class/Common/FileChecker.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/footer.php b/admin/footer.php index 635f2013..a84585f1 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -22,7 +22,7 @@ * Goffy https://myxoops.org * */ -$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); if (isset($templateMain)) { $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 1788f4d0..1243352b 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -44,7 +44,7 @@ class DirectoryChecker */ public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null) { - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); if (empty($path)) { return false; diff --git a/class/Common/FileChecker.php b/class/Common/FileChecker.php index d0d870f7..380254fd 100644 --- a/class/Common/FileChecker.php +++ b/class/Common/FileChecker.php @@ -44,7 +44,7 @@ class FileChecker */ public static function getFileStatus($file_path, $original_file_path = null, $redirectFile) { - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); if (empty($file_path)) { return false; diff --git a/config/icons.php b/config/icons.php index 40358524..fccce32a 100644 --- a/config/icons.php +++ b/config/icons.php @@ -2,7 +2,7 @@ function getIcons() { - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); $moduleDirName = \basename(\dirname(__DIR__)); return (object)[ diff --git a/files/commonfiles/class/Common/DirectoryChecker.php b/files/commonfiles/class/Common/DirectoryChecker.php index 1788f4d0..1243352b 100644 --- a/files/commonfiles/class/Common/DirectoryChecker.php +++ b/files/commonfiles/class/Common/DirectoryChecker.php @@ -44,7 +44,7 @@ class DirectoryChecker */ public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null) { - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); if (empty($path)) { return false; diff --git a/files/commonfiles/class/Common/FileChecker.php b/files/commonfiles/class/Common/FileChecker.php index d0d870f7..380254fd 100644 --- a/files/commonfiles/class/Common/FileChecker.php +++ b/files/commonfiles/class/Common/FileChecker.php @@ -44,7 +44,7 @@ class FileChecker */ public static function getFileStatus($file_path, $original_file_path = null, $redirectFile) { - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); if (empty($file_path)) { return false; From 38437a0ee863644f7bad8da0b84a8cd64d9d8d98 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:36:27 -0400 Subject: [PATCH 151/266] parameter types --- class/Common/VersionChecks.php | 6 +++--- files/commonfiles/class/Common/VersionChecks.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 39488d25..b52d89b7 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -84,7 +84,7 @@ public static function checkVerPhp(\XoopsModule $module = null) } /** - * compares current module version with latest GitHub release + * compares current module version with the latest GitHub release * @static * @param \Xmf\Module\Helper $helper * @param string|null $source @@ -92,14 +92,14 @@ public static function checkVerPhp(\XoopsModule $module = null) * * @return string|array info about the latest module version, if newer */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') + public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; $repository = 'XoopsModules25x/' . $moduleDirName; // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; + $ret = null; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { diff --git a/files/commonfiles/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php index 39488d25..b52d89b7 100644 --- a/files/commonfiles/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -84,7 +84,7 @@ public static function checkVerPhp(\XoopsModule $module = null) } /** - * compares current module version with latest GitHub release + * compares current module version with the latest GitHub release * @static * @param \Xmf\Module\Helper $helper * @param string|null $source @@ -92,14 +92,14 @@ public static function checkVerPhp(\XoopsModule $module = null) * * @return string|array info about the latest module version, if newer */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') + public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; $repository = 'XoopsModules25x/' . $moduleDirName; // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; + $ret = null; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { From 1794d5eb73252396d0b0d71d6c3d1f95e4a5204e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:40:29 -0400 Subject: [PATCH 152/266] PHP8 for Scrutinizer --- .scrutinizer.yml | 2 ++ files/commonfiles/.scrutinizer.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 82981035..fd26326c 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,5 +1,7 @@ # language: php build: + environment: + php: 8.0.11 nodes: tests: true analysis: diff --git a/files/commonfiles/.scrutinizer.yml b/files/commonfiles/.scrutinizer.yml index af09681d..a8feb1b1 100644 --- a/files/commonfiles/.scrutinizer.yml +++ b/files/commonfiles/.scrutinizer.yml @@ -1,5 +1,7 @@ # language: php build: + environment: + php: 8.0.11 nodes: tests: true analysis: From 5bdd85f69fc9bf8e5d97acd02af1b23cca04e449 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 21 Oct 2021 15:40:56 +0200 Subject: [PATCH 153/266] moved to final --- docs/changelog.txt | 4 ++++ xoops_version.php | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index f76dca3b..7de5dbd3 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,7 @@ +
    3.05 Final [2021-10-21]
    Dev: XOOPS 2.5.11, PHP 7.4.5 +
    + - moved to final (goffy) +
    3.05 RC2 [2021-10-13]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    - added icon for clone (goffy) diff --git a/xoops_version.php b/xoops_version.php index 2e64a23b..62b7877b 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -27,8 +27,8 @@ $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $modversion['version'] = 3.05; -$modversion['module_status'] = 'RC2'; -$modversion['release_date'] = '2020/11/11'; +$modversion['module_status'] = 'Final'; +$modversion['release_date'] = '2021/10/21'; $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; @@ -46,9 +46,9 @@ $modversion['image'] = "assets/images/logoModule.png"; $modversion['dirname'] = $moduleDirName; // Frameworks icons -$modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin'; -$modversion['sysicons16'] = '../../Frameworks/moduleclasses/icons/16'; -$modversion['sysicons32'] = '../../Frameworks/moduleclasses/icons/32'; +$modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin'; +$modversion['sysicons16'] = '../../Frameworks/moduleclasses/icons/16'; +$modversion['sysicons32'] = '../../Frameworks/moduleclasses/icons/32'; // Module icons $modversion['modicons16'] = 'assets/images/icons/16'; $modversion['modicons32'] = 'assets/images/icons/32'; From 765c2574a9cd485491307f3836a0a518ed21c599 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 27 Oct 2021 15:25:42 +0200 Subject: [PATCH 154/266] fixed bug in class handler creation --- class/Files/Classes/ClassHandlerFiles.php | 11 +++++++---- docs/changelog.txt | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 102d839b..ebf6310d 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -119,7 +119,7 @@ private function getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldN $cClh .= $this->getClassAll($tableName, $fieldId, $fieldMain); $cClh .= $this->getClassCriteria($tableName); if ($fieldElement > 16 && \in_array(1, $fieldParentId)) { - $cClh .= $this->getClassByCategory($moduleDirname, $tableName, $tableFieldName, $fieldId, $fieldName, $fieldMain, $fieldElement); + //$cClh .= $this->getClassByCategory($moduleDirname, $tableName, $tableFieldName, $fieldId, $fieldName, $fieldMain, $fieldElement); $cClh .= $this->getClassGetTableSolenameById($table, $fieldMain); } @@ -223,6 +223,7 @@ private function getClassAll($tableName, $fieldId, $fieldMain) return $ret; } + /*remark from goffy: 'getClassByCategory' currently not in use*/ /** * @public function getClassByCategory * @@ -235,6 +236,7 @@ private function getClassAll($tableName, $fieldId, $fieldMain) * @param $fieldElement * @return string */ + /* private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, $fieldId, $fieldName, $fieldMain, $fieldElement) { $ucfTableName = \ucfirst($tableName); @@ -266,7 +268,9 @@ private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, $ret .= $this->pc->getPhpCodeFunction("getAll{$ucfTableName}By{$fieldNameDesc}Id" . $ucfTableName, $params, $critAll, 'public ', false, "\t"); return $ret; + } + */ /** * @public function getClassCriteria @@ -304,14 +308,13 @@ private function getClassGetTableSolenameById($table, $fieldMain) $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); $ucfTableSoleName = \ucfirst($tableSoleName); - $ccTableSoleName = $this->getCamelCase($tableSoleName, true); $ret = $this->pc->getPhpCodeCommentMultiLine(['Returns the' => $ucfTableSoleName . ' from id', '' => '', '@return' => 'string'], "\t"); $soleName = $this->xc->getXcEqualsOperator("\${$tableSoleName}Id", "(int)( \${$tableSoleName}Id )", null, "\t\t"); $soleName .= $this->xc->getXcEqualsOperator("\${$tableSoleName}", "''", null, "\t\t"); $contentIf = $this->xc->getXcHandlerLine($tableName, "\t\t\t"); - $contentIf .= $this->xc->getXcHandlerGet($tableName, "\${$tableSoleName}Id", 'Obj', true, false, "\t\t\t"); - $getVar = $this->xc->getXcGetVar($ccTableSoleName, "{$tableSoleName}Obj", $fieldMain, false, "\t\t\t\t"); + $contentIf .= $this->xc->getXcHandlerGet($tableName, "{$tableSoleName}Id", 'Obj', $tableName . 'Handler', false, "\t\t\t"); + $getVar = $this->xc->getXcGetVar($tableSoleName, "{$tableSoleName}Obj", $fieldMain, false, "\t\t\t\t"); $contentIf .= $this->pc->getPhpCodeConditions("\is_object( \${$tableSoleName}Obj )", '', '', $getVar, false, "\t\t\t"); $soleName .= $this->pc->getPhpCodeConditions("\${$tableSoleName}Id", ' > ', '0', $contentIf, false, "\t\t"); $soleName .= $this->getSimpleString("return \${$tableSoleName};", "\t\t"); diff --git a/docs/changelog.txt b/docs/changelog.txt index 7de5dbd3..dddc56a1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,6 +1,7 @@
    3.05 Final [2021-10-21]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    - moved to final (goffy) + - fixed bug in class handler creation (jjdai/goffy)
    3.05 RC2 [2021-10-13]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    From 7431e8d6d2e0443048128fe65ab87b3f2cc8b72e Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 27 Oct 2021 19:05:28 +0200 Subject: [PATCH 155/266] changed font color --- assets/css/admin/style.css | 2 +- docs/changelog.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/css/admin/style.css b/assets/css/admin/style.css index 710008ff..2d4e62e6 100644 --- a/assets/css/admin/style.css +++ b/assets/css/admin/style.css @@ -362,7 +362,7 @@ tbody.table-list tr td { padding: 5px 2px; margin-bottom: 3px; text-shadow: 1px 1px 1px #fff; - color: #ff8400; + color: #000000; } .field-list tr td img.move { diff --git a/docs/changelog.txt b/docs/changelog.txt index dddc56a1..6538e6ab 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,7 @@
    - moved to final (goffy) - fixed bug in class handler creation (jjdai/goffy) + - changed font color (jjdai/goffy)
    3.05 RC2 [2021-10-13]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    From 5a4de8fa0ea92aecf7841a4dcd468fdb7885f5a3 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 27 Oct 2021 22:26:42 -0400 Subject: [PATCH 156/266] semantic versioning --- docs/changelog.txt | 3 ++- xoops_version.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index f76dca3b..5b9c4727 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,7 +1,8 @@ -
    3.05 RC2 [2021-10-13]
    Dev: XOOPS 2.5.11, PHP 7.4.5 +
    3.5.0 RC2 [2021-10-13]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    - added icon for clone (goffy) - added feature to clone module (mamba/goffy) + - semantic versioning (mamba)
    3.05 RC1 [2020-11-11]
    Dev: XOOPS 2.5.11, PHP 7.4.5
    diff --git a/xoops_version.php b/xoops_version.php index 2e64a23b..f8dfd55b 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -26,9 +26,9 @@ $moduleDirName = \basename(__DIR__); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -$modversion['version'] = 3.05; +$modversion['version'] = '3.5.0'; $modversion['module_status'] = 'RC2'; -$modversion['release_date'] = '2020/11/11'; +$modversion['release_date'] = '2021/10/27'; $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; @@ -230,7 +230,7 @@ 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', - 'default' => '1.0', + 'default' => '1.0.0', ]; $modversion['config'][] = [ From 007ca0073350f2c03342ce09afdee293535a2adf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 27 Oct 2021 22:27:15 -0400 Subject: [PATCH 157/266] cosmetics --- class/Common/TestdataButtons.php | 2 +- language/english/admin.php | 2 +- testdata/index.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index b6eacaac..8f51a93f 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -37,7 +37,7 @@ class TestdataButtons public static function loadButtonConfig($adminObject) { $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps $displaySampleButton = $config['displaySampleButton']; diff --git a/language/english/admin.php b/language/english/admin.php index 488e0b0c..7fd24e54 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -435,7 +435,7 @@ \define('_AM_MODULEBUILDER_TOGGLE_SUCCESS', 'Successfully Changed Display'); \define('_AM_MODULEBUILDER_TOGGLE_FAILED', 'Changing Display Failed'); // -\define('_AM_MODULEBUILDER_ABOUT_WEBSITE_FORUM', 'Forum Web Site'); +\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 '); \define('_AM_MODULEBUILDER_SUPPORT_FORUM', 'Support Forum'); diff --git a/testdata/index.php b/testdata/index.php index fb0a9092..dd40ad91 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -107,7 +107,7 @@ function saveSampleData() { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $tables = $helper->getModule()->getInfo('tables'); @@ -136,7 +136,7 @@ function saveSampleData() function exportSchema() { $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); try { // TODO set exportSchema @@ -208,7 +208,7 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) function clearSampleData() { $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); // Load language files $helper->loadLanguage('common'); From 59445ffc768f2315f2490a0ac629fb3e1b422c28 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 08:52:48 -0400 Subject: [PATCH 158/266] import of existing modules --- admin/import_module.php | 73 +++++ admin/modules.php | 276 ++++++++++++++++-- class/Common/SysUtility.php | 2 +- class/Devtools.php | 2 +- class/Utility.php | 2 +- docs/changelog.txt | 3 + files/commonfiles/class/Common/SysUtility.php | 2 +- files/commonfiles/class/Utility.php | 2 +- language/english/admin.php | 14 + xoops_version.php | 4 +- 10 files changed, 349 insertions(+), 31 deletions(-) create mode 100644 admin/import_module.php diff --git a/admin/import_module.php b/admin/import_module.php new file mode 100644 index 00000000..34039c3a --- /dev/null +++ b/admin/import_module.php @@ -0,0 +1,73 @@ +displayNavigation('modules.php'); +$adminObject->addItemButton(_MI_MODULEBUILDER_ADMIN_MODULES, 'modules.php', 'list'); +$adminObject->displayButton('left'); + +require XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + +$formImportModule = new \XoopsThemeForm('modules_import', 'Class', 'modules.php?op=modules_import', 'post', true); +$select_module = new \XoopsFormSelect(_AM_MODULEBUILDER_MODULE_ID, 'moduleName', ''); +$newModuleName = new \XoopsFormText(_AM_MODULEBUILDER_MODULE_NEW_NAME, 'moduleNewName', 50, 50, ''); +$moduleHandler = xoops_getHandler('module'); +$installed_mods = $moduleHandler->getObjects(); +$listed_mods = []; +$count = 0; +foreach ($installed_mods as $module) { + $select_module->addOption($module->getVar('dirname', 'E'), $module->getVar('dirname', 'E')); +} +$select_table = new \XoopsFormSelect(_AM_MODULEBUILDER_TABLE_ID, 'table_id', ''); + +$sql = 'SHOW TABLES'; +$result = $GLOBALS['xoopsDB']->queryF($sql); + +if (!$result) { + echo '_AM_MODULEBUILDER_ERROR_DATABASE'; + echo '_AM_MODULEBUILDER_ERROR_SQL' . $GLOBALS['xoopsDB']->error(); + exit; +} + +while (false !== ($row = $GLOBALS['xoopsDB']->fetchRow($result))) { + $select_table->addOption($row[0], $row[0]); +} +//TODO: add an option to set a name of the new module created by importing the old one +$formImportModule->addElement($select_module); +$formImportModule->addElement($newModuleName); +$op_hidden = new \XoopsFormHidden('op', 'modules_import'); +$formImportModule->addElement($op_hidden); +$dbname_hidden = new \XoopsFormHidden('dbname', ''); +$formImportModule->addElement($dbname_hidden); + +//Submit buttons +$buttonTray = new \XoopsFormElementTray('', ''); +$submit_button = new \XoopsFormButton('', '', _AM_MODULEBUILDER_GENERATE, 'submit'); +$buttonTray->addElement($submit_button); + +$cancel_button = new \XoopsFormButton('', '', _CANCEL, 'button'); +$cancel_button->setExtra('onclick="history.go(-1)"'); +$buttonTray->addElement($cancel_button); + +$formImportModule->addElement($buttonTray); + +$formImportModule->display(); + +require __DIR__ . '/footer.php'; diff --git a/admin/modules.php b/admin/modules.php index 3292b718..9af27471 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -23,6 +23,11 @@ */ use Xmf\Request; +use XoopsModules\Modulebuilder\{ + Helper +}; + +/** @var Helper $helper */ // Define main template $templateMain = 'modulebuilder_modules.tpl'; @@ -32,6 +37,225 @@ $op = Request::getString('op', 'list'); $modId = Request::getInt('mod_id'); +/** + * @param $tableName + * + * @return array + */ +function importFields($tableName) +{ + $table = $GLOBALS['xoopsDB']->prefix((string)$tableName); + + $sql = 'SHOW COLUMNS FROM ' . $table; + $result = $GLOBALS['xoopsDB']->query($sql); + + $tFields = []; + + while ($data = $GLOBALS['xoopsDB']->fetchBoth($result)) { + $t = []; + $t['Field'] = $data['Field']; + $t['Type'] = $data['Type']; + + if ('YES' === $data['Null']) { + $t['Null'] = 'NULL'; + } else { + $t['Null'] = 'NOT NULL'; + } + $t['Key'] = $data['Key']; + $t['Default'] = $data['Default']; + $t['Extra'] = $data['Extra']; + + $t['Label'] = isset($data['Label']) ? $data['Label'] : ''; + + $h = strpos($data['Type'], '('); + $i = strpos($data['Type'], ')'); + if (false === $h) { + $t['Len'] = 0; + } else { + $t['Type'] = 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); + } else { + $t['Len'] = (int)substr($data['Type'], $h + 1, $i - 1 - $h); + } + if (strlen($data['Type']) > $i) { + $t['Signed'] = substr($data['Type'], $i + 2); + } + } + + $tFields[$t['Field']] = $t; + + return $tFields; + } +} + +function importModule() +{ + $moduleName = isset($_POST['moduleName']) ? $_POST['moduleName'] : 'newModule'; + $moduleNewName = isset($_POST['moduleNewName']) ? $_POST['moduleNewName'] : $moduleName; + $moduleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower($moduleNewName)); + + $helper = Helper::getInstance(); + $modulesHandler = $helper->getHandler('Modules'); + $newModule = $modulesHandler->create(); + + $newModule->setVar('mod_name', $moduleNewName); + $newModule->setVar('mod_release', date('Y-m-d')); + $newModule->setVar('mod_dirname', $moduleDirname); + + $newModule->setVar('mod_version', $helper->getConfig('version')); //$GLOBALS['xoopsModuleConfig']['version']); + + $newModule->setVar('mod_since', $helper->getConfig('since')); + $newModule->setVar('mod_min_php', $helper->getConfig('min_php')); + $newModule->setVar('mod_min_xoops', $helper->getConfig('min_xoops')); + $newModule->setVar('mod_min_admin', $helper->getConfig('min_admin')); + $newModule->setVar('mod_min_mysql', $helper->getConfig('min_mysql')); + + $newModule->setVar('mod_description', $helper->getConfig('description')); + $newModule->setVar('mod_author', $helper->getConfig('author')); + $newModule->setVar('mod_author_mail', $helper->getConfig('author_email')); + $newModule->setVar('mod_author_website_url', $helper->getConfig('author_website_url')); + $newModule->setVar('mod_author_website_name', $helper->getConfig('author_website_name')); + $newModule->setVar('mod_credits', $helper->getConfig('credits')); + $newModule->setVar('mod_license', $helper->getConfig('license')); + $newModule->setVar('mod_display_admin', $helper->getConfig('display_admin')); + $newModule->setVar('mod_display_user', $helper->getConfig('display_user')); + $newModule->setVar('mod_active_search', $helper->getConfig('active_search')); + $newModule->setVar('mod_active_comments', $helper->getConfig('active_comments')); + $newModule->setVar('mod_release_info', $helper->getConfig('release_info')); + $newModule->setVar('mod_release_file', $helper->getConfig('release_file')); + $newModule->setVar('mod_manual', $helper->getConfig('manual')); + $newModule->setVar('mod_manual_file', $helper->getConfig('manual_file')); + $newModule->setVar('mod_image', 'empty.png'); + $newModule->setVar('mod_demo_site_url', $helper->getConfig('demo_site_url')); + $newModule->setVar('mod_demo_site_name', $helper->getConfig('demo_site_name')); + $newModule->setVar('mod_support_url', $helper->getConfig('support_url')); + $newModule->setVar('mod_support_name', $helper->getConfig('support_name')); + $newModule->setVar('mod_website_url', $helper->getConfig('website_url')); + $newModule->setVar('mod_website_name', $helper->getConfig('website_name')); + $newModule->setVar('mod_status', $helper->getConfig('status')); + + $newModule->setVar('mod_admin', $helper->getConfig('display_admin')); + $newModule->setVar('mod_user', $helper->getConfig('display_user')); + $newModule->setVar('mod_search', $helper->getConfig('active_search')); + $newModule->setVar('mod_comments', $helper->getConfig('active_comments')); + $newModule->setVar('mod_notifications', $helper->getConfig('active_notifications')); + $newModule->setVar('mod_permissions', $helper->getConfig('active_permissions')); + $newModule->setVar('mod_donations', $helper->getConfig('donations')); + $newModule->setVar('mod_subversion', $helper->getConfig('subversion')); + + if ($modulesHandler->insert($newModule)) { + // get the ID of the new module + $criteria = new \Criteria('mod_name', $moduleNewName); + $moduleObject = $modulesHandler->getObjects($criteria, '', true); + $moduleId = $moduleObject[0]->getVar('mod_id'); + importTables($moduleId, $moduleName); + } +} + +/** + * @param $moduleId + * @param $moduleName + */ +function importTables($moduleId, $moduleName) +{ + $helper = Helper::getInstance(); + $tablesHandler = $helper->getHandler('Tables'); + $fieldsHandler = $helper->getHandler('Fields'); + //mb--------------------------------------------- + $moduleHandler = xoops_getHandler('module'); + $module = $moduleHandler->getByDirname($moduleName); + $moduleTables = $module->getInfo('tables'); + + if (false !== $moduleTables && is_array($moduleTables)) { + foreach ($moduleTables as $table) { + //create a new tablesholder + $newTable = $tablesHandler->create(); + $newTable->setVar('table_mid', $moduleId); + + $newTable->setVar('table_name', $table); + $newTable->setVar('table_image', 'alert.png'); + + //get all the fields for this table + $importedFields = importFields($table); + + //set the number of fields for this table + $countFields = count($importedFields); + $newTable->setVar('table_nbfields', $countFields); + + $currentNumber = 0; + + foreach ($importedFields as $t) { + $fieldsObj = $fieldsHandler->create(); + $fieldsObj->setVar('field_mid', $moduleId); + $fieldsObj->setVar('field_tid', $newTable->getVar('table_id')); + $fieldsObj->setVar('field_order', $currentNumber); + $fieldsObj->setVar('field_name', $t['Field']); + $fieldsObj->setVar('field_type', $t['Type']); + $fieldsObj->setVar('field_value', $t['Len']); + $fieldsObj->setVar('field_attribute', $t['Signed'] ?? ''); + $fieldsObj->setVar('field_null', $t['Null'] ?? ''); + $fieldsObj->setVar('field_default', $t['Default']); + + if (isset($t['Key'])) { + if ('PRI' === $t['Key']) { + $fieldsObj->setVar('field_key', 'primary'); + } else { + if ('UNI' === $t['Key']) { + $fieldsObj->setVar('field_key', 'unique'); + } + } + } + $fieldsObj->setVar('field_element', $t['Field']); + + if ($currentNumber < $countFields - 1) { + } + + if (0 == $currentNumber) { + 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',])) { + //XoopsFormText + $fieldsObj->setVar('field_element', '2'); + } elseif ('datetime' === $t['Type']) { + //XoopsFormDateTime //XoopsFormDatePicker + $fieldsObj->setVar('field_element', '21'); + } elseif ('date' === $t['Type']) { + //XoopsFormTextDateSelect + $fieldsObj->setVar('field_element', '15'); + } + } else { + if ($currentNumber > 0) { + 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',])) { + //XoopsFormText + $fieldsObj->setVar('field_element', '2'); + } elseif ('datetime' === $t['Type']) { + //XoopsFormDateTime //XoopsFormDatePicker + $fieldsObj->setVar('field_element', '21'); + } elseif ('date' === $t['Type']) { + //XoopsFormTextDateSelect + $fieldsObj->setVar('field_element', '15'); + } + } + } + + ++$currentNumber; + + $fieldsHandler->insert($fieldsObj); + } + + if ($tablesHandler->insert($newTable)) { + echo $table . ' Table has been imported
    '; + //success, redirect + } + } + } +} + switch ($op) { case 'list': default: @@ -41,6 +265,9 @@ $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new', 'add'); + + $adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_IMPORT, 'import_module.php', 'compfile'); + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); @@ -82,6 +309,11 @@ $form = $modulesObj->getFormModules(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; + + case 'modules_import': + importModule(); + break; + case 'save': if (!$GLOBALS['xoopsSecurity']->check()) { \redirect_header('modules.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); @@ -209,11 +441,11 @@ } } else { $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm( - ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], - \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), - $modulesObj->getVar('mod_name') - ); - $form = $xoopsconfirm->getFormXoopsConfirm(); + ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], + \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), + $modulesObj->getVar('mod_name') + ); + $form = $xoopsconfirm->getFormXoopsConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; @@ -240,19 +472,19 @@ //clone data table modules $modulesHandler = $helper->getHandler('Modules'); $tablesHandler = $helper->getHandler('Tables'); - $fieldsHandler = $helper->getHandler('Fields'); - $moduleSource = $modulesHandler->get($modIdSource); - $moduleTarget = $modulesHandler->create(); - $sourceVars = $moduleSource->getVars(); + $fieldsHandler = $helper->getHandler('Fields'); + $moduleSource = $modulesHandler->get($modIdSource); + $moduleTarget = $modulesHandler->create(); + $sourceVars = $moduleSource->getVars(); foreach ($sourceVars as $varKey => $varArray) { if ('mod_id' !== $varKey) { if (in_array($varKey, ['mod_name', 'mod_dirname'])) { for ($i = 1; $i <= 10; $i++) { $uniqValue = $varArray['value'] . $i; - $result = $GLOBALS['xoopsDB']->query( + $result = $GLOBALS['xoopsDB']->query( 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_modules') . " as ms WHERE ms.{$varKey} = '{$uniqValue}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { break; } @@ -262,7 +494,7 @@ $moduleTarget->setVar($varKey, $varArray['value']); } } -} + } if ($modulesHandler->insert($moduleTarget)) { //get new mod_id @@ -275,13 +507,13 @@ $resultTables = $GLOBALS['xoopsDB']->query( 'SELECT table_id FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_tables') . " as ts WHERE ts.table_mid = '{$modIdSource}'" ); - $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']; - $tableSource = $tablesHandler->get($tableIdSource); - $tableTarget = $tablesHandler->create(); - $sourceVars = $tableSource->getVars(); + $tableSource = $tablesHandler->get($tableIdSource); + $tableTarget = $tablesHandler->create(); + $sourceVars = $tableSource->getVars(); foreach ($sourceVars as $varKey => $varArray) { //skip table_id if ('table_id' !== $varKey) { @@ -304,13 +536,13 @@ $resultFields = $GLOBALS['xoopsDB']->query( 'SELECT field_id FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_fields') . " as fs WHERE fs.field_tid = '{$tableIdSource}'" ); - $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']; - $fieldsSource = $fieldsHandler->get($fieldIdSource); - $fieldsTarget = $fieldsHandler->create(); - $sourceVars = $fieldsSource->getVars(); + $fieldsSource = $fieldsHandler->get($fieldIdSource); + $fieldsTarget = $fieldsHandler->create(); + $sourceVars = $fieldsSource->getVars(); foreach ($sourceVars as $varKey => $varArray) { //skip field_id if ('field_id' !== $varKey) { @@ -336,10 +568,6 @@ \redirect_header('modules.php', 5, \_AM_MODULEBUILDER_MODULE_CLONE_SUCCESS); } - - - - break; } diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 70267d39..f71d56c1 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -19,7 +19,7 @@ * * @license https://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2000-2020 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba */ diff --git a/class/Devtools.php b/class/Devtools.php index 8f3bc8b8..73b838ae 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -21,7 +21,7 @@ * @package \module\modulebuilder\class * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2001-2017 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba * @since */ diff --git a/class/Utility.php b/class/Utility.php index ecbdc226..b02e38dd 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -21,7 +21,7 @@ * @package \module\modulebuilder\class * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2001-2017 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba * @since */ diff --git a/docs/changelog.txt b/docs/changelog.txt index 0cb64919..4db5ce35 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,6 @@ +
    3.6.0 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 +- added import of existing modules (for their redesign) (mamba) +
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/files/commonfiles/class/Common/SysUtility.php b/files/commonfiles/class/Common/SysUtility.php index 70267d39..f71d56c1 100644 --- a/files/commonfiles/class/Common/SysUtility.php +++ b/files/commonfiles/class/Common/SysUtility.php @@ -19,7 +19,7 @@ * * @license https://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2000-2020 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba */ diff --git a/files/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php index cf0cce55..ffd79cbb 100644 --- a/files/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -21,7 +21,7 @@ * @package \module\modulebuilder\class * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2001-2017 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba * @since */ diff --git a/language/english/admin.php b/language/english/admin.php index 7fd24e54..93cdfec2 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -461,3 +461,17 @@ \define('_AM_MODULEBUILDER_DEVTOOLS_TAB', 'Replace tab by 4 spaces'); \define('_AM_MODULEBUILDER_DEVTOOLS_TAB_MODULE', 'Select module to replace tabs'); \define('_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC', 'This tool creates a copy of selected module in %s and replace tab by 4 spaces'); + +// -------------------- IMPORT MODULE ----------------------------------- + +define('_AM_MODULEBUILDER_MODULES_IMPORT', 'Import Module'); +define('_MI_MODULEBUILDER_ADMIN_MODULES', 'Modules'); +define('_AM_MODULEBUILDER_TABLES_IMPORT', 'Import Table'); +//define('_AM_MODULEBUILDER_MODULE_ID', 'Import this module into TDMCreate:'); +define('_AM_MODULEBUILDER_MODULE_IMPORT_INTO', 'Import Table into this module:'); +define('_AM_MODULEBUILDER_TABLE_ID', 'Select table to import:'); +define('_AM_MODULEBUILDER_MODULE_NEW_NAME', 'New Name for the generated module:'); + +define('_AM_MODULEBUILDER_GENERATE', 'Generate'); +define('_AM_MODULEBUILDER_ERROR_DATABASE', "Unable to list the databases \n"); +define('_AM_MODULEBUILDER_ERROR_SQL', 'Error SQL: '); diff --git a/xoops_version.php b/xoops_version.php index 25fbcc40..3f8f05fc 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -26,9 +26,9 @@ $moduleDirName = \basename(__DIR__); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -$modversion['version'] = '3.5.1'; +$modversion['version'] = '3.6.0'; $modversion['module_status'] = 'Beta 1 NOT RELEASED'; -$modversion['release_date'] = '2021/10/27'; +$modversion['release_date'] = '2021/11/04'; $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; From 67a720394ef251f56ff87301500377e9972bbce6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 09:35:57 -0400 Subject: [PATCH 159/266] scrutinizer --- admin/import_module.php | 9 +++++---- admin/modules.php | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/admin/import_module.php b/admin/import_module.php index 34039c3a..0c51769d 100644 --- a/admin/import_module.php +++ b/admin/import_module.php @@ -28,10 +28,11 @@ $formImportModule = new \XoopsThemeForm('modules_import', 'Class', 'modules.php?op=modules_import', 'post', true); $select_module = new \XoopsFormSelect(_AM_MODULEBUILDER_MODULE_ID, 'moduleName', ''); $newModuleName = new \XoopsFormText(_AM_MODULEBUILDER_MODULE_NEW_NAME, 'moduleNewName', 50, 50, ''); -$moduleHandler = xoops_getHandler('module'); -$installed_mods = $moduleHandler->getObjects(); -$listed_mods = []; -$count = 0; +/** @var \XoopsModuleHandler $moduleHandler */ +$moduleHandler = xoops_getHandler('module'); +$installed_mods = $moduleHandler->getObjects(); +$listed_mods = []; +$count = 0; foreach ($installed_mods as $module) { $select_module->addOption($module->getVar('dirname', 'E'), $module->getVar('dirname', 'E')); } diff --git a/admin/modules.php b/admin/modules.php index 9af27471..d1f7f946 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -147,7 +147,7 @@ function importModule() if ($modulesHandler->insert($newModule)) { // get the ID of the new module $criteria = new \Criteria('mod_name', $moduleNewName); - $moduleObject = $modulesHandler->getObjects($criteria, '', true); + $moduleObject = $modulesHandler->getObjects($criteria, false, true); $moduleId = $moduleObject[0]->getVar('mod_id'); importTables($moduleId, $moduleName); } @@ -162,7 +162,8 @@ function importTables($moduleId, $moduleName) $helper = Helper::getInstance(); $tablesHandler = $helper->getHandler('Tables'); $fieldsHandler = $helper->getHandler('Fields'); - //mb--------------------------------------------- + + /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $module = $moduleHandler->getByDirname($moduleName); $moduleTables = $module->getInfo('tables'); From 4e3f804121a7b607930b17578fe8822a753eb3f3 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 10:37:19 -0400 Subject: [PATCH 160/266] increased size of the "mod_version" field in modulebuilder_modules table from 4 to 10 --- docs/changelog.txt | 1 + sql/mysql.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 4db5ce35..5ea5797c 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,6 @@
    3.6.0 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - added import of existing modules (for their redesign) (mamba) +- increased size of the "mod_version" field in modulebuilder_modules table from 4 to 10 (mamba)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/sql/mysql.sql b/sql/mysql.sql index ec2a2e7d..3dfb5e4f 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -72,7 +72,7 @@ CREATE TABLE `modulebuilder_modules` ( `mod_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, `mod_name` VARCHAR(200) NOT NULL DEFAULT '', `mod_dirname` VARCHAR(100) NOT NULL DEFAULT '', - `mod_version` VARCHAR(4) NOT NULL DEFAULT '1.0', + `mod_version` VARCHAR(10) NOT NULL DEFAULT '1.0', `mod_since` VARCHAR(4) NOT NULL DEFAULT '1.0', `mod_min_php` VARCHAR(4) NOT NULL DEFAULT '5.5', `mod_min_xoops` VARCHAR(6) NOT NULL DEFAULT '2.5.9', From a57da26e0b9192608def341a36e220faa15bb4b8 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 16:06:07 -0400 Subject: [PATCH 161/266] language updates --- language/english/admin.php | 20 ++- language/update language 1.39 to 3.6.0.txt | 146 +++++++++++++++++++++ 2 files changed, 155 insertions(+), 11 deletions(-) create mode 100644 language/update language 1.39 to 3.6.0.txt diff --git a/language/english/admin.php b/language/english/admin.php index 93cdfec2..3e6aa4b7 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -464,14 +464,12 @@ // -------------------- IMPORT MODULE ----------------------------------- -define('_AM_MODULEBUILDER_MODULES_IMPORT', 'Import Module'); -define('_MI_MODULEBUILDER_ADMIN_MODULES', 'Modules'); -define('_AM_MODULEBUILDER_TABLES_IMPORT', 'Import Table'); -//define('_AM_MODULEBUILDER_MODULE_ID', 'Import this module into TDMCreate:'); -define('_AM_MODULEBUILDER_MODULE_IMPORT_INTO', 'Import Table into this module:'); -define('_AM_MODULEBUILDER_TABLE_ID', 'Select table to import:'); -define('_AM_MODULEBUILDER_MODULE_NEW_NAME', 'New Name for the generated module:'); - -define('_AM_MODULEBUILDER_GENERATE', 'Generate'); -define('_AM_MODULEBUILDER_ERROR_DATABASE', "Unable to list the databases \n"); -define('_AM_MODULEBUILDER_ERROR_SQL', 'Error SQL: '); +\define('_AM_MODULEBUILDER_MODULES_IMPORT', 'Import Module'); +\define('_MI_MODULEBUILDER_ADMIN_MODULES', 'Modules'); +\define('_AM_MODULEBUILDER_TABLES_IMPORT', 'Import Table'); +\define('_AM_MODULEBUILDER_MODULE_IMPORT_INTO', 'Import Table into this module:'); +\define('_AM_MODULEBUILDER_TABLE_ID', 'Select table to import:'); +\define('_AM_MODULEBUILDER_MODULE_NEW_NAME', 'New Name for the generated module:'); +\define('_AM_MODULEBUILDER_GENERATE', 'Import'); +\define('_AM_MODULEBUILDER_ERROR_DATABASE', "Unable to list the databases \n"); +\define('_AM_MODULEBUILDER_ERROR_SQL', 'Error SQL: '); diff --git a/language/update language 1.39 to 3.6.0.txt b/language/update language 1.39 to 3.6.0.txt new file mode 100644 index 00000000..aca8759a --- /dev/null +++ b/language/update language 1.39 to 3.6.0.txt @@ -0,0 +1,146 @@ +// 1.38 +admin.php + +//Buttons +define("_AM_MODULEBUILDER_TABLES_NEW","Add Table"); +define("_AM_MODULEBUILDER_TABLES_LIST","List Tables"); + +define("_AM_MODULEBUILDER_TABLES_CATEGORIES","Add New Categories"); + +define("_AM_MODULEBUILDER_NEW","Add Define Language"); +define("_AM_MODULEBUILDER_LIST","List Defines Languages"); + +//Error NoFrameworks +define("_AM_ERROR_NOFRAMEWORKS","Error: You don't use the Frameworks \"admin module\". Please install this Frameworks"); +//Support +define("_AM_MODULEBUILDER_MAINTAINEDBY", "is maintained by the"); + +define("_AM_MODULEBUILDER_VERSION", "Version"); +define("_AM_MODULEBUILDER_RELEASE", "Date created"); +define("_AM_MODULEBUILDER_STATUS", "Status"); +define("_AM_MODULEBUILDER_SEARCH", "Search"); + +//deleted +define("_AM_MODULEBUILDER_TABLES_CATEGORIES", "Add Category"); + +// New Module +define("_AM_MODULEBUILDER_MODULES_ACTIVE_SUBMENU", "Visible Submenu"); +define("_AM_MODULEBUILDER_MODULES_ACTIVE_NOTIFY", "Active Notifications"); +define("_AM_MODULEBUILDER_NOTINSERTED", "The module is not saved, it is likely that you have used a name that already exists, please change name for a new module"); + +// New Table +define("_AM_MODULEBUILDER_TABLES_DISPLAY_SUMENU", "Use view TAB Submenu"); +define("_AM_MODULEBUILDER_TABLES_IMAGE_DESC", ""); +define("_AM_MODULEBUILDER_TABLES_BLOCKS_DESC", "(blocks: random, latest, today)"); + +// Filemanager.php +// Nav +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_MANAGER','File Manager'); +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_MAIN','File Manager'); + +//Tips +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_TIPS',' +
      +
    • Change file permission, content or just delete an unused file from your XOOPS site.
    • +
    +'); + +// Main +define('_AM_MODULEBUILDER_FILEMANAGER_DIRECTORY','Directory'); +define('_AM_MODULEBUILDER_FILEMANAGER_FILES','Files'); +define('_AM_MODULEBUILDER_FILEMANAGER_GENERATE','Force generation'); +define('_AM_MODULEBUILDER_FILEMANAGER_SELECT_THEME','Select theme'); +define('_AM_MODULEBUILDER_FILEMANAGER_FORCE_GENERATED','Force generated'); +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_FILE_GENERATED','Files generated'); +define('_AM_MODULEBUILDER_FILEMANAGER_NOT_CREATED','No files created'); +define('_AM_MODULEBUILDER_FILEMANAGER_HOME','Home'); +define('_AM_MODULEBUILDER_FILEMANAGER_SAVE','Save'); +define('_AM_MODULEBUILDER_FILEMANAGER_CANCEL','Cancel'); +define('_AM_MODULEBUILDER_FILEMANAGER_RESTORE','Restore'); +define('_AM_MODULEBUILDER_FILEMANAGER_REFRESH','Refresh'); +define('_AM_MODULEBUILDER_FILEMANAGER_UPLOAD','Upload file'); +define('_AM_MODULEBUILDER_FILEMANAGER_UPLOAD_CHOOSE','Select file to upload'); +define('_AM_MODULEBUILDER_FILEMANAGER_ADDDIR','Add Directory'); +define('_AM_MODULEBUILDER_FILEMANAGER_ADDDIR_NAME','Choose name of directory'); +define('_AM_MODULEBUILDER_FILEMANAGER_ADDFILE','Add New File'); +define('_AM_MODULEBUILDER_FILEMANAGER_DELDIR','Delete Directory'); + +define('_AM_MODULEBUILDER_FILEMANAGER_RESTORE_ERROR_FILE_EXISTS','Error: File not exist'); +define('_AM_MODULEBUILDER_FILEMANAGER_RESTORE_ERROR_FILE_DELETE','Error: File not delete'); +define('_AM_MODULEBUILDER_FILEMANAGER_RESTORE_ERROR_FILE_RENAME','Error: File not rename'); +define('_AM_MODULEBUILDER_FILEMANAGER_BACK','Back'); +define('_AM_MODULEBUILDER_FILEMANAGER_DELETE','Delete'); +define('_AM_MODULEBUILDER_FILEMANAGER_ERROR','Error'); +define('_AM_MODULEBUILDER_FILEMANAGER_EDIT','Edit of:'); +define('_AM_MODULEBUILDER_FILEMANAGER_EMPTY_FILE','File empty'); +define('_AM_MODULEBUILDER_FILEMANAGER_DELDIR_NOTOK','Error: delete this directory'); +define('_AM_MODULEBUILDER_FILEMANAGER_DELDIR_OK','Directory successfully deleted'); + +// Message +define('_AM_MODULEBUILDER_FILEMANAGER_UPLOAD_FILE','Files successfully uploaded'); +define('_AM_MODULEBUILDER_FILEMANAGER_EXTRACT_FILE','Files successfully extracted'); +define('_AM_MODULEBUILDER_FILEMANAGER_EXTRACT_ERROR','Files could not be extracted'); +define('_AM_MODULEBUILDER_FILEMANAGER_DELETE_FILE','Files successfully deleted'); +define('_AM_MODULEBUILDER_FILEMANAGER_DIR_SUCCESS','Directory successfully created'); +define('_AM_MODULEBUILDER_FILEMANAGER_DIR_ERROR','Directory could not be created'); +define('_AM_MODULEBUILDER_FILEMANAGER_DIR_RYSDEL','Are you sure to delete this folder?'); +define('_AM_MODULEBUILDER_FILEMANAGER_FILE_SUCCESS','File successfully created'); +define('_AM_MODULEBUILDER_FILEMANAGER_SUREDEL', 'Are you sure to delete this file %s?'); +define('_AM_MODULEBUILDER_FILEMANAGER_DIR_SUREDEL', 'Are you sure you want to delete this directory %s?
    Warning: all subdirectories and files file will be deleted'); + +modinfo.php + +// Main +define("_MI_MODULEBUILDER_NAME", "ModuleBuilder"); +define("_MI_MODULEBUILDER_DESC", "This module does to create others modules."); +// Admin +define("_MI_MODULEBUILDER_ADMIN_NAME","ModuleBuilder"); +define("_MI_MODULEBUILDER_ADMIN_DESC","This module does to create others modules: "); + +//Menu +define("_MI_MODULEBUILDER_ADMENU1","Home"); +define("_MI_MODULEBUILDER_ADMENU2","Modules"); +define("_MI_MODULEBUILDER_ADMENU3","Tables"); +define("_MI_MODULEBUILDER_ADMENU4","Languages"); +define("_MI_MODULEBUILDER_ADMENU5","Build"); +define("_MI_MODULEBUILDER_ADMENU6","File Manager"); +define("_MI_MODULEBUILDER_ADMENU7","About"); + +//Config +define("_MI_MODULEBUILDER_EDITOR","Editor"); +define("_MI_MODULEBUILDER_EDITOR_DESC","Choose an editor from the list"); +define("_MI_MODULEBUILDER_PERPAGEADMIN","Admin per page"); +define("_MI_MODULEBUILDER_PERPAGEADMIN_DESC","Select to view admin per page tables or modules"); +define("_MI_MODULEBUILDER_IDPAYPAL", "Paypal ID"); +define("_MI_MODULEBUILDER_IDPAYPAL_DESC", "Insert here your id paypal for donactions."); + +//1.39 +admin.php +define('_AM_MODULEBUILDER_MODULE_MIN_PHP', "Minimum Php"); +define('_AM_MODULEBUILDER_MODULE_MIN_XOOPS', "Minimum Xoops"); +define('_AM_MODULEBUILDER_MODULE_MIN_ADMIN', "Minimum Admin"); +define('_AM_MODULEBUILDER_MODULE_MIN_MYSQL', "Minimum Database"); + +modinfo.php +//Config +define('_MI_MODULEBUILDER_BREAK_GENERAL', "General preferences"); +define('_MI_MODULEBUILDER_BREAK_REQUIRED', "Module required"); +define('_MI_MODULEBUILDER_BREAK_OPTIONAL', "Module optional"); +define('_MI_MODULEBUILDER_MODULE_MIN_PHP', "Minimum Php"); +define('_MI_MODULEBUILDER_MODULE_MIN_XOOPS', "Minimum Xoops"); +define('_MI_MODULEBUILDER_MODULE_MIN_ADMIN', "Minimum Admin"); +define('_MI_MODULEBUILDER_MODULE_MIN_MYSQL', "Minimum Database"); +define('_MI_MODULEBUILDER_MODULES_ADMINPAGER', "Modules adminpager"); +define('_MI_MODULEBUILDER_TABLES_ADMINPAGER', "Tables adminpager"); + +//3.6.0 + +define('_AM_MODULEBUILDER_MODULES_IMPORT', 'Import Module'); +define('_MI_MODULEBUILDER_ADMIN_MODULES', 'Modules'); +define('_AM_MODULEBUILDER_TABLES_IMPORT', 'Import Table'); +define('_AM_MODULEBUILDER_MODULE_IMPORT_INTO', 'Import Table into this module:'); +define('_AM_MODULEBUILDER_TABLE_ID', 'Select table to import:'); +define('_AM_MODULEBUILDER_MODULE_NEW_NAME', 'New Name for the generated module:'); +define('_AM_MODULEBUILDER_GENERATE', 'Import'); +define('_AM_MODULEBUILDER_ERROR_DATABASE', "Unable to list the databases \n"); +define('_AM_MODULEBUILDER_ERROR_SQL', 'Error SQL: '); From 0d0418af56e4954cee7791c0950adb0bc289dd63 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 18:40:06 -0400 Subject: [PATCH 162/266] fix import added \trigger_error --- admin/import_module.php | 8 ++++---- admin/modules.php | 20 +++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/admin/import_module.php b/admin/import_module.php index 0c51769d..e2f60c97 100644 --- a/admin/import_module.php +++ b/admin/import_module.php @@ -41,10 +41,10 @@ $sql = 'SHOW TABLES'; $result = $GLOBALS['xoopsDB']->queryF($sql); -if (!$result) { - echo '_AM_MODULEBUILDER_ERROR_DATABASE'; - echo '_AM_MODULEBUILDER_ERROR_SQL' . $GLOBALS['xoopsDB']->error(); - exit; +if (!$result instanceof \mysqli_result) { +// echo '_AM_MODULEBUILDER_ERROR_DATABASE'; +// echo '_AM_MODULEBUILDER_ERROR_SQL' . $GLOBALS['xoopsDB']->error(); + \trigger_error($GLOBALS['xoopsDB']->error()); } while (false !== ($row = $GLOBALS['xoopsDB']->fetchRow($result))) { diff --git a/admin/modules.php b/admin/modules.php index d1f7f946..96086d2e 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -44,13 +44,15 @@ */ function importFields($tableName) { - $table = $GLOBALS['xoopsDB']->prefix((string)$tableName); - + $table = $GLOBALS['xoopsDB']->prefix((string)$tableName); $sql = 'SHOW COLUMNS FROM ' . $table; $result = $GLOBALS['xoopsDB']->query($sql); - $tFields = []; + if (!$result instanceof \mysqli_result) { + \trigger_error($GLOBALS['xoopsDB']->error()); + } + $tFields = []; while ($data = $GLOBALS['xoopsDB']->fetchBoth($result)) { $t = []; $t['Field'] = $data['Field']; @@ -84,9 +86,8 @@ function importFields($tableName) } $tFields[$t['Field']] = $t; - - return $tFields; } + return $tFields; } function importModule() @@ -185,7 +186,6 @@ function importTables($moduleId, $moduleName) $newTable->setVar('table_nbfields', $countFields); $currentNumber = 0; - foreach ($importedFields as $t) { $fieldsObj = $fieldsHandler->create(); $fieldsObj->setVar('field_mid', $moduleId); @@ -197,7 +197,6 @@ function importTables($moduleId, $moduleName) $fieldsObj->setVar('field_attribute', $t['Signed'] ?? ''); $fieldsObj->setVar('field_null', $t['Null'] ?? ''); $fieldsObj->setVar('field_default', $t['Default']); - if (isset($t['Key'])) { if ('PRI' === $t['Key']) { $fieldsObj->setVar('field_key', 'primary'); @@ -210,6 +209,7 @@ function importTables($moduleId, $moduleName) $fieldsObj->setVar('field_element', $t['Field']); if ($currentNumber < $countFields - 1) { + // } if (0 == $currentNumber) { @@ -508,6 +508,9 @@ function importTables($moduleId, $moduleName) $resultTables = $GLOBALS['xoopsDB']->query( 'SELECT table_id FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_tables') . " as ts WHERE ts.table_mid = '{$modIdSource}'" ); + if (!$resultTables instanceof \mysqli_result) { + \trigger_error($GLOBALS['xoopsDB']->error()); + } $num_rows1 = $GLOBALS['xoopsDB']->getRowsNum($resultTables); if ($num_rows1 > 0) { while (false !== ($myTables = $GLOBALS['xoopsDB']->fetchArray($resultTables))) { @@ -537,6 +540,9 @@ function importTables($moduleId, $moduleName) $resultFields = $GLOBALS['xoopsDB']->query( 'SELECT field_id FROM ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_fields') . " as fs WHERE fs.field_tid = '{$tableIdSource}'" ); + if (!$resultFields instanceof \mysqli_result) { + \trigger_error($GLOBALS['xoopsDB']->error()); + } $num_rows2 = $GLOBALS['xoopsDB']->getRowsNum($resultFields); if ($num_rows2 > 0) { while (false !== ($myField = $GLOBALS['xoopsDB']->fetchArray($resultFields))) { From 6f15ebbd1b4eb2c3a72367fc12511964ae4231b6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 22:46:12 -0400 Subject: [PATCH 163/266] refactored import functions to a class --- admin/modules.php | 225 +----------------------------------- class/Import.php | 286 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 289 insertions(+), 222 deletions(-) create mode 100644 class/Import.php diff --git a/admin/modules.php b/admin/modules.php index 96086d2e..8ed351a2 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -24,7 +24,8 @@ use Xmf\Request; use XoopsModules\Modulebuilder\{ - Helper + Helper, + Import }; /** @var Helper $helper */ @@ -37,226 +38,6 @@ $op = Request::getString('op', 'list'); $modId = Request::getInt('mod_id'); -/** - * @param $tableName - * - * @return array - */ -function importFields($tableName) -{ - $table = $GLOBALS['xoopsDB']->prefix((string)$tableName); - $sql = 'SHOW COLUMNS FROM ' . $table; - $result = $GLOBALS['xoopsDB']->query($sql); - - if (!$result instanceof \mysqli_result) { - \trigger_error($GLOBALS['xoopsDB']->error()); - } - - $tFields = []; - while ($data = $GLOBALS['xoopsDB']->fetchBoth($result)) { - $t = []; - $t['Field'] = $data['Field']; - $t['Type'] = $data['Type']; - - if ('YES' === $data['Null']) { - $t['Null'] = 'NULL'; - } else { - $t['Null'] = 'NOT NULL'; - } - $t['Key'] = $data['Key']; - $t['Default'] = $data['Default']; - $t['Extra'] = $data['Extra']; - - $t['Label'] = isset($data['Label']) ? $data['Label'] : ''; - - $h = strpos($data['Type'], '('); - $i = strpos($data['Type'], ')'); - if (false === $h) { - $t['Len'] = 0; - } else { - $t['Type'] = 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); - } else { - $t['Len'] = (int)substr($data['Type'], $h + 1, $i - 1 - $h); - } - if (strlen($data['Type']) > $i) { - $t['Signed'] = substr($data['Type'], $i + 2); - } - } - - $tFields[$t['Field']] = $t; - } - return $tFields; -} - -function importModule() -{ - $moduleName = isset($_POST['moduleName']) ? $_POST['moduleName'] : 'newModule'; - $moduleNewName = isset($_POST['moduleNewName']) ? $_POST['moduleNewName'] : $moduleName; - $moduleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower($moduleNewName)); - - $helper = Helper::getInstance(); - $modulesHandler = $helper->getHandler('Modules'); - $newModule = $modulesHandler->create(); - - $newModule->setVar('mod_name', $moduleNewName); - $newModule->setVar('mod_release', date('Y-m-d')); - $newModule->setVar('mod_dirname', $moduleDirname); - - $newModule->setVar('mod_version', $helper->getConfig('version')); //$GLOBALS['xoopsModuleConfig']['version']); - - $newModule->setVar('mod_since', $helper->getConfig('since')); - $newModule->setVar('mod_min_php', $helper->getConfig('min_php')); - $newModule->setVar('mod_min_xoops', $helper->getConfig('min_xoops')); - $newModule->setVar('mod_min_admin', $helper->getConfig('min_admin')); - $newModule->setVar('mod_min_mysql', $helper->getConfig('min_mysql')); - - $newModule->setVar('mod_description', $helper->getConfig('description')); - $newModule->setVar('mod_author', $helper->getConfig('author')); - $newModule->setVar('mod_author_mail', $helper->getConfig('author_email')); - $newModule->setVar('mod_author_website_url', $helper->getConfig('author_website_url')); - $newModule->setVar('mod_author_website_name', $helper->getConfig('author_website_name')); - $newModule->setVar('mod_credits', $helper->getConfig('credits')); - $newModule->setVar('mod_license', $helper->getConfig('license')); - $newModule->setVar('mod_display_admin', $helper->getConfig('display_admin')); - $newModule->setVar('mod_display_user', $helper->getConfig('display_user')); - $newModule->setVar('mod_active_search', $helper->getConfig('active_search')); - $newModule->setVar('mod_active_comments', $helper->getConfig('active_comments')); - $newModule->setVar('mod_release_info', $helper->getConfig('release_info')); - $newModule->setVar('mod_release_file', $helper->getConfig('release_file')); - $newModule->setVar('mod_manual', $helper->getConfig('manual')); - $newModule->setVar('mod_manual_file', $helper->getConfig('manual_file')); - $newModule->setVar('mod_image', 'empty.png'); - $newModule->setVar('mod_demo_site_url', $helper->getConfig('demo_site_url')); - $newModule->setVar('mod_demo_site_name', $helper->getConfig('demo_site_name')); - $newModule->setVar('mod_support_url', $helper->getConfig('support_url')); - $newModule->setVar('mod_support_name', $helper->getConfig('support_name')); - $newModule->setVar('mod_website_url', $helper->getConfig('website_url')); - $newModule->setVar('mod_website_name', $helper->getConfig('website_name')); - $newModule->setVar('mod_status', $helper->getConfig('status')); - - $newModule->setVar('mod_admin', $helper->getConfig('display_admin')); - $newModule->setVar('mod_user', $helper->getConfig('display_user')); - $newModule->setVar('mod_search', $helper->getConfig('active_search')); - $newModule->setVar('mod_comments', $helper->getConfig('active_comments')); - $newModule->setVar('mod_notifications', $helper->getConfig('active_notifications')); - $newModule->setVar('mod_permissions', $helper->getConfig('active_permissions')); - $newModule->setVar('mod_donations', $helper->getConfig('donations')); - $newModule->setVar('mod_subversion', $helper->getConfig('subversion')); - - if ($modulesHandler->insert($newModule)) { - // get the ID of the new module - $criteria = new \Criteria('mod_name', $moduleNewName); - $moduleObject = $modulesHandler->getObjects($criteria, false, true); - $moduleId = $moduleObject[0]->getVar('mod_id'); - importTables($moduleId, $moduleName); - } -} - -/** - * @param $moduleId - * @param $moduleName - */ -function importTables($moduleId, $moduleName) -{ - $helper = Helper::getInstance(); - $tablesHandler = $helper->getHandler('Tables'); - $fieldsHandler = $helper->getHandler('Fields'); - - /** @var \XoopsModuleHandler $moduleHandler */ - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname($moduleName); - $moduleTables = $module->getInfo('tables'); - - if (false !== $moduleTables && is_array($moduleTables)) { - foreach ($moduleTables as $table) { - //create a new tablesholder - $newTable = $tablesHandler->create(); - $newTable->setVar('table_mid', $moduleId); - - $newTable->setVar('table_name', $table); - $newTable->setVar('table_image', 'alert.png'); - - //get all the fields for this table - $importedFields = importFields($table); - - //set the number of fields for this table - $countFields = count($importedFields); - $newTable->setVar('table_nbfields', $countFields); - - $currentNumber = 0; - foreach ($importedFields as $t) { - $fieldsObj = $fieldsHandler->create(); - $fieldsObj->setVar('field_mid', $moduleId); - $fieldsObj->setVar('field_tid', $newTable->getVar('table_id')); - $fieldsObj->setVar('field_order', $currentNumber); - $fieldsObj->setVar('field_name', $t['Field']); - $fieldsObj->setVar('field_type', $t['Type']); - $fieldsObj->setVar('field_value', $t['Len']); - $fieldsObj->setVar('field_attribute', $t['Signed'] ?? ''); - $fieldsObj->setVar('field_null', $t['Null'] ?? ''); - $fieldsObj->setVar('field_default', $t['Default']); - if (isset($t['Key'])) { - if ('PRI' === $t['Key']) { - $fieldsObj->setVar('field_key', 'primary'); - } else { - if ('UNI' === $t['Key']) { - $fieldsObj->setVar('field_key', 'unique'); - } - } - } - $fieldsObj->setVar('field_element', $t['Field']); - - if ($currentNumber < $countFields - 1) { - // - } - - if (0 == $currentNumber) { - 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',])) { - //XoopsFormText - $fieldsObj->setVar('field_element', '2'); - } elseif ('datetime' === $t['Type']) { - //XoopsFormDateTime //XoopsFormDatePicker - $fieldsObj->setVar('field_element', '21'); - } elseif ('date' === $t['Type']) { - //XoopsFormTextDateSelect - $fieldsObj->setVar('field_element', '15'); - } - } else { - if ($currentNumber > 0) { - 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',])) { - //XoopsFormText - $fieldsObj->setVar('field_element', '2'); - } elseif ('datetime' === $t['Type']) { - //XoopsFormDateTime //XoopsFormDatePicker - $fieldsObj->setVar('field_element', '21'); - } elseif ('date' === $t['Type']) { - //XoopsFormTextDateSelect - $fieldsObj->setVar('field_element', '15'); - } - } - } - - ++$currentNumber; - - $fieldsHandler->insert($fieldsObj); - } - - if ($tablesHandler->insert($newTable)) { - echo $table . ' Table has been imported
    '; - //success, redirect - } - } - } -} - switch ($op) { case 'list': default: @@ -312,7 +93,7 @@ function importTables($moduleId, $moduleName) break; case 'modules_import': - importModule(); + Import::importModule(); break; case 'save': diff --git a/class/Import.php b/class/Import.php new file mode 100644 index 00000000..a6bef580 --- /dev/null +++ b/class/Import.php @@ -0,0 +1,286 @@ +getHandler('Modules'); + $newModule = $modulesHandler->create(); + + $newModule->setVar('mod_name', $moduleNewName); + $newModule->setVar('mod_release', date('Y-m-d')); + $newModule->setVar('mod_dirname', $moduleDirname); + + $newModule->setVar('mod_version', $helper->getConfig('version')); //$GLOBALS['xoopsModuleConfig']['version']); + + $newModule->setVar('mod_since', $helper->getConfig('since')); + $newModule->setVar('mod_min_php', $helper->getConfig('min_php')); + $newModule->setVar('mod_min_xoops', $helper->getConfig('min_xoops')); + $newModule->setVar('mod_min_admin', $helper->getConfig('min_admin')); + $newModule->setVar('mod_min_mysql', $helper->getConfig('min_mysql')); + + $newModule->setVar('mod_description', $helper->getConfig('description')); + $newModule->setVar('mod_author', $helper->getConfig('author')); + $newModule->setVar('mod_author_mail', $helper->getConfig('author_email')); + $newModule->setVar('mod_author_website_url', $helper->getConfig('author_website_url')); + $newModule->setVar('mod_author_website_name', $helper->getConfig('author_website_name')); + $newModule->setVar('mod_credits', $helper->getConfig('credits')); + $newModule->setVar('mod_license', $helper->getConfig('license')); + $newModule->setVar('mod_display_admin', $helper->getConfig('display_admin')); + $newModule->setVar('mod_display_user', $helper->getConfig('display_user')); + $newModule->setVar('mod_active_search', $helper->getConfig('active_search')); + $newModule->setVar('mod_active_comments', $helper->getConfig('active_comments')); + $newModule->setVar('mod_release_info', $helper->getConfig('release_info')); + $newModule->setVar('mod_release_file', $helper->getConfig('release_file')); + $newModule->setVar('mod_manual', $helper->getConfig('manual')); + $newModule->setVar('mod_manual_file', $helper->getConfig('manual_file')); + $newModule->setVar('mod_image', 'empty.png'); + $newModule->setVar('mod_demo_site_url', $helper->getConfig('demo_site_url')); + $newModule->setVar('mod_demo_site_name', $helper->getConfig('demo_site_name')); + $newModule->setVar('mod_support_url', $helper->getConfig('support_url')); + $newModule->setVar('mod_support_name', $helper->getConfig('support_name')); + $newModule->setVar('mod_website_url', $helper->getConfig('website_url')); + $newModule->setVar('mod_website_name', $helper->getConfig('website_name')); + $newModule->setVar('mod_status', $helper->getConfig('status')); + + $newModule->setVar('mod_admin', $helper->getConfig('display_admin')); + $newModule->setVar('mod_user', $helper->getConfig('display_user')); + $newModule->setVar('mod_search', $helper->getConfig('active_search')); + $newModule->setVar('mod_comments', $helper->getConfig('active_comments')); + $newModule->setVar('mod_notifications', $helper->getConfig('active_notifications')); + $newModule->setVar('mod_permissions', $helper->getConfig('active_permissions')); + $newModule->setVar('mod_donations', $helper->getConfig('donations')); + $newModule->setVar('mod_subversion', $helper->getConfig('subversion')); + + if ($modulesHandler->insert($newModule)) { + // get the ID of the new module + $criteria = new \Criteria('mod_name', $moduleNewName); + $moduleObject = $modulesHandler->getObjects($criteria, false, true); + $moduleId = $moduleObject[0]->getVar('mod_id'); + self::importTables($moduleId, $moduleName); + } + } + + /** + * @param $moduleId + * @param $moduleName + */ + public static function importTables($moduleId, $moduleName) + { + $helper = Helper::getInstance(); + $tablesHandler = $helper->getHandler('Tables'); + $fieldsHandler = $helper->getHandler('Fields'); + + /** @var \XoopsModuleHandler $moduleHandler */ + $moduleHandler = xoops_getHandler('module'); + $module = $moduleHandler->getByDirname($moduleName); + $moduleTables = $module->getInfo('tables'); + + if (false !== $moduleTables && is_array($moduleTables)) { + $currentTableNumber = 0; + foreach ($moduleTables as $table) { + //create a new tablesholder + $newTable = $tablesHandler->create(); + $newTable->setVar('table_mid', $moduleId); + + $newTable->setVar('table_name', $table); + $newTable->setVar('table_image', 'alert.png'); + + //get all the fields for this table + $importedFields = self::importFields($table); + + //set the number of fields for this table + $countFields = count($importedFields); + $newTable->setVar('table_nbfields', $countFields); + $newTable->setVar('table_order', $currentTableNumber); + $tablesHandler->insert($newTable); + + $currentFieldNumber = 0; + foreach ($importedFields as $t) { + $fieldsObj = $fieldsHandler->create(); + $fieldsObj->setVar('field_mid', $moduleId); + $fieldsObj->setVar('field_tid', $newTable->getVar('table_id')); + $fieldsObj->setVar('field_order', $currentFieldNumber); + $fieldsObj->setVar('field_name', $t['Field']); + + + $type = '1'; + if (isset($t['Type'])) { + $types = [ + 2 => 'INT', + 3 => 'TINYINT', + 4 => 'MEDIUMINT', + 5 => 'SMALLINT', + 6 => 'FLOAT', + 7 => 'DOUBLE', + 8 => 'DECIMAL', + 9 => 'SET', + 10 => 'ENUM', + 11 => 'EMAIL', + 12 => 'URL', + 13 => 'CHAR', + 14 => 'VARCHAR', + 15 => 'TEXT', + 16 => 'TINYTEXT', + 17 => 'MEDIUMTEXT', + 18 => 'LONGTEXT', + 19 => 'DATE', + 20 => 'DATETIME', + 21 => 'TIMESTAMP', + 22 => 'TIME', + 23 => 'YEAR', + ]; + $type = array_search(strtolower($t['Type']), array_map('strtolower', $types)); + } + $fieldsObj->setVar('field_type', $type); + $fieldsObj->setVar('field_value', $t['Len']); + + $attr = '1'; + if (isset($t['Signed'])) { + $attribs = [ + 2 => 'BINARY', + 3 => 'UNSIGNED', + 4 => 'UNSIGNED_ZEROFILL', + 5 => 'SMALLINT', + 6 => 'CURRENT_TIMESTAMP', + ]; + $attr = array_search(strtolower($t['Signed']), array_map('strtolower', $attribs)); + } + $fieldsObj->setVar('field_attribute', $attr); + + // $fieldsObj->setVar('field_null', $t['Null'] ?? ''); + $null = '1'; + if ('NOT NULL' === $t['Null']) { + $null = '2'; + } elseif ('NULL' === $t['Null']) { + $null = '3'; + } + $fieldsObj->setVar('field_null', $null); + $fieldsObj->setVar('field_default', $t['Default']); + + $key = 1; + if (isset($t['Key'])) { + $keys = [ + 2 => 'PRI', + 3 => 'UNI', + 4 => 'KEY', + 5 => 'IND', + 6 => 'FUL', + ]; + $key = array_search(strtolower($t['Key']), array_map('strtolower', $keys)); + } + $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',])) { + // XoopsFormTextArea + $fieldsObj->setVar('field_element', '3'); + } 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']) { + //XoopsFormDateTime //XoopsFormDatePicker + $fieldsObj->setVar('field_element', '21'); + } elseif ('date' === $t['Type']) { + //XoopsFormTextDateSelect + $fieldsObj->setVar('field_element', '15'); + } + } else { + if ($currentFieldNumber > 0) { + 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',])) { + //XoopsFormText + $fieldsObj->setVar('field_element', '2'); + } elseif ('datetime' === $t['Type']) { + //XoopsFormDateTime //XoopsFormDatePicker + $fieldsObj->setVar('field_element', '21'); + } elseif ('date' === $t['Type']) { + //XoopsFormTextDateSelect + $fieldsObj->setVar('field_element', '15'); + } + } + } + + ++$currentFieldNumber; + + $fieldsHandler->insert($fieldsObj); + } + + echo $table . ' Table has been imported
    '; + + ++$currentTableNumber; + } + } + } + + /** + * @param $tableName + * + * @return array + */ + public static function importFields($tableName) + { + $table = $GLOBALS['xoopsDB']->prefix((string)$tableName); + $sql = 'SHOW COLUMNS FROM ' . $table; + $result = $GLOBALS['xoopsDB']->query($sql); + + if (!$result instanceof \mysqli_result) { + \trigger_error($GLOBALS['xoopsDB']->error()); + } + + $tFields = []; + while ($data = $GLOBALS['xoopsDB']->fetchBoth($result)) { + $t = []; + $t['Field'] = $data['Field']; + $t['Type'] = $data['Type']; + + if ('YES' === $data['Null']) { + $t['Null'] = 'NULL'; + } else { + $t['Null'] = 'NOT NULL'; + } + $t['Key'] = $data['Key']; + $t['Default'] = $data['Default']; + $t['Extra'] = $data['Extra']; + + $t['Label'] = isset($data['Label']) ? $data['Label'] : ''; + + $h = strpos($data['Type'], '('); + $i = strpos($data['Type'], ')'); + if (false === $h) { + $t['Len'] = 0; + } else { + $t['Type'] = 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); + } else { + $t['Len'] = (int)substr($data['Type'], $h + 1, $i - 1 - $h); + } + if (strlen($data['Type']) > $i) { + $t['Signed'] = substr($data['Type'], $i + 2); + } + } + + $tFields[$t['Field']] = $t; + } + return $tFields; + } +} From 81eabedff635f2869627ea46d30b2f09bb956d04 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 23:00:28 -0400 Subject: [PATCH 164/266] scrutinizer --- class/Import.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/class/Import.php b/class/Import.php index a6bef580..cf4670db 100644 --- a/class/Import.php +++ b/class/Import.php @@ -2,16 +2,14 @@ namespace XoopsModules\Modulebuilder; -use function GuzzleHttp\Psr7\_caseless_remove; - -use const XoopsModules\Modulebuilder\_caseless_remove as _caseless_removeAlias; +use Xmf\Request; class Import { public static function importModule() { - $moduleName = isset($_POST['moduleName']) ? $_POST['moduleName'] : 'newModule'; - $moduleNewName = isset($_POST['moduleNewName']) ? $_POST['moduleNewName'] : $moduleName; + $moduleName = Request::getString('moduleName', 'newModule', 'POST'); + $moduleNewName = Request::getString('moduleNewName', $moduleName, 'POST'); $moduleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower($moduleNewName)); $helper = Helper::getInstance(); @@ -201,8 +199,7 @@ public static function importTables($moduleId, $moduleName) //XoopsFormTextDateSelect $fieldsObj->setVar('field_element', '15'); } - } else { - if ($currentFieldNumber > 0) { + } elseif ($currentFieldNumber > 0) { if (in_array($t['Type'], ['blob', 'text', 'mediumblob', 'mediumtext', 'longblob', 'longtext', 'enum', 'set',])) { //XoopsFormTextArea $fieldsObj->setVar('field_element', '3'); @@ -216,7 +213,6 @@ public static function importTables($moduleId, $moduleName) //XoopsFormTextDateSelect $fieldsObj->setVar('field_element', '15'); } - } } ++$currentFieldNumber; From 30829583d5c57a34eae45b7609313f8f494373bd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Nov 2021 23:00:49 -0400 Subject: [PATCH 165/266] coalesce --- class/Import.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Import.php b/class/Import.php index cf4670db..a6d487af 100644 --- a/class/Import.php +++ b/class/Import.php @@ -257,7 +257,7 @@ public static function importFields($tableName) $t['Default'] = $data['Default']; $t['Extra'] = $data['Extra']; - $t['Label'] = isset($data['Label']) ? $data['Label'] : ''; + $t['Label'] = $data['Label'] ?? ''; $h = strpos($data['Type'], '('); $i = strpos($data['Type'], ')'); From 77ac96631fa479012d05502e5cc8e7fb312fa82e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 5 Nov 2021 01:04:38 -0400 Subject: [PATCH 166/266] PhpDoc --- class/Import.php | 3 +++ docs/changelog.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/class/Import.php b/class/Import.php index a6d487af..f54a0851 100644 --- a/class/Import.php +++ b/class/Import.php @@ -4,6 +4,9 @@ use Xmf\Request; +/** + * class Import + */ class Import { public static function importModule() diff --git a/docs/changelog.txt b/docs/changelog.txt index 5ea5797c..b6698fc2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,6 +1,7 @@
    3.6.0 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - added import of existing modules (for their redesign) (mamba) - increased size of the "mod_version" field in modulebuilder_modules table from 4 to 10 (mamba) +- refactored import to a class (mamba)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From 5a7afdc42e0649aa5c96ca33b836b28cf6a44afd Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 6 Nov 2021 10:17:22 +0100 Subject: [PATCH 167/266] usage of templates and adding results --- admin/devtools.php | 2 +- admin/import_module.php | 5 +- admin/modules.php | 10 +- class/Devtools.php | 2 +- class/Import.php | 122 +++++++++++++--------- language/english/admin.php | 3 + language/english/common.php | 4 +- templates/admin/modulebuilder_modules.tpl | 7 ++ 8 files changed, 99 insertions(+), 56 deletions(-) diff --git a/admin/devtools.php b/admin/devtools.php index 9cb1c1bd..8f4ac5fa 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -18,7 +18,7 @@ * * @since 2.5.5 * - * @author Txmod Xoops + * @author Goffy https://myxoops.org * */ diff --git a/admin/import_module.php b/admin/import_module.php index e2f60c97..ca10b431 100644 --- a/admin/import_module.php +++ b/admin/import_module.php @@ -16,6 +16,9 @@ * @author Mamba */ +// Define main template +$templateMain = 'modulebuilder_modules.tpl'; + require __DIR__ . '/header.php'; //xoops_cp_header(); $adminObject = \Xmf\Module\Admin::getInstance(); @@ -69,6 +72,6 @@ $formImportModule->addElement($buttonTray); -$formImportModule->display(); +$GLOBALS['xoopsTpl']->assign('form', $formImportModule->render()); require __DIR__ . '/footer.php'; diff --git a/admin/modules.php b/admin/modules.php index 8ed351a2..e7111728 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -93,7 +93,15 @@ break; case 'modules_import': - Import::importModule(); + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); + $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list'); + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); + $result = Import::importModule(); + if (false === $result['result']) { + $GLOBALS['xoopsTpl']->assign('error', $result['error']); + } else { + $GLOBALS['xoopsTpl']->assign('tables_list', $result['tables']); + } break; case 'save': diff --git a/class/Devtools.php b/class/Devtools.php index 73b838ae..e69452a2 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -21,7 +21,7 @@ * @package \module\modulebuilder\class * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2001-2017 © XOOPS Project - * @author ZySpec + * @author Goffy https://myxoops.org * @author Mamba * @since */ diff --git a/class/Import.php b/class/Import.php index f54a0851..98cf520c 100644 --- a/class/Import.php +++ b/class/Import.php @@ -11,66 +11,83 @@ class Import { public static function importModule() { + $ret = []; $moduleName = Request::getString('moduleName', 'newModule', 'POST'); $moduleNewName = Request::getString('moduleNewName', $moduleName, 'POST'); $moduleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower($moduleNewName)); + if ('' === $moduleDirname) { + $ret['result'] = false; + $ret['error'] = \_AM_MODULEBUILDER_ERROR_MNAME; + return $ret; + } $helper = Helper::getInstance(); $modulesHandler = $helper->getHandler('Modules'); - $newModule = $modulesHandler->create(); - - $newModule->setVar('mod_name', $moduleNewName); - $newModule->setVar('mod_release', date('Y-m-d')); - $newModule->setVar('mod_dirname', $moduleDirname); - - $newModule->setVar('mod_version', $helper->getConfig('version')); //$GLOBALS['xoopsModuleConfig']['version']); - - $newModule->setVar('mod_since', $helper->getConfig('since')); - $newModule->setVar('mod_min_php', $helper->getConfig('min_php')); - $newModule->setVar('mod_min_xoops', $helper->getConfig('min_xoops')); - $newModule->setVar('mod_min_admin', $helper->getConfig('min_admin')); - $newModule->setVar('mod_min_mysql', $helper->getConfig('min_mysql')); - - $newModule->setVar('mod_description', $helper->getConfig('description')); - $newModule->setVar('mod_author', $helper->getConfig('author')); - $newModule->setVar('mod_author_mail', $helper->getConfig('author_email')); - $newModule->setVar('mod_author_website_url', $helper->getConfig('author_website_url')); - $newModule->setVar('mod_author_website_name', $helper->getConfig('author_website_name')); - $newModule->setVar('mod_credits', $helper->getConfig('credits')); - $newModule->setVar('mod_license', $helper->getConfig('license')); - $newModule->setVar('mod_display_admin', $helper->getConfig('display_admin')); - $newModule->setVar('mod_display_user', $helper->getConfig('display_user')); - $newModule->setVar('mod_active_search', $helper->getConfig('active_search')); - $newModule->setVar('mod_active_comments', $helper->getConfig('active_comments')); - $newModule->setVar('mod_release_info', $helper->getConfig('release_info')); - $newModule->setVar('mod_release_file', $helper->getConfig('release_file')); - $newModule->setVar('mod_manual', $helper->getConfig('manual')); - $newModule->setVar('mod_manual_file', $helper->getConfig('manual_file')); - $newModule->setVar('mod_image', 'empty.png'); - $newModule->setVar('mod_demo_site_url', $helper->getConfig('demo_site_url')); - $newModule->setVar('mod_demo_site_name', $helper->getConfig('demo_site_name')); - $newModule->setVar('mod_support_url', $helper->getConfig('support_url')); - $newModule->setVar('mod_support_name', $helper->getConfig('support_name')); - $newModule->setVar('mod_website_url', $helper->getConfig('website_url')); - $newModule->setVar('mod_website_name', $helper->getConfig('website_name')); - $newModule->setVar('mod_status', $helper->getConfig('status')); - - $newModule->setVar('mod_admin', $helper->getConfig('display_admin')); - $newModule->setVar('mod_user', $helper->getConfig('display_user')); - $newModule->setVar('mod_search', $helper->getConfig('active_search')); - $newModule->setVar('mod_comments', $helper->getConfig('active_comments')); - $newModule->setVar('mod_notifications', $helper->getConfig('active_notifications')); - $newModule->setVar('mod_permissions', $helper->getConfig('active_permissions')); - $newModule->setVar('mod_donations', $helper->getConfig('donations')); - $newModule->setVar('mod_subversion', $helper->getConfig('subversion')); - - if ($modulesHandler->insert($newModule)) { + $newModuleObj = $modulesHandler->create(); + + $newModuleObj->setVar('mod_name', $moduleNewName); + $newModuleObj->setVar('mod_release', date('Y-m-d')); + $newModuleObj->setVar('mod_dirname', $moduleDirname); + + $newModuleObj->setVar('mod_version', $helper->getConfig('version')); //$GLOBALS['xoopsModuleConfig']['version']); + + $newModuleObj->setVar('mod_since', $helper->getConfig('since')); + $newModuleObj->setVar('mod_min_php', $helper->getConfig('min_php')); + $newModuleObj->setVar('mod_min_xoops', $helper->getConfig('min_xoops')); + $newModuleObj->setVar('mod_min_admin', $helper->getConfig('min_admin')); + $newModuleObj->setVar('mod_min_mysql', $helper->getConfig('min_mysql')); + + $newModuleObj->setVar('mod_description', $helper->getConfig('description')); + $newModuleObj->setVar('mod_author', $helper->getConfig('author')); + $newModuleObj->setVar('mod_author_mail', $helper->getConfig('author_email')); + $newModuleObj->setVar('mod_author_website_url', $helper->getConfig('author_website_url')); + $newModuleObj->setVar('mod_author_website_name', $helper->getConfig('author_website_name')); + $newModuleObj->setVar('mod_credits', $helper->getConfig('credits')); + $newModuleObj->setVar('mod_license', $helper->getConfig('license')); + $newModuleObj->setVar('mod_display_admin', $helper->getConfig('display_admin')); + $newModuleObj->setVar('mod_display_user', $helper->getConfig('display_user')); + $newModuleObj->setVar('mod_active_search', $helper->getConfig('active_search')); + $newModuleObj->setVar('mod_active_comments', $helper->getConfig('active_comments')); + $newModuleObj->setVar('mod_release_info', $helper->getConfig('release_info')); + $newModuleObj->setVar('mod_release_file', $helper->getConfig('release_file')); + $newModuleObj->setVar('mod_manual', $helper->getConfig('manual')); + $newModuleObj->setVar('mod_manual_file', $helper->getConfig('manual_file')); + $newModuleObj->setVar('mod_image', 'empty.png'); + $newModuleObj->setVar('mod_demo_site_url', $helper->getConfig('demo_site_url')); + $newModuleObj->setVar('mod_demo_site_name', $helper->getConfig('demo_site_name')); + $newModuleObj->setVar('mod_support_url', $helper->getConfig('support_url')); + $newModuleObj->setVar('mod_support_name', $helper->getConfig('support_name')); + $newModuleObj->setVar('mod_website_url', $helper->getConfig('website_url')); + $newModuleObj->setVar('mod_website_name', $helper->getConfig('website_name')); + $newModuleObj->setVar('mod_status', $helper->getConfig('status')); + + $newModuleObj->setVar('mod_admin', $helper->getConfig('display_admin')); + $newModuleObj->setVar('mod_user', $helper->getConfig('display_user')); + $newModuleObj->setVar('mod_search', $helper->getConfig('active_search')); + $newModuleObj->setVar('mod_comments', $helper->getConfig('active_comments')); + $newModuleObj->setVar('mod_notifications', $helper->getConfig('active_notifications')); + $newModuleObj->setVar('mod_permissions', $helper->getConfig('active_permissions')); + $newModuleObj->setVar('mod_donations', $helper->getConfig('donations')); + $newModuleObj->setVar('mod_subversion', $helper->getConfig('subversion')); + + if ($modulesHandler->insert($newModuleObj)) { // get the ID of the new module $criteria = new \Criteria('mod_name', $moduleNewName); $moduleObject = $modulesHandler->getObjects($criteria, false, true); $moduleId = $moduleObject[0]->getVar('mod_id'); - self::importTables($moduleId, $moduleName); + $tables = self::importTables($moduleId, $moduleName); + if (false === $tables ) { + $ret['result'] = false; + $ret['error'] = \_AM_MODULEBUILDER_ERROR_IMPTABLES; + } else { + $ret['result'] = true; + $ret['tables'] = $tables; + } + } else { + $ret['result'] = false; + $ret['error'] = \_AM_MODULEBUILDER_ERROR_MCREATE . $GLOBALS['xoopsDB']->error(); } + return $ret; } /** @@ -88,6 +105,8 @@ public static function importTables($moduleId, $moduleName) $module = $moduleHandler->getByDirname($moduleName); $moduleTables = $module->getInfo('tables'); + $tables = []; + if (false !== $moduleTables && is_array($moduleTables)) { $currentTableNumber = 0; foreach ($moduleTables as $table) { @@ -223,11 +242,14 @@ public static function importTables($moduleId, $moduleName) $fieldsHandler->insert($fieldsObj); } - echo $table . ' Table has been imported
    '; + $tables[] = \_AM_MODULEBUILDER_SUCCESS_IMPTABLES . $table; ++$currentTableNumber; } + } else { + return false; } + return $tables; } /** diff --git a/language/english/admin.php b/language/english/admin.php index 3e6aa4b7..a3dea796 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -473,3 +473,6 @@ \define('_AM_MODULEBUILDER_GENERATE', 'Import'); \define('_AM_MODULEBUILDER_ERROR_DATABASE', "Unable to list the databases \n"); \define('_AM_MODULEBUILDER_ERROR_SQL', 'Error SQL: '); +\define('_AM_MODULEBUILDER_ERROR_MNAME', 'Error: no valid new module name'); +\define('_AM_MODULEBUILDER_ERROR_IMPTABLES', 'Error: import tables failed'); +\define('_AM_MODULEBUILDER_SUCCESS_IMPTABLES', 'Table has been imported: '); diff --git a/language/english/common.php b/language/english/common.php index 9b76bc82..69c0924e 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -83,8 +83,8 @@ \define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); \define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); \define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); -\define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); -\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons'); \define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); //letter choice diff --git a/templates/admin/modulebuilder_modules.tpl b/templates/admin/modulebuilder_modules.tpl index e777d53c..6abca4f2 100644 --- a/templates/admin/modulebuilder_modules.tpl +++ b/templates/admin/modulebuilder_modules.tpl @@ -99,10 +99,17 @@
    <{$form}>
    <{/if}> <{/if}> + <{if $error|default:''}>
    <{$error}>
    <{/if}> + +<{if $tables_list|default:''}> + <{foreach item=table from=$tables_list}> +

    <{$table}>

    + <{/foreach}> +<{/if}> <{includeq file="db:modulebuilder_footer.tpl"}> From 970cbd8e6cf7b919fb551fb4b3a59a91fc39163d Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 6 Nov 2021 10:38:02 +0100 Subject: [PATCH 168/266] fixed bug in class handler creation --- class/Files/Classes/ClassFiles.php | 2 +- docs/changelog.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 0d4249e5..889eed8a 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -539,7 +539,7 @@ private function getToArrayInObject($table) $getToArray = $this->pc->getPhpCodeArray('ret', [], false, "\t\t"); $getToArray .= $this->xc->getXcEqualsOperator('$vars', '$this->getVars()', null, "\t\t"); - $foreach = $this->xc->getXcGetVar('ret[$var]', 'this', '"{$var}"', false, "\t\t\t"); + $foreach = $this->xc->getXcEqualsOperator('$ret[$var]', '$this->getVar($var)', null, "\t\t\t"); $getToArray .= $this->pc->getPhpCodeForeach('vars', true, false, 'var', $foreach, "\t\t"); $getToArray .= $this->getSimpleString('return $ret;', "\t\t"); diff --git a/docs/changelog.txt b/docs/changelog.txt index b6698fc2..cddf4f04 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,9 @@ - added import of existing modules (for their redesign) (mamba) - increased size of the "mod_version" field in modulebuilder_modules table from 4 to 10 (mamba) - refactored import to a class (mamba) +- template usage (goffy) +- add result handling (goffy) +- fixed bug in class handler creation (jjdai/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From 8aef07fa76cafdb55086d1a5dfcc4cf506366e5e Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 6 Nov 2021 18:07:14 +0100 Subject: [PATCH 169/266] increasing field size --- docs/changelog.txt | 1 + include/update.php | 20 ++++++++++++++++++++ sql/mysql.sql | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index cddf4f04..0b8ad5f7 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -5,6 +5,7 @@ - template usage (goffy) - add result handling (goffy) - fixed bug in class handler creation (jjdai/goffy) +- increasing field size (mamba/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/include/update.php b/include/update.php index 841f5849..27964708 100644 --- a/include/update.php +++ b/include/update.php @@ -706,6 +706,26 @@ function modulebuilder_check_db($module) } } + // update table 'modulebuilder_settings' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_settings'); + $field = 'set_version'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); + $module->setErrors("Error when changing '$field' in table '$table'."); + $ret = false; + } + + // update table 'modulebuilder_modules' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); + $field = 'mod_version'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); + $module->setErrors("Error when changing '$field' in table '$table'."); + $ret = false; + } + return $ret; } diff --git a/sql/mysql.sql b/sql/mysql.sql index 3dfb5e4f..2b876244 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -15,7 +15,7 @@ CREATE TABLE `modulebuilder_settings` ( `set_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, `set_name` VARCHAR(255) NOT NULL DEFAULT 'My Module', `set_dirname` VARCHAR(100) NOT NULL DEFAULT 'mymoduledirname', - `set_version` VARCHAR(5) NOT NULL DEFAULT '1.0', + `set_version` VARCHAR(10) NOT NULL DEFAULT '1.0', `set_since` VARCHAR(5) NOT NULL DEFAULT '1.0', `set_min_php` VARCHAR(5) NOT NULL DEFAULT '7.0', `set_min_xoops` VARCHAR(8) NOT NULL DEFAULT '2.5.10', From 3fde9ee6e8203713971bbd456d5ca752551cf2d7 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 13:36:02 -0500 Subject: [PATCH 170/266] missing _AM_MODULEBUILDER_ERROR_MCREATE --- language/english/admin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/language/english/admin.php b/language/english/admin.php index a3dea796..b54c6f03 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -476,3 +476,5 @@ \define('_AM_MODULEBUILDER_ERROR_MNAME', 'Error: no valid new module name'); \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'); + From 8687dca8be828d074bc75545d9d67758cd08833c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 14:35:53 -0500 Subject: [PATCH 171/266] Unnecessary pass-by-ref --- include/update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/update.php b/include/update.php index 27964708..4fd6c8b9 100644 --- a/include/update.php +++ b/include/update.php @@ -66,7 +66,7 @@ function xoops_module_update_modulebuilder(&$module, $prev_version = null) * * @return bool */ -function update_modulebuilder_v191(&$module) +function update_modulebuilder_v191($module) { global $xoopsDB; $result = $xoopsDB->query( From 2144ebf2703e3710c928f80daeb7596216e2efbf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 14:37:13 -0500 Subject: [PATCH 172/266] Missing visibility --- class/Constants.php | 61 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/class/Constants.php b/class/Constants.php index 3d5f895d..ca00f489 100644 --- a/class/Constants.php +++ b/class/Constants.php @@ -29,39 +29,38 @@ interface Constants { // Constants for morefiles - const MORE_FILES_TYPE_EMPTY = 1; - const MORE_FILES_TYPE_COPY = 2; - - const FIRST_FIELDELEMENT_TABLE = 30; + public const MORE_FILES_TYPE_EMPTY = 1; + public const MORE_FILES_TYPE_COPY = 2; + public const FIRST_FIELDELEMENT_TABLE = 30; // ------------------- 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; + 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; } From 1fef16f252773fe0d46ca597e6b10d3cfee7076e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 14:37:53 -0500 Subject: [PATCH 173/266] Case mismatch in method call or class usage --- class/Files/CheckData.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Files/CheckData.php b/class/Files/CheckData.php index 2199ff8a..dbccea9c 100644 --- a/class/Files/CheckData.php +++ b/class/Files/CheckData.php @@ -100,7 +100,7 @@ public function getCheckPreBuilding($module) $this->getCheckUserpage(); $this->getCheckRating(); $this->getCheckReads(); - $this->getCheckSQL(); + $this->getCheckSql(); return $this->infos; } From 39655930c875449b9318ea9a4708426cf99d2fd1 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 14:38:34 -0500 Subject: [PATCH 174/266] 'isset' can be replaced with coalesce --- admin/devtools.php | 2 +- class/Fieldelements.php | 2 +- class/Fields.php | 2 +- class/Modules.php | 2 +- class/Morefiles.php | 2 +- class/Settings.php | 2 +- class/Tables.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/admin/devtools.php b/admin/devtools.php index 8f4ac5fa..e7bc3237 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -187,7 +187,7 @@ function getUserDefinedConstants() { $constants = get_defined_constants(true); - return (isset($constants['user']) ? $constants['user'] : []); + return ($constants['user'] ?? []); } require __DIR__ . '/footer.php'; diff --git a/class/Fieldelements.php b/class/Fieldelements.php index e55bc2e1..ff36c14a 100644 --- a/class/Fieldelements.php +++ b/class/Fieldelements.php @@ -54,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/Fields.php b/class/Fields.php index 728d0719..4bc0c4b5 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -75,7 +75,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/Modules.php b/class/Modules.php index d21ab979..46fd1e2c 100644 --- a/class/Modules.php +++ b/class/Modules.php @@ -104,7 +104,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/Morefiles.php b/class/Morefiles.php index f43ad5be..835b621f 100644 --- a/class/Morefiles.php +++ b/class/Morefiles.php @@ -67,7 +67,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/Settings.php b/class/Settings.php index 87dde86b..c8ffa8a5 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -108,7 +108,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/Tables.php b/class/Tables.php index 447e3be9..77476d9c 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -103,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); } From c7e0e447c87a39b274b865a08d4fed11d60c9655 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 14:39:36 -0500 Subject: [PATCH 175/266] Unnecessary double quotes --- class/Devtools.php | 2 +- class/Files/Admin/AdminIndex.php | 2 +- class/Files/Admin/AdminMenu.php | 2 +- class/Files/Admin/AdminPermissions.php | 2 +- class/Files/Blocks/BlocksFiles.php | 6 +- class/Files/Classes/ClassSpecialFiles.php | 34 +++++----- class/Files/Config/ConfigConfig.php | 18 +++--- class/Files/CreateFile.php | 2 +- class/Files/CreatePhpCode.php | 4 +- class/Files/CreateSmartyCode.php | 8 +-- class/Files/CreateXoopsCode.php | 2 +- .../Includes/IncludeCommentFunctions.php | 2 +- class/Files/Includes/IncludeFunctions.php | 2 +- class/Files/Includes/IncludeSearch.php | 2 +- class/Files/Language/LanguageModinfo.php | 2 +- .../Blocks/Defstyle/TemplatesBlocks.php | 4 +- class/Files/Templates/User/Defstyle/Pages.php | 2 +- class/Files/User/UserPages.php | 12 ++-- class/Files/User/UserXoopsCode.php | 8 +-- class/Files/User/UserXoopsVersion.php | 6 +- class/Files/admin/AdminPages.php | 2 +- language/english/admin.php | 64 +++++++++---------- xoops_version.php | 2 +- 23 files changed, 95 insertions(+), 95 deletions(-) diff --git a/class/Devtools.php b/class/Devtools.php index e69452a2..e83c3e95 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -311,7 +311,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/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index 0471e333..e5bce7ae 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -154,7 +154,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..be451212 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -87,7 +87,7 @@ private function getAdminMenuArray($param = [], $adminObject = false) 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 5586feba..a886f8d0 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -246,7 +246,7 @@ private function getPermissionsBody($module, $language) $ret .= $this->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/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 8e9a392d..4ea4f4bc 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -168,7 +168,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case2[] = $critStatus; } $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"); @@ -248,7 +248,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; } @@ -300,7 +300,7 @@ 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, '', false, ""); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, '', false, ''); return $ret; diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 53d24dea..a9c2f05d 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -135,7 +135,7 @@ public function getGlobalPerms($permId) $module = $this->getModule(); $moduleDirname = $module->getVar('mod_dirname'); - $returnTrue = $this->getSimpleString("return true;", "\t\t\t"); + $returnTrue = $this->getSimpleString('return true;', "\t\t\t"); $right = ''; $cond = ''; $funcname = ''; @@ -181,7 +181,7 @@ public function getGlobalPerms($permId) $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"); + $globalContent .= $this->getSimpleString('return false;', "\t\t"); $functions .= $this->pc->getPhpCodeFunction($funcname, '', $globalContent, 'public ', false, "\t"); return $functions; @@ -244,33 +244,33 @@ public function renderConstantsInterface() 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'); + $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->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->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(); diff --git a/class/Files/Config/ConfigConfig.php b/class/Files/Config/ConfigConfig.php index 9b5ba9a3..8a02b55c 100644 --- a/class/Files/Config/ConfigConfig.php +++ b/class/Files/Config/ConfigConfig.php @@ -102,7 +102,7 @@ private function getConfigCode() $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('],', "\t"); $ret .= $this->getSimpleString("'uploadFolders' => [", "\t"); $ret .= $this->getSimpleString("\XOOPS_UPLOAD_PATH . '/' . \$moduleDirName,", "\t\t"); foreach (\array_keys($tables) as $t) { @@ -120,29 +120,29 @@ private function getConfigCode() $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('],', "\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('],', "\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('],', "\t"); $ret .= $this->getSimpleString("'templateFolders' => [", "\t"); $ret .= $this->getSimpleString("'/templates/',", "\t\t"); - $ret .= $this->getSimpleString("],", "\t"); + $ret .= $this->getSimpleString('],', "\t"); $ret .= $this->getSimpleString("'oldFiles' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); + $ret .= $this->getSimpleString('],', "\t"); $ret .= $this->getSimpleString("'oldFolders' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); + $ret .= $this->getSimpleString('],', "\t"); $ret .= $this->getSimpleString("'renameTables' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); + $ret .= $this->getSimpleString('],', "\t"); $ret .= $this->getSimpleString("'moduleStats' => [", "\t"); - $ret .= $this->getSimpleString("],", "\t"); + $ret .= $this->getSimpleString('],', "\t"); $ret .= $this->getSimpleString("'modCopyright' => \"XOOPS Project\",", "\t"); $ret .= $this->getSimpleString('];'); diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 32d7d3f9..29ab6bbb 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -488,7 +488,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 = "{$n}"; } @@ -258,7 +258,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 +266,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 { diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 7671ef2e..283307d6 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1271,7 +1271,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 !== '') { diff --git a/class/Files/Includes/IncludeCommentFunctions.php b/class/Files/Includes/IncludeCommentFunctions.php index 7928515d..b287b859 100644 --- a/class/Files/Includes/IncludeCommentFunctions.php +++ b/class/Files/Includes/IncludeCommentFunctions.php @@ -127,7 +127,7 @@ public function getCommentBody($module, $table) $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(); diff --git a/class/Files/Includes/IncludeFunctions.php b/class/Files/Includes/IncludeFunctions.php index 07746a1e..262cb931 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -114,7 +114,7 @@ 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->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); diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index c54b1424..95edc412 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -99,7 +99,7 @@ public function getSearchFunction($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->getXcEqualsOperator('$ret', '[]', '', $t); $func .= $this->xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", $t); if (\is_array($tables)) { diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 08512ecb..4f052285 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -429,7 +429,7 @@ private function getLanguageNotificationsTable($language, $tableName, $tableSole '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 . '_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}", diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 9786cceb..a4dcb6ab 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -188,7 +188,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi $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 +197,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/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index 8d5f33d3..c72da3ba 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -154,7 +154,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/User/UserPages.php b/class/Files/User/UserPages.php index be5234bb..f7354e32 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -131,9 +131,9 @@ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $table $ret .= $this->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; @@ -211,21 +211,21 @@ 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', 'Handler'); $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"); } @@ -449,7 +449,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/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index f101a80c..5bc56e47 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -198,7 +198,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,7 +207,7 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ $ret .= "['{$name}'][{$index}][{$num}] = "; } if ($isArray) { - $ret .= "["; + $ret .= '['; } $ret .= $n; //search for longest key @@ -232,7 +232,7 @@ 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) { diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 0716534f..974f1619 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -268,7 +268,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 +376,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; } @@ -702,7 +702,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'); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 06ba25f2..fc4b7ad1 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -225,7 +225,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); diff --git a/language/english/admin.php b/language/english/admin.php index b54c6f03..909a7452 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -63,7 +63,7 @@ \define('_AM_MODULEBUILDER_FORMADD', 'Add'); \define( '_AM_MODULEBUILDER_OPTIONS_DESC', - "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'); @@ -329,7 +329,7 @@ // 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_TEST', 'Save and restore test data of selected module'); @@ -358,7 +358,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,35 +394,35 @@ \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_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'); // // ------------------- Misc --------------------------------- // \define('_AM_MODULEBUILDER_THEREARE_DATABASE1', "There are %s"); diff --git a/xoops_version.php b/xoops_version.php index 3f8f05fc..48e1a448 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -43,7 +43,7 @@ $modversion['release_file'] = 'https://github.com/txmodxoops/modulebuilder-1.91/releases'; $modversion['manual'] = 'MANUAL'; $modversion['manual_file'] = XOOPS_URL . "/modules/{$moduleDirName}/docs/manual.txt"; -$modversion['image'] = "assets/images/logoModule.png"; +$modversion['image'] = 'assets/images/logoModule.png'; $modversion['dirname'] = $moduleDirName; // Frameworks icons $modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin'; From f630a67cbb7e8079d0c397cf8b65e4188ac04486 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 7 Nov 2021 14:42:35 -0500 Subject: [PATCH 176/266] Static method called as dynamic --- class/Common/TableChecker.php | 4 ++-- files/commonfiles/class/Common/TableChecker.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index 7b00512c..20a08517 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -120,11 +120,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'; diff --git a/files/commonfiles/class/Common/TableChecker.php b/files/commonfiles/class/Common/TableChecker.php index 7b00512c..20a08517 100644 --- a/files/commonfiles/class/Common/TableChecker.php +++ b/files/commonfiles/class/Common/TableChecker.php @@ -120,11 +120,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'; From e90b0cdb7c343c74468f63479e85749e2c97063d Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sun, 14 Nov 2021 12:02:52 +0100 Subject: [PATCH 177/266] fixed bug in class utility --- docs/changelog.txt | 1 + files/commonfiles/class/Utility.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 0b8ad5f7..20fe5b1d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -6,6 +6,7 @@ - add result handling (goffy) - fixed bug in class handler creation (jjdai/goffy) - increasing field size (mamba/goffy) +- fixed bug in class utility (jjdai/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/files/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php index ffd79cbb..e0b76809 100644 --- a/files/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -173,9 +173,9 @@ public static function getEditor($helper = null, $options = null) if (\class_exists('XoopsFormEditor')) { if ($isAdmin) { - $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editor_admin'), $options, $nohtml = false, $onfailure = 'textarea'); } else { - $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editor_user'), $options, $nohtml = false, $onfailure = 'textarea'); } } else { $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); From f36214a930443a07fb04f6578423c74809660d85 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Fri, 19 Nov 2021 13:11:21 +0100 Subject: [PATCH 178/266] removed empty items from autor info --- class/Files/Admin/AdminHeader.php | 1 + class/Files/Admin/AdminIndex.php | 3 +-- class/Files/CreateFile.php | 21 ++++++++++++++------- class/Files/admin/AdminAbout.php | 1 + class/Files/admin/AdminFooter.php | 1 + docs/changelog.txt | 1 + 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/class/Files/Admin/AdminHeader.php b/class/Files/Admin/AdminHeader.php index 8f3b4a91..00f5f508 100644 --- a/class/Files/Admin/AdminHeader.php +++ b/class/Files/Admin/AdminHeader.php @@ -160,6 +160,7 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); + $content .= $this->getSimpleString(''); $content .= $this->getAdminHeader($moduleDirname); $this->create($moduleDirname, 'admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index 0471e333..00f909a1 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -101,8 +101,7 @@ private function getAdminIndex($module) $language = $this->getLanguage($moduleDirname, 'AM'); $languageThereAre = $this->getLanguage($moduleDirname, 'AM', 'THEREARE_'); - $ret = $this->getSimpleString(''); - $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); + $ret = $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); $ret .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'preloads/autoloader', true); $ret .= $this->getRequire(); $ret .= $this->pc->getPhpCodeBlankLine(); diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 32d7d3f9..d88c8164 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -506,14 +506,21 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = $copyright = [ $name => 'module for xoops', '' => '', - '@copyright ' => ' 2021 XOOPS Project (https://xoops.org)', - '@license ' => " {$license}", - '@package ' => " {$dirname}", - '@since ' => " {$since}", - '@min_xoops ' => " {$minXoops}", - '@author ' => " {$author} - Email:<{$authorMail}> - Website:<{$authorWebsiteUrl}>", - // '@version ' => " \$Id: {$version} {$fileName} {$subversion} {$date}Z {$credits} \$", + '@copyright ' => '2021 XOOPS Project (https://xoops.org)', + '@license ' => $license, + '@package ' => $dirname, + '@since ' => $since, + '@min_xoops ' => $minXoops, ]; + $authorLine = $author; + if ('' !== $authorMail) { + $authorLine .= ' - Email:' . $authorMail; + } + if ('' !== $authorWebsiteUrl) { + $authorLine .= ' - Website:' . $authorWebsiteUrl; + } + $copyright['@author '] = $authorLine; + $ret .= $pc->getPhpCodeCommentMultiLine($copyright); return $ret; diff --git a/class/Files/admin/AdminAbout.php b/class/Files/admin/AdminAbout.php index cc9a8dca..8c60b497 100644 --- a/class/Files/admin/AdminAbout.php +++ b/class/Files/admin/AdminAbout.php @@ -90,6 +90,7 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $moduleDonations = $module->getVar('mod_donations'); $content = $this->getHeaderFilesComments($module); + $content .= $this->getSimpleString(''); $content .= $this->getRequire(); $content .= $this->axc->getAdminTemplateMain($moduleDirname, 'about'); $content .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('about.php')"); diff --git a/class/Files/admin/AdminFooter.php b/class/Files/admin/AdminFooter.php index e98915d9..b8d99f49 100644 --- a/class/Files/admin/AdminFooter.php +++ b/class/Files/admin/AdminFooter.php @@ -88,6 +88,7 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); + $content .= $this->getSimpleString(''); $isset = $this->pc->getPhpCodeIsset('templateMain'); $display = "\t" . $this->xc->getXcXoopsTplAssign('maintainedby', "\$helper->getConfig('maintainedby')"); $display .= "\t" . $this->pc->getPhpCodeRemoveCarriageReturn($this->xc->getXcXoopsTplDisplay(), '', "\r"); diff --git a/docs/changelog.txt b/docs/changelog.txt index 20fe5b1d..7a6e0ce6 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -7,6 +7,7 @@ - fixed bug in class handler creation (jjdai/goffy) - increasing field size (mamba/goffy) - fixed bug in class utility (jjdai/goffy) +- removed empty items from autor info (mjoel/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From 77e9b97a97a89c6bb343ddf406984e5511c0720f Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 24 Nov 2021 09:25:09 +0100 Subject: [PATCH 179/266] added block spotlight --- class/Files/Blocks/BlocksFiles.php | 46 +-- class/Files/Blocks/BlocksFilesSpotlight.php | 289 ++++++++++++++++++ class/Files/CreateArchitecture.php | 14 + class/Files/CreatePhpCode.php | 11 +- class/Files/Language/LanguageBlocks.php | 3 +- class/Files/Language/LanguageMain.php | 9 +- class/Files/Language/LanguageModinfo.php | 2 + .../Defstyle/TemplatesBlocksSpotlight.php | 251 +++++++++++++++ class/Files/User/UserXoopsVersion.php | 39 ++- docs/changelog.txt | 1 + files/commonfiles/include/install.php | 2 - files/commonfiles/include/uninstall.php | 2 - include/update.php | 8 +- sql/mysql.sql | 12 +- 14 files changed, 637 insertions(+), 52 deletions(-) create mode 100644 class/Files/Blocks/BlocksFilesSpotlight.php create mode 100644 class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 8e9a392d..4d685619 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -96,7 +96,6 @@ public function write($module, $table, $filename) */ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tablePermissions, $fields, $fieldId, $fieldParent = 0) { - $stuModuleDirname = \mb_strtoupper($moduleDirname); $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; @@ -104,7 +103,6 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); //$func .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); - $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); @@ -133,7 +131,6 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab //content else: parent //search for SelectStatus field $fieldStatus = ''; - $critStatus = ''; $fieldDate = ''; if (1 == $tablePermissions) { foreach ($fields as $field) { @@ -147,7 +144,9 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab if ('' !== $fieldStatus) { $constant = $this->xc->getXcGetConstants('PERM_GLOBAL_VIEW'); $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'>'", true); - $critStatus .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t\t"); + $func .= $this->pc->getPhpCodeCommentLine("Criteria for status field",'',"\t"); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); } } @@ -156,17 +155,10 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case3 = []; $case4 = []; $case5 = []; - $case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case1[] = $critStatus; - } $case1[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); $case1[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); $case2[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} new",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case2[] = $critStatus; - } $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->xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); @@ -175,21 +167,12 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case2[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); $case2[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); $case3[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} hits",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case3[] = $critStatus; - } $case3[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_hits'","\t\t\t"); $case3[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case4[] = $critStatus; - } $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'","\t\t\t"); $case4[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); $case5[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} random",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case5[] = $critStatus; - } $case5[] = $this->xc->getXcCriteriaSetSort($critName, "'RAND()'","\t\t\t"); $cases = [ 'last' => $case1, @@ -212,6 +195,17 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); $func .= $this->pc->getPhpCodeUnset($critName, "\t"); $contentForeach = ''; + $contentForeach .= $this->pc->getPhpCodeCommentMultiLine([ + 'If you want to use the parameter for limits you have to adapt the line where it should be applied' => '', + 'e.g. change' => '', + "\t\$block[\$i]['title']" => "= \${$tableName}All[\$i]->getVar('art_title');", + 'into' => '', + "\t" . '$myTitle' => "= \${$tableName}All[\$i]->getVar('art_title');", + "\t" . 'if ($limit > 0) {' => '', + "\t\t" . '$myTitle' => '= \substr($myTitle, 0, (int)$limit);', + "\t" . '}' => '', + "\t\$block[\$i]['title'] = " => '$myTitle;', + ], "\t\t\t", false); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); @@ -272,10 +266,8 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); - $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); - $func .= $this->xc->getXcHandlerLine($tableName, "\t"); $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); - $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY", '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY . ' : '", '',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "\"\"", '.',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "{$language}TITLE_LENGTH . \" :

    \"", '.',"\t"); @@ -288,6 +280,13 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t","\n"); $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t","\n"); + $func .= $this->pc->getPhpCodeCommentMultiLine([ + 'If you want to filter your results by e.g. a category used in your' . $tableName => '', + 'then you can activate the following code, but you have to change it according your category' => '' + ], "\t"); + $func .= $this->getSimpleString('/*', "\t"); + $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); + $func .= $this->xc->getXcHandlerLine($tableName, "\t"); $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); $func .= $this->pc->getPhpCodeUnset($critName, "\t"); $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    '", '.',"\t"); $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->getSimpleString('*/', "\t"); $func .= $this->getSimpleString('return $form;', "\t"); $func .= $this->pc->getPhpCodeBlankLine(); diff --git a/class/Files/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php new file mode 100644 index 00000000..b5133180 --- /dev/null +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -0,0 +1,289 @@ +xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + } + + /** + * @static function getInstance + * @param null + * @return BlocksFiles + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param string $module + * @param mixed $table + * @param $filename + */ + public function write($module, $table, $filename) + { + $this->setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getBlocksShow + * @param $moduleDirname + * @param $tableName + * @param $tablePermissions + * @param $fields + * @param $fieldId + * @return string + */ + private function getBlocksShow($moduleDirname, $tableName, $tablePermissions, $fields, $fieldId) + { + $ucfTableName = \ucfirst($tableName); + $critName = 'cr' . $ucfTableName; + + $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); + + $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); + //$func .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$lenghtTitle', '$options[2]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); + $func .= $this->xc->getXcHandlerLine($tableName, "\t"); + $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + + //Criteria for status field + $fieldStatus = ''; + if (1 == $tablePermissions) { + foreach ($fields as $field) { + if ($field->getVar('field_element') == 16) { + $fieldStatus = $field->getVar('field_name'); + } + } + if ('' !== $fieldStatus) { + $constant = $this->xc->getXcGetConstants('PERM_GLOBAL_VIEW'); + $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'>'", true); + $func .= $this->pc->getPhpCodeCommentLine("Criteria for status field",'',"\t"); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + } + } + + $crit = $this->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->getPhpCodeBlankLine(); + + $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t"); + $func .= $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t"); + $func .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', "\t"); + $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); + $func .= $this->pc->getPhpCodeUnset($critName, "\t"); + $contentForeach = ''; + $contentForeach .= $this->pc->getPhpCodeCommentMultiLine([ + 'If you want to use the parameter for limits you have to adapt the line where it should be applied' => '', + 'e.g. change' => '', + "\t\$block[\$i]['title']" => "= \${$tableName}All[\$i]->getVar('art_title');", + 'into' => '', + "\t" . '$myTitle' => "= \${$tableName}All[\$i]->getVar('art_title');", + "\t" . 'if ($limit > 0) {' => '', + "\t\t" . '$myTitle' => '= \substr($myTitle, 0, (int)$limit);', + "\t" . '}' => '', + "\t\$block[\$i]['title'] = " => '$myTitle;', + ], "\t\t\t", false); + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $fieldElement = $fields[$f]->getVar('field_element'); + + if (0 == $f) { + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['id']", "\${$tableName}All[\$i]->getVar('{$fieldId}')", null, "\t\t\t"); + } + if (1 == $fields[$f]->getVar('field_block')) { + switch ($fieldElement) { + case 2: + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\htmlspecialchars(\${$tableName}All[\$i]->getVar('{$fieldName}'), ENT_QUOTES | ENT_HTML5)", null, "\t\t\t"); + break; + case 3: + case 4: + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\strip_tags(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + break; + case 8: + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + break; + case 15: + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","\\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + break; + default: + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","\${$tableName}All[\$i]->getVar('{$fieldName}')", null, "\t\t\t"); + break; + } + } + } + $foreach = $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, "\t\t"); + + $func .= $this->pc->getPhpCodeConditions("\count(\${$tableName}All)", ' > ', '0', $foreach, false, "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->getSimpleString('return $block;',"\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_spotlight_show", '$options', $func, '', false, ""); + + return $ret; + } + + /** + * @public function getBlocksEdit + * @param string $moduleDirname + * @param string $tableName + * @param string $fieldId + * @param string $fieldMain + * @param string $language + * + * @return string + */ + private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $language) + { + $stuModuleDirname = \mb_strtoupper($moduleDirname); + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $critName = 'cr' . $ucfTableName; + + $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); + $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); + $func .= $this->xc->getXcHandlerLine($tableName, "\t"); + $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY_SPOTLIGHT . ' : '", '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "\"\"", '.',"\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.',"\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}TITLE_LENGTH . \" :

    \"", '.',"\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); + $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); + $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t","\n"); + $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t","\n"); + $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); + $func .= $this->pc->getPhpCodeUnset($critName, "\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    '", '.',"\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->getSimpleString('return $form;', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_spotlight_edit", '$options', $func, '', false, ""); + + return $ret; + + } + + /** + * @public function render + * @param null + * + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $table = $this->getTable(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tablePermissions = $table->getVar('table_permissions'); + $language = $this->getLanguage($moduleDirname, 'MB'); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldId = null; + $fieldMain = null; + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $fieldId = $fieldName; + } + if (1 == $fields[$f]->getVar('field_main')) { + $fieldMain = $fieldName; + } + } + $content = $this->getHeaderFilesComments($module); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Helper'], '', ''); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); + $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/include/common.php'",'',true, true); + $content .= $this->getBlocksShow($moduleDirname, $tableName, $tablePermissions, $fields, $fieldId); + $content .= $this->getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $language); + + $this->create($moduleDirname, 'blocks', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 4e5b3104..56d71845 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -292,6 +292,7 @@ public function setFilesToBuilding($module) } // Creation of blocks if (1 === (int)$tables[$t]->getVar('table_blocks')) { + // Default block // Blocks Files $blocksFiles = Modulebuilder\Files\Blocks\BlocksFiles::getInstance(); $blocksFiles->write($module, $table, $tableName . '.php'); @@ -304,6 +305,19 @@ public function setFilesToBuilding($module) } $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl'); $ret[] = $templatesBlocks->render(); + // Spotlight block + // Blocks Files + $blocksFiles = Modulebuilder\Files\Blocks\BlocksFilesSpotlight::getInstance(); + $blocksFiles->write($module, $table, $tableName . '_spotlight.php'); + $ret[] = $blocksFiles->render(); + // Templates Blocks Files + if ($templateType == 'bootstrap') { + $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Bootstrap\TemplatesBlocksSpotlight::getInstance(); + } else { + $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Defstyle\TemplatesBlocksSpotlight::getInstance(); + } + $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '_spotlight.tpl'); + $ret[] = $templatesBlocks->render(); } // Creation of classes if (1 === (int)$tables[$t]->getVar('table_admin') || 1 === (int)$tables[$t]->getVar('table_user')) { diff --git a/class/Files/CreatePhpCode.php b/class/Files/CreatePhpCode.php index b318016c..34674982 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -65,15 +65,18 @@ public function getPhpCodeCommentLine($comment = null, $var = null, $t = '', $n /** * @public function getPhpCodeCommentMultiLine * @param array $multiLine - * * @param string $t + * @param bool $blankLineBefore * @return string */ - public function getPhpCodeCommentMultiLine($multiLine = [], $t = '') + public function getPhpCodeCommentMultiLine($multiLine = [], $t = '', $blankLineBefore = true) { $values = !empty($multiLine) ? $multiLine : []; - - $ret = "\n{$t}/**\n"; + $ret = ''; + if ($blankLineBefore) { + $ret .= "\n"; + } + $ret .= "{$t}/**\n"; foreach ($values as $string => $value) { if ('' === $string && '' === $value) { $ret .= "{$t} *\n"; diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index 7be01d88..0781e0dd 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -85,7 +85,8 @@ private function getLanguageBlock($language) { $tables = $this->getTables(); $ret = $this->ld->getAboveDefines('Admin Edit'); - $ret .= $this->ld->getDefine($language, 'DISPLAY', 'How Many Tables to Display'); + $ret .= $this->ld->getDefine($language, 'DISPLAY', 'How Many Items to Display'); + $ret .= $this->ld->getDefine($language, 'DISPLAY_SPOTLIGHT', "How Many Items to Display (only valid if you select 'all')", true); $ret .= $this->ld->getDefine($language, 'TITLE_LENGTH', 'Title Length'); $ret .= $this->ld->getDefine($language, 'CATTODISPLAY', 'Categories to Display'); $ret .= $this->ld->getDefine($language, 'ALLCAT', 'All Categories'); diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index 71906067..4cfd5043 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -90,7 +90,6 @@ public function write($module, $tables, $filename) */ private function getLanguageMain($module, $language) { - /** @var \XoopsModules\Modulebuilder\Utility $utility */ $utility = new \XoopsModules\Modulebuilder\Utility(); $moduleName = $module->getVar('mod_name'); @@ -102,13 +101,7 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getDefine($language, 'INDEX', 'Overview ' . (string)$module->getVar('mod_name')); $ret .= $this->ld->getDefine($language, 'TITLE', (string)$module->getVar('mod_name')); $ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); - $ret .= $this->ld->getDefine( - $language, - 'INDEX_DESC', - "Welcome to the homepage of your new module {$moduleName}!
    -As you can see, you have created a page with a list of links at the top to navigate between the pages of your module. This description is only visible on the homepage of this module, the other pages you will see the content you created when you built this module with the module ModuleBuilder, and after creating new content in admin of this module. In order to expand this module with other resources, just add the code you need to extend the functionality of the same. The files are grouped by type, from the header to the footer to see how divided the source code.

    If you see this message, it is because you have not created content for this module. Once you have created any type of content, you will not see this message.

    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!

    Use the link below to go to the admin and create content.", - true - ); + $ret .= $this->ld->getDefine($language, 'INDEX_DESC',"Welcome to the homepage of your new module {$moduleName}!
    This description is only visible on the homepage of this module."); $ret .= $this->ld->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); $ret .= $this->ld->getDefine($language, 'NO', 'No'); $ret .= $this->ld->getDefine($language, 'DETAILS', 'Show details'); diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 08512ecb..f6f22ae5 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -234,6 +234,8 @@ private function getLanguageBlocks($tables, $language) $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_TOP_DESC", "{$ucfTableName} block top description"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_RANDOM", "{$ucfTableName} block random"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_RANDOM_DESC", "{$ucfTableName} block random description"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_SPOTLIGHT", "{$ucfTableName} block spotlight"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_SPOTLIGHT_DESC", "{$ucfTableName} block spotlight description"); } } } diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php new file mode 100644 index 00000000..7adc0eae --- /dev/null +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -0,0 +1,251 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * @param null + * @return TemplatesBlocks + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param string $module + * @param string $table + * @param string $filename + */ + public function write($module, $table, $filename) + { + $this->setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesBlocksTableThead + * @param $tableId + * @param $tableMid + * @param string $language + * @param $tableAutoincrement + * @return string + */ + private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement) + { + $th = ''; + if (1 == $tableAutoincrement) { + $th .= $this->hc->getHtmlTableHead(' ', '', '', "\t\t\t"); + } + $fields = $this->getTableFields($tableMid, $tableId); + foreach (\array_keys($fields) as $f) { + if (1 === (int)$fields[$f]->getVar('field_block')) { + $fieldName = $fields[$f]->getVar('field_name'); + $stuFieldName = \mb_strtoupper($fieldName); + $lang = $this->sc->getSmartyConst($language, $stuFieldName); + $th .= $this->hc->getHtmlTableHead($lang, 'center', '', "\t\t\t"); + } + } + $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t"); + + return $this->hc->getHtmlTableThead($tr, '', "\t"); + } + + /** + * @private function getTemplatesBlocksTableTbody + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param $language + * @return string + */ + private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + { + $td = ''; + $fieldId = ''; + $stuTableSoleName = \mb_strtoupper($tableSoleName); + if (1 == $tableAutoincrement) { + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + } + $fields = $this->getTableFields($tableMid, $tableId); + foreach (\array_keys($fields) as $f) { + if (0 == $f) { + $fieldId = $fields[$f]->getVar('field_name'); + } + if (1 === (int)$fields[$f]->getVar('field_block')) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if (1 == $fields[$f]->getVar('field_inlist')) { + switch ($fieldElement) { + case 9: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $span = $this->hc->getHtmlTag('span', [], $double); + $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"); + 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"); + break; + default: + if (0 != $f) { + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + } + break; + } + } + } + } + // 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"); + $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"); + + return $this->sc->getSmartyConditions("block", '', '', $tbody, false, true, true, "\t"); + } + + /** + * @private function getTemplatesBlocksTfoot + * @return string + */ + private function getTemplatesBlocksTableTfoot() + { + $td = $this->hc->getHtmlTag('td', [], " ", false, '', ''); + $tr = $this->hc->getHtmlTag('tr', [], $td, false, '', ''); + + return $this->hc->getHtmlTag('tfoot', [], $tr, false, "\t"); + } + + /** + * @private function getTemplatesBlocksTable + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param string $language + * @return string + */ + private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + { + $tbody = $this->getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement); + $tbody .= $this->getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); + $tbody .= $this->getTemplatesBlocksTableTfoot(); + $single = $this->sc->getSmartySingleVar('table_type'); + + return $this->hc->getHtmlTable($tbody, 'table table-' . $single); + } + + /** + * @public function render + * @param null + * + * @return bool|string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableAutoincrement = $table->getVar('table_autoincrement'); + $language = $this->getLanguage($moduleDirname, 'MB', '', false); + $content = $this->getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); + + $this->create($moduleDirname, 'templates/blocks', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 0716534f..6557c691 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -141,7 +141,7 @@ private function getXoopsVersionHeader($module, $language) $descriptions = [ 'name' => "{$language}NAME", - 'version' => (string)$module->getVar('mod_version'), + 'version' => "'" . (string)$module->getVar('mod_version') . "'", 'description' => "{$language}DESC", 'author' => "'{$module->getVar('mod_author')}'", 'author_mail' => "'{$module->getVar('mod_author_mail')}'", @@ -481,7 +481,7 @@ private function getXoopsVersionSubmenu($language, $tables) */ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) { - $ret = $this->getDashComment('Blocks'); + $ret = $this->getDashComment('Default Blocks'); foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); if (0 == $tables[$i]->getVar('table_category') && 1 == $tables[$i]->getVar('table_blocks')) { @@ -492,6 +492,13 @@ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'RANDOM', $language, 'random'); } } + $ret .= $this->getDashComment('Spotlight Blocks'); + foreach (\array_keys($tables) as $i) { + $tableName = $tables[$i]->getVar('table_name'); + if (0 == $tables[$i]->getVar('table_category') && 1 == $tables[$i]->getVar('table_blocks')) { + $ret .= $this->getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, '', $language, 'spotlight'); + } + } return $ret; } @@ -524,6 +531,34 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable return $ret; } + /** + * @private function getXoopsVersionTypeBlocks + * @param $moduleDirname + * @param $tableName + * @param $stuTableSoleName + * @param $language + * @param $type + * @return string + */ + private function getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type) + { + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); + $blocks = [ + 'file' => "'{$tableName}_spotlight.php'", + 'name' => "{$language}{$stuTableName}_BLOCK_SPOTLIGHT", + 'description' => "{$language}{$stuTableName}_BLOCK_SPOTLIGHT_DESC", + 'show_func' => "'b_{$moduleDirname}_{$tableName}_spotlight_show'", + 'edit_func' => "'b_{$moduleDirname}_{$tableName}_spotlight_edit'", + 'template' => "'{$moduleDirname}_block_{$tableName}_spotlight.tpl'", + 'options' => "'{$type}|5|25|0'", + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); + + return $ret; + } + /** * @private function getXoopsVersionConfig * @param $module diff --git a/docs/changelog.txt b/docs/changelog.txt index 7a6e0ce6..69c6d022 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -8,6 +8,7 @@ - increasing field size (mamba/goffy) - fixed bug in class utility (jjdai/goffy) - removed empty items from autor info (mjoel/goffy) +- added block spotlight (liomj/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index e46c6522..fa1ac8f7 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -57,8 +57,6 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) { require \dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Modulebuilder\Helper $helper */ /** @var Modulebuilder\Utility $utility */ - /** @var Common\Configurator $configurator */ $helper = Modulebuilder\Helper::getInstance(); $utility = new Modulebuilder\Utility(); $configurator = new Common\Configurator(); diff --git a/files/commonfiles/include/uninstall.php b/files/commonfiles/include/uninstall.php index c8dd909e..dfec04dd 100644 --- a/files/commonfiles/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -30,8 +30,6 @@ function xoops_module_pre_uninstall_modulebuilder(\XoopsModule $module) */ function xoops_module_uninstall_modulebuilder(\XoopsModule $module) { - // return true; - $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); diff --git a/include/update.php b/include/update.php index 27964708..96590c10 100644 --- a/include/update.php +++ b/include/update.php @@ -708,8 +708,8 @@ function modulebuilder_check_db($module) // update table 'modulebuilder_settings' $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_settings'); - $field = 'set_version'; - $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + $field = 'set_min_xoops'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(15) NOT NULL DEFAULT '1.0';"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); @@ -718,8 +718,8 @@ function modulebuilder_check_db($module) // update table 'modulebuilder_modules' $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); - $field = 'mod_version'; - $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + $field = 'mod_min_xoops'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(15) NOT NULL DEFAULT '1.0';"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); diff --git a/sql/mysql.sql b/sql/mysql.sql index 2b876244..0758347b 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -15,10 +15,10 @@ CREATE TABLE `modulebuilder_settings` ( `set_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, `set_name` VARCHAR(255) NOT NULL DEFAULT 'My Module', `set_dirname` VARCHAR(100) NOT NULL DEFAULT 'mymoduledirname', - `set_version` VARCHAR(10) NOT NULL DEFAULT '1.0', - `set_since` VARCHAR(5) NOT NULL DEFAULT '1.0', + `set_version` VARCHAR(10) NOT NULL DEFAULT '1.0.0', + `set_since` VARCHAR(5) NOT NULL DEFAULT '1.0.0', `set_min_php` VARCHAR(5) NOT NULL DEFAULT '7.0', - `set_min_xoops` VARCHAR(8) NOT NULL DEFAULT '2.5.10', + `set_min_xoops` VARCHAR(15) NOT NULL DEFAULT '2.5.10', `set_min_admin` VARCHAR(8) NOT NULL DEFAULT '1.2', `set_min_mysql` VARCHAR(8) NOT NULL DEFAULT '5.5', `set_description` VARCHAR(255) NOT NULL DEFAULT 'This module is for doing following...', @@ -72,10 +72,10 @@ CREATE TABLE `modulebuilder_modules` ( `mod_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, `mod_name` VARCHAR(200) NOT NULL DEFAULT '', `mod_dirname` VARCHAR(100) NOT NULL DEFAULT '', - `mod_version` VARCHAR(10) NOT NULL DEFAULT '1.0', - `mod_since` VARCHAR(4) NOT NULL DEFAULT '1.0', + `mod_version` VARCHAR(10) NOT NULL DEFAULT '1.0.0', + `mod_since` VARCHAR(4) NOT NULL DEFAULT '1.0.0', `mod_min_php` VARCHAR(4) NOT NULL DEFAULT '5.5', - `mod_min_xoops` VARCHAR(6) NOT NULL DEFAULT '2.5.9', + `mod_min_xoops` VARCHAR(15) NOT NULL DEFAULT '2.5.11', `mod_min_admin` VARCHAR(4) NOT NULL DEFAULT '1.2', `mod_min_mysql` VARCHAR(6) NOT NULL DEFAULT '5.5', `mod_description` TEXT, From 58075329e9fbde260a163dd2a3227daabb65de66 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 25 Nov 2021 07:52:59 +0100 Subject: [PATCH 180/266] - fixed bug in field size and permissionUpload --- class/Files/Classes/ClassFiles.php | 13 +++++++++---- docs/changelog.txt | 2 ++ include/update.php | 10 ++++++++++ sql/mysql.sql | 4 ++-- testdata/english/modulebuilder_modules.yml | 6 +++--- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 889eed8a..77eabcd8 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -197,6 +197,7 @@ private function getClassObject($module, $table, $fields) $fieldInForm = []; $fieldElementId = []; $optionsFieldName = []; + $fieldUpload = false; $fieldId = null; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -204,6 +205,10 @@ private function getClassObject($module, $table, $fields) $fieldInForm[] = $fields[$f]->getVar('field_inform'); $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); + if (13 == $fieldElements->getVar('fieldelement_id') || 14 == $fieldElements->getVar('fieldelement_id')) { + //13: UploadImage, 14: UploadFile + $fieldUpload = true; + } $rpFieldName = $this->getRightString($fieldName); if (\in_array(5, $fieldElementId)) { //if (\count($rpFieldName) % 5) { @@ -237,7 +242,7 @@ private function getClassObject($module, $table, $fields) $cCl .= $this->pc->getPhpCodeFunction('getInstance', '', $getInstance, 'public static ', false, "\t"); $cCl .= $this->getNewInsertId($table); - $cCl .= $this->getFunctionForm($module, $table, $fieldId, $fieldInForm); + $cCl .= $this->getFunctionForm($module, $table, $fieldId, $fieldInForm, $fieldUpload); $cCl .= $this->getValuesInObject($moduleDirname, $table, $fields); $cCl .= $this->getToArrayInObject($table); @@ -276,12 +281,12 @@ private function getNewInsertId($table) * * @param string $module * @param string $table - * * @param $fieldId * @param $fieldInForm + * @param $fieldUpload * @return string */ - private function getFunctionForm($module, $table, $fieldId, $fieldInForm) + private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $fieldUpload) { $fe = ClassFormElements::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); @@ -300,7 +305,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); $getForm .= $this->xc->getXcEqualsOperator('$isAdmin', $xUser . '->isAdmin(' . $xModule . '->mid())', null, "\t\t"); - if ((1 != $tableCategory) && (1 == $table->getVar('table_permissions'))) { + if ($fieldUpload) { $permString = 'upload_groups'; $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); $getForm .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); diff --git a/docs/changelog.txt b/docs/changelog.txt index 69c6d022..91c07709 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -9,6 +9,8 @@ - fixed bug in class utility (jjdai/goffy) - removed empty items from autor info (mjoel/goffy) - added block spotlight (liomj/goffy) +- fixed bug in field size (liomj/goffy) +- fixed bug in permissionUpload (liomj/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/include/update.php b/include/update.php index 96590c10..2e6b4c48 100644 --- a/include/update.php +++ b/include/update.php @@ -726,6 +726,16 @@ function modulebuilder_check_db($module) $ret = false; } + // update table 'modulebuilder_modules' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); + $field = 'mod_since'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); + $module->setErrors("Error when changing '$field' in table '$table'."); + $ret = false; + } + return $ret; } diff --git a/sql/mysql.sql b/sql/mysql.sql index 0758347b..2ef1792c 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -60,7 +60,7 @@ CREATE TABLE `modulebuilder_settings` ( INSERT INTO `modulebuilder_settings` (`set_id`, `set_name`, `set_dirname`, `set_version`, `set_since`, `set_min_php`, `set_min_xoops`, `set_min_admin`, `set_min_mysql`, `set_description`, `set_author`, `set_author_mail`, `set_author_website_url`, `set_author_website_name`, `set_credits`, `set_license`, `set_release_info`, `set_release_file`, `set_manual`, `set_manual_file`, `set_image`, `set_demo_site_url`, `set_demo_site_name`, `set_support_url`, `set_support_name`, `set_website_url`, `set_website_name`, `set_release`, `set_status`, `set_admin`, `set_user`, `set_blocks`, `set_search`, `set_comments`, `set_notifications`, `set_permissions`, `set_inroot_copy`, `set_donations`, `set_subversion`, `set_type`) VALUES - (1, 'My Module', 'mymoduledirname', '1.0', '1.0', '7.0', '2.5.9', '1.2', '5.6', 'This module is for doing following...', 'TDM XOOPS', 'info@email.com', 'http://xoops.org', 'XOOPS Project', 'XOOPS Development Team', 'GPL 2.0 or later', 'release_info', 'release_info file', 'link to manual file', + (1, 'My Module', 'mymoduledirname', '1.0.0', '1.0.0', '7.0', '2.5.10', '1.2', '5.6', 'This module is for doing following...', 'TDM XOOPS', 'info@email.com', 'http://xoops.org', 'XOOPS Project', 'XOOPS Development Team', 'GPL 2.0 or later', 'release_info', 'release_info file', 'link to manual file', 'install.txt', 'empty.png', 'https://xoops.org', 'XOOPS Demo Site', 'https://xoops.org/modules/newbb', 'Support Forum', 'www.xoops.org', 'XOOPS Project', '2017-12-02', 'Beta 1', '1', '1', '1', '0', '0', '0', '0', '0', '6KJ7RW5DR3VTJ', '13070', 1); @@ -73,7 +73,7 @@ CREATE TABLE `modulebuilder_modules` ( `mod_name` VARCHAR(200) NOT NULL DEFAULT '', `mod_dirname` VARCHAR(100) NOT NULL DEFAULT '', `mod_version` VARCHAR(10) NOT NULL DEFAULT '1.0.0', - `mod_since` VARCHAR(4) NOT NULL DEFAULT '1.0.0', + `mod_since` VARCHAR(10) NOT NULL DEFAULT '1.0.0', `mod_min_php` VARCHAR(4) NOT NULL DEFAULT '5.5', `mod_min_xoops` VARCHAR(15) NOT NULL DEFAULT '2.5.11', `mod_min_admin` VARCHAR(4) NOT NULL DEFAULT '1.2', diff --git a/testdata/english/modulebuilder_modules.yml b/testdata/english/modulebuilder_modules.yml index cdf4a55f..32844029 100644 --- a/testdata/english/modulebuilder_modules.yml +++ b/testdata/english/modulebuilder_modules.yml @@ -2,10 +2,10 @@ mod_id: '1' mod_name: 'My Module' mod_dirname: mymodule - mod_version: '1.0' - mod_since: '1.0' + mod_version: '1.0.0' + mod_since: '1.0.0' mod_min_php: '7.3' - mod_min_xoops: 2.5.11 + mod_min_xoops: '2.5.11 Beta1' mod_min_admin: '1.2' mod_min_mysql: '5.6' mod_description: 'This module is for doing following...' From e0fcb3b1454129ecd53600cce0ac8f13888263a5 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 25 Nov 2021 13:52:26 +0100 Subject: [PATCH 181/266] code cleaning --- README.md | 2 +- admin/building.php | 2 +- admin/feedback.php | 14 ++++----- admin/fields.php | 11 +++---- admin/footer.php | 2 +- admin/header.php | 1 - admin/index.php | 2 +- admin/menu.php | 5 ++- admin/migrate.php | 2 -- admin/modules.php | 11 ++++--- admin/morefiles.php | 8 ++--- admin/settings.php | 10 +++--- admin/tables.php | 13 ++++---- class/Building.php | 2 +- class/Common/Breadcrumb.php | 4 +-- class/Common/ModuleFeedback.php | 2 +- class/Common/TableChecker.php | 5 +-- class/Common/TestdataButtons.php | 4 +-- class/Devtools.php | 4 +-- class/Fields.php | 3 +- class/Files/Admin/AdminBroken.php | 2 +- class/Files/Admin/AdminIndex.php | 2 +- class/Files/Admin/AdminPermissions.php | 2 +- class/Files/Blocks/BlocksFiles.php | 10 +++--- class/Files/Blocks/BlocksFilesSpotlight.php | 12 +++---- class/Files/Classes/ClassFiles.php | 8 ++--- class/Files/Classes/ClassFormElements.php | 4 +-- class/Files/Classes/ClassHandlerFiles.php | 6 ++-- class/Files/CreateFile.php | 24 +++++++------- class/Files/CreatePhpCode.php | 6 ++-- class/Files/CreateXoopsCode.php | 17 +++++----- class/Files/Language/LanguageAdmin.php | 2 +- class/Files/Language/LanguageMain.php | 2 +- class/Files/Sql/SqlFile.php | 11 +++---- .../Templates/Admin/TemplatesAdminBroken.php | 8 ++--- .../Templates/Admin/TemplatesAdminHeader.php | 4 +-- .../Templates/Admin/TemplatesAdminPages.php | 4 +-- .../Defstyle/TemplatesBlocksSpotlight.php | 2 +- .../Templates/User/Defstyle/Breadcrumbs.php | 2 +- .../Templates/User/Defstyle/Categories.php | 2 +- .../Files/Templates/User/Defstyle/Header.php | 2 +- class/Files/Templates/User/Defstyle/Index.php | 2 +- class/Files/Templates/User/Defstyle/Pages.php | 4 +-- .../Templates/User/Defstyle/PagesItem.php | 2 +- .../Templates/User/Defstyle/PagesList.php | 2 +- .../Templates/User/Defstyle/UserPrint.php | 2 +- class/Files/User/UserIndex.php | 2 +- class/Files/User/UserPages.php | 8 ++--- class/Files/User/UserPdf.php | 8 ++--- class/Files/User/UserPrint.php | 4 +-- class/Files/User/UserSearch.php | 7 ++--- class/Files/User/UserXoopsVersion.php | 31 +++++++++---------- class/Files/admin/AdminFooter.php | 4 +-- class/Files/admin/AdminPages.php | 7 ++--- class/Files/admin/AdminXoopsCode.php | 1 - class/Form/FormTab.php | 1 - class/Form/FormTabTray.php | 1 - class/Import.php | 5 +-- class/Morefiles.php | 8 +---- class/Tables.php | 2 +- docs/changelog.txt | 1 + files/commonfiles/admin/feedback.php | 12 +++---- files/commonfiles/class/Common/Breadcrumb.php | 4 +-- .../class/Common/ModuleFeedback.php | 2 +- .../commonfiles/class/Common/TableChecker.php | 5 +-- files/commonfiles/testdata/index.php | 4 +-- include/install.php | 1 - include/update.php | 2 +- templates/admin/modulebuilder_building.tpl | 6 ++-- testdata/index.php | 6 ++-- 70 files changed, 177 insertions(+), 206 deletions(-) diff --git a/README.md b/README.md index 4cf1cd4c..e0931b06 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ If you liked the modulebuilder module and thanks to the long process for giving It's under development currently. If you want to build with developers this version of module or create a base modules, you can use the last version of this module at [Github](https://github.com/XoopsModules25x/modulebuilder), and visit the main discussion forum at [XOOPS Web Site](https://xoops.org/modules/newbb/viewtopic.php?topic_id=76746) for more information. Screenshot: -

    +

    ModuleBuilder 1.9.1 dashboard

    diff --git a/admin/building.php b/admin/building.php index 5ff7601e..c3027735 100644 --- a/admin/building.php +++ b/admin/building.php @@ -41,7 +41,7 @@ if (!\mkdir($cachePath, 0777) && !\is_dir($cachePath)) { throw new \RuntimeException(\sprintf('Directory "%s" was not created', $cachePath)); } - chmod($cachePath, 0777); + \chmod($cachePath, 0777); } // Clear cache if (\file_exists($cache = $cachePath . '/classpaths.cache')) { diff --git a/admin/feedback.php b/admin/feedback.php index 2fb28cbd..44598b97 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -53,11 +53,11 @@ $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); - $your_name = Request::getString('your_name', ''); - $your_site = Request::getString('your_site', ''); - $your_mail = Request::getString('your_mail', ''); - $fb_type = Request::getString('fb_type', ''); - $fb_content = Request::getText('fb_content', ''); + $your_name = Request::getString('your_name'); + $your_site = Request::getString('your_site'); + $your_mail = Request::getString('your_mail'); + $fb_type = Request::getString('fb_type'); + $fb_content = Request::getText('fb_content'); $fb_content = \str_replace(["\r\n", "\n", "\r"], '
    ', $fb_content); //clean line break from dhtmltextarea $title = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname'); @@ -73,7 +73,7 @@ $xoopsMailer->setFromEmail($your_mail); $xoopsMailer->setFromName($your_name); $xoopsMailer->setSubject($title); - $xoopsMailer->multimailer->isHTML(true); + $xoopsMailer->multimailer->isHTML(); $xoopsMailer->setBody($body); $ret = $xoopsMailer->send(); if ($ret) { @@ -86,7 +86,7 @@ $feedback->site = $your_site; $feedback->type = $fb_type; $feedback->content = $fb_content; - echo '
    + echo '

    ' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_ERROR') . '

    '; $form = $feedback->getFormFeedback(); diff --git a/admin/fields.php b/admin/fields.php index 0133bf3c..ff621407 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -42,19 +42,19 @@ $fieldMid = \Xmf\Request::getInt('field_mid'); $fieldTid = \Xmf\Request::getInt('field_tid'); $fieldNumb = \Xmf\Request::getInt('field_numb'); -$fieldName = \Xmf\Request::getString('field_name', ''); +$fieldName = \Xmf\Request::getString('field_name'); // switch op switch ($op) { case 'list': default: - $start = \Xmf\Request::getInt('start', 0); + $start = \Xmf\Request::getInt('start'); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('tables_adminpager')); $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/sortable.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); // Redirect if there aren't modules @@ -103,7 +103,7 @@ if ($tablesCount > $limit) { require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new \XoopsPageNav($tablesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); } } else { $GLOBALS['xoopsTpl']->assign('error', \_AM_MODULEBUILDER_THEREARENT_FIELDS); @@ -191,7 +191,7 @@ $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('fields.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new'); $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_LIST, 'tables.php', 'list'); $adminObject->addItemButton(\_AM_MODULEBUILDER_FIELDS_LIST, 'fields.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); @@ -220,7 +220,6 @@ unset($i); } exit; - break; case 'delete': //delete is not needed as deletion is done by deleting whole table break; diff --git a/admin/footer.php b/admin/footer.php index a84585f1..fd0461d6 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -22,7 +22,7 @@ * Goffy https://myxoops.org * */ -$pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); +$pathIcon32 = Xmf\Module\Admin::iconUrl(); if (isset($templateMain)) { $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); diff --git a/admin/header.php b/admin/header.php index 52b59e9c..d4e6dca7 100644 --- a/admin/header.php +++ b/admin/header.php @@ -35,7 +35,6 @@ $modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons32'); //$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -/** @var \XoopsModules\Modulebuilder\Helper $helper */ $helper = \XoopsModules\Modulebuilder\Helper::getInstance(); $utility = new \XoopsModules\Modulebuilder\Utility(); diff --git a/admin/index.php b/admin/index.php index 4b71a5c7..9cbe408c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -60,7 +60,7 @@ //------ check Upload Folders --------------- -$adminObject->addConfigBoxLine(''); +$adminObject->addConfigBoxLine(); $redirectFile = $_SERVER['SCRIPT_NAME']; foreach (\array_keys($folder) as $i) { diff --git a/admin/menu.php b/admin/menu.php index 87bcf462..b68be2f0 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -27,15 +27,14 @@ $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -/** @var \XoopsModules\Modulebuilder\Helper $helper */ $helper = \XoopsModules\Modulebuilder\Helper::getInstance(); $helper->loadLanguage('common'); $helper->loadLanguage('feedback'); $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); -if (\is_object($helper->getModule())) { +//if (\is_object($helper->getModule())) { // $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); -} +//} $moduleHandler = \xoops_getHandler('module'); $xoopsModule = \XoopsModule::getByDirname($moduleDirName); diff --git a/admin/migrate.php b/admin/migrate.php index 47c37b90..fb90a88c 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -53,10 +53,8 @@ //XoopsLoad::load('migrate', 'newbb'); -/** @var Modulebuilder\Common\Configurator $configurator */ $configurator = new Modulebuilder\Common\Configurator(); -/** @var \XoopsModules\Modulebuilder\Common\Migrate $migrator */ $migrator = new \XoopsModules\Modulebuilder\Common\Migrate($configurator); $op = Request::getCmd('op', 'default'); diff --git a/admin/modules.php b/admin/modules.php index e7111728..b4f6c702 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -41,12 +41,12 @@ switch ($op) { case 'list': default: - $start = Request::getInt('start', 0); + $start = Request::getInt('start'); $limit = Request::getInt('limit', $helper->getConfig('modules_adminpager')); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new'); $adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_IMPORT, 'import_module.php', 'compfile'); @@ -70,7 +70,7 @@ if ($modulesCount > $limit) { require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new \XoopsPageNav($modulesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); } } else { $GLOBALS['xoopsTpl']->assign('error', \_AM_MODULEBUILDER_THEREARENT_MODULES); @@ -194,7 +194,7 @@ case 'edit': $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('modules.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_ADD, 'modules.php?op=new'); $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); @@ -257,7 +257,7 @@ } break; case 'clone': - $modIdSource = Request::getInt('mod_id', 0); + $modIdSource = Request::getInt('mod_id'); if ($modIdSource > 0) { //clone data table modules $modulesHandler = $helper->getHandler('Modules'); @@ -269,6 +269,7 @@ foreach ($sourceVars as $varKey => $varArray) { if ('mod_id' !== $varKey) { if (in_array($varKey, ['mod_name', 'mod_dirname'])) { + $uniqValue = ''; for ($i = 1; $i <= 10; $i++) { $uniqValue = $varArray['value'] . $i; $result = $GLOBALS['xoopsDB']->query( diff --git a/admin/morefiles.php b/admin/morefiles.php index 60a38c00..6a2abf1b 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -34,12 +34,12 @@ switch ($op) { case 'list': default: - $start = \Xmf\Request::getInt('start', 0); + $start = \Xmf\Request::getInt('start'); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('morefiles_adminpager')); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_MORE_FILES_ADD, 'morefiles.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_MORE_FILES_ADD, 'morefiles.php?op=new'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgfile_url', TDMC_UPLOAD_IMGMOD_URL); @@ -62,7 +62,7 @@ if ($morefilesCount > $limit) { require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new \XoopsPageNav($morefilesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); } } else { $GLOBALS['xoopsTpl']->assign('error', \_AM_MODULEBUILDER_THEREARENT_MORE_FILES); @@ -114,7 +114,7 @@ case 'edit': $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_MORE_FILES_ADD, 'morefiles.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_MORE_FILES_ADD, 'morefiles.php?op=new'); $adminObject->addItemButton(\_AM_MODULEBUILDER_MORE_FILES_LIST, 'morefiles.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); diff --git a/admin/settings.php b/admin/settings.php index 449cf92a..7b57b7e9 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -34,12 +34,12 @@ switch ($op) { case 'list': default: - $start = \Xmf\Request::getInt('start', 0); + $start = \Xmf\Request::getInt('start'); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('settings_adminpager')); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); $GLOBALS['xoopsTpl']->assign('tdmc_url', TDMC_URL); @@ -57,7 +57,7 @@ if ($settingsCount > $limit) { require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new \XoopsPageNav($settingsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); } } else { $GLOBALS['xoopsTpl']->assign('error', \_AM_MODULEBUILDER_THEREARENT_SETTINGS); @@ -151,7 +151,7 @@ break; case 'edit': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_SETTINGS_ADD, 'settings.php?op=new'); $adminObject->addItemButton(\_AM_MODULEBUILDER_SETTINGS_LIST, 'settings.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $settingsObj = $helper->getHandler('Settings')->get($setId); @@ -178,7 +178,7 @@ } break; case 'display': - $setId = \Xmf\Request::getInt('set_id', 0); + $setId = \Xmf\Request::getInt('set_id'); if ($setId > 0) { $settingsHandler = $helper->getHandler('Settings'); $settingsObj = $settingsHandler->get($setId); diff --git a/admin/tables.php b/admin/tables.php index 272f3e82..bccd404a 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -36,19 +36,19 @@ $tableMid = \Xmf\Request::getInt('table_mid'); $tableName = \Xmf\Request::getInt('table_name'); $tableNumbFields = \Xmf\Request::getInt('table_nbfields'); -$tableFieldname = \Xmf\Request::getString('table_fieldname', ''); +$tableFieldname = \Xmf\Request::getString('table_fieldname'); switch ($op) { case 'list': default: - $start = \Xmf\Request::getInt('start', 0); + $start = \Xmf\Request::getInt('start'); $limit = \Xmf\Request::getInt('limit', $helper->getConfig('modules_adminpager')); $GLOBALS['xoTheme']->addStylesheet('modules/modulebuilder/assets/css/admin/style.css'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js'); $GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/sortable.js'); $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $GLOBALS['xoopsTpl']->assign('tdmc_upload_imgmod_url', TDMC_UPLOAD_IMGMOD_URL); $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); @@ -59,7 +59,7 @@ \redirect_header('modules.php?op=new', 10, \_AM_MODULEBUILDER_THEREARENT_MODULES2); } $modulesAll = $helper->getHandler('Modules')->getAllModules($start, $limit); - $tablesCount = $helper->getHandler('Tables')->getObjects(null); + $tablesCount = $helper->getHandler('Tables')->getObjects(); // Redirect if there aren't tables if (0 == $tablesCount) { \redirect_header('tables.php?op=new', 10, \_AM_MODULEBUILDER_THEREARENT_TABLES2); @@ -92,7 +92,7 @@ if ($modulesCount > $limit) { require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new \XoopsPageNav($modulesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); } } else { $GLOBALS['xoopsTpl']->assign('error', \_AM_MODULEBUILDER_THEREARENT_TABLES); @@ -214,7 +214,7 @@ break; case 'edit': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('tables.php')); - $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new', 'add'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_ADD, 'tables.php?op=new'); $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_LIST, 'tables.php?op=list', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); @@ -241,7 +241,6 @@ unset($i); } exit; - break; case 'delete': $tablesObj = $helper->getHandler('Tables')->get($tableId); if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { diff --git a/class/Building.php b/class/Building.php index 6ea687ca..37d5c1ce 100644 --- a/class/Building.php +++ b/class/Building.php @@ -62,7 +62,7 @@ public function getForm($action = false) \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm(\_AM_MODULEBUILDER_ADMIN_CONST, 'buildform', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); - $moduleObj = $helper->getHandler('Modules')->getObjects(null); + $moduleObj = $helper->getHandler('Modules')->getObjects(); $mod_select = new \XoopsFormSelect(\_AM_MODULEBUILDER_CONST_MODULES, 'mod_id', 'mod_id'); $mod_select->addOption('', \_AM_MODULEBUILDER_BUILD_MODSELOPT); foreach ($moduleObj as $mod) { diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index bcab7155..1f6a884d 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -38,8 +38,8 @@ */ class Breadcrumb { - public $dirname; - private $bread = []; + public string $dirname; + private array $bread = []; public function __construct() { diff --git a/class/Common/ModuleFeedback.php b/class/Common/ModuleFeedback.php index 747d2451..76e8b806 100644 --- a/class/Common/ModuleFeedback.php +++ b/class/Common/ModuleFeedback.php @@ -84,7 +84,7 @@ public function getFormFeedback() $form->addElement($your_mail); $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); - $fbtypeSelect->addOption('', ''); + $fbtypeSelect->addOption(''); $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION')); $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS')); $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL')); diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index 7b00512c..b1f73a02 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -53,6 +53,7 @@ class TableChecker extends \XoopsObject /** * @param \XoopsModules\Modulebuilder\Common\TableChecker|null + * @param int $checktype */ public function __construct($mydirname, $checktype = 0) { @@ -167,9 +168,9 @@ private function readSQLFile() private function extractKey($line) { //todo: split string into single keys $needle = '('; - $key_text = \substr($line, \strpos($line, $needle, 0) + 1); + $key_text = \substr($line, \strpos($line, $needle) + 1); $needle = ')'; - $key_text = \substr($key_text, 0, \strpos($key_text, $needle, 0)); + $key_text = \substr($key_text, 0, \strpos($key_text, $needle)); return $key_text; diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 8f51a93f..c601834f 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -62,7 +62,7 @@ public static function hideButtons() $app = []; $app['displaySampleButton'] = 0; Yaml::save($app, $yamlFile); - \redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0); } public static function showButtons() @@ -71,6 +71,6 @@ public static function showButtons() $app = []; $app['displaySampleButton'] = 1; Yaml::save($app, $yamlFile); - \redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0); } } diff --git a/class/Devtools.php b/class/Devtools.php index e69452a2..508c747c 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -252,7 +252,6 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { /** * @param $src_path * @param $dst_path - * @param $moduleName */ public static function function_tabreplacer($src_path, $dst_path) { $patKeys = []; @@ -293,8 +292,7 @@ public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $pat * @param $dst_file * @param array $patKeys * @param array $patValues - * @param array $patValues - * @param bool $replaceTabs + * @param bool $replaceTabs */ private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues =[], $replaceTabs = false) { diff --git a/class/Fields.php b/class/Fields.php index 728d0719..ec742a77 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -230,7 +230,8 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $fieldAttributesSelect->addOptionArray($helper->getHandler('Fieldattributes')->getList()); $form->addElement(new Modulebuilder\Html\FormLabel('' . $fieldAttributesSelect->render() . '')); // Field Null - $value = (1 == $i) && (1 == $tableAutoincrement) ? '2' : '2'; + //$value = (1 == $i) && (1 == $tableAutoincrement) ? '2' : '2'; + $value = '2'; $fieldNullSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_FIELD_NULL, 'field_null[' . $i . ']', $value); $fieldNullSelect->addOptionArray($helper->getHandler('Fieldnull')->getList()); $form->addElement(new Modulebuilder\Html\FormLabel('' . $fieldNullSelect->render() . '')); diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index 21861dbe..b3ff8ee9 100644 --- a/class/Files/Admin/AdminBroken.php +++ b/class/Files/Admin/AdminBroken.php @@ -151,7 +151,7 @@ private function getAdminBrokenList($tables, $language, $t = '') $ret .= $this->xc->getXcCriteriaCompo($critName, $t); $constant = $this->xc->getXcGetConstants('STATUS_BROKEN'); $crit = $this->xc->getXcCriteria('', "'{$fieldSatus}'", $constant, '', true); - $ret .= $this->xc->getXcCriteriaAdd($critName, $crit, $t, "\n"); + $ret .= $this->xc->getXcCriteriaAdd($critName, $crit, $t); $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); $ret .= $this->xc->getXcXoopsTplAssign($tableName . '_count', "\${$tableName}Count", true, $t); $sprintf = $this->pc->getPhpCodeSprintf($language . 'BROKEN_RESULT', "'{$ucfTableName}'"); diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index 00f909a1..00ff84d8 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -144,7 +144,7 @@ private function getAdminIndex($module) $ret .= $this->pc->getPhpCodeCommentLine('Uploads Folders Created'); $boxLine = $this->axc->getAxcAddConfigBoxLine('$folder[$i]', 'folder', '', "\t"); $boxLine .= $this->axc->getAxcAddConfigBoxLine("[\$folder[\$i], '777']", 'chmod', '', "\t"); - $ret .= $this->pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, '') . PHP_EOL; + $ret .= $this->pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine) . PHP_EOL; } $ret .= $this->pc->getPhpCodeCommentLine('Render Index'); $ret .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')"); diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index 5586feba..4097055d 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -120,7 +120,7 @@ private function getPermissionsHeader($module, $language) $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getRequire('header'); + $ret .= $this->getRequire(); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Template Index'); $ret .= $this->axc->getAdminTemplateMain($moduleDirname, 'permissions'); diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 4d685619..386ff0be 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -242,7 +242,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; } @@ -277,9 +277,9 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->pc->getPhpCodeBlankLine(); $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); - $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); - $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t","\n"); - $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t","\n"); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); + $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t"); + $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t"); $func .= $this->pc->getPhpCodeCommentMultiLine([ 'If you want to filter your results by e.g. a category used in your' . $tableName => '', 'then you can activate the following code, but you have to change it according your category' => '' @@ -300,7 +300,7 @@ 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, '', false, ""); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, ''); return $ret; diff --git a/class/Files/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php index b5133180..8a0f434d 100644 --- a/class/Files/Blocks/BlocksFilesSpotlight.php +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -58,7 +58,7 @@ public function __construct() /** * @static function getInstance * @param null - * @return BlocksFiles + * @return false|BlocksFiles|BlocksFilesSpotlight */ public static function getInstance() { @@ -189,7 +189,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tablePermissions, $f $func .= $this->getSimpleString('return $block;',"\t"); $func .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_spotlight_show", '$options', $func, '', false, ""); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_spotlight_show", '$options', $func, ''); return $ret; } @@ -226,9 +226,9 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->pc->getPhpCodeBlankLine(); $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); - $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); - $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t","\n"); - $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t","\n"); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); + $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t"); + $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t"); $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); $func .= $this->pc->getPhpCodeUnset($critName, "\t"); $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    \"", '.',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.',"\t"); diff --git a/class/Files/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php index 8a0f434d..a4265f13 100644 --- a/class/Files/Blocks/BlocksFilesSpotlight.php +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -99,9 +99,8 @@ private function getBlocksShow($moduleDirname, $tableName, $tablePermissions, $f $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); - $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); //$func .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); + $func = $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); $func .= $this->xc->getXcEqualsOperator('$lenghtTitle', '$options[2]','',"\t"); @@ -212,8 +211,7 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $critName = 'cr' . $ucfTableName; $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); - $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); - $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); + $func = $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); $func .= $this->xc->getXcHandlerLine($tableName, "\t"); $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY_SPOTLIGHT . ' : '", '',"\t"); From 2d139589c2708ef53ef85a7b06dc1f71852ff93c Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 29 Dec 2021 16:59:15 +0100 Subject: [PATCH 196/266] devtools --- class/Devtools.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/class/Devtools.php b/class/Devtools.php index 26294c2d..ef848773 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -196,12 +196,10 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { $moduleNameUpper = \mb_strtoupper($moduleName); // module language defines $constants[] = [ - /* '_AM_' . $moduleNameUpper .'_', '_MI_' . $moduleNameUpper .'_', '_MB_' . $moduleNameUpper .'_', '_MA_' . $moduleNameUpper .'_', - */ $moduleNameUpper .'_', ]; @@ -261,16 +259,16 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { '\strr\chr(' => '\strrchr(', 'strf\time(' => 'strftime(', 'filem\time' => 'filemtime', - "'\_AM_\\" . $moduleNameUpper .'_' => "'_AM_" . $moduleNameUpper .'_', - "'\_MI_\\" . $moduleNameUpper .'_' => "'_MI_" . $moduleNameUpper .'_', - "'\_MB_\\" . $moduleNameUpper .'_' => "'_MB_" . $moduleNameUpper .'_', - "'\_MA_\\" . $moduleNameUpper .'_' => "'_MA_" . $moduleNameUpper .'_', "_AM_\\" . $moduleNameUpper .'_' => "_AM_" . $moduleNameUpper .'_', "_MI_\\" . $moduleNameUpper .'_' => "_MI_" . $moduleNameUpper .'_', "_MB_\\" . $moduleNameUpper .'_' => "_MB_" . $moduleNameUpper .'_', "_MA_\\" . $moduleNameUpper .'_' => "_MA_" . $moduleNameUpper .'_', "CO_\\" . $moduleNameUpper .'_' => "CO_" . $moduleNameUpper .'_', "'\\" . $moduleNameUpper .'_' => "'" . $moduleNameUpper .'_', + "'\_AM_\\" . $moduleNameUpper .'_' => "'_AM_" . $moduleNameUpper .'_', + "'\_MI_\\" . $moduleNameUpper .'_' => "'_MI_" . $moduleNameUpper .'_', + "'\_MB_\\" . $moduleNameUpper .'_' => "'_MB_" . $moduleNameUpper .'_', + "'\_MA_\\" . $moduleNameUpper .'_' => "'_MA_" . $moduleNameUpper .'_', 'namespace \XoopsModules' => 'namespace XoopsModules', 'use \Xoops' => 'use Xoops', "'\XOOPS_" => "'XOOPS_", From 3773bece580609e21fda194d1bec2d21777716bb Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 29 Dec 2021 17:34:12 +0100 Subject: [PATCH 197/266] devtools --- class/Devtools.php | 1 + 1 file changed, 1 insertion(+) diff --git a/class/Devtools.php b/class/Devtools.php index ef848773..11571c99 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -235,6 +235,7 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { $misc = [ 'new Criteria(' => 'new \Criteria(', 'new CriteriaCompo(' => 'new \CriteriaCompo(', + "\define('\\" => "\define('", ]; // repair known errors From dd406b185a6ead964a3ac6076bda86d386d45a60 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sun, 2 Jan 2022 09:42:20 +0100 Subject: [PATCH 198/266] XoopsConfirm to Confirm --- admin/modules.php | 4 +- admin/morefiles.php | 4 +- admin/settings.php | 4 +- admin/tables.php | 4 +- .../Common/{XoopsConfirm.php => Confirm.php} | 38 ++++++++++++------- class/Files/CreateXoopsCode.php | 4 +- .../Common/{XoopsConfirm.php => Confirm.php} | 38 ++++++++++++------- 7 files changed, 58 insertions(+), 38 deletions(-) rename class/Common/{XoopsConfirm.php => Confirm.php} (69%) rename files/commonfiles/class/Common/{XoopsConfirm.php => Confirm.php} (69%) diff --git a/admin/modules.php b/admin/modules.php index b4f6c702..54bb4c55 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -230,12 +230,12 @@ $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm( + $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $modulesObj->getVar('mod_name') ); - $form = $xoopsconfirm->getFormXoopsConfirm(); + $form = $xoopsconfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/admin/morefiles.php b/admin/morefiles.php index 6a2abf1b..4c15b06b 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -134,10 +134,10 @@ $GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm( + $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $morefilesObj->getVar('file_name') ); - $form = $xoopsconfirm->getFormXoopsConfirm(); + $form = $xoopsconfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/admin/settings.php b/admin/settings.php index 7b57b7e9..ff95f1ec 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -170,10 +170,10 @@ $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm( + $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $settingsObj->getVar('set_name') ); - $form = $xoopsconfirm->getFormXoopsConfirm(); + $form = $xoopsconfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/admin/tables.php b/admin/tables.php index bccd404a..acbbba45 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -272,10 +272,10 @@ $GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm( + $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'table_id' => $tableId, 'table_mid' => $tableMid, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $tablesObj->getVar('table_name') ); - $form = $xoopsconfirm->getFormXoopsConfirm(); + $form = $xoopsconfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/class/Common/XoopsConfirm.php b/class/Common/Confirm.php similarity index 69% rename from class/Common/XoopsConfirm.php rename to class/Common/Confirm.php index ad2c696a..46960ded 100644 --- a/class/Common/XoopsConfirm.php +++ b/class/Common/Confirm.php @@ -13,24 +13,32 @@ */ /** - * My Module module for xoops + * Custom form confirm for XOOPS modules * * @copyright 2020 XOOPS Project (https://xoops.org) * @license GPL 2.0 or later - * @package Modulebuilder + * @package general * @since 1.0 * @min_xoops 2.5.9 * @author Goffy - Email: - Website: + * + * + * Example: + $xoopsconfirm = new Common\Confirm( + ['ok' => 1, 'item_id' => $itemId, 'op' => 'delete'], + $_SERVER['REQUEST_URI'], + \sprintf(\_MA_MYMODULE_FORM_SURE_DELETE, + $itemsObj->getCaption())); + $form = $xoopsconfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); */ -use XoopsModules\Modulebuilder; - \defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** - * Class Object XoopsConfirm + * Class Object Confirm */ -class XoopsConfirm +class Confirm { private $hiddens = []; private $action = ''; @@ -56,15 +64,17 @@ public function __construct($hiddens, $action, $object, $title = '', $label = '' } /** - * @public function getXoopsConfirm + * @public function getFormConfirm * @return \XoopsThemeForm */ - public function getFormXoopsConfirm() + public function getFormConfirm() { + $moduleDirName = \basename(__DIR__); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); //in order to be accessable from user and admin area this should be place in language common.php - if (!\defined('CO_MODULEBUILDER_DELETE_CONFIRM')) { - \define('CO_MODULEBUILDER_DELETE_CONFIRM', 'Confirm delete'); - \define('CO_MODULEBUILDER_DELETE_LABEL', 'Do you really want to delete:'); + if (!\defined('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM')) { + \define('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM', 'Confirm delete'); + \define('CO_' . $moduleDirNameUpper . '_DELETE_LABEL', 'Do you really want to delete:'); } // Get Theme Form @@ -72,15 +82,15 @@ public function getFormXoopsConfirm() $this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } if ('' === $this->title) { - $this->title = \CO_MODULEBUILDER_DELETE_CONFIRM; + $this->title = \constant('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM'); } if ('' === $this->label) { - $this->label = \CO_MODULEBUILDER_DELETE_LABEL; + $this->label = \constant('CO_' . $moduleDirNameUpper . '_DELETE_LABEL'); } \xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($this->title, 'formXoopsConfirm', $this->action, 'post', true); + $form = new \XoopsThemeForm($this->title, 'formConfirm', $this->action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new \XoopsFormLabel($this->label, $this->object)); //hiddens diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index a8cff5e3..de710d75 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1038,12 +1038,12 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $server = $pc->getPhpCodeGlobalsVariables('REQUEST_URI', 'SERVER'); $getVar = $this->getXcGetVar('', $tableName . 'Obj', $fieldMain, true); $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, $getVar); - $confirm = 'new Common\XoopsConfirm(' . "\n"; + $confirm = 'new Common\Confirm(' . "\n"; $confirm .= $t . "\t" . $array . ",\n"; $confirm .= $t . "\t" . $server . ",\n"; $confirm .= $t . "\t" . $sprintf . ')'; $ret = $xc->getXcEqualsOperator('$xoopsconfirm', $confirm, '', $t); - $ret .= $xc->getXcEqualsOperator('$form', '$xoopsconfirm->getFormXoopsConfirm()', '', $t); + $ret .= $xc->getXcEqualsOperator('$form', '$xoopsconfirm->getFormConfirm()', '', $t); $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); return $ret; } diff --git a/files/commonfiles/class/Common/XoopsConfirm.php b/files/commonfiles/class/Common/Confirm.php similarity index 69% rename from files/commonfiles/class/Common/XoopsConfirm.php rename to files/commonfiles/class/Common/Confirm.php index ad2c696a..46960ded 100644 --- a/files/commonfiles/class/Common/XoopsConfirm.php +++ b/files/commonfiles/class/Common/Confirm.php @@ -13,24 +13,32 @@ */ /** - * My Module module for xoops + * Custom form confirm for XOOPS modules * * @copyright 2020 XOOPS Project (https://xoops.org) * @license GPL 2.0 or later - * @package Modulebuilder + * @package general * @since 1.0 * @min_xoops 2.5.9 * @author Goffy - Email: - Website: + * + * + * Example: + $xoopsconfirm = new Common\Confirm( + ['ok' => 1, 'item_id' => $itemId, 'op' => 'delete'], + $_SERVER['REQUEST_URI'], + \sprintf(\_MA_MYMODULE_FORM_SURE_DELETE, + $itemsObj->getCaption())); + $form = $xoopsconfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); */ -use XoopsModules\Modulebuilder; - \defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** - * Class Object XoopsConfirm + * Class Object Confirm */ -class XoopsConfirm +class Confirm { private $hiddens = []; private $action = ''; @@ -56,15 +64,17 @@ public function __construct($hiddens, $action, $object, $title = '', $label = '' } /** - * @public function getXoopsConfirm + * @public function getFormConfirm * @return \XoopsThemeForm */ - public function getFormXoopsConfirm() + public function getFormConfirm() { + $moduleDirName = \basename(__DIR__); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); //in order to be accessable from user and admin area this should be place in language common.php - if (!\defined('CO_MODULEBUILDER_DELETE_CONFIRM')) { - \define('CO_MODULEBUILDER_DELETE_CONFIRM', 'Confirm delete'); - \define('CO_MODULEBUILDER_DELETE_LABEL', 'Do you really want to delete:'); + if (!\defined('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM')) { + \define('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM', 'Confirm delete'); + \define('CO_' . $moduleDirNameUpper . '_DELETE_LABEL', 'Do you really want to delete:'); } // Get Theme Form @@ -72,15 +82,15 @@ public function getFormXoopsConfirm() $this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } if ('' === $this->title) { - $this->title = \CO_MODULEBUILDER_DELETE_CONFIRM; + $this->title = \constant('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM'); } if ('' === $this->label) { - $this->label = \CO_MODULEBUILDER_DELETE_LABEL; + $this->label = \constant('CO_' . $moduleDirNameUpper . '_DELETE_LABEL'); } \xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($this->title, 'formXoopsConfirm', $this->action, 'post', true); + $form = new \XoopsThemeForm($this->title, 'formConfirm', $this->action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new \XoopsFormLabel($this->label, $this->object)); //hiddens From b82f1ff38ed057ae1b2b242641c8683f76894180 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sun, 2 Jan 2022 16:19:01 +0100 Subject: [PATCH 199/266] replaced XoopsConfirm --- admin/modules.php | 4 ++-- admin/morefiles.php | 4 ++-- admin/settings.php | 4 ++-- admin/tables.php | 4 ++-- class/Common/Confirm.php | 4 ++-- class/Files/CreateXoopsCode.php | 4 ++-- docs/changelog.txt | 1 + files/commonfiles/class/Common/Confirm.php | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/admin/modules.php b/admin/modules.php index 54bb4c55..3295f769 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -230,12 +230,12 @@ $GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $modulesObj->getVar('mod_name') ); - $form = $xoopsconfirm->getFormConfirm(); + $form = $customConfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/admin/morefiles.php b/admin/morefiles.php index 4c15b06b..315b5556 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -134,10 +134,10 @@ $GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $morefilesObj->getVar('file_name') ); - $form = $xoopsconfirm->getFormConfirm(); + $form = $customConfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/admin/settings.php b/admin/settings.php index ff95f1ec..4e4247f7 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -170,10 +170,10 @@ $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $settingsObj->getVar('set_name') ); - $form = $xoopsconfirm->getFormConfirm(); + $form = $customConfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/admin/tables.php b/admin/tables.php index acbbba45..a287e1ba 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -272,10 +272,10 @@ $GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors()); } } else { - $xoopsconfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( ['ok' => 1, 'table_id' => $tableId, 'table_mid' => $tableMid, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $tablesObj->getVar('table_name') ); - $form = $xoopsconfirm->getFormConfirm(); + $form = $customConfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; diff --git a/class/Common/Confirm.php b/class/Common/Confirm.php index 46960ded..56f11e78 100644 --- a/class/Common/Confirm.php +++ b/class/Common/Confirm.php @@ -24,12 +24,12 @@ * * * Example: - $xoopsconfirm = new Common\Confirm( + $customConfirm = new Common\Confirm( ['ok' => 1, 'item_id' => $itemId, 'op' => 'delete'], $_SERVER['REQUEST_URI'], \sprintf(\_MA_MYMODULE_FORM_SURE_DELETE, $itemsObj->getCaption())); - $form = $xoopsconfirm->getFormConfirm(); + $form = $customConfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); */ diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index de710d75..412fad41 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1042,8 +1042,8 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $confirm .= $t . "\t" . $array . ",\n"; $confirm .= $t . "\t" . $server . ",\n"; $confirm .= $t . "\t" . $sprintf . ')'; - $ret = $xc->getXcEqualsOperator('$xoopsconfirm', $confirm, '', $t); - $ret .= $xc->getXcEqualsOperator('$form', '$xoopsconfirm->getFormConfirm()', '', $t); + $ret = $xc->getXcEqualsOperator('$customConfirm', $confirm, '', $t); + $ret .= $xc->getXcEqualsOperator('$form', '$customConfirm->getFormConfirm()', '', $t); $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); return $ret; } diff --git a/docs/changelog.txt b/docs/changelog.txt index dc620c81..a16cac71 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -14,6 +14,7 @@ - code cleaning (PS inspect code) (goffy) - fixed bug in guests (goffy) - removed redundant params from Request (goffy) +- replaced Common/XoopsConfirm by Common/Confirm(mamba/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/files/commonfiles/class/Common/Confirm.php b/files/commonfiles/class/Common/Confirm.php index 46960ded..56f11e78 100644 --- a/files/commonfiles/class/Common/Confirm.php +++ b/files/commonfiles/class/Common/Confirm.php @@ -24,12 +24,12 @@ * * * Example: - $xoopsconfirm = new Common\Confirm( + $customConfirm = new Common\Confirm( ['ok' => 1, 'item_id' => $itemId, 'op' => 'delete'], $_SERVER['REQUEST_URI'], \sprintf(\_MA_MYMODULE_FORM_SURE_DELETE, $itemsObj->getCaption())); - $form = $xoopsconfirm->getFormConfirm(); + $form = $customConfirm->getFormConfirm(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); */ From da51e4d8a8760576aba5b23995ff07680b9920bb Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 3 Jan 2022 09:54:24 +0100 Subject: [PATCH 200/266] table renaming in fieldelements --- admin/tables.php | 15 +++++++++++++++ admin/test.php | 44 -------------------------------------------- docs/changelog.txt | 1 + 3 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 admin/test.php diff --git a/admin/tables.php b/admin/tables.php index a287e1ba..388517be 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -204,6 +204,21 @@ } \redirect_header('fields.php?op=new' . $tableAction, 5, \sprintf(\_AM_MODULEBUILDER_TABLE_FORM_CREATED_OK, \Xmf\Request::getString('table_name', '', 'POST'))); } else { + // table exists, recreate fieldelement_name/fieldelement_value in order to catch changes of table name + $crFieldelements = new \CriteriaCompo(); + $crFieldelements->add(new \Criteria('fieldelement_mid', $tableMid)); + $crFieldelements->add(new \Criteria('fieldelement_tid', $tableId)); + $fieldelementsAll = $helper->getHandler('Fieldelements')->getAll($crFieldelements); + foreach (\array_keys($fieldelementsAll) as $feid) { + $fieldelementObj = $helper->getHandler('Fieldelements')->get($feid); + $fieldelementObj->setVar('fieldelement_name', 'Table : ' . \ucfirst(\Xmf\Request::getString('table_name', '', 'POST'))); + $fieldelementObj->setVar('fieldelement_value', 'XoopsFormTables-' . \ucfirst(\Xmf\Request::getString('table_name', '', 'POST'))); + // Insert new field element id for table name + if (!$helper->getHandler('Fieldelements')->insert($fieldelementObj)) { + $GLOBALS['xoopsTpl']->assign('error', $fieldelementObj->getHtmlErrors() . ' Field element'); + } + } + \redirect_header('tables.php', 5, \sprintf(\_AM_MODULEBUILDER_TABLE_FORM_UPDATED_OK, \Xmf\Request::getString('table_name', '', 'POST'))); } } diff --git a/admin/test.php b/admin/test.php deleted file mode 100644 index 5602d766..00000000 --- a/admin/test.php +++ /dev/null @@ -1,44 +0,0 @@ -processSQL(); - -/* -use XoopsModules\Wgdiaries\Common\TableChecker; - $tablechecker = new \XoopsModules\Wgdiaries\Common\TableChecker('wgdiaries', 1); - $result = $tablechecker->processSQL(); - */ - -var_dump($result); - -require __DIR__ . '/footer.php'; diff --git a/docs/changelog.txt b/docs/changelog.txt index a16cac71..00c7581b 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -15,6 +15,7 @@ - fixed bug in guests (goffy) - removed redundant params from Request (goffy) - replaced Common/XoopsConfirm by Common/Confirm(mamba/goffy) +- table renaming in fieldelements (goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From 3e761528744322adcd291bfd1524126394807bf5 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 3 Jan 2022 12:04:51 +0100 Subject: [PATCH 201/266] added new fieldelements integer/float --- assets/js/functions.js | 7 +- class/Constants.php | 4 +- class/Fieldelements.php | 2 + class/Fields.php | 4 +- class/Files/Classes/ClassFormElements.php | 2 + docs/changelog.txt | 1 + include/update.php | 131 ++++++++++++++++-- language/english/admin.php | 2 + sql/mysql.sql | 61 ++++---- .../english/modulebuilder_fieldelements.yml | 124 ++++++++++++----- testdata/english/modulebuilder_modules.yml | 4 +- 11 files changed, 261 insertions(+), 81 deletions(-) diff --git a/assets/js/functions.js b/assets/js/functions.js index e104d353..73410285 100644 --- a/assets/js/functions.js +++ b/assets/js/functions.js @@ -102,7 +102,8 @@ function presetField(typeId) { vselected = eleSelected.value; defaultType = xoopsGetElementById('fe_defaulttype[' + vselected + ']').value; defaultValue = xoopsGetElementById('fe_defaultvalue[' + vselected + ']').value; - eleType = xoopsGetElementById('field_type[' + typeId + ']').value = defaultType; - eleValue = xoopsGetElementById('field_value[' + typeId + ']').value = defaultValue; - + defaultField = xoopsGetElementById('fe_defaultfield[' + vselected + ']').value; + xoopsGetElementById('field_type[' + typeId + ']').value = defaultType; + xoopsGetElementById('field_value[' + typeId + ']').value = defaultValue; + xoopsGetElementById('field_default[' + typeId + ']').value = defaultField; } diff --git a/class/Constants.php b/class/Constants.php index 3d5f895d..74b74308 100644 --- a/class/Constants.php +++ b/class/Constants.php @@ -32,7 +32,7 @@ interface Constants const MORE_FILES_TYPE_EMPTY = 1; const MORE_FILES_TYPE_COPY = 2; - const FIRST_FIELDELEMENT_TABLE = 30; + const FIRST_FIELDELEMENT_TABLE = 31; // ------------------- Field elements --------------------------------- // --------- The values MUST BE IDENTICAL to fieldelement_id ---------- @@ -63,5 +63,7 @@ interface Constants 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; } diff --git a/class/Fieldelements.php b/class/Fieldelements.php index e55bc2e1..37f0a8fd 100644 --- a/class/Fieldelements.php +++ b/class/Fieldelements.php @@ -44,6 +44,7 @@ public function __construct() $this->initVar('fieldelement_sort', XOBJ_DTYPE_INT); $this->initVar('fieldelement_deftype', XOBJ_DTYPE_TXTBOX); $this->initVar('fieldelement_defvalue', XOBJ_DTYPE_TXTBOX); + $this->initVar('fieldelement_deffield', XOBJ_DTYPE_TXTBOX); } /** @@ -93,6 +94,7 @@ public function getValuesFieldelements($keys = null, $format = null, $maxDepth = $ret['sort'] = $this->getVar('fieldelement_sort'); $ret['deftype'] = $this->getVar('fieldelement_deftype'); $ret['defvalue'] = $this->getVar('fieldelement_defvalue'); + $ret['deffield'] = $this->getVar('fieldelement_deffield'); return $ret; } diff --git a/class/Fields.php b/class/Fields.php index ec742a77..dbdb0d67 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -185,7 +185,8 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, $fieldElements = $helper->getHandler('Fieldelements')->getAll(); foreach ($fieldElements as $fe) { $form->addElement(new \XoopsFormHidden('fe_defaulttype[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_deftype'))); - $form->addElement(new \XoopsFormHidden('fe_defaultvalue[' . $fe->getVar('fieldelement_id') . ']', "'" . $fe->getVar('fieldelement_defvalue') . "'")); + $form->addElement(new \XoopsFormHidden('fe_defaultvalue[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_defvalue'))); + $form->addElement(new \XoopsFormHidden('fe_defaultfield[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_deffield'))); } $form->addElement(new \XoopsFormHidden('field_id[' . $i . ']', 0)); $form->addElement(new \XoopsFormHidden('field_mid', $fieldMid)); @@ -363,6 +364,7 @@ public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false) foreach ($fieldElements as $fe) { $form->addElement(new \XoopsFormHidden('fe_defaulttype[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_deftype'))); $form->addElement(new \XoopsFormHidden('fe_defaultvalue[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_defvalue'))); + $form->addElement(new \XoopsFormHidden('fe_defaultfield[' . $fe->getVar('fieldelement_id') . ']', $fe->getVar('fieldelement_deffield'))); } $id = 1; foreach ($fields as $field) { diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 31b8bd6d..8e023f61 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -933,6 +933,8 @@ public function renderElements() case 1: break; case Constants::FIELD_ELE_TEXT: // textbox + case Constants::FIELD_ELE_TEXTINTEGER: // textbox integer + case Constants::FIELD_ELE_TEXTFLOAT: // textbox float case Constants::FIELD_ELE_TEXTCOMMENTS: // textbox comments case Constants::FIELD_ELE_TEXTRATINGS: // textbox ratings case Constants::FIELD_ELE_TEXTVOTES: // textbox votes diff --git a/docs/changelog.txt b/docs/changelog.txt index 00c7581b..a031d1bc 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -16,6 +16,7 @@ - removed redundant params from Request (goffy) - replaced Common/XoopsConfirm by Common/Confirm(mamba/goffy) - table renaming in fieldelements (goffy) +- added new fieldelements integer/float (goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/include/update.php b/include/update.php index b04e2206..f28f771f 100644 --- a/include/update.php +++ b/include/update.php @@ -397,16 +397,6 @@ function modulebuilder_check_db($module) } } - // set default values for form elements - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '255' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in(2, 10, 11, 12, 13, 14, 17)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 15, `fieldelement_defvalue` = '0' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in (3, 4)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 2, `fieldelement_defvalue` = '10' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in(5, 7, 8, 15, 20, 21, 22)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 2, `fieldelement_defvalue` = '1' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in(6, 16)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '7' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in(9)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '3' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in(18)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '100' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_id` in(19)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " SET `fieldelement_deftype` = 2, `fieldelement_defvalue` = '10' WHERE `xc_modulebuilder_fieldelements`.`fieldelement_mid` > 0"); - // update table 'modulebuilder_fields' $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fields'); $field = 'field_ifoot'; @@ -736,6 +726,127 @@ function modulebuilder_check_db($module) $ret = false; } + // update table 'modulebuilder_fieldelements' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); + $field = 'fieldelement_deffield'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` VARCHAR(5) NOT NULL DEFAULT '' AFTER `fieldelement_defvalue`;"; + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); + $module->setErrors("Error when adding '$field' to table '$table'."); + $ret = false; + } + } + + // new form field text votes + $fname = 'TextInteger'; + $fid = 29; + $fvalue = 'XoopsFormText'; + $fsort = 14; + $fdeftype = 2; + $fdefvalue = 10; + $fdeffield = 0; + $result = $xoopsDB->query( + 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + ); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows == 0) { + $result = $xoopsDB->query( + 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" + ); + $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, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; + $result = $xoopsDB->query($sql); + // update table fields to new id of previous 29 + $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 29 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}', `fieldelement_deffield` = '{$fdeffield}' 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; + $result = $xoopsDB->query($sql); + } + } + // new form field text votes + $fname = 'TextFloat'; + $fid = 30; + $fvalue = 'XoopsFormText'; + $fsort = 14; + $fdeftype = 6; + $fdefvalue = '16,2'; + $fdeffield = '0.00'; + $result = $xoopsDB->query( + 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + ); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows == 0) { + $result = $xoopsDB->query( + 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" + ); + $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, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; + $result = $xoopsDB->query($sql); + // update table fields to new id of previous 30 + $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 30 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}', `fieldelement_deffield` = '{$fdeffield}' 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; + $result = $xoopsDB->query($sql); + } + } + + // resorting elements + $sortElements = []; + $sortElements[] = 'Text'; + $sortElements[] = 'TextInteger'; + $sortElements[] = 'TextFloat'; + $sortElements[] = 'TextArea'; + $sortElements[] = 'DhtmlTextArea'; + $sortElements[] = 'CheckBox'; + $sortElements[] = 'RadioYN'; + $sortElements[] = 'Radio'; + $sortElements[] = 'SelectBox'; + $sortElements[] = 'SelectCombo'; + $sortElements[] = 'SelectUser'; + $sortElements[] = 'ImageList'; + $sortElements[] = 'SelectFile'; + $sortElements[] = 'UploadImage'; + $sortElements[] = 'UploadFile'; + $sortElements[] = 'UrlFile'; + $sortElements[] = 'DateTime'; + $sortElements[] = 'TextDateSelect'; + $sortElements[] = 'SelectStatus'; + $sortElements[] = 'SelectCountry'; + $sortElements[] = 'SelectLang'; + $sortElements[] = 'Password'; + $sortElements[] = 'ColorPicker'; + $sortElements[] = 'TextUuid'; + $sortElements[] = 'TextIp'; + $sortElements[] = 'TextComments'; + $sortElements[] = 'TextRatings'; + $sortElements[] = 'TextVotes'; + $sortElements[] = 'TextReads'; + foreach ($sortElements as $key => $sortElement) { + $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . ' SET `fieldelement_sort` = ' . ($key + 1) . ' WHERE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "`.`fieldelement_name` = '" . $sortElement . "'"); + + } + return $ret; } diff --git a/language/english/admin.php b/language/english/admin.php index b54c6f03..24931766 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -423,6 +423,8 @@ \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"); diff --git a/sql/mysql.sql b/sql/mysql.sql index 2ef1792c..6a9f266f 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -318,41 +318,44 @@ CREATE TABLE `modulebuilder_fieldelements` ( `fieldelement_sort` INT(1) UNSIGNED NOT NULL DEFAULT '0', `fieldelement_deftype` INT(10) UNSIGNED NOT NULL DEFAULT '0', `fieldelement_defvalue` VARCHAR(5) NULL DEFAULT NULL, + `fieldelement_deffield` VARCHAR(5) NOT NULL DEFAULT '', PRIMARY KEY (`fieldelement_id`), KEY `fieldelement_mid` (`fieldelement_mid`), KEY `fieldelement_tid` (`fieldelement_tid`) ) ENGINE = InnoDB; -INSERT INTO `modulebuilder_fieldelements` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`) VALUES -(1, 0, 0, '...', '', 0, 0, '0'), -(2, 0, 0, 'Text', 'XoopsFormText', 1, 14, '255'), -(3, 0, 0, 'TextArea', 'XoopsFormTextArea', 2, 15, '0'), -(4, 0, 0, 'DhtmlTextArea', 'XoopsFormDhtmlTextArea', 3, 15, '0'), -(5, 0, 0, 'CheckBox', 'XoopsFormCheckBox', 4, 2, '10'), -(6, 0, 0, 'RadioYN', 'XoopsFormRadioYN', 6, 2, '1'), -(7, 0, 0, 'SelectBox', 'XoopsFormSelect', 7, 2, '10'), -(8, 0, 0, 'SelectUser', 'XoopsFormSelectUser', 9, 2, '10'), -(9, 0, 0, 'ColorPicker', 'XoopsFormColorPicker', 19, 14, '7'), -(10, 0, 0, 'ImageList', 'XoopsFormImageList', 13, 14, '255'), -(11, 0, 0, 'SelectFile', 'XoopsFormSelectFile', 10, 14, '255'), -(12, 0, 0, 'UrlFile', 'XoopsFormUrlFile', 16, 14, '255'), -(13, 0, 0, 'UploadImage', 'XoopsFormUploadImage', 14, 14, '255'), -(14, 0, 0, 'UploadFile', 'XoopsFormUploadFile', 15, 14, '255'), -(15, 0, 0, 'TextDateSelect', 'XoopsFormTextDateSelect', 17, 2, '11'), -(16, 0, 0, 'SelectStatus', 'XoopsFormSelectStatus', 20, 2, '1'), -(17, 0, 0, 'Password', 'XoopsFormPassword', 21, 14, '255'), -(18, 0, 0, 'SelectCountry', 'XoopsFormSelectCountry', 11, 14, '3'), -(19, 0, 0, 'SelectLang', 'XoopsFormSelectLang', 12, 14, '100'), -(20, 0, 0, 'Radio', 'XoopsFormRadio', 5, 2, '10'), -(21, 0, 0, 'DateTime', 'XoopsFormDateTime', 18, 2, '11'), -(22, 0, 0, 'SelectCombo', 'XoopsFormSelectCombo', 8, 2, '10'), -(23, 0, 0, 'TextUuid', 'XoopsFormTextUuid', 22, 14, '45'), -(24, 0, 0, 'TextIp', 'XoopsFormTextIp', 23, 14, '45'), -(25, 0, 0, 'TextComments', 'XoopsFormTextComments', 24, 2, '10'), -(26, 0, 0, 'TextRatings', 'XoopsFormTextRatings', 25, 7, '10, 2'), -(27, 0, 0, 'TextVotes', 'XoopsFormTextVotes', 26, 2, '10'), -(28, 0, 0, 'TextReads', 'XoopsFormTextReads', 27, 2, '10'); +INSERT INTO `modulebuilder_fieldelements` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`, `fieldelement_sort`, `fieldelement_deftype`, `fieldelement_defvalue`, `fieldelement_deffield`) VALUES +(1, 0, 0, '...', '', 0, 0, '0', ''), +(2, 0, 0, 'Text', 'XoopsFormText', 1, 14, '255', ''), +(3, 0, 0, 'TextArea', 'XoopsFormTextArea', 4, 15, '0', ''), +(4, 0, 0, 'DhtmlTextArea', 'XoopsFormDhtmlTextArea', 5, 15, '0', ''), +(5, 0, 0, 'CheckBox', 'XoopsFormCheckBox', 6, 2, '10', ''), +(6, 0, 0, 'RadioYN', 'XoopsFormRadioYN', 7, 2, '1', ''), +(7, 0, 0, 'SelectBox', 'XoopsFormSelect', 9, 2, '10', ''), +(8, 0, 0, 'SelectUser', 'XoopsFormSelectUser', 11, 2, '10', ''), +(9, 0, 0, 'ColorPicker', 'XoopsFormColorPicker', 23, 14, '7', ''), +(10, 0, 0, 'ImageList', 'XoopsFormImageList', 12, 14, '255', ''), +(11, 0, 0, 'SelectFile', 'XoopsFormSelectFile', 13, 14, '255', ''), +(12, 0, 0, 'UrlFile', 'XoopsFormUrlFile', 16, 14, '255', ''), +(13, 0, 0, 'UploadImage', 'XoopsFormUploadImage', 14, 14, '255', ''), +(14, 0, 0, 'UploadFile', 'XoopsFormUploadFile', 15, 14, '255', ''), +(15, 0, 0, 'TextDateSelect', 'XoopsFormTextDateSelect', 18, 2, '11', ''), +(16, 0, 0, 'SelectStatus', 'XoopsFormSelectStatus', 19, 2, '1', ''), +(17, 0, 0, 'Password', 'XoopsFormPassword', 22, 14, '255', ''), +(18, 0, 0, 'SelectCountry', 'XoopsFormSelectCountry', 20, 14, '3', ''), +(19, 0, 0, 'SelectLang', 'XoopsFormSelectLang', 21, 14, '100', ''), +(20, 0, 0, 'Radio', 'XoopsFormRadio', 8, 2, '10', ''), +(21, 0, 0, 'DateTime', 'XoopsFormDateTime', 17, 2, '11', ''), +(22, 0, 0, 'SelectCombo', 'XoopsFormSelectCombo', 10, 2, '10', ''), +(23, 0, 0, 'TextUuid', 'XoopsFormTextUuid', 24, 14, '45', ''), +(24, 0, 0, 'TextIp', 'XoopsFormTextIp', 25, 14, '45', ''), +(25, 0, 0, 'TextComments', 'XoopsFormTextComments', 26, 2, '10', ''), +(26, 0, 0, 'TextRatings', 'XoopsFormTextRatings', 27, 7, '10, 2', ''), +(27, 0, 0, 'TextVotes', 'XoopsFormTextVotes', 28, 2, '10', ''), +(28, 0, 0, 'TextReads', 'XoopsFormTextReads', 29, 2, '10', ''), +(29, 0, 0, 'TextInteger', 'XoopsFormText', 2, 2, '10', '0'), +(30, 0, 0, 'TextFloat', 'XoopsFormText', 3, 6, '16,2', '0.00'); # # Table structure for table `modulebuilder_morefiles` 5 diff --git a/testdata/english/modulebuilder_fieldelements.yml b/testdata/english/modulebuilder_fieldelements.yml index 9e96d63a..dea98e8f 100644 --- a/testdata/english/modulebuilder_fieldelements.yml +++ b/testdata/english/modulebuilder_fieldelements.yml @@ -7,6 +7,7 @@ fieldelement_sort: '0' fieldelement_deftype: '0' fieldelement_defvalue: '0' + fieldelement_deffield: '' - fieldelement_id: '2' fieldelement_mid: '0' @@ -16,87 +17,97 @@ fieldelement_sort: '1' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '3' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextArea fieldelement_value: XoopsFormTextArea - fieldelement_sort: '2' + fieldelement_sort: '4' fieldelement_deftype: '15' fieldelement_defvalue: '0' + fieldelement_deffield: '' - fieldelement_id: '4' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: DhtmlTextArea fieldelement_value: XoopsFormDhtmlTextArea - fieldelement_sort: '3' + fieldelement_sort: '5' fieldelement_deftype: '15' fieldelement_defvalue: '0' + fieldelement_deffield: '' - fieldelement_id: '5' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: CheckBox fieldelement_value: XoopsFormCheckBox - fieldelement_sort: '4' + fieldelement_sort: '6' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '6' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: RadioYN fieldelement_value: XoopsFormRadioYN - fieldelement_sort: '6' + fieldelement_sort: '7' fieldelement_deftype: '2' fieldelement_defvalue: '1' + fieldelement_deffield: '' - fieldelement_id: '7' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectBox fieldelement_value: XoopsFormSelect - fieldelement_sort: '7' + fieldelement_sort: '9' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '8' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectUser fieldelement_value: XoopsFormSelectUser - fieldelement_sort: '9' + fieldelement_sort: '11' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '9' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: ColorPicker fieldelement_value: XoopsFormColorPicker - fieldelement_sort: '19' + fieldelement_sort: '23' fieldelement_deftype: '14' fieldelement_defvalue: '7' + fieldelement_deffield: '' - fieldelement_id: '10' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: ImageList fieldelement_value: XoopsFormImageList - fieldelement_sort: '13' + fieldelement_sort: '12' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '11' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectFile fieldelement_value: XoopsFormSelectFile - fieldelement_sort: '10' + fieldelement_sort: '13' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '12' fieldelement_mid: '0' @@ -106,6 +117,7 @@ fieldelement_sort: '16' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '13' fieldelement_mid: '0' @@ -115,6 +127,7 @@ fieldelement_sort: '14' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '14' fieldelement_mid: '0' @@ -124,150 +137,167 @@ fieldelement_sort: '15' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '15' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextDateSelect fieldelement_value: XoopsFormTextDateSelect - fieldelement_sort: '17' + fieldelement_sort: '18' fieldelement_deftype: '2' fieldelement_defvalue: '11' + fieldelement_deffield: '' - fieldelement_id: '16' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectStatus fieldelement_value: XoopsFormSelectStatus - fieldelement_sort: '20' + fieldelement_sort: '19' fieldelement_deftype: '2' fieldelement_defvalue: '1' + fieldelement_deffield: '' - fieldelement_id: '17' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: Password fieldelement_value: XoopsFormPassword - fieldelement_sort: '21' + fieldelement_sort: '22' fieldelement_deftype: '14' fieldelement_defvalue: '255' + fieldelement_deffield: '' - fieldelement_id: '18' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectCountry fieldelement_value: XoopsFormSelectCountry - fieldelement_sort: '11' + fieldelement_sort: '20' fieldelement_deftype: '14' fieldelement_defvalue: '3' + fieldelement_deffield: '' - fieldelement_id: '19' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectLang fieldelement_value: XoopsFormSelectLang - fieldelement_sort: '12' + fieldelement_sort: '21' fieldelement_deftype: '14' fieldelement_defvalue: '100' + fieldelement_deffield: '' - fieldelement_id: '20' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: Radio fieldelement_value: XoopsFormRadio - fieldelement_sort: '5' + fieldelement_sort: '8' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '21' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: DateTime fieldelement_value: XoopsFormDateTime - fieldelement_sort: '18' + fieldelement_sort: '17' fieldelement_deftype: '2' fieldelement_defvalue: '11' + fieldelement_deffield: '' - fieldelement_id: '22' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: SelectCombo fieldelement_value: XoopsFormSelectCombo - fieldelement_sort: '8' + fieldelement_sort: '10' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '23' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextUuid fieldelement_value: XoopsFormTextUuid - fieldelement_sort: '22' + fieldelement_sort: '24' fieldelement_deftype: '14' fieldelement_defvalue: '45' + fieldelement_deffield: '' - fieldelement_id: '24' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextIp fieldelement_value: XoopsFormTextIp - fieldelement_sort: '23' + fieldelement_sort: '25' fieldelement_deftype: '14' fieldelement_defvalue: '45' + fieldelement_deffield: '' - fieldelement_id: '25' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextComments fieldelement_value: XoopsFormTextComments - fieldelement_sort: '24' + fieldelement_sort: '26' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '26' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextRatings fieldelement_value: XoopsFormTextRatings - fieldelement_sort: '25' + fieldelement_sort: '27' fieldelement_deftype: '7' fieldelement_defvalue: '10, 2' + fieldelement_deffield: '' - fieldelement_id: '27' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextVotes fieldelement_value: XoopsFormTextVotes - fieldelement_sort: '26' + fieldelement_sort: '28' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '28' fieldelement_mid: '0' fieldelement_tid: '0' fieldelement_name: TextReads fieldelement_value: XoopsFormTextReads - fieldelement_sort: '27' + fieldelement_sort: '29' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '29' - fieldelement_mid: '2' - fieldelement_tid: '5' - fieldelement_name: 'Table : Articles' - fieldelement_value: XoopsFormTables-Articles - fieldelement_sort: '0' + fieldelement_mid: '0' + fieldelement_tid: '0' + fieldelement_name: TextInteger + fieldelement_value: XoopsFormText + fieldelement_sort: '2' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '0' - fieldelement_id: '30' - fieldelement_mid: '2' - fieldelement_tid: '6' - fieldelement_name: 'Table : Testfields' - fieldelement_value: XoopsFormTables-Testfields - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' + fieldelement_mid: '0' + fieldelement_tid: '0' + fieldelement_name: TextFloat + fieldelement_value: XoopsFormText + fieldelement_sort: '3' + fieldelement_deftype: '6' + fieldelement_defvalue: '16,2' + fieldelement_deffield: '0.00' - fieldelement_id: '31' fieldelement_mid: '1' @@ -277,6 +307,7 @@ fieldelement_sort: '0' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '32' fieldelement_mid: '1' @@ -286,6 +317,7 @@ fieldelement_sort: '0' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '33' fieldelement_mid: '1' @@ -295,6 +327,7 @@ fieldelement_sort: '0' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' - fieldelement_id: '34' fieldelement_mid: '2' @@ -304,3 +337,24 @@ fieldelement_sort: '0' fieldelement_deftype: '2' fieldelement_defvalue: '10' + fieldelement_deffield: '' +- + fieldelement_id: '35' + fieldelement_mid: '2' + fieldelement_tid: '5' + fieldelement_name: 'Table : Articles' + fieldelement_value: XoopsFormTables-Articles + fieldelement_sort: '0' + fieldelement_deftype: '2' + fieldelement_defvalue: '10' + fieldelement_deffield: '' +- + fieldelement_id: '36' + fieldelement_mid: '2' + fieldelement_tid: '6' + fieldelement_name: 'Table : Testfields' + fieldelement_value: XoopsFormTables-Testfields + fieldelement_sort: '0' + fieldelement_deftype: '2' + fieldelement_defvalue: '10' + fieldelement_deffield: '' diff --git a/testdata/english/modulebuilder_modules.yml b/testdata/english/modulebuilder_modules.yml index 32844029..aeb09205 100644 --- a/testdata/english/modulebuilder_modules.yml +++ b/testdata/english/modulebuilder_modules.yml @@ -2,8 +2,8 @@ mod_id: '1' mod_name: 'My Module' mod_dirname: mymodule - mod_version: '1.0.0' - mod_since: '1.0.0' + mod_version: 1.0.0 + mod_since: 1.0.0 mod_min_php: '7.3' mod_min_xoops: '2.5.11 Beta1' mod_min_admin: '1.2' From 2a08b837a7afe07c179368affb461cc2a02b5cf0 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Tue, 4 Jan 2022 10:33:51 +0100 Subject: [PATCH 202/266] removed old tablechecker --- .../commonfiles/class/Common/TableChecker.php | 257 ------------------ 1 file changed, 257 deletions(-) delete mode 100644 files/commonfiles/class/Common/TableChecker.php diff --git a/files/commonfiles/class/Common/TableChecker.php b/files/commonfiles/class/Common/TableChecker.php deleted file mode 100644 index b1f73a02..00000000 --- a/files/commonfiles/class/Common/TableChecker.php +++ /dev/null @@ -1,257 +0,0 @@ - - * @copyright 2021 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 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 - */ - private $checktype = null; - public const CHECKTYPE_REPORT = 0; //report only - 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 - */ - public function __construct($mydirname, $checktype = 0) - { - $this->mydirname = $mydirname; - $this->checktype = $checktype; - $this->result = []; - } - - /** - * - */ - public function processSQL() - { - - $tabledefs = $this->readSQLFile(); - - $this->result[] = 'Tables found in sql:' . \count($tabledefs); - - foreach ($tabledefs as $tabledef) { - //echo '
    ' . $tabledef['name']; - //check whether table exist or not - $table = $tabledef['name']; - $check = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if ($numRows) { - //table exist - $this->result[] = 'Table exist:' . $table; - $ret = $this->checkTableFields($table, $tabledef['fields']); - } else { - if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) { - // create new table - $sql = $tabledef['sql']; - if ($this->result = $GLOBALS['xoopsDB']->queryF($sql)) { - $this->result[] = 'Table created:' . $table; - } else { - \xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); - $this->result[] = 'Error creating table:' . $table; - } - } else { - $this->result[] = 'Table do not exist:' . $table . ' (creation not activated)'; - } - } - } - - if (self::CHECKTYPE_REPORT == $this->checktype || self::CHECKTYPE_UPDATE_REPORT == $this->checktype) { - return $this->result; - } - } - - /** - * - */ - private function readSQLFile() - { - $tabledefs = []; - - $moduleHandler = \xoops_getHandler('module'); - $module = $moduleHandler->getByDirname($this->mydirname); - $module->loadInfoAsVar($this->mydirname); - $sqlfile = $module->getInfo('sqlfile'); - $sql_file_path = \XOOPS_ROOT_PATH . '/modules/' . $this->mydirname . '/' . $sqlfile[\XOOPS_DB_TYPE]; - - if (\file_exists($sql_file_path)) { - require_once \XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; - $sqlutil = new \SqlUtility(); - $pieces = []; - $sql_query = \trim(file_get_contents($sql_file_path)); - $sqlutil->splitMySqlFile($pieces, $sql_query); - - $countTable = 0; - foreach ($pieces as $piece) { - $singleSql = $sqlutil->prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); - $lines = \preg_split('/\r\n|\n|\r/', $piece); - //var_dump($lines); - $needle1 = 'create table'; - if ($needle1 == \mb_strtolower($singleSql[1])) { - $countLine = 0; - $tabledefs[$countTable]['sql'] = $singleSql[0]; - $tabledefs[$countTable]['name'] = $GLOBALS['xoopsDB']->prefix() . '_' . $singleSql[4]; - $this->after = ''; - foreach($lines as $line) { - if ($countLine > 0) { - $needle2 = 'primary key'; - $needle3 = 'unique key'; - $needle4 = 'key'; - if (0 === \stripos(\trim($line), $needle2)) { - $tabledefs[$countTable][$needle2] = $line; - } elseif (0 === \stripos(\trim($line), $needle3)) { - $tabledefs[$countTable][$needle3] = $line; - } elseif (0 === \stripos(\trim($line), $needle4)) { - $tabledefs[$countTable][$needle4] = $line; - } else { - if (\strpos($line, '`') > 0) { - $tabledefs[$countTable]['fields'][] = $this->extractField($line); - } - } - } - $countLine++; - } - $countTable++; - } - } - //var_dump($tabledefs); - } else { - $this->result[] = 'File do not exist:' . $sql_file_path; - } - - return $tabledefs; - } - - - private function extractKey($line) { - //todo: split string into single keys - $needle = '('; - $key_text = \substr($line, \strpos($line, $needle) + 1); - $needle = ')'; - $key_text = \substr($key_text, 0, \strpos($key_text, $needle)); - - return $key_text; - - } - - private function extractField($line) { - //todo - $counter = 0; - $clean = mb_substr(\trim($line), 0, -1); - $params = \array_values(\array_filter(\explode(' ', $clean))); - $field['sql'] = $clean; - $field['name'] = \trim($params[$counter], '`'); - $counter++; - $field['type'] = $params[$counter]; - $counter++; - if ('unsigned' == \mb_strtolower($params[$counter])) { - $field['unsigned'] = $params[$counter]; - $counter++; - } - if ('not' == \mb_strtolower($params[$counter]) && 'null' == \mb_strtolower($params[$counter + 1])) { - $field['null'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter+2; - } - if (\count($params) > $counter) { - if ('auto_increment' == \mb_strtolower($params[$counter])) { - $field['auto_increment'] = $params[$counter]; - $counter++; - } - } - if (\count($params) > $counter) { - if ('default' == \mb_strtolower($params[$counter])) { - $field['default'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter + 2; - } - } - - $field['after'] = $this->after; - $this->after = $field['name']; - - return $field; - - } - - private function checkTableFields($table, $fields) - { - //to be created - foreach ($fields as $field) { - //check whether column exist or not - $fieldname = $field['name']; - $check = $GLOBALS['xoopsDB']->queryF("SHOW COLUMNS FROM `$table` LIKE '$fieldname'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if ($numRows) { - //field exist - $this->checkField($table, $field); - } else { - if (self::CHECKTYPE_UPDATE == $this->checktype || self::CHECKTYPE_UPDATE_REPORT == $this->checktype) { - // create new field - $sql = "ALTER TABLE `$table` ADD " . $field['sql']; - if ('' !== (string)$field['after']) { - $sql .= ' AFTER `' . $field['after'] . '`;'; - } - if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { - $this->result[] = 'Field added:' . $fieldname; - } else { - \xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); - $this->result[] = "Error when adding '$fieldname' to table '$table'."; - } - } else { - $this->result[] = 'Field do not exist:' . $fieldname . ' (creation not activated)'; - } - } - } - - return true; - } - - private function checkField($table, $field) - { - //to be created - $this->result[] = 'Field exist:' . $field['name'] . ' - no changes'; - - return true; - } -} From 3fb2d81bd5206897e3ae1b177c8e33652909d4bf Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 6 Jan 2022 10:38:04 +0100 Subject: [PATCH 203/266] new lang defines added --- class/Files/Language/LanguageMain.php | 2 ++ class/Files/Templates/User/Defstyle/Breadcrumbs.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index 2bc09e0d..8ef36357 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -143,6 +143,7 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_DELETE", "Delete {$ucfTableSoleName}"); $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_CLONE", "Clone {$ucfTableSoleName}"); } + $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_DETAILS", "Details {$ucfTableSoleName}"); $ret .= $this->ld->getDefine($language, $stuTableName, $ucfTableName); $ret .= $this->ld->getDefine($language, "{$stuTableName}_LIST", "List of {$ucfTableName}"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_TITLE", "{$ucfTableName} title"); @@ -163,6 +164,7 @@ private function getLanguageMain($module, $language) if (1 === $tableSubmit) { $ret .= $this->ld->getAboveDefines('Submit'); $ret .= $this->ld->getDefine($language, 'SUBMIT', 'Submit'); + $ret .= $this->ld->getDefine($language, 'SAVE', 'Save'); $ret .= $this->ld->getAboveDefines('Form'); $ret .= $this->ld->getDefine($language, 'FORM_OK', 'Successfully saved'); $ret .= $this->ld->getDefine($language, 'FORM_DELETE_OK', 'Successfully deleted'); diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index 79e6df28..06c1c0b9 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -97,7 +97,7 @@ public function render() $title = $this->sc->getSmartyDoubleVar('itm', 'title'); $titleElse = $this->sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n"); $link = $this->sc->getSmartyDoubleVar('itm', 'link'); - $glyph = $this->hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home'], '', false, '', ''); + $glyph = $this->hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home fa fa-home'], '', false, '', ''); $anchor = $this->hc->getHtmlAnchor('<{xoAppUrl index.php}>', $glyph, 'home'); $into = $this->hc->getHtmlLi($anchor, 'breadcrumb-item', "\t"); $anchorIf = $this->hc->getHtmlAnchor($link, $title, $title, '', '', '', "\t\t\t", "\n"); From 532300493da225274b265d01fa0b90ff97602205 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Fri, 21 Jan 2022 19:14:59 +0100 Subject: [PATCH 204/266] - uninstall with bak-file creation --- docs/changelog.txt | 1 + files/commonfiles/include/uninstall.php | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index a031d1bc..91d7a48f 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -17,6 +17,7 @@ - replaced Common/XoopsConfirm by Common/Confirm(mamba/goffy) - table renaming in fieldelements (goffy) - added new fieldelements integer/float (goffy) +- uninstall with bak-file creation (mamba/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/files/commonfiles/include/uninstall.php b/files/commonfiles/include/uninstall.php index dfec04dd..81024446 100644 --- a/files/commonfiles/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -35,27 +35,23 @@ function xoops_module_uninstall_modulebuilder(\XoopsModule $module) $helper = Modulebuilder\Helper::getInstance(); - $utility = new Modulebuilder\Utility(); - $success = true; $helper->loadLanguage('admin'); //------------------------------------------------------------------ - // Remove uploads folder (and all subfolders) if they exist + // Rename uploads folder to BAK and add date to name //------------------------------------------------------------------ - - $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; - foreach ($old_directories as $old_dir) { - $dirInfo = new \SplFileInfo($old_dir); - if ($dirInfo->isDir()) { - // The directory exists so delete it - if (!$utility::rrmdir($old_dir)) { - $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); - $success = false; - } + $uploadDirectory = $GLOBALS['xoops']->path("uploads/$moduleDirName"); + $dirInfo = new \SplFileInfo($uploadDirectory); + if ($dirInfo->isDir()) { + // The directory exists so rename it + $date = date('Y-m-d'); + if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) { + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $uploadDirectory)); + $success = false; } - unset($dirInfo); } + unset($dirInfo); /* //------------ START ---------------- //------------------------------------------------------------------ From 90b5e6f3991cabf9e656e76f5e634bfcde6cc926 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 20:33:09 -0500 Subject: [PATCH 205/266] PHP8.1 logo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4cf1cd4c..a92b5488 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) -![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png) +![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp81.png) # Support From 181835ae17d59faac5dc74d1b74945add37d95f9 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 21:38:14 -0500 Subject: [PATCH 206/266] declare(strict_types=1), cosmetics, void,
    , mb_substr --- admin/about.php | 4 +- admin/building.php | 22 +- admin/devtools.php | 71 ++-- admin/feedback.php | 6 +- admin/fields.php | 5 +- admin/footer.php | 5 +- admin/header.php | 5 +- admin/import_module.php | 8 +- admin/index.php | 5 +- admin/logo.php | 5 +- admin/menu.php | 5 +- admin/migrate.php | 73 ++-- admin/modules.php | 10 +- admin/tables.php | 5 +- admin/test.php | 7 +- assets/css/admin/index.php | 2 +- assets/css/index.php | 2 +- assets/fonts/index.php | 2 +- assets/images/icons/16/index.php | 2 +- assets/images/icons/24/index.php | 2 +- assets/images/icons/32/index.php | 2 +- assets/images/icons/index.php | 2 +- assets/images/index.php | 2 +- assets/images/logos/index.php | 2 +- assets/images/modules/index.php | 2 +- assets/index.php | 2 +- assets/js/index.php | 2 +- class/Common/Breadcrumb.php | 6 +- class/Common/Configurator.php | 6 +- class/Common/DirectoryChecker.php | 7 +- class/Common/Migrate.php | 13 +- class/Common/ModuleFeedback.php | 8 +- class/Common/ModuleStats.php | 6 +- class/Common/Resizer.php | 11 +- class/Common/ServerStats.php | 4 +- class/Common/SysUtility.php | 8 +- class/Common/TableChecker.php | 86 ++-- class/Common/TestdataButtons.php | 37 +- class/Common/VersionChecks.php | 4 +- class/Common/XoopsConfirm.php | 9 +- class/Common/index.php | 2 +- class/Constants.php | 65 ++- class/Fieldattributes.php | 5 +- class/FieldattributesHandler.php | 5 +- class/Fieldelements.php | 3 +- class/FieldelementsHandler.php | 6 +- class/Fieldkey.php | 3 +- class/FieldkeyHandler.php | 3 +- class/Fieldnull.php | 3 +- class/FieldnullHandler.php | 3 +- class/FieldsHandler.php | 5 +- class/Fieldtype.php | 3 +- class/FieldtypeHandler.php | 3 +- class/Files/Admin/AdminIndex.php | 50 ++- class/Files/Admin/AdminPermissions.php | 74 ++-- class/Files/Admin/index.php | 2 +- .../Files/Assets/Css/Admin/CssAdminStyles.php | 15 +- class/Files/Assets/Css/Admin/index.php | 4 +- class/Files/Assets/Css/CssSelectors.php | 5 +- class/Files/Assets/Css/CssStyles.php | 43 +- class/Files/Assets/Css/index.php | 4 +- class/Files/Assets/Js/JavascriptJQuery.php | 151 ++++--- class/Files/Assets/Js/JsJquery.php | 21 +- class/Files/Assets/Js/index.php | 4 +- class/Files/Assets/index.php | 4 +- class/Files/Blocks/BlocksFiles.php | 141 ++++--- class/Files/Blocks/index.php | 4 +- class/Files/CheckData.php | 114 +++--- class/Files/Classes/ClassFiles.php | 141 +++---- class/Files/Classes/ClassFormElements.php | 346 ++++++++-------- class/Files/Classes/ClassSpecialFiles.php | 132 +++--- class/Files/Classes/ClassXoopsCode.php | 7 +- class/Files/Classes/index.php | 4 +- class/Files/Config/ConfigConfig.php | 96 +++-- class/Files/Config/index.php | 4 +- class/Files/CreateAbstractClass.php | 15 +- class/Files/CreateArchitecture.php | 13 +- class/Files/CreateClone.php | 9 +- class/Files/CreateCodeIndents.php | 2 +- class/Files/CreateFile.php | 35 +- class/Files/CreateHtmlCode.php | 73 ++-- class/Files/CreatePhpCode.php | 8 +- class/Files/CreateSmartyCode.php | 42 +- class/Files/CreateStructure.php | 33 +- class/Files/CreateTableFields.php | 5 +- class/Files/CreateXoopsCode.php | 103 ++--- class/Files/Docs/DocsChangelog.php | 17 +- class/Files/Docs/DocsFiles.php | 57 ++- class/Files/Docs/index.php | 4 +- .../Includes/IncludeCommentFunctions.php | 52 ++- class/Files/Includes/IncludeComments.php | 30 +- class/Files/Includes/IncludeCommon.php | 39 +- class/Files/Includes/IncludeFunctions.php | 384 +++++++++--------- class/Files/Includes/IncludeJquery.php | 21 +- class/Files/Includes/IncludeNotifications.php | 50 ++- class/Files/Includes/IncludeSearch.php | 69 ++-- class/Files/Includes/index.php | 4 +- class/Files/Language/LanguageAdmin.php | 11 +- class/Files/Language/LanguageBlocks.php | 23 +- class/Files/Language/LanguageDefines.php | 5 +- class/Files/Language/LanguageHelp.php | 63 ++- class/Files/Language/LanguageMailTpl.php | 9 +- class/Files/Language/LanguageMain.php | 57 ++- class/Files/Language/LanguageModinfo.php | 126 +++--- class/Files/Language/index.php | 4 +- class/Files/Sql/SqlFile.php | 9 +- class/Files/Sql/index.php | 4 +- .../Templates/Admin/TemplatesAdminAbout.php | 7 +- .../Templates/Admin/TemplatesAdminBroken.php | 7 +- .../Templates/Admin/TemplatesAdminFooter.php | 24 +- .../Templates/Admin/TemplatesAdminHeader.php | 7 +- .../Templates/Admin/TemplatesAdminIndex.php | 7 +- .../Templates/Admin/TemplatesAdminPages.php | 46 +-- .../Admin/TemplatesAdminPermissions.php | 8 +- class/Files/Templates/Admin/index.php | 4 +- .../Blocks/Defstyle/TemplatesBlocks.php | 60 ++- .../Files/Templates/Blocks/Defstyle/index.php | 4 +- class/Files/Templates/Blocks/index.php | 4 +- .../Templates/User/Defstyle/Breadcrumbs.php | 7 +- .../Templates/User/Defstyle/Categories.php | 47 +-- .../User/Defstyle/CategoriesList.php | 76 ++-- .../Files/Templates/User/Defstyle/Footer.php | 24 +- .../Files/Templates/User/Defstyle/Header.php | 41 +- class/Files/Templates/User/Defstyle/Index.php | 81 ++-- .../Templates/User/Defstyle/MoreFiles.php | 19 +- class/Files/Templates/User/Defstyle/Pages.php | 24 +- .../Templates/User/Defstyle/PagesItem.php | 62 ++- .../Templates/User/Defstyle/PagesList.php | 43 +- class/Files/Templates/User/Defstyle/Pdf.php | 51 ++- class/Files/Templates/User/Defstyle/Rate.php | 95 +++-- class/Files/Templates/User/Defstyle/Rss.php | 75 ++-- .../Files/Templates/User/Defstyle/Search.php | 95 +++-- .../Templates/User/Defstyle/UserPrint.php | 7 +- class/Files/Templates/User/index.php | 4 +- class/Files/Templates/index.php | 4 +- class/Files/User/UserFooter.php | 7 +- class/Files/User/UserHeader.php | 23 +- class/Files/User/UserIndex.php | 63 ++- class/Files/User/UserNotificationUpdate.php | 7 +- class/Files/User/UserPages.php | 234 ++++++----- class/Files/User/UserPdf.php | 73 ++-- class/Files/User/UserPrint.php | 57 ++- class/Files/User/UserRate.php | 85 ++-- class/Files/User/UserRss.php | 161 ++++---- class/Files/User/UserXoopsCode.php | 23 +- class/Files/User/UserXoopsVersion.php | 276 ++++++------- class/Files/User/index.php | 4 +- class/Files/admin/AdminFooter.php | 7 +- class/Files/admin/AdminPages.php | 30 +- class/Files/admin/AdminXoopsCode.php | 117 +++--- class/Files/index.php | 2 +- class/Form/FormRadio.php | 7 +- class/Form/FormRaw.php | 4 +- class/Form/FormTab.php | 6 +- class/Form/FormTabTray.php | 6 +- class/Form/SimpleForm.php | 5 +- class/Form/ThemeForm.php | 3 +- class/Form/index.php | 4 +- class/Helper.php | 7 +- class/Html/FormLabel.php | 5 +- class/Html/index.php | 4 +- class/Logo.php | 5 +- class/LogoGenerator.php | 10 +- class/ModulesHandler.php | 5 +- class/Morefiles.php | 19 +- class/MorefilesHandler.php | 5 +- class/Session.php | 13 +- class/SettingsHandler.php | 3 +- class/SplClassLoader.php | 24 +- class/TablesHandler.php | 5 +- class/Utility.php | 6 +- class/autoload.php | 7 +- class/index.php | 2 +- config/config.php | 7 +- config/icons.php | 2 +- config/index.php | 4 +- config/paths.php | 2 +- docs/index.php | 4 +- files/commonfiles/admin/clone.php | 17 +- files/commonfiles/admin/feedback.php | 6 +- files/commonfiles/class/Common/Breadcrumb.php | 6 +- .../commonfiles/class/Common/Configurator.php | 6 +- .../class/Common/DirectoryChecker.php | 7 +- .../class/Common/FilesManagement.php | 18 +- files/commonfiles/class/Common/Migrate.php | 13 +- .../class/Common/ModuleFeedback.php | 8 +- .../commonfiles/class/Common/ModuleStats.php | 6 +- files/commonfiles/class/Common/Resizer.php | 7 +- .../commonfiles/class/Common/ServerStats.php | 4 +- files/commonfiles/class/Common/SysUtility.php | 8 +- .../commonfiles/class/Common/TableChecker.php | 86 ++-- .../class/Common/VersionChecks.php | 4 +- .../commonfiles/class/Common/XoopsConfirm.php | 9 +- files/commonfiles/class/Helper.php | 5 +- files/commonfiles/class/Utility.php | 5 +- files/commonfiles/include/install.php | 5 +- files/commonfiles/include/uninstall.php | 5 +- .../commonfiles/include/xoops_version.inc.php | 6 +- files/commonfiles/language/english/common.php | 5 +- .../commonfiles/language/english/feedback.php | 5 +- files/commonfiles/preloads/autoloader.php | 8 +- files/commonfiles/preloads/core.php | 4 +- files/commonfiles/testdata/index.php | 33 +- files/ratingfiles/assets/css/rating.css | 2 +- files/ratingfiles/class/Ratings.php | 5 +- files/ratingfiles/class/RatingsHandler.php | 5 +- include/common.php | 8 +- include/functions.php | 5 +- include/index.php | 4 +- include/install.php | 7 +- index.php | 2 +- language/english/admin.php | 24 +- language/english/directorychecker.php | 2 +- language/english/feedback.php | 6 +- language/english/filechecker.php | 2 +- language/english/help/help.html | 36 +- language/english/help/index.php | 4 +- language/english/index.php | 4 +- language/english/mail_template/index.php | 4 +- language/english/modinfo.php | 6 +- language/index.php | 4 +- preloads/autoloader.php | 8 +- preloads/core.php | 4 +- preloads/index.php | 4 +- sql/index.php | 4 +- templates/admin/index.php | 4 +- templates/admin/modulebuilder_fields.tpl | 32 +- templates/admin/modulebuilder_footer.tpl | 4 +- templates/admin/modulebuilder_modules.tpl | 40 +- templates/index.php | 4 +- testdata/english/index.php | 4 +- testdata/english/modulebuilder_settings.yml | 4 +- testdata/images/index.php | 2 +- testdata/images/modules/index.php | 2 +- testdata/images/repository/index.php | 2 +- testdata/images/tables/index.php | 2 +- xoops_version.php | 5 +- 237 files changed, 2931 insertions(+), 3202 deletions(-) diff --git a/admin/about.php b/admin/about.php index 6810ce60..1475203a 100644 --- a/admin/about.php +++ b/admin/about.php @@ -1,4 +1,4 @@ -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 e7bc3237..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 ($constants['user'] ?? []); } require __DIR__ . '/footer.php'; - - - - diff --git a/admin/feedback.php b/admin/feedback.php index 2fb28cbd..764436f4 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 0133bf3c..ae5eb439 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 4b71a5c7..a61407a0 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 87bcf462..feda0348 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 // -// ------------------------------------------------------------------------- // + +declare(strict_types=1); +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + 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. +*/ + +/** + * Migration for XOOPS modules + * + * @copyright XOOPS Project (https://xoops.org) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Richard Griffith + * @author Michael Beck + */ use Xmf\Request; use XoopsModules\Modulebuilder; @@ -38,18 +29,18 @@ $adminObject->displayNavigation(\basename(__FILE__)); echo << -
    - -
    -
    - -
    -
    - -
    - -EOF; +
    +
    + +
    +
    + +
    +
    + +
    +
    + EOF; //XoopsLoad::load('migrate', 'newbb'); diff --git a/admin/modules.php b/admin/modules.php index e7111728..e7473549 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())); @@ -300,7 +298,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']; @@ -332,7 +330,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/tables.php b/admin/tables.php index 272f3e82..eb76de56 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -1,4 +1,4 @@ -processSQL(); +$result = $tablechecker->processSQL(); /* use XoopsModules\Wgdiaries\Common\TableChecker; diff --git a/assets/css/admin/index.php b/assets/css/admin/index.php index 6a505435..e5ee0725 100644 --- a/assets/css/admin/index.php +++ b/assets/css/admin/index.php @@ -1,2 +1,2 @@ - * @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 @@ - * @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 747d2451..0eaa5181 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 20a08517..5f7a916c 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 */ private $checktype = null; - public const CHECKTYPE_REPORT = 0; //report only - public const CHECKTYPE_UPDATE = 1; //update only + public const CHECKTYPE_REPORT = 0; //report only + public const CHECKTYPE_UPDATE = 1; //update only public const CHECKTYPE_UPDATE_REPORT = 2; //update and report - /** * @param \XoopsModules\Modulebuilder\Common\TableChecker|null + * @param mixed $mydirname + * @param mixed $checktype */ public function __construct($mydirname, $checktype = 0) { $this->mydirname = $mydirname; $this->checktype = $checktype; - $this->result = []; + $this->result = []; } - /** - * - */ public function processSQL() { - $tabledefs = $this->readSQLFile(); $this->result[] = 'Tables found in sql:' . \count($tabledefs); @@ -80,7 +72,7 @@ public function processSQL() if ($numRows) { //table exist $this->result[] = 'Table exist:' . $table; - $ret = $this->checkTableFields($table, $tabledef['fields']); + $ret = $this->checkTableFields($table, $tabledef['fields']); } else { if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) { // create new table @@ -102,50 +94,47 @@ public function processSQL() } } - /** - * - */ private function readSQLFile() { $tabledefs = []; $moduleHandler = \xoops_getHandler('module'); - $module = $moduleHandler->getByDirname($this->mydirname); + $module = $moduleHandler->getByDirname($this->mydirname); $module->loadInfoAsVar($this->mydirname); - $sqlfile = $module->getInfo('sqlfile'); + $sqlfile = $module->getInfo('sqlfile'); $sql_file_path = \XOOPS_ROOT_PATH . '/modules/' . $this->mydirname . '/' . $sqlfile[\XOOPS_DB_TYPE]; if (\file_exists($sql_file_path)) { require_once \XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; - $sqlutil = new \SqlUtility(); - $pieces = []; + $sqlutil = new \SqlUtility(); + $pieces = []; $sql_query = \trim(file_get_contents($sql_file_path)); $sqlutil::splitMySqlFile($pieces, $sql_query); $countTable = 0; foreach ($pieces as $piece) { $singleSql = $sqlutil::prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); - $lines = \preg_split('/\r\n|\n|\r/', $piece); + $lines = \preg_split('/\r\n|\n|\r/', $piece); //var_dump($lines); $needle1 = 'create table'; if ($needle1 == \mb_strtolower($singleSql[1])) { - $countLine = 0; - $tabledefs[$countTable]['sql'] = $singleSql[0]; + $countLine = 0; + $tabledefs[$countTable]['sql'] = $singleSql[0]; $tabledefs[$countTable]['name'] = $GLOBALS['xoopsDB']->prefix() . '_' . $singleSql[4]; - $this->after = ''; - foreach($lines as $line) { + $this->after = ''; + foreach ($lines as $line) { if ($countLine > 0) { $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); } } @@ -163,24 +152,24 @@ 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, 0) + 1); - $needle = ')'; - $key_text = \substr($key_text, 0, \strpos($key_text, $needle, 0)); + $needle = '('; + $key_text = \mb_substr($line, \mb_strpos($line, $needle, 0) + 1); + $needle = ')'; + $key_text = \mb_substr($key_text, 0, \mb_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); - $params = \array_values(\array_filter(\explode(' ', $clean))); - $field['sql'] = $clean; + $counter = 0; + $clean = mb_substr(\trim($line), 0, -1); + $params = \array_values(\array_filter(\explode(' ', $clean))); + $field['sql'] = $clean; $field['name'] = \trim($params[$counter], '`'); $counter++; $field['type'] = $params[$counter]; @@ -191,7 +180,7 @@ private function extractField($line) { } if ('not' == \mb_strtolower($params[$counter]) && 'null' == \mb_strtolower($params[$counter + 1])) { $field['null'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter+2; + $counter = $counter + 2; } if (\count($params) > $counter) { if ('auto_increment' == \mb_strtolower($params[$counter])) { @@ -202,15 +191,14 @@ private function extractField($line) { if (\count($params) > $counter) { if ('default' == \mb_strtolower($params[$counter])) { $field['default'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter + 2; + $counter = $counter + 2; } } $field['after'] = $this->after; - $this->after = $field['name']; + $this->after = $field['name']; return $field; - } private function checkTableFields($table, $fields) @@ -229,7 +217,7 @@ private function checkTableFields($table, $fields) // create new field $sql = "ALTER TABLE `$table` ADD " . $field['sql']; if ('' !== (string)$field['after']) { - $sql .= ' AFTER `' . $field['after'] . '`;'; + $sql .= ' AFTER `' . $field['after'] . '`;'; } if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { $this->result[] = 'Field added:' . $fieldname; diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 8f51a93f..c7b41b00 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/XoopsConfirm.php b/class/Common/XoopsConfirm.php index 10f6cee5..c3a0f553 100644 --- a/class/Common/XoopsConfirm.php +++ b/class/Common/XoopsConfirm.php @@ -1,4 +1,4 @@ - - Website: @@ -75,7 +74,6 @@ public function getFormXoopsConfirm() $this->title = CO_MYMODULE_DELETE_CONFIRM; } if ('' === $this->label) { - $this->label = CO_MYMODULE_DELETE_LABEL; } @@ -94,6 +92,7 @@ public function getFormXoopsConfirm() $buttonBack->setExtra('onclick="history.go(-1);return true;"'); $buttonTray->addElement($buttonBack); $form->addElement($buttonTray); + return $form; } } 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: @@ -28,39 +27,37 @@ */ interface Constants { - // Constants for morefiles - public const MORE_FILES_TYPE_EMPTY = 1; - public const MORE_FILES_TYPE_COPY = 2; + // Constants for morefiles + public const MORE_FILES_TYPE_EMPTY = 1; + public const MORE_FILES_TYPE_COPY = 2; public const FIRST_FIELDELEMENT_TABLE = 30; - // ------------------- Field elements --------------------------------- // --------- The values MUST BE IDENTICAL to fieldelement_id ---------- - 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_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_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; } 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 ff36c14a..f9de4fc6 100644 --- a/class/Fieldelements.php +++ b/class/Fieldelements.php @@ -1,4 +1,4 @@ - - * */ /** 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/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/AdminIndex.php b/class/Files/Admin/AdminIndex.php index e5bce7ae..62f2cdad 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -22,9 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops https://xoops.org + * @author Txmod Xoops https://xoops.org * Goffy https://myxoops.org - * */ /** @@ -36,17 +35,15 @@ class AdminIndex extends Files\CreateFile * @var mixed */ private $axc = null; - /** * @var mixed */ private $xc = null; - /** * @var mixed */ private $pc = null; - + /** * @public function constructor * @param null @@ -95,31 +92,30 @@ public function write($module, $tables, $filename) */ private function getAdminIndex($module) { - $moduleDirname = $module->getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $language = $this->getLanguage($moduleDirname, 'AM'); $languageThereAre = $this->getLanguage($moduleDirname, 'AM', 'THEREARE_'); - $ret = $this->getSimpleString(''); - $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); - $ret .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'preloads/autoloader', true); + $ret = $this->getSimpleString(''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); + $ret .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'preloads/autoloader', true); $ret .= $this->getRequire(); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Template Index'); - $ret .= $this->axc->getAdminTemplateMain((string)$moduleDirname, 'index'); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Count elements'); - $tableName = null; + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Template Index'); + $ret .= $this->axc->getAdminTemplateMain((string)$moduleDirname, 'index'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Count elements'); + $tableName = null; foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); $ucfTableName = \ucfirst($tableName); $ret .= $this->xc->getXcEqualsOperator("\$count{$ucfTableName}", "\${$tableName}Handler->getCount()"); } - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('InfoBox Statistics'); - $ret .= $this->axc->getAxcAddInfoBox($language . 'STATISTICS'); - $ret .= $this->pc->getPhpCodeCommentLine('Info elements'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('InfoBox Statistics'); + $ret .= $this->axc->getAxcAddInfoBox($language . 'STATISTICS'); + $ret .= $this->pc->getPhpCodeCommentLine('Info elements'); $tableInstall = []; foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); @@ -138,20 +134,20 @@ private function getAdminIndex($module) $ret .= $this->pc->getPhpCodeCommentLine('Upload Folders'); $ret .= $this->xc->getXcEqualsOperator('$configurator', 'new Common\Configurator()'); $cond = '$configurator->uploadFolders && \is_array($configurator->uploadFolders)'; - $fe_action = $this->xc->getXcEqualsOperator('$folder[]', '$configurator->uploadFolders[$i]', '',"\t\t"); + $fe_action = $this->xc->getXcEqualsOperator('$folder[]', '$configurator->uploadFolders[$i]', '', "\t\t"); $condIf = $this->pc->getPhpCodeForeach('configurator->uploadFolders', true, false, 'i', $fe_action, "\t"); $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf, false); - $ret .= $this->pc->getPhpCodeCommentLine('Uploads Folders Created'); - $boxLine = $this->axc->getAxcAddConfigBoxLine('$folder[$i]', 'folder', '', "\t"); - $boxLine .= $this->axc->getAxcAddConfigBoxLine("[\$folder[\$i], '777']", 'chmod', '', "\t"); - $ret .= $this->pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, '') . PHP_EOL; + $ret .= $this->pc->getPhpCodeCommentLine('Uploads Folders Created'); + $boxLine = $this->axc->getAxcAddConfigBoxLine('$folder[$i]', 'folder', '', "\t"); + $boxLine .= $this->axc->getAxcAddConfigBoxLine("[\$folder[\$i], '777']", 'chmod', '', "\t"); + $ret .= $this->pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, '') . PHP_EOL; } $ret .= $this->pc->getPhpCodeCommentLine('Render Index'); $ret .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')"); $ret .= $this->pc->getPhpCodeCommentLine('Test Data'); - $condIf = $this->xc->getXcXoopsLoadLanguage('admin/modulesadmin',"\t", 'system'); - $condIf .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'testdata/index', true, '','',"\t"); + $condIf = $this->xc->getXcXoopsLoadLanguage('admin/modulesadmin', "\t", 'system'); + $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"); @@ -161,7 +157,7 @@ private function getAdminIndex($module) $ret .= $this->xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()'); $ret .= $this->pc->getPhpCodeCommentLine('End Test Data'); - $ret .= $this->getRequire('footer'); + $ret .= $this->getRequire('footer'); return $ret; } diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index a886f8d0..83510f5e 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -22,9 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops https://xoops.org + * @author Txmod Xoops https://xoops.org * Goffy https://myxoops.org - * */ /** @@ -36,17 +35,14 @@ class AdminPermissions extends Files\CreateFile * @var mixed */ private $axc = null; - /** * @var mixed */ private $xc = null; - /** * @var mixed */ private $pc = null; - /** * @var mixed */ @@ -117,29 +113,29 @@ private function getPermissionsHeader($module, $language) $tableNames[] = $tables[$t]->getVar('table_name'); } } - $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getRequire('header'); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Template Index'); - $ret .= $this->axc->getAdminTemplateMain($moduleDirname, 'permissions'); - $ret .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('permissions.php')"); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'global', 'Cmd'); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Get Form'); - $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); - $ret .= $this->xc->getXcXoopsLoad('XoopsFormLoader'); + $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); + $ret .= $this->getRequire('header'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Template Index'); + $ret .= $this->axc->getAdminTemplateMain($moduleDirname, 'permissions'); + $ret .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('permissions.php')"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'global', 'Cmd'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Get Form'); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); + $ret .= $this->xc->getXcXoopsLoad('XoopsFormLoader'); $optionsSelect['global'] = "{$language}PERMISSIONS_GLOBAL"; foreach ($tableNames as $tableName) { - $ucfTablename = \ucfirst($tableName); + $ucfTablename = \ucfirst($tableName); $optionsSelect["approve_{$tableName}"] = "{$language}PERMISSIONS_APPROVE . ' {$ucfTablename}'"; - $optionsSelect["submit_{$tableName}"] = "{$language}PERMISSIONS_SUBMIT . ' {$ucfTablename}'"; - $optionsSelect["view_{$tableName}"] = "{$language}PERMISSIONS_VIEW . ' {$ucfTablename}'"; + $optionsSelect["submit_{$tableName}"] = "{$language}PERMISSIONS_SUBMIT . ' {$ucfTablename}'"; + $optionsSelect["view_{$tableName}"] = "{$language}PERMISSIONS_VIEW . ' {$ucfTablename}'"; } - $formSelect = $this->xc->getXoopsFormSelectExtraOptions('formSelect', '\'\'', 'op', $optionsSelect, 'onchange="document.fselperm.submit()"'); - $ret .= $this->cxc->getXoopsSimpleForm('permTableForm', 'formSelect', $formSelect, '\'\'', 'fselperm', 'permissions'); + $formSelect = $this->xc->getXoopsFormSelectExtraOptions('formSelect', '\'\'', 'op', $optionsSelect, 'onchange="document.fselperm.submit()"'); + $ret .= $this->cxc->getXoopsSimpleForm('permTableForm', 'formSelect', $formSelect, '\'\'', 'fselperm', 'permissions'); return $ret; } @@ -153,33 +149,33 @@ private function getPermissionsHeader($module, $language) */ private function getPermissionsSwitch($module, $language) { - $moduleDirname = $module->getVar('mod_dirname'); - $tables = $this->getTableTables($module->getVar('mod_id')); - $t = "\t\t"; - $n = "\n"; - $cases['global']= [ - "{$t}\$formTitle = {$language}PERMISSIONS_GLOBAL;{$n}", - "{$t}\$permName = '{$moduleDirname}_ac';{$n}", - "{$t}\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;{$n}", - "{$t}\$globalPerms = ['4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 ];{$n}", - ]; + $moduleDirname = $module->getVar('mod_dirname'); + $tables = $this->getTableTables($module->getVar('mod_id')); + $t = "\t\t"; + $n = "\n"; + $cases['global'] = [ + "{$t}\$formTitle = {$language}PERMISSIONS_GLOBAL;{$n}", + "{$t}\$permName = '{$moduleDirname}_ac';{$n}", + "{$t}\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;{$n}", + "{$t}\$globalPerms = ['4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 ];{$n}", + ]; foreach (\array_keys($tables) as $i) { if (1 == $tables[$i]->getVar('table_permissions')) { - $tableName = $tables[$i]->getVar('table_name'); - $ucfTablename = \ucfirst($tableName); + $tableName = $tables[$i]->getVar('table_name'); + $ucfTablename = \ucfirst($tableName); $cases["approve_{$tableName}"] = [ "{$t}\$formTitle = {$language}PERMISSIONS_APPROVE;{$n}", "{$t}\$permName = '{$moduleDirname}_approve_{$tableName}';{$n}", "{$t}\$permDesc = {$language}PERMISSIONS_APPROVE_DESC . ' {$ucfTablename}';{$n}", "{$t}\$handler = \$helper->getHandler('{$tableName}');{$n}", ]; - $cases["submit_{$tableName}"] = [ + $cases["submit_{$tableName}"] = [ "{$t}\$formTitle = {$language}PERMISSIONS_SUBMIT;{$n}", "{$t}\$permName = '{$moduleDirname}_submit_{$tableName}';{$n}", "{$t}\$permDesc = {$language}PERMISSIONS_SUBMIT_DESC . ' {$ucfTablename}';{$n}", "{$t}\$handler = \$helper->getHandler('{$tableName}');{$n}", ]; - $cases["view_{$tableName}"] = [ + $cases["view_{$tableName}"] = [ "{$t}\$formTitle = {$language}PERMISSIONS_VIEW;{$n}", "{$t}\$permName = '{$moduleDirname}_view_{$tableName}';{$n}", "{$t}\$permDesc = {$language}PERMISSIONS_VIEW_DESC . ' {$ucfTablename}';{$n}", @@ -202,7 +198,7 @@ private function getPermissionsSwitch($module, $language) */ private function getPermissionsBody($module, $language) { - $tables = $this->getTableTables($module->getVar('mod_id')); + $tables = $this->getTableTables($module->getVar('mod_id')); $ret = $this->xc->getXcGetVar('moduleId', 'xoopsModule', 'mid'); $ret .= $this->xc->getXcXoopsFormGroupPerm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'"); 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 @@ -pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } - /** + /** * @static function getInstance * @param null * @return BlocksFiles @@ -76,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); @@ -100,16 +96,16 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; - $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); - $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); + $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'", '', true, true, '', "\t"); //$func .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); - $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); - $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$lenghtTitle', '$options[2]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); + $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL", '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]', '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]', '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$lenghtTitle', '$options[2]', '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()', '', "\t"); $func .= $this->xc->getXcHandlerLine($tableName, "\t"); $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); @@ -145,8 +141,8 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab } } if ('' !== $fieldStatus) { - $constant = $this->xc->getXcGetConstants('PERM_GLOBAL_VIEW'); - $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'>'", true); + $constant = $this->xc->getXcGetConstants('PERM_GLOBAL_VIEW'); + $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'>'", true); $critStatus .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t\t"); } } @@ -157,41 +153,41 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case4 = []; $case5 = []; - $case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\t\t\t"); + $case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last", '', "\t\t\t"); if ('' !== $fieldStatus) { $case1[] = $critStatus; } - $case1[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); - $case1[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); - $case2[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} new",'',"\t\t\t"); + $case1[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'", "\t\t\t"); + $case1[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'", "\t\t\t"); + $case2[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} new", '', "\t\t\t"); if ('' !== $fieldStatus) { $case2[] = $critStatus; } $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->xc->getXcCriteriaAdd($critName, $crit,"\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"); - $case2[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); - $case2[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); - $case3[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} hits",'',"\t\t\t"); + $case2[] = $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t\t"); + $case2[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'", "\t\t\t"); + $case2[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'", "\t\t\t"); + $case3[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} hits", '', "\t\t\t"); if ('' !== $fieldStatus) { $case3[] = $critStatus; } - $case3[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_hits'","\t\t\t"); - $case3[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); - $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); + $case3[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_hits'", "\t\t\t"); + $case3[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'", "\t\t\t"); + $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top", '', "\t\t\t"); if ('' !== $fieldStatus) { $case4[] = $critStatus; } - $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'","\t\t\t"); - $case4[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); - $case5[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} random",'',"\t\t\t"); + $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'", "\t\t\t"); + $case4[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'", "\t\t\t"); + $case5[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} random", '', "\t\t\t"); if ('' !== $fieldStatus) { $case5[] = $critStatus; } - $case5[] = $this->xc->getXcCriteriaSetSort($critName, "'RAND()'","\t\t\t"); - $cases = [ + $case5[] = $this->xc->getXcCriteriaSetSort($critName, "'RAND()'", "\t\t\t"); + $cases = [ 'last' => $case1, 'new' => $case2, 'hits' => $case3, @@ -208,9 +204,9 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab } $func .= $this->pc->getPhpCodeBlankLine(); - $func .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', "\t"); - $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); - $func .= $this->pc->getPhpCodeUnset($critName, "\t"); + $func .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', "\t"); + $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); + $func .= $this->pc->getPhpCodeUnset($critName, "\t"); $contentForeach = ''; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -233,10 +229,10 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); break; case 15: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","\\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); break; default: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","\${$tableName}All[\$i]->getVar('{$fieldName}')", null, "\t\t\t"); + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\${$tableName}All[\$i]->getVar('{$fieldName}')", null, "\t\t\t"); break; } } @@ -245,10 +241,10 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func .= $this->pc->getPhpCodeConditions("\count(\${$tableName}All)", ' > ', '0', $foreach, false, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); - $func .= $this->getSimpleString('return $block;',"\t"); + $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; } @@ -270,40 +266,39 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; - $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); - $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); - $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); - $func .= $this->xc->getXcHandlerLine($tableName, "\t"); - $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); - $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY", '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$form', "\"\"", '.',"\t"); - $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.',"\t"); - $func .= $this->xc->getXcEqualsOperator('$form', "{$language}TITLE_LENGTH . \" :

    \"", '.',"\t"); - $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $this->pc->getPhpCodeBlankLine(); - $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); - $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); - $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); - $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t","\n"); - $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t","\n"); - $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); - $func .= $this->pc->getPhpCodeUnset($critName, "\t"); - $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    '", '.',"\t"); - $func .= $this->pc->getPhpCodeBlankLine(); - $func .= $this->getSimpleString('return $form;', "\t"); - $func .= $this->pc->getPhpCodeBlankLine(); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); + $func = $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'", '', true, true, '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '', "\t"); + $func .= $this->xc->getXcHandlerLine($tableName, "\t"); + $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL", '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY", '', "\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "\"\"", '.', "\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.', "\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}TITLE_LENGTH . \" :

    \"", '.', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); + $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); + $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'", "\t", "\n"); + $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'", "\t", "\n"); + $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); + $func .= $this->pc->getPhpCodeUnset($critName, "\t"); + $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    '", '.', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->getSimpleString('return $form;', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, '', false, ''); return $ret; - } /** @@ -340,7 +335,7 @@ public function render() $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Helper'], '', ''); $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/include/common.php'",'',true, true); + $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/include/common.php'", '', true, true); $content .= $this->getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tablePermissions, $fields, $fieldId, $fieldParent); $content .= $this->getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $language); 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(); @@ -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 889eed8a..92c62d14 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); - } /** @@ -187,12 +180,12 @@ private function getInitVars($fields) */ private function getClassObject($module, $table, $fields) { - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $ucfTableName = \ucfirst($tableName); - $ret = $this->pc->getPhpCodeDefined(); - $ret .= $this->pc->getPhpCodeCommentMultiLine(['Class Object' => $ucfTableName]); - $cCl = ''; + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeDefined(); + $ret .= $this->pc->getPhpCodeCommentMultiLine(['Class Object' => $ucfTableName]); + $cCl = ''; $fieldInForm = []; $fieldElementId = []; @@ -207,9 +200,9 @@ private function getClassObject($module, $table, $fields) $rpFieldName = $this->getRightString($fieldName); if (\in_array(5, $fieldElementId)) { //if (\count($rpFieldName) % 5) { - //$optionsFieldName[] = "'" . $rpFieldName . "'"; + //$optionsFieldName[] = "'" . $rpFieldName . "'"; //} else { - $optionsFieldName[] = "'" . $rpFieldName . "'\n"; + $optionsFieldName[] = "'" . $rpFieldName . "'\n"; //} } if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { @@ -217,9 +210,9 @@ private function getClassObject($module, $table, $fields) } } if (\in_array(5, $fieldElementId) > 1) { - $cCl .= $this->pc->getPhpCodeCommentMultiLine(['Options' => '']); - $options = $this->pc->getPhpCodeArray('', $optionsFieldName, true); - $cCl .= $this->pc->getPhpCodeVariableClass('private', 'options', $options); + $cCl .= $this->pc->getPhpCodeCommentMultiLine(['Options' => '']); + $options = $this->pc->getPhpCodeArray('', $optionsFieldName, true); + $cCl .= $this->pc->getPhpCodeVariableClass('private', 'options', $options); } unset($optionsFieldName); $cCl .= $this->pc->getPhpCodeCommentMultiLine(['@var' => 'int'], "\t"); @@ -302,11 +295,11 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) $getForm .= $this->xc->getXcEqualsOperator('$isAdmin', $xUser . '->isAdmin(' . $xModule . '->mid())', null, "\t\t"); if ((1 != $tableCategory) && (1 == $table->getVar('table_permissions'))) { $permString = 'upload_groups'; - $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); - $getForm .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); - $getForm .= $this->pc->getPhpCodeTernaryOperator('groups', '\is_object(' . $xUser . ')', $xUser . '->getGroups()', '\XOOPS_GROUP_ANONYMOUS', "\t\t"); - $checkRight = $this->xc->getXcCheckRight('$grouppermHandler', $permString, 32, '$groups', $xModule . '->getVar(\'mid\')', true); - $getForm .= $this->pc->getPhpCodeTernaryOperator('permissionUpload', $checkRight, 'true', 'false', "\t\t"); + $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); + $getForm .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); + $getForm .= $this->pc->getPhpCodeTernaryOperator('groups', '\is_object(' . $xUser . ')', $xUser . '->getGroups()', '\XOOPS_GROUP_ANONYMOUS', "\t\t"); + $checkRight = $this->xc->getXcCheckRight('$grouppermHandler', $permString, 32, '$groups', $xModule . '->getVar(\'mid\')', true); + $getForm .= $this->pc->getPhpCodeTernaryOperator('permissionUpload', $checkRight, 'true', 'false', "\t\t"); } $getForm .= $this->pc->getPhpCodeCommentLine('Title', '', "\t\t"); $getForm .= $this->pc->getPhpCodeTernaryOperator('title', '$this->isNew()', "\sprintf({$language}{$stuTableSoleName}_ADD)", "\sprintf({$language}{$stuTableSoleName}_EDIT)", "\t\t"); @@ -340,7 +333,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) * @param string $moduleDirname * @param string $fieldId * - * @param $tableName + * @param $tableName * @return string */ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) @@ -351,7 +344,7 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) $ret = $this->pc->getPhpCodeCommentLine('Permissions', '', "\t\t"); $ret .= $this->xc->getXcXoopsHandler('member', "\t\t"); $ret .= $this->xc->getXcEqualsOperator('$groupList', '$memberHandler->getGroupList()', null, "\t\t"); - $ret .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); + $ret .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); $ret .= $this->pc->getPhpCodeArrayType('fullList', 'keys', 'groupList', null, false, "\t\t"); $fId = $this->xc->getXcGetVar('', 'this', $fieldId, true); $mId = $this->xc->getXcGetVar('', "GLOBALS['xoopsModule']", 'mid', true); @@ -408,11 +401,11 @@ private function getValuesInObject($moduleDirname, $table, $fields) $configMaxchar = 0; $lenMaxName = 0; foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $len = \strlen($rpFieldName); + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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); } @@ -420,31 +413,31 @@ 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"); if ($configMaxchar == 0) { - $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); + $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); $configMaxchar = 1; } - $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; - $spacer = str_repeat(' ', $lenMaxName - \strlen($rpFieldName) - \strlen('_short')); + $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + $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; + $helper = 1; + $utility = 1; break; case 4: $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t", ", 'e'"); if ($configMaxchar == 0) { - $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); + $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); $configMaxchar = 1; } - $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; - $spacer = str_repeat(' ', $lenMaxName - \strlen($rpFieldName) - \strlen('_short')); + $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + $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; + $helper = 1; + $utility = 1; break; case 6: $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t"); @@ -456,54 +449,54 @@ 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); - $getValues .= $this->xc->getXcGetVar("status{$spacer}", 'this', $fieldName, false, "\t\t"); - $spacer = str_repeat(' ', $lenMaxName - \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]; - $contCase2 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_OFFLINE', false, "\t\t\t\t"); - $cases[$this->xc->getXcGetConstants('STATUS_OFFLINE')] = [$contCase2]; - $contCase3 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_SUBMITTED', false, "\t\t\t\t"); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen('status') + 7); + $getValues .= $this->xc->getXcGetVar("status{$spacer}", 'this', $fieldName, false, "\t\t"); + $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]; + $contCase2 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_OFFLINE', false, "\t\t\t\t"); + $cases[$this->xc->getXcGetConstants('STATUS_OFFLINE')] = [$contCase2]; + $contCase3 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_SUBMITTED', false, "\t\t\t\t"); $cases[$this->xc->getXcGetConstants('STATUS_SUBMITTED')] = [$contCase3]; if (1 == $tablePermissions) { - $contCase4 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_APPROVED', false, "\t\t\t\t"); + $contCase4 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_APPROVED', false, "\t\t\t\t"); $cases[$this->xc->getXcGetConstants('STATUS_APPROVED')] = [$contCase4]; } if (1 == $tableBroken) { - $contCase5 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_BROKEN', false, "\t\t\t\t"); + $contCase5 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_BROKEN', false, "\t\t\t\t"); $cases[$this->xc->getXcGetConstants('STATUS_BROKEN')] = [$contCase5]; } $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"); + $getValues .= $this->xc->getXcEqualsOperator("\$ret['status_text']{$spacer}", '$status_text', false, "\t\t"); break; case 21: $getValues .= $this->xc->getXcFormatTimeStamp("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", 'm', "\t\t"); break; default: - $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); - $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); - if ((int)$fieldElementTid > 0 ) { - $fieldElementMid = $fieldElements->getVar('fieldelement_mid'); + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); + $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); + if ((int)$fieldElementTid > 0) { + $fieldElementMid = $fieldElements->getVar('fieldelement_mid'); $fieldElementName = (string)$fieldElements->getVar('fieldelement_name'); - $fieldNameDesc = mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); - $topicTableName = \str_replace(': ', '', \mb_strtolower($fieldNameDesc)); - $fieldsTopics = $this->getTableFields($fieldElementMid, $fieldElementTid); + $fieldNameDesc = mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); + $topicTableName = \str_replace(': ', '', \mb_strtolower($fieldNameDesc)); + $fieldsTopics = $this->getTableFields($fieldElementMid, $fieldElementTid); foreach (\array_keys($fieldsTopics) as $g) { $fieldNameTopic = $fieldsTopics[$g]->getVar('field_name'); if (1 == $fieldsTopics[$g]->getVar('field_main')) { $fieldMainTopic = $fieldNameTopic; } } - $getValues .= $this->xc->getXcHandlerLine($topicTableName, "\t\t"); + $getValues .= $this->xc->getXcHandlerLine($topicTableName, "\t\t"); $getTopicTable = "\${$topicTableName}Handler->get(\$this->getVar('{$fieldName}'))"; - $getValues .= $this->xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t"); - $fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')"; - $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", $fMainTopic, null, "\t\t"); - $helper = 1; + $getValues .= $this->xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t"); + $fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')"; + $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", $fMainTopic, null, "\t\t"); + $helper = 1; } else { $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t"); } @@ -514,7 +507,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) $header .= $this->xc->getXcGetInstance('helper ', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); } if ($utility > 0) { - $header .= $this->xc->getXcEqualsOperator('$utility', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\t\t"); + $header .= $this->xc->getXcEqualsOperator('$utility', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '', "\t\t"); } $getValues .= $this->getSimpleString('return $ret;', "\t\t"); @@ -591,11 +584,11 @@ private function getOptionsCheck($table) */ public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); $content = $this->getHeaderFilesComments($module, null, $namespace); diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 3eb33e3d..56324a7a 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -122,7 +114,7 @@ public function initForm($module, $table) */ private function getXoopsFormText($language, $fieldName, $fieldDefault, $required = 'false') { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); if ('' != $fieldDefault) { $ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", "\t\t"); @@ -170,14 +162,13 @@ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'f $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t"); $ret .= $this->pc->getPhpCodeArray('editorConfigs', null, false, "\t\t"); - $getConfig = $this->xc->getXcGetConfig('editor_admin'); - $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"); - $ret .= $this->pc->getPhpCodeConditions('$isAdmin','','', $contIf, $contElse, "\t\t"); - + $getConfig = $this->xc->getXcGetConfig('editor_admin'); + $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"); + $ret .= $this->pc->getPhpCodeConditions('$isAdmin', '', '', $contIf, $contElse, "\t\t"); - $configs = [ + $configs = [ 'name' => "'{$fieldName}'", 'value' => "\$this->getVar('{$fieldName}', 'e')", 'rows' => 5, @@ -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); @@ -242,10 +233,10 @@ private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fi */ private function getXoopsFormHidden($fieldName) { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $ret = $this->pc->getPhpCodeCommentLine('Form Hidden', $ccFieldName, "\t\t"); - $formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $fieldName, true, true); - $ret .= $this->cxc->getClassAddElement('form', $formHidden); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Hidden', $ccFieldName, "\t\t"); + $formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $fieldName, true, true); + $ret .= $this->cxc->getClassAddElement('form', $formHidden); return $ret; } @@ -265,10 +256,10 @@ 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); + $ret .= $this->pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName . ': Select Uploaded Image', $t); $ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); $ret .= $this->xc->getXcEqualsOperator('$imageDirectory', "'/Frameworks/moduleclasses/icons/32'", null, $t); @@ -284,7 +275,7 @@ private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $r $paramLabel = "\"
    \""; $xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); $ret .= $this->cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); - $ret .= $this->pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName .': Upload new image', $t); + $ret .= $this->pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName . ': Upload new image', $t); $ret .= $this->cxc->getClassXoopsFormElementTray('fileSelectTray', "''", '
    ', $t); $getConfig = $this->xc->getXcGetConfig('maxsize_image'); $xoopsFormFile = $this->cxc->getClassXoopsFormFile('', $languageShort . 'FORM_UPLOAD_NEW', $fieldName, $getConfig, true, ''); @@ -311,40 +302,40 @@ private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $r */ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { - $ucfFieldName = $this->cf->getCamelCase($fieldName, true); - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \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); - $ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); - $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); - $ret .= $this->xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); - $ret .= $this->cxc->getClassXoopsFormElementTray('fileTray', $language, '
    ', $t); - $sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); - $ret .= $this->cxc->getClassXoopsFormSelect('fileSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); - $ret .= $this->xc->getXcXoopsListImgListArray('fileArray', '\XOOPS_ROOT_PATH . $fileDirectory', $t); - $contForeach = $this->cxc->getClassAddOption('fileSelect', '($file1), $file1', $t . "\t"); - $ret .= $this->pc->getPhpCodeForeach('fileArray', false, false, 'file1', $contForeach, $t); + $ucfFieldName = $this->cf->getCamelCase($fieldName, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $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); + $ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); + $ret .= $this->xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); + $ret .= $this->cxc->getClassXoopsFormElementTray('fileTray', $language, '
    ', $t); + $sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); + $ret .= $this->cxc->getClassXoopsFormSelect('fileSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); + $ret .= $this->xc->getXcXoopsListImgListArray('fileArray', '\XOOPS_ROOT_PATH . $fileDirectory', $t); + $contForeach = $this->cxc->getClassAddOption('fileSelect', '($file1), $file1', $t . "\t"); + $ret .= $this->pc->getPhpCodeForeach('fileArray', false, false, 'file1', $contForeach, $t); //TODO: make preview for images or show "no preview possible" //$setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . \XOOPS_URL . \"\\\")'\""; //$ret .= $cc->getClassSetExtra('fileSelect', $setExtraParam, $t); - $ret .= $this->cxc->getClassAddElement('fileTray', '$fileSelect, false', $t); - //$paramLabel = "\"
    \""; + $ret .= $this->cxc->getClassAddElement('fileTray', '$fileSelect, false', $t); + //$paramLabel = "\"
    \""; //$xoopsFormLabel = $cc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); //$ret .= $cc->getClassAddElement('fileTray', $xoopsFormLabel, $t); - $ret .= $this->pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Upload new file', $t); - $getConfigSize = $this->xc->getXcGetConfig('maxsize_file'); - $contIf = $this->xc->getXcEqualsOperator('$maxsize', $getConfigSize,'', "\t\t\t"); - $xoopsFormFile = $this->cxc->getClassXoopsFormFile('fileTray', "'
    ' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); - $contIf .= $this->cxc->getClassAddElement('fileTray', $xoopsFormFile, $t . "\t"); - $configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; - $labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); - $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->cxc->getClassAddElement('form', "\$fileTray{$required}", $t); + $ret .= $this->pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Upload new file', $t); + $getConfigSize = $this->xc->getXcGetConfig('maxsize_file'); + $contIf = $this->xc->getXcEqualsOperator('$maxsize', $getConfigSize, '', "\t\t\t"); + $xoopsFormFile = $this->cxc->getClassXoopsFormFile('fileTray', "'
    ' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); + $contIf .= $this->cxc->getClassAddElement('fileTray', $xoopsFormFile, $t . "\t"); + $configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; + $labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); + $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->cxc->getClassAddElement('form', "\$fileTray{$required}", $t); return $ret; } @@ -363,8 +354,8 @@ 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) . '_'; + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $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); @@ -392,45 +383,45 @@ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fie */ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, $required = 'false') { - $ucfFieldName = $this->cf->getCamelCase($fieldName, true); - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \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); - $ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); - $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); - $ret .= $this->xc->getXcEqualsOperator('$imageDirectory', "'/uploads/{$moduleDirname}/images/{$tableName}'", null, $t); - $ret .= $this->cxc->getClassXoopsFormElementTray('imageTray', $language, '
    ', $t); - $sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$imageDirectory}/"'); - $ret .= $this->cxc->getClassXoopsFormSelect('imageSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); - $ret .= $this->xc->getXcXoopsListImgListArray('imageArray', '\XOOPS_ROOT_PATH . $imageDirectory', $t); - $contForeach = $this->cxc->getClassAddOption('imageSelect', '($image1), $image1', $t . "\t"); - $ret .= $this->pc->getPhpCodeForeach('imageArray', false, false, 'image1', $contForeach, $t); - $setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . \XOOPS_URL . \"\\\")'\""; - $ret .= $this->cxc->getClassSetExtra('imageSelect', $setExtraParam, $t); - $ret .= $this->cxc->getClassAddElement('imageTray', '$imageSelect, false', $t); - $paramLabel = "\"
    \""; - $xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); - $ret .= $this->cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); - $ret .= $this->pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Upload new image', $t); - $getConfigSize = $this->xc->getXcGetConfig('maxsize_image'); - $contIf = $this->xc->getXcEqualsOperator('$maxsize', $getConfigSize,'', "\t\t\t"); - $xoopsFormFile = $this->cxc->getClassXoopsFormFile('imageTray', "'
    ' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); - $contIf .= $this->cxc->getClassAddElement('imageTray', $xoopsFormFile, $t . "\t"); - $configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; - $labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); - $contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo1, $t . "\t"); - $getConfig = $this->xc->getXcGetConfig('maxwidth_image'); - $labelInfo2 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_WIDTH', $getConfig . " . ' px'", true, ''); - $contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo2, $t . "\t"); - $getConfig = $this->xc->getXcGetConfig('maxheight_image'); - $labelInfo3 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_HEIGHT', $getConfig . " . ' px'", true, ''); - $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->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); + $ucfFieldName = $this->cf->getCamelCase($fieldName, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $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); + $ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); + $ret .= $this->xc->getXcEqualsOperator('$imageDirectory', "'/uploads/{$moduleDirname}/images/{$tableName}'", null, $t); + $ret .= $this->cxc->getClassXoopsFormElementTray('imageTray', $language, '
    ', $t); + $sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$imageDirectory}/"'); + $ret .= $this->cxc->getClassXoopsFormSelect('imageSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); + $ret .= $this->xc->getXcXoopsListImgListArray('imageArray', '\XOOPS_ROOT_PATH . $imageDirectory', $t); + $contForeach = $this->cxc->getClassAddOption('imageSelect', '($image1), $image1', $t . "\t"); + $ret .= $this->pc->getPhpCodeForeach('imageArray', false, false, 'image1', $contForeach, $t); + $setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . \XOOPS_URL . \"\\\")'\""; + $ret .= $this->cxc->getClassSetExtra('imageSelect', $setExtraParam, $t); + $ret .= $this->cxc->getClassAddElement('imageTray', '$imageSelect, false', $t); + $paramLabel = "\"
    \""; + $xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); + $ret .= $this->cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); + $ret .= $this->pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Upload new image', $t); + $getConfigSize = $this->xc->getXcGetConfig('maxsize_image'); + $contIf = $this->xc->getXcEqualsOperator('$maxsize', $getConfigSize, '', "\t\t\t"); + $xoopsFormFile = $this->cxc->getClassXoopsFormFile('imageTray', "'
    ' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); + $contIf .= $this->cxc->getClassAddElement('imageTray', $xoopsFormFile, $t . "\t"); + $configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; + $labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); + $contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo1, $t . "\t"); + $getConfig = $this->xc->getXcGetConfig('maxwidth_image'); + $labelInfo2 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_WIDTH', $getConfig . " . ' px'", true, ''); + $contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo2, $t . "\t"); + $getConfig = $this->xc->getXcGetConfig('maxheight_image'); + $labelInfo3 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_HEIGHT', $getConfig . " . ' px'", true, ''); + $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->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); return $ret; } @@ -439,10 +430,10 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, * @private function getXoopsFormUploadFile * provides label with last uploaded file and an upload field * - * @param $language - * @param $moduleDirname - * @param $tableName - * @param $fieldName + * @param $language + * @param $moduleDirname + * @param $tableName + * @param $fieldName * * @param string $required * @return string @@ -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"); @@ -461,17 +452,17 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $ $condIf = $this->cxc->getClassAddElement('fileUploadTray', $xoopsFormLabel, $t . "\t"); $uForm .= $this->pc->getPhpCodeConditions('!$this->isNew()', null, null, $condIf, false, "\t\t\t"); $getConfig = $this->xc->getXcGetConfig('maxsize_file'); - $uForm .= $this->xc->getXcEqualsOperator('$maxsize', $getConfig,'', "\t\t\t"); + $uForm .= $this->xc->getXcEqualsOperator('$maxsize', $getConfig, '', "\t\t\t"); $xoopsFormFile = $this->cxc->getClassXoopsFormFile('', "''", $fieldName, '$maxsize', true, ''); $uForm .= $this->cxc->getClassAddElement('fileUploadTray', $xoopsFormFile, $t); $configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; - $labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); - $uForm .= $this->cxc->getClassAddElement('fileUploadTray', $labelInfo1, $t ); + $labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); + $uForm .= $this->cxc->getClassAddElement('fileUploadTray', $labelInfo1, $t); $uForm .= $this->cxc->getClassAddElement('form', "\$fileUploadTray{$required}", $t); $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', null, null, $uForm, $contElse, "\t\t"); return $ret; } @@ -479,8 +470,8 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $ /** * @private function getXoopsFormColorPicker * - * @param $language - * @param $fieldName + * @param $language + * @param $fieldName * * @param string $required * @return string @@ -492,7 +483,7 @@ private function getXoopsFormColorPicker($language, $fieldName, $required = 'fal $ret = $this->pc->getPhpCodeCommentLine('Form Color', 'Picker ' . $ccFieldName, $t); $getVar = $this->xc->getXcGetVar('', 'this', $fieldName, true); $xoopsFormFile = $this->cxc->getClassXoopsFormColorPicker('', $language, $fieldName, $getVar, true, ''); - $ret .= $this->cxc->getClassAddElement('form', $xoopsFormFile. $required, $t); + $ret .= $this->cxc->getClassAddElement('form', $xoopsFormFile . $required, $t); return $ret; } @@ -609,33 +600,33 @@ private function getXoopsFormDateTime($language, $fieldName, $required = 'false' /** * @private function getXoopsFormSelectStatus * - * @param $language - * @param $moduleDirname - * @param $fieldName - * @param $tablePermissions + * @param $language + * @param $moduleDirname + * @param $fieldName + * @param $tablePermissions * @param string $required * * @return string */ private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required = 'false') { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $languageShort = \substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; - $t = "\t\t"; - $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Status ' . $ccFieldName, $t); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; + $t = "\t\t"; + $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Status ' . $ccFieldName, $t); if (1 == $tablePermissions) { $ret .= $this->xc->getXcHandlerLine('permissions', $t); } - $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_NONE') . ", {$languageShort}STATUS_NONE", $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_OFFLINE') . ", {$languageShort}STATUS_OFFLINE", $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_SUBMITTED') . ", {$languageShort}STATUS_SUBMITTED", $t); + $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_NONE') . ", {$languageShort}STATUS_NONE", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_OFFLINE') . ", {$languageShort}STATUS_OFFLINE", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_SUBMITTED') . ", {$languageShort}STATUS_SUBMITTED", $t); if (1 == $tablePermissions) { $contIf = $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_APPROVED') . ", {$languageShort}STATUS_APPROVED", $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$permissionsHandler->getPermGlobalApprove()', '', '', $contIf, false, $t); + $ret .= $this->pc->getPhpCodeConditions('$permissionsHandler->getPermGlobalApprove()', '', '', $contIf, false, $t); } - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_BROKEN') . ", {$languageShort}STATUS_BROKEN", $t); - $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_BROKEN') . ", {$languageShort}STATUS_BROKEN", $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; } @@ -663,22 +654,22 @@ private function getXoopsFormPassword($language, $fieldName, $required = 'false' /** * @private function getXoopsFormSelectCountry * - * @param $language - * @param $fieldName + * @param $language + * @param $fieldName * @param string $required * * @return string */ private function getXoopsFormSelectCountry($language, $fieldName, $required = 'false') { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $t = "\t\t"; - $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Country ' . $ccFieldName, $t); - $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'', \_NONE", $t); - $ret .= $this->xc->getXcXoopsListCountryList('countryArray', $t); - $ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', '$countryArray', $t); - $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $t = "\t\t"; + $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Country ' . $ccFieldName, $t); + $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'', \_NONE", $t); + $ret .= $this->xc->getXcXoopsListCountryList('countryArray', $t); + $ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', '$countryArray', $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; } @@ -686,22 +677,22 @@ private function getXoopsFormSelectCountry($language, $fieldName, $required = 'f /** * @private function getXoopsFormSelectLang * - * @param $language - * @param $fieldName + * @param $language + * @param $fieldName * @param string $required * * @return string */ private function getXoopsFormSelectLang($language, $fieldName, $required = 'false') { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $t = "\t\t"; - $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Lang ' . $ccFieldName, $t); - $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'', \_NONE", $t); - $ret .= $this->xc->getXcXoopsListLangList('langArray', $t); - $ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', '$langArray', $t); - $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $t = "\t\t"; + $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Lang ' . $ccFieldName, $t); + $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'', \_NONE", $t); + $ret .= $this->xc->getXcXoopsListLangList('langArray', $t); + $ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', '$langArray', $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; } @@ -709,9 +700,9 @@ private function getXoopsFormSelectLang($language, $fieldName, $required = 'fals /** * @private function getXoopsFormRadio * - * @param $language - * @param $moduleDirname - * @param $fieldName + * @param $language + * @param $moduleDirname + * @param $fieldName * @param string $required * * @return string @@ -719,7 +710,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); @@ -736,10 +727,10 @@ private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $requi /** * @private function getXoopsFormSelectCombo * - * @param $language - * @param $moduleDirname - * @param $tableName - * @param $fieldName + * @param $language + * @param $moduleDirname + * @param $tableName + * @param $fieldName * @param string $required * * @return string @@ -748,7 +739,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); @@ -773,10 +764,10 @@ private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, * * @return string */ - private function getXoopsFormTable($language,$fieldName, $fieldElement, $required = 'false') + private function getXoopsFormTable($language, $fieldName, $fieldElement, $required = 'false') { - $t = "\t\t"; - $ret = ''; + $t = "\t\t"; + $ret = ''; $fElement = $this->helper->getHandler('Fieldelements')->get($fieldElement); $rpFieldelementName = \mb_strtolower(\str_replace('Table : ', '', $fElement->getVar('fieldelement_name'))); $ret .= $this->pc->getPhpCodeCommentLine('Form Table', $rpFieldelementName, $t); @@ -855,16 +846,15 @@ private function getXoopsFormTag($fieldId, $required = 'false') */ private function getXoopsFormTextUuid($language, $fieldName, $required = 'false') { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); - $ret = $this->pc->getPhpCodeCommentLine('Form Text Uuid', $ccFieldName, "\t\t"); - $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '\Xmf\Uuid::generate()', "\$this->getVar('{$fieldName}')", "\t\t"); - $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 150, $ccFieldName, true); - $ret .= $this->cxc->getClassAddElement('form', $formText . $required); - + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Text Uuid', $ccFieldName, "\t\t"); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '\Xmf\Uuid::generate()', "\$this->getVar('{$fieldName}')", "\t\t"); + $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 150, $ccFieldName, true); + $ret .= $this->cxc->getClassAddElement('form', $formText . $required); return $ret; } - + /** * @private function getXoopsFormTextIp * @@ -875,7 +865,7 @@ private function getXoopsFormTextUuid($language, $fieldName, $required = 'false' */ private function getXoopsFormTextIp($language, $fieldName, $required = 'false') { - $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Text IP', $ccFieldName, "\t\t"); $ret .= $this->xc->getXcEqualsOperator('$' . $ccFieldName, "\$_SERVER['REMOTE_ADDR']", null, "\t\t"); @@ -899,15 +889,15 @@ public function renderElements() $tableSoleName = $table->getVar('table_solename'); $tablePermissions = $table->getVar('table_permissions'); $languageFunct = $this->cf->getLanguage($moduleDirname, 'AM'); - $ret = ''; - $fields = $this->tf->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order ASC, field_id'); - $fieldId = ''; - $fieldIdTopic = ''; - $fieldPidTopic = ''; - $fieldMainTopic = ''; - $fieldElementId = []; - $counter = 0; - $tagDone = false; + $ret = ''; + $fields = $this->tf->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order ASC, field_id'); + $fieldId = ''; + $fieldIdTopic = ''; + $fieldPidTopic = ''; + $fieldMainTopic = ''; + $fieldElementId = []; + $counter = 0; + $tagDone = false; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldDefault = $fields[$f]->getVar('field_default'); @@ -980,7 +970,7 @@ public function renderElements() $ret .= $this->getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required); break; case Constants::FIELD_ELE_PASSWORD: - $ret .= $this->getXoopsFormPassword($language, $fieldName, $required); + $ret .= $this->getXoopsFormPassword($language, $fieldName, $required); break; case Constants::FIELD_ELE_SELECTCOUNTRY: $ret .= $this->getXoopsFormSelectCountry($language, $fieldName, $required); @@ -1006,7 +996,7 @@ public function renderElements() default: // If we use tag module if (!$tagDone && 1 == $table->getVar('table_tag')) { - $ret .= $this->getXoopsFormTag($fieldId, $required); + $ret .= $this->getXoopsFormTag($fieldId, $required); $tagDone = true; } // If we want to hide XoopsFormHidden() or field id @@ -1016,9 +1006,9 @@ public function renderElements() break; } - $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); - $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); - if ((int)$fieldElementTid > 0 ) { + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); + $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); + if ((int)$fieldElementTid > 0) { if ((1 == $fieldParent) || 1 == $table->getVar('table_category')) { $fieldElementMid = $fieldElements->getVar('fieldelement_mid'); $fieldElementName = $fieldElements->getVar('fieldelement_name'); diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index a9c2f05d..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,17 +230,17 @@ 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(); @@ -255,27 +251,27 @@ public function renderConstantsInterface() $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; @@ -151,7 +150,7 @@ public function getFields() * * @abstract */ - public function render() + public function render(): void { } } diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 4e5b3104..4cd79ade 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -1,4 +1,4 @@ -getVar('mod_id'); @@ -414,7 +413,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; @@ -774,7 +773,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); @@ -850,7 +849,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; } @@ -303,7 +301,7 @@ private function getMode() * @param string $moduleDirname * @param string $prefix * @param string $suffix - * @param string $addFq //add function qualifier + * @param bool $addFq //add function qualifier * @return string */ public function getLanguage($moduleDirname, $prefix = '', $suffix = '', $addFq = true) @@ -342,10 +340,10 @@ public function getLeftString($string) */ public function getRightString($string = null) { - if (mb_strpos($string, '_')) { - $str = mb_strpos($string, '_'); + if (\mb_strpos($string, '_')) { + $str = \mb_strpos($string, '_'); if (false !== $str) { - $ret = mb_substr($string, $str + 1, mb_strlen($string)); + $ret = \mb_substr($string, $str + 1, \mb_strlen($string)); return $ret; } @@ -395,7 +393,7 @@ public function getUcfirst($string) */ public function getLcfirst($string) { - return lcfirst($string); + return \lcfirst($string); } /** @@ -498,9 +496,9 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = $ret .= "\n{$namespace}/*\n"; $filename = TDMC_CLASS_PATH . '/Files/Docs/license.txt'; - $handle = fopen($filename, 'rb'); - $data = fread($handle, filesize($filename)); - fclose($handle); + $handle = \fopen($filename, 'rb'); + $data = \fread($handle, \filesize($filename)); + \fclose($handle); $ret .= $data . "\n"; $ret .= "*/\n"; $copyright = [ @@ -541,6 +539,7 @@ public function renderFile() if (!$this->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/CreatePhpCode.php b/class/Files/CreatePhpCode.php index 4d02b8cb..abee2a06 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -1,4 +1,4 @@ -{$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'); @@ -703,7 +702,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 @@ -715,18 +714,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"; } @@ -967,11 +968,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); } @@ -1042,6 +1043,7 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $ret = $xc->getXcEqualsOperator('$xoopsconfirm', $confirm, '', $t); $ret .= $xc->getXcEqualsOperator('$form', '$xoopsconfirm->getFormXoopsConfirm()', '', $t); $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + return $ret; } @@ -1184,7 +1186,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'); @@ -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', 'Handler'); $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,13 +116,13 @@ 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); @@ -133,13 +131,13 @@ public function getCommentBody($module, $table) $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 9327f01b..e761ef3d 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -1,4 +1,4 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -73,7 +71,7 @@ public static function getInstance() * @param string $module * @param mixed $table */ - public function write($module, $table) + public function write($module, $table): void { $this->setModule($module); $this->setTable($table); @@ -90,8 +88,8 @@ public function renderCommentsIncludes($module, $filename) { $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); - $content .= $this->pc->getPhpCodeIncludeDir("\dirname(__DIR__, 2) . '/mainfile.php'",'',true, true); - $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH.'/include/{$filename}.php'",'',true, true); + $content .= $this->pc->getPhpCodeIncludeDir("\dirname(__DIR__, 2) . '/mainfile.php'", '', true, true); + $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH.'/include/{$filename}.php'", '', true, true); $this->create($moduleDirname, '', $filename . '.php', $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); @@ -119,14 +117,14 @@ public function renderCommentsNew($module, $filename) } $content = $this->getHeaderFilesComments($module); $content .= $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request']); - $content .= $this->pc->getPhpCodeIncludeDir("__DIR__ . '/../../../mainfile.php'",'',true, true); - $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true); + $content .= $this->pc->getPhpCodeIncludeDir("__DIR__ . '/../../../mainfile.php'", '', true, true); + $content .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'", '', true, true); $content .= $this->xc->getXcXoopsRequest('com_itemid', 'com_itemid', '0', 'Int'); - $contIf = $this->xc->getXcEqualsOperator("\${$tableName}Handler", "xoops_getModuleHandler('{$tableName}', '{$moduleDirname}')",'',"\t"); - $contIf .= $this->xc->getXcHandlerGet("{$tableName}", 'com_itemid','Obj', "{$tableName}Handler", false, "\t"); - $contIf .= $this->xc->getXcGetVar('com_replytitle', "{$tableName}Obj", $fieldMain,false, "\t"); - $contIf .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH.'/include/{$filename}.php'",'',true, true, '',"\t"); - $content .= $this->pc->getPhpCodeConditions('$com_itemid',' > ', '0', $contIf); + $contIf = $this->xc->getXcEqualsOperator("\${$tableName}Handler", "xoops_getModuleHandler('{$tableName}', '{$moduleDirname}')", '', "\t"); + $contIf .= $this->xc->getXcHandlerGet("{$tableName}", 'com_itemid', 'Obj', "{$tableName}Handler", false, "\t"); + $contIf .= $this->xc->getXcGetVar('com_replytitle', "{$tableName}Obj", $fieldMain, false, "\t"); + $contIf .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH.'/include/{$filename}.php'", '', true, true, '', "\t"); + $content .= $this->pc->getPhpCodeConditions('$com_itemid', ' > ', '0', $contIf); $this->create($moduleDirname, 'include', $filename . '.php', $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); 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 262cb931..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 95edc412..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 @@ -setModule($module); $this->setTable($table); diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index 7be01d88..5d87b462 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -97,17 +96,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 71906067..64d96f5a 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -93,27 +91,27 @@ private function getLanguageMain($module, $language) /** @var \XoopsModules\Modulebuilder\Utility $utility */ $utility = new \XoopsModules\Modulebuilder\Utility(); - $moduleName = $module->getVar('mod_name'); - $tables = $this->getTables(); - $ret = $this->ld->getBlankLine(); - $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'admin', true); - $ret .= $this->ld->getBlankLine(); - $ret .= $this->ld->getAboveHeadDefines('Main'); - $ret .= $this->ld->getDefine($language, 'INDEX', 'Overview ' . (string)$module->getVar('mod_name')); - $ret .= $this->ld->getDefine($language, 'TITLE', (string)$module->getVar('mod_name')); - $ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); - $ret .= $this->ld->getDefine( + $moduleName = $module->getVar('mod_name'); + $tables = $this->getTables(); + $ret = $this->ld->getBlankLine(); + $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'admin', true); + $ret .= $this->ld->getBlankLine(); + $ret .= $this->ld->getAboveHeadDefines('Main'); + $ret .= $this->ld->getDefine($language, 'INDEX', 'Overview ' . (string)$module->getVar('mod_name')); + $ret .= $this->ld->getDefine($language, 'TITLE', (string)$module->getVar('mod_name')); + $ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); + $ret .= $this->ld->getDefine( $language, 'INDEX_DESC', "Welcome to the homepage of your new module {$moduleName}!
    As you can see, you have created a page with a list of links at the top to navigate between the pages of your module. This description is only visible on the homepage of this module, the other pages you will see the content you created when you built this module with the module ModuleBuilder, and after creating new content in admin of this module. In order to expand this module with other resources, just add the code you need to extend the functionality of the same. The files are grouped by type, from the header to the footer to see how divided the source code.

    If you see this message, it is because you have not created content for this module. Once you have created any type of content, you will not see this message.

    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!

    Use the link below to go to the admin and create content.", true ); - $ret .= $this->ld->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); - $ret .= $this->ld->getDefine($language, 'NO', 'No'); - $ret .= $this->ld->getDefine($language, 'DETAILS', 'Show details'); - $ret .= $this->ld->getDefine($language, 'BROKEN', 'Notify broken'); - $ret .= $this->ld->getAboveHeadDefines('Contents'); + $ret .= $this->ld->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); + $ret .= $this->ld->getDefine($language, 'NO', 'No'); + $ret .= $this->ld->getDefine($language, 'DETAILS', 'Show details'); + $ret .= $this->ld->getDefine($language, 'BROKEN', 'Notify broken'); + $ret .= $this->ld->getAboveHeadDefines('Contents'); $ucfTableName = ''; $ucfTableSoleName = ''; $stuTableSoleName = ''; @@ -124,7 +122,7 @@ private function getLanguageMain($module, $language) $tablePrint = 0; foreach (\array_keys($tables) as $i) { if (1 == $tables[$i]->getVar('table_user')) { - $tableName = $tables[$i]->getVar('table_name'); + $tableName = $tables[$i]->getVar('table_name'); $tableSoleName = $tables[$i]->getVar('table_solename'); if (1 === (int)$tables[$i]->getVar('table_submit')) { $tableSubmit = 1; @@ -138,12 +136,12 @@ private function getLanguageMain($module, $language) if (1 === (int)$tables[$i]->getVar('table_print')) { $tablePrint = 1; } - $stuTableName = \mb_strtoupper($tableName); + $stuTableName = \mb_strtoupper($tableName); $stuTableSoleName = \mb_strtoupper($tableSoleName); - $ucfTableName = $utility::UcFirstAndToLower($tableName); + $ucfTableName = $utility::UcFirstAndToLower($tableName); $ucfTableSoleName = $utility::UcFirstAndToLower($tableSoleName); - $ret .= $this->ld->getAboveDefines($ucfTableSoleName); - $ret .= $this->ld->getDefine($language, $stuTableSoleName, $ucfTableSoleName); + $ret .= $this->ld->getAboveDefines($ucfTableSoleName); + $ret .= $this->ld->getDefine($language, $stuTableSoleName, $ucfTableSoleName); if (1 === $tableSubmit) { $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_ADD", "Add {$ucfTableSoleName}"); $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_EDIT", "Edit {$ucfTableSoleName}"); @@ -155,13 +153,13 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getDefine($language, "{$stuTableName}_TITLE", "{$ucfTableName} title"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_DESC", "{$ucfTableName} description"); - $ret .= $this->ld->getAboveDefines("Caption of {$ucfTableSoleName}"); + $ret .= $this->ld->getAboveDefines("Caption of {$ucfTableSoleName}"); $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); $fieldNameDesc = \ucfirst($rpFieldName); - $ret .= $this->ld->getDefine($language, $stuTableSoleName . '_' . $rpFieldName, $fieldNameDesc); + $ret .= $this->ld->getDefine($language, $stuTableSoleName . '_' . $rpFieldName, $fieldNameDesc); } } } @@ -213,6 +211,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 4f052285..d4850c0d 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"); @@ -287,7 +285,7 @@ private function getLanguageConfig($language, $tables) if (13 == $fieldElement) { $fieldImage = true; } - if (14 == $fieldElement) { + if (14 == $fieldElement) { $fieldFile = true; } } @@ -319,7 +317,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'); @@ -330,24 +328,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', @@ -363,27 +361,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', @@ -413,29 +411,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"; @@ -473,7 +471,6 @@ private function getLanguagePermissionsGroups($language) return $ret; } - /** * @private function getLanguagePermissionsGroups * @param $language @@ -548,12 +545,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); } @@ -572,7 +568,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 aa83723d..adb8b552 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 8d1363e8..dc52b2f2 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 38db6744..e09b3565 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -91,7 +89,7 @@ public function write($module, $table, $filename) */ private function getTemplatesAdminPagesHeader($moduleDirname) { - $ret = $this->hc->getHtmlComment('Header', '',"\n"); + $ret = $this->hc->getHtmlComment('Header', '', "\n"); $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); return $ret; @@ -101,7 +99,7 @@ private function getTemplatesAdminPagesHeader($moduleDirname) * @private function getTemplatesAdminPagesTableThead * @param $tableSoleName * @param $tableAutoincrement - * @param array $fields + * @param array $fields * @param string $language * @return string */ @@ -137,7 +135,7 @@ private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincr * @param string $tableName * @param $tableSoleName * @param $tableAutoincrement - * @param array $fields + * @param array $fields * @return string * @internal param string $language */ @@ -146,7 +144,7 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $td = ''; if (1 == $tableAutoincrement) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); } $fieldId = ''; foreach (\array_keys($fields) as $f) { @@ -161,13 +159,13 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); - $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); break; case Constants::FIELD_ELE_CHECKBOX: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16') . $double . '.png'; - $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true,'',''); - $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); + $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t\t"); break; case Constants::FIELD_ELE_COLORPICKER: // This is to be reviewed, as it was initially to style = "backgroung-color: #" @@ -175,31 +173,31 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t // Old code was ... $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $color = "    "; - $td .= $this->hc->getHtmlTableData($color, 'center', '',"\t\t\t\t"); + $td .= $this->hc->getHtmlTableData($color, 'center', '', "\t\t\t\t"); break; case Constants::FIELD_ELE_IMAGELIST: $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\t"); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); + $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t\t"); break; case Constants::FIELD_ELE_UPLOADIMAGE: $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, 'style' => 'max-width:100px'], '', true, '', ''); - $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); + $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'status'); $src = $this->sc->getSmartyNoSimbol('$modPathIcon16') . 'status' . $double . '.png'; $imgAlt = $this->sc->getSmartyDoubleVar($tableSoleName, 'status_text'); - $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $imgAlt, 'title' => $imgAlt], '', true,'',''); - $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $imgAlt, 'title' => $imgAlt], '', true, '', ''); + $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t\t"); break; default: if (0 != $f) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); } break; } @@ -208,12 +206,12 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $lang = $this->sc->getSmartyConst('', '_EDIT'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 edit.png'); - $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true, '', ''); $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double . '&start=<{$start}>&limit=<{$limit}>', 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_CLONE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 editcopy.png'); - $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true, '', ''); $anchor .= $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=clone&{$fieldId}_source=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_DELETE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); @@ -223,8 +221,8 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $td .= $this->hc->getHtmlTag('td', ['class' => 'center width5'], "\n" . $anchor . "\t\t\t\t", false, "\t\t\t\t"); $cycle = $this->sc->getSmartyNoSimbol('cycle values=\'odd, even\''); $tr = $this->hc->getHtmlTableRow($td, $cycle, "\t\t\t"); - $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '','', "\t\t\t"); - $tbody = $this->hc->getHtmlTableTbody($foreach,'' , "\t\t"); + $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '', '', "\t\t\t"); + $tbody = $this->hc->getHtmlTableTbody($foreach, '', "\t\t"); return $this->sc->getSmartyConditions($tableName . '_count', '', '', $tbody, '', false, false, "\t\t"); } @@ -264,7 +262,7 @@ private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleNa $single = $this->sc->getSmartySingleVar('pagenav'); $div = $this->hc->getHtmlTag('div', ['class' => 'xo-pagenav floatright'], $single, false, "\t\t"); $div .= $this->hc->getHtmlTag('div', ['class' => 'clear spacer'], '', false, "\t\t", "\n"); - $htmlTable .= $this->sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', "\t" ); + $htmlTable .= $this->sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', "\t"); $ifList = $this->sc->getSmartyConditions($tableName . '_list', '', '', $htmlTable); $single = $this->sc->getSmartySingleVar('form', "\t", "\n"); $ifList .= $this->sc->getSmartyConditions('form', '', '', $single); 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,25 +166,25 @@ 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"); } diff --git a/class/Files/Templates/Blocks/Defstyle/index.php b/class/Files/Templates/Blocks/Defstyle/index.php index 4ae18fd0..e5ee0725 100644 --- a/class/Files/Templates/Blocks/Defstyle/index.php +++ b/class/Files/Templates/Blocks/Defstyle/index.php @@ -1,2 +1,2 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index 82192619..d5fe2f2f 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, 'header') . PHP_EOL; } @@ -186,14 +182,14 @@ private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSo private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language) { $stuTableName = \mb_strtoupper($tableName); - $incl = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; - $html = $this->hc->getHtmlEmpty('
    ') . PHP_EOL; - $incl .= $this->sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$numb_col', $html, false, false, false, '',"\n", true, false) . PHP_EOL; - $const = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE'); - $div = $this->hc->getHtmlDiv($const, 'panel-heading') . PHP_EOL; - $cont = $this->hc->getHtmlDiv($incl, 'panel panel-body') . PHP_EOL; - $div .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; - $panelType = $this->sc->getSmartySingleVar('panel_type'); + $incl = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; + $html = $this->hc->getHtmlEmpty('
    ') . PHP_EOL; + $incl .= $this->sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$numb_col', $html, false, false, false, '', "\n", true, false) . PHP_EOL; + $const = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE'); + $div = $this->hc->getHtmlDiv($const, 'panel-heading') . PHP_EOL; + $cont = $this->hc->getHtmlDiv($incl, 'panel panel-body') . PHP_EOL; + $div .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; + $panelType = $this->sc->getSmartySingleVar('panel_type'); return $this->hc->getHtmlDiv($div, 'panel panel-' . $panelType) . PHP_EOL; } @@ -206,7 +202,6 @@ private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $ta */ private function getTemplatesUserCategoriesFooter($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); } @@ -216,16 +211,16 @@ private function getTemplatesUserCategoriesFooter($moduleDirname) */ public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $language = $this->getLanguage($moduleDirname, 'MA', '', false); - $content = $this->getTemplatesUserCategoriesHeader($moduleDirname); - $content .= $this->getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language); - $content .= $this->getTemplatesUserCategoriesFooter($moduleDirname); + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); + $content = $this->getTemplatesUserCategoriesHeader($moduleDirname); + $content .= $this->getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language); + $content .= $this->getTemplatesUserCategoriesFooter($moduleDirname); $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); 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 dbdaf034..83ba0be8 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); @@ -92,12 +89,12 @@ public function write($module, $filename) */ public function getTemplatesUserHeader($moduleDirname) { - $ret = ''; + $ret = ''; $cond = $this->sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, true, "\t"); - $ret .= $this->sc->getSmartyConditions('xoBreadcrumbs', '', '', $cond); - $var = $this->sc->getSmartySingleVar('ads', '', ''); - $div = $this->hc->getHtmlDiv($var, 'center', "\t","\n", false) ; - $ret .= $this->sc->getSmartyConditions('ads', '', '', $div); + $ret .= $this->sc->getSmartyConditions('xoBreadcrumbs', '', '', $cond); + $var = $this->sc->getSmartySingleVar('ads', '', ''); + $div = $this->hc->getHtmlDiv($var, 'center', "\t", "\n", false); + $ret .= $this->sc->getSmartyConditions('ads', '', '', $div); return $ret; } @@ -111,16 +108,16 @@ public function getTemplatesUserHeader($moduleDirname) public function getTemplateUserHeaderFacebbokSDK() { $ret = <<<'EOT' - -
    - -EOT; + +
    + + EOT; return $ret; } @@ -135,7 +132,7 @@ public function render() $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getTemplatesUserHeader($moduleDirname); + $content = $this->getTemplatesUserHeader($moduleDirname); $this->cf->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 95ffae55..13d45f46 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,8 +88,7 @@ public function write($module, $table, $tables, $filename) */ public function getTemplateUserIndexHeader($moduleDirname) { - - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, false, '', "\n"); } /** @@ -103,50 +100,50 @@ public function getTemplateUserIndexHeader($moduleDirname) public function getTemplatesUserIndexIntro($module, $language) { $moduleDirname = $module->getVar('mod_dirname'); - $ret = $this->hc->getHtmlEmpty('','',"\n"); - $ret .= $this->hc->getHtmlComment('Start index list','', "\n"); + $ret = $this->hc->getHtmlEmpty('', '', "\n"); + $ret .= $this->hc->getHtmlComment('Start index list', '', "\n"); //Table head - $th = $this->hc->getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '',"\t\t\t"); - $tr = $this->hc->getHtmlTableRow($th,'center',"\t\t"); - $thead = $this->hc->getHtmlTableThead($tr,'', "\t"); + $th = $this->hc->getHtmlTableHead("<{\$smarty.const.{$language}TITLE}> - <{\$smarty.const.{$language}DESC}>", '', '', "\t\t\t"); + $tr = $this->hc->getHtmlTableRow($th, 'center', "\t\t"); + $thead = $this->hc->getHtmlTableThead($tr, '', "\t"); $contTable = $thead; //Table body - $li = $this->hc->getHtmlLi("<{\$smarty.const.{$language}INDEX}>",'',"\t\t\t\t\t"); + $li = $this->hc->getHtmlLi("<{\$smarty.const.{$language}INDEX}>", '', "\t\t\t\t\t"); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); foreach (\array_keys($tables) as $i) { if (1 == $tables[$i]->getVar('table_index')) { - $tableNameLi = $tables[$i]->getVar('table_name'); - $tableName = $tables[$i]->getVar('table_name'); + $tableNameLi = $tables[$i]->getVar('table_name'); + $tableName = $tables[$i]->getVar('table_name'); $stuTableNameLi = \mb_strtoupper($tableName); - $li .= $this->hc->getHtmlLi("<{\$smarty.const.{$language}{$stuTableNameLi}}>", '', "\t\t\t\t\t"); + $li .= $this->hc->getHtmlLi("<{\$smarty.const.{$language}{$stuTableNameLi}}>", '', "\t\t\t\t\t"); } } - $ul = $this->hc->getHtmlUl($li,'menu text-center',"\t\t\t\t"); - $td = $this->hc->getHtmlTableData($ul, 'bold pad5','',"\t\t\t", "\n", true); - $tr = $this->hc->getHtmlTablerow($td, 'center',"\t\t"); - $tbody = $this->hc->getHtmlTableTbody($tr,'', "\t"); + $ul = $this->hc->getHtmlUl($li, 'menu text-center', "\t\t\t\t"); + $td = $this->hc->getHtmlTableData($ul, 'bold pad5', '', "\t\t\t", "\n", true); + $tr = $this->hc->getHtmlTablerow($td, 'center', "\t\t"); + $tbody = $this->hc->getHtmlTableTbody($tr, '', "\t"); $contTable .= $tbody; //Table foot $single = $this->sc->getSmartySingleVar('adv'); - $cond = $this->sc->getSmartyConditions('adv','','', $single, false, '','', "\t\t\t\t", "\n", false); - $td = $this->hc->getHtmlTableData($cond, 'bold pad5','',"\t\t\t", "\n", true); - $tr = $this->hc->getHtmlTablerow($td, 'center',"\t\t"); - $tfoot = $this->hc->getHtmlTableTfoot($tr,'', "\t"); + $cond = $this->sc->getSmartyConditions('adv', '', '', $single, false, '', '', "\t\t\t\t", "\n", false); + $td = $this->hc->getHtmlTableData($cond, 'bold pad5', '', "\t\t\t", "\n", true); + $tr = $this->hc->getHtmlTablerow($td, 'center', "\t\t"); + $tfoot = $this->hc->getHtmlTableTfoot($tr, '', "\t"); $contTable .= $tfoot; $ret .= $this->hc->getHtmlTable($contTable); - $ret .= $this->hc->getHtmlComment('End index list','', "\n"); - $ret .= $this->hc->getHtmlEmpty('','',"\n"); + $ret .= $this->hc->getHtmlComment('End index list', '', "\n"); + $ret .= $this->hc->getHtmlEmpty('', '', "\n"); return $ret; } /** * @public function getTemplateUserIndexTable - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $language * @param string $t * @return bool|string */ @@ -154,18 +151,18 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole { $double = $this->sc->getSmartyConst($language, 'INDEX_LATEST_LIST'); $ret = $this->hc->getHtmlDiv($double, "{$moduleDirname}-linetitle", $t, "\n", false); - $table = $this->hc->getHtmlComment("Start show new {$tableName} in index",$t . "\t", "\n"); + $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"); - $foreach .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $td, $tableSoleName,'',"\t\t\t"); - $foreach .= $this->hc->getHtmlComment('End new link loop',$t . "\t\t\t", "\n"); - $tr .= $this->hc->getHtmlTableRow($foreach, '',$t . "\t\t"); + $foreach = $this->hc->getHtmlComment('Start new link loop', $t . "\t\t\t", "\n"); + $foreach .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $td, $tableSoleName, '', "\t\t\t"); + $foreach .= $this->hc->getHtmlComment('End new link loop', $t . "\t\t\t", "\n"); + $tr .= $this->hc->getHtmlTableRow($foreach, '', $t . "\t\t"); - $table .= $this->hc->getHtmlTable($tr, 'table table-<{$table_type}>', $t . "\t"); - $ret .= $this->sc->getSmartyConditions($tableName . 'Count', ' > ','0', $table, false, false, false, '', "\n", true, 'int'); + $table .= $this->hc->getHtmlTable($tr, 'table table-<{$table_type}>', $t . "\t"); + $ret .= $this->sc->getSmartyConditions($tableName . 'Count', ' > ', '0', $table, false, false, false, '', "\n", true, 'int'); return $ret; } @@ -195,14 +192,14 @@ public function render() $content = $this->getTemplateUserIndexHeader($moduleDirname); $content .= $this->getTemplatesUserIndexIntro($module, $language); foreach (\array_keys($tables) as $t) { - $tableName = $tables[$t]->getVar('table_name'); - $tableSoleName = $tables[$t]->getVar('table_solename'); - $tableIndex = $tables[$t]->getVar('table_index'); + $tableName = $tables[$t]->getVar('table_name'); + $tableSoleName = $tables[$t]->getVar('table_solename'); + $tableIndex = $tables[$t]->getVar('table_index'); if (1 == $tableIndex) { $content .= $this->getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language); } } - $content .= $this->getTemplateUserIndexFooter($moduleDirname); + $content .= $this->getTemplateUserIndexFooter($moduleDirname); $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); 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 c72da3ba..acf22990 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); @@ -88,7 +86,7 @@ public function write($module, $table, $filename) */ private function getTemplatesUserPagesHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', '','','',"\n\n"); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', '', '', '', "\n\n"); } /** @@ -136,15 +134,15 @@ private function getTemplatesUserPagesTableThead($tableName, $language) private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) { $single = $this->sc->getSmartySingleVar('panel_type'); - $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false,false, "\t\t\t\t\t\t", "\n"); + $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false, false, "\t\t\t\t\t\t", "\n"); $div = $this->hc->getHtmlDiv($include, 'panel panel-' . $single, "\t\t\t\t\t", "\n"); $cont = $this->hc->getHtmlTableData($div, '', '', "\t\t\t\t", "\n", true); $html = $this->hc->getHtmlEmpty('', "\t\t\t\t\t", "\n"); - $cont .= $this->sc->getSmartyConditions('smarty.foreach.' . $tableSoleName . '.iteration', ' is div by ', '$divideby', $html, '', '', '',"\t\t\t\t", "\n", true, false); - $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont, $tableSoleName,'',"\t\t\t\t"); - $tr = $this->hc->getHtmlTableRow($foreach,'',"\t\t\t"); + $cont .= $this->sc->getSmartyConditions('smarty.foreach.' . $tableSoleName . '.iteration', ' is div by ', '$divideby', $html, '', '', '', "\t\t\t\t", "\n", true, false); + $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont, $tableSoleName, '', "\t\t\t\t"); + $tr = $this->hc->getHtmlTableRow($foreach, '', "\t\t\t"); - return $this->hc->getHtmlTableTbody($tr,'',"\t\t"); + return $this->hc->getHtmlTableTbody($tr, '', "\t\t"); } /** @@ -183,7 +181,7 @@ private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleNam */ private function getTemplatesUserPagesForm($t = "\t") { - $var = $this->sc->getSmartySingleVar('form', $t, "\n"); + $var = $this->sc->getSmartySingleVar('form', $t, "\n"); return $this->sc->getSmartyConditions('form', '', '', $var, false, false, true); } @@ -195,7 +193,7 @@ private function getTemplatesUserPagesForm($t = "\t") */ private function getTemplatesUserPagesError($t = "\t") { - $var = $this->sc->getSmartySingleVar('error', $t, "\n"); + $var = $this->sc->getSmartySingleVar('error', $t, "\n"); return $this->sc->getSmartyConditions('error', '', '', $var, false, false, true); } diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 475928b9..cc2c870d 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); @@ -100,15 +98,15 @@ public function write($module, $table, $tables, $filename) */ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableRate, $tableBroken, $language) { - $fields = $this->getTableFields($tableMid, $tableId); - $ret = ''; - $retNumb = ''; + $fields = $this->getTableFields($tableMid, $tableId); + $ret = ''; + $retNumb = ''; $fieldId = ''; $ccFieldId = ''; $keyDouble = ''; foreach (\array_keys($fields) as $f) { if (0 == $f) { - $fieldId = $fields[$f]->getVar('field_name'); + $fieldId = $fields[$f]->getVar('field_name'); $ccFieldId = $this->getCamelCase($fieldId, false, true); $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $fieldId); } @@ -117,7 +115,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_thead')) { switch ($fieldElement) { default: - //case 2: + //case 2: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); @@ -136,8 +134,8 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_tbody')) { switch ($fieldElement) { default: - //case 3: - //case 4: + //case 3: + //case 4: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); @@ -158,7 +156,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $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->getHtmlSpan($img, 'col-sm-3',"\t"); + $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-3', "\t"); unset($img); break; } @@ -167,7 +165,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table } $ret .= $this->hc->getHtmlDiv($retElem, 'panel-body'); - $retFoot = ''; + $retFoot = ''; foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_user')) { if (1 == $fields[$f]->getVar('field_tfoot')) { @@ -176,33 +174,33 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify', "\t"); } } } $anchors = ''; $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); - $contIf = $this->hc->getHtmlAnchor($tableName . '.php?op=list&start=<{$start}>&limit=<{$limit}>#' .$ccFieldId . '_' . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $contIf = $this->hc->getHtmlAnchor($tableName . '.php?op=list&start=<{$start}>&limit=<{$limit}>#' . $ccFieldId . '_' . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst($language, 'DETAILS'); - $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); - $anchors .= $this->sc->getSmartyConditions('showItem', '', '', $contIf, $contElse, '', '', "\t\t"); + $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $anchors .= $this->sc->getSmartyConditions('showItem', '', '', $contIf, $contElse, '', '', "\t\t"); $lang = $this->sc->getSmartyConst('', '_EDIT'); - $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); + $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_CLONE'); - $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=clone&{$fieldId}_source=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); + $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=clone&{$fieldId}_source=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_DELETE'); - $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-danger right', '', "\t\t\t", "\n"); + $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-danger right', '', "\t\t\t", "\n"); $anchors .= $this->sc->getSmartyConditions('permEdit', '', '', $contIf, false, '', '', "\t\t"); if (1 == $tableBroken) { - $lang = $this->sc->getSmartyConst($language, 'BROKEN'); - $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); + $lang = $this->sc->getSmartyConst($language, 'BROKEN'); + $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); } - $retFoot .= $this->hc->getHtmlDiv($anchors, 'col-sm-12 right',"\t", "\n"); - $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); + $retFoot .= $this->hc->getHtmlDiv($anchors, 'col-sm-12 right', "\t", "\n"); + $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); if ($tableRate) { $rate = $this->sc->getSmartyIncludeFile($moduleDirname, 'rate', false, false, "\t", "\n", 'item=$' . $tableSoleName); - $ret .= $this->sc->getSmartyConditions('rating', '', '', $rate, false); + $ret .= $this->sc->getSmartyConditions('rating', '', '', $rate, false); } return $ret; @@ -215,12 +213,12 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table */ public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $moduleDirname = $module->getVar('mod_dirname'); - $filename = $this->getFileName(); - $language = $this->getLanguage($moduleDirname, 'MA', '', false); - $content = ''; + $module = $this->getModule(); + $table = $this->getTable(); + $moduleDirname = $module->getVar('mod_dirname'); + $filename = $this->getFileName(); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); + $content = ''; $tableId = $table->getVar('table_id'); $tableMid = $table->getVar('table_mid'); $tableName = $table->getVar('table_name'); diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index cccaf20a..1dbf5b57 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); @@ -107,7 +105,7 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_ihead')) { switch ($fieldElement) { default: - //case 2: + //case 2: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); @@ -117,13 +115,13 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table } } } - $ret .= $this->hc->getHtmlDiv($retNumb, 'panel-heading'); + $ret .= $this->hc->getHtmlDiv($retNumb, 'panel-heading'); $retElem = ''; $fieldId = ''; $keyDouble = ''; foreach (\array_keys($fields) as $f) { if (0 == $f) { - $fieldId = $fields[$f]->getVar('field_name'); + $fieldId = $fields[$f]->getVar('field_name'); $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $fieldId); } $fieldElement = $fields[$f]->getVar('field_element'); @@ -131,8 +129,8 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_ibody')) { switch ($fieldElement) { default: - //case 3: - //case 4: + //case 3: + //case 4: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); @@ -153,7 +151,7 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table $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->getHtmlSpan($img, 'col-sm-3',"\t"); + $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-3', "\t"); unset($img); break; } @@ -161,7 +159,6 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table } } - $ret .= $this->hc->getHtmlDiv($retElem, 'panel-body'); $retFoot = ''; foreach (\array_keys($fields) as $f) { @@ -172,14 +169,14 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify', "\t"); } } } - $lang = $this->sc->getSmartyConst($language, 'DETAILS'); - $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-primary', '', '', ''); - $retFoot .= $this->hc->getHtmlSpan($anchor, 'col-sm-12',"\t"); - $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); + $lang = $this->sc->getSmartyConst($language, 'DETAILS'); + $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-primary', '', '', ''); + $retFoot .= $this->hc->getHtmlSpan($anchor, 'col-sm-12', "\t"); + $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); return $ret; } @@ -191,12 +188,12 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table */ public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $moduleDirname = $module->getVar('mod_dirname'); - $filename = $this->getFileName(); - $language = $this->getLanguage($moduleDirname, 'MA', '', false); - $content = ''; + $module = $this->getModule(); + $table = $this->getTable(); + $moduleDirname = $module->getVar('mod_dirname'); + $filename = $this->getFileName(); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); + $content = ''; $tableId = $table->getVar('table_id'); $tableMid = $table->getVar('table_mid'); $tableName = $table->getVar('table_name'); 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 eabc5b09..5b25003d 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 a775e4ef..398e5962 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, null); $content .= $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); 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 f7354e32..31213ccd 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -25,9 +25,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops https://xoops.org + * @author Txmod Xoops https://xoops.org * Goffy https://myxoops.org - * */ /** @@ -39,12 +38,10 @@ class UserPages extends Files\CreateFile * @var mixed */ private $uxc = null; - /** * @var mixed */ private $xc = null; - /** * @var mixed */ @@ -133,21 +130,21 @@ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $table $ret .= $this->xc->getXcEqualsOperator('$permEdit', '$permissionsHandler->getPermGlobalSubmit()'); $ret .= $this->xc->getXcXoopsTplAssign('permEdit', '$permEdit'); } - $ret .= $this->xc->getXcXoopsTplAssign('showItem', "\${$ccFieldId} > 0"); - $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->xc->getXcXoopsTplAssign('showItem', "\${$ccFieldId} > 0"); + $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; } /** * @private function getUserPagesList - * @param $moduleDirname - * @param $tableName - * @param $fieldId - * @param $fieldMain - * @param $tableRate - * @param $fieldReads - * @param $language + * @param $moduleDirname + * @param $tableName + * @param $fieldId + * @param $fieldMain + * @param $tableRate + * @param $fieldReads + * @param $language * @param string $t * @return string */ @@ -164,38 +161,38 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $ret .= $this->uxc->getUserBreadcrumbs($language, $tableName, 'list', '', "\t\t"); if ($tableRate) { $varRate = '$ratingbars'; - $ret .= $this->xc->getXcEqualsOperator($varRate, '(int)' . $this->xc->getXcGetConfig('ratingbars'),'', $t); - $contIf = $this->xc->getXcXoThemeAddStylesheet("\\{$stuModuleDirname}_URL . '/assets/css/rating.css'", $t . "\t", false); - $contIf .= $this->xc->getXcXoopsTplAssign('rating', $varRate, true, $t . "\t"); - $contIf .= $this->xc->getXcXoopsTplAssign('rating_5stars', "(Constants::RATING_5STARS === {$varRate})", true, $t . "\t"); - $contIf .= $this->xc->getXcXoopsTplAssign('rating_10stars', "(Constants::RATING_10STARS === {$varRate})", true, $t . "\t"); - $contIf .= $this->xc->getXcXoopsTplAssign('rating_10num', "(Constants::RATING_10NUM === {$varRate})", true, $t . "\t"); - $contIf .= $this->xc->getXcXoopsTplAssign('rating_likes', "(Constants::RATING_LIKES === {$varRate})", true, $t . "\t"); - $contIf .= $this->xc->getXcXoopsTplAssign('itemid', "'{$fieldId}'", true, $t . "\t"); - $contIf .= $this->xc->getXcXoopsTplAssign($moduleDirname . '_icon_url_16', "\\{$stuModuleDirname}_URL . '/' . \$modPathIcon16", true, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions($varRate, ' > ', '0', $contIf, false, $t); + $ret .= $this->xc->getXcEqualsOperator($varRate, '(int)' . $this->xc->getXcGetConfig('ratingbars'), '', $t); + $contIf = $this->xc->getXcXoThemeAddStylesheet("\\{$stuModuleDirname}_URL . '/assets/css/rating.css'", $t . "\t", false); + $contIf .= $this->xc->getXcXoopsTplAssign('rating', $varRate, true, $t . "\t"); + $contIf .= $this->xc->getXcXoopsTplAssign('rating_5stars', "(Constants::RATING_5STARS === {$varRate})", true, $t . "\t"); + $contIf .= $this->xc->getXcXoopsTplAssign('rating_10stars', "(Constants::RATING_10STARS === {$varRate})", true, $t . "\t"); + $contIf .= $this->xc->getXcXoopsTplAssign('rating_10num', "(Constants::RATING_10NUM === {$varRate})", true, $t . "\t"); + $contIf .= $this->xc->getXcXoopsTplAssign('rating_likes', "(Constants::RATING_LIKES === {$varRate})", true, $t . "\t"); + $contIf .= $this->xc->getXcXoopsTplAssign('itemid', "'{$fieldId}'", true, $t . "\t"); + $contIf .= $this->xc->getXcXoopsTplAssign($moduleDirname . '_icon_url_16', "\\{$stuModuleDirname}_URL . '/' . \$modPathIcon16", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions($varRate, ' > ', '0', $contIf, false, $t); } - $critName = 'cr' . $ucfTableName; - $ret .= $this->xc->getXcCriteriaCompo($critName, $t); - $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", "\${$ccFieldId}",'',true); - $contIf = $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contIf, false, $t); - $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); - $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count", '', $t); - $contIf = $this->xc->getXcCriteriaSetStart($critName, '$start', $t . "\t"); - $contIf .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' === ', '0', $contIf, false, $t); - $ret .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t); - $condIf = $this->pc->getPhpCodeArray($tableName, null, false, $t . "\t"); - $condIf .= $this->xc->getXcEqualsOperator("\${$ccFieldMain}", "''",'', $t . "\t"); - $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, $t . "\t"); - $foreach = $this->xc->getXcGetValues($tableName, $tableName . '[$i]', 'i', false, $t . "\t\t"); - $foreach .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}All[\$i]", $fieldMain, false, $t . "\t\t"); - $foreach .= $this->xc->getXcEqualsOperator('$keywords[$i]', "\${$ccFieldMain}",'', $t . "\t\t"); + $critName = 'cr' . $ucfTableName; + $ret .= $this->xc->getXcCriteriaCompo($critName, $t); + $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", "\${$ccFieldId}", '', true); + $contIf = $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contIf, false, $t); + $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); + $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count", '', $t); + $contIf = $this->xc->getXcCriteriaSetStart($critName, '$start', $t . "\t"); + $contIf .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' === ', '0', $contIf, false, $t); + $ret .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t); + $condIf = $this->pc->getPhpCodeArray($tableName, null, false, $t . "\t"); + $condIf .= $this->xc->getXcEqualsOperator("\${$ccFieldMain}", "''", '', $t . "\t"); + $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, $t . "\t"); + $foreach = $this->xc->getXcGetValues($tableName, $tableName . '[$i]', 'i', false, $t . "\t\t"); + $foreach .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}All[\$i]", $fieldMain, false, $t . "\t\t"); + $foreach .= $this->xc->getXcEqualsOperator('$keywords[$i]', "\${$ccFieldMain}", '', $t . "\t\t"); if ($tableRate) { - $itemId = $this->xc->getXcGetVar($ccFieldId, "{$tableName}All[\$i]", $fieldId, true); - $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); - $foreach .= $this->xc->getXcEqualsOperator("\${$tableName}[\$i]['rating']", "\$ratingsHandler->getItemRating({$itemId}, {$const})",'', $t . "\t\t"); + $itemId = $this->xc->getXcGetVar($ccFieldId, "{$tableName}All[\$i]", $fieldId, true); + $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); + $foreach .= $this->xc->getXcEqualsOperator("\${$tableName}[\$i]['rating']", "\$ratingsHandler->getItemRating({$itemId}, {$const})", '', $t . "\t\t"); } $condIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t . "\t"); $condIf .= $this->xc->getXcXoopsTplAssign($tableName, "\${$tableName}", true, $t . "\t"); @@ -209,28 +206,25 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $condIf .= $this->xc->getXcXoopsTplAssign('divideby', $divideby, true, $t . "\t"); $numbCol = $this->xc->getXcGetConfig('numb_col'); $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"); + $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"); if ('' !== $fieldReads) { $condIf3 = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t\t"); - - $getVar = $this->xc->getXcGetVar('', "{$tableName}Obj", $fieldReads, true); + $getVar = $this->xc->getXcGetVar('', "{$tableName}Obj", $fieldReads, true); $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', 'Handler'); - $condIf3 .= $this->getSimpleString($insert .';',$t . "\t\t"); + $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj', 'Handler'); + $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"); - } - - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, false, $t); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, false, $t); return $ret; } @@ -241,8 +235,8 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa * @param $fields * @param string $tableName * @param $tableSoleName - * @param $tablePermissions - * @param $tableNotifications + * @param $tablePermissions + * @param $tableNotifications * @param $language * @param string $t * @return string @@ -261,16 +255,16 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { - $fieldId = $fieldName; - $ccFieldId = $this->getCamelCase($fieldId, false, true); + $fieldId = $fieldName; + $ccFieldId = $this->getCamelCase($fieldId, false, true); $ucfFieldId = \ucfirst($ccFieldId); } if ($fields[$f]->getVar('field_element') >= Constants::FIELD_ELE_IMAGELIST && $fields[$f]->getVar('field_element') <= Constants::FIELD_ELE_UPLOADFILE) { $countUploader++; } 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); } if ($fields[$f]->getVar('field_element') == Constants::FIELD_ELE_SELECTSTATUS) { $fieldStatus = $fieldName; @@ -285,16 +279,16 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectError, false, $t); if (1 == $tablePermissions) { - $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); - $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('Check permissions', '', $t); + $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, '\_NOPERM', true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); } - $getObj = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t"); - $createObj = $this->xc->getXcHandlerCreateObj($tableName, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $getObj, $createObj, $t); - $ret .= $this->xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t); - $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t); - $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj', 'Handler'); + $getObj = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t"); + $createObj = $this->xc->getXcHandlerCreateObj($tableName, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $getObj, $createObj, $t); + $ret .= $this->xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t); + $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj', 'Handler'); $contentInsert = ''; if (1 == $tableNotifications || $countUploader > 0) { @@ -304,28 +298,28 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole if (1 == $tablePermissions) { $contentInsert .= $this->xc->getXcXoopsHandler('groupperm', $t . "\t"); $contentInsert .= $this->xc->getXcEqualsOperator('$mid', "\$GLOBALS['xoopsModule']->getVar('mid')", null, $t . "\t"); - $contentInsert .= $this->getPermissionsSave($moduleDirname, $ucfFieldId,'view_' . $tableName); + $contentInsert .= $this->getPermissionsSave($moduleDirname, $ucfFieldId, 'view_' . $tableName); $contentInsert .= $this->getPermissionsSave($moduleDirname, $ucfFieldId, 'submit_' . $tableName); $contentInsert .= $this->getPermissionsSave($moduleDirname, $ucfFieldId, 'approve_' . $tableName); } if (1 == $tableNotifications) { $contentInsert .= $this->pc->getPhpCodeCommentLine('Handle notification', null, $t . "\t"); - $contentInsert .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t. "\t"); + $contentInsert .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t . "\t"); if ('' !== $fieldStatus) { $contentInsert .= $this->xc->getXcGetVar($ccFieldStatus, "{$tableName}Obj", $fieldStatus, false, $t . "\t"); } $contentInsert .= $this->pc->getPhpCodeArray('tags', [], false, $t . "\t"); $contentInsert .= $this->xc->getXcEqualsOperator("\$tags['ITEM_NAME']", "\${$ccFieldMain}", '', $t . "\t"); - $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; + $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; $contentInsert .= $this->xc->getXcEqualsOperator("\$tags['ITEM_URL'] ", $url, '', $t . "\t"); $contentInsert .= $this->xc->getXcXoopsHandler('notification', $t . "\t"); if ('' === $fieldStatus) { - $not2If = $this->pc->getPhpCodeCommentLine('Event modify notification', null, $t . "\t\t"); - $not2If .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_modify', \$tags);", $t . "\t\t"); - $not2If .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \$new{$ucfFieldId}, '{$tableSoleName}_modify', \$tags);", $t . "\t\t"); - $not2Else = $this->pc->getPhpCodeCommentLine('Event new notification', null, $t . "\t\t"); - $not2Else .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_new', \$tags);", $t . "\t\t"); + $not2If = $this->pc->getPhpCodeCommentLine('Event modify notification', null, $t . "\t\t"); + $not2If .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_modify', \$tags);", $t . "\t\t"); + $not2If .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \$new{$ucfFieldId}, '{$tableSoleName}_modify', \$tags);", $t . "\t\t"); + $not2Else = $this->pc->getPhpCodeCommentLine('Event new notification', null, $t . "\t\t"); + $not2Else .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_new', \$tags);", $t . "\t\t"); //$not2Else .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \$new{$ucfFieldId}, '{$tableSoleName}_new', \$tags);", $t . "\t\t"); $not1Else = $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $not2If, $not2Else, $t . "\t"); $contentInsert .= $not1Else; @@ -364,8 +358,8 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole /** * @private function getPermissionsSave - * @param $moduleDirname - * @param $ucfFieldId + * @param $moduleDirname + * @param $ucfFieldId * @param string $perm * * @return string @@ -392,13 +386,13 @@ private function getPermissionsSave($moduleDirname, $ucfFieldId, $perm = 'view') */ public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, $t = '') { - $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'add', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'add', '', "\t\t"); if (1 == $tablePermissions) { $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, '\_NOPERM', true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); } - $ret .= $this->xc->getXcCommonPagesNew($tableName, $t); + $ret .= $this->xc->getXcCommonPagesNew($tableName, $t); return $ret; } @@ -418,14 +412,14 @@ public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'edit', '', "\t\t"); $ccFieldId = $this->getCamelCase($fieldId, false, true); if (1 == $tablePermissions) { - $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); - $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('Check permissions', '', $t); + $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('Check params', '', $t); - $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); - $ret .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); + $ret .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t); return $ret; } @@ -445,9 +439,9 @@ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'clone', '', "\t\t"); $ccFieldId = $this->getCamelCase($fieldId, false, true); if (1 == $tablePermissions) { - $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); - $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('Check permissions', '', $t); + $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->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', false, $t); @@ -476,14 +470,14 @@ private function getUserPagesDelete($tableName, $tableSoleName, $tablePermission $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'delete', '', "\t\t"); $ccFieldId = $this->getCamelCase($fieldId, false, true); if (1 == $tablePermissions) { - $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); - $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('Check permissions', '', $t); + $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('Check params', '', $t); - $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); - $ret .= $this->xc->getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); + $ret .= $this->xc->getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, $t); return $ret; } @@ -495,7 +489,7 @@ private function getUserPagesDelete($tableName, $tableSoleName, $tablePermission * @param $tableName * @param $tableSoleName * @param $fieldId - * @param $fieldStatus + * @param $fieldStatus * @param $fieldMain * @param $tableNotifications * @param string $t @@ -505,10 +499,10 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl { $ccFieldId = $this->getCamelCase($fieldId, false, true); $ccFieldMain = $this->getCamelCase($fieldMain, false, true); - $ret = $this->uxc->getUserBreadcrumbs($language, '', 'broken', '', "\t\t"); - $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); - $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); + $ret = $this->uxc->getUserBreadcrumbs($language, '', 'broken', '', "\t\t"); + $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); $ret .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); $ret .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t); @@ -528,7 +522,7 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl $contInsert .= $this->pc->getPhpCodeCommentLine('Event broken notification', null, $t . "\t\t"); $contInsert .= $this->pc->getPhpCodeArray('tags', [], false, $t . "\t\t"); $contInsert .= $this->xc->getXcEqualsOperator("\$tags['ITEM_NAME']", "\${$ccFieldMain}", '', $t . "\t\t"); - $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; + $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; $contInsert .= $this->xc->getXcEqualsOperator("\$tags['ITEM_URL'] ", $url, '', $t . "\t\t"); $contInsert .= $this->xc->getXcXoopsHandler('notification', $t . "\t\t"); $contInsert .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_broken', \$tags);", $t . "\t\t"); @@ -557,15 +551,15 @@ private function getUserPagesFooter($moduleDirname, $tableName, $tableComments, { $stuModuleDirname = \mb_strtoupper($moduleDirname); $stuTableName = \mb_strtoupper($tableName); - $ret = $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); - $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); - $ret .= $this->pc->getPhpCodeUnset('keywords'); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Description'); - $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language, $stuTableName); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_mpageurl', "\\{$stuModuleDirname}_URL.'/{$tableName}.php'"); - $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL"); + $ret = $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); + $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); + $ret .= $this->pc->getPhpCodeUnset('keywords'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Description'); + $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language, $stuTableName); + $ret .= $this->xc->getXcXoopsTplAssign('xoops_mpageurl', "\\{$stuModuleDirname}_URL.'/{$tableName}.php'"); + $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL"); if (1 == $tableComments) { $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('View comments'); @@ -599,18 +593,18 @@ private function getUserPagesFooter($moduleDirname, $tableName, $tableComments, */ private function getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldStatus, $tableNotifications, $tableRate, $fieldReads, $language, $t) { - $fields = $this->getTableFields($tableMid, $tableId); + $fields = $this->getTableFields($tableMid, $tableId); $cases['show'] = []; - $cases['list'] = [$this->getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language,$t . "\t")]; + $cases['list'] = [$this->getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language, $t . "\t")]; if (1 == $tableSubmit) { $cases['save'] = [$this->getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, $t . "\t")]; $cases['new'] = [$this->getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, $t . "\t")]; $cases['edit'] = [$this->getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t . "\t")]; $cases['clone'] = [$this->getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t . "\t")]; - $cases['delete'] = [$this->getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications,$t . "\t")]; + $cases['delete'] = [$this->getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications, $t . "\t")]; } if (1 == $tableBroken) { - $cases['broken'] = [$this->getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, $t . "\t")]; + $cases['broken'] = [$this->getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, $t . "\t")]; } return $this->xc->getXcSwitch('op', $cases, true, false); @@ -640,11 +634,11 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MA'); // Fields - $fieldId = ''; - $fieldMain = ''; + $fieldId = ''; + $fieldMain = ''; $fieldStatus = ''; - $fieldReads = ''; - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldReads = ''; + $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) { diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index a2a4a28a..c5314e01 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -111,7 +108,7 @@ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language $ret .= $this->pc->getPhpCodeIncludeDir("\$tcpdf . 'config/tcpdf_config.php'", '', true, true, 'require', ''); $ret .= $this->pc->getPhpCodeCommentLine('Get new template'); $ret .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/class/template.php'", '', true, true, 'require', ''); - $ret .= $this->xc->getXcEqualsOperator('$pdfTpl', 'new $xoopsTpl()'); + $ret .= $this->xc->getXcEqualsOperator('$pdfTpl', 'new $xoopsTpl()'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Get requests'); $ret .= $this->xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int'); @@ -136,13 +133,13 @@ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields) { $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->pc->getPhpCodeCommentLine('Set defaults'); - $ret .= $this->xc->getXcEqualsOperator('$pdfFilename', "'$tableName.pdf'"); - $ret .= $this->xc->getXcEqualsOperator('$title ', "'Pdf Title'"); - $ret .= $this->xc->getXcEqualsOperator('$subject ', "'Pdf Subject'"); - $ret .= $this->xc->getXcEqualsOperator('$content ', "''"); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Read data from table and create pdfData'); + $ret = $this->pc->getPhpCodeCommentLine('Set defaults'); + $ret .= $this->xc->getXcEqualsOperator('$pdfFilename', "'$tableName.pdf'"); + $ret .= $this->xc->getXcEqualsOperator('$title ', "'Pdf Title'"); + $ret .= $this->xc->getXcEqualsOperator('$subject ', "'Pdf Subject'"); + $ret .= $this->xc->getXcEqualsOperator('$content ', "''"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Read data from table and create pdfData'); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldDefault = $fields[$f]->getVar('field_default'); @@ -167,29 +164,29 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie break; } } - $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['fontname']", 'PDF_FONT_NAME_MAIN'); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontsize']", 'PDF_FONT_SIZE_MAIN'); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Get Config'); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['creator'] ", "\$GLOBALS['xoopsConfig']['sitename']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['keywords'] ", "\$helper->getConfig('keywords')"); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Defines'); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_CREATOR", "\$pdfData['creator']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_AUTHOR", "\$pdfData['author']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_TITLE", "\$pdfData['title']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_STRING", "\$pdfData['subject']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_LOGO", "'logo.gif'"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_IMAGES_PATH", "\XOOPS_ROOT_PATH.'/images/'"); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Assign customs tpl fields'); - $ret .= $this->xc->getXcXoopsTplAssign('content_header', "'$tableName'", true, '', 'pdfTpl'); - $ret .= $this->xc->getXcGetValues($tableName, $tableSolename, '', true, '', 'Obj'); - $ret .= $this->xc->getXcXoopsTplAssign($tableSolename, '$' .$tableSolename, true, '', 'pdfTpl'); + $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['fontname']", 'PDF_FONT_NAME_MAIN'); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontsize']", 'PDF_FONT_SIZE_MAIN'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Get Config'); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['creator'] ", "\$GLOBALS['xoopsConfig']['sitename']"); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['keywords'] ", "\$helper->getConfig('keywords')"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Defines'); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_CREATOR", "\$pdfData['creator']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_AUTHOR", "\$pdfData['author']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_TITLE", "\$pdfData['title']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_STRING", "\$pdfData['subject']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_LOGO", "'logo.gif'"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_IMAGES_PATH", "\XOOPS_ROOT_PATH.'/images/'"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Assign customs tpl fields'); + $ret .= $this->xc->getXcXoopsTplAssign('content_header', "'$tableName'", true, '', 'pdfTpl'); + $ret .= $this->xc->getXcGetValues($tableName, $tableSolename, '', true, '', 'Obj'); + $ret .= $this->xc->getXcXoopsTplAssign($tableSolename, '$' . $tableSolename, true, '', 'pdfTpl'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Create pdf'); @@ -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 e88acaf1..b4da9914 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -1,4 +1,4 @@ -setModule($module); $this->setTable($table); @@ -102,12 +99,12 @@ public function getUserPrint($moduleDirname, $language) $tableSoleName = $table->getVar('table_solename'); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - $fieldId = ''; - $fieldMain = ''; - $fieldName = ''; - $ucfFieldName = ''; + $fieldId = ''; + $fieldMain = ''; + $fieldName = ''; + $ucfFieldName = ''; foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); + $fieldName = $fields[$f]->getVar('field_name'); if ((0 == $f) && (1 == $this->table->getVar('table_autoincrement'))) { $fieldId = $fieldName; } else { @@ -129,11 +126,11 @@ public function getUserPrint($moduleDirname, $language) $redirectHeader = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '2', "{$language}INVALID_PARAM", false, "\t"); $ret .= $this->pc->getPhpCodeConditions("empty(\${$ccFieldId})", '', '', $redirectHeader); - $ret .= $this->pc->getPhpCodeCommentLine('Get Instance of Handler'); - $ret .= $this->xc->getXcHandlerLine($tableName); - $ret .= $this->xc->getXcXoopsHandler('groupperm'); + $ret .= $this->pc->getPhpCodeCommentLine('Get Instance of Handler'); + $ret .= $this->xc->getXcHandlerLine($tableName); + $ret .= $this->xc->getXcXoopsHandler('groupperm'); - $ret .= $this->pc->getPhpCodeCommentLine('Verify that the article is published'); + $ret .= $this->pc->getPhpCodeCommentLine('Verify that the article is published'); if (false !== mb_strpos($fieldName, 'published')) { $ret .= $this->pc->getPhpCodeCommentLine('Not yet', $fieldName); $redirectHeader .= $this->getSimpleString('exit();'); @@ -154,20 +151,20 @@ public function getUserPrint($moduleDirname, $language) $redirectHeader .= $this->getSimpleString('exit();'); $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < \time()", '', '', $redirectHeader); } - $ret .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, '', $tableName . 'Handler',false); - $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view", "\${$ccFieldId}->getVar('{$fieldId}')", '$groups', "\$GLOBALS['xoopsModule']->getVar('mid')", true); - $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); - $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); - $noPerm .= $this->getSimpleString('exit();', "\t"); - $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); - $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName, '', true); - $ret .= $this->xc->getXcXoopsTplAppend($tableName . '_list', '$' . $tableSoleName, ''); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_sitename', "\$GLOBALS['xoopsConfig']['sitename']"); - $getVar = $this->xc->getXcGetVar('', $tableName, $fieldMain, true); - $stripTags = $this->pc->getPhpCodeStripTags('', $getVar . " . ' - ' . " . "{$language}PRINT" . " . ' - ' . " . "\$GLOBALS['xoopsModule']->getVar('name')", true); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_pagetitle', $stripTags); - $ret .= $this->xc->getXcXoopsTplDisplay($tableName . '_print.tpl', '', false); + $ret .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, '', $tableName . 'Handler', false); + $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view", "\${$ccFieldId}->getVar('{$fieldId}')", '$groups', "\$GLOBALS['xoopsModule']->getVar('mid')", true); + $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); + $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); + $noPerm .= $this->getSimpleString('exit();', "\t"); + $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); + $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName, '', true); + $ret .= $this->xc->getXcXoopsTplAppend($tableName . '_list', '$' . $tableSoleName, ''); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->xc->getXcXoopsTplAssign('xoops_sitename', "\$GLOBALS['xoopsConfig']['sitename']"); + $getVar = $this->xc->getXcGetVar('', $tableName, $fieldMain, true); + $stripTags = $this->pc->getPhpCodeStripTags('', $getVar . " . ' - ' . " . "{$language}PRINT" . " . ' - ' . " . "\$GLOBALS['xoopsModule']->getVar('name')", true); + $ret .= $this->xc->getXcXoopsTplAssign('xoops_pagetitle', $stripTags); + $ret .= $this->xc->getXcXoopsTplDisplay($tableName . '_print.tpl', '', false); return $ret; } diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index 49d94a72..936a3038 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -22,9 +22,8 @@ * * @since 2.5.0 * - * @author Txmod Xoops https://xoops.org + * @author Txmod Xoops https://xoops.org * Goffy https://myxoops.org - * */ /** @@ -36,19 +35,16 @@ class UserRate extends Files\CreateFile * @var mixed */ private $xc = null; - - /** + /** * @var mixed */ private $pc = null; - - /** + /** * @var mixed */ private $uxc = null; - - - /** + + /** * @public function constructor * * @param null @@ -81,7 +77,7 @@ public static function getInstance() /** * @public function write * @param string $module - * @param $tables + * @param $tables * @param string $filename */ public function write($module, $tables, $filename) @@ -117,10 +113,10 @@ public function getUserRateHeader($moduleDirname) */ private function getUserRateSwitch($tables, $language) { - $t = "\t\t"; - $cases = [ - 'list' => [$this->getUserRateDefault( $t)], - 'save' => [$this->getUserRateSave($tables, $language, $t)], + $t = "\t\t"; + $cases = [ + 'list' => [$this->getUserRateDefault($t)], + 'save' => [$this->getUserRateSave($tables, $language, $t)], ]; return $this->xc->getXcSwitch('op', $cases, true); @@ -133,7 +129,7 @@ private function getUserRateSwitch($tables, $language) */ public function getUserRateDefault($t = '') { - $ret = $this->pc->getPhpCodeCommentLine('default should not happen','', $t); + $ret = $this->pc->getPhpCodeCommentLine('default should not happen', '', $t); $ret .= $this->xc->getXcRedirectHeader('index', '', '3', '\_NOPERM', true, $t); return $ret; @@ -156,13 +152,13 @@ public function getUserRateSave($tables, $language, $t) $ret .= $this->pc->getPhpCodeConditions($xoopsSecurityCheck, '', '', $redirectError, false, $t); $ret .= $this->xc->getXcXoopsRequest('rating', 'rating', '0', 'Int', false, $t); - $ret .= $this->xc->getXcEqualsOperator('$itemid', '0','', $t); - $ret .= $this->xc->getXcEqualsOperator('$redir ', "\Xmf\Request::getString('HTTP_REFERER', '', 'SERVER')",'', $t); + $ret .= $this->xc->getXcEqualsOperator('$itemid', '0', '', $t); + $ret .= $this->xc->getXcEqualsOperator('$redir ', "\Xmf\Request::getString('HTTP_REFERER', '', 'SERVER')", '', $t); foreach ($tables as $table) { - $tableName = $table->getVar('table_name'); + $tableName = $table->getVar('table_name'); $stuTableName = \mb_strtoupper($tableName); if (1 == $table->getVar('table_rate')) { - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $fieldId = ''; foreach (\array_keys($fields) as $f) { if (0 == $f) { @@ -170,18 +166,18 @@ public function getUserRateSave($tables, $language, $t) } } $contIf = $this->xc->getXcXoopsRequest('itemid', $fieldId, '0', 'Int', false, $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$redir', "'{$tableName}.php?op=show&{$fieldId}=' . \$itemid",'', $t . "\t"); - $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); - $ret .= $this->pc->getPhpCodeConditions('$source', ' === ', $const, $contIf, false, $t); + $contIf .= $this->xc->getXcEqualsOperator('$redir', "'{$tableName}.php?op=show&{$fieldId}=' . \$itemid", '', $t . "\t"); + $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); + $ret .= $this->pc->getPhpCodeConditions('$source', ' === ', $const, $contIf, false, $t); } } $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); - $ret .= $this->xc->getXcEqualsOperator('$rate_allowed', 'false','', $t); + $ret .= $this->xc->getXcEqualsOperator('$rate_allowed', 'false', '', $t); $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); $ret .= $this->pc->getPhpCodeTernaryOperator('groups', '(isset(' . $xUser . ') && \is_object(' . $xUser . '))', $xUser . '->getGroups()', '\XOOPS_GROUP_ANONYMOUS', "\t\t"); - $contIf = $this->xc->getXcEqualsOperator('$rate_allowed', 'true','', $t . "\t\t"); + $contIf = $this->xc->getXcEqualsOperator('$rate_allowed', 'true', '', $t . "\t\t"); $contIf .= $this->getSimpleString('break;', $t . "\t\t"); $cond = '\XOOPS_GROUP_ADMIN == $group || \in_array($group, $helper->getConfig(\'ratingbar_groups\'))'; $contFe = $this->pc->getPhpCodeConditions($cond, '', '', $contIf, false, $t . "\t"); @@ -195,7 +191,7 @@ public function getUserRateSave($tables, $language, $t) $contIf = $this->xc->getXcRedirectHeader('index', '', '3', $language . 'RATING_VOTE_BAD', true, $t . "\t\t"); $contIf .= $this->getSimpleString('exit;', $t . "\t\t"); $const = $this->xc->getXcGetConstants('RATING_NONE'); - $cases[$const] = [$contIf]; + $cases[$const] = [$contIf]; $contIf = $this->xc->getXcRedirectHeader('index', '', '3', $language . 'RATING_VOTE_BAD', true, $t . "\t\t\t"); $contIf .= $this->getSimpleString('exit;', $t . "\t\t\t"); $const = $this->xc->getXcGetConstants('RATING_LIKES'); @@ -211,13 +207,13 @@ public function getUserRateSave($tables, $language, $t) $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Get existing rating', null, $t); - $ret .= $this->xc->getXcEqualsOperator('$itemrating', '$ratingsHandler->getItemRating($itemid, $source)','', $t); + $ret .= $this->xc->getXcEqualsOperator('$itemrating', '$ratingsHandler->getItemRating($itemid, $source)', '', $t); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Set data rating', null, $t); $contIf = $this->pc->getPhpCodeCommentLine('If yo want to avoid revoting then activate next line', null, $t . "\t"); $contIf .= $t . "\t//" . $this->xc->getXcRedirectHeader('index', '', '3', $language . 'RATING_VOTE_BAD'); - $contIf .= $this->xc->getXcHandlerGet('ratings', "itemrating['id']",'Obj', 'ratingsHandler', false, $t . "\t"); + $contIf .= $this->xc->getXcHandlerGet('ratings', "itemrating['id']", 'Obj', 'ratingsHandler', false, $t . "\t"); $contElse = $this->xc->getXcHandlerCreateObj('ratings', $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\$itemrating['voted']", '', '', $contIf, $contElse, $t); $ret .= $this->xc->getXcSetVarObj('ratings', 'rate_source', '$source', $t); @@ -231,23 +227,23 @@ public function getUserRateSave($tables, $language, $t) $contIf = $this->pc->getPhpCodeUnset('ratingsObj', $t . "\t"); $contIf .= $this->pc->getPhpCodeCommentLine('Calc average rating value', null, $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$nb_ratings ', '0','', $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$avg_rate_value', '0','', $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$current_rating', '0','', $t . "\t"); + $contIf .= $this->xc->getXcEqualsOperator('$nb_ratings ', '0', '', $t . "\t"); + $contIf .= $this->xc->getXcEqualsOperator('$avg_rate_value', '0', '', $t . "\t"); + $contIf .= $this->xc->getXcEqualsOperator('$current_rating', '0', '', $t . "\t"); $tableName = 'ratings'; $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; $contIf .= $this->xc->getXcCriteriaCompo($critName, $t . "\t"); - $crit = $this->xc->getXcCriteria('', "'rate_source'", '$source','',true); + $crit = $this->xc->getXcCriteria('', "'rate_source'", '$source', '', true); $contIf .= $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); - $crit = $this->xc->getXcCriteria('', "'rate_itemid'", '$itemid','',true); + $crit = $this->xc->getXcCriteria('', "'rate_itemid'", '$itemid', '', true); $contIf .= $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); $contIf .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t . "\t"); $contIf .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t . "\t"); - $contFe = $this->xc->getXcEqualsOperator('$current_rating', "\$ratingsAll[\$i]->getVar('rate_value')",'+', $t . "\t\t"); + $contFe = $this->xc->getXcEqualsOperator('$current_rating', "\$ratingsAll[\$i]->getVar('rate_value')", '+', $t . "\t\t"); $contIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contFe, $t . "\t"); $contIf .= $this->pc->getPhpCodeUnset($tableName . 'All', $t . "\t"); - $contIfInt = $this->xc->getXcEqualsOperator('$avg_rate_value', 'number_format($current_rating / $ratingsCount, 2)','', $t . "\t\t"); + $contIfInt = $this->xc->getXcEqualsOperator('$avg_rate_value', 'number_format($current_rating / $ratingsCount, 2)', '', $t . "\t\t"); $contIf .= $this->pc->getPhpCodeConditions('$ratingsCount', ' > ', '0', $contIfInt, false, $t . "\t"); $contIf .= $this->pc->getPhpCodeCommentLine('Update related table', null, $t . "\t"); @@ -266,7 +262,7 @@ public function getUserRateSave($tables, $language, $t) $insertOK = $this->xc->getXcRedirectHeader('$redir', '', '2', "{$language}RATING_VOTE_THANKS", false, $t . "\t\t\t"); $insertErr = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}RATING_ERROR1", true, $t . "\t\t\t"); - $contIfInt .= $this->pc->getPhpCodeConditions($insertInt, '', '', $insertOK, $insertErr, $t. "\t\t"); + $contIfInt .= $this->pc->getPhpCodeConditions($insertInt, '', '', $insertOK, $insertErr, $t . "\t\t"); $contIfInt .= $this->pc->getPhpCodeUnset($tableName . 'Obj', $t . "\t\t"); $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); $contIf .= $this->pc->getPhpCodeConditions('$source', ' === ', $const, $contIfInt, false, $t . "\t"); @@ -280,7 +276,6 @@ public function getUserRateSave($tables, $language, $t) $ret .= $this->pc->getPhpCodeCommentLine('Get Error', null, $t); $ret .= $this->getSimpleString("echo 'Error: ' . \$ratingsObj->getHtmlErrors();", $t); - return $ret; } @@ -300,15 +295,15 @@ public function getUserRateFooter() */ public function render() { - $module = $this->getModule(); - $tables = $this->getTables(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserRateHeader($moduleDirname); - $content .= $this->getUserRateSwitch($tables, $language); - $content .= $this->getUserRateFooter(); + $module = $this->getModule(); + $tables = $this->getTables(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getHeaderFilesComments($module); + $content .= $this->getUserRateHeader($moduleDirname); + $content .= $this->getUserRateSwitch($tables, $language); + $content .= $this->getUserRateFooter(); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); 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/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index 5bc56e47..ee7d967f 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); @@ -213,15 +212,15 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ //search for longest key $len = 0; foreach ($descs as $key => $desc) { - $len = \strlen($key) > $len ? \strlen($key) : $len; + $len = \mb_strlen($key) > $len ? \mb_strlen($key) : $len; } foreach ($descs as $key => $desc) { - $space = str_repeat(' ', $len - \strlen($key)); + $space = str_repeat(' ', $len - \mb_strlen($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}"; @@ -235,6 +234,7 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ $ret .= ']'; } $ret .= ";\n"; + return $ret; } @@ -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 974f1619..a1fa3cbc 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; @@ -254,11 +250,11 @@ private function getXoopsVersionSearch($moduleDirname) private function getXoopsVersionComments($moduleDirname, $tables) { $tableName = ''; - $fieldId = ''; + $fieldId = ''; foreach (\array_keys($tables) as $t) { if (1 == $tables[$t]->getVar('table_comments')) { $tableName = $tables[$t]->getVar('table_name'); - $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); + $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { @@ -293,10 +289,10 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm $ret = $this->getDashComment('Templates'); $item = []; if ($admin) { - $item[] = $this->pc->getPhpCodeCommentLine('Admin templates'); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'about', '', true); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', '', true); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', '', true); + $item[] = $this->pc->getPhpCodeCommentLine('Admin templates'); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'about', '', true); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', '', true); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', '', true); $tablePermissions = []; $tableBroken = []; foreach (\array_keys($tables) as $t) { @@ -344,12 +340,12 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'item'); } } - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'breadcrumbs', ''); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'breadcrumbs', ''); if (\in_array(1, $tablePdf)) { foreach (\array_keys($tables) as $t) { if ($tables[$t]->getVar('table_pdf')) { $tableName = $tables[$t]->getVar('table_name'); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName . '_pdf', ''); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName . '_pdf', ''); } } } @@ -357,7 +353,7 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm foreach (\array_keys($tables) as $t) { if ($tables[$t]->getVar('table_print')) { $tableName = $tables[$t]->getVar('table_name'); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName . '_print', ''); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName . '_print', ''); } } } @@ -391,9 +387,9 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm */ private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '', $isAdmin = false) { - $ret = ''; - $desc = "'description' => ''"; - $arrayFile = "['file' =>"; + $ret = ''; + $desc = "'description' => ''"; + $arrayFile = "['file' =>"; if ($isAdmin) { $ret .= "{$arrayFile} '{$moduleDirname}_admin_{$type}.tpl', {$desc}, 'type' => 'admin']"; } else { @@ -418,15 +414,15 @@ private function getXoopsVersionSubmenu($language, $tables) $ret = $this->getDashComment('Menu'); $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); $cond = 'isset(' . $xModule . ') && \is_object(' . $xModule . ')'; - $one = $this->pc->getPhpCodeGlobals('xoopsModule') . "->getVar('dirname')"; + $one = $this->pc->getPhpCodeGlobals('xoopsModule') . "->getVar('dirname')"; $ret .= $this->pc->getPhpCodeTernaryOperator('currdirname ', $cond, $one, "'system'"); - $i = 1; + $i = 1; $descriptions = [ 'name' => "{$language}SMNAME{$i}", 'url' => "'index.php'", ]; - $contentIf = $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + $contentIf = $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '', '', "\t"); ++$i; $tableSearch = []; @@ -434,22 +430,22 @@ private function getXoopsVersionSubmenu($language, $tables) $tableName = $tables[$t]->getVar('table_name'); $tableSearch[] = $tables[$t]->getVar('table_search'); if (1 == $tables[$t]->getVar('table_submenu')) { - $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); + $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); $descriptions = [ 'name' => "{$language}SMNAME{$i}", 'url' => "'{$tableName}.php'", ]; - $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '', '', "\t"); unset($item); } ++$i; if (1 == $tables[$t]->getVar('table_submit')) { - $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', 'Submit', "\t"); + $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', 'Submit', "\t"); $descriptions = [ 'name' => "{$language}SMNAME{$i}", 'url' => "'{$tableName}.php?op=new'", ]; - $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '', '', "\t"); ++$i; } } @@ -481,9 +477,9 @@ private function getXoopsVersionSubmenu($language, $tables) */ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) { - $ret = $this->getDashComment('Blocks'); + $ret = $this->getDashComment('Blocks'); foreach (\array_keys($tables) as $i) { - $tableName = $tables[$i]->getVar('table_name'); + $tableName = $tables[$i]->getVar('table_name'); if (0 == $tables[$i]->getVar('table_category') && 1 == $tables[$i]->getVar('table_blocks')) { $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'LAST', $language, 'last'); $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'NEW', $language, 'new'); @@ -507,10 +503,10 @@ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) */ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type) { - $stuTableName = \mb_strtoupper($tableName); - $ucfTableName = \ucfirst($tableName); - $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); - $blocks = [ + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); + $blocks = [ 'file' => "'{$tableName}.php'", 'name' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}", 'description' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", @@ -519,7 +515,7 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable 'template' => "'{$moduleDirname}_block_{$tableName}.tpl'", 'options' => "'{$type}|5|25|0'", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); + $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); return $ret; } @@ -534,8 +530,8 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable */ private function getXoopsVersionConfig($module, $tables, $language) { - $moduleDirname = $module->getVar('mod_dirname'); - $ret = $this->getDashComment('Config'); + $moduleDirname = $module->getVar('mod_dirname'); + $ret = $this->getDashComment('Config'); $table_editors = 0; $table_permissions = 0; @@ -587,10 +583,10 @@ private function getXoopsVersionConfig($module, $tables, $language) } } if (1 === $table_editors) { - $ret .= $this->pc->getPhpCodeCommentLine('Editor Admin', ''); - $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); - $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); - $editor = [ + $ret .= $this->pc->getPhpCodeCommentLine('Editor Admin', ''); + $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); + $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); + $editor = [ 'name' => "'editor_admin'", 'title' => "'{$language}EDITOR_ADMIN'", 'description' => "'{$language}EDITOR_ADMIN_DESC'", @@ -599,11 +595,11 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "'dhtml'", 'options' => 'array_flip($editorHandler->getList())', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Editor User', ''); - $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); - $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); - $editor = [ + $ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Editor User', ''); + $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); + $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); + $editor = [ 'name' => "'editor_user'", 'title' => "'{$language}EDITOR_USER'", 'description' => "'{$language}EDITOR_USER_DESC'", @@ -612,9 +608,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "'dhtml'", 'options' => 'array_flip($editorHandler->getList())', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Editor : max characters admin area'); - $maxsize_image = [ + $ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Editor : max characters admin area'); + $maxsize_image = [ 'name' => "'editor_maxchar'", 'title' => "'{$language}EDITOR_MAXCHAR'", 'description' => "'{$language}EDITOR_MAXCHAR_DESC'", @@ -622,17 +618,17 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '50', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); } if (1 === $table_permissions) { - $ret .= $this->pc->getPhpCodeCommentLine('Get groups'); - $ret .= $this->xc->getXcXoopsHandler('member'); - $ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); - $ret .= $this->xc->getXcEqualsOperator('$groups', '[]'); - $group = $this->xc->getXcEqualsOperator('$groups[$group] ', '$key', null, "\t"); - $ret .= $this->pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); - $ret .= $this->pc->getPhpCodeCommentLine('General access groups'); - $groups = [ + $ret .= $this->pc->getPhpCodeCommentLine('Get groups'); + $ret .= $this->xc->getXcXoopsHandler('member'); + $ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); + $ret .= $this->xc->getXcEqualsOperator('$groups', '[]'); + $group = $this->xc->getXcEqualsOperator('$groups[$group] ', '$key', null, "\t"); + $ret .= $this->pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); + $ret .= $this->pc->getPhpCodeCommentLine('General access groups'); + $groups = [ 'name' => "'groups'", 'title' => "'{$language}GROUPS'", 'description' => "'{$language}GROUPS_DESC'", @@ -641,9 +637,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '$groups', 'options' => '$groups', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Upload groups'); - $uplgroups = [ + $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Upload groups'); + $uplgroups = [ 'name' => "'upload_groups'", 'title' => "'{$language}UPLOAD_GROUPS'", 'description' => "'{$language}UPLOAD_GROUPS_DESC'", @@ -652,7 +648,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '$groups', 'options' => '$groups', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $uplgroups, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $uplgroups, 'config'); $ret .= $this->pc->getPhpCodeCommentLine('Get Admin groups'); $ret .= $this->xc->getXcCriteriaCompo('crGroups'); @@ -673,7 +669,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'options' => '$adminGroups', ]; $ret .= $this->uxc->getUserModVersionArray(2, $adminGroups, 'config'); - $ret .= $this->pc->getPhpCodeUnset('crGroups'); + $ret .= $this->pc->getPhpCodeUnset('crGroups'); } if (1 === $table_rate) { @@ -693,10 +689,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '[1]', 'options' => '$ratingbar_groups', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Rating : used ratingbar'); - $mimetypes_image = [ + $ret .= $this->pc->getPhpCodeCommentLine('Rating : used ratingbar'); + $mimetypes_image = [ 'name' => "'ratingbars'", 'title' => "'{$language}RATINGBARS'", 'description' => "'{$language}RATINGBARS_DESC'", @@ -705,7 +701,7 @@ private function getXoopsVersionConfig($module, $tables, $language) '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'); + $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); } $keyword = \implode(', ', $this->getKeywords()); @@ -718,15 +714,15 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'text'", 'default' => "'{$moduleDirname}, {$keyword}'", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); unset($this->keywords); if (1 === $table_uploadimage || 1 === $table_uploadfile) { - $ret .= $this->getXoopsVersionSelectSizeMB($moduleDirname); + $ret .= $this->getXoopsVersionSelectSizeMB($moduleDirname); } if (1 === $table_uploadimage) { - $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of image'); - $maxsize_image = [ + $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of image'); + $maxsize_image = [ 'name' => "'maxsize_image'", 'title' => "'{$language}MAXSIZE_IMAGE'", 'description' => "'{$language}MAXSIZE_IMAGE_DESC'", @@ -735,9 +731,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '3145728', 'options' => '$optionMaxsize', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of image'); - $mimetypes_image = [ + $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of image'); + $mimetypes_image = [ 'name' => "'mimetypes_image'", 'title' => "'{$language}MIMETYPES_IMAGE'", 'description' => "'{$language}MIMETYPES_IMAGE_DESC'", @@ -746,8 +742,8 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "['image/gif', 'image/jpeg', 'image/png']", 'options' => "['bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png']", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); - $maxwidth_image = [ + $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); + $maxwidth_image = [ 'name' => "'maxwidth_image'", 'title' => "'{$language}MAXWIDTH_IMAGE'", 'description' => "'{$language}MAXWIDTH_IMAGE_DESC'", @@ -755,8 +751,8 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '800', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maxwidth_image, 'config'); - $maxheight_image = [ + $ret .= $this->uxc->getUserModVersionArray(2, $maxwidth_image, 'config'); + $maxheight_image = [ 'name' => "'maxheight_image'", 'title' => "'{$language}MAXHEIGHT_IMAGE'", 'description' => "'{$language}MAXHEIGHT_IMAGE_DESC'", @@ -764,11 +760,11 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '800', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maxheight_image, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maxheight_image, 'config'); } if (1 === $table_uploadfile) { - $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of file'); - $maxsize_file = [ + $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of file'); + $maxsize_file = [ 'name' => "'maxsize_file'", 'title' => "'{$language}MAXSIZE_FILE'", 'description' => "'{$language}MAXSIZE_FILE_DESC'", @@ -777,9 +773,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '3145728', 'options' => '$optionMaxsize', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_file, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of file'); - $mimetypes_file = [ + $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_file, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of file'); + $mimetypes_file = [ 'name' => "'mimetypes_file'", 'title' => "'{$language}MIMETYPES_FILE'", 'description' => "'{$language}MIMETYPES_FILE_DESC'", @@ -788,10 +784,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "['application/pdf', 'application/zip', 'text/comma-separated-values', 'text/plain', 'image/gif', 'image/jpeg', 'image/png']", 'options' => "['gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png', 'pdf' => 'application/pdf','zip' => 'application/zip','csv' => 'text/comma-separated-values', 'txt' => 'text/plain', 'xml' => 'application/xml', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_file, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_file, 'config'); } if (1 === $table_admin) { - $ret .= $this->pc->getPhpCodeCommentLine('Admin pager'); + $ret .= $this->pc->getPhpCodeCommentLine('Admin pager'); $adminPager = [ 'name' => "'adminpager'", 'title' => "'{$language}ADMIN_PAGER'", @@ -800,10 +796,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '10', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $adminPager, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $adminPager, 'config'); } if (1 === $table_user) { - $ret .= $this->pc->getPhpCodeCommentLine('User pager'); + $ret .= $this->pc->getPhpCodeCommentLine('User pager'); $userPager = [ 'name' => "'userpager'", 'title' => "'{$language}USER_PAGER'", @@ -812,10 +808,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '10', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $userPager, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $userPager, 'config'); } if (1 === $table_tag) { - $ret .= $this->pc->getPhpCodeCommentLine('Use tag'); + $ret .= $this->pc->getPhpCodeCommentLine('Use tag'); $useTag = [ 'name' => "'usetag'", 'title' => "'{$language}USE_TAG'", @@ -824,10 +820,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '0', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $useTag, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $useTag, 'config'); } - $ret .= $this->pc->getPhpCodeCommentLine('Number column'); - $numbCol = [ + $ret .= $this->pc->getPhpCodeCommentLine('Number column'); + $numbCol = [ 'name' => "'numb_col'", 'title' => "'{$language}NUMB_COL'", 'description' => "'{$language}NUMB_COL_DESC'", @@ -836,10 +832,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '1', 'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $numbCol, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $numbCol, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Divide by'); - $divideby = [ + $ret .= $this->pc->getPhpCodeCommentLine('Divide by'); + $divideby = [ 'name' => "'divideby'", 'title' => "'{$language}DIVIDEBY'", 'description' => "'{$language}DIVIDEBY_DESC'", @@ -848,10 +844,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '1', 'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $divideby, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $divideby, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Table type'); - $tableType = [ + $ret .= $this->pc->getPhpCodeCommentLine('Table type'); + $tableType = [ 'name' => "'table_type'", 'title' => "'{$language}TABLE_TYPE'", 'description' => "'{$language}DIVIDEBY_DESC'", @@ -860,10 +856,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "'bordered'", 'options' => "['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed']", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $tableType, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $tableType, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Panel by'); - $panelType = [ + $ret .= $this->pc->getPhpCodeCommentLine('Panel by'); + $panelType = [ 'name' => "'panel_type'", 'title' => "'{$language}PANEL_TYPE'", 'description' => "'{$language}PANEL_TYPE_DESC'", @@ -872,9 +868,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "'default'", 'options' => "['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger']", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $panelType, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Paypal ID'); - $paypal = [ + $ret .= $this->uxc->getUserModVersionArray(2, $panelType, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Paypal ID'); + $paypal = [ 'name' => "'donations'", 'title' => "'{$language}IDPAYPAL'", 'description' => "'{$language}IDPAYPAL_DESC'", @@ -882,9 +878,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'textbox'", 'default' => "'XYZ123'", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $paypal, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Show Breadcrumbs'); - $breadcrumbs = [ + $ret .= $this->uxc->getUserModVersionArray(2, $paypal, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Show Breadcrumbs'); + $breadcrumbs = [ 'name' => "'show_breadcrumbs'", 'title' => "'{$language}SHOW_BREADCRUMBS'", 'description' => "'{$language}SHOW_BREADCRUMBS_DESC'", @@ -892,9 +888,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '1', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $breadcrumbs, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Advertise'); - $advertise = [ + $ret .= $this->uxc->getUserModVersionArray(2, $breadcrumbs, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Advertise'); + $advertise = [ 'name' => "'advertise'", 'title' => "'{$language}ADVERTISE'", 'description' => "'{$language}ADVERTISE_DESC'", @@ -902,9 +898,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'text'", 'default' => "''", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $advertise, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Bookmarks'); - $bookmarks = [ + $ret .= $this->uxc->getUserModVersionArray(2, $advertise, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Bookmarks'); + $bookmarks = [ 'name' => "'bookmarks'", 'title' => "'{$language}BOOKMARKS'", 'description' => "'{$language}BOOKMARKS_DESC'", @@ -912,7 +908,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '0', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $bookmarks, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $bookmarks, 'config'); /* * removed, as there are no system templates in xoops core for fb or disqus comments @@ -941,8 +937,8 @@ private function getXoopsVersionConfig($module, $tables, $language) $ret .= $this->getSimpleString('++$c;'); */ - $ret .= $this->pc->getPhpCodeCommentLine('Make Sample button visible?'); - $maintainedby = [ + $ret .= $this->pc->getPhpCodeCommentLine('Make Sample button visible?'); + $maintainedby = [ 'name' => "'displaySampleButton'", 'title' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON'", 'description' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC'", @@ -950,10 +946,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '1', ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); - $ret .= $this->pc->getPhpCodeCommentLine('Maintained by'); - $maintainedby = [ + $ret .= $this->pc->getPhpCodeCommentLine('Maintained by'); + $maintainedby = [ 'name' => "'maintainedby'", 'title' => "'{$language}MAINTAINEDBY'", 'description' => "'{$language}MAINTAINEDBY_DESC'", @@ -961,7 +957,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'text'", 'default' => "'{$module->getVar('mod_support_url')}'", ]; - $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); return $ret; } @@ -1015,16 +1011,16 @@ private function getXoopsVersionNotifications($module, $language) $tableSoleName = $tables[$t]->getVar('table_solename'); $tableCategory[] = $tables[$t]->getVar('table_category'); $tableSubmit[] = $tables[$t]->getVar('table_submit'); - $fields = $this->getTableFields($tableMid, $tableId); - $fieldId = 0; + $fields = $this->getTableFields($tableMid, $tableId); + $fieldId = 0; foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); + $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { $fieldId = $fieldName; } } if (1 == $tables[$t]->getVar('table_notifications')) { - $notifyFiles[] = $tableName; + $notifyFiles[] = $tableName; $notifyCategory .= $this->getXoopsVersionNotificationTableName($language, 'category', $tableName, $tableSoleName, $tableName, $fieldId, 1); //$notifyEvent .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_new', $tableName, 0, $tableSoleName, $tableSoleName . '_new_notify'); $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_modify', $tableName, 0, $tableSoleName . '_modify', $tableSoleName . '_modify_notify'); @@ -1046,7 +1042,6 @@ private function getXoopsVersionNotifications($module, $language) $ret .= $notifyCategory . $notifyEventGlobal . $notifyEventTable; - return $ret; } @@ -1076,7 +1071,6 @@ private function getXoopsVersionNotificationGlobal($language, $type, $name, $tit return $ret; } - /** * @private function getXoopsVersionNotificationTableName * @param $language @@ -1102,7 +1096,7 @@ private function getXoopsVersionNotificationTableName($language, $type, $name, $ 'item_name' => "'{$item}'", 'allow_bookmark' => (string)$allow, ]; - $ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'{$type}'"); + $ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'{$type}'"); return $ret; } @@ -1134,30 +1128,30 @@ private function getXoopsVersionNotificationCodeComplete($language, $type, $name 'mail_template' => "'{$mail}'", 'mail_subject' => "{$language}NOTIFY_{$title}_SUBJECT", ]; - $ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'{$type}'"); + $ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'{$type}'"); return $ret; } /** * @private function getXoopsVersionNotifications - * @param $moduleDirname + * @param $moduleDirname * @param string $t * @return string */ private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') { - $ucModuleDirname = \mb_strtoupper($moduleDirname); - - $ret = $this->pc->getPhpCodeCommentLine('create increment steps for file size'); - $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)"); - $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"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, $t); + $ucModuleDirname = \mb_strtoupper($moduleDirname); + + $ret = $this->pc->getPhpCodeCommentLine('create increment steps for file size'); + $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)'); + $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"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, $t); $cond = $this->xc->getXcEqualsOperator('$increment', '100', null, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '5000 * 1048576', $cond, false, $t); $cond = $this->xc->getXcEqualsOperator('$increment', '50', null, $t . "\t"); @@ -1175,7 +1169,7 @@ private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') $ret .= $this->xc->getXcEqualsOperator('$optionMaxsize', '[]'); $ret .= $this->xc->getXcEqualsOperator('$i', '$increment'); $while = $this->xc->getXcEqualsOperator("\$optionMaxsize[\$i . ' ' . _MI_{$ucModuleDirname}_SIZE_MB]", '$i * 1048576', null, $t . "\t"); - $while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+',$t . "\t"); + $while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+', $t . "\t"); $ret .= $this->pc->getPhpCodeWhile('i * 1048576', $while, '$maxSize', '<='); return $ret; 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 fc4b7ad1..bf14abab 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -1,8 +1,7 @@ -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); @@ -259,21 +255,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); @@ -348,7 +344,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"); } @@ -373,11 +369,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); @@ -401,7 +397,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, * @param $language * @param $fieldId * @param $fieldMain - * @param $tableNotifications + * @param $tableNotifications * @param string $t * @return string */ diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index bc9cc277..d99cb79b 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}', '{$type}');\n"; - break; - case 'samplebutton'; + break; + case 'samplebutton': $ret = $aM . "{$language}, '{$op}', 'add');\n"; break; case 'default': default: $ret = $aM . "{$language}{$stuType}_{$stuTableSoleName}, '{$tableName}.php{$op}', '{$type}');\n"; - break; + break; } return $ret; @@ -113,7 +111,7 @@ public function getAdminItemButton($language, $tableName, $stuTableSoleName, $op /** * @public function getAdminAddNavigation * - * @param $type + * @param $type * @param string $t * @return string */ @@ -193,7 +191,7 @@ public function getAxcAddConfigBoxLine($language, $label = '', $var = '', $t = ' * @param string $tableName * @param string $fieldName * @param string $t - * @param int $countUploader + * @param int $countUploader * @return string */ public function getAxcSetVarImageList($tableName, $fieldName, $t = '', $countUploader = 0) @@ -211,7 +209,7 @@ public function getAxcSetVarImageList($tableName, $fieldName, $t = '', $countUpl $ifelse .= $this->pc->getPhpCodeConditions('$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t"); $contElseExt = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); + $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); return $ret; } @@ -230,44 +228,44 @@ public function getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, { $stuModuleDirname = \mb_strtoupper($moduleDirname); $ucfModuleDirname = \ucfirst($moduleDirname); - $ret = $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); - $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); - $file = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; - $ret .= $this->xc->getXcEqualsOperator('$filename ', $file, null, $t); - $mimetype = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['type']"; - $ret .= $this->xc->getXcEqualsOperator('$imgMimetype ', $mimetype, null, $t); - $ret .= $this->xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t); - $xUploadImage = "\\{$stuModuleDirname}_UPLOAD_IMAGE_PATH"; - $ret .= $this->xc->getXcMediaUploader('uploader', $xUploadImage . " . '/{$tableName}/'", 'mimetypes_image', 'maxsize_image', $t); - $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 .= $t . "\t\$imgName = \str_replace(' ', '', \$imgNameDef) . '.' . \$extension;\n"; - $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; - $ifelse .= $t . "\t{$fetchMedia};\n"; - $contIf = $this->xc->getXcEqualsOperator('$savedFilename', '$uploader->getSavedFileName()', null, $t . "\t\t"); - $config = $this->xc->getXcGetConfig('maxwidth_image'); - $contIf .= $this->xc->getXcEqualsOperator('$maxwidth ', "(int){$config}", null, $t . "\t\t"); - $config = $this->xc->getXcGetConfig('maxheight_image'); - $contIf .= $this->xc->getXcEqualsOperator('$maxheight', "(int){$config}", null, $t . "\t\t"); - $resizer = $this->pc->getPhpCodeCommentLine('Resize image', '', $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler ', "new {$ucfModuleDirname}\Common\Resizer()", null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->sourceFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->endFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->imageMimetype', '$imgMimetype', null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxWidth ', '$maxwidth', null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxHeight ', '$maxheight', null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$result ', '$imgHandler->resizeImage()', null, $t . "\t\t\t"); - $contIf .= $this->pc->getPhpCodeConditions('$maxwidth > 0 && $maxheight > 0', '', '', $resizer, false, $t . "\t\t"); - $contIf .= $this->xc->getXcSetVarObj($tableName, $fieldName, '$savedFilename', $t . "\t\t"); - $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->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - - $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); + $ret = $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); + $file = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; + $ret .= $this->xc->getXcEqualsOperator('$filename ', $file, null, $t); + $mimetype = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['type']"; + $ret .= $this->xc->getXcEqualsOperator('$imgMimetype ', $mimetype, null, $t); + $ret .= $this->xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t); + $xUploadImage = "\\{$stuModuleDirname}_UPLOAD_IMAGE_PATH"; + $ret .= $this->xc->getXcMediaUploader('uploader', $xUploadImage . " . '/{$tableName}/'", 'mimetypes_image', 'maxsize_image', $t); + $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 .= $t . "\t\$imgName = \str_replace(' ', '', \$imgNameDef) . '.' . \$extension;\n"; + $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; + $ifelse .= $t . "\t{$fetchMedia};\n"; + $contIf = $this->xc->getXcEqualsOperator('$savedFilename', '$uploader->getSavedFileName()', null, $t . "\t\t"); + $config = $this->xc->getXcGetConfig('maxwidth_image'); + $contIf .= $this->xc->getXcEqualsOperator('$maxwidth ', "(int){$config}", null, $t . "\t\t"); + $config = $this->xc->getXcGetConfig('maxheight_image'); + $contIf .= $this->xc->getXcEqualsOperator('$maxheight', "(int){$config}", null, $t . "\t\t"); + $resizer = $this->pc->getPhpCodeCommentLine('Resize image', '', $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler ', "new {$ucfModuleDirname}\Common\Resizer()", null, $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->sourceFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->endFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->imageMimetype', '$imgMimetype', null, $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxWidth ', '$maxwidth', null, $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxHeight ', '$maxheight', null, $t . "\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$result ', '$imgHandler->resizeImage()', null, $t . "\t\t\t"); + $contIf .= $this->pc->getPhpCodeConditions('$maxwidth > 0 && $maxheight > 0', '', '', $resizer, false, $t . "\t\t"); + $contIf .= $this->xc->getXcSetVarObj($tableName, $fieldName, '$savedFilename', $t . "\t\t"); + $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->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); + + $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); return $ret; } @@ -296,9 +294,9 @@ public function getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, $ * @param $dirname * @param $tableName * @param $fieldName - * @param bool $formatUrl + * @param bool $formatUrl * @param string $t - * @param int $countUploader + * @param int $countUploader * @param string $fieldMain * @param string $mimetype * @param string $maxsize @@ -322,7 +320,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"; @@ -330,10 +328,10 @@ 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); + $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); return $ret; } @@ -347,28 +345,27 @@ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $format */ public function getAxcSetVarPassword($tableName, $fieldName, $t = '') { - $cf = Modulebuilder\Files\CreateFile::getInstance(); + $cf = Modulebuilder\Files\CreateFile::getInstance(); $ccFieldId = $cf->getCamelCase($fieldName, false, true); - $ret = $this->xc->getXcEqualsOperator("\${$ccFieldId}", "Request::getString('{$fieldName}', '')", '',$t); + $ret = $this->xc->getXcEqualsOperator("\${$ccFieldId}", "Request::getString('{$fieldName}', '')", '', $t); $contIf = $this->xc->getXcSetVarObj($tableName, $fieldName, "password_hash(\${$ccFieldId}, PASSWORD_DEFAULT)", $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' !== ', "''", $contIf, false, $t); return $ret; } - /** * @public function getAxcSetVarMisc * @param $tableName * @param $fieldName - * @param $fieldType - * @param $fieldElement + * @param $fieldType + * @param $fieldElement * @param string $t * @return string */ public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t = '') { - switch ((int)$fieldType){ + switch ((int)$fieldType) { case 2: case 3: case 4: 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 7ca65cd9..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,7 +50,7 @@ public function __construct($caption, $name) public function render() { $ret = ''; - /* @var \XoopsFormElement $ele */ + /** @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 1c752600..6d4a3ba1 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 @@ -81,7 +81,7 @@ public function render() $extras = []; foreach ($this->getElements() as $ele) { - /* @var \XoopsFormElement $ele */ + /** @var \XoopsFormElement $ele */ if (!$ele->isHidden()) { if (!$ele instanceof Modulebuilder\Form\FormRaw) { if ($ele instanceof Modulebuilder\Form\FormTab) { 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 @@ - - - * + * @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 - */ /** diff --git a/class/Morefiles.php b/class/Morefiles.php index 835b621f..8dea5fef 100644 --- a/class/Morefiles.php +++ b/class/Morefiles.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /* @@ -133,14 +132,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); } @@ -148,7 +146,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); @@ -178,7 +175,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/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/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 cac7e71f..7636b6f8 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 bcab7155..a800ef51 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 @@ - */ 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 747d2451..0eaa5181 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/TableChecker.php b/files/commonfiles/class/Common/TableChecker.php index 20a08517..5f7a916c 100644 --- a/files/commonfiles/class/Common/TableChecker.php +++ b/files/commonfiles/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 */ private $checktype = null; - public const CHECKTYPE_REPORT = 0; //report only - public const CHECKTYPE_UPDATE = 1; //update only + public const CHECKTYPE_REPORT = 0; //report only + public const CHECKTYPE_UPDATE = 1; //update only public const CHECKTYPE_UPDATE_REPORT = 2; //update and report - /** * @param \XoopsModules\Modulebuilder\Common\TableChecker|null + * @param mixed $mydirname + * @param mixed $checktype */ public function __construct($mydirname, $checktype = 0) { $this->mydirname = $mydirname; $this->checktype = $checktype; - $this->result = []; + $this->result = []; } - /** - * - */ public function processSQL() { - $tabledefs = $this->readSQLFile(); $this->result[] = 'Tables found in sql:' . \count($tabledefs); @@ -80,7 +72,7 @@ public function processSQL() if ($numRows) { //table exist $this->result[] = 'Table exist:' . $table; - $ret = $this->checkTableFields($table, $tabledef['fields']); + $ret = $this->checkTableFields($table, $tabledef['fields']); } else { if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) { // create new table @@ -102,50 +94,47 @@ public function processSQL() } } - /** - * - */ private function readSQLFile() { $tabledefs = []; $moduleHandler = \xoops_getHandler('module'); - $module = $moduleHandler->getByDirname($this->mydirname); + $module = $moduleHandler->getByDirname($this->mydirname); $module->loadInfoAsVar($this->mydirname); - $sqlfile = $module->getInfo('sqlfile'); + $sqlfile = $module->getInfo('sqlfile'); $sql_file_path = \XOOPS_ROOT_PATH . '/modules/' . $this->mydirname . '/' . $sqlfile[\XOOPS_DB_TYPE]; if (\file_exists($sql_file_path)) { require_once \XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; - $sqlutil = new \SqlUtility(); - $pieces = []; + $sqlutil = new \SqlUtility(); + $pieces = []; $sql_query = \trim(file_get_contents($sql_file_path)); $sqlutil::splitMySqlFile($pieces, $sql_query); $countTable = 0; foreach ($pieces as $piece) { $singleSql = $sqlutil::prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); - $lines = \preg_split('/\r\n|\n|\r/', $piece); + $lines = \preg_split('/\r\n|\n|\r/', $piece); //var_dump($lines); $needle1 = 'create table'; if ($needle1 == \mb_strtolower($singleSql[1])) { - $countLine = 0; - $tabledefs[$countTable]['sql'] = $singleSql[0]; + $countLine = 0; + $tabledefs[$countTable]['sql'] = $singleSql[0]; $tabledefs[$countTable]['name'] = $GLOBALS['xoopsDB']->prefix() . '_' . $singleSql[4]; - $this->after = ''; - foreach($lines as $line) { + $this->after = ''; + foreach ($lines as $line) { if ($countLine > 0) { $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); } } @@ -163,24 +152,24 @@ 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, 0) + 1); - $needle = ')'; - $key_text = \substr($key_text, 0, \strpos($key_text, $needle, 0)); + $needle = '('; + $key_text = \mb_substr($line, \mb_strpos($line, $needle, 0) + 1); + $needle = ')'; + $key_text = \mb_substr($key_text, 0, \mb_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); - $params = \array_values(\array_filter(\explode(' ', $clean))); - $field['sql'] = $clean; + $counter = 0; + $clean = mb_substr(\trim($line), 0, -1); + $params = \array_values(\array_filter(\explode(' ', $clean))); + $field['sql'] = $clean; $field['name'] = \trim($params[$counter], '`'); $counter++; $field['type'] = $params[$counter]; @@ -191,7 +180,7 @@ private function extractField($line) { } if ('not' == \mb_strtolower($params[$counter]) && 'null' == \mb_strtolower($params[$counter + 1])) { $field['null'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter+2; + $counter = $counter + 2; } if (\count($params) > $counter) { if ('auto_increment' == \mb_strtolower($params[$counter])) { @@ -202,15 +191,14 @@ private function extractField($line) { if (\count($params) > $counter) { if ('default' == \mb_strtolower($params[$counter])) { $field['default'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter + 2; + $counter = $counter + 2; } } $field['after'] = $this->after; - $this->after = $field['name']; + $this->after = $field['name']; return $field; - } private function checkTableFields($table, $fields) @@ -229,7 +217,7 @@ private function checkTableFields($table, $fields) // create new field $sql = "ALTER TABLE `$table` ADD " . $field['sql']; if ('' !== (string)$field['after']) { - $sql .= ' AFTER `' . $field['after'] . '`;'; + $sql .= ' AFTER `' . $field['after'] . '`;'; } if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { $this->result[] = 'Field added:' . $fieldname; 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/Common/XoopsConfirm.php b/files/commonfiles/class/Common/XoopsConfirm.php index 10f6cee5..c3a0f553 100644 --- a/files/commonfiles/class/Common/XoopsConfirm.php +++ b/files/commonfiles/class/Common/XoopsConfirm.php @@ -1,4 +1,4 @@ - - Website: @@ -75,7 +74,6 @@ public function getFormXoopsConfirm() $this->title = CO_MYMODULE_DELETE_CONFIRM; } if ('' === $this->label) { - $this->label = CO_MYMODULE_DELETE_LABEL; } @@ -94,6 +92,7 @@ public function getFormXoopsConfirm() $buttonBack->setExtra('onclick="history.go(-1);return true;"'); $buttonTray->addElement($buttonBack); $form->addElement($buttonTray); + return $form; } } 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 e46c6522..a9088bd7 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 c8dd909e..042d04ee 100644 --- a/files/commonfiles/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -1,10 +1,11 @@ - 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) $ @@ -100,7 +99,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/index.php b/index.php index 6a505435..e5ee0725 100644 --- a/index.php +++ b/index.php @@ -1,2 +1,2 @@ -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"); @@ -331,7 +330,7 @@ \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_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'); @@ -429,12 +428,12 @@ \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 '); @@ -477,4 +476,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/directorychecker.php b/language/english/directorychecker.php index 46d9b61e..a88bdb01 100644 --- a/language/english/directorychecker.php +++ b/language/english/directorychecker.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 @@ - 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_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/index.php b/templates/index.php index 4ae18fd0..e5ee0725 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,2 +1,2 @@ - Date: Mon, 24 Jan 2022 21:45:55 -0500 Subject: [PATCH 207/266] declare(strict_types=1), cosmetics --- admin/morefiles.php | 3 +-- admin/settings.php | 3 +-- class/Building.php | 7 +++---- class/Common/FileChecker.php | 4 ++-- class/Common/FilesManagement.php | 18 ++++++++++-------- class/Fields.php | 7 +++---- class/Files/Admin/AdminBroken.php | 5 ++--- class/Files/Admin/AdminHeader.php | 11 +++++------ class/Files/Admin/AdminMenu.php | 9 ++++----- class/Files/Classes/ClassHandlerFiles.php | 7 +++---- class/Files/CreateMoreFiles.php | 5 ++--- class/Files/User/UserListTag.php | 7 +++---- class/Files/User/UserSearch.php | 5 ++--- class/Files/User/UserViewTag.php | 7 +++---- class/Files/admin/AdminAbout.php | 5 ++--- class/Modules.php | 13 ++++++------- class/Settings.php | 5 ++--- class/Tables.php | 7 +++---- files/commonfiles/class/Common/FileChecker.php | 4 ++-- 19 files changed, 59 insertions(+), 73 deletions(-) diff --git a/admin/morefiles.php b/admin/morefiles.php index 60a38c00..dacadd17 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 449cf92a..78bb9fee 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -1,4 +1,4 @@ - - * */ // Define main template diff --git a/class/Building.php b/class/Building.php index 6ea687ca..ee5ea330 100644 --- a/class/Building.php +++ b/class/Building.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/Fields.php b/class/Fields.php index 4bc0c4b5..7aa4a1f9 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** @@ -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/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index 21861dbe..35be2f13 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/AdminMenu.php b/class/Files/Admin/AdminMenu.php index be451212..99908120 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -1,4 +1,4 @@ -setModule($module); $this->setFileName($filename); @@ -83,7 +82,7 @@ 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},"); } diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index ebf6310d..b75cec11 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/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 @@ -setModule($module); $this->setFileName($filename); diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index 55afdfcc..27f9156a 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/admin/AdminAbout.php b/class/Files/admin/AdminAbout.php index cc9a8dca..e76219c3 100644 --- a/class/Files/admin/AdminAbout.php +++ b/class/Files/admin/AdminAbout.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** @@ -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/Settings.php b/class/Settings.php index c8ffa8a5..1ad122b6 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -1,4 +1,4 @@ -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/Tables.php b/class/Tables.php index 77476d9c..ab6cad62 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -1,4 +1,4 @@ - - - * + * @author Txmod Xoops - */ /** @@ -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/files/commonfiles/class/Common/FileChecker.php b/files/commonfiles/class/Common/FileChecker.php index 380254fd..c8282eb1 100644 --- a/files/commonfiles/class/Common/FileChecker.php +++ b/files/commonfiles/class/Common/FileChecker.php @@ -1,4 +1,4 @@ - Date: Mon, 24 Jan 2022 21:46:15 -0500 Subject: [PATCH 208/266] PHP 8 version --- files/commonfiles/.scrutinizer.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/files/commonfiles/.scrutinizer.yml b/files/commonfiles/.scrutinizer.yml index a8feb1b1..23c90bba 100644 --- a/files/commonfiles/.scrutinizer.yml +++ b/files/commonfiles/.scrutinizer.yml @@ -15,9 +15,6 @@ build: tests: override: - php-scrutinizer-run --enable-security-analysis - environment: - php: - version: "7.2" filter: dependency_paths: - XoopsCore25/* From 603b629a58ae0254283078a84c3979a717ecb605 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 21:46:49 -0500 Subject: [PATCH 209/266] /> cosmetics --- templates/admin/modulebuilder_building.tpl | 18 ++++---- templates/admin/modulebuilder_devtools.tpl | 6 +-- templates/admin/modulebuilder_fields_item.tpl | 44 +++++++++--------- templates/admin/modulebuilder_morefiles.tpl | 8 ++-- templates/admin/modulebuilder_settings.tpl | 16 +++---- templates/admin/modulebuilder_tables.tpl | 46 +++++++++---------- templates/admin/modulebuilder_tables_item.tpl | 42 ++++++++--------- 7 files changed, 90 insertions(+), 90 deletions(-) diff --git a/templates/admin/modulebuilder_building.tpl b/templates/admin/modulebuilder_building.tpl index 5e93b69b..f089e277 100644 --- a/templates/admin/modulebuilder_building.tpl +++ b/templates/admin/modulebuilder_building.tpl @@ -1,7 +1,7 @@ <{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_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_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}> From 665343bec4d77875cd23056d3ace5d30dec880ca Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 21:47:19 -0500 Subject: [PATCH 210/266] self::, mb_strpos --- class/Devtools.php | 118 ++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/class/Devtools.php b/class/Devtools.php index e83c3e95..2491e073 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -1,4 +1,4 @@ - - * @since + * @since */ use XoopsModules\Modulebuilder; @@ -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 = []; @@ -182,37 +182,37 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { $moduleNameUpper = \mb_strtoupper($moduleName); // module language defines $constants[] = [ - '_AM_' . $moduleNameUpper .'_', - '_MI_' . $moduleNameUpper .'_', - '_MB_' . $moduleNameUpper .'_', - '_MA_' . $moduleNameUpper .'_', + '_AM_' . $moduleNameUpper . '_', + '_MI_' . $moduleNameUpper . '_', + '_MB_' . $moduleNameUpper . '_', + '_MA_' . $moduleNameUpper . '_', ]; // repair known errors $errors = [ - 'substr_\count(' => 'substr_count(', - 'micro\time(' => 'microtime(', - 'mk\time(' => 'mktime(', - 'strto\time(' => 'strtotime(', - 'mb_\strlen(' => 'mb_strlen(', - 'mb_\substr(' => 'mb_substr(', - 'x\copy' => 'xcopy', - 'r\rmdir' => 'rrmdir', - 'r\copy' => 'rcopy', - 'r\trim' => 'rtrim', - 'l\trim' => 'ltrim', - '\dirname()' => 'dirname()', - 'assw\ord' => 'assword', - 'mb_\strpos' => 'mb_strpos', - 'image\copy(' => 'imagecopy(', - '<{if \count(' => '<{if count(', - 'define(\_' => 'define(_', - '\strr\chr(' => '\strrchr(', - 'strf\time(' => 'strftime(', - "'\_AM_" . $moduleNameUpper .'_' => "'_AM_" . $moduleNameUpper .'_', - "'\_MI_" . $moduleNameUpper .'_' => "'_MI_" . $moduleNameUpper .'_', - "'\_MB_" . $moduleNameUpper .'_' => "'_MB_" . $moduleNameUpper .'_', - "'\_MA_" . $moduleNameUpper .'_' => "'_MA_" . $moduleNameUpper .'_', + 'substr_\count(' => 'substr_count(', + 'micro\time(' => 'microtime(', + 'mk\time(' => 'mktime(', + 'strto\time(' => 'strtotime(', + 'mb_\strlen(' => 'mb_strlen(', + 'mb_\substr(' => 'mb_substr(', + 'x\copy' => 'xcopy', + 'r\rmdir' => 'rrmdir', + 'r\copy' => 'rcopy', + 'r\trim' => 'rtrim', + 'l\trim' => 'ltrim', + '\dirname()' => 'dirname()', + 'assw\ord' => 'assword', + 'mb_\strpos' => 'mb_strpos', + 'image\copy(' => 'imagecopy(', + '<{if \count(' => '<{if count(', + 'define(\_' => 'define(_', + '\strr\chr(' => '\strrchr(', + 'strf\time(' => 'strftime(', + "'\_AM_" . $moduleNameUpper . '_' => "'_AM_" . $moduleNameUpper . '_', + "'\_MI_" . $moduleNameUpper . '_' => "'_MI_" . $moduleNameUpper . '_', + "'\_MB_" . $moduleNameUpper . '_' => "'_MB_" . $moduleNameUpper . '_', + "'\_MA_" . $moduleNameUpper . '_' => "'_MA_" . $moduleNameUpper . '_', ]; $patterns = []; @@ -229,7 +229,7 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) { foreach ($constants as $constant) { //reset existing in order to avoid double \\ foreach ($constant as $item) { - $patterns['\\' . $item ] = $item; + $patterns['\\' . $item] = $item; } //apply now for all foreach ($constant as $item) { @@ -244,44 +244,45 @@ 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 - * @param $moduleName */ - 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 + * @param $src_path + * @param $dst_path * @param array $patKeys * @param array $patValues * @param bool $replaceTabs */ - public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues =[], $replaceTabs = false) + public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues = [], $replaceTabs = false): void { // open the source directory $dir = \opendir($src_path); // Make the destination directory if not exist @\mkdir($dst_path); // Loop through the files in source directory - while( $file = \readdir($dir) ) { - if (( $file != '.' ) && ( $file != '..' )) { - if ( \is_dir($src_path . '/' . $file) ) { + while ($file = \readdir($dir)) { + 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); } } } @@ -289,21 +290,20 @@ public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $pat } /** - * @param $src_file - * @param $dst_file + * @param $src_file + * @param $dst_file * @param array $patKeys * @param array $patValues - * @param array $patValues * @param bool $replaceTabs */ - private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues =[], $replaceTabs = false) + private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues = [], $replaceTabs = false): void { - $replace_code = false; + $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; } @@ -317,9 +317,9 @@ private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValue } //check file name whether it contains replace code $path_parts = \pathinfo($dst_file); - $path = $path_parts['dirname']; - $file = $path_parts['basename']; - $dst_file = $path . '/' . \str_replace($patKeys, $patValues, $file); + $path = $path_parts['dirname']; + $file = $path_parts['basename']; + $dst_file = $path . '/' . \str_replace($patKeys, $patValues, $file); \file_put_contents($dst_file, $content); } else { \copy($src_file, $dst_file); @@ -342,7 +342,7 @@ public static function getFormModulesFq($action = false) $form->setExtra('enctype="multipart/form-data"'); // Form Select Module $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_FQ_MODULE, 'fq_module', ''); - $modulesArr = \XoopsLists::getModulesList(); + $modulesArr = \XoopsLists::getModulesList(); $modulesSelect->addOption('', ' '); foreach ($modulesArr as $mod) { $modulesSelect->addOption($mod, $mod); @@ -371,7 +371,7 @@ public static function getFormModulesCl($action = false) $form->setExtra('enctype="multipart/form-data"'); // Form Select Module $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_CL_MODULE, 'cl_module', ''); - $modulesArr = \XoopsLists::getModulesList(); + $modulesArr = \XoopsLists::getModulesList(); $modulesSelect->addOption('', ' '); foreach ($modulesArr as $mod) { $modulesSelect->addOption($mod, $mod); @@ -400,7 +400,7 @@ public static function getFormModulesTab($action = false) $form->setExtra('enctype="multipart/form-data"'); // Form Select Module $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_TAB_MODULE, 'tab_module', ''); - $modulesArr = \XoopsLists::getModulesList(); + $modulesArr = \XoopsLists::getModulesList(); $modulesSelect->addOption('', ' '); foreach ($modulesArr as $mod) { $modulesSelect->addOption($mod, $mod); From e116bfa997e23febec79ab871b6416f5b3733cb0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 21:49:10 -0500 Subject: [PATCH 211/266] mb_strpos, list() to [] --- class/Import.php | 93 +++---- files/commonfiles/include/update.php | 14 +- include/update.php | 347 +++++++++++++++------------ 3 files changed, 244 insertions(+), 210 deletions(-) diff --git a/class/Import.php b/class/Import.php index 98cf520c..17ef9662 100644 --- a/class/Import.php +++ b/class/Import.php @@ -1,4 +1,4 @@ -getObjects($criteria, false, true); $moduleId = $moduleObject[0]->getVar('mod_id'); - $tables = self::importTables($moduleId, $moduleName); - if (false === $tables ) { + $tables = self::importTables($moduleId, $moduleName); + if (null === $tables) { $ret['result'] = false; - $ret['error'] = \_AM_MODULEBUILDER_ERROR_IMPTABLES; + $ret['error'] = \_AM_MODULEBUILDER_ERROR_IMPTABLES; } else { $ret['result'] = true; $ret['tables'] = $tables; } } else { $ret['result'] = false; - $ret['error'] = \_AM_MODULEBUILDER_ERROR_MCREATE . $GLOBALS['xoopsDB']->error(); + $ret['error'] = \_AM_MODULEBUILDER_ERROR_MCREATE . $GLOBALS['xoopsDB']->error(); } + return $ret; } /** - * @param $moduleId - * @param $moduleName + * @param int $moduleId + * @param string $moduleName */ - public static function importTables($moduleId, $moduleName) + public static function importTables($moduleId, $moduleName): ?array { $helper = Helper::getInstance(); $tablesHandler = $helper->getHandler('Tables'); @@ -105,10 +107,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(); @@ -134,7 +137,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 = [ @@ -161,7 +163,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']); @@ -175,7 +177,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); @@ -189,7 +191,7 @@ public static function importTables($moduleId, $moduleName) $fieldsObj->setVar('field_null', $null); $fieldsObj->setVar('field_default', $t['Default']); - $key = 1; + $key = 1; if (isset($t['Key'])) { $keys = [ 2 => 'PRI', @@ -198,20 +200,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']) { @@ -222,19 +223,19 @@ 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',])) { - //XoopsFormTextArea - $fieldsObj->setVar('field_element', '3'); - } 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']) { - //XoopsFormDateTime //XoopsFormDatePicker - $fieldsObj->setVar('field_element', '21'); - } elseif ('date' === $t['Type']) { - //XoopsFormTextDateSelect - $fieldsObj->setVar('field_element', '15'); - } + 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'])) { + //XoopsFormText + $fieldsObj->setVar('field_element', '2'); + } elseif ('datetime' === $t['Type']) { + //XoopsFormDateTime //XoopsFormDatePicker + $fieldsObj->setVar('field_element', '21'); + } elseif ('date' === $t['Type']) { + //XoopsFormTextDateSelect + $fieldsObj->setVar('field_element', '15'); + } } ++$currentFieldNumber; @@ -246,14 +247,13 @@ public static function importTables($moduleId, $moduleName) ++$currentTableNumber; } - } else { - return false; } + return $tables; } /** - * @param $tableName + * @param string $tableName * * @return array */ @@ -268,7 +268,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']; @@ -284,24 +284,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/files/commonfiles/include/update.php b/files/commonfiles/include/update.php index 69efc843..5a63ebd2 100644 --- a/files/commonfiles/include/update.php +++ b/files/commonfiles/include/update.php @@ -1,4 +1,4 @@ - - 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/include/update.php b/include/update.php index 4fd6c8b9..de9cd143 100644 --- a/include/update.php +++ b/include/update.php @@ -1,4 +1,4 @@ -getErrors()); } if (!clean_index_files()) { print_r($module->getErrors()); } - - //check upload directory - require_once __DIR__ . '/install.php'; + + //check upload directory + require_once __DIR__ . '/install.php'; xoops_module_install_modulebuilder($module); - + $errors = $module->getErrors(); if (!empty($errors)) { print_r($errors); } return $ret; - } // irmtfan bug fix: solve templates duplicate issue @@ -73,7 +71,7 @@ function update_modulebuilder_v191($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) { @@ -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 /** @@ -128,229 +127,229 @@ function update_modulebuilder_v191($module) function modulebuilder_check_db($module) { $ret = true; - //insert here code for database check + //insert here code for database check global $xoopsDB; // new form field SelectStatus - $fname = 'SelectStatus'; - $fid = 16; - $fvalue = 'XoopsFormSelectStatus'; - $result = $xoopsDB->query( + $fname = 'SelectStatus'; + $fid = 16; + $fvalue = 'XoopsFormSelectStatus'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 16 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } // new form field Password - $fname = 'Password'; - $fid = 17; - $fvalue = 'XoopsFormPassword'; - $result = $xoopsDB->query( + $fname = 'Password'; + $fid = 17; + $fvalue = 'XoopsFormPassword'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 17 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 17 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } // new form field SelectCountry - $fname = 'SelectCountry'; - $fid = 18; - $fvalue = 'XoopsFormSelectCountry'; - $result = $xoopsDB->query( + $fname = 'SelectCountry'; + $fid = 18; + $fvalue = 'XoopsFormSelectCountry'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 18 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 18 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } // new form field SelectLanguage - $fname = 'SelectLang'; - $fid = 19; - $fvalue = 'XoopsFormSelectLang'; - $result = $xoopsDB->query( + $fname = 'SelectLang'; + $fid = 19; + $fvalue = 'XoopsFormSelectLang'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 19 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 19 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } // new form field Radio - $fname = 'Radio'; - $fid = 20; - $fvalue = 'XoopsFormRadio'; - $result = $xoopsDB->query( + $fname = 'Radio'; + $fid = 20; + $fvalue = 'XoopsFormRadio'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 20 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 20 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } // new form field DateTime - $fname = 'DateTime'; - $fid = 21; - $fvalue = 'XoopsFormDateTime'; - $result = $xoopsDB->query( + $fname = 'DateTime'; + $fid = 21; + $fvalue = 'XoopsFormDateTime'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 21 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 21 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } // new form field DateTime - $fname = 'SelectCombo'; - $fid = 22; - $fvalue = 'XoopsFormSelectCombo'; - $result = $xoopsDB->query( + $fname = 'SelectCombo'; + $fid = 22; + $fvalue = 'XoopsFormSelectCombo'; + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}')"; + $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); // update table fields to new id of previous 22 - $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + $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 22 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; $result = $xoopsDB->query($sql); } } @@ -482,30 +481,36 @@ function modulebuilder_check_db($module) $fsort = 22; $fdeftype = 14; $fdefvalue = 45; - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}';"; + $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,38 +522,44 @@ function modulebuilder_check_db($module) $fsort = 23; $fdeftype = 14; $fdefvalue = 16; - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}';"; + $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); } } // update table 'modulebuilder_fieldelements' - $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); - $field = 'fieldelement_defvalue'; - $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(5) NULL DEFAULT NULL;"; + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); + $field = 'fieldelement_defvalue'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(5) NULL DEFAULT NULL;"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); @@ -562,30 +573,36 @@ function modulebuilder_check_db($module) $fsort = 24; $fdeftype = 2; $fdefvalue = 10; - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}';"; + $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,30 +613,36 @@ function modulebuilder_check_db($module) $fsort = 25; $fdeftype = 7; $fdefvalue = '10, 2'; - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}';"; + $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,30 +653,36 @@ function modulebuilder_check_db($module) $fsort = 26; $fdeftype = 2; $fdefvalue = 10; - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}';"; + $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,30 +693,36 @@ function modulebuilder_check_db($module) $fsort = 27; $fdeftype = 2; $fdefvalue = 10; - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" ); - $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( + $result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" ); $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}';"; + $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); } } @@ -707,9 +742,9 @@ function modulebuilder_check_db($module) } // update table 'modulebuilder_settings' - $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_settings'); - $field = 'set_version'; - $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_settings'); + $field = 'set_version'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); @@ -717,9 +752,9 @@ function modulebuilder_check_db($module) } // update table 'modulebuilder_modules' - $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); - $field = 'mod_version'; - $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); + $field = 'mod_version'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); @@ -737,7 +772,7 @@ function modulebuilder_check_db($module) */ function clean_index_files() { - $files = []; + $files = []; $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/admin/index.php'; $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/assets/index.php'; $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/commonfiles/class/index.php'; @@ -748,7 +783,7 @@ function clean_index_files() $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/class/index.php'; $files[] = \XOOPS_ROOT_PATH . '/modules/modulebuilder/files/ratingfiles/templates/index.php'; - foreach($files as $file) { + foreach ($files as $file) { if (\file_exists($file)) { \unlink($file); } From c6e4d6c73b859fcc246982b19bde198d329d2a25 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 21:49:18 -0500 Subject: [PATCH 212/266] typo --- language/english/common.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 @@ - Date: Mon, 24 Jan 2022 21:49:51 -0500 Subject: [PATCH 213/266] confirm to clear --- testdata/index.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/testdata/index.php b/testdata/index.php index dd40ad91..f117e8d8 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -1,4 +1,5 @@ -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); From da295eb6e291981b71f2b1546a99a3bffa85fed3 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 22:41:18 -0500 Subject: [PATCH 214/266] Strict type --- .atoum.php | 3 ++- admin/migrate.php | 4 +--- class/Files/Admin/AdminIndex.php | 2 +- class/Files/Admin/AdminPermissions.php | 2 +- class/Files/Blocks/BlocksFilesSpotlight.php | 2 +- .../Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php | 2 +- class/Files/User/UserPages.php | 2 +- class/Files/User/UserRate.php | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.atoum.php b/.atoum.php index e9c8ba6c..902a12dc 100644 --- a/.atoum.php +++ b/.atoum.php @@ -1,4 +1,5 @@ - Date: Mon, 24 Jan 2022 22:51:39 -0500 Subject: [PATCH 215/266] Undefined class --- admin/index.php | 2 +- class/Files/Language/LanguageAdmin.php | 7 ++++--- class/Files/admin/AdminPages.php | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/admin/index.php b/admin/index.php index 4f3bcd60..13c16d96 100644 --- a/admin/index.php +++ b/admin/index.php @@ -27,7 +27,7 @@ use XoopsModules\Modulebuilder\{ Common, Common\TestdataButtons, - Forms, + Form, Helper, Utility }; diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 71b71dfb..1084770a 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -4,7 +4,8 @@ use XoopsModules\Modulebuilder\{ Files, - Constants + Constants, + Helper }; /* @@ -50,7 +51,7 @@ public function __construct() { parent::__construct(); $this->ld = LanguageDefines::getInstance(); - $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->pc = Files\CreatePhpCode::getInstance(); } /** @@ -195,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/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 1640548f..6b1b3674 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -53,9 +53,9 @@ class AdminPages extends Files\CreateFile public function __construct() { parent::__construct(); - $this->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(); } /** @@ -429,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(); From c9801404886b29afeb596b8a76ee5aca5c2a56c2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 22:51:50 -0500 Subject: [PATCH 216/266] remove void --- class/Files/CreateAbstractClass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Files/CreateAbstractClass.php b/class/Files/CreateAbstractClass.php index 3d58f372..3d3102a6 100644 --- a/class/Files/CreateAbstractClass.php +++ b/class/Files/CreateAbstractClass.php @@ -150,7 +150,7 @@ public function getFields() * * @abstract */ - public function render(): void + public function render() { } } From 2edefe058685cf36bd81684dca0a016479b00817 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 22:54:12 -0500 Subject: [PATCH 217/266] return \XoopsObject --- files/ratingfiles/class/RatingsHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/ratingfiles/class/RatingsHandler.php b/files/ratingfiles/class/RatingsHandler.php index 82516317..6d6e0713 100644 --- a/files/ratingfiles/class/RatingsHandler.php +++ b/files/ratingfiles/class/RatingsHandler.php @@ -40,7 +40,7 @@ public function __construct(\XoopsDatabase $db) /** * @param bool $isNew * - * @return object + * @return \XoopsObject */ public function create($isNew = true) { From a2ea0a419351f7414a2ecf719df45f690c38e4e7 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 24 Jan 2022 23:49:17 -0500 Subject: [PATCH 218/266] strict type --- class/Files/Blocks/BlocksFiles.php | 4 ++-- class/Files/Blocks/BlocksFilesSpotlight.php | 2 +- class/Files/Classes/ClassFiles.php | 2 +- class/Files/Classes/ClassFormElements.php | 10 +++++----- class/Files/CreateFile.php | 2 +- class/Files/CreatePhpCode.php | 2 +- class/Files/User/UserPages.php | 2 +- class/Files/User/UserXoopsCode.php | 16 ++++++++-------- class/Files/User/UserXoopsVersion.php | 4 ++-- class/Files/admin/AdminPages.php | 2 +- xoops_version.php | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index e3e0003e..31f6ef8c 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -116,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 diff --git a/class/Files/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php index 92e688c5..d571ef69 100644 --- a/class/Files/Blocks/BlocksFilesSpotlight.php +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -132,7 +132,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tablePermissions, $f $crit = $this->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/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 7bdf242b..43bfd0a1 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -365,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'); diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 6bca0d1f..f85749d1 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -334,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; @@ -420,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 +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, ''); @@ -462,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; } @@ -808,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; diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index f58450f2..c0b8a4a8 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -329,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, '_')); } /** diff --git a/class/Files/CreatePhpCode.php b/class/Files/CreatePhpCode.php index 9e52348e..51b46a19 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -352,7 +352,7 @@ public function getPhpCodeFunction($name = null, $params = null, $content = null * @param string $conditionElse * @return string */ - public function getPhpCodeConditions($condition = null, $operator = null, $type = null, $contentIf = null, $contentElse = false, $t = '', $conditionElse = '') + public function getPhpCodeConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $t = '', $conditionElse = '') { if ('==' === \trim($operator) || '===' === \trim($operator) || '!=' === \trim($operator) || '!==' === \trim($operator)) { //yoda conditions diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 5f6c73bb..7854ae2b 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -385,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; } diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index ee7d967f..50165012 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -175,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 */ @@ -212,11 +212,11 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ //search for longest key $len = 0; foreach ($descs as $key => $desc) { - $len = \mb_strlen($key) > $len ? \mb_strlen($key) : $len; + $len = \mb_strlen((string)$key) > $len ? \mb_strlen((string)$key) : $len; } foreach ($descs as $key => $desc) { - $space = str_repeat(' ', $len - \mb_strlen($key)); + $space = str_repeat(' ', $len - \mb_strlen((string)$key)); if ($eleArray < 4) { $ret .= $t . "\t'{$key}'{$space} => {$desc},{$n}"; } elseif (11 === $eleArray) { diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 07dac9e2..c58abea3 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -132,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", diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 6b1b3674..d22309d3 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -258,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; } diff --git a/xoops_version.php b/xoops_version.php index c0901e15..b7f581a9 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -65,8 +65,8 @@ $modversion['forum_site_name'] = 'ModuleBuilder 3.03 for Testing'; $modversion['module_website_name'] = 'Xoops TDM'; // Admin things -$modversion['system_menu'] = 1; -$modversion['hasAdmin'] = 1; +$modversion['system_menu'] = '1'; +$modversion['hasAdmin'] = '1'; $modversion['adminindex'] = 'admin/index.php'; $modversion['adminmenu'] = 'admin/menu.php'; // Templates admin From b43dcbacc9414475dd209300c95c5fdcbf9a8f95 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 27 Jan 2022 07:34:54 +0100 Subject: [PATCH 219/266] updates from main branch --- .atoum.php | 3 +- README.md | 2 +- admin/about.php | 4 +- admin/building.php | 22 +- admin/devtools.php | 73 ++-- admin/feedback.php | 6 +- admin/fields.php | 5 +- admin/footer.php | 5 +- admin/header.php | 5 +- admin/import_module.php | 8 +- admin/index.php | 7 +- admin/logo.php | 5 +- admin/menu.php | 5 +- admin/migrate.php | 73 ++-- admin/modules.php | 10 +- admin/morefiles.php | 3 +- admin/settings.php | 3 +- admin/tables.php | 5 +- assets/css/admin/index.php | 2 +- assets/css/index.php | 2 +- assets/fonts/index.php | 2 +- assets/images/icons/16/index.php | 2 +- assets/images/icons/24/index.php | 2 +- assets/images/icons/32/index.php | 2 +- assets/images/icons/index.php | 2 +- assets/images/index.php | 2 +- assets/images/logos/index.php | 2 +- assets/images/modules/index.php | 2 +- assets/index.php | 2 +- assets/js/index.php | 2 +- class/Building.php | 7 +- class/Common/Breadcrumb.php | 6 +- class/Common/Configurator.php | 6 +- class/Common/Confirm.php | 5 +- class/Common/DirectoryChecker.php | 7 +- class/Common/FileChecker.php | 4 +- class/Common/FilesManagement.php | 18 +- class/Common/Migrate.php | 13 +- class/Common/ModuleFeedback.php | 8 +- class/Common/ModuleStats.php | 6 +- class/Common/Resizer.php | 11 +- class/Common/ServerStats.php | 4 +- class/Common/SysUtility.php | 8 +- class/Common/TableChecker.php | 45 +- class/Common/TestdataButtons.php | 37 +- class/Common/VersionChecks.php | 4 +- class/Common/index.php | 2 +- class/Constants.php | 69 ++-- class/Devtools.php | 34 +- class/Fieldattributes.php | 5 +- class/FieldattributesHandler.php | 5 +- class/Fieldelements.php | 5 +- class/FieldelementsHandler.php | 6 +- class/Fieldkey.php | 3 +- class/FieldkeyHandler.php | 3 +- class/Fieldnull.php | 3 +- class/FieldnullHandler.php | 3 +- class/Fields.php | 9 +- class/FieldsHandler.php | 5 +- class/Fieldtype.php | 3 +- class/FieldtypeHandler.php | 3 +- class/Files/Admin/AdminBroken.php | 5 +- class/Files/Admin/AdminHeader.php | 11 +- class/Files/Admin/AdminIndex.php | 8 +- class/Files/Admin/AdminMenu.php | 11 +- class/Files/Admin/AdminPermissions.php | 8 +- class/Files/Admin/index.php | 2 +- .../Files/Assets/Css/Admin/CssAdminStyles.php | 15 +- class/Files/Assets/Css/Admin/index.php | 4 +- class/Files/Assets/Css/CssSelectors.php | 5 +- class/Files/Assets/Css/CssStyles.php | 43 +- class/Files/Assets/Css/index.php | 4 +- class/Files/Assets/Js/JavascriptJQuery.php | 151 ++++--- class/Files/Assets/Js/JsJquery.php | 21 +- class/Files/Assets/Js/index.php | 4 +- class/Files/Assets/index.php | 4 +- class/Files/Blocks/BlocksFiles.php | 19 +- class/Files/Blocks/BlocksFilesSpotlight.php | 4 +- class/Files/Blocks/index.php | 4 +- class/Files/CheckData.php | 116 +++--- class/Files/Classes/ClassFiles.php | 29 +- class/Files/Classes/ClassFormElements.php | 48 +-- class/Files/Classes/ClassHandlerFiles.php | 7 +- class/Files/Classes/ClassSpecialFiles.php | 142 ++++--- class/Files/Classes/ClassXoopsCode.php | 7 +- class/Files/Classes/index.php | 4 +- class/Files/Config/ConfigConfig.php | 96 +++-- class/Files/Config/index.php | 4 +- class/Files/CreateAbstractClass.php | 13 +- class/Files/CreateArchitecture.php | 13 +- class/Files/CreateClone.php | 9 +- class/Files/CreateCodeIndents.php | 2 +- class/Files/CreateFile.php | 23 +- class/Files/CreateHtmlCode.php | 73 ++-- class/Files/CreateMoreFiles.php | 5 +- class/Files/CreatePhpCode.php | 14 +- class/Files/CreateSmartyCode.php | 50 ++- class/Files/CreateStructure.php | 33 +- class/Files/CreateTableFields.php | 5 +- class/Files/CreateXoopsCode.php | 105 ++--- class/Files/Docs/DocsChangelog.php | 17 +- class/Files/Docs/DocsFiles.php | 57 ++- class/Files/Docs/index.php | 4 +- .../Includes/IncludeCommentFunctions.php | 54 ++- class/Files/Includes/IncludeComments.php | 6 +- class/Files/Includes/IncludeCommon.php | 39 +- class/Files/Includes/IncludeFunctions.php | 384 +++++++++--------- class/Files/Includes/IncludeJquery.php | 21 +- class/Files/Includes/IncludeNotifications.php | 50 ++- class/Files/Includes/IncludeSearch.php | 69 ++-- class/Files/Includes/index.php | 4 +- class/Files/Language/LanguageAdmin.php | 18 +- class/Files/Language/LanguageBlocks.php | 23 +- class/Files/Language/LanguageDefines.php | 5 +- class/Files/Language/LanguageHelp.php | 63 ++- class/Files/Language/LanguageMailTpl.php | 9 +- class/Files/Language/LanguageMain.php | 7 +- class/Files/Language/LanguageModinfo.php | 126 +++--- class/Files/Language/index.php | 4 +- class/Files/Sql/SqlFile.php | 9 +- class/Files/Sql/index.php | 4 +- .../Templates/Admin/TemplatesAdminAbout.php | 7 +- .../Templates/Admin/TemplatesAdminBroken.php | 7 +- .../Templates/Admin/TemplatesAdminFooter.php | 24 +- .../Templates/Admin/TemplatesAdminHeader.php | 7 +- .../Templates/Admin/TemplatesAdminIndex.php | 7 +- .../Templates/Admin/TemplatesAdminPages.php | 6 +- .../Admin/TemplatesAdminPermissions.php | 8 +- class/Files/Templates/Admin/index.php | 4 +- .../Blocks/Defstyle/TemplatesBlocks.php | 64 ++- .../Defstyle/TemplatesBlocksSpotlight.php | 2 +- .../Files/Templates/Blocks/Defstyle/index.php | 4 +- class/Files/Templates/Blocks/index.php | 4 +- .../Templates/User/Defstyle/Breadcrumbs.php | 7 +- .../Templates/User/Defstyle/Categories.php | 9 +- .../User/Defstyle/CategoriesList.php | 76 ++-- .../Files/Templates/User/Defstyle/Footer.php | 24 +- .../Files/Templates/User/Defstyle/Header.php | 7 +- class/Files/Templates/User/Defstyle/Index.php | 9 +- .../Templates/User/Defstyle/MoreFiles.php | 19 +- class/Files/Templates/User/Defstyle/Pages.php | 8 +- .../Templates/User/Defstyle/PagesItem.php | 6 +- .../Templates/User/Defstyle/PagesList.php | 7 +- class/Files/Templates/User/Defstyle/Pdf.php | 51 ++- class/Files/Templates/User/Defstyle/Rate.php | 95 +++-- class/Files/Templates/User/Defstyle/Rss.php | 75 ++-- .../Files/Templates/User/Defstyle/Search.php | 95 +++-- .../Templates/User/Defstyle/UserPrint.php | 7 +- class/Files/Templates/User/index.php | 4 +- class/Files/Templates/index.php | 4 +- class/Files/User/UserFooter.php | 7 +- class/Files/User/UserHeader.php | 23 +- class/Files/User/UserIndex.php | 63 ++- class/Files/User/UserListTag.php | 7 +- class/Files/User/UserNotificationUpdate.php | 7 +- class/Files/User/UserPages.php | 22 +- class/Files/User/UserPdf.php | 13 +- class/Files/User/UserPrint.php | 7 +- class/Files/User/UserRate.php | 7 +- class/Files/User/UserRss.php | 161 ++++---- class/Files/User/UserSearch.php | 5 +- class/Files/User/UserViewTag.php | 7 +- class/Files/User/UserXoopsCode.php | 43 +- class/Files/User/UserXoopsVersion.php | 24 +- class/Files/User/index.php | 4 +- class/Files/admin/AdminAbout.php | 5 +- class/Files/admin/AdminFooter.php | 7 +- class/Files/admin/AdminPages.php | 42 +- class/Files/admin/AdminXoopsCode.php | 17 +- class/Files/index.php | 2 +- class/Form/FormRadio.php | 7 +- class/Form/FormRaw.php | 4 +- class/Form/FormTab.php | 5 +- class/Form/FormTabTray.php | 4 +- class/Form/SimpleForm.php | 5 +- class/Form/ThemeForm.php | 3 +- class/Form/index.php | 4 +- class/Helper.php | 7 +- class/Html/FormLabel.php | 5 +- class/Html/index.php | 4 +- class/Import.php | 53 +-- class/Logo.php | 5 +- class/LogoGenerator.php | 10 +- class/Modules.php | 15 +- class/ModulesHandler.php | 5 +- class/Morefiles.php | 21 +- class/MorefilesHandler.php | 5 +- class/Session.php | 13 +- class/Settings.php | 7 +- class/SettingsHandler.php | 3 +- class/SplClassLoader.php | 24 +- class/Tables.php | 9 +- class/TablesHandler.php | 5 +- class/Utility.php | 6 +- class/autoload.php | 7 +- class/index.php | 2 +- config/config.php | 7 +- config/icons.php | 2 +- config/index.php | 4 +- config/paths.php | 2 +- docs/index.php | 4 +- files/commonfiles/.scrutinizer.yml | 3 - files/commonfiles/admin/clone.php | 17 +- files/commonfiles/admin/feedback.php | 6 +- files/commonfiles/class/Common/Breadcrumb.php | 6 +- .../commonfiles/class/Common/Configurator.php | 6 +- files/commonfiles/class/Common/Confirm.php | 6 +- .../class/Common/DirectoryChecker.php | 7 +- .../commonfiles/class/Common/FileChecker.php | 4 +- .../class/Common/FilesManagement.php | 18 +- files/commonfiles/class/Common/Migrate.php | 13 +- .../class/Common/ModuleFeedback.php | 8 +- .../commonfiles/class/Common/ModuleStats.php | 6 +- files/commonfiles/class/Common/Resizer.php | 7 +- .../commonfiles/class/Common/ServerStats.php | 4 +- files/commonfiles/class/Common/SysUtility.php | 8 +- .../class/Common/VersionChecks.php | 4 +- files/commonfiles/class/Helper.php | 5 +- files/commonfiles/class/Utility.php | 5 +- files/commonfiles/include/install.php | 5 +- files/commonfiles/include/uninstall.php | 5 +- files/commonfiles/include/update.php | 14 +- .../commonfiles/include/xoops_version.inc.php | 6 +- files/commonfiles/language/english/common.php | 5 +- .../commonfiles/language/english/feedback.php | 5 +- files/commonfiles/preloads/autoloader.php | 8 +- files/commonfiles/preloads/core.php | 4 +- files/commonfiles/testdata/index.php | 33 +- files/ratingfiles/assets/css/rating.css | 2 +- files/ratingfiles/class/Ratings.php | 5 +- files/ratingfiles/class/RatingsHandler.php | 5 +- include/common.php | 8 +- include/functions.php | 5 +- include/index.php | 4 +- include/install.php | 7 +- include/update.php | 111 +++-- index.php | 2 +- language/english/admin.php | 90 ++-- language/english/common.php | 8 +- language/english/directorychecker.php | 2 +- language/english/feedback.php | 6 +- language/english/filechecker.php | 2 +- language/english/help/help.html | 36 +- language/english/help/index.php | 4 +- language/english/index.php | 4 +- language/english/mail_template/index.php | 4 +- language/english/modinfo.php | 6 +- language/index.php | 4 +- preloads/autoloader.php | 8 +- preloads/core.php | 4 +- preloads/index.php | 4 +- sql/index.php | 4 +- templates/admin/index.php | 4 +- templates/admin/modulebuilder_building.tpl | 18 +- templates/admin/modulebuilder_devtools.tpl | 6 +- templates/admin/modulebuilder_fields.tpl | 32 +- templates/admin/modulebuilder_fields_item.tpl | 44 +- templates/admin/modulebuilder_footer.tpl | 4 +- templates/admin/modulebuilder_modules.tpl | 40 +- templates/admin/modulebuilder_morefiles.tpl | 8 +- templates/admin/modulebuilder_settings.tpl | 16 +- templates/admin/modulebuilder_tables.tpl | 46 +-- templates/admin/modulebuilder_tables_item.tpl | 42 +- templates/index.php | 4 +- testdata/english/index.php | 4 +- testdata/images/index.php | 2 +- testdata/images/modules/index.php | 2 +- testdata/images/repository/index.php | 2 +- testdata/images/tables/index.php | 2 +- testdata/index.php | 30 +- xoops_version.php | 11 +- 271 files changed, 2364 insertions(+), 2592 deletions(-) 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 @@ - Date: Wed, 2 Feb 2022 19:17:42 +0100 Subject: [PATCH 220/266] fix bug in type cast --- class/Form/FormRadio.php | 2 +- docs/changelog.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/class/Form/FormRadio.php b/class/Form/FormRadio.php index abed3144..79b73d2a 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -49,7 +49,7 @@ public function render() } $ret .= ''; } - $ret .= '3.5.1 Beta 1 [NOT RELEASED] Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From cad2069e1d02ef0125ade2169252cdbe083328ef Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 3 Feb 2022 14:38:44 +0100 Subject: [PATCH 221/266] type cast --- class/Building.php | 12 ++++++++++++ class/Files/CreateFile.php | 12 +++++++----- class/Form/FormRadio.php | 12 +++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/class/Building.php b/class/Building.php index c66c90bd..1fbd8a57 100644 --- a/class/Building.php +++ b/class/Building.php @@ -100,6 +100,18 @@ public function clearDir($dir, $pattern = '*'): void \unlink($file); } } + $file = $dir . '/.gitignore'; + if (is_file($file)) { + \unlink($file); + } + $file = $dir . '/.gitattributes'; + if (is_file($file)) { + \unlink($file); + } + $file = $dir . '/.scrutinizer.yml'; + if (is_file($file)) { + \unlink($file); + } if (\is_dir($dir)) { \rmdir($dir); } diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index c0b8a4a8..7bf8e2e2 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -340,12 +340,14 @@ public function getLeftString($string) */ public function getRightString($string = null) { - if (\mb_strpos($string, '_')) { - $str = \mb_strpos($string, '_'); - if (false !== $str) { - $ret = \mb_substr($string, $str + 1, \mb_strlen($string)); + if ('' != \trim($string)) { + if (\mb_strpos($string, '_')) { + $str = \mb_strpos($string, '_'); + if (false !== $str) { + $ret = \mb_substr($string, $str + 1, \mb_strlen($string)); - return $ret; + return $ret; + } } } diff --git a/class/Form/FormRadio.php b/class/Form/FormRadio.php index 79b73d2a..23bef86c 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -31,8 +31,8 @@ public function render() { $ret = ''; $ele_name = $this->getName(); - $ele_title = $this->getTitle(); - $ele_value = $this->getValue(); + $ele_title = (string)$this->getTitle(); + $ele_value = (string)$this->getValue(); $ele_options = $this->getOptions(); $ele_extra = $this->getExtra(); $ele_delimeter = empty($this->columns) ? $this->getDelimeter() : ''; @@ -41,6 +41,12 @@ public function render() } $i = 0; $id_ele = 0; + if ('' != $ele_title) { + $ele_title = htmlspecialchars($ele_title, ENT_QUOTES); + } + if ('' != $ele_value) { + $ele_value = htmlspecialchars($ele_value, ENT_QUOTES); + } foreach ($ele_options as $value => $name) { ++$id_ele; if (!empty($this->columns)) { @@ -49,7 +55,7 @@ public function render() } $ret .= ''; } - $ret .= ' Date: Thu, 3 Feb 2022 17:20:29 +0100 Subject: [PATCH 222/266] fixed problems with empy strings --- class/Files/CreateArchitecture.php | 4 ++++ class/Files/CreateFile.php | 32 ++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index dec24346..80ee51ce 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -160,6 +160,10 @@ public function setBaseFoldersFiles($module): void \copy($copyFile, $copyNewFile); } else { // Copy file + if (!\file_exists($logoPng)) { + $logoPng = 'tdmxoops_logo.png'; + $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH . '/' . $logoPng; + } $copyFile = TDMC_IMAGES_LOGOS_URL . '/' . $logoPng; $copyNewFile = $logoGifFrom; \copy($copyFile, $copyNewFile); diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 7bf8e2e2..57a40daf 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -329,7 +329,11 @@ public function getLanguage($moduleDirname, $prefix = '', $suffix = '', $addFq = */ public function getLeftString($string) { - return \mb_substr($string, 0, (int)\mb_strpos($string, '_')); + $ret = ''; + if ('' != $string) { + $ret .= \mb_substr($string, 0, (int)\mb_strpos($string, '_')); + } + return $ret; } /** @@ -340,7 +344,7 @@ public function getLeftString($string) */ public function getRightString($string = null) { - if ('' != \trim($string)) { + if ('' != $string) { if (\mb_strpos($string, '_')) { $str = \mb_strpos($string, '_'); if (false !== $str) { @@ -384,7 +388,11 @@ public function getCamelCase($string, $ucfirst = false, $lcfirst = false) */ public function getUcfirst($string) { - return \ucfirst($string); + $ret = ''; + if ('' != $string) { + $ret .= \ucfirst($string); + } + return $ret; } /** @@ -395,7 +403,11 @@ public function getUcfirst($string) */ public function getLcfirst($string) { - return \lcfirst($string); + $ret = ''; + if ('' != $string) { + $ret .= \lcfirst($string); + } + return $ret; } /** @@ -406,7 +418,11 @@ public function getLcfirst($string) */ public function getStrToUpper($string) { - return \mb_strtoupper($string); + $ret = ''; + if ('' != $string) { + $ret .= \mb_strtoupper($string); + } + return $ret; } /** @@ -417,7 +433,11 @@ public function getStrToUpper($string) */ public function getStrToLower($string) { - return \mb_strtolower($string); + $ret = ''; + if ('' != $string) { + $ret .= \mb_strtolower($string); + } + return $ret; } /** From a57d6b1ca8c77e6a6144e46429026b2fb9711ea3 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Fri, 4 Feb 2022 15:50:41 +0100 Subject: [PATCH 223/266] fixed bug in LogoGenerator --- class/LogoGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/LogoGenerator.php b/class/LogoGenerator.php index fabc0f0e..10974a58 100644 --- a/class/LogoGenerator.php +++ b/class/LogoGenerator.php @@ -85,7 +85,7 @@ public static function createLogo($logoIcon, $moduleName) // Write text $textColor = imagecolorallocate($imageModule, 0, 0, 0); - $spaceToBorder = (92 - mb_strlen($moduleName) * 7.5) / 2; + $spaceToBorder = (int)\floor((92 - mb_strlen($moduleName) * 7.5) / 2); imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, $moduleName, []); imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32); From a5ff56f70e800d677e708f5f016da1edb8413382 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 18 Mar 2022 17:15:35 -0400 Subject: [PATCH 224/266] updates --- class/Common/TestdataButtons.php | 22 ++++++++++++++-------- preloads/index.html | 1 + preloads/index.php | 2 -- xoops_version.php | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 preloads/index.html delete mode 100644 preloads/index.php diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index a8db9c77..75f63d36 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -30,21 +30,27 @@ */ class TestdataButtons { - //functions for import buttons + /** Button status constants */ + private const SHOW_BUTTONS = 1; + private const HIDE_BUTTONS = 0; + /** + * Load the test button configuration + * * @param \Xmf\Module\Admin $adminObject + * * @return void */ - public static function loadButtonConfig(\Xmf\Module\Admin $adminObject) + public static function loadButtonConfig($adminObject): void { - $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']; + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); + $yamlFile = $helper->path('/config/admin.yml'); + $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + $displaySampleButton = $config['displaySampleButton']; - if (1 == $displaySampleButton) { + if (self::SHOW_BUTTONS == $displaySampleButton) { \xoops_loadLanguage('admin/modulesadmin', 'system'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); diff --git a/preloads/index.html b/preloads/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/preloads/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/preloads/index.php b/preloads/index.php deleted file mode 100644 index e5ee0725..00000000 --- a/preloads/index.php +++ /dev/null @@ -1,2 +0,0 @@ - '5.5']; From e543aae01f2f04ee99b0931f5b58f2908c2c9396 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 23 Mar 2022 10:51:52 +0100 Subject: [PATCH 225/266] removed unnecessary sprintf --- class/Files/Classes/ClassFiles.php | 2 +- docs/changelog.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 43bfd0a1..d3012bb0 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -306,7 +306,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field $getForm .= $this->pc->getPhpCodeTernaryOperator('permissionUpload', $checkRight, 'true', 'false', "\t\t"); } $getForm .= $this->pc->getPhpCodeCommentLine('Title', '', "\t\t"); - $getForm .= $this->pc->getPhpCodeTernaryOperator('title', '$this->isNew()', "\sprintf({$language}{$stuTableSoleName}_ADD)", "\sprintf({$language}{$stuTableSoleName}_EDIT)", "\t\t"); + $getForm .= $this->pc->getPhpCodeTernaryOperator('title', '$this->isNew()', "{$language}{$stuTableSoleName}_ADD", "{$language}{$stuTableSoleName}_EDIT", "\t\t"); $getForm .= $this->pc->getPhpCodeCommentLine('Get Theme', 'Form', "\t\t"); $getForm .= $this->xc->getXcXoopsLoad('XoopsFormLoader', "\t\t"); $getForm .= $this->cxc->getClassXoopsThemeForm('form', 'title', 'form', 'action', 'post'); diff --git a/docs/changelog.txt b/docs/changelog.txt index f0ee6b0d..fce34847 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -20,6 +20,7 @@ - uninstall with bak-file creation (mamba/goffy) - module update to php8 (mamba) - fix bug in type cast (liomj/goffy) +- removed unnecessary sprintf (goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From b4ae5ca6792fe00d4dcd8b7203da9c7918c1a604 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 23 Mar 2022 11:11:46 +0100 Subject: [PATCH 226/266] replace ternary expression by condition --- class/Files/Classes/ClassFiles.php | 2 ++ docs/changelog.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index d3012bb0..0bf276a0 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -297,6 +297,8 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); $getForm .= $this->pc->getPhpCodeTernaryOperator('isAdmin', '\is_object(' . $xUser . ')', $xUser . '->isAdmin(' . $xModule . '->mid())', 'false', "\t\t"); + $getForm .= $this->xc->getXcEqualsOperator('$isAdmin', "\is_object(\$GLOBALS['xoopsUser']) && \$GLOBALS['xoopsUser']->isAdmin(\$GLOBALS['xoopsModule']->mid())", null, "\t\t"); + if ($fieldUpload) { $permString = 'upload_groups'; $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); diff --git a/docs/changelog.txt b/docs/changelog.txt index fce34847..1332e4cf 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -21,6 +21,7 @@ - module update to php8 (mamba) - fix bug in type cast (liomj/goffy) - removed unnecessary sprintf (goffy) +- replace ternary expression by condition (goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From 6d54d45dd09182ce3b1102a9e5af610d30538b15 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 23 Mar 2022 11:43:03 +0100 Subject: [PATCH 227/266] using same param name during inheritance --- class/Files/Classes/ClassHandlerFiles.php | 6 +++--- docs/changelog.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 6137f32a..23c9d747 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -147,10 +147,10 @@ private function getClassCreate() */ private function getClassGet() { - $ret = $this->pc->getPhpCodeCommentMultiLine(['retrieve a' => 'field', '' => '', '@param int' => '$i field id', '@param null' => 'fields', '@return \XoopsObject|null reference to the' => '{@link Get} object'], "\t"); - $cClhg = $this->getSimpleString('return parent::get($i, $fields);', "\t\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['retrieve a' => 'field', '' => '', '@param int' => '$id field id', '@param null' => 'fields', '@return \XoopsObject|null reference to the' => '{@link Get} object'], "\t"); + $cClhg = $this->getSimpleString('return parent::get($id, $fields);', "\t\t"); - $ret .= $this->pc->getPhpCodeFunction('get', '$i = null, $fields = null', $cClhg, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('get', '$id = null, $fields = null', $cClhg, 'public ', false, "\t"); return $ret; } diff --git a/docs/changelog.txt b/docs/changelog.txt index 1332e4cf..5ee9df5b 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -22,6 +22,7 @@ - fix bug in type cast (liomj/goffy) - removed unnecessary sprintf (goffy) - replace ternary expression by condition (goffy) +- using same param name during inheritance (goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) From 32dae10400f6aecad460ddc4add7ae3b9170805b Mon Sep 17 00:00:00 2001 From: ggoffy Date: Fri, 8 Apr 2022 07:34:54 +0200 Subject: [PATCH 228/266] proper language load --- class/Files/Admin/AdminHeader.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/class/Files/Admin/AdminHeader.php b/class/Files/Admin/AdminHeader.php index aff091c5..ca6628db 100644 --- a/class/Files/Admin/AdminHeader.php +++ b/class/Files/Admin/AdminHeader.php @@ -124,8 +124,9 @@ private function getAdminHeader($moduleDirname) $ret .= $this->pc->getPhpCodeConditions('!isset($xoopsTpl)', ' || ', '!\is_object($xoopsTpl)', $template, false); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Load languages'); - $ret .= $this->xc->getXcXoopsLoadLanguage('admin'); - $ret .= $this->xc->getXcXoopsLoadLanguage('modinfo'); + $ret .= $this->xc->getXcXoopsLoadLanguage('admin', '', $moduleDirname); + $ret .= $this->xc->getXcXoopsLoadLanguage('modinfo', '', $moduleDirname); + $ret .= $this->pc->getPhpCodeCommentLine($this->xc->getXcXoopsLoadLanguage('main', '', $moduleDirname)); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Local admin menu class'); $xoopsPathCond = $this->xc->getXcXoopsPath('$pathModuleAdmin', 'moduleadmin', true); From c0ad3641c3ac5d079ebc5ee10a909136c6599e71 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 1 Oct 2022 17:57:45 +0200 Subject: [PATCH 229/266] fixed bug in update function --- docs/changelog.txt | 1 + files/commonfiles/include/update.php | 59 ++------------------- sql/mysql.sql | 76 ++++++++++++++-------------- 3 files changed, 42 insertions(+), 94 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 5ee9df5b..ced8e335 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -23,6 +23,7 @@ - removed unnecessary sprintf (goffy) - replace ternary expression by condition (goffy) - using same param name during inheritance (goffy) +- fixed bug in update function (liomj/goffy)
    3.5.1 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - semantic versioning (mamba) diff --git a/files/commonfiles/include/update.php b/files/commonfiles/include/update.php index 5a63ebd2..3abf56e2 100644 --- a/files/commonfiles/include/update.php +++ b/files/commonfiles/include/update.php @@ -31,10 +31,11 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) { $ret = null; + /* if ($prev_version < 10) { - $ret = update_modulebuilder_v10($module); + //enter code or call your function } - + */ $ret = modulebuilder_check_db($module); //check upload directory @@ -49,60 +50,6 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) return $ret; } -// irmtfan bug fix: solve templates duplicate issue -/** - * @param $module - * - * @return bool - */ -function update_modulebuilder_v10($module) -{ - global $xoopsDB; - $result = $xoopsDB->query( - '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 ([$tplid] = $xoopsDB->fetchRow($result)) { - $tplids[] = $tplid; - } - if (\count($tplids) > 0) { - $tplfileHandler = \xoops_getHandler('tplfile'); - $duplicate_files = $tplfileHandler->getObjects(new \Criteria('tpl_id', '(' . \implode(',', $tplids) . ')', 'IN')); - - if (\count($duplicate_files) > 0) { - foreach (\array_keys($duplicate_files) as $i) { - $tplfileHandler->delete($duplicate_files[$i]); - } - } - } - $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); - - return false; - } - $ret = []; - while (false !== ($myrow = $xoopsDB->fetchArray($result))) { - $ret[] = $myrow; - } - if (!empty($ret)) { - $module->setErrors("'tpl_refid_module_set_file_type' unique index is exist. Note: check 'tplfile' table to be sure this index is UNIQUE because XOOPS CORE need it."); - - return true; - } - $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); - $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."); - - return false; - } - - return true; -} - -// irmtfan bug fix: solve templates duplicate issue - /** * @param $module * diff --git a/sql/mysql.sql b/sql/mysql.sql index 6a9f266f..75b32145 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -13,34 +13,34 @@ CREATE TABLE `modulebuilder_settings` ( `set_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, - `set_name` VARCHAR(255) NOT NULL DEFAULT 'My Module', - `set_dirname` VARCHAR(100) NOT NULL DEFAULT 'mymoduledirname', - `set_version` VARCHAR(10) NOT NULL DEFAULT '1.0.0', - `set_since` VARCHAR(5) NOT NULL DEFAULT '1.0.0', - `set_min_php` VARCHAR(5) NOT NULL DEFAULT '7.0', - `set_min_xoops` VARCHAR(15) NOT NULL DEFAULT '2.5.10', - `set_min_admin` VARCHAR(8) NOT NULL DEFAULT '1.2', - `set_min_mysql` VARCHAR(8) NOT NULL DEFAULT '5.5', - `set_description` VARCHAR(255) NOT NULL DEFAULT 'This module is for doing following...', - `set_author` VARCHAR(255) NOT NULL DEFAULT 'TDM XOOPS', - `set_author_mail` VARCHAR(255) NOT NULL DEFAULT 'info@email.com', - `set_author_website_url` VARCHAR(255) NOT NULL DEFAULT 'http://xoops.org', - `set_author_website_name` VARCHAR(255) NOT NULL DEFAULT 'XOOPS Project', - `set_credits` VARCHAR(255) NOT NULL DEFAULT 'XOOPS Development Team', - `set_license` VARCHAR(255) NOT NULL DEFAULT 'GPL 2.0 or later', - `set_release_info` VARCHAR(255) NOT NULL DEFAULT 'release_info', - `set_release_file` VARCHAR(255) NOT NULL DEFAULT 'release_info file', - `set_manual` VARCHAR(255) NOT NULL DEFAULT 'link to manual file', - `set_manual_file` VARCHAR(255) NOT NULL DEFAULT 'install.txt', - `set_image` VARCHAR(255) NOT NULL DEFAULT 'empty.png', - `set_demo_site_url` VARCHAR(255) NOT NULL DEFAULT 'https://xoops.org', - `set_demo_site_name` VARCHAR(255) NOT NULL DEFAULT 'XOOPS Demo Site', - `set_support_url` VARCHAR(255) NOT NULL DEFAULT 'http://xoops.org/modules/newbb', - `set_support_name` VARCHAR(255) NOT NULL DEFAULT 'Support Forum', - `set_website_url` VARCHAR(255) NOT NULL DEFAULT 'www.xoops.org', - `set_website_name` VARCHAR(255) NOT NULL DEFAULT 'XOOPS Project', - `set_release` VARCHAR(11) NOT NULL DEFAULT '2015-05-02', - `set_status` VARCHAR(150) NOT NULL DEFAULT 'Beta 1', + `set_name` VARCHAR(255) NOT NULL DEFAULT '', + `set_dirname` VARCHAR(100) NOT NULL DEFAULT '', + `set_version` VARCHAR(15) NOT NULL DEFAULT '', + `set_since` VARCHAR(15) NOT NULL DEFAULT '', + `set_min_php` VARCHAR(15) NOT NULL DEFAULT '', + `set_min_xoops` VARCHAR(15) NOT NULL DEFAULT '', + `set_min_admin` VARCHAR(15) NOT NULL DEFAULT '', + `set_min_mysql` VARCHAR(15) NOT NULL DEFAULT '', + `set_description` VARCHAR(255) NOT NULL DEFAULT '', + `set_author` VARCHAR(255) NOT NULL DEFAULT '', + `set_author_mail` VARCHAR(255) NOT NULL DEFAULT '', + `set_author_website_url` VARCHAR(255) NOT NULL DEFAULT '', + `set_author_website_name` VARCHAR(255) NOT NULL DEFAULT '', + `set_credits` VARCHAR(255) NOT NULL DEFAULT '', + `set_license` VARCHAR(255) NOT NULL DEFAULT '', + `set_release_info` VARCHAR(255) NOT NULL DEFAULT '', + `set_release_file` VARCHAR(255) NOT NULL DEFAULT '', + `set_manual` VARCHAR(255) NOT NULL DEFAULT '', + `set_manual_file` VARCHAR(255) NOT NULL DEFAULT '', + `set_image` VARCHAR(255) NOT NULL DEFAULT '', + `set_demo_site_url` VARCHAR(255) NOT NULL DEFAULT '', + `set_demo_site_name` VARCHAR(255) NOT NULL DEFAULT '', + `set_support_url` VARCHAR(255) NOT NULL DEFAULT '', + `set_support_name` VARCHAR(255) NOT NULL DEFAULT '', + `set_website_url` VARCHAR(255) NOT NULL DEFAULT '', + `set_website_name` VARCHAR(255) NOT NULL DEFAULT '', + `set_release` VARCHAR(11) NOT NULL DEFAULT '', + `set_status` VARCHAR(150) NOT NULL DEFAULT '', `set_admin` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', `set_user` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', `set_blocks` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', @@ -49,8 +49,8 @@ CREATE TABLE `modulebuilder_settings` ( `set_notifications` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', `set_permissions` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', `set_inroot_copy` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', - `set_donations` VARCHAR(50) NOT NULL DEFAULT '6KJ7RW5DR3VTJ', - `set_subversion` VARCHAR(10) NOT NULL DEFAULT '13070', + `set_donations` VARCHAR(50) NOT NULL DEFAULT '', + `set_subversion` VARCHAR(10) NOT NULL DEFAULT '', `set_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', PRIMARY KEY (`set_id`) ) @@ -60,7 +60,7 @@ CREATE TABLE `modulebuilder_settings` ( INSERT INTO `modulebuilder_settings` (`set_id`, `set_name`, `set_dirname`, `set_version`, `set_since`, `set_min_php`, `set_min_xoops`, `set_min_admin`, `set_min_mysql`, `set_description`, `set_author`, `set_author_mail`, `set_author_website_url`, `set_author_website_name`, `set_credits`, `set_license`, `set_release_info`, `set_release_file`, `set_manual`, `set_manual_file`, `set_image`, `set_demo_site_url`, `set_demo_site_name`, `set_support_url`, `set_support_name`, `set_website_url`, `set_website_name`, `set_release`, `set_status`, `set_admin`, `set_user`, `set_blocks`, `set_search`, `set_comments`, `set_notifications`, `set_permissions`, `set_inroot_copy`, `set_donations`, `set_subversion`, `set_type`) VALUES - (1, 'My Module', 'mymoduledirname', '1.0.0', '1.0.0', '7.0', '2.5.10', '1.2', '5.6', 'This module is for doing following...', 'TDM XOOPS', 'info@email.com', 'http://xoops.org', 'XOOPS Project', 'XOOPS Development Team', 'GPL 2.0 or later', 'release_info', 'release_info file', 'link to manual file', + (1, 'My Module', 'mymoduledirname', '1.0.0', '1.0.0', '7.0', '2.5.10', '1.2', '5.6', 'This module is for doing following...', 'TDM XOOPS', 'info@email.com', 'https://xoops.org', 'XOOPS Project', 'XOOPS Development Team', 'GPL 2.0 or later', 'release_info', 'release_info file', 'link to manual file', 'install.txt', 'empty.png', 'https://xoops.org', 'XOOPS Demo Site', 'https://xoops.org/modules/newbb', 'Support Forum', 'www.xoops.org', 'XOOPS Project', '2017-12-02', 'Beta 1', '1', '1', '1', '0', '0', '0', '0', '0', '6KJ7RW5DR3VTJ', '13070', 1); @@ -72,12 +72,12 @@ CREATE TABLE `modulebuilder_modules` ( `mod_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, `mod_name` VARCHAR(200) NOT NULL DEFAULT '', `mod_dirname` VARCHAR(100) NOT NULL DEFAULT '', - `mod_version` VARCHAR(10) NOT NULL DEFAULT '1.0.0', - `mod_since` VARCHAR(10) NOT NULL DEFAULT '1.0.0', - `mod_min_php` VARCHAR(4) NOT NULL DEFAULT '5.5', + `mod_version` VARCHAR(15) NOT NULL DEFAULT '1.0.0', + `mod_since` VARCHAR(15) NOT NULL DEFAULT '1.0.0', + `mod_min_php` VARCHAR(15) NOT NULL DEFAULT '5.5', `mod_min_xoops` VARCHAR(15) NOT NULL DEFAULT '2.5.11', - `mod_min_admin` VARCHAR(4) NOT NULL DEFAULT '1.2', - `mod_min_mysql` VARCHAR(6) NOT NULL DEFAULT '5.5', + `mod_min_admin` VARCHAR(15) NOT NULL DEFAULT '1.2', + `mod_min_mysql` VARCHAR(15) NOT NULL DEFAULT '5.5', `mod_description` TEXT, `mod_author` VARCHAR(200) NOT NULL DEFAULT 'TDM XOOPS', `mod_author_mail` VARCHAR(200) NOT NULL DEFAULT 'info@email.com', @@ -106,8 +106,8 @@ CREATE TABLE `modulebuilder_modules` ( `mod_notifications` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', `mod_permissions` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', `mod_inroot_copy` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', - `mod_donations` VARCHAR(50) NOT NULL DEFAULT '6KJ7RW5DR3VTJ', - `mod_subversion` VARCHAR(10) NOT NULL DEFAULT '12550', + `mod_donations` VARCHAR(50) NOT NULL DEFAULT '', + `mod_subversion` VARCHAR(10) NOT NULL DEFAULT '', PRIMARY KEY (`mod_id`), KEY `mod_name` (`mod_name`), UNIQUE KEY `mod_dirname` (`mod_dirname`) From 2800aad0d93a107ae3accf55f7af768f428fe9db Mon Sep 17 00:00:00 2001 From: ggoffy Date: Tue, 28 Feb 2023 20:08:03 +0100 Subject: [PATCH 230/266] moved to last stable with smarty 2 --- docs/changelog.txt | 3 +++ xoops_version.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index ced8e335..8685cfe2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,6 @@ +
    3.6.0 Stable [2023-02-28]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 + - moved to last stable with smarty 2 (goffy) +
    3.6.0 Beta 1 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - added import of existing modules (for their redesign) (mamba) - increased size of the "mod_version" field in modulebuilder_modules table from 4 to 10 (mamba) diff --git a/xoops_version.php b/xoops_version.php index b7f581a9..535a64d2 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -26,8 +26,8 @@ $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $modversion['version'] = '3.6.0'; -$modversion['module_status'] = 'Beta 1 NOT RELEASED'; -$modversion['release_date'] = '2021/11/04'; +$modversion['module_status'] = 'Stable'; +$modversion['release_date'] = '2023/02/28'; // format: yyyy/mm/dd $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; From a3259d702d27715f04cc40f000427200c25c0468 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 6 Jul 2023 12:54:30 +0200 Subject: [PATCH 231/266] implemented smarty3 --- class/Common/TestdataButtons.php | 22 ++++++++++++------- class/Files/CreateHtmlCode.php | 7 +++++- class/Files/CreateSmartyCode.php | 12 +++------- class/Files/Language/LanguageHelp.php | 2 +- .../Templates/Admin/TemplatesAdminAbout.php | 4 ++-- .../Templates/Admin/TemplatesAdminBroken.php | 8 +++---- .../Templates/Admin/TemplatesAdminFooter.php | 2 +- .../Templates/Admin/TemplatesAdminIndex.php | 4 ++-- .../Templates/Admin/TemplatesAdminPages.php | 8 +++---- .../Admin/TemplatesAdminPermissions.php | 2 +- .../Templates/User/Defstyle/Breadcrumbs.php | 2 +- .../Files/Templates/User/Defstyle/Footer.php | 6 ++--- .../Files/Templates/User/Defstyle/Header.php | 2 +- class/Files/Templates/User/Defstyle/Index.php | 2 +- class/Files/Templates/User/Defstyle/Pages.php | 4 ++-- .../Templates/User/Defstyle/PagesItem.php | 2 +- .../Templates/User/Defstyle/UserPrint.php | 2 +- docs/changelog.txt | 3 +++ language/english/help/help.html | 2 +- preloads/index.html | 1 + preloads/index.php | 2 -- templates/admin/modulebuilder_about.tpl | 4 ++-- templates/admin/modulebuilder_building.tpl | 14 ++++++------ templates/admin/modulebuilder_devtools.tpl | 4 ++-- templates/admin/modulebuilder_fields.tpl | 12 +++++----- templates/admin/modulebuilder_footer.tpl | 2 +- templates/admin/modulebuilder_header.tpl | 4 ++-- templates/admin/modulebuilder_index.tpl | 4 ++-- templates/admin/modulebuilder_modules.tpl | 12 +++++----- templates/admin/modulebuilder_morefiles.tpl | 8 +++---- templates/admin/modulebuilder_settings.tpl | 8 +++---- templates/admin/modulebuilder_tables.tpl | 14 ++++++------ templates/admin/modulebuilder_tables_item.tpl | 4 ++-- xoops_version.php | 12 +++++----- 34 files changed, 104 insertions(+), 97 deletions(-) create mode 100644 preloads/index.html delete mode 100644 preloads/index.php diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index a8db9c77..75f63d36 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -30,21 +30,27 @@ */ class TestdataButtons { - //functions for import buttons + /** Button status constants */ + private const SHOW_BUTTONS = 1; + private const HIDE_BUTTONS = 0; + /** + * Load the test button configuration + * * @param \Xmf\Module\Admin $adminObject + * * @return void */ - public static function loadButtonConfig(\Xmf\Module\Admin $adminObject) + public static function loadButtonConfig($adminObject): void { - $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']; + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); + $yamlFile = $helper->path('/config/admin.yml'); + $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + $displaySampleButton = $config['displaySampleButton']; - if (1 == $displaySampleButton) { + if (self::SHOW_BUTTONS == $displaySampleButton) { \xoops_loadLanguage('admin/modulesadmin', 'system'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index d208954a..f867c06a 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -370,7 +370,12 @@ public function getHtmlAnchor($url = '#', $content = ' ', $title = '', $tar public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '', $t = '', $n = '') { $rImgClass = ('' != $imgClass) ? " class='{$imgClass}'" : ''; - $ret = "{$t}{$n}"; + if (strpos($src,"'")) { + // function getSmartyNoSimbol is used before + $ret = "{$t}{$n}"; + } else { + $ret = "{$t}{$n}"; + } return $ret; } diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index ecdc9e43..fe49324b 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -177,24 +177,18 @@ public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '') * @param $moduleDirname * @param string $fileName * @param bool $admin - * - * @param bool $q * @param string $t * @param string $n * @param string $attributes * @return string */ - public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $q = false, $t = '', $n = "\n", $attributes = '') + public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $t = '', $n = "\n", $attributes = '') { $ret = ''; - if (!$admin && !$q) { + if (!$admin) { $ret = "{$t}<{include file='db:{$moduleDirname}_{$fileName}.tpl' {$attributes}}>{$n}"; - } elseif ($admin && !$q) { + } else { $ret = "{$t}<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl' {$attributes}}>{$n}"; - } elseif (!$admin && $q) { - $ret = "{$t}<{includeq file='db:{$moduleDirname}_{$fileName}.tpl' {$attributes}}>{$n}"; - } elseif ($admin && $q) { - $ret = "{$t}<{includeq file='db:{$moduleDirname}_admin_{$fileName}.tpl' {$attributes}}>{$n}"; } return $ret; diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 53528d03..83f6a551 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -88,7 +88,7 @@ public function render()

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

    diff --git a/class/Files/Templates/Admin/TemplatesAdminAbout.php b/class/Files/Templates/Admin/TemplatesAdminAbout.php index 16a5326a..b64abd21 100644 --- a/class/Files/Templates/Admin/TemplatesAdminAbout.php +++ b/class/Files/Templates/Admin/TemplatesAdminAbout.php @@ -87,12 +87,12 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $content = $this->hc->getHtmlComment('Header', '', "\n"); - $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, true) . PHP_EOL; + $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true) . PHP_EOL; $content .= $this->hc->getHtmlComment('About Page', '', "\n"); $single = $this->sc->getSmartySingleVar('about'); $content .= $this->hc->getHtmlTag('div', ['class' => 'top'], $single) . PHP_EOL; $content .= $this->hc->getHtmlComment('Footer', '', "\n"); - $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); + $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); $this->create($moduleDirname, 'templates/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index 3d7156f6..fae01126 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -87,7 +87,7 @@ public function write($module, $tables, $filename): void private function getTemplatesAdminBrokenHeader($moduleDirname) { $ret = $this->hc->getHtmlComment('Header', '', "\n"); - $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); return $ret; } @@ -132,11 +132,11 @@ private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $ $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'main'); $td .= $this->hc->getHtmlTableData($double, 'center', '', $t . "\t\t"); $lang = $this->sc->getSmartyConst('', '_EDIT'); - $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 edit.png'); + $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'edit.png'"); $img = $this->hc->getHtmlImage($src, $tableName); $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', $t . "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_DELETE'); - $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 delete.png'); + $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'delete.png'"); $img = $this->hc->getHtmlImage($src, $tableName); $anchor .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', $t . "\t\t\t", "\n"); $td .= $this->hc->getHtmlTableData($anchor, 'center width5', '', $t . "\t\t", "\n", true); @@ -185,7 +185,7 @@ private function getTemplatesAdminBrokenList($table, $language, $t = '') $div .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false); $htmlTable .= $this->sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', $t); $noData = $this->sc->getSmartySingleVar('nodata' . $ucfTableName, $t . "\t\t"); - $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32 button_ok.png'); + $src = $this->sc->getSmartyNoSimbol("xoModuleIcons32 'button_ok.png'"); $noData .= $this->hc->getHtmlImage($src, $tableName, '', '', "\n"); $div = $this->hc->getHtmlDiv($noData, '', $t . "\t", "\n", true); $div .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false); diff --git a/class/Files/Templates/Admin/TemplatesAdminFooter.php b/class/Files/Templates/Admin/TemplatesAdminFooter.php index c6db7d4d..e11b3cd0 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -89,7 +89,7 @@ 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'); + $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); diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index 97542018..88019bb5 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -88,12 +88,12 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->hc->getHtmlComment('Header', '', "\n"); - $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, true) . PHP_EOL; + $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true) . PHP_EOL; $content .= $this->hc->getHtmlComment('Index Page', '', "\n"); $single = $this->sc->getSmartySingleVar('index'); $content .= $this->hc->getHtmlTag('div', ['class' => 'top'], $single) . PHP_EOL; $content .= $this->hc->getHtmlComment('Footer', '', "\n"); - $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); + $content .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); $this->create($moduleDirname, 'templates/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 5ef9fe4f..bba26604 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -90,7 +90,7 @@ public function write($module, $table, $filename): void private function getTemplatesAdminPagesHeader($moduleDirname) { $ret = $this->hc->getHtmlComment('Header', '',"\n"); - $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); return $ret; } @@ -205,17 +205,17 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t } $lang = $this->sc->getSmartyConst('', '_EDIT'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 edit.png'); + $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'edit.png'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double . '&start=<{$start}>&limit=<{$limit}>', 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_CLONE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 editcopy.png'); + $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'editcopy.png'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); $anchor .= $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=clone&{$fieldId}_source=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_DELETE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); - $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16 delete.png'); + $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'delete.png'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true, '', ''); $anchor .= $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=delete&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); $td .= $this->hc->getHtmlTag('td', ['class' => 'center width5'], "\n" . $anchor . "\t\t\t\t", false, "\t\t\t\t"); diff --git a/class/Files/Templates/Admin/TemplatesAdminPermissions.php b/class/Files/Templates/Admin/TemplatesAdminPermissions.php index 8eff4b1b..030e97c4 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -85,7 +85,7 @@ public function write($module, $filename): void */ private function getTemplatesAdminPermissionsHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); } /** diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index b00cf540..1ed30067 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -97,7 +97,7 @@ public function render() $titleElse = $this->sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n"); $link = $this->sc->getSmartyDoubleVar('itm', 'link'); $glyph = $this->hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home fa fa-home'], '', false, '', ''); - $anchor = $this->hc->getHtmlAnchor('<{xoAppUrl index.php}>', $glyph, 'home'); + $anchor = $this->hc->getHtmlAnchor("<{xoAppUrl 'index.php'}>", $glyph, 'home'); $into = $this->hc->getHtmlLi($anchor, 'breadcrumb-item', "\t"); $anchorIf = $this->hc->getHtmlAnchor($link, $title, $title, '', '', '', "\t\t\t", "\n"); $breadcrumb = $this->sc->getSmartyConditions('itm.link', '', '', $anchorIf, $titleElse, false, false, "\t\t"); diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index b0a47d6a..babc912a 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -116,11 +116,11 @@ 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->sc->getSmartyIncludeFile('system_comments', 'flat', 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->sc->getSmartyIncludeFile('system_comments', 'thread', 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"); + $contIf .= $this->sc->getSmartyIncludeFile('system_comments', 'nest', 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); diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php index e32d998d..9b579847 100644 --- a/class/Files/Templates/User/Defstyle/Header.php +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -90,7 +90,7 @@ public function write($module, $filename): void public function getTemplatesUserHeader($moduleDirname) { $ret = ''; - $cond = $this->sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, true, "\t"); + $cond = $this->sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, "\t"); $ret .= $this->sc->getSmartyConditions('xoBreadcrumbs', '', '', $cond); $var = $this->sc->getSmartySingleVar('ads'); $div = $this->hc->getHtmlDiv($var, 'center', "\t","\n", false) ; diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 0d394d3d..cd543fa4 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -88,7 +88,7 @@ public function write($module, $table, $tables, $filename): void */ public function getTemplateUserIndexHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, false); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false); } /** diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index d65e4fc6..30afddb1 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -86,7 +86,7 @@ public function write($module, $table, $filename): void */ private function getTemplatesUserPagesHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', '','','',"\n\n"); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', '','',"\n\n"); } /** @@ -134,7 +134,7 @@ private function getTemplatesUserPagesTableThead($tableName, $language) private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) { $single = $this->sc->getSmartySingleVar('panel_type'); - $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false,false, "\t\t\t\t\t\t"); + $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false, "\t\t\t\t\t\t"); $div = $this->hc->getHtmlDiv($include, 'panel panel-' . $single, "\t\t\t\t\t"); $cont = $this->hc->getHtmlTableData($div, '', '', "\t\t\t\t", "\n", true); $html = $this->hc->getHtmlEmpty('', "\t\t\t\t\t", "\n"); diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 6348694a..2ea6b2df 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -199,7 +199,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $retFoot .= $this->hc->getHtmlDiv($anchors, 'col-sm-12 right',"\t"); $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); if ($tableRate) { - $rate = $this->sc->getSmartyIncludeFile($moduleDirname, 'rate', false, false, "\t", "\n", 'item=$' . $tableSoleName); + $rate = $this->sc->getSmartyIncludeFile($moduleDirname, 'rate', false, "\t", "\n", 'item=$' . $tableSoleName); $ret .= $this->sc->getSmartyConditions('rating', '', '', $rate, false); } diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index 2848dadc..a78b7a70 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -87,7 +87,7 @@ public function write($module, $table, $filename): void private function getTemplatesUserPrintHeader($moduleDirname) { $ret = $this->hc->getHtmlComment('Header', '', "\n"); - $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, '', '', "\n\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, '', "\n\n"); return $ret; } diff --git a/docs/changelog.txt b/docs/changelog.txt index 8685cfe2..08be864a 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,6 @@ +
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 + - implemented smarty 3 (zivXP/goffy) +
    3.6.0 Stable [2023-02-28]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - moved to last stable with smarty 2 (goffy) diff --git a/language/english/help/help.html b/language/english/help/help.html index 52ced4c1..5db23b92 100644 --- a/language/english/help/help.html +++ b/language/english/help/help.html @@ -1,7 +1,7 @@

    Help: ModuleBuilder ModuleBuilder Back to the Administration of ModuleBuilder

    diff --git a/preloads/index.html b/preloads/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/preloads/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/preloads/index.php b/preloads/index.php deleted file mode 100644 index e5ee0725..00000000 --- a/preloads/index.php +++ /dev/null @@ -1,2 +0,0 @@ - -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}>
    <{$about}>
    -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_building.tpl b/templates/admin/modulebuilder_building.tpl index 8927f4db..d6eac59b 100644 --- a/templates/admin/modulebuilder_building.tpl +++ b/templates/admin/modulebuilder_building.tpl @@ -1,5 +1,5 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}>
    <{if $building_directory|default:''}> @@ -15,24 +15,24 @@ <{if $base_architecture}> <{$smarty.const._AM_MODULEBUILDER_OK_ARCHITECTURE}> - +   <{else}> <{$smarty.const._AM_MODULEBUILDER_NOTOK_ARCHITECTURE}>   - + <{/if}> <{foreach item=build from=$builds}> <{if $created}> <{$build.list}> - +   <{else}> <{$build.list}>   - + <{/if}> <{/foreach}> @@ -56,11 +56,11 @@ <{/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}> <{/if}> <{/if}> -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_devtools.tpl b/templates/admin/modulebuilder_devtools.tpl index 36e70e79..17dba8d8 100644 --- a/templates/admin/modulebuilder_devtools.tpl +++ b/templates/admin/modulebuilder_devtools.tpl @@ -8,7 +8,7 @@ padding:20px 0 !important; } -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> <{if $devtools_list|default:''}> @@ -74,4 +74,4 @@ <{/if}> -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_fields.tpl b/templates/admin/modulebuilder_fields.tpl index 8338dfc8..b10b1bc6 100644 --- a/templates/admin/modulebuilder_fields.tpl +++ b/templates/admin/modulebuilder_fields.tpl @@ -1,5 +1,5 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> <{if $tables_list|default:''}>
    @@ -43,18 +43,18 @@ - + <{/if}> <{/foreach}> @@ -79,4 +79,4 @@
    <{$form}>
    <{/if}> -<{*<{includeq file="db:modulebuilder_footer.tpl"}>*}> +<{*<{include file="db:modulebuilder_footer.tpl"}>*}> diff --git a/templates/admin/modulebuilder_footer.tpl b/templates/admin/modulebuilder_footer.tpl index 37cdf169..67541769 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_index.tpl b/templates/admin/modulebuilder_index.tpl index dd970789..42048d22 100644 --- a/templates/admin/modulebuilder_index.tpl +++ b/templates/admin/modulebuilder_index.tpl @@ -1,6 +1,6 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}>
    <{$index|default:''}>
    -<{*<{includeq file="db:modulebuilder_footer.tpl"}>*}> +<{*<{include file="db:modulebuilder_footer.tpl"}>*}> diff --git a/templates/admin/modulebuilder_modules.tpl b/templates/admin/modulebuilder_modules.tpl index 3be5dbfe..7f02ca9b 100644 --- a/templates/admin/modulebuilder_modules.tpl +++ b/templates/admin/modulebuilder_modules.tpl @@ -1,5 +1,5 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> <{if $modules_list|default:''}>
    - <{$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}>
    <{includeq file="db:modulebuilder_fields_item.tpl" table=$table}><{include file="db:modulebuilder_fields_item.tpl" table=$table}>
    @@ -74,13 +74,13 @@ <{/foreach}> @@ -112,4 +112,4 @@ <{/foreach}> <{/if}> -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_morefiles.tpl b/templates/admin/modulebuilder_morefiles.tpl index 08da6ff0..2c10b3df 100644 --- a/templates/admin/modulebuilder_morefiles.tpl +++ b/templates/admin/modulebuilder_morefiles.tpl @@ -1,5 +1,5 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> <{if $files_list|default:''}>
    - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> - <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> + <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> - <{$smarty.const._CLONE}> + <{$smarty.const._CLONE}>
    @@ -24,10 +24,10 @@ @@ -53,4 +53,4 @@ <{/if}> -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_settings.tpl b/templates/admin/modulebuilder_settings.tpl index b9ad8305..e453b942 100644 --- a/templates/admin/modulebuilder_settings.tpl +++ b/templates/admin/modulebuilder_settings.tpl @@ -1,5 +1,5 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> <{if $settings_list|default:''}>
    @@ -40,10 +40,10 @@
    @@ -70,4 +70,4 @@ <{/if}> -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_tables.tpl b/templates/admin/modulebuilder_tables.tpl index 7a647db3..6cc65219 100644 --- a/templates/admin/modulebuilder_tables.tpl +++ b/templates/admin/modulebuilder_tables.tpl @@ -1,5 +1,5 @@ -<{includeq file="db:modulebuilder_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> <{if $modules_list|default:''}>
    <{$file.upload}> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}>
    - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}>
    @@ -81,21 +81,21 @@ - + <{/if}> <{/foreach}> @@ -120,4 +120,4 @@
    <{$form}>
    <{/if}> -<{includeq file="db:modulebuilder_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_tables_item.tpl b/templates/admin/modulebuilder_tables_item.tpl index 3e1391d4..c585da22 100644 --- a/templates/admin/modulebuilder_tables_item.tpl +++ b/templates/admin/modulebuilder_tables_item.tpl @@ -64,13 +64,13 @@
    diff --git a/xoops_version.php b/xoops_version.php index 535a64d2..465f6584 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -25,9 +25,9 @@ $moduleDirName = \basename(__DIR__); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -$modversion['version'] = '3.6.0'; -$modversion['module_status'] = 'Stable'; -$modversion['release_date'] = '2023/02/28'; // format: yyyy/mm/dd +$modversion['version'] = '3.7.0'; +$modversion['module_status'] = 'Alpha'; +$modversion['release_date'] = '2023/07/06'; // format: yyyy/mm/dd $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; @@ -54,15 +54,15 @@ $modversion['targetdir'] = XOOPS_UPLOAD_PATH . "/{$moduleDirName}/repository/"; $modversion['module_website_url'] = 'https://github.com/XoopsModules25x/modulebuilder'; $modversion['module_website_name'] = 'GitHub Xoops'; -$modversion['min_php'] = '7.2'; -$modversion['min_xoops'] = '2.5.11-Beta 2'; +$modversion['min_php'] = '7.4'; +$modversion['min_xoops'] = '2.5.11-RC2'; $modversion['min_admin'] = '1.2'; $modversion['min_db'] = ['mysql' => '5.5']; //about $modversion['demo_site_url'] = 'https://xoops.org/'; $modversion['demo_site_name'] = 'Xoops TDM'; $modversion['forum_site_url'] = 'https://xoops.org/modules/newbb/viewtopic.php?post_id=365223'; -$modversion['forum_site_name'] = 'ModuleBuilder 3.03 for Testing'; +$modversion['forum_site_name'] = 'ModuleBuilder for Testing'; $modversion['module_website_name'] = 'Xoops TDM'; // Admin things $modversion['system_menu'] = '1'; From 2b77959fb20d302f2e2ab6866391fd222348db4c Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 8 Jul 2023 10:48:28 +0200 Subject: [PATCH 232/266] fixed bug in creation if search.inc.php --- class/Files/Includes/IncludeSearch.php | 35 ++++++++++++++++---------- docs/changelog.txt | 1 + 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index 2b71f6de..723dd244 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -120,8 +120,13 @@ public function getSearchFunction($moduleDirname) $fieldMain = ''; $fieldDate = ''; $countField = 0; + $fieldUser = ''; foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + if (Modulebuilder\Constants::FIELD_ELE_SELECTUSER == $fieldElement) { + $fieldUser = $fieldName; + } if (0 == $f) { $fieldId = $fieldName; } @@ -143,22 +148,26 @@ public function getSearchFunction($moduleDirname) $for .= $this->pc->getPhpCodeUnset('crKeyword', $t . "\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"); - $contIf .= $this->xc->getXcCriteriaCompo('crUser', $t . "\t"); - $crit = $this->xc->getXcCriteria('', "'{$tableFieldname}_submitter'", "'(' . \implode(',', \$userid) . ')'", "'IN'", true, $t . "\t"); - $contIf .= $this->xc->getXcCriteriaAdd('crUser', $crit, $t . "\t", "\n", "'OR'"); - $contElse = $this->xc->getXcCriteriaCompo('crUser', $t . "\t"); - $crit = $this->xc->getXcCriteria('', "'{$tableFieldname}_submitter'", '$userid', '', true, $t . "\t"); - $contElse .= $this->xc->getXcCriteriaAdd('crUser', $crit, $t . "\t", "\n", "'OR'"); - $func .= $this->pc->getPhpCodeConditions('$userid && \is_array($userid)', '', '', $contIf, $contElse, $t, 'is_numeric($userid) && $userid > 0'); + if ('' !== $fieldUser) { + $func .= $this->pc->getPhpCodeCommentLine('search user(s)', '', $t); + $contIf = $this->xc->getXcEqualsOperator('$userid', "array_map('\intval', \$userid)", '', $t . "\t"); + $contIf .= $this->xc->getXcCriteriaCompo('crUser', $t . "\t"); + $crit = $this->xc->getXcCriteria('', "'{$fieldUser}'", "'(' . \implode(',', \$userid) . ')'", "'IN'", true, $t . "\t"); + $contIf .= $this->xc->getXcCriteriaAdd('crUser', $crit, $t . "\t", "\n", "'OR'"); + $contElse = $this->xc->getXcCriteriaCompo('crUser', $t . "\t"); + $crit = $this->xc->getXcCriteria('', "'{$fieldUser}'", '$userid', '', true, $t . "\t"); + $contElse .= $this->xc->getXcCriteriaAdd('crUser', $crit, $t . "\t", "\n", "'OR'"); + $func .= $this->pc->getPhpCodeConditions('$userid && \is_array($userid)', '', '', $contIf, $contElse, $t, 'is_numeric($userid) && $userid > 0'); + } $func .= $this->xc->getXcCriteriaCompo('crSearch', $t); $contIf = $this->xc->getXcCriteriaAdd('crSearch', '$crKeywords', $t . "\t", "\n", "'AND'"); $cond = $this->pc->getPhpCodeIsset('crKeywords'); $func .= $this->pc->getPhpCodeConditions($cond, '', '', $contIf, false, $t); - $contIf = $this->xc->getXcCriteriaAdd('crSearch', '$crUser', $t . "\t", "\n", "'AND'"); - $cond = $this->pc->getPhpCodeIsset('crUser'); - $func .= $this->pc->getPhpCodeConditions($cond, '', '', $contIf, false, $t); + if ('' !== $fieldUser) { + $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); if ('' !== $fieldDate) { diff --git a/docs/changelog.txt b/docs/changelog.txt index 08be864a..a807a7bd 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,6 @@
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) + - fixed bug in creation if search.inc.php (zivXP/goffy)
    3.6.0 Stable [2023-02-28]
    Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4 - moved to last stable with smarty 2 (goffy) From b68e0d198763f20c7c1c026eb4035935b8743cbd Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 1 Feb 2024 15:43:03 +0100 Subject: [PATCH 233/266] update version check --- class/Common/VersionChecks.php | 2 +- files/commonfiles/class/Common/VersionChecks.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 9c0bee7f..a18c6f28 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } $success = true; - if (\version_compare($currentVer, $requiredVer, '<')) { + if ($module->versionCompare($currentVer, $requiredVer, '<')) { $success = false; $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } diff --git a/files/commonfiles/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php index 9c0bee7f..a18c6f28 100644 --- a/files/commonfiles/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } $success = true; - if (\version_compare($currentVer, $requiredVer, '<')) { + if ($module->versionCompare($currentVer, $requiredVer, '<')) { $success = false; $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } From 7d99f1c9fec3e99567a2ebd925137071c60fe219 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 1 Feb 2024 15:52:02 +0100 Subject: [PATCH 234/266] removed prefix from table field names --- class/Fields.php | 3 ++- docs/changelog.txt | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/class/Fields.php b/class/Fields.php index c54a074c..b0e0a0de 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -195,7 +195,8 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, // Index ID $form->addElement(new Modulebuilder\Html\FormLabel('
    ')); // Field Name - $thisFieldName = (!empty($fName) ? ((1 == $i) ? $fName . '_id' : $fName . '_') : ''); + //$thisFieldName = (!empty($fName) ? ((1 == $i) ? $fName . '_id' : $fName . '_') : ''); + $thisFieldName = (1 === $i) ? 'id' : ''; $fieldName = new \XoopsFormText(\_AM_MODULEBUILDER_FIELD_NAME, 'field_name[' . $i . ']', 15, 255, $thisFieldName); $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Element diff --git a/docs/changelog.txt b/docs/changelog.txt index a807a7bd..73de4368 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,7 @@ +
    3.7.0 RC1 [2024-02-01]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 + - updated version check for XOOPS 2.5.11 Stable (goffy) + - removed prefix from table field names (mamba/goffy) +
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) - fixed bug in creation if search.inc.php (zivXP/goffy) From e2bd1e0ef26f17994dd1b630e8cc5c0c47e0fbec Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 10 Feb 2024 18:26:06 +0100 Subject: [PATCH 235/266] moved to singular table names --- class/Files/Language/LanguageMain.php | 2 +- class/Tables.php | 4 ++++ docs/changelog.txt | 3 ++- language/english/admin.php | 6 +++--- templates/admin/modulebuilder_tables.tpl | 7 +++++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index ce518e36..b2baa57a 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -142,7 +142,7 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_CLONE", "Clone {$ucfTableSoleName}"); } $ret .= $this->ld->getDefine($language, "{$stuTableSoleName}_DETAILS", "Details {$ucfTableSoleName}"); - $ret .= $this->ld->getDefine($language, $stuTableName, $ucfTableName); + //$ret .= $this->ld->getDefine($language, $stuTableName, $ucfTableName); $ret .= $this->ld->getDefine($language, "{$stuTableName}_LIST", "List of {$ucfTableName}"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_TITLE", "{$ucfTableName} title"); $ret .= $this->ld->getDefine($language, "{$stuTableName}_DESC", "{$ucfTableName} description"); diff --git a/class/Tables.php b/class/Tables.php index b6a81f42..7c6da9ca 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -151,12 +151,16 @@ public function getFormTables($action = false) } $form->addElement($modulesSelect, true); + /* $tableNameText = new \XoopsFormText(\_AM_MODULEBUILDER_TABLE_NAME, 'table_name', 40, 150, $tableName); $tableNameText->setDescription(\_AM_MODULEBUILDER_TABLE_NAME_DESC); $form->addElement($tableNameText, true); + */ + $form->addElement(new \XoopsFormHidden('table_name', $tableName)); $tableSoleNameText = new \XoopsFormText(\_AM_MODULEBUILDER_TABLE_SOLENAME, 'table_solename', 40, 150, $this->getVar('table_solename')); $tableSoleNameText->setDescription(\_AM_MODULEBUILDER_TABLE_SOLENAME_DESC); + $tableSoleNameText->setExtra('onchange="changeTablesolename()"'); $form->addElement($tableSoleNameText, true); $radioCategory = $isNew ? 0 : $this->getVar('table_category'); diff --git a/docs/changelog.txt b/docs/changelog.txt index 73de4368..0e292f56 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,6 +1,7 @@
    3.7.0 RC1 [2024-02-01]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 - updated version check for XOOPS 2.5.11 Stable (goffy) - - removed prefix from table field names (mamba/goffy) + - moved to singular table names (mamba/goffy) +
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) diff --git a/language/english/admin.php b/language/english/admin.php index df9983b5..aaf52527 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -210,9 +210,9 @@ \define('_AM_MODULEBUILDER_TABLES_NEW_CATEGORY', 'New Category'); \define('_AM_MODULEBUILDER_TABLE_MODULES', 'Choose a module'); \define('_AM_MODULEBUILDER_TABLE_NAME', 'Table Name'); -\define('_AM_MODULEBUILDER_TABLE_NAME_DESC', "Unique Name: It's recommended to use plural word (i.e.: categoriess)"); -\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_NAME_DESC', "Unique Name: You can use plural word, but it's recommended to use singular word (i.e.: categorys)"); +\define('_AM_MODULEBUILDER_TABLE_SOLENAME', 'Table Name'); +\define('_AM_MODULEBUILDER_TABLE_SOLENAME_DESC', "Name: It's recommended to use singular word (i.e.: category)"); \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_NBFIELDS', 'Number fields'); diff --git a/templates/admin/modulebuilder_tables.tpl b/templates/admin/modulebuilder_tables.tpl index 6cc65219..603659d6 100644 --- a/templates/admin/modulebuilder_tables.tpl +++ b/templates/admin/modulebuilder_tables.tpl @@ -121,3 +121,10 @@ <{/if}> <{include file="db:modulebuilder_footer.tpl"}> + + From 2b530a1bce8cbd9f7707b5efac53ef132cea5595 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sun, 11 Feb 2024 16:03:40 +0100 Subject: [PATCH 236/266] added trailing '_text' for output of prepared text --- class/Files/Classes/ClassFiles.php | 66 +++++----- class/Files/Classes/ClassHandlerFiles.php | 6 - class/Files/CreateXoopsCode.php | 3 + class/Files/Sql/SqlFile.php | 56 ++++---- .../Templates/Admin/TemplatesAdminPages.php | 7 + .../Blocks/Defstyle/TemplatesBlocks.php | 26 +++- .../Defstyle/TemplatesBlocksSpotlight.php | 26 +++- class/Files/Templates/User/Defstyle/Index.php | 6 +- .../Templates/User/Defstyle/PagesItem.php | 121 ++++++++++++++++-- .../Templates/User/Defstyle/PagesList.php | 117 +++++++++++++++-- class/Files/Templates/User/Defstyle/Pdf.php | 24 +++- .../Templates/User/Defstyle/UserPrint.php | 26 ++-- class/Tables.php | 2 +- docs/changelog.txt | 3 +- language/english/admin.php | 2 +- 15 files changed, 372 insertions(+), 119 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 0bf276a0..c4c4f25e 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Classes; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -198,8 +201,7 @@ private function getClassObject($module, $table, $fields) $fieldInForm[] = $fields[$f]->getVar('field_inform'); $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); - if (13 == $fieldElements->getVar('fieldelement_id') || 14 == $fieldElements->getVar('fieldelement_id')) { - //13: UploadImage, 14: UploadFile + if (Constants::FIELD_ELE_UPLOADIMAGE == $fieldElements->getVar('fieldelement_id') || Constants::FIELD_ELE_UPLOADFILE == $fieldElements->getVar('fieldelement_id')) { $fieldUpload = true; } $rpFieldName = $this->getRightString($fieldName); @@ -406,13 +408,17 @@ private function getValuesInObject($moduleDirname, $table, $fields) $configMaxchar = 0; $lenMaxName = 0; foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); - $len = \mb_strlen($rpFieldName); - if (3 == $fields[$f]->getVar('field_element') || 4 == $fields[$f]->getVar('field_element')) { - $len = $len + \mb_strlen('_short'); - } + $len = \mb_strlen($rpFieldName) + \mb_strlen('_short'); $lenMaxName = max($len, $lenMaxName); + if (Constants::FIELD_ELE_TEXTAREA == $fieldElement || Constants::FIELD_ELE_DHTMLTEXTAREA == $fieldElement) { + $configMaxchar = 1; + } + } + if (1 === $configMaxchar) { + $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); } foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -420,43 +426,40 @@ private function getValuesInObject($moduleDirname, $table, $fields) $rpFieldName = $this->getRightString($fieldName); $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"); - if ($configMaxchar == 0) { - $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); - $configMaxchar = 1; - } + case Constants::FIELD_ELE_TEXTAREA: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $getValues .= $this->pc->getPhpCodeStripTags("ret['{$rpFieldName}_text']{$spacer}", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; $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; break; - case 4: - $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t", ", 'e'"); - if ($configMaxchar == 0) { - $getValues .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t\t"); - $configMaxchar = 1; - } + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}_text']{$spacer}", 'this', $fieldName, false, "\t\t", ", 'e'"); $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; $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; break; - case 6: - $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t"); + case Constants::FIELD_ELE_RADIOYN: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_text']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t"); break; - case 8: - $getValues .= $this->xc->getXcXoopsUserUnameFromId("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", "\t\t"); + case Constants::FIELD_ELE_SELECTUSER: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $getValues .= $this->xc->getXcXoopsUserUnameFromId("ret['{$rpFieldName}_text']{$spacer}", "\$this->getVar('{$fieldName}')", "\t\t"); break; - case 15: - $getValues .= $this->xc->getXcFormatTimeStamp("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", 's', "\t\t"); + case Constants::FIELD_ELE_TEXTDATESELECT: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $getValues .= $this->xc->getXcFormatTimeStamp("ret['{$rpFieldName}_text']{$spacer}", "\$this->getVar('{$fieldName}')", 's', "\t\t"); break; - case 16: - $spacer = str_repeat(' ', $lenMaxName - \mb_strlen('status') + 7); + case Constants::FIELD_ELE_SELECTSTATUS: + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen('status') + 7); $getValues .= $this->xc->getXcGetVar("status{$spacer}", 'this', $fieldName, false, "\t\t"); - $spacer = str_repeat(' ', $lenMaxName - \mb_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]; @@ -478,8 +481,9 @@ private function getValuesInObject($moduleDirname, $table, $fields) $spacer = $len > 0 ? str_repeat(' ', $len) : ''; $getValues .= $this->xc->getXcEqualsOperator("\$ret['status_text']{$spacer}", '$status_text', false, "\t\t"); break; - case 21: - $getValues .= $this->xc->getXcFormatTimeStamp("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", 'm', "\t\t"); + case Constants::FIELD_ELE_DATETIME: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $getValues .= $this->xc->getXcFormatTimeStamp("ret['{$rpFieldName}_text']{$spacer}", "\$this->getVar('{$fieldName}')", 'm', "\t\t"); break; default: $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 23c9d747..13e25c46 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -336,14 +336,11 @@ public function render() $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $fieldInForm = []; $fieldParentId = []; - $fieldElementId = []; $fieldId = null; - $fieldName = null; $fieldMain = null; $fieldElement = null; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); - $fieldInForm[] = $fields[$f]->getVar('field_inform'); $fieldParentId[] = $fields[$f]->getVar('field_parent'); if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { $fieldId = $fieldName; // $fieldId = fields parameter index field @@ -352,9 +349,6 @@ public function render() $fieldMain = $fieldName; // $fieldMain = fields parameter main field } $fieldElement = $fields[$f]->getVar('field_element'); - - $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); - $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); } $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); $content = $this->getHeaderFilesComments($module, null, $namespace); diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 3313c491..ad7061b2 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1035,9 +1035,12 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $ccFieldMain = Modulebuilder\Files\CreateFile::getInstance()->getCamelCase($fieldMain, false, true); + $array = "['ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'start' => \$start, 'limit' => \$limit, 'op' => '{$options}']"; $server = $pc->getPhpCodeGlobalsVariables('REQUEST_URI', 'SERVER'); $getVar = $this->getXcGetVar('', $tableName . 'Obj', $fieldMain, true); + $getVar = "\${$ccFieldMain}"; $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, $getVar); $confirm = 'new Common\Confirm(' . "\n"; $confirm .= $t . "\t" . $array . ",\n"; diff --git a/class/Files/Sql/SqlFile.php b/class/Files/Sql/SqlFile.php index cd884b11..e14a2b83 100644 --- a/class/Files/Sql/SqlFile.php +++ b/class/Files/Sql/SqlFile.php @@ -34,7 +34,6 @@ class SqlFile extends Files\CreateFile /** * @public function constructor * - * @param null */ public function __construct() { @@ -44,8 +43,6 @@ public function __construct() /** * @static function getInstance * - * @param null - * * @return SqlFile */ public static function getInstance() @@ -184,9 +181,15 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa $j = 0; $comma = []; $row = []; - //$type = ''; + $lenMax = 0; $fieldTypeName = ''; $fields = $this->getTableFields($tableMid, $tableId); + //get max length + foreach (\array_keys($fields) as $f) { + $len = \mb_strlen($fields[$f]->getVar('field_name')); + $lenMax = max($len, $lenMax); + } + //create foreach (\array_keys($fields) as $f) { // Creation of database table $ret = $this->getHeadDatabaseTable($moduleDirname, $tableName, $fieldsNumb); @@ -267,12 +270,6 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa $type = $fieldTypeName; $default = null; break; - case 19: - case 20: - case 21: - $type = $fieldTypeName . '(' . $fieldValue . ')'; - $default = "DEFAULT '{$fieldDefault}'"; - break; case 23: $type = $fieldTypeName; if (empty($fieldDefault)) { @@ -290,39 +287,39 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa break; } if ((0 == $f) && (1 == $tableAutoincrement)) { - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, null, 'AUTO_INCREMENT'); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, null, 'AUTO_INCREMENT', $lenMax); $comma[$j] = $this->getKey(2, $fieldName); ++$j; } elseif ((0 == $f) && (0 == $tableAutoincrement)) { - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default, null, $lenMax); $comma[$j] = $this->getKey(2, $fieldName); ++$j; } else { if (3 == $fieldKey || 4 == $fieldKey || 5 == $fieldKey || 6 == $fieldKey) { switch ($fieldKey) { case 3: - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default, null, $lenMax); $comma[$j] = $this->getKey(3, $fieldName); ++$j; break; case 4: - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default, null, $lenMax); $comma[$j] = $this->getKey(4, $fieldName); ++$j; break; case 5: - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default, null, $lenMax); $comma[$j] = $this->getKey(5, $fieldName); ++$j; break; case 6: - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default, null, $lenMax); $comma[$j] = $this->getKey(6, $fieldName); ++$j; break; } } else { - $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default); + $row[] = $this->getFieldRow($fieldName, $type, $fieldAttribute, $fieldNull, $default, null, $lenMax); } } } @@ -371,8 +368,6 @@ private function getTableRatings($moduleDirname) /** * @private function getFootDatabaseTable * - * @param null - * * @return string */ private function getFootDatabaseTable() @@ -389,15 +384,24 @@ private function getFootDatabaseTable() * @param $fieldNull * @param $fieldDefault * @param $autoincrement + * @param $lenMax * * @return string */ - private function getFieldRow($fieldName, $fieldTypeValue, $fieldAttribute = null, $fieldNull = null, $fieldDefault = null, $autoincrement = null) + private function getFieldRow($fieldName, $fieldTypeValue, $fieldAttribute = null, $fieldNull = null, $fieldDefault = null, $autoincrement = null, $lenMax = 0) { - $retAutoincrement = " `{$fieldName}` {$fieldTypeValue} {$fieldAttribute} {$fieldNull} {$autoincrement},"; - $retFieldAttribute = " `{$fieldName}` {$fieldTypeValue} {$fieldAttribute} {$fieldNull} {$fieldDefault},"; - $fieldDefault = " `{$fieldName}` {$fieldTypeValue} {$fieldNull} {$fieldDefault},"; - $retShort = " `{$fieldName}` {$fieldTypeValue},"; + $fieldNameMax = " `{$fieldName}`"; + if ($lenMax > 0) { + $fieldNameMax .= \str_repeat(' ', $lenMax - \strlen($fieldName)); + } + $fieldTypeValueMax = $fieldTypeValue; + if (\strlen($fieldTypeValue) < 15) { + $fieldTypeValueMax .= \str_repeat(' ', 15 - \strlen($fieldTypeValue)); + } + $retAutoincrement = $fieldNameMax . " {$fieldTypeValueMax} {$fieldAttribute} {$fieldNull} {$autoincrement},"; + $retFieldAttribute = $fieldNameMax . " {$fieldTypeValueMax} {$fieldAttribute} {$fieldNull} {$fieldDefault},"; + $fieldDefault = $fieldNameMax . " {$fieldTypeValueMax} {$fieldNull} {$fieldDefault},"; + $retShort = $fieldNameMax . " {$fieldTypeValueMax},"; $ret = $retShort; if (null != $autoincrement) { @@ -445,9 +449,7 @@ private function getKey($key, $fieldName) /** * @public function render * - * @param null - * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index bba26604..03901aed 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -194,6 +194,13 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $imgAlt, 'title' => $imgAlt], '', true,'',''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + break; default: if (0 != $f) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 98ee1a2c..158d9583 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Templates\Blocks\Defstyle; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -138,23 +141,36 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi $rpFieldName = $this->getRightString($fieldName); if (1 == $fields[$f]->getVar('field_inlist')) { switch ($fieldElement) { - case 9: + case Constants::FIELD_ELE_COLORPICKER: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $span = $this->hc->getHtmlTag('span', [], $double); + $span = $this->hc->getHtmlTag('span', [], $double, false, '', ''); $td .= $this->hc->getHtmlTableData($span, 'center', '', "\t\t\t"); break; - case 10: + case Constants::FIELD_ELE_IMAGELIST: $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"); break; - case 13: + case Constants::FIELD_ELE_UPLOADIMAGE: $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"); break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + break; default: if (0 != $f) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php index 66595e36..d4a693e0 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Templates\Blocks\Defstyle; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -140,23 +143,36 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi $rpFieldName = $this->getRightString($fieldName); if (1 == $fields[$f]->getVar('field_inlist')) { switch ($fieldElement) { - case 9: + case Constants::FIELD_ELE_COLORPICKER: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $span = $this->hc->getHtmlTag('span', [], $double); + $span = $this->hc->getHtmlTag('span', [], $double, false, '', ''); $td .= $this->hc->getHtmlTableData($span, 'center', '', "\t\t\t"); break; - case 10: + case Constants::FIELD_ELE_IMAGELIST: $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"); break; - case 13: + case Constants::FIELD_ELE_UPLOADIMAGE: $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"); break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + break; default: if (0 != $f) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index cd543fa4..32424373 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -154,12 +154,12 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole $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); - $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); + $trClose = $this->hc->getHtmlEmpty('', $t . "\t\t\t\t\t", "\n"); + $td .= $this->sc->getSmartyConditions('smarty.foreach.' . $tableSoleName . '.iteration', ' is div by ', '$divideby', $trClose, false, false, false, $t . "\t\t\t\t", "\n", true, false); $foreach = $this->hc->getHtmlComment('Start new link loop',$t . "\t\t\t", "\n"); $foreach .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $td, $tableSoleName,'',"\t\t\t"); $foreach .= $this->hc->getHtmlComment('End new link loop',$t . "\t\t\t", "\n"); - $tr .= $this->hc->getHtmlTableRow($foreach, '',$t . "\t\t"); + $tr = $this->hc->getHtmlTableRow($foreach, '',$t . "\t\t"); $table .= $this->hc->getHtmlTable($tr, 'table table-<{$table_type}>', $t . "\t"); $ret .= $this->sc->getSmartyConditions($tableName . 'Count', ' > ','0', $table, false, false, false, '', "\n", true, 'int'); diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 2ea6b2df..1f38c52d 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -115,11 +115,45 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_thead')) { switch ($fieldElement) { default: - //case 2: - $fieldName = $fields[$f]->getVar('field_name'); + $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + break; + case Constants::FIELD_ELE_IMAGELIST: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + unset($img); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + unset($img); break; } } @@ -134,20 +168,35 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_tbody')) { switch ($fieldElement) { default: - //case 3: - //case 4: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); + break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-3', "\t"); + $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify', "\t"); unset($img); break; case Constants::FIELD_ELE_UPLOADIMAGE: @@ -156,7 +205,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $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->getHtmlSpan($img, 'col-sm-3',"\t"); + $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify',"\t"); unset($img); break; } @@ -169,12 +218,56 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_user')) { if (1 == $fields[$f]->getVar('field_tfoot')) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); - $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + $fieldElement = $fields[$f]->getVar('field_element'); + switch ($fieldElement) { + default: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + $lang = $this->sc->getSmartyConst($language, $langConst); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + $lang = $this->sc->getSmartyConst($language, $langConst); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + $lang = $this->sc->getSmartyConst($language, $langConst); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + break; + case Constants::FIELD_ELE_IMAGELIST: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify', "\t"); + unset($img); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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->getHtmlSpan($img, 'block-pie justify',"\t"); + unset($img); + break; + } } } } diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index c016cec4..eb08fef2 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -105,17 +105,51 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_ihead')) { switch ($fieldElement) { default: - //case 2: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + break; + case Constants::FIELD_ELE_IMAGELIST: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + unset($img); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); + $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); + unset($img); + break; } } } } - $ret .= $this->hc->getHtmlDiv($retNumb, 'panel-heading'); + $ret .= $this->hc->getHtmlDiv($retNumb, 'panel-heading'); $retElem = ''; $fieldId = ''; $keyDouble = ''; @@ -129,20 +163,35 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table if (1 == $fields[$f]->getVar('field_ibody')) { switch ($fieldElement) { default: - //case 3: - //case 4: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); + break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-3', "\t"); + $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify', "\t"); unset($img); break; case Constants::FIELD_ELE_UPLOADIMAGE: @@ -151,7 +200,7 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table $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->getHtmlSpan($img, 'col-sm-3',"\t"); + $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify',"\t"); unset($img); break; } @@ -164,12 +213,56 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_user')) { if (1 == $fields[$f]->getVar('field_ifoot')) { - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); - $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + $fieldElement = $fields[$f]->getVar('field_element'); + switch ($fieldElement) { + default: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + $lang = $this->sc->getSmartyConst($language, $langConst); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + $lang = $this->sc->getSmartyConst($language, $langConst); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + $lang = $this->sc->getSmartyConst($language, $langConst); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); + break; + case Constants::FIELD_ELE_IMAGELIST: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); + $retFoot .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); + unset($img); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); + $retFoot .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); + unset($img); + break; + } } } } diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php index efe83790..60260c75 100644 --- a/class/Files/Templates/User/Defstyle/Pdf.php +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Templates\User\Defstyle; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -108,19 +111,30 @@ private function getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $t $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); break; - case 10: + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $retElem .= $this->hc->getHtmlDiv($doubleVar, 'col-sm-8', "\t", "\n", false); + break; + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $retElem .= $this->hc->getHtmlDiv($doubleVar, 'col-sm-8', "\t", "\n", false); + break; + case Constants::FIELD_ELE_IMAGELIST: $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: + case Constants::FIELD_ELE_UPLOADIMAGE: $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index a78b7a70..deb80c91 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Templates\User\Defstyle; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -147,18 +150,25 @@ private function getTemplatesUserPrintTableTBody($moduleDirname, $tableName, $ta $rpFieldName = $this->getRightString($fieldName); if (1 == $fields[$f]->getVar('field_user')) { switch ($fieldElement) { - case 3: - case 4: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_TEXTDATESELECT: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + break; + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); break; - case 5: + case Constants::FIELD_ELE_CHECKBOX: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $src = $this->sc->getSmartyNoSimbol('xoModuleIcons16') . $double . '.png'; $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; - case 9: + case Constants::FIELD_ELE_COLORPICKER: // This is to be reviewed, as it was initially to style = "backgroung-color: #" // Now with HTML5 is not supported inline style in the parameters of the HTML tag // Old code was ... @@ -166,19 +176,19 @@ private function getTemplatesUserPrintTableTBody($moduleDirname, $tableName, $ta $color = "    "; $td .= $this->hc->getHtmlTableData($color, 'center', '', "\t\t\t"); break; - case 10: + case Constants::FIELD_ELE_IMAGELIST: $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"); break; - case 13: + case Constants::FIELD_ELE_UPLOADIMAGE: $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, 'style' => 'max-width:100px'], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; - case 16: + case Constants::FIELD_ELE_SELECTSTATUS: $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $src = $this->sc->getSmartyNoSimbol('$modPathIcon16') . 'status' . $double . '.png'; $imgAlt = $this->sc->getSmartyDoubleVar($tableSoleName, 'status_text'); diff --git a/class/Tables.php b/class/Tables.php index 7c6da9ca..94a3ec52 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -170,7 +170,7 @@ public function getFormTables($action = false) $tableFieldname = new \XoopsFormText(\_AM_MODULEBUILDER_TABLE_FIELDNAME, 'table_fieldname', 30, 50, $this->getVar('table_fieldname')); $tableFieldname->setDescription(\_AM_MODULEBUILDER_TABLE_FIELDNAME_DESC); - $form->addElement($tableFieldname); + $form->addElement($tableFieldname, true); $tableNumbFileds = new \XoopsFormText(\_AM_MODULEBUILDER_TABLE_NBFIELDS, 'table_nbfields', 10, 25, $this->getVar('table_nbfields')); $tableNumbFileds->setDescription(\_AM_MODULEBUILDER_TABLE_NBFIELDS_DESC); diff --git a/docs/changelog.txt b/docs/changelog.txt index 0e292f56..2a85bd51 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,7 +1,8 @@
    3.7.0 RC1 [2024-02-01]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 - updated version check for XOOPS 2.5.11 Stable (goffy) - moved to singular table names (mamba/goffy) - + - create nicer mysql.sql (goffy) + - added trailing '_text' for output of prepared text (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) diff --git a/language/english/admin.php b/language/english/admin.php index aaf52527..92bcc085 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -222,7 +222,7 @@ \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. This prefix will also be used for creation of variables.
    It's recommended to use an appreviation of table name (e.g. cat for table category).
    WARNING: if you change this prefix after creation of table you have to change the prefix in the table field names manually!" ); \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'); From 955a333088a4814b8efaf0e2c2f3aed9f57f0f4c Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 12 Feb 2024 09:55:56 +0100 Subject: [PATCH 237/266] fixed bugs with foreach in tpl caused by singular table names; added devtool for removing table field prefix --- admin/devtools.php | 70 +++++--- class/Devtools.php | 156 +++++++++++++++--- class/Files/Templates/User/Defstyle/Index.php | 2 +- class/Files/Templates/User/Defstyle/Pages.php | 4 +- class/Files/User/UserIndex.php | 6 +- class/Files/User/UserPages.php | 8 +- class/Files/User/UserPrint.php | 4 +- docs/changelog.txt | 1 + language/english/admin.php | 7 +- templates/admin/modulebuilder_devtools.tpl | 7 + 10 files changed, 208 insertions(+), 57 deletions(-) diff --git a/admin/devtools.php b/admin/devtools.php index 27a50a51..a2714483 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -36,23 +36,28 @@ switch ($op) { case 'fq': - $fqModule = Request::getString('fq_module'); - $src_path = \XOOPS_ROOT_PATH . '/modules/' . $fqModule; - $dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/' . $fqModule; + $modName = Request::getString('fq_module'); + if ('' === $modName) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD); + } + $src_path = \XOOPS_ROOT_PATH . '/modules/' . $modName; + $dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/' . $modName; $patKeys = []; $patValues = []; - //Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues); - Devtools::function_qualifier($src_path, $dst_path, $fqModule); + Devtools::function_qualifier($src_path, $dst_path, $modName); \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS); break; case 'check_lang': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php')); - $clModuleName = Request::getString('cl_module'); - $clModuleNameUpper = \mb_strtoupper($clModuleName); + $modName = Request::getString('cl_module'); + if ('' === $modName) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD); + } + $modNameUpper = \mb_strtoupper($modName); //scan language files - $src_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName . '/language/english/'; + $src_path = \XOOPS_ROOT_PATH . '/modules/' . $modName . '/language/english/'; $langfiles = []; foreach (scandir($src_path) as $scan) { if (is_file($src_path . $scan) && 'index.html' !== $scan) { @@ -68,13 +73,13 @@ } $constantsAfterInclude = getUserDefinedConstants(); foreach ($constantsAfterInclude as $constKey => $constValue) { - if (mb_strpos($constKey, '_' . $clModuleNameUpper . '_') > 0) { + if (mb_strpos($constKey, '_' . $modNameUpper . '_') > 0) { $moduleConstants[$constKey] = $constKey; } } //get all php and tpl files from module - $check_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName; + $check_path = \XOOPS_ROOT_PATH . '/modules/' . $modName; $Directory = new RecursiveDirectoryIterator($check_path); $Iterator = new RecursiveIteratorIterator($Directory); $regexFiles = new RegexIterator($Iterator, '/^.+\.(php|tpl)$/i', RecursiveRegexIterator::GET_MATCH); @@ -103,7 +108,7 @@ } if (0 == $foundMod) { //search for concatenated string - $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey); + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey); foreach ($modfiles as $modfile) { if (mb_strpos(file_get_contents($modfile), $needle) !== false) { $foundMod = 1; @@ -114,7 +119,7 @@ } if (0 == $foundMod) { //search for concatenated string - $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey); + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey); foreach ($modfiles as $modfile) { if (mb_strpos(file_get_contents($modfile), $needle) !== false) { $foundMod = 1; @@ -131,7 +136,7 @@ } if ('' == $foundLang) { //search for concatenated string - $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey); + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey); foreach ($langfiles as $langfile) { if (mb_strpos(file_get_contents($langfile), $needle) !== false) { $foundLang = $langfile; @@ -141,7 +146,7 @@ } if ('' == $foundLang) { //search for concatenated string - $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey); + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey); foreach ($langfiles as $langfile) { if (mb_strpos(file_get_contents($langfile), $needle) !== false) { $foundLang = $langfile; @@ -156,15 +161,32 @@ break; case 'tab_replacer': - $tabModule = Request::getString('tab_module'); - $src_path = \XOOPS_ROOT_PATH . '/modules/' . $tabModule; + $modName = Request::getString('tab_module'); + if ('' === $modName) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD); + } + $src_path = \XOOPS_ROOT_PATH . '/modules/' . $modName; $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/'; @\mkdir($dst_path); - $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/' . $tabModule; + $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/' . $modName; @\mkdir($dst_path); Devtools::function_tabreplacer($src_path, $dst_path); - \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS); + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_TAB_SUCCESS); + break; + case 'remove_prefix': + $modName = Request::getString('rp_module'); + if ('' === $modName) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD); + } + $src_path = \XOOPS_ROOT_PATH . '/modules/' . $modName; + $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/'; + @\mkdir($dst_path); + $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/' . $modName; + @\mkdir($dst_path); + + Devtools::function_removeprefix($src_path, $dst_path, $modName); + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_RP_SUCCESS); break; case 'list': default: @@ -173,12 +195,20 @@ $GLOBALS['xoopsTpl']->assign('fq_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC)); $fq_form = Devtools::getFormModulesFq(); $GLOBALS['xoopsTpl']->assign('fq_form', $fq_form->render()); + $cl_form = Devtools::getFormModulesCl(); $GLOBALS['xoopsTpl']->assign('cl_form', $cl_form->render()); - $tab_form = Devtools::getFormModulesTab(); - $GLOBALS['xoopsTpl']->assign('tab_form', $tab_form->render()); + $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/'; $GLOBALS['xoopsTpl']->assign('tab_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC)); + $tab_form = Devtools::getFormModulesTab(); + $GLOBALS['xoopsTpl']->assign('tab_form', $tab_form->render()); + + $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/'; + $GLOBALS['xoopsTpl']->assign('rp_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_RP_DESC)); + $tab_form = Devtools::getFormModulesRemovePrefix(); + $GLOBALS['xoopsTpl']->assign('rp_form', $tab_form->render()); + $GLOBALS['xoopsTpl']->assign('devtools_list', true); break; diff --git a/class/Devtools.php b/class/Devtools.php index d430211e..2774be4a 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -32,14 +32,94 @@ */ class Devtools { + + /* function to remove prefix from table field names */ + + /** + * @param $src_path + * @param $dst_path + * @param $moduleDirName + */ + public static function function_removeprefix($src_path, $dst_path, $moduleDirName): void + { + $fieldNames = []; + + $helper = \XoopsModules\Modulebuilder\Helper::getInstance(); + // get module id + $crModules = new \CriteriaCompo(); + $crModules->add(new \Criteria('mod_dirname', $moduleDirName)); + $modulesAll = $helper->getHandler('Modules')->getAll($crModules); + $modId = 0; + foreach (\array_keys($modulesAll) as $i) { + $modId = $modulesAll[$i]->getVar('mod_id'); + } + if (0 === $modId) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD); + } + // get module tables + $crTables = new \CriteriaCompo(); + $crTables->add(new \Criteria('table_mid', $modId)); + $tablesAll = $helper->getHandler('Tables')->getAll($crTables); + $tablesArr = []; + foreach (\array_keys($tablesAll) as $j) { + $tablesArr[$j] = $tablesAll[$j]->getVar('table_name'); + } + + foreach ($tablesArr as $key => $value) { + $crFields = new \CriteriaCompo(); + $crFields->add(new \Criteria('field_tid', $key)); + $fieldsAll = $helper->getHandler('Fields')->getAll($crFields); + foreach (\array_keys($fieldsAll) as $k) { + $fieldName = $fieldsAll[$k]->getVar('field_name'); + if (\mb_strpos($fieldName, '_')) { + $str = \mb_strpos($fieldName, '_'); + if (false !== $str) { + $rpFieldName = \mb_substr($fieldName, $str + 1, \mb_strlen($fieldName)); + } + } + // for getVar, setVar,.... + $fieldNames["'" . $fieldName . "'"] = "'" . $rpFieldName . "'"; + // for tpl files + if ($rpFieldName=='id') echo "
    v1:" . '<{$' . $value . '.' . $fieldName . '}>'; + $fieldNames['<{$' . $value . '.' . $fieldName . '}>'] = '<{$' . $value . '.' . $rpFieldName . '}>'; + // for sql file + $fieldNames['`' . $fieldName . '`'] = '`' . $rpFieldName . '`'; + } + } + + $fieldNames2 = []; + $fieldNames2['<{$testfield.tf_id}>'] = '<{$testfield.id}>';/**/ + echo '
    v2:<{$testfield.tf_id}>'; + + // repair known errors + $errors = []; + + $patterns = []; + foreach ($fieldNames as $key => $value) { + $patterns[$key] = $value; + } + //add errors + foreach ($errors as $key => $value) { + $patterns[$key] = $value; + } + + $patKeys = \array_keys($patterns); + $patValues = \array_values($patterns); + $extensions = []; + $extensions[] = 'php'; + $extensions[] = 'tpl'; + $extensions[] = 'sql'; + self::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues, false, $extensions); + } + /* function to add function qualifier to module */ /** * @param $src_path * @param $dst_path - * @param $moduleName + * @param $moduleDirName */ - public static function function_qualifier($src_path, $dst_path, $moduleName): void + public static function function_qualifier($src_path, $dst_path, $moduleDirName): void { $functions = []; $constants = []; @@ -193,14 +273,14 @@ public static function function_qualifier($src_path, $dst_path, $moduleName): vo 'XOOPS_GROUP_', ]; - $moduleNameUpper = \mb_strtoupper($moduleName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); // module language defines $constants[] = [ - '_AM_' . $moduleNameUpper .'_', - '_MI_' . $moduleNameUpper .'_', - '_MB_' . $moduleNameUpper .'_', - '_MA_' . $moduleNameUpper .'_', - $moduleNameUpper .'_', + '_AM_' . $moduleDirNameUpper .'_', + '_MI_' . $moduleDirNameUpper .'_', + '_MB_' . $moduleDirNameUpper .'_', + '_MA_' . $moduleDirNameUpper .'_', + $moduleDirNameUpper .'_', ]; // xoops objects @@ -260,16 +340,16 @@ public static function function_qualifier($src_path, $dst_path, $moduleName): vo '\strr\chr(' => '\strrchr(', 'strf\time(' => 'strftime(', 'filem\time' => 'filemtime', - "_AM_\\" . $moduleNameUpper .'_' => "_AM_" . $moduleNameUpper .'_', - "_MI_\\" . $moduleNameUpper .'_' => "_MI_" . $moduleNameUpper .'_', - "_MB_\\" . $moduleNameUpper .'_' => "_MB_" . $moduleNameUpper .'_', - "_MA_\\" . $moduleNameUpper .'_' => "_MA_" . $moduleNameUpper .'_', - "CO_\\" . $moduleNameUpper .'_' => "CO_" . $moduleNameUpper .'_', - "'\\" . $moduleNameUpper .'_' => "'" . $moduleNameUpper .'_', - "'\_AM_\\" . $moduleNameUpper .'_' => "'_AM_" . $moduleNameUpper .'_', - "'\_MI_\\" . $moduleNameUpper .'_' => "'_MI_" . $moduleNameUpper .'_', - "'\_MB_\\" . $moduleNameUpper .'_' => "'_MB_" . $moduleNameUpper .'_', - "'\_MA_\\" . $moduleNameUpper .'_' => "'_MA_" . $moduleNameUpper .'_', + "_AM_\\" . $moduleDirNameUpper .'_' => "_AM_" . $moduleDirNameUpper .'_', + "_MI_\\" . $moduleDirNameUpper .'_' => "_MI_" . $moduleDirNameUpper .'_', + "_MB_\\" . $moduleDirNameUpper .'_' => "_MB_" . $moduleDirNameUpper .'_', + "_MA_\\" . $moduleDirNameUpper .'_' => "_MA_" . $moduleDirNameUpper .'_', + "CO_\\" . $moduleDirNameUpper .'_' => "CO_" . $moduleDirNameUpper .'_', + "'\\" . $moduleDirNameUpper .'_' => "'" . $moduleDirNameUpper .'_', + "'\_AM_\\" . $moduleDirNameUpper .'_' => "'_AM_" . $moduleDirNameUpper .'_', + "'\_MI_\\" . $moduleDirNameUpper .'_' => "'_MI_" . $moduleDirNameUpper .'_', + "'\_MB_\\" . $moduleDirNameUpper .'_' => "'_MB_" . $moduleDirNameUpper .'_', + "'\_MA_\\" . $moduleDirNameUpper .'_' => "'_MA_" . $moduleDirNameUpper .'_', 'namespace \XoopsModules' => 'namespace XoopsModules', 'use \Xoops' => 'use Xoops', "'\XOOPS_" => "'XOOPS_", @@ -346,7 +426,7 @@ public static function function_tabreplacer($src_path, $dst_path): void * @param array $patValues * @param bool $replaceTabs */ - public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues = [], $replaceTabs = false): void + public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues = [], $replaceTabs = false, $extensions = ['php']): void { // open the source directory $dir = \opendir($src_path); @@ -357,9 +437,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 - self::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs); + self::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs, $extensions); } else { - self::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs); + self::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs, $extensions); } } } @@ -373,11 +453,10 @@ public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $pat * @param array $patValues * @param bool $replaceTabs */ - private static function cloneFile($src_file, $dst_file, $patKeys = [], $patValues = [], $replaceTabs = false): void + private static function cloneFile($src_file, $dst_file, $patKeys, $patValues, $replaceTabs, $extensions): void { $replace_code = false; - $changeExtensions = ['php']; - if (\in_array(\mb_strtolower(\pathinfo($src_file, PATHINFO_EXTENSION)), $changeExtensions)) { + if (\in_array(\mb_strtolower(\pathinfo($src_file, PATHINFO_EXTENSION)), $extensions)) { $replace_code = true; } if (\mb_strpos($dst_file, \basename(__FILE__)) > 0) { @@ -489,4 +568,33 @@ public static function getFormModulesTab($action = false) return $form; } + + /** + * get form with all existing modules + * @param bool $action + * @return \XoopsSimpleForm + */ + public static function getFormModulesRemovePrefix($action = false) + { + if (!$action) { + $action = $_SERVER['REQUEST_URI']; + } + // Get Theme Form + \xoops_load('XoopsFormLoader'); + $form = new \XoopsSimpleForm('', 'form', $action, 'post', true); + $form->setExtra('enctype="multipart/form-data"'); + // Form Select Module + $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_RP_MODULE, 'rp_module', ''); + $modulesArr = \XoopsLists::getModulesList(); + $modulesSelect->addOption('', ' '); + foreach ($modulesArr as $mod) { + $modulesSelect->addOption($mod, $mod); + } + $form->addElement($modulesSelect, true); + // To Save + $form->addElement(new \XoopsFormHidden('op', 'remove_prefix')); + $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); + + return $form; + } } diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 32424373..7f2e0244 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -157,7 +157,7 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole $trClose = $this->hc->getHtmlEmpty('
    ', $t . "\t\t\t\t\t", "\n"); $td .= $this->sc->getSmartyConditions('smarty.foreach.' . $tableSoleName . '.iteration', ' is div by ', '$divideby', $trClose, false, false, false, $t . "\t\t\t\t", "\n", true, false); $foreach = $this->hc->getHtmlComment('Start new link loop',$t . "\t\t\t", "\n"); - $foreach .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $td, $tableSoleName,'',"\t\t\t"); + $foreach .= $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $td, $tableSoleName,'',"\t\t\t"); $foreach .= $this->hc->getHtmlComment('End new link loop',$t . "\t\t\t", "\n"); $tr = $this->hc->getHtmlTableRow($foreach, '',$t . "\t\t"); diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index 30afddb1..e35239d3 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -134,12 +134,12 @@ private function getTemplatesUserPagesTableThead($tableName, $language) private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) { $single = $this->sc->getSmartySingleVar('panel_type'); - $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false, "\t\t\t\t\t\t"); + $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false, "\t\t\t\t\t\t", "\n", $tableSoleName . '=$' . $tableSoleName); $div = $this->hc->getHtmlDiv($include, 'panel panel-' . $single, "\t\t\t\t\t"); $cont = $this->hc->getHtmlTableData($div, '', '', "\t\t\t\t", "\n", true); $html = $this->hc->getHtmlEmpty('', "\t\t\t\t\t", "\n"); $cont .= $this->sc->getSmartyConditions('smarty.foreach.' . $tableSoleName . '.iteration', ' is div by ', '$divideby', $html, '', '', '',"\t\t\t\t", "\n", true, false); - $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont, $tableSoleName,'',"\t\t\t\t"); + $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $cont, $tableSoleName,'',"\t\t\t\t"); $tr = $this->hc->getHtmlTableRow($foreach,'',"\t\t\t"); return $this->hc->getHtmlTableTbody($tr,'',"\t\t"); diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index 3e55b44d..245dbe36 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -176,10 +176,10 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) $condIf .= $this->xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int', false, "\t"); $condIf .= $this->xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', "\t"); $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, "\t"); - $condIf .= $this->pc->getPhpCodeArray($tableName, null, false, "\t"); + $condIf .= $this->pc->getPhpCodeArray($tableName . '_list', null, false, "\t"); $foreach = $this->xc->getXcGetValues($tableName, $tableSoleName, 'i', false, "\t\t"); $foreach .= $this->pc->getPhpCodeArray('acount', ["'count'", '$count']); - $foreach .= $this->pc->getPhpCodeArrayType($tableName, 'merge', $tableSoleName, '$acount'); + $foreach .= $this->pc->getPhpCodeArrayType($tableName . '_list', 'merge', $tableSoleName . '_list', '$acount'); // Fields $fieldMain = ''; foreach (\array_keys($fields) as $f) { @@ -191,7 +191,7 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) $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->xc->getXcXoopsTplAssign($tableName . '_list', '$' . $tableName . '_list', true, "\t"); $condIf .= $this->pc->getPhpCodeUnset($tableName, "\t"); $condIf .= $this->xc->getXcPageNav($tableName, "\t"); $thereare = $this->pc->getPhpCodeSprintf("{$language}INDEX_THEREARE", "\${$tableName}Count"); diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 7854ae2b..167827e3 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -198,10 +198,10 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $contIf .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' === ', '0', $contIf, false, $t); $ret .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t); - $condIf = $this->pc->getPhpCodeArray($tableName, null, false, $t . "\t"); + $condIf = $this->pc->getPhpCodeArray($tableName . 'List', null, false, $t . "\t"); $condIf .= $this->xc->getXcEqualsOperator("\${$ccFieldMain}", "''",'', $t . "\t"); $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, $t . "\t"); - $foreach = $this->xc->getXcGetValues($tableName, $tableName . '[$i]', 'i', false, $t . "\t\t"); + $foreach = $this->xc->getXcGetValues($tableName, $tableName . 'List' . '[$i]', 'i', false, $t . "\t\t"); $foreach .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}All[\$i]", $fieldMain, false, $t . "\t\t"); $foreach .= $this->xc->getXcEqualsOperator('$keywords[$i]', "\${$ccFieldMain}",'', $t . "\t\t"); if ($tableRate) { @@ -210,8 +210,8 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $foreach .= $this->xc->getXcEqualsOperator("\${$tableName}[\$i]['rating']", "\$ratingsHandler->getItemRating({$itemId}, {$const})",'', $t . "\t\t"); } $condIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t . "\t"); - $condIf .= $this->xc->getXcXoopsTplAssign($tableName, "\${$tableName}", true, $t . "\t"); - $condIf .= $this->pc->getPhpCodeUnset($tableName, $t . "\t"); + $condIf .= $this->xc->getXcXoopsTplAssign($tableName . '_list', "\${$tableName}List", true, $t . "\t"); + $condIf .= $this->pc->getPhpCodeUnset($tableName . 'List', $t . "\t"); $condIf .= $this->xc->getXcPageNav($tableName, $t . "\t"); $config = $this->xc->getXcGetConfig('table_type'); $condIf .= $this->xc->getXcXoopsTplAssign('table_type', $config, true, $t . "\t"); diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 2434b333..2ffd5655 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -157,8 +157,8 @@ public function getUserPrint($moduleDirname, $language) $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); $noPerm .= $this->getSimpleString('exit();', "\t"); $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); - $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName, '', true); - $ret .= $this->xc->getXcXoopsTplAppend($tableName . '_list', '$' . $tableSoleName); + $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName . 'List', '', true); + $ret .= $this->xc->getXcXoopsTplAppend($tableName . '_list', '$' . $tableSoleName . 'List'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcXoopsTplAssign('xoops_sitename', "\$GLOBALS['xoopsConfig']['sitename']"); $getVar = $this->xc->getXcGetVar('', $tableName, $fieldMain, true); diff --git a/docs/changelog.txt b/docs/changelog.txt index 2a85bd51..3c850884 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -3,6 +3,7 @@ - moved to singular table names (mamba/goffy) - create nicer mysql.sql (goffy) - added trailing '_text' for output of prepared text (goffy) + - fixed bugs with foreach in tpl caused by singular table names (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) diff --git a/language/english/admin.php b/language/english/admin.php index 92bcc085..4af9c584 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -446,6 +446,7 @@ // // ------------------- Devtools --------------------------------- // \define('_AM_MODULEBUILDER_DEVTOOLS', 'Developer Tools'); +\define('_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD', 'No valid module selected'); \define('_AM_MODULEBUILDER_DEVTOOLS_FQ', 'Add function qualifiers to modules'); \define('_AM_MODULEBUILDER_DEVTOOLS_FQ_MODULE', 'Select module to add function qualifiers'); \define('_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC', 'This tool creates a copy of selected module in %s and add function qualifiers to the php functions'); @@ -462,7 +463,11 @@ \define('_AM_MODULEBUILDER_DEVTOOLS_TAB', 'Replace tab by 4 spaces'); \define('_AM_MODULEBUILDER_DEVTOOLS_TAB_MODULE', 'Select module to replace tabs'); \define('_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC', 'This tool creates a copy of selected module in %s and replace tab by 4 spaces'); - +\define('_AM_MODULEBUILDER_DEVTOOLS_TAB_SUCCESS', 'Function replace tabs successfully added to copy of module'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP', 'Remove prefix from table field names'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_MODULE', 'Select module to remove prefix'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_DESC', 'This tool creates a copy of selected module in %s and remove prefix from table field names'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_SUCCESS', 'Function remove prefix tabs successfully added to copy of module'); // -------------------- IMPORT MODULE ----------------------------------- \define('_AM_MODULEBUILDER_MODULES_IMPORT', 'Import Module'); diff --git a/templates/admin/modulebuilder_devtools.tpl b/templates/admin/modulebuilder_devtools.tpl index 17dba8d8..a6ad8ea7 100644 --- a/templates/admin/modulebuilder_devtools.tpl +++ b/templates/admin/modulebuilder_devtools.tpl @@ -36,6 +36,13 @@
    + + + +
    - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}> - <{$smarty.const._ADD}> + <{$smarty.const._ADD}> - <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}>
    <{includeq file="db:modulebuilder_tables_item.tpl" module=$module}><{include file="db:modulebuilder_tables_item.tpl" module=$module}>
    - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}>
    ' . $i . '' . $fieldName->render() . '
    <{$tab_form}>
    +
    <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_RP}>
    +

    <{$rp_desc}>

    +
    <{$rp_form}>
    <{/if}> <{if $clresults|default:''}> From acd93a49caf6e1666065780e3bd9d87e3caf8c80 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Mon, 12 Feb 2024 23:38:26 +0100 Subject: [PATCH 238/266] various fixes --- admin/devtools.php | 2 +- class/Devtools.php | 51 ++++++++++--------- class/Files/Classes/ClassFormElements.php | 3 ++ class/Files/CreateSmartyCode.php | 4 +- .../Blocks/Defstyle/TemplatesBlocks.php | 2 +- .../Defstyle/TemplatesBlocksSpotlight.php | 2 +- .../Files/Templates/User/Defstyle/Footer.php | 4 +- .../Templates/User/Defstyle/PagesItem.php | 1 + .../Templates/User/Defstyle/PagesList.php | 2 + class/Files/User/UserIndex.php | 14 ++--- 10 files changed, 48 insertions(+), 37 deletions(-) diff --git a/admin/devtools.php b/admin/devtools.php index a2714483..0a11ba92 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -185,7 +185,7 @@ $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/' . $modName; @\mkdir($dst_path); - Devtools::function_removeprefix($src_path, $dst_path, $modName); + Devtools::function_removeprefix($src_path, $src_path, $modName); \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_RP_SUCCESS); break; case 'list': diff --git a/class/Devtools.php b/class/Devtools.php index 2774be4a..3fabf2d2 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -42,7 +42,8 @@ class Devtools */ public static function function_removeprefix($src_path, $dst_path, $moduleDirName): void { - $fieldNames = []; + $patKeys = []; + $patValues = []; $helper = \XoopsModules\Modulebuilder\Helper::getInstance(); // get module id @@ -78,33 +79,37 @@ public static function function_removeprefix($src_path, $dst_path, $moduleDirNam } } // for getVar, setVar,.... - $fieldNames["'" . $fieldName . "'"] = "'" . $rpFieldName . "'"; + $patKeys[] = "'" . $fieldName . "'"; + $patValues[] = "'" . $rpFieldName . "'"; + $patKeys[] = 'showImgSelected(\"imglabel_' . $fieldName . '\",'; + $patValues[] = 'showImgSelected(\"imglabel_' . $rpFieldName . '\",'; + $patKeys[] = '\"' . $fieldName . '\",'; + $patValues[] = '\"' . $rpFieldName . '\",'; + $patKeys[] = "id='imglabel_" . $fieldName . "' alt="; + $patValues[] = "id='imglabel_" . $rpFieldName . "' alt="; + $patKeys[] = "sort = '" . $fieldName . ' ASC,'; + $patValues[] = "sort = '" . $rpFieldName . ' ASC,'; + $patKeys[] = 'ASC, ' . $fieldName . "', \$order"; + $patValues[] = 'ASC, ' . $rpFieldName . "', \$order"; // for tpl files - if ($rpFieldName=='id') echo "
    v1:" . '<{$' . $value . '.' . $fieldName . '}>'; - $fieldNames['<{$' . $value . '.' . $fieldName . '}>'] = '<{$' . $value . '.' . $rpFieldName . '}>'; + if ($rpFieldName=='id') { + $patKeys[] = 'op=edit&' . $fieldName . '='; + $patValues[] = 'op=edit&' . $rpFieldName . '='; + $patKeys[] = 'op=show&' . $fieldName . '='; + $patValues[] = 'op=show&' . $rpFieldName . '='; + $patKeys[] = 'op=delete&' . $fieldName . '='; + $patValues[] = 'op=delete&' . $rpFieldName . '='; + $patKeys[] = 'op=broken&' . $fieldName . '='; + $patValues[] = 'op=broken&' . $rpFieldName . '='; + $patKeys[] = 'op=clone&' . $fieldName . '_source='; + $patValues[] = 'op=clone&' . $rpFieldName . '_source='; + } // for sql file - $fieldNames['`' . $fieldName . '`'] = '`' . $rpFieldName . '`'; + $patKeys[] = '`' . $fieldName . '`'; + $patValues[] = '`' . $rpFieldName . '`'; } } - $fieldNames2 = []; - $fieldNames2['<{$testfield.tf_id}>'] = '<{$testfield.id}>';/**/ - echo '
    v2:<{$testfield.tf_id}>'; - - // repair known errors - $errors = []; - - $patterns = []; - foreach ($fieldNames as $key => $value) { - $patterns[$key] = $value; - } - //add errors - foreach ($errors as $key => $value) { - $patterns[$key] = $value; - } - - $patKeys = \array_keys($patterns); - $patValues = \array_values($patterns); $extensions = []; $extensions[] = 'php'; $extensions[] = 'tpl'; diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index f85749d1..84a71702 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -776,6 +776,9 @@ private function getXoopsFormTable($language,$fieldName, $fieldElement, $require $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret .= $this->xc->getXcHandlerLine($rpFieldelementName, $t); $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); + if ('' === $required || 'false' === $required) { + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "0, ' '", $t); + } $ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', "\${$rpFieldelementName}Handler->getList()", $t); $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index fe49324b..852512ec 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -167,9 +167,9 @@ public function getSmartySingleVar($var, $t = '', $n = '', $default = 'false') * @param string $n * @return string */ - public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '') + public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '', $default = '') { - return "{$t}<{\${$leftVar}.{$rightVar}}>{$n}"; + return "{$t}<{\${$leftVar}.{$rightVar}|default:false}>{$n}"; } /** diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 158d9583..73fdd5b8 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -202,7 +202,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi $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|default:0', ' > ', '0', $tbody, false, true, true, "\t"); } /** diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php index d4a693e0..52870a49 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -204,7 +204,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi $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|default:0", ' > ', '0', $tbody, false, true, true, "\t"); } /** diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index babc912a..4626891a 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -108,12 +108,12 @@ public function getTemplateUserFooterFacebookShareButton() */ private function getTemplateUserFooterContent($language) { - $ret = $this->hc->getHtmlDiv('<{$copyright}>', 'pull-left', '', "\n", false); + $ret = $this->hc->getHtmlDiv('<{$copyright|default:false}>', 'pull-left', '', "\n", false); $ret .= $this->hc->getHtmlEmpty("\n"); $contIf = $this->hc->getHtmlDiv('<{$pagenav}>', 'pull-right', "\t", "\n", false); $ret .= $this->sc->getSmartyConditions('pagenav', '', '', $contIf); $ret .= $this->hc->getHtmlEmpty("
    \n"); - $contIf = $this->hc->getHtmlDiv("
    <{\$smarty.const.{$language}ADMIN}>", 'text-center bold', "\t", "\n", false); + $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, "\t\t\t"); diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index 1f38c52d..eca6b5f2 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -272,6 +272,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table } } + $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $this->getRightString($fieldId)); $anchors = ''; $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); $contIf = $this->hc->getHtmlAnchor($tableName . '.php?op=list&start=<{$start}>&limit=<{$limit}>#' .$ccFieldId . '_' . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index eb08fef2..1bfe3403 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -266,6 +266,8 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table } } } + + $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $this->getRightString($fieldId)); $lang = $this->sc->getSmartyConst($language, 'DETAILS'); $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-primary'); $retFoot .= $this->hc->getHtmlSpan($anchor, 'col-sm-12',"\t"); diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index 245dbe36..fef248b5 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -137,7 +137,7 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS $contentIf .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/tree', true, false, 'require', "\t"); //$contentIf .= $cc->getClassXoopsObjectTree('mytree', $tableName, $fieldId, $fieldParent, "\t"); $contentIf .= $this->pc->getPhpCodeArray($tableName, "\t"); - $foreach = $this->xc->getXcGetValues($tableName, $tableSoleName . 'Values', $tableFieldname, false, "\t\t"); + $foreach = $this->xc->getXcGetValues($tableName.'aaa', $tableSoleName.'bbb' . 'Values', $tableFieldname, false, "\t\t"); $foreach .= $this->pc->getPhpCodeArray('acount', ["'count'", '$count']); $foreach .= $this->pc->getPhpCodeArrayType($tableName, 'merge', $tableSoleName . 'Values', '$acount'); $foreach .= $this->getSimpleString('++$count;', "\t\t"); @@ -170,16 +170,16 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) $ret = $this->pc->getPhpCodeCommentLine('Tables'); $ret .= $this->xc->getXcHandlerCountObj($tableName); $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count"); - $ret .= $this->getSimpleString('$count = 1;'); + //$ret .= $this->getSimpleString('$count = 1;'); $condIf = $this->xc->getXcXoopsRequest('start', 'start', '', 'Int', false, "\t"); $userpager = $this->xc->getXcGetConfig('userpager'); $condIf .= $this->xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int', false, "\t"); $condIf .= $this->xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', "\t"); $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, "\t"); $condIf .= $this->pc->getPhpCodeArray($tableName . '_list', null, false, "\t"); - $foreach = $this->xc->getXcGetValues($tableName, $tableSoleName, 'i', false, "\t\t"); - $foreach .= $this->pc->getPhpCodeArray('acount', ["'count'", '$count']); - $foreach .= $this->pc->getPhpCodeArrayType($tableName . '_list', 'merge', $tableSoleName . '_list', '$acount'); + $foreach = $this->xc->getXcGetValues($tableName, $tableSoleName . '_list[]', 'i', false, "\t\t"); + //$foreach .= $this->pc->getPhpCodeArray('acount', ["'count'", '$count']); + //$foreach .= $this->pc->getPhpCodeArrayType($tableName . '_list', 'merge', $tableSoleName . '_list', '$acount'); // Fields $fieldMain = ''; foreach (\array_keys($fields) as $f) { @@ -189,7 +189,7 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) } } $foreach .= $this->xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, "\t\t"); - $foreach .= $this->getSimpleString('++$count;', "\t\t"); + //$foreach .= $this->getSimpleString('++$count;', "\t\t"); $condIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, "\t"); $condIf .= $this->xc->getXcXoopsTplAssign($tableName . '_list', '$' . $tableName . '_list', true, "\t"); $condIf .= $this->pc->getPhpCodeUnset($tableName, "\t"); @@ -201,7 +201,7 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) $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'); + //$ret .= $this->pc->getPhpCodeUnset('count'); $tableType = $this->xc->getXcGetConfig('table_type'); $ret .= $this->xc->getXcXoopsTplAssign('table_type', $tableType); From 8ba85944c05fd04cc442a17ecb71013cc9b75db9 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 14 Feb 2024 22:33:54 +0100 Subject: [PATCH 239/266] update smarty default values --- class/Devtools.php | 7 +++++-- class/Files/CreateSmartyCode.php | 8 ++++++-- .../Templates/Admin/TemplatesAdminPages.php | 2 +- .../Templates/User/Defstyle/CategoriesList.php | 2 +- class/Files/Templates/User/Defstyle/Index.php | 2 +- .../Files/Templates/User/Defstyle/PagesItem.php | 17 ++++++++--------- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/class/Devtools.php b/class/Devtools.php index 3fabf2d2..86ee6c64 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -66,9 +66,9 @@ public static function function_removeprefix($src_path, $dst_path, $moduleDirNam $tablesArr[$j] = $tablesAll[$j]->getVar('table_name'); } - foreach ($tablesArr as $key => $value) { + foreach ($tablesArr as $tid => $tablename) { $crFields = new \CriteriaCompo(); - $crFields->add(new \Criteria('field_tid', $key)); + $crFields->add(new \Criteria('field_tid', $tid)); $fieldsAll = $helper->getHandler('Fields')->getAll($crFields); foreach (\array_keys($fieldsAll) as $k) { $fieldName = $fieldsAll[$k]->getVar('field_name'); @@ -104,6 +104,9 @@ public static function function_removeprefix($src_path, $dst_path, $moduleDirNam $patKeys[] = 'op=clone&' . $fieldName . '_source='; $patValues[] = 'op=clone&' . $rpFieldName . '_source='; } + //<{$article.art_id|default:false}> + $patKeys[] = '<{$' . $tablename . '.' . $fieldName . '|default:false}>'; + $patValues[] = '<{$' . $tablename . '.' . $rpFieldName . '|default:false}>'; // for sql file $patKeys[] = '`' . $fieldName . '`'; $patValues[] = '`' . $rpFieldName . '`'; diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index 852512ec..3d3eaa74 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -167,9 +167,9 @@ public function getSmartySingleVar($var, $t = '', $n = '', $default = 'false') * @param string $n * @return string */ - public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '', $default = '') + public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '', $default = 'false') { - return "{$t}<{\${$leftVar}.{$rightVar}|default:false}>{$n}"; + return "{$t}<{\${$leftVar}.{$rightVar}|default:{$default}}>{$n}"; } /** @@ -250,6 +250,8 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', $ret = "{$t}<{if \${$condition}"; if ('string' === $default) { $ret .= "|default:''"; + } elseif ('bool' === $default) { + $ret .= '|default:false'; } elseif ('int' === $default) { $ret .= '|default:0'; } @@ -258,6 +260,8 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', $ret = "{$t}<{if {$condition}"; if ('string' === $default) { $ret .= "|default:''"; + } elseif ('bool' === $default) { + $ret .= '|default:false'; } elseif ('int' === $default) { $ret .= '|default:0'; } diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 03901aed..9f78fbae 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -214,7 +214,7 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'edit.png'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $lang . ' ' . $tableName], '', true,'', ''); - $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double . '&start=<{$start}>&limit=<{$limit}>', 'title' => $lang], $img, false, "\t\t\t\t\t"); + $anchor = $this->hc->getHtmlTag('a', ['href' => $tableName . ".php?op=edit&{$fieldId}=" . $double . '&start=<{$start|default:0}>&limit=<{$limit|default:0}>', 'title' => $lang], $img, false, "\t\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_CLONE'); $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'editcopy.png'"); diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php index aa422fd4..099f2244 100644 --- a/class/Files/Templates/User/Defstyle/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -86,7 +86,7 @@ private function getTemplatesUserCategoriesListStartTable() { $ret = << - \n +
    \n EOT; return $ret; diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 7f2e0244..3830516b 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -161,7 +161,7 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole $foreach .= $this->hc->getHtmlComment('End new link loop',$t . "\t\t\t", "\n"); $tr = $this->hc->getHtmlTableRow($foreach, '',$t . "\t\t"); - $table .= $this->hc->getHtmlTable($tr, 'table table-<{$table_type}>', $t . "\t"); + $table .= $this->hc->getHtmlTable($tr, "table table-<{\$table_type|default:''}>", $t . "\t"); $ret .= $this->sc->getSmartyConditions($tableName . 'Count', ' > ','0', $table, false, false, false, '', "\n", true, 'int'); return $ret; diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index eca6b5f2..f0197d4d 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -108,7 +108,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table if (0 == $f) { $fieldId = $fields[$f]->getVar('field_name'); $ccFieldId = $this->getCamelCase($fieldId, false, true); - $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $fieldId); + $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $this->getRightString($fieldId)); } $fieldElement = $fields[$f]->getVar('field_element'); if (1 == $fields[$f]->getVar('field_user')) { @@ -272,29 +272,28 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table } } - $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $this->getRightString($fieldId)); $anchors = ''; $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); - $contIf = $this->hc->getHtmlAnchor($tableName . '.php?op=list&start=<{$start}>&limit=<{$limit}>#' .$ccFieldId . '_' . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $contIf = $this->hc->getHtmlAnchor($tableName . '.php?op=list&start=<{$start|default:0}>&limit=<{$limit|default:0}>#' .$ccFieldId . '_' . $keyDouble, $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst($language, 'DETAILS'); - $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); - $anchors .= $this->sc->getSmartyConditions('showItem', '', '', $contIf, $contElse, '', '', "\t\t"); + $contElse = $this->hc->getHtmlAnchor($tableName . ".php?op=show&{$fieldId}=" . $keyDouble . '&start=<{$start|default:0}>&limit=<{$limit|default:0}>', $lang, $lang, '', 'btn btn-success right', '', "\t\t\t", "\n"); + $anchors .= $this->sc->getSmartyConditions('showItem', '', '', $contIf, $contElse, '', '', "\t\t", "\n", true, 'bool'); $lang = $this->sc->getSmartyConst('', '_EDIT'); - $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); + $contIf = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$fieldId}=" . $keyDouble . '&start=<{$start|default:0}>&limit=<{$limit|default:0}>', $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_CLONE'); $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=clone&{$fieldId}_source=" . $keyDouble, $lang, $lang, '', 'btn btn-primary right', '', "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_DELETE'); $contIf .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$fieldId}=" . $keyDouble, $lang, $lang, '', 'btn btn-danger right', '', "\t\t\t", "\n"); - $anchors .= $this->sc->getSmartyConditions('permEdit', '', '', $contIf, false, '', '', "\t\t"); + $anchors .= $this->sc->getSmartyConditions('permEdit', '', '', $contIf, false, '', '', "\t\t", "\n", true, 'bool'); if (1 == $tableBroken) { $lang = $this->sc->getSmartyConst($language, 'BROKEN'); - $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble . '&start=<{$start}>&limit=<{$limit}>', $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); + $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble . '&start=<{$start|default:0}>&limit=<{$limit|default:0}>', $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); } $retFoot .= $this->hc->getHtmlDiv($anchors, 'col-sm-12 right',"\t"); $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); if ($tableRate) { $rate = $this->sc->getSmartyIncludeFile($moduleDirname, 'rate', false, "\t", "\n", 'item=$' . $tableSoleName); - $ret .= $this->sc->getSmartyConditions('rating', '', '', $rate, false); + $ret .= $this->sc->getSmartyConditions('rating', '', '', $rate, false, false, false, '', "\n", true, 'bool'); } return $ret; From eee9bc828690678cc34e10ca8febebcaa340f317 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Sat, 16 Mar 2024 12:22:53 +0100 Subject: [PATCH 240/266] added devtool for removing prefix from table field names --- admin/devtools.php | 23 ++++++++++++++++------- class/Devtools.php | 28 ++++++++++++++++++---------- docs/changelog.txt | 1 + language/english/admin.php | 8 ++++++-- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/admin/devtools.php b/admin/devtools.php index 0a11ba92..fb176e14 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -176,16 +176,25 @@ break; case 'remove_prefix': $modName = Request::getString('rp_module'); + $rpDest = Request::getInt('rp_dest'); if ('' === $modName) { \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_INVALID_MOD); } $src_path = \XOOPS_ROOT_PATH . '/modules/' . $modName; - $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/'; - @\mkdir($dst_path); - $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/' . $modName; - @\mkdir($dst_path); - Devtools::function_removeprefix($src_path, $src_path, $modName); + if (1 === $rpDest) { + $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/'; + if (!\mkdir($dst_path) && !\is_dir($dst_path)) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_RP_ERROR); + } + $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/' . $modName; + if (!\mkdir($dst_path) && !\is_dir($dst_path)) { + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_RP_ERROR); + } + } else { + $dst_path = $src_path; + } + Devtools::function_removeprefix($src_path, $dst_path, $modName); \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_RP_SUCCESS); break; case 'list': @@ -205,8 +214,8 @@ $GLOBALS['xoopsTpl']->assign('tab_form', $tab_form->render()); $dst_path = TDMC_UPLOAD_PATH . '/devtools/remove_prefix/'; - $GLOBALS['xoopsTpl']->assign('rp_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_RP_DESC)); - $tab_form = Devtools::getFormModulesRemovePrefix(); + $GLOBALS['xoopsTpl']->assign('rp_desc', \_AM_MODULEBUILDER_DEVTOOLS_RP_DESC); + $tab_form = Devtools::getFormModulesRemovePrefix($dst_path); $GLOBALS['xoopsTpl']->assign('rp_form', $tab_form->render()); $GLOBALS['xoopsTpl']->assign('devtools_list', true); diff --git a/class/Devtools.php b/class/Devtools.php index 86ee6c64..d9b19930 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -71,28 +71,32 @@ public static function function_removeprefix($src_path, $dst_path, $moduleDirNam $crFields->add(new \Criteria('field_tid', $tid)); $fieldsAll = $helper->getHandler('Fields')->getAll($crFields); foreach (\array_keys($fieldsAll) as $k) { - $fieldName = $fieldsAll[$k]->getVar('field_name'); + $fieldName = $fieldsAll[$k]->getVar('field_name'); + $rpFieldName = ''; if (\mb_strpos($fieldName, '_')) { $str = \mb_strpos($fieldName, '_'); if (false !== $str) { $rpFieldName = \mb_substr($fieldName, $str + 1, \mb_strlen($fieldName)); } } - // for getVar, setVar,.... - $patKeys[] = "'" . $fieldName . "'"; + // for getVar, setVar, forms, .... + $patKeys[] = "'" . $fieldName . "'"; $patValues[] = "'" . $rpFieldName . "'"; - $patKeys[] = 'showImgSelected(\"imglabel_' . $fieldName . '\",'; + $patKeys[] = 'showImgSelected(\"imglabel_' . $fieldName . '\",'; $patValues[] = 'showImgSelected(\"imglabel_' . $rpFieldName . '\",'; - $patKeys[] = '\"' . $fieldName . '\",'; + $patKeys[] = '\"' . $fieldName . '\",'; $patValues[] = '\"' . $rpFieldName . '\",'; - $patKeys[] = "id='imglabel_" . $fieldName . "' alt="; + $patKeys[] = "id='imglabel_" . $fieldName . "' alt="; $patValues[] = "id='imglabel_" . $rpFieldName . "' alt="; - $patKeys[] = "sort = '" . $fieldName . ' ASC,'; + $patKeys[] = "sort = '" . $fieldName . ' ASC,'; $patValues[] = "sort = '" . $rpFieldName . ' ASC,'; - $patKeys[] = 'ASC, ' . $fieldName . "', \$order"; + $patKeys[] = 'ASC, ' . $fieldName . "', \$order"; $patValues[] = 'ASC, ' . $rpFieldName . "', \$order"; + //clone feature + $patKeys[] = "'" . $fieldName . "_source'"; + $patValues[] = "'" . $rpFieldName . "_source'"; // for tpl files - if ($rpFieldName=='id') { + if ($rpFieldName === 'id') { $patKeys[] = 'op=edit&' . $fieldName . '='; $patValues[] = 'op=edit&' . $rpFieldName . '='; $patKeys[] = 'op=show&' . $fieldName . '='; @@ -582,7 +586,7 @@ public static function getFormModulesTab($action = false) * @param bool $action * @return \XoopsSimpleForm */ - public static function getFormModulesRemovePrefix($action = false) + public static function getFormModulesRemovePrefix($dst_path, $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -599,6 +603,10 @@ public static function getFormModulesRemovePrefix($action = false) $modulesSelect->addOption($mod, $mod); } $form->addElement($modulesSelect, true); + $destradioSelect = new \XoopsFormRadio(\_AM_MODULEBUILDER_DEVTOOLS_RP_DEST, 'rp_dest', 1); + $destradioSelect->addOption('1', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_RP_DEST1)); + $destradioSelect->addOption('2', \_AM_MODULEBUILDER_DEVTOOLS_RP_DEST2); + $form->addElement($destradioSelect); // To Save $form->addElement(new \XoopsFormHidden('op', 'remove_prefix')); $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); diff --git a/docs/changelog.txt b/docs/changelog.txt index 3c850884..8251ea18 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -4,6 +4,7 @@ - create nicer mysql.sql (goffy) - added trailing '_text' for output of prepared text (goffy) - fixed bugs with foreach in tpl caused by singular table names (goffy) + - added devtool for removing prefix from table field names (mamba/goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) diff --git a/language/english/admin.php b/language/english/admin.php index 4af9c584..d2c467b6 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -466,8 +466,12 @@ \define('_AM_MODULEBUILDER_DEVTOOLS_TAB_SUCCESS', 'Function replace tabs successfully added to copy of module'); \define('_AM_MODULEBUILDER_DEVTOOLS_RP', 'Remove prefix from table field names'); \define('_AM_MODULEBUILDER_DEVTOOLS_RP_MODULE', 'Select module to remove prefix'); -\define('_AM_MODULEBUILDER_DEVTOOLS_RP_DESC', 'This tool creates a copy of selected module in %s and remove prefix from table field names'); -\define('_AM_MODULEBUILDER_DEVTOOLS_RP_SUCCESS', 'Function remove prefix tabs successfully added to copy of module'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_DESC', 'This tool removes prefix from table field names'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_DEST', 'Destination'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_DEST1', 'Create a copy of selected module in %s'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_DEST2', 'Overwrite original files'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_SUCCESS', 'Function remove prefix from table field names successfully added to copy of module'); +\define('_AM_MODULEBUILDER_DEVTOOLS_RP_ERROR', 'Error occured when removing prefix from table field names'); // -------------------- IMPORT MODULE ----------------------------------- \define('_AM_MODULEBUILDER_MODULES_IMPORT', 'Import Module'); From 51343f34e08b2b9903df6ee5386a8b2ad7604f83 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Wed, 11 Dec 2024 10:34:15 +0100 Subject: [PATCH 241/266] fixed dups --- class/Files/Classes/ClassFiles.php | 3 ++- class/Files/CreateFile.php | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index c4c4f25e..f55f46f1 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -298,9 +298,10 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field $getForm .= $this->pc->getPhpCodeConditions('!', '', '$action', $action, false, "\t\t"); $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); - $getForm .= $this->pc->getPhpCodeTernaryOperator('isAdmin', '\is_object(' . $xUser . ')', $xUser . '->isAdmin(' . $xModule . '->mid())', 'false', "\t\t"); + //$getForm .= $this->pc->getPhpCodeTernaryOperator('isAdmin', '\is_object(' . $xUser . ')', $xUser . '->isAdmin(' . $xModule . '->mid())', 'false', "\t\t"); $getForm .= $this->xc->getXcEqualsOperator('$isAdmin', "\is_object(\$GLOBALS['xoopsUser']) && \$GLOBALS['xoopsUser']->isAdmin(\$GLOBALS['xoopsModule']->mid())", null, "\t\t"); + if ($fieldUpload) { $permString = 'upload_groups'; $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 57a40daf..67a86164 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -498,8 +498,8 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = $name = $module->getVar('mod_name'); $dirname = $module->getVar('mod_dirname'); //$version = $module->getVar('mod_version'); - $since = $module->getVar('mod_since'); - $minXoops = $module->getVar('mod_min_xoops'); + //$since = $module->getVar('mod_since'); + //$minXoops = $module->getVar('mod_min_xoops'); $author = $module->getVar('mod_author'); //$credits = $module->getVar('mod_credits'); $authorMail = $module->getVar('mod_author_mail'); @@ -526,11 +526,11 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = $copyright = [ $name => 'module for xoops', '' => '', - '@copyright ' => '2021 XOOPS Project (https://xoops.org)', + '@copyright ' => date('Y') . ' XOOPS Project (https://xoops.org)', '@license ' => $license, '@package ' => $dirname, - '@since ' => $since, - '@min_xoops ' => $minXoops, + //'@since ' => $since, + //'@min_xoops ' => $minXoops, ]; $authorLine = $author; if ('' !== $authorMail) { From 7069211dd34c1d852724b1710b57b4987dab4aaa Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Fri, 3 Jan 2025 15:12:50 +0100 Subject: [PATCH 242/266] added include autoloader to xoopsversion --- class/Files/User/UserXoopsVersion.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index c58abea3..b77646e0 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -131,7 +131,11 @@ private function getXoopsVersionHeader($module, $language) $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine(); $ret .= $this->xc->getXcEqualsOperator('$moduleDirName ', '\basename(__DIR__)'); $ret .= $this->xc->getXcEqualsOperator('$moduleDirNameUpper', '\mb_strtoupper($moduleDirName)'); + $ret .= $this->getSimpleString(''); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH . ' . "'/modules/'" . ' . $moduleDirName', 'preloads/autoloader', false, false, 'include'); + $ret .= $this->getSimpleString(''); $ret .= $this->getDashComment('Informations'); + $ha = (1 == $module->getVar('mod_admin')) ? '1' : '0'; $hm = (1 == $module->getVar('mod_user')) ? '1' : '0'; From 40d5d4a16040d648551380fadd6fa043adf354ed Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Fri, 3 Jan 2025 16:10:32 +0100 Subject: [PATCH 243/266] moved meta description from language file to module config --- class/Files/Language/LanguageMain.php | 1 - class/Files/Language/LanguageModinfo.php | 7 +++-- class/Files/User/UserXoopsCode.php | 2 +- class/Files/User/UserXoopsVersion.php | 38 ++++++++++++++++-------- docs/changelog.txt | 1 + 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index b2baa57a..abb2c015 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -99,7 +99,6 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getDefine($language, 'INDEX', 'Overview ' . (string)$module->getVar('mod_name')); $ret .= $this->ld->getDefine($language, 'TITLE', (string)$module->getVar('mod_name')); $ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); - $ret .= $this->ld->getDefine($language, 'INDEX_DESC',"Welcome to the homepage of your new module {$moduleName}!
    This description is only visible on the homepage of this module."); $ret .= $this->ld->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); $ret .= $this->ld->getDefine($language, 'NO', 'No'); $ret .= $this->ld->getDefine($language, 'DETAILS', 'Show details'); diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index c0854574..19e1c893 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -295,6 +295,11 @@ private function getLanguageConfig($language, $tables) $useTag = true; } } + $ret .= $this->ld->getDefine($language, 'MDESC', 'Meta module description'); + $ret .= $this->ld->getDefine($language, 'MDESC_DESC', 'Insert here module description which should be shown in meta data description'); + $ret .= $this->ld->getDefine($language, 'KEYWORDS', 'Meta keywords'); + $ret .= $this->ld->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma) which should be shown in meta data'); + if ($fieldEditor) { $ret .= $this->ld->getDefine($language, 'EDITOR_ADMIN', 'Editor admin'); $ret .= $this->ld->getDefine($language, 'EDITOR_ADMIN_DESC', 'Select the editor which should be used in admin area for text area fields'); @@ -303,8 +308,6 @@ private function getLanguageConfig($language, $tables) $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR', 'Text max characters'); $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field in admin area'); } - $ret .= $this->ld->getDefine($language, 'KEYWORDS', 'Keywords'); - $ret .= $this->ld->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); if ($fieldImage || $fieldFile) { $ret .= $this->ld->getDefine($language, 'SIZE_MB', 'MB'); diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index 50165012..1a9cffd9 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -123,7 +123,7 @@ public function getUserMetaKeywords($moduleDirname) */ public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') { - return "{$moduleDirname}MetaDescription({$language}{$file}_DESC);\n"; + return $moduleDirname. 'MetaDescription((string)$helper->' . "getConfig('metadescription'));\n"; } /** diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index b77646e0..53671d25 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -618,6 +618,31 @@ private function getXoopsVersionConfig($module, $tables, $language) $table_rate = 1; } } + //meta descrition + $ret .= $this->pc->getPhpCodeCommentLine('Meta descrition', ''); + $descr = [ + 'name' => "'metadescription'", + 'title' => "'{$language}MDESC'", + 'description' => "'{$language}MDESC_DESC'", + 'formtype' => "'textbox'", + 'valuetype' => "'text'", + 'default' => "{$language}DESC", + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $descr, 'config'); + //meta keywords + $keyword = \implode(', ', $this->getKeywords()); + $ret .= $this->pc->getPhpCodeCommentLine('Meta Keywords'); + $arrayKeyword = [ + 'name' => "'keywords'", + 'title' => "'{$language}KEYWORDS'", + 'description' => "'{$language}KEYWORDS_DESC'", + 'formtype' => "'textbox'", + 'valuetype' => "'text'", + 'default' => "'{$moduleDirname}, {$keyword}'", + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); + unset($this->keywords); + if (1 === $table_editors) { $ret .= $this->pc->getPhpCodeCommentLine('Editor Admin', ''); $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); @@ -740,19 +765,6 @@ private function getXoopsVersionConfig($module, $tables, $language) $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); } - $keyword = \implode(', ', $this->getKeywords()); - $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); - $arrayKeyword = [ - 'name' => "'keywords'", - 'title' => "'{$language}KEYWORDS'", - 'description' => "'{$language}KEYWORDS_DESC'", - 'formtype' => "'textbox'", - 'valuetype' => "'text'", - 'default' => "'{$moduleDirname}, {$keyword}'", - ]; - $ret .= $this->uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); - unset($this->keywords); - if (1 === $table_uploadimage || 1 === $table_uploadfile) { $ret .= $this->getXoopsVersionSelectSizeMB($moduleDirname); } diff --git a/docs/changelog.txt b/docs/changelog.txt index 8251ea18..f3a182d0 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -5,6 +5,7 @@ - added trailing '_text' for output of prepared text (goffy) - fixed bugs with foreach in tpl caused by singular table names (goffy) - added devtool for removing prefix from table field names (mamba/goffy) + - moved meta description from language file to module config (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) From b5ff4059037600f6759e7be68ea8bd01566d085b Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Sun, 5 Jan 2025 14:05:48 +0100 Subject: [PATCH 244/266] fixed bug for truncated text --- class/Files/Classes/ClassFiles.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index f55f46f1..28bff9d5 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -430,7 +430,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) case Constants::FIELD_ELE_TEXTAREA: $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); $getValues .= $this->pc->getPhpCodeStripTags("ret['{$rpFieldName}_text']{$spacer}", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t"); - $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}_text'], \$editorMaxchar)"; $spacer = str_repeat(' ', $lenMaxName - \mb_strlen($rpFieldName) - \mb_strlen('_short')); $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']{$spacer}", $truncate, false, "\t\t"); $helper = 1; @@ -439,7 +439,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) case Constants::FIELD_ELE_DHTMLTEXTAREA: $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}_text']{$spacer}", 'this', $fieldName, false, "\t\t", ", 'e'"); - $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)"; + $truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}_text'], \$editorMaxchar)"; $spacer = str_repeat(' ', $lenMaxName - \mb_strlen($rpFieldName) - \mb_strlen('_short')); $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']{$spacer}", $truncate, false, "\t\t"); $helper = 1; From f6fe6cee49c7df5c302357c31c8dd2a0d7a58158 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Sun, 5 Jan 2025 14:33:44 +0100 Subject: [PATCH 245/266] fixed duplicated blank file --- files/commonfiles/include/install.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index be97430e..c0703920 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -80,11 +80,6 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) $dest = $configurator->copyBlankFiles[$i] . '/blank.gif'; $utility::copyFile($file, $dest); } - $file = \dirname(__DIR__) . '/assets/images/blank.png'; - foreach (\array_keys($configurator->copyBlankFiles) as $i) { - $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; - $utility::copyFile($file, $dest); - } } return true; From c7f9d19c869c463a87603e2056c14009ed821058 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Sun, 5 Jan 2025 17:47:33 +0100 Subject: [PATCH 246/266] added new fieldelement 'RadioOnoffline' --- class/Constants.php | 63 ++++++++++--------- class/Files/Classes/ClassFiles.php | 8 ++- class/Files/Classes/ClassFormElements.php | 27 ++++++++ class/Files/Language/LanguageAdmin.php | 20 +++--- .../Templates/Admin/TemplatesAdminPages.php | 4 ++ docs/changelog.txt | 1 + include/update.php | 37 +++++++++++ language/english/admin.php | 1 + sql/mysql.sql | 3 +- 9 files changed, 122 insertions(+), 42 deletions(-) diff --git a/class/Constants.php b/class/Constants.php index bac6c9ce..6b423030 100644 --- a/class/Constants.php +++ b/class/Constants.php @@ -31,38 +31,39 @@ interface Constants public const MORE_FILES_TYPE_EMPTY = 1; public const MORE_FILES_TYPE_COPY = 2; - public const FIRST_FIELDELEMENT_TABLE = 31; - // ------------------- Field elements --------------------------------- // --------- The values MUST BE IDENTICAL to fieldelement_id ---------- - 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; + 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; + public const FIELD_ELE_RADIO_ONOFFLINE = 31; + // FIRST_FIELDELEMENT_TABLE must be +1 higher than the highest FIELD_ELE... constant + public const FIRST_FIELDELEMENT_TABLE = 32; } diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 28bff9d5..56d768db 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -300,8 +300,6 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); //$getForm .= $this->pc->getPhpCodeTernaryOperator('isAdmin', '\is_object(' . $xUser . ')', $xUser . '->isAdmin(' . $xModule . '->mid())', 'false', "\t\t"); $getForm .= $this->xc->getXcEqualsOperator('$isAdmin', "\is_object(\$GLOBALS['xoopsUser']) && \$GLOBALS['xoopsUser']->isAdmin(\$GLOBALS['xoopsModule']->mid())", null, "\t\t"); - - if ($fieldUpload) { $permString = 'upload_groups'; $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); @@ -449,6 +447,12 @@ private function getValuesInObject($moduleDirname, $table, $fields) $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_text']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t"); break; + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $offline = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_OFFLINE'; + $online = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_ONLINE'; + $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_text']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? $online : $offline", false, "\t\t"); + break; case Constants::FIELD_ELE_SELECTUSER: $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); $getValues .= $this->xc->getXcXoopsUserUnameFromId("ret['{$rpFieldName}_text']{$spacer}", "\$this->getVar('{$fieldName}')", "\t\t"); diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 84a71702..6f4dd64e 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -726,6 +726,30 @@ private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $requi return $ret; } + /** + * @private function getXoopsFormRadioOnoffline + * + * @param $language + * @param $moduleDirname + * @param $fieldName + * @param string $required + * + * @return string + */ + private function getXoopsFormRadioOnoffline($language, $fieldName, $required = 'false') + { + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $t = "\t\t"; + $ret = $this->pc->getPhpCodeCommentLine('Form Radio on-/offline', $ccFieldName, $t); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '0', "\$this->getVar('{$fieldName}')", $t); + $ret .= $this->cxc->getClassXoopsFormRadio($ccFieldName . 'Select', $language, $fieldName, "{$ccFieldName}", false, $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'0', {$language}_OFFLINE", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$language}_ONLINE", $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + + return $ret; + } + /** * @private function getXoopsFormSelectCombo * @@ -946,6 +970,9 @@ public function renderElements() case Constants::FIELD_ELE_RADIOYN: $ret .= $this->getXoopsFormRadioYN($language, $fieldName, $required); break; + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $ret .= $this->getXoopsFormRadioOnoffline($language, $fieldName, $required); + break; case Constants::FIELD_ELE_SELECTBOX: $ret .= $this->getXoopsFormSelectBox($language, $tableName, $fieldName, $required); break; diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 1084770a..969ee6b7 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -206,24 +206,28 @@ public function getLanguageAdminClass($language, $tables) $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName, $fieldNameDesc); switch ($fieldElement) { - case 10: + case Constants::FIELD_ELE_IMAGELIST: $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in frameworks images: %s"); break; - case 12: + case Constants::FIELD_ELE_URLFILE: $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in uploads"); break; - case 11: - case 13: - case 14: + case Constants::FIELD_ELE_SELECTFILE: + case Constants::FIELD_ELE_UPLOADIMAGE: + case Constants::FIELD_ELE_UPLOADFILE: $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in %s :"); break; - case 16: + case Constants::FIELD_ELE_SELECTSTATUS: $fieldStatus++; break; - case 20: - case 22: + case Constants::FIELD_ELE_RADIO: + case Constants::FIELD_ELE_SELECTCOMBO: $fieldSampleListValue++; break; + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_OFFLINE', 'Offline'); + $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_ONLINE', 'Online'); + break; } if (16 === (int)$fieldElement) { $fieldStatus++; diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 9f78fbae..36c562e8 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -201,6 +201,10 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); break; + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + break; default: if (0 != $f) { $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); diff --git a/docs/changelog.txt b/docs/changelog.txt index f3a182d0..dd02f03d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -6,6 +6,7 @@ - fixed bugs with foreach in tpl caused by singular table names (goffy) - added devtool for removing prefix from table field names (mamba/goffy) - moved meta description from language file to module config (goffy) + - added new fieldelement 'RadioOnoffline' (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) diff --git a/include/update.php b/include/update.php index 6d032dea..d08fcf0b 100644 --- a/include/update.php +++ b/include/update.php @@ -846,6 +846,42 @@ function modulebuilder_check_db($module) } } + // new form field Radio On-/Offline + $fname = 'RadioOnoffline'; + $fid = 31; + $fvalue = 'XoopsFormRadioOnoffline'; + $fsort = 7; + $fdeftype = 2; + $fdefvalue = 1; + $fdeffield = 0; + $result = $xoopsDB->query( + 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + ); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows == 0) { + $result = $xoopsDB->query( + 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" + ); + $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, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; + $result = $xoopsDB->query($sql); + // update table fields to new id of previous 31 + $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 31 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}', `fieldelement_deffield` = '{$fdeffield}' 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; + $result = $xoopsDB->query($sql); + } + } + // resorting elements $sortElements = []; $sortElements[] = 'Text'; @@ -855,6 +891,7 @@ function modulebuilder_check_db($module) $sortElements[] = 'DhtmlTextArea'; $sortElements[] = 'CheckBox'; $sortElements[] = 'RadioYN'; + $sortElements[] = 'RadioOnoffline'; $sortElements[] = 'Radio'; $sortElements[] = 'SelectBox'; $sortElements[] = 'SelectCombo'; diff --git a/language/english/admin.php b/language/english/admin.php index d2c467b6..395eeb15 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -424,6 +424,7 @@ \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_RADIOONOFFLINE', 'Radio On-/Offline'); // // ------------------- Misc --------------------------------- // \define('_AM_MODULEBUILDER_THEREARE_DATABASE1', "There are %s"); diff --git a/sql/mysql.sql b/sql/mysql.sql index 75b32145..b15c457d 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -355,7 +355,8 @@ INSERT INTO `modulebuilder_fieldelements` (`fieldelement_id`, `fieldelement_mid` (27, 0, 0, 'TextVotes', 'XoopsFormTextVotes', 28, 2, '10', ''), (28, 0, 0, 'TextReads', 'XoopsFormTextReads', 29, 2, '10', ''), (29, 0, 0, 'TextInteger', 'XoopsFormText', 2, 2, '10', '0'), -(30, 0, 0, 'TextFloat', 'XoopsFormText', 3, 6, '16,2', '0.00'); +(30, 0, 0, 'TextFloat', 'XoopsFormText', 3, 6, '16,2', '0.00'), +(31, 0, 0, 'RadioOnoffline', 'XoopsFormRadioOnoffline', 7, 2, '1', ''); # # Table structure for table `modulebuilder_morefiles` 5 From 75ba39ba1f430d2515267cc9b87dc3d8a54a3639 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Sun, 5 Jan 2025 21:20:19 +0100 Subject: [PATCH 247/266] improved block.php creation --- class/Files/Blocks/BlocksFiles.php | 32 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 31f6ef8c..48ccdabf 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -4,6 +4,7 @@ use XoopsModules\Modulebuilder; use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\Constants; /* You may not change or alter any portion of this comment or credits @@ -124,17 +125,23 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $contIf .= $this->pc->getPhpCodeConditions('$typeBlock', '', '', $contIf2, false, "\t"); //content else: parent + $fieldDate = ''; + $fieldRating = ''; + foreach ($fields as $field) { + if ($field->getVar('field_element') == Constants::FIELD_ELE_TEXTDATESELECT || $field->getVar('field_element') == Constants::FIELD_ELE_DATETIME) { + $fieldDate = $field->getVar('field_name'); + } + if ($field->getVar('field_element') == Constants::FIELD_ELE_TEXTRATINGS || $field->getVar('field_element') == Constants::FIELD_ELE_TEXTVOTES) { + $fieldRating = $field->getVar('field_name'); + } + } //search for SelectStatus field $fieldStatus = ''; - $fieldDate = ''; if (1 == $tablePermissions) { foreach ($fields as $field) { - if ($field->getVar('field_element') == 16) { + if ($field->getVar('field_element') == Constants::FIELD_ELE_SELECTSTATUS) { $fieldStatus = $field->getVar('field_name'); } - if ($field->getVar('field_element') == 15 || $field->getVar('field_element') == 21) { - $fieldDate = $field->getVar('field_name'); - } } if ('' !== $fieldStatus) { $constant = $this->xc->getXcGetConstants('PERM_GLOBAL_VIEW'); @@ -151,21 +158,28 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case4 = []; $case5 = []; $case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\t\t\t"); - $case1[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); + $case1[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t\t\t"); $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"); + $crit = $this->xc->getXcCriteria('', "'{$fieldDate}'", '\time() - 604800', "'>='", true); $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"); $case2[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); $case2[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); $case3[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} hits",'',"\t\t\t"); + $case3[] = $this->pc->getPhpCodeCommentLine("Table {$tableName} must have {$tableFieldname}_hits or you have to change into corresponding field name",'',"\t\t\t"); $case3[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_hits'","\t\t\t"); $case3[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); - $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); - $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'","\t\t\t"); + if ('' !== $fieldRating) { + $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); + $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldRating}'","\t\t\t"); + } else { + $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); + $case4[] = $this->pc->getPhpCodeCommentLine("Table {$tableName} must have {$tableFieldname}_top or you have to change into corresponding field name",'',"\t\t\t"); + $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'","\t\t\t"); + } $case4[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); $case5[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} random",'',"\t\t\t"); $case5[] = $this->xc->getXcCriteriaSetSort($critName, "'RAND()'","\t\t\t"); From 4b97b82ff198e25ee04d33c059a81a8325253411 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Sun, 5 Jan 2025 21:30:37 +0100 Subject: [PATCH 248/266] next improvements for block.php --- class/Files/Blocks/BlocksFiles.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 48ccdabf..57a70073 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -162,6 +162,10 @@ 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"); $case2[] = $this->pc->getPhpCodeCommentLine('new since last week: 7 * 24 * 60 * 60 = 604800', '', "\t\t\t"); + if ('' === $fieldDate) { + $fieldDate = "{$tableFieldname}_date"; + $case2[] = $this->pc->getPhpCodeCommentLine("Table {$tableName} must have {$tableFieldname}_date or you have to change into corresponding field name",'',"\t\t\t"); + } $crit = $this->xc->getXcCriteria('', "'{$fieldDate}'", '\time() - 604800', "'>='", true); $case2[] = $this->xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); $crit = $this->xc->getXcCriteria('', "'{$fieldDate}'", '\time()', "'<='", true); From 2bc9475727acd886dd6c2ca4ea90d785cc182d13 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Sun, 5 Jan 2025 23:07:06 +0100 Subject: [PATCH 249/266] moved meta description/path assignments to footer.php --- class/Files/Blocks/BlocksFiles.php | 2 +- class/Files/User/UserFooter.php | 25 ++++++++++++++++++++----- class/Files/User/UserIndex.php | 11 +---------- class/Files/User/UserPages.php | 10 +--------- class/Files/User/UserSearch.php | 5 ----- docs/changelog.txt | 1 + 6 files changed, 24 insertions(+), 30 deletions(-) diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 57a70073..bbfc3268 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -161,7 +161,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $case1[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t\t\t"); $case1[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); $case2[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} new",'',"\t\t\t"); - $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"); if ('' === $fieldDate) { $fieldDate = "{$tableFieldname}_date"; $case2[] = $this->pc->getPhpCodeCommentLine("Table {$tableName} must have {$tableFieldname}_date or you have to change into corresponding field name",'',"\t\t\t"); diff --git a/class/Files/User/UserFooter.php b/class/Files/User/UserFooter.php index 19c6c9c1..15e76361 100644 --- a/class/Files/User/UserFooter.php +++ b/class/Files/User/UserFooter.php @@ -31,6 +31,10 @@ */ class UserFooter extends Files\CreateFile { + /** + * @var mixed + */ + private $uxc = null; /** * @var mixed */ @@ -49,6 +53,7 @@ public function __construct() parent::__construct(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); } /** @@ -80,23 +85,32 @@ public function write($module, $filename): void /** * @private function getUserFooter * @param $moduleDirname + * @param $language * * @return string */ - private function getUserFooter($moduleDirname) + private function getUserFooter($moduleDirname, $language) { $stuModuleDirname = \mb_strtoupper($moduleDirname); $xoBreadcrumbs = $this->xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs', true, "\t"); $config = $this->xc->getXcGetConfig('show_breadcrumbs'); $ret = $this->pc->getPhpCodeConditions($config . ' && \count($xoBreadcrumbs) > 0', '', '', $xoBreadcrumbs); $ret .= $this->xc->getXcXoopsTplAssign('adv', "\$helper->getConfig('advertise')"); - $ret .= $this->pc->getPhpCodeCommentLine(); + $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcXoopsTplAssign('bookmarks', "\$helper->getConfig('bookmarks')"); $ret .= $this->xc->getXcXoopsTplAssign('fbcomments', "\$helper->getConfig('fbcomments')"); - $ret .= $this->pc->getPhpCodeCommentLine(); + $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcXoopsTplAssign('admin', "\\{$stuModuleDirname}_ADMIN"); $ret .= $this->xc->getXcXoopsTplAssign('copyright', '$copyright'); - $ret .= $this->pc->getPhpCodeCommentLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Meta description'); + $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Paths'); + $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}_url", "\\{$stuModuleDirname}_URL"); + $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL"); + $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'footer', true); return $ret; @@ -111,9 +125,10 @@ public function render() { $module = $this->getModule(); $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); $filename = $this->getFileName(); $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserFooter($moduleDirname); + $content .= $this->getUserFooter($moduleDirname, $language); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index fef248b5..64dd9b4a 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -103,9 +103,6 @@ private function getUserIndexHeader($language, $moduleDirname) $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); $ret .= $this->pc->getPhpCodeArray('keywords', null, false, ''); $ret .= $this->uxc->getUserBreadcrumbs($language); - $ret .= $this->pc->getPhpCodeCommentLine('Paths'); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_icons32_url', '\XOOPS_ICONS32_URL'); - $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_url", "\\{$stuModuleDirname}_URL"); return $ret; } @@ -216,15 +213,9 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) */ private function getUserIndexFooter($moduleDirname, $language) { - $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->pc->getPhpCodeCommentLine('Keywords'); + $ret = $this->pc->getPhpCodeCommentLine('Meta 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; diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 167827e3..aae5e3ef 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -134,9 +134,6 @@ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $table $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet'); $ret .= $this->xc->getXcXoThemeAddStylesheet(); - $ret .= $this->pc->getPhpCodeCommentLine('Paths'); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_icons32_url', '\XOOPS_ICONS32_URL'); - $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_url", "\\{$stuModuleDirname}_URL"); $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); $ret .= $this->pc->getPhpCodeArray('keywords', null, false, ''); $ret .= $this->uxc->getUserBreadcrumbs($language, 'index', '', 'index.php'); @@ -567,14 +564,9 @@ private function getUserPagesFooter($moduleDirname, $tableName, $tableComments, $stuModuleDirname = \mb_strtoupper($moduleDirname); $stuTableName = \mb_strtoupper($tableName); $ret = $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); + $ret .= $this->pc->getPhpCodeCommentLine('Meta keywords'); $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); $ret .= $this->pc->getPhpCodeUnset('keywords'); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Description'); - $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language, $stuTableName); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_mpageurl', "\\{$stuModuleDirname}_URL.'/{$tableName}.php'"); - $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL"); if (1 == $tableComments) { $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('View comments'); diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index 9dbe1f9f..d8963199 100644 --- a/class/Files/User/UserSearch.php +++ b/class/Files/User/UserSearch.php @@ -156,11 +156,6 @@ private function getUserSearchFooter($moduleDirname, $tableName, $language) $ret .= $this->getDashComment('Keywords'); $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); $ret .= $this->phpcode->getPhpCodeUnset('keywords'); - $ret .= $this->getDashComment('Description'); - $ret .= $this->uxc->getUserMetaDesc($moduleDirname, 'DESC', $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; diff --git a/docs/changelog.txt b/docs/changelog.txt index dd02f03d..add1d158 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -7,6 +7,7 @@ - added devtool for removing prefix from table field names (mamba/goffy) - moved meta description from language file to module config (goffy) - added new fieldelement 'RadioOnoffline' (goffy) + - moved meta description/path assignments to footer.php (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) From 8dd6958d8f3e9bd514ce5b3904c888a48ffbe46d Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Mon, 6 Jan 2025 10:50:21 +0100 Subject: [PATCH 250/266] implemented constants for radio on-/offline --- class/Files/Classes/ClassFiles.php | 7 ++-- class/Files/Classes/ClassFormElements.php | 6 ++- class/Files/Classes/ClassSpecialFiles.php | 47 ++++++++++++++++++----- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 56d768db..be916e5d 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -449,9 +449,10 @@ private function getValuesInObject($moduleDirname, $table, $fields) break; case Constants::FIELD_ELE_RADIO_ONOFFLINE: $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); - $offline = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_OFFLINE'; - $online = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_ONLINE'; - $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_text']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? $online : $offline", false, "\t\t"); + $defaultRO = $this->xc->getXcGetConstants('RADIO_OFFLINE'); + $offlineRO = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_OFFLINE'; + $onlineRO = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_ONLINE'; + $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_text']{$spacer}", "(int)\$this->getVar('{$fieldName}') > $defaultRO ? $onlineRO : $offlineRO", false, "\t\t"); break; case Constants::FIELD_ELE_SELECTUSER: $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index 6f4dd64e..e7171210 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -743,8 +743,10 @@ private function getXoopsFormRadioOnoffline($language, $fieldName, $required = ' $ret = $this->pc->getPhpCodeCommentLine('Form Radio on-/offline', $ccFieldName, $t); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '0', "\$this->getVar('{$fieldName}')", $t); $ret .= $this->cxc->getClassXoopsFormRadio($ccFieldName . 'Select', $language, $fieldName, "{$ccFieldName}", false, $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'0', {$language}_OFFLINE", $t); - $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$language}_ONLINE", $t); + $param = $this->xc->getXcGetConstants('RADIO_OFFLINE'); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "{$param}, {$language}_OFFLINE", $t); + $param = $this->xc->getXcGetConstants('RADIO_ONLINE'); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "{$param}, {$language}_ONLINE", $t); $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 660488e8..800cc579 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Classes; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -224,11 +227,27 @@ public function renderConstantsInterface() $module = $this->getModule(); $filename = $this->getFileName(); $tables = $this->getTables(); - $tablePermissions = []; - $tableRate = []; + + + $tablePermissions = []; + $tableRate = []; + $hasRadioOnoffline = false; + $hasSelectStatus = false; foreach (\array_keys($tables) as $t) { $tablePermissions[] = $tables[$t]->getVar('table_permissions'); $tableRate[] = $tables[$t]->getVar('table_rate'); + $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); + foreach (\array_keys($fields) as $f) { + $fieldElement = $fields[$f]->getVar('field_element'); + switch ($fieldElement) { + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $hasRadioOnoffline = true; + break; + case Constants::FIELD_ELE_SELECTSTATUS: + $hasSelectStatus = true; + break; + } + } } $moduleDirname = $module->getVar('mod_dirname'); $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); @@ -243,13 +262,21 @@ public function renderConstantsInterface() $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'); + if ($hasSelectStatus) { + $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'); + } + if ($hasRadioOnoffline) { + $contentClass .= $this->pc->getPhpCodeBlankLine(); + $contentClass .= $this->pc->getPhpCodeCommentLine('Constants for radio on-/offline', '', "\t"); + $contentClass .= $this->pc->getPhpCodeConstant('RADIO_OFFLINE', 0, "\t", 'public const'); + $contentClass .= $this->pc->getPhpCodeConstant('RADIO_ONLINE ', 1, "\t", 'public const'); + } if (\in_array(1, $tablePermissions)) { $constPerm = $this->pc->getPhpCodeBlankLine(); $constPerm .= $this->pc->getPhpCodeCommentLine('Constants for permissions', '', "\t"); From 25f9276d0d7b933484894840ab38ec3798c56c64 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Mon, 6 Jan 2025 12:25:01 +0100 Subject: [PATCH 251/266] added field prefix again --- class/Fields.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class/Fields.php b/class/Fields.php index b0e0a0de..8d30ae19 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -195,8 +195,8 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, // Index ID $form->addElement(new Modulebuilder\Html\FormLabel('
    ')); // Field Name - //$thisFieldName = (!empty($fName) ? ((1 == $i) ? $fName . '_id' : $fName . '_') : ''); - $thisFieldName = (1 === $i) ? 'id' : ''; + $thisFieldName = (!empty($fName) ? ((1 == $i) ? $fName . '_id' : $fName . '_') : ''); + //$thisFieldName = (1 === $i) ? 'id' : ''; $fieldName = new \XoopsFormText(\_AM_MODULEBUILDER_FIELD_NAME, 'field_name[' . $i . ']', 15, 255, $thisFieldName); $form->addElement(new Modulebuilder\Html\FormLabel('')); // Field Element From 2ab3056dece21071d88d037e93b694ed22e5285d Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Mon, 6 Jan 2025 16:39:43 +0100 Subject: [PATCH 252/266] fixed bug in block links --- class/Files/Blocks/BlocksFiles.php | 3 +++ class/Files/Blocks/BlocksFilesSpotlight.php | 3 +++ class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php | 4 +++- .../Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php | 3 ++- docs/changelog.txt | 6 ++++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index bbfc3268..acae5dc9 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -95,6 +95,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab { $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; + $stuModuleDirname = \mb_strtoupper($moduleDirname); $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); @@ -252,6 +253,8 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func .= $this->pc->getPhpCodeConditions("\count(\${$tableName}All)", ' > ', '0', $foreach, false, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_url", "\\{$stuModuleDirname}_URL", true ,"\t"); + $func .= $this->pc->getPhpCodeBlankLine(); $func .= $this->getSimpleString('return $block;',"\t"); $func .= $this->pc->getPhpCodeBlankLine(); diff --git a/class/Files/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php index d571ef69..131344c8 100644 --- a/class/Files/Blocks/BlocksFilesSpotlight.php +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -96,6 +96,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tablePermissions, $f { $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; + $stuModuleDirname = \mb_strtoupper($moduleDirname); $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); @@ -185,6 +186,8 @@ private function getBlocksShow($moduleDirname, $tableName, $tablePermissions, $f $func .= $this->pc->getPhpCodeConditions("\count(\${$tableName}All)", ' > ', '0', $foreach, false, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_url", "\\{$stuModuleDirname}_URL", true ,"\t"); + $func .= $this->pc->getPhpCodeBlankLine(); $func .= $this->getSimpleString('return $block;',"\t"); $func .= $this->pc->getPhpCodeBlankLine(); diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 73fdd5b8..e029de80 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -165,6 +165,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi break; case Constants::FIELD_ELE_SELECTSTATUS: case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_RADIO_ONOFFLINE: case Constants::FIELD_ELE_SELECTUSER: case Constants::FIELD_ELE_DATETIME: case Constants::FIELD_ELE_TEXTDATESELECT: @@ -195,7 +196,8 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi // $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); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_url'); + $anchor = $this->hc->getHtmlAnchor($single . '/' . $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"); diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php index 52870a49..5855d1fd 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -197,7 +197,8 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi // $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); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_url'); + $anchor = $this->hc->getHtmlAnchor($single . '/' . $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"); diff --git a/docs/changelog.txt b/docs/changelog.txt index add1d158..9c529dfe 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -6,8 +6,14 @@ - fixed bugs with foreach in tpl caused by singular table names (goffy) - added devtool for removing prefix from table field names (mamba/goffy) - moved meta description from language file to module config (goffy) + - added include autoloader to xoopsversion (goffy) - added new fieldelement 'RadioOnoffline' (goffy) + - implemented constants for radio on-/offline (goffy) - moved meta description/path assignments to footer.php (goffy) + - fixed duplicated blank file (goffy) + - fixed bug for truncated text (goffy) + - added field prefix again (goffy) + - fixed bug in block links (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) From a45a0a1fb3f9cb4a6b22e0679c7bc9c972e4c103 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Mon, 6 Jan 2025 21:54:19 +0100 Subject: [PATCH 253/266] responsive and lang --- class/Files/Language/LanguageModinfo.php | 2 +- class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php | 2 +- .../Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php | 2 +- docs/changelog.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 19e1c893..2b87dd1d 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -306,7 +306,7 @@ private function getLanguageConfig($language, $tables) $ret .= $this->ld->getDefine($language, 'EDITOR_USER', 'Editor user'); $ret .= $this->ld->getDefine($language, 'EDITOR_USER_DESC', 'Select the editor which should be used in user area for text area fields'); $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR', 'Text max characters'); - $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field in admin area'); + $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field as short version'); } if ($fieldImage || $fieldFile) { diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index e029de80..98072cc7 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -237,7 +237,7 @@ private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $t $tbody .= $this->getTemplatesBlocksTableTfoot(); $single = $this->sc->getSmartySingleVar('table_type'); - return $this->hc->getHtmlTable($tbody, 'table table-' . $single); + return $this->hc->getHtmlTable($tbody, 'table table-responsive table-' . $single); } /** diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php index 5855d1fd..59ff5e3a 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -238,7 +238,7 @@ private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $t $tbody .= $this->getTemplatesBlocksTableTfoot(); $single = $this->sc->getSmartySingleVar('table_type'); - return $this->hc->getHtmlTable($tbody, 'table table-' . $single); + return $this->hc->getHtmlTable($tbody, 'table table-responsive table-' . $single); } /** diff --git a/docs/changelog.txt b/docs/changelog.txt index 9c529dfe..e2b4d820 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -14,7 +14,7 @@ - fixed bug for truncated text (goffy) - added field prefix again (goffy) - fixed bug in block links (goffy) - +
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) - fixed bug in creation if search.inc.php (zivXP/goffy) From 60b66c4544edcc36fae729b3c6627d0556c28cbe Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Mon, 6 Jan 2025 22:27:22 +0100 Subject: [PATCH 254/266] fixed bug with short text in block --- class/Files/Blocks/BlocksFiles.php | 45 ++++++++++++++++++++---------- docs/changelog.txt | 1 + 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index acae5dc9..0796ded2 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -3,8 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\Blocks; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; -use XoopsModules\Modulebuilder\Constants; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -96,22 +98,34 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; $stuModuleDirname = \mb_strtoupper($moduleDirname); + $ucfModuleDirname = \ucfirst($moduleDirname); - $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); + $configMaxchar = 0; + foreach (\array_keys($fields) as $f) { + $fieldElement = $fields[$f]->getVar('field_element'); + if (Constants::FIELD_ELE_TEXTAREA == $fieldElement || Constants::FIELD_ELE_DHTMLTEXTAREA == $fieldElement) { + $configMaxchar = 1; + } + } + $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); + $func = $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); + if (1 === $configMaxchar) { + $func .= $this->xc->getXcEqualsOperator('$utility ', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t"); + } //$func .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); - $func = $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$lenghtTitle', '$options[2]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); - $func .= $this->xc->getXcHandlerLine($tableName, "\t"); - $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); + $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$lenghtTitle ', '$options[2]','',"\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeBlankLine(); - + $func .= $this->xc->getXcHandlerLine($tableName, "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); //content if: parent $contIf = $this->xc->getXcEqualsOperator("\${$tableName}", "{$moduleDirname}_getMyItemIds('{$moduleDirname}_view', '{$moduleDirname}')", null, "\t"); $crit = $this->xc->getXcCriteria('', "'cid'", "'(' . \implode(',', \${$tableName}) . ')'", "'IN'", true); @@ -230,12 +244,13 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab } if (1 == $fields[$f]->getVar('field_block')) { switch ($fieldElement) { - case 2: + case Constants::FIELD_ELE_TEXT: $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\htmlspecialchars(\${$tableName}All[\$i]->getVar('{$fieldName}'), ENT_QUOTES | ENT_HTML5)", null, "\t\t\t"); break; - case 3: - case 4: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\strip_tags(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}_text']", "\${$tableName}All[\$i]->getVar('{$fieldName}', 'e')", null, "\t\t\t"); + $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}_short']", "\$utility::truncateHtml(\${$tableName}All[\$i]->getVar('{$fieldName}', 'e'), \$editorMaxchar)", null, "\t\t\t"); break; case 8: $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); diff --git a/docs/changelog.txt b/docs/changelog.txt index e2b4d820..81a59fd1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -14,6 +14,7 @@ - fixed bug for truncated text (goffy) - added field prefix again (goffy) - fixed bug in block links (goffy) + - fixed bug with short text in block (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) From 647babff4e7beea3b75eff5ec014bf951c3687be Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Tue, 7 Apr 2026 14:45:21 +0200 Subject: [PATCH 255/266] updated creation code to generate module with no errors from copilot --- class/Building.php | 8 +- class/Common/Breadcrumb.php | 2 +- class/Common/Confirm.php | 2 +- class/Common/DirectoryChecker.php | 6 +- class/Common/FileChecker.php | 34 +- class/Common/Migrate.php | 2 +- class/Common/ModuleFeedback.php | 8 +- class/Common/ModuleStats.php | 4 +- class/Common/SysUtility.php | 14 +- class/Common/TableChecker.php | 20 +- class/Common/TestdataButtons.php | 8 +- class/Common/VersionChecks.php | 2 +- class/Devtools.php | 18 +- class/Fieldattributes.php | 3 +- class/Fieldelements.php | 7 +- class/FieldelementsHandler.php | 36 +- class/Fieldkey.php | 3 +- class/Fieldnull.php | 3 +- class/Fields.php | 14 +- class/FieldsHandler.php | 28 +- class/Fieldtype.php | 3 +- class/Files/Admin/AdminBroken.php | 73 ++-- class/Files/Admin/AdminHeader.php | 16 +- class/Files/Admin/AdminIndex.php | 38 +- class/Files/Admin/AdminMenu.php | 31 +- class/Files/Admin/AdminPermissions.php | 36 +- .../Files/Assets/Css/Admin/CssAdminStyles.php | 7 +- class/Files/Assets/Css/CssSelectors.php | 9 +- class/Files/Assets/Css/CssStyles.php | 7 +- class/Files/Assets/Js/JavascriptJQuery.php | 20 +- class/Files/Assets/Js/JsJquery.php | 11 +- class/Files/Blocks/BlocksFiles.php | 107 +++-- class/Files/Blocks/BlocksFilesSpotlight.php | 102 +++-- class/Files/CheckData.php | 45 +-- class/Files/Classes/ClassFiles.php | 64 +-- class/Files/Classes/ClassFormElements.php | 113 +++--- class/Files/Classes/ClassHandlerFiles.php | 35 +- class/Files/Classes/ClassSpecialFiles.php | 37 +- class/Files/Classes/ClassXoopsCode.php | 133 +++---- class/Files/Config/ConfigConfig.php | 11 +- class/Files/CreateAbstractClass.php | 6 +- class/Files/CreateArchitecture.php | 110 +++--- class/Files/CreateClone.php | 8 +- class/Files/CreateCodeIndents.php | 9 +- class/Files/CreateFile.php | 61 ++- class/Files/CreateHtmlCode.php | 85 ++-- class/Files/CreateMoreFiles.php | 18 +- class/Files/CreatePhpCode.php | 176 ++++----- class/Files/CreateSmartyCode.php | 54 ++- class/Files/CreateStructure.php | 29 +- class/Files/CreateTableFields.php | 16 +- class/Files/CreateXoopsCode.php | 365 +++++++++--------- class/Files/Docs/DocsChangelog.php | 7 +- class/Files/Docs/DocsFiles.php | 39 +- .../Includes/IncludeCommentFunctions.php | 24 +- class/Files/Includes/IncludeComments.php | 19 +- class/Files/Includes/IncludeCommon.php | 23 +- class/Files/Includes/IncludeFunctions.php | 65 ++-- class/Files/Includes/IncludeJquery.php | 11 +- class/Files/Includes/IncludeNotifications.php | 25 +- class/Files/Includes/IncludeSearch.php | 12 +- class/Files/Language/LanguageAdmin.php | 38 +- class/Files/Language/LanguageBlocks.php | 15 +- class/Files/Language/LanguageDefines.php | 13 +- class/Files/Language/LanguageHelp.php | 15 +- class/Files/Language/LanguageMailTpl.php | 5 +- class/Files/Language/LanguageMain.php | 28 +- class/Files/Language/LanguageModinfo.php | 13 +- class/Files/Sql/SqlFile.php | 6 +- .../Templates/Admin/TemplatesAdminAbout.php | 5 +- .../Templates/Admin/TemplatesAdminBroken.php | 81 ++-- .../Templates/Admin/TemplatesAdminFooter.php | 13 +- .../Templates/Admin/TemplatesAdminHeader.php | 9 +- .../Templates/Admin/TemplatesAdminIndex.php | 9 +- .../Templates/Admin/TemplatesAdminPages.php | 48 +-- .../Admin/TemplatesAdminPermissions.php | 19 +- .../Blocks/Defstyle/TemplatesBlocks.php | 37 +- .../Defstyle/TemplatesBlocksSpotlight.php | 21 +- .../Templates/User/Defstyle/Breadcrumbs.php | 26 +- .../Templates/User/Defstyle/Categories.php | 17 +- .../User/Defstyle/CategoriesList.php | 22 +- .../Files/Templates/User/Defstyle/Footer.php | 19 +- .../Files/Templates/User/Defstyle/Header.php | 18 +- class/Files/Templates/User/Defstyle/Index.php | 19 +- .../Templates/User/Defstyle/MoreFiles.php | 14 +- class/Files/Templates/User/Defstyle/Pages.php | 32 +- .../Templates/User/Defstyle/PagesItem.php | 59 ++- .../Templates/User/Defstyle/PagesList.php | 11 +- class/Files/Templates/User/Defstyle/Pdf.php | 9 +- class/Files/Templates/User/Defstyle/Rate.php | 25 +- class/Files/Templates/User/Defstyle/Rss.php | 48 +-- .../Files/Templates/User/Defstyle/Search.php | 25 +- .../Templates/User/Defstyle/UserPrint.php | 37 +- class/Files/User/UserFooter.php | 11 +- class/Files/User/UserHeader.php | 14 +- class/Files/User/UserIndex.php | 33 +- class/Files/User/UserListTag.php | 10 +- class/Files/User/UserNotificationUpdate.php | 9 +- class/Files/User/UserPages.php | 100 ++--- class/Files/User/UserPdf.php | 138 ++++--- class/Files/User/UserPrint.php | 39 +- class/Files/User/UserRate.php | 99 +++-- class/Files/User/UserRss.php | 50 +-- class/Files/User/UserSearch.php | 18 +- class/Files/User/UserViewTag.php | 10 +- class/Files/User/UserXoopsCode.php | 35 +- class/Files/User/UserXoopsVersion.php | 139 ++++--- class/Files/admin/AdminAbout.php | 14 +- class/Files/admin/AdminFooter.php | 11 +- class/Files/admin/AdminPages.php | 68 ++-- class/Files/admin/AdminXoopsCode.php | 154 ++++---- class/Form/FormRadio.php | 4 +- class/Form/FormRaw.php | 2 +- class/Form/FormTab.php | 1 - class/Form/FormTabTray.php | 2 +- class/Form/ThemeForm.php | 4 +- class/Helper.php | 2 +- class/Html/FormLabel.php | 2 +- class/Import.php | 4 +- class/Logo.php | 2 +- class/LogoGenerator.php | 4 +- class/Modules.php | 12 +- class/ModulesHandler.php | 21 +- class/Morefiles.php | 10 +- class/MorefilesHandler.php | 27 +- class/Session.php | 6 +- class/Settings.php | 8 +- class/SettingsHandler.php | 21 +- class/SplClassLoader.php | 14 +- class/Tables.php | 10 +- class/TablesHandler.php | 27 +- class/Utility.php | 20 +- class/autoload.php | 2 +- xoops_version.php | 8 +- 134 files changed, 2041 insertions(+), 2162 deletions(-) diff --git a/class/Building.php b/class/Building.php index 1fbd8a57..eaf07224 100644 --- a/class/Building.php +++ b/class/Building.php @@ -33,8 +33,6 @@ class Building /** * @static function getInstance * - * @param null - * * @return Building */ public static function getInstance() @@ -52,7 +50,7 @@ public static function getInstance() * * @return \XoopsThemeForm */ - public function getForm($action = false) + public function getForm(bool $action = false) { $helper = Modulebuilder\Helper::getInstance(); if (false === $action) { @@ -85,7 +83,7 @@ public function getForm($action = false) * @param string $dir * @param string $pattern */ - public function clearDir($dir, $pattern = '*'): void + public function clearDir(string $dir, string $pattern = '*'): void { // Find all files and folders matching pattern $files = glob($dir . "/$pattern"); @@ -121,7 +119,7 @@ public function clearDir($dir, $pattern = '*'): void * @param string $src * @param string $dst */ - public function copyDir($src, $dst): void + public function copyDir(string $src, string $dst): void { $dir = \opendir($src); if (!\mkdir($dst) && !\is_dir($dst)) { diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index dbd19c3b..c4cb3d3c 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -52,7 +52,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = ''): void + public function addLink(string $title = '', string $link = ''): void { $this->bread[] = [ 'link' => $link, diff --git a/class/Common/Confirm.php b/class/Common/Confirm.php index d2108513..60580058 100644 --- a/class/Common/Confirm.php +++ b/class/Common/Confirm.php @@ -53,7 +53,7 @@ class Confirm * @param string $title * @param string $label */ - public function __construct($hiddens, $action, $object, $title = '', $label = '') + public function __construct($hiddens, $action, $object, string $title = '', string $label = '') { $this->hiddens = $hiddens; $this->action = $action; diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 6c450a96..5ad1d848 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -41,7 +41,7 @@ class DirectoryChecker * * @return bool|string */ - public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null) + public static function getDirectoryStatus($path, int $mode = 0777, $redirectFile = null) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -99,7 +99,7 @@ public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = n * * @return bool */ - public static function createDirectory($target, $mode = 0777) + public static function createDirectory($target, int $mode = 0777) { $target = \str_replace('..', '', $target); @@ -113,7 +113,7 @@ public static function createDirectory($target, $mode = 0777) * * @return bool */ - public static function setDirectoryPermissions($target, $mode = 0777) + public static function setDirectoryPermissions($target, int $mode = 0777) { $target = \str_replace('..', '', $target); diff --git a/class/Common/FileChecker.php b/class/Common/FileChecker.php index c8282eb1..638475fa 100644 --- a/class/Common/FileChecker.php +++ b/class/Common/FileChecker.php @@ -37,12 +37,12 @@ class FileChecker { /** - * @param string $file_path + * @param string $file_path * @param string|null $original_file_path - * @param string $redirectFile + * @param string $redirectFile * @return bool|string */ - public static function getFileStatus($file_path, $original_file_path = null, $redirectFile) + public static function getFileStatus(string $file_path, string $original_file_path = null, string $redirectFile) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -135,7 +135,7 @@ public static function fileExists($file_path) * * @return bool */ - public static function setFilePermissions($target, $mode = 0777) + public static function setFilePermissions($target, int $mode = 0777) { $target = \str_replace('..', '', $target); @@ -144,18 +144,16 @@ public static function setFilePermissions($target, $mode = 0777) } $op = Request::getString('op', '', 'POST'); -switch ($op) { - case 'copyfile': - if (\Xmf\Request::hasVar('original_file_path', 'POST')) { - $original_file_path = $_POST['original_file_path']; - } - if (\Xmf\Request::hasVar('file_path', 'POST')) { - $file_path = $_POST['file_path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; - } - $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); - \redirect_header($redirect, 2, $msg . ': ' . $file_path); - break; +if ($op == 'copyfile') { + if (\Xmf\Request::hasVar('original_file_path', 'POST')) { + $original_file_path = $_POST['original_file_path']; + } + if (\Xmf\Request::hasVar('file_path', 'POST')) { + $file_path = $_POST['file_path']; + } + if (\Xmf\Request::hasVar('redirect', 'POST')) { + $redirect = $_POST['redirect']; + } + $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); + \redirect_header($redirect, 2, $msg . ': ' . $file_path); } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 5e46abac..d56fc374 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -58,7 +58,7 @@ private function changePrefix(): void * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName): void + private function convertIPAddresses(string $tableName, string $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); diff --git a/class/Common/ModuleFeedback.php b/class/Common/ModuleFeedback.php index f4b68532..b756fa70 100644 --- a/class/Common/ModuleFeedback.php +++ b/class/Common/ModuleFeedback.php @@ -36,8 +36,6 @@ class ModuleFeedback extends \XoopsObject /** * Constructor - * - * @param null */ public function __construct() { @@ -45,8 +43,6 @@ public function __construct() /** * @static function &getInstance - * - * @param null */ public static function getInstance(): void { @@ -70,7 +66,9 @@ public function getFormFeedback() $form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true); $form->setExtra('enctype="multipart/form-data"'); - $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail')); + $xoopsModule = $GLOBALS['xoopsModule'] ?? null; + $authorMail = $xoopsModule ? (string)$xoopsModule->getInfo('author_mail') : ''; + $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $authorMail); $recipient->setExtra('disabled="disabled"'); $form->addElement($recipient); $your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index 7fb40989..674b69c0 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -23,10 +23,10 @@ trait ModuleStats { /** * @param \XoopsModules\Modulebuilder\Common\Configurator $configurator - * @param array $moduleStats + * @param array $moduleStats * @return array */ - public static function getModuleStats($configurator, $moduleStats) + public static function getModuleStats(Configurator $configurator, array $moduleStats) { if (\count($configurator->moduleStats) > 0) { foreach (\array_keys($configurator->moduleStats) as $i) { diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index e8d4d9de..48840524 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -62,14 +62,14 @@ public static function getInstance() * www.cakephp.org * * @param string $text String to truncate. - * @param int $length Length of returned string, including ellipsis. + * @param int $length Length of returned string, including ellipsis. * @param string $ending Ending to be appended to the trimmed string. - * @param bool $exact If false, $text will not be cut mid-word - * @param bool $considerHtml If true, HTML tags would be handled correctly + * @param bool $exact If false, $text will not be cut mid-word + * @param bool $considerHtml If true, HTML tags would be handled correctly * * @return string Trimmed string. */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) + public static function truncateHtml(string $text, int $length = 100, string $ending = '...', bool $exact = false, bool $considerHtml = true) { if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text @@ -161,11 +161,11 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options + * @param \Xmf\Module\Helper|null $helper + * @param array|null $options * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ - public static function getEditor($helper = null, $options = null) + public static function getEditor(\Xmf\Module\Helper $helper = null, array $options = null) { /** @var Helper $helper */ if (null === $options) { diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index 1ef283d7..5bf140a6 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -46,7 +46,6 @@ class TableChecker extends \XoopsObject public const CHECKTYPE_UPDATE_REPORT = 2; //update and report /** - * @param \XoopsModules\Modulebuilder\Common\TableChecker|null * @param mixed $mydirname * @param mixed $checktype */ @@ -72,7 +71,7 @@ public function processSQL() if ($numRows) { //table exist $this->result[] = 'Table exist:' . $table; - $ret = $this->checkTableFields($table, $tabledef['fields']); + //$ret = $this->checkTableFields($table, $tabledef['fields']); } else { if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) { // create new table @@ -92,6 +91,8 @@ public function processSQL() if (self::CHECKTYPE_REPORT == $this->checktype || self::CHECKTYPE_UPDATE_REPORT == $this->checktype) { return $this->result; } + + return []; } private function readSQLFile() @@ -156,11 +157,9 @@ private function extractKey($line) { //todo: split string into single keys $needle = '('; - $key_text = \substr($line, \strpos($line, $needle, 0) + 1); + $key_text = \substr($line, \strpos($line, $needle) + 1); $needle = ')'; - $key_text = \substr($key_text, 0, \strpos($key_text, $needle, 0)); - - return $key_text; + return \substr($key_text, 0, \strpos($key_text, $needle)); } private function extractField($line) @@ -191,7 +190,7 @@ private function extractField($line) if (\count($params) > $counter) { if ('default' == \mb_strtolower($params[$counter])) { $field['default'] = $params[$counter] . ' ' . $params[$counter + 1]; - $counter = $counter + 2; + //$counter = $counter + 2; } } @@ -211,7 +210,7 @@ private function checkTableFields($table, $fields) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if ($numRows) { //field exist - $this->checkField($table, $field); + $this->checkField($field); } else { if (self::CHECKTYPE_UPDATE == $this->checktype || self::CHECKTYPE_UPDATE_REPORT == $this->checktype) { // create new field @@ -219,7 +218,7 @@ private function checkTableFields($table, $fields) if ('' !== (string)$field['after']) { $sql .= ' AFTER `' . $field['after'] . '`;'; } - if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { + if ($GLOBALS['xoopsDB']->queryF($sql)) { $this->result[] = 'Field added:' . $fieldname; } else { \xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); @@ -234,11 +233,10 @@ private function checkTableFields($table, $fields) return true; } - private function checkField($table, $field) + private function checkField($field): void { //to be created $this->result[] = 'Field exist:' . $field['name'] . ' - no changes'; - return true; } } diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 75f63d36..3c7791df 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -41,7 +41,7 @@ class TestdataButtons * * @return void */ - public static function loadButtonConfig($adminObject): void + public static function loadButtonConfig(\Xmf\Module\Admin $adminObject): void { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -52,13 +52,13 @@ public static function loadButtonConfig($adminObject): void if (self::SHOW_BUTTONS == $displaySampleButton) { \xoops_loadLanguage('admin/modulesadmin', 'system'); - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load')); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save')); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert'); // $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); } else { - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons'); // $displaySampleButton = $config['displaySampleButton']; } } diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index a18c6f28..fa19754f 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } $success = true; - if ($module->versionCompare($currentVer, $requiredVer, '<')) { + if ($module->versionCompare($currentVer, $requiredVer)) { $success = false; $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } diff --git a/class/Devtools.php b/class/Devtools.php index d9b19930..6481db7c 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -436,9 +436,10 @@ public static function function_tabreplacer($src_path, $dst_path): void * @param $dst_path * @param array $patKeys * @param array $patValues - * @param bool $replaceTabs + * @param bool $replaceTabs + * @param string[] $extensions */ - public static function cloneFileFolder($src_path, $dst_path, $patKeys = [], $patValues = [], $replaceTabs = false, $extensions = ['php']): void + public static function cloneFileFolder($src_path, $dst_path, array $patKeys = [], array $patValues = [], bool $replaceTabs = false, $extensions = ['php']): void { // open the source directory $dir = \opendir($src_path); @@ -463,9 +464,10 @@ 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 + * @param $extensions */ - private static function cloneFile($src_file, $dst_file, $patKeys, $patValues, $replaceTabs, $extensions): void + private static function cloneFile($src_file, $dst_file, array $patKeys, array $patValues, bool $replaceTabs, $extensions): void { $replace_code = false; if (\in_array(\mb_strtolower(\pathinfo($src_file, PATHINFO_EXTENSION)), $extensions)) { @@ -499,7 +501,7 @@ private static function cloneFile($src_file, $dst_file, $patKeys, $patValues, $r * @param bool $action * @return \XoopsSimpleForm */ - public static function getFormModulesFq($action = false) + public static function getFormModulesFq(bool $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -528,7 +530,7 @@ public static function getFormModulesFq($action = false) * @param bool $action * @return \XoopsSimpleForm */ - public static function getFormModulesCl($action = false) + public static function getFormModulesCl(bool $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -557,7 +559,7 @@ public static function getFormModulesCl($action = false) * @param bool $action * @return \XoopsSimpleForm */ - public static function getFormModulesTab($action = false) + public static function getFormModulesTab(bool $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -586,7 +588,7 @@ public static function getFormModulesTab($action = false) * @param bool $action * @return \XoopsSimpleForm */ - public static function getFormModulesRemovePrefix($dst_path, $action = false) + public static function getFormModulesRemovePrefix($dst_path, bool $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; diff --git a/class/Fieldattributes.php b/class/Fieldattributes.php index 23723c3e..0b292d5c 100644 --- a/class/Fieldattributes.php +++ b/class/Fieldattributes.php @@ -36,7 +36,6 @@ class Fieldattributes extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -47,7 +46,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldattributes */ public static function getInstance() diff --git a/class/Fieldelements.php b/class/Fieldelements.php index 35273654..4dec54eb 100644 --- a/class/Fieldelements.php +++ b/class/Fieldelements.php @@ -31,7 +31,6 @@ class Fieldelements extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -48,11 +47,11 @@ public function __construct() /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { $arg = $args[0] ?? null; @@ -61,7 +60,7 @@ public function __call($method, $args) /** * @static function getInstance - * @param null + * * @return Fieldelements */ public static function getInstance() diff --git a/class/FieldelementsHandler.php b/class/FieldelementsHandler.php index 6426927a..503491ef 100644 --- a/class/FieldelementsHandler.php +++ b/class/FieldelementsHandler.php @@ -40,13 +40,13 @@ public function __construct(\XoopsDatabase $db) /** * Get Count Fields. - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return int */ - public function getCountFieldelements($start = 0, $limit = 0, $sort = 'fieldelement_id ASC, fieldelement_name', $order = 'ASC') + public function getCountFieldelements(int $start = 0, int $limit = 0, string $sort = 'fieldelement_id ASC, fieldelement_name', string $order = 'ASC') { $crCountFieldElems = new \CriteriaCompo(); $crCountFieldElems = $this->getFieldelementsCriteria($crCountFieldElems, $start, $limit, $sort, $order); @@ -56,13 +56,13 @@ public function getCountFieldelements($start = 0, $limit = 0, $sort = 'fieldelem /** * Get Objects Fields. - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getObjectsFieldelements($start = 0, $limit = 0, $sort = 'fieldelement_id ASC, fieldelement_name', $order = 'ASC') + public function getObjectsFieldelements(int $start = 0, int $limit = 0, string $sort = 'fieldelement_id ASC, fieldelement_name', string $order = 'ASC') { $crObjectsFieldElems = new \CriteriaCompo(); $crObjectsFieldElems = $this->getFieldelementsCriteria($crObjectsFieldElems, $start, $limit, $sort, $order); @@ -72,13 +72,13 @@ public function getObjectsFieldelements($start = 0, $limit = 0, $sort = 'fieldel /** * Get All Fields. - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getAllFieldelements($start = 0, $limit = 0, $sort = 'fieldelement_id ASC, fieldelement_name', $order = 'ASC') + public function getAllFieldelements(int $start = 0, int $limit = 0, string $sort = 'fieldelement_id ASC, fieldelement_name', string $order = 'ASC') { $crAllFieldElems = new \CriteriaCompo(); $crAllFieldElems = $this->getFieldelementsCriteria($crAllFieldElems, $start, $limit, $sort, $order); @@ -89,13 +89,13 @@ public function getAllFieldelements($start = 0, $limit = 0, $sort = 'fieldelemen /** * Get All Fields By Module & Table Id. * @param $tabId - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getAllFieldelementsByTableId($tabId, $start = 0, $limit = 0, $sort = 'fieldelement_id ASC, fieldelement_name', $order = 'ASC') + public function getAllFieldelementsByTableId($tabId, int $start = 0, int $limit = 0, string $sort = 'fieldelement_id ASC, fieldelement_name', string $order = 'ASC') { $crAllFieldElemsByModule = new \CriteriaCompo(); $crAllFieldElemsByModule->add(new \Criteria('fieldelement_tid', $tabId)); @@ -126,13 +126,13 @@ private function getFieldelementsCriteria($crFieldElemsCriteria, $start, $limit, /** * Get Fieldelements Criteria. * @param $crFieldElemsCriteria - * @param $start - * @param $limit - * @param $sort - * @param $order - * @return mixed + * @param int $start + * @param int $limit + * @param string $sort + * @param string $order + * @return array */ - public function getFieldelementsList($crFieldElemsCriteria, $start = 0, $limit = 0, $sort = 'fieldelement_sort', $order = 'ASC') + public function getFieldelementsList($crFieldElemsCriteria, int $start = 0, int $limit = 0, string $sort = 'fieldelement_sort', string $order = 'ASC') { $crFieldElems = $this->getFieldelementsCriteria($crFieldElemsCriteria, $start, $limit, $sort, $order); $fieldeleArr = $this->getAll($crFieldElems); diff --git a/class/Fieldkey.php b/class/Fieldkey.php index 8bdc1622..b9556d7f 100644 --- a/class/Fieldkey.php +++ b/class/Fieldkey.php @@ -31,7 +31,6 @@ class Fieldkey extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -42,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldkey */ public static function getInstance() diff --git a/class/Fieldnull.php b/class/Fieldnull.php index 2b368711..6bb16940 100644 --- a/class/Fieldnull.php +++ b/class/Fieldnull.php @@ -31,7 +31,6 @@ class Fieldnull extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -42,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldnull */ public static function getInstance() diff --git a/class/Fields.php b/class/Fields.php index 8d30ae19..c857279c 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -32,8 +32,6 @@ class Fields extends \XoopsObject { /** * @public function constructor class - * - * @param null */ public function __construct() { @@ -68,11 +66,11 @@ public function __construct() /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { $arg = $args[0] ?? null; @@ -101,14 +99,14 @@ public static function getInstance() * @param $prefix * @return Modulebuilder\Form\ThemeForm */ - private function getHeaderForm($prefix, $action = false) + private function getHeaderForm($prefix, bool $action = false) { if (false === $action) { $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } $isNew = $this->isNew(); - $title = $isNew ? \sprintf(\_AM_MODULEBUILDER_FIELDS_NEW) : \sprintf(\_AM_MODULEBUILDER_FIELDS_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_FIELDS_NEW : \_AM_MODULEBUILDER_FIELDS_EDIT; $form = new Modulebuilder\Form\ThemeForm(null, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); @@ -145,7 +143,7 @@ private function getHeaderForm($prefix, $action = false) * @param bool $action * @return mixed */ - public function getFormNew($fieldMid = null, $fieldTid = null, $fieldNumb = null, $fieldName = null, $action = false) + public function getFormNew($fieldMid = null, $fieldTid = null, $fieldNumb = null, $fieldName = null, bool $action = false) { $helper = Modulebuilder\Helper::getInstance(); // Get handler tables @@ -338,7 +336,7 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName, * @param bool $action * @return mixed */ - public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false) + public function getFormEdit($fieldMid = null, $fieldTid = null, bool $action = false) { $helper = Modulebuilder\Helper::getInstance(); $tablesHandler = $helper->getHandler('Tables'); diff --git a/class/FieldsHandler.php b/class/FieldsHandler.php index 2f1baaaf..96074e00 100644 --- a/class/FieldsHandler.php +++ b/class/FieldsHandler.php @@ -51,22 +51,20 @@ public function create($isNew = true) /** * retrieve a field. * - * @param int $i field id + * @param int $id field id * @param null $fields * - * @return mixed reference to the Fields object + * @return \XoopsObject|null reference to the Fields object * object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** * get inserted id. * - * @param null - * * @return int reference to the {@link Fields} object */ public function getInsertId() @@ -76,13 +74,13 @@ public function getInsertId() /** * Get Count Fields. - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return int */ - public function getCountFields($start = 0, $limit = 0, $sort = 'field_id ASC, field_name', $order = 'ASC') + public function getCountFields(int $start = 0, int $limit = 0, string $sort = 'field_id ASC, field_name', string $order = 'ASC') { $crCountFields = new \CriteriaCompo(); $crCountFields = $this->getFieldsCriteria($crCountFields, $start, $limit, $sort, $order); @@ -92,13 +90,13 @@ public function getCountFields($start = 0, $limit = 0, $sort = 'field_id ASC, fi /** * Get All Fields. - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getAllFields($start = 0, $limit = 0, $sort = 'field_id ASC, field_name', $order = 'ASC') + public function getAllFields(int $start = 0, int $limit = 0, string $sort = 'field_id ASC, field_name', string $order = 'ASC') { $crAllFields = new \CriteriaCompo(); $crAllFields = $this->getFieldsCriteria($crAllFields, $start, $limit, $sort, $order); @@ -109,13 +107,13 @@ public function getAllFields($start = 0, $limit = 0, $sort = 'field_id ASC, fiel /** * Get All Fields By Module & Table Id. * @param $tabId - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getAllFieldsByTableId($tabId, $start = 0, $limit = 0, $sort = 'field_order ASC, field_id, field_name', $order = 'ASC') + public function getAllFieldsByTableId($tabId, int $start = 0, int $limit = 0, string $sort = 'field_order ASC, field_id, field_name', string $order = 'ASC') { $crAllFieldsByModule = new \CriteriaCompo(); $crAllFieldsByModule->add(new \Criteria('field_tid', $tabId)); diff --git a/class/Fieldtype.php b/class/Fieldtype.php index 673ef289..1b3d32dc 100644 --- a/class/Fieldtype.php +++ b/class/Fieldtype.php @@ -31,7 +31,6 @@ class Fieldtype extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -42,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldtype */ public static function getInstance() diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index e0dd7a6c..5f7755ed 100644 --- a/class/Files/Admin/AdminBroken.php +++ b/class/Files/Admin/AdminBroken.php @@ -46,7 +46,6 @@ class AdminBroken extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return AdminBroken */ @@ -88,22 +87,21 @@ public function write($module, $tables, $filename) /** * @private function getAdminBrokenHeader * @param $moduleDirname - * @param $tableName - * @param string $t * @return string */ - private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '') + private function getAdminBrokenHeader($moduleDirname) { + $tableName = 'broken'; $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); $ret .= $this->getRequire(); $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet', '', $t); - $ret .= $this->xc->getXcXoThemeAddStylesheet('style', $t); - $ret .= $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet', ''); + $ret .= $this->xc->getXcXoThemeAddStylesheet(); + $ret .= $this->axc->getAdminTemplateMain($moduleDirname, $tableName); $navigation = $this->axc->getAdminDisplayNavigation($tableName); - $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); + $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation); return $ret; } @@ -111,11 +109,10 @@ private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '') /** * @private function getAdminBrokenList * @param $tables - * @param $language - * @param string $t + * @param string $language * @return string */ - private function getAdminBrokenList($tables, $language, $t = '') + private function getAdminBrokenList($tables, string $language) { $ret = ''; foreach (\array_keys($tables) as $i) { @@ -124,10 +121,10 @@ private function getAdminBrokenList($tables, $language, $t = '') $tableSoleName = $tables[$i]->getVar('table_solename'); $ucfTableName = \ucfirst($tableName); $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Check table', $tableName, $t); - $ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', false, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Check table', $tableName, ''); + $ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', false, ''); $adminpager = $this->xc->getXcGetConfig('adminpager'); - $ret .= $this->xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', false, $t); + $ret .= $this->xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', false, ''); $critName = 'cr' . $ucfTableName; $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); @@ -147,30 +144,30 @@ private function getAdminBrokenList($tables, $language, $t = '') } } - $ret .= $this->xc->getXcCriteriaCompo($critName, $t); + $ret .= $this->xc->getXcCriteriaCompo($critName, ''); $constant = $this->xc->getXcGetConstants('STATUS_BROKEN'); - $crit = $this->xc->getXcCriteria('', "'{$fieldSatus}'", $constant, '', true); - $ret .= $this->xc->getXcCriteriaAdd($critName, $crit, $t); - $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); - $ret .= $this->xc->getXcXoopsTplAssign($tableName . '_count', "\${$tableName}Count", true, $t); + $crit = $this->xc->getXcCriteria('', "'$fieldSatus'", $constant, '', true); + $ret .= $this->xc->getXcCriteriaAdd($critName, $crit, ''); + $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, ''); + $ret .= $this->xc->getXcXoopsTplAssign($tableName . '_count', "\${$tableName}Count", true, ''); $sprintf = $this->pc->getPhpCodeSprintf($language . 'BROKEN_RESULT', "'{$ucfTableName}'"); - $ret .= $this->xc->getXcXoopsTplAssign($tableName . '_result', $sprintf, true, $t); - - $ret .= $this->xc->getXcCriteriaSetStart($critName, '$start', $t); - $ret .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t); - $contIf = $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", $t . "\t"); - $foreach = $this->xc->getXcEqualsOperator("\${$tableSoleName}['table']", "'{$ucfTableName}'", '', $t . "\t\t"); - $foreach .= $this->xc->getXcEqualsOperator("\${$tableSoleName}['key']", "'{$fieldId}'", '', $t . "\t\t"); - $foreach .= $this->xc->getXcGetVar("{$tableSoleName}['keyval']", "{$tableName}All[\$i]", "{$fieldId}", false, $t . "\t\t"); - $foreach .= $this->xc->getXcGetVar("{$tableSoleName}['main']", "{$tableName}All[\$i]", "{$fieldMain}", false, $t . "\t\t"); - $foreach .= $this->xc->getXcXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}", $t . "\t\t"); - $contIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t . "\t"); - $contIf .= $this->xc->getXcPageNav($tableName, $t . "\t", 'start' . $ucfTableName, "'op=list&limit{$ucfTableName}=' . \$limit"); + $ret .= $this->xc->getXcXoopsTplAssign($tableName . '_result', $sprintf, true, ''); + + $ret .= $this->xc->getXcCriteriaSetStart($critName, '$start', ''); + $ret .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', ''); + $contIf = $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", '' . "\t"); + $foreach = $this->xc->getXcEqualsOperator("\${$tableSoleName}['table']", "'{$ucfTableName}'", '', '' . "\t\t"); + $foreach .= $this->xc->getXcEqualsOperator("\${$tableSoleName}['key']", "'{$fieldId}'", '', '' . "\t\t"); + $foreach .= $this->xc->getXcGetVar("{$tableSoleName}['keyval']", "{$tableName}All[\$i]", "{$fieldId}", false, '' . "\t\t"); + $foreach .= $this->xc->getXcGetVar("{$tableSoleName}['main']", "{$tableName}All[\$i]", "{$fieldMain}", false, '' . "\t\t"); + $foreach .= $this->xc->getXcXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}", '' . "\t\t"); + $contIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, '' . "\t"); + $contIf .= $this->xc->getXcPageNav($tableName, '' . "\t", 'start' . $ucfTableName, "'op=list&limit{$ucfTableName}=' . \$limit", 'pagenav_' . $tableName); $sprintf = $this->pc->getPhpCodeSprintf($language . 'BROKEN_NODATA', "'{$ucfTableName}'"); - $contElse = $this->xc->getXcXoopsTplAssign('nodata' . $ucfTableName, $sprintf, true, $t . "\t"); + $contElse = $this->xc->getXcXoopsTplAssign('nodata' . $ucfTableName, $sprintf, true, '' . "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contIf, $contElse, $t); - $ret .= $this->pc->getPhpCodeUnset($critName, $t); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contIf, $contElse, ''); + $ret .= $this->pc->getPhpCodeUnset($critName, ''); } } @@ -181,9 +178,9 @@ private function getAdminBrokenList($tables, $language, $t = '') /** * @public function render - * @param null + * - * @return bool|string + * @return string */ public function render() { @@ -196,7 +193,7 @@ public function render() $language = $this->getLanguage($moduleDirname, 'AM'); $content = $this->getHeaderFilesComments($module); - $content .= $this->getAdminBrokenHeader($moduleDirname, 'broken'); + $content .= $this->getAdminBrokenHeader($moduleDirname); $content .= $this->getAdminBrokenList($tables, $language); $content .= $this->getRequire('footer'); diff --git a/class/Files/Admin/AdminHeader.php b/class/Files/Admin/AdminHeader.php index ca6628db..4d2a438a 100644 --- a/class/Files/Admin/AdminHeader.php +++ b/class/Files/Admin/AdminHeader.php @@ -42,7 +42,6 @@ class AdminHeader extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * @return AdminHeader */ public static function getInstance() @@ -68,12 +67,12 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table - * @param array $tables + * @param array $tables * @param string $filename */ - public function write($module, $table, $tables, $filename): void + public function write($module, $table, array $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -121,7 +120,7 @@ private function getAdminHeader($moduleDirname) $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"); - $ret .= $this->pc->getPhpCodeConditions('!isset($xoopsTpl)', ' || ', '!\is_object($xoopsTpl)', $template, false); + $ret .= $this->pc->getPhpCodeConditions('!isset($xoopsTpl)', ' || ', '!\is_object($xoopsTpl)', $template); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Load languages'); $ret .= $this->xc->getXcXoopsLoadLanguage('admin', '', $moduleDirname); @@ -145,14 +144,15 @@ private function getAdminHeader($moduleDirname) $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcEqualsOperator('$adminObject', '\Xmf\Module\Admin::getInstance()'); $ret .= $this->getSimpleString("\$style = \\{$stuModuleDirname}_URL . '/assets/css/admin/style.css';"); + $ret .= $this->xc->getXcXoThemeAddStylesheet(); return $ret; } /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { diff --git a/class/Files/Admin/AdminIndex.php b/class/Files/Admin/AdminIndex.php index b5e8b1a4..f2d8eeab 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -46,7 +46,6 @@ class AdminIndex extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,7 @@ public function __construct() /** * @static function getInstance - * @param null + * @return AdminIndex */ public static function getInstance() @@ -73,11 +72,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $tables * @param string $filename */ - public function write($module, $tables, $filename) + public function write($module, $tables, string $filename) { $this->setModule($module); $this->setTables($tables); @@ -131,30 +130,35 @@ private function getAdminIndex($module) if (\is_array($tables) && \in_array(1, $tableInstall)) { $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Upload Folders'); + $ret .= $this->pc->getPhpCodeArray('folder',null,false,''); $ret .= $this->xc->getXcEqualsOperator('$configurator', 'new Common\Configurator()'); $cond = '$configurator->uploadFolders && \is_array($configurator->uploadFolders)'; $fe_action = $this->xc->getXcEqualsOperator('$folder[]', '$configurator->uploadFolders[$i]', '',"\t\t"); $condIf = $this->pc->getPhpCodeForeach('configurator->uploadFolders', true, false, 'i', $fe_action, "\t"); - $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf, false); + $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf); $ret .= $this->pc->getPhpCodeCommentLine('Uploads Folders Created'); - $boxLine = $this->axc->getAxcAddConfigBoxLine('$folder[$i]', 'folder', '', "\t"); - $boxLine .= $this->axc->getAxcAddConfigBoxLine("[\$folder[\$i], '777']", 'chmod', '', "\t"); - $ret .= $this->pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine) . PHP_EOL; + $boxLine = $this->axc->getAxcAddConfigBoxLine('$folder[$i]', 'folder', '', "\t\t"); + $boxLine .= $this->axc->getAxcAddConfigBoxLine("[\$folder[\$i], '777']", 'chmod', '', "\t\t"); + $cond = '$folder'; + $condIf = $this->pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, "\t"); + $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf); + $ret .= $this->pc->getPhpCodeBlankLine(); } + $ret .= $this->pc->getPhpCodeCommentLine('Render Index'); $ret .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')"); - $ret .= $this->pc->getPhpCodeCommentLine('Test Data'); $condIf = $this->xc->getXcXoopsLoadLanguage('admin/modulesadmin',"\t", 'system'); - $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->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'testdata/index', true, false,'',"\t"); + $condIf .= $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_ADD_SAMPLEDATA')", '', '', '../testdata/index.php?op=load', 'samplebutton', "\t"); + $condIf .= $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_SAVE_SAMPLEDATA')", '', '', '../testdata/index.php?op=save', 'samplebutton', "\t"); + $condIf .= '//' . $this->axc->getAdminItemButton("\constant('CO_' . \$moduleDirNameUpper . '_EXPORT_SCHEMA')", '', '', '../testdata/index.php?op=exportschema', 'samplebutton', "\t"); $condIf .= $this->axc->getAdminDisplayButton('left', "\t"); $cond = $this->xc->getXcGetConfig('displaySampleButton'); - $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf, false); + $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $condIf); $ret .= $this->xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()'); - $ret .= $this->pc->getPhpCodeCommentLine('End Test Data'); + + $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->getRequire('footer'); @@ -163,8 +167,8 @@ private function getAdminIndex($module) /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { diff --git a/class/Files/Admin/AdminMenu.php b/class/Files/Admin/AdminMenu.php index 99908120..57ca4d9d 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -38,7 +38,6 @@ class AdminMenu extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -48,7 +47,7 @@ public function __construct() /** * @static function getInstance - * @param null + * @return AdminMenu */ public static function getInstance() @@ -63,10 +62,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -75,10 +74,10 @@ public function write($module, $filename): void /** * @private function getAdminMenuArray * @param array $param - * @param bool $adminObject + * @param bool $adminObject * @return string */ - private function getAdminMenuArray($param = [], $adminObject = false) + private function getAdminMenuArray(array $param = [], bool $adminObject = false) { $ret = ''; if ($adminObject) { @@ -98,7 +97,7 @@ private function getAdminMenuArray($param = [], $adminObject = false) /** * @private function getAdminMenuHeader - * @param null + * @return string */ private function getAdminMenuHeader() @@ -120,28 +119,26 @@ private function getAdminMenuHeader() /** * @private function getAdminMenuDashboard * @param string $language - * @param int $menu + * @param int $menu * * @return string */ - private function getAdminMenuDashboard($language, $menu) + private function getAdminMenuDashboard(string $language, int $menu) { $param = ['title' => "{$language}{$menu}", 'link' => "'admin/index.php'", 'icon' => "\$sysPathIcon32.'/dashboard.png'"]; - $ret = $this->getAdminMenuArray($param, true); - - return $ret; + return $this->getAdminMenuArray($param, true); } /** * @private function getAdminMenuList - * @param string $module + * @param $module * @param string $language * @param string $langAbout - * @param int $menu + * @param int $menu * * @return string */ - private function getAdminMenuList($module, $language, $langAbout, $menu) + private function getAdminMenuList($module, string $language, string $langAbout, int $menu) { $ret = ''; $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); @@ -181,8 +178,8 @@ private function getAdminMenuList($module, $language, $langAbout, $menu) /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index 43d70667..18cf7d81 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -50,7 +50,6 @@ class AdminPermissions extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -64,7 +63,7 @@ public function __construct() /** * @static function getInstance * - * @param null + * * @return AdminPermissions */ @@ -81,13 +80,13 @@ public static function getInstance() /** * @public function write * - * @param string $module + * @param $module * @param mixed $tables * @param string $filename * * @return null */ - public function write($module, $tables, $filename) + public function write($module, $tables, string $filename) { $this->setModule($module); $this->setTables($tables); @@ -191,12 +190,12 @@ private function getPermissionsSwitch($module, $language) /** * @private function getPermissionsBody * - * @param string $module + * @param $module * @param string $language * * @return string */ - private function getPermissionsBody($module, $language) + private function getPermissionsBody($module, string $language) { $tables = $this->getTableTables($module->getVar('mod_id')); @@ -207,7 +206,7 @@ private function getPermissionsBody($module, $language) $if1 = $this->pc->getPhpCodeForeach('globalPerms', false, 'gPermId', 'gPermName', $foreach1, "\t"); $if1 .= $this->xc->getXcXoopsTplAssign('form', '$permform->render()', true, "\t"); $if1 .= $this->xc->getXcEqualsOperator('$permFound', 'true', null, "\t"); - $ret .= $this->pc->getPhpCodeConditions("'global'", ' === ', '$op', $if1, false); + $ret .= $this->pc->getPhpCodeConditions("'global'", ' === ', '$op', $if1); foreach (\array_keys($tables) as $t) { if (1 == $tables[$t]->getVar('table_permissions')) { @@ -215,18 +214,9 @@ private function getPermissionsBody($module, $language) $tableMid = $tables[$t]->getVar('table_mid'); $tableName = $tables[$t]->getVar('table_name'); $fields = $this->getTableFields($tableMid, $tableId); - $fieldId = 'id'; - $fieldMain = 'title'; - foreach (\array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - if (0 == $f) { - $fieldId = $fieldName; - } - if (1 == $fields[$f]->getVar('field_main')) { - $fieldMain = $fieldName; - } - } - $if_count = $this->xc->getXcHandlerAllObj($tableName, $fieldMain, 0, 0, "\t\t"); + $fieldId = $this->xc->getXcTableFieldId($fields); + $fieldMain = $this->xc->getXcTableFieldMain($fields); + $if_count = $this->xc->getXcHandlerAllObj($tableName, $fieldMain, '0', '0', "\t\t"); $getVar1 = $this->xc->getXcGetVar('', "{$tableName}All[\$i]", $fieldId, true); $getVar2 = $this->xc->getXcGetVar('', "{$tableName}All[\$i]", $fieldMain, true); $fe_content = $this->xc->getXcAddItem('permform', $getVar1, $getVar2, "\t\t\t"); @@ -236,14 +226,14 @@ private function getPermissionsBody($module, $language) $if_table .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $if_count, false, "\t"); $if_table .= $this->xc->getXcEqualsOperator('$permFound', 'true', null, "\t"); $cond = "'approve_{$tableName}' === \$op || 'submit_{$tableName}' === \$op || 'view_{$tableName}' === \$op"; - $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $if_table, false); + $ret .= $this->pc->getPhpCodeConditions($cond, '', '', $if_table); } } $ret .= $this->pc->getPhpCodeUnset('permform'); $elseInter = $this->xc->getXcRedirectHeader("'permissions.php'", '', '3', "{$language}NO_PERMISSIONS_SET", false, "\t"); $elseInter .= $this->getSimpleString('exit();', "\t"); - $ret .= $this->pc->getPhpCodeConditions('$permFound', ' !== ', 'true', $elseInter, false); + $ret .= $this->pc->getPhpCodeConditions('$permFound', ' !== ', 'true', $elseInter); return $ret; } @@ -251,9 +241,9 @@ private function getPermissionsBody($module, $language) /** * @public function render * - * @param null + * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Assets/Css/Admin/CssAdminStyles.php b/class/Files/Assets/Css/Admin/CssAdminStyles.php index 73ea5c8f..64e2e5a3 100644 --- a/class/Files/Assets/Css/Admin/CssAdminStyles.php +++ b/class/Files/Assets/Css/Admin/CssAdminStyles.php @@ -32,7 +32,6 @@ class CssAdminStyles extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -41,7 +40,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return CssAdminStyles */ public static function getInstance() @@ -67,8 +66,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Assets/Css/CssSelectors.php b/class/Files/Assets/Css/CssSelectors.php index b57b1893..4318e8f8 100644 --- a/class/Files/Assets/Css/CssSelectors.php +++ b/class/Files/Assets/Css/CssSelectors.php @@ -30,7 +30,6 @@ class CssSelectors { /** * @static function getInstance - * @param null * * @return CssSelectors */ @@ -52,19 +51,17 @@ public static function getInstance() */ public function geCssComment($comment, $t) { - $ret = ('' != $comment) ? "{$t}/* {$comment} */" : ''; - - return $ret; + return ('' != $comment) ? "{$t}/* {$comment} */" : ''; } /** * @public function geCssSelector - * @param string $selector + * @param mixed $selector * @param mixed $content * @param string $t * @return string */ - public function geCssSelector($selector, $content, $t) + public function geCssSelector($selector, $content, string $t) { $ret = ''; if (\is_array($selector)) { diff --git a/class/Files/Assets/Css/CssStyles.php b/class/Files/Assets/Css/CssStyles.php index d098afcc..ef1ce279 100644 --- a/class/Files/Assets/Css/CssStyles.php +++ b/class/Files/Assets/Css/CssStyles.php @@ -32,7 +32,6 @@ class CssStyles extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -41,7 +40,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return CssStyles */ public static function getInstance() @@ -67,8 +66,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Assets/Js/JavascriptJQuery.php b/class/Files/Assets/Js/JavascriptJQuery.php index 530722e0..b06d84d6 100644 --- a/class/Files/Assets/Js/JavascriptJQuery.php +++ b/class/Files/Assets/Js/JavascriptJQuery.php @@ -33,7 +33,6 @@ class JavascriptJQuery extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -42,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return JavascriptJQuery */ public static function getInstance() @@ -57,10 +56,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -68,13 +67,12 @@ public function write($module, $filename): void /** * @public function getJavascriptJQueryButtons - * @param null * * @return string */ public function getJavascriptJQueryButtons() { - $ret = << EOT; - - return $ret; } /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Assets/Js/JsJquery.php b/class/Files/Assets/Js/JsJquery.php index 973b7f6f..38d4698b 100644 --- a/class/Files/Assets/Js/JsJquery.php +++ b/class/Files/Assets/Js/JsJquery.php @@ -39,7 +39,6 @@ class JsJquery extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -49,7 +48,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return JsJquery */ public static function getInstance() @@ -64,10 +63,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -75,8 +74,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 0796ded2..382b2e00 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -45,7 +45,6 @@ class BlocksFiles extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return BlocksFiles */ public static function getInstance() @@ -71,7 +70,7 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param $filename */ @@ -93,7 +92,7 @@ public function write($module, $table, $filename): void * @param int $fieldParent * @return string */ - private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tablePermissions, $fields, $fieldId, $fieldParent = 0) + private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tablePermissions, $fields, $fieldId, int $fieldParent = 0) { $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; @@ -109,16 +108,15 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab } $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); - $func = $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); + $func = $this->xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); if (1 === $configMaxchar) { - $func .= $this->xc->getXcEqualsOperator('$utility ', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$editorMaxchar', $this->xc->getXcGetConfig('editor_maxchar'), false, "\t"); + $func .= $this->xc->getXcEqualsOperator('$utility ', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\t"); } //$func .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); - $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); - $func .= $this->xc->getXcEqualsOperator('$lenghtTitle ', '$options[2]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$block ', '[]', '',"\t"); + $func .= $this->xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); + $func .= $this->xc->getXcEqualsOperator('$lenghtTitle', '$options[2]','',"\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); @@ -159,7 +157,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab } } if ('' !== $fieldStatus) { - $constant = $this->xc->getXcGetConstants('PERM_GLOBAL_VIEW'); + $constant = $this->xc->getXcGetConstants('STATUS_OFFLINE'); $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'>'", true); $func .= $this->pc->getPhpCodeCommentLine("Criteria for status field",'',"\t"); $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); @@ -186,20 +184,19 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $crit = $this->xc->getXcCriteria('', "'{$fieldDate}'", '\time()', "'<='", true); $case2[] = $this->xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); $case2[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldDate}'","\t\t\t"); - $case2[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); + $case2[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); $case3[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} hits",'',"\t\t\t"); $case3[] = $this->pc->getPhpCodeCommentLine("Table {$tableName} must have {$tableFieldname}_hits or you have to change into corresponding field name",'',"\t\t\t"); $case3[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_hits'","\t\t\t"); $case3[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); + $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); if ('' !== $fieldRating) { - $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$fieldRating}'","\t\t\t"); } else { - $case4[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); $case4[] = $this->pc->getPhpCodeCommentLine("Table {$tableName} must have {$tableFieldname}_top or you have to change into corresponding field name",'',"\t\t\t"); $case4[] = $this->xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'","\t\t\t"); } - $case4[] = $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); + $case4[] = $this->xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); $case5[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} random",'',"\t\t\t"); $case5[] = $this->xc->getXcCriteriaSetSort($critName, "'RAND()'","\t\t\t"); $cases = [ @@ -222,7 +219,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', "\t"); $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); $func .= $this->pc->getPhpCodeUnset($critName, "\t"); - $contentForeach = ''; + $contentForeach = $this->xc->getXcEqualsOperator("\${$tableName}","\${$tableName}All[\$i]->getValues{$ucfTableName}()", '', "\t\t\t"); $contentForeach .= $this->pc->getPhpCodeCommentMultiLine([ 'If you want to use the parameter for limits you have to adapt the line where it should be applied' => '', 'e.g. change' => '', @@ -234,32 +231,62 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab "\t" . '}' => '', "\t\$block[\$i]['title'] = " => '$myTitle;', ], "\t\t\t", false); + $lenName = 0; + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + if (1 == $fields[$f]->getVar('field_block')) { + switch ($fieldElement) { + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $lenName = max(strlen($this->getRightString($fieldName)) + 6, $lenName); + break; + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_TEXTDATESELECT: + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + case Constants::FIELD_ELE_DATETIME: + $lenName = max(strlen($this->getRightString($fieldName)) + 5, $lenName); + break; + case 0: + default: + $lenName = max(strlen($this->getRightString($fieldName)), $lenName); + break; + } + } + } + $lenName += 15; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); $fieldElement = $fields[$f]->getVar('field_element'); if (0 == $f) { - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['id']", "\${$tableName}All[\$i]->getVar('{$fieldId}')", null, "\t\t\t"); + $contentForeach .= $this->xc->getXcEqualsOperator(str_pad("\$block[\$i]['id']", $lenName), "\${$tableName}['{$rpFieldName}']", null, "\t\t\t"); } if (1 == $fields[$f]->getVar('field_block')) { switch ($fieldElement) { - case Constants::FIELD_ELE_TEXT: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\htmlspecialchars(\${$tableName}All[\$i]->getVar('{$fieldName}'), ENT_QUOTES | ENT_HTML5)", null, "\t\t\t"); - break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}_text']", "\${$tableName}All[\$i]->getVar('{$fieldName}', 'e')", null, "\t\t\t"); - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}_short']", "\$utility::truncateHtml(\${$tableName}All[\$i]->getVar('{$fieldName}', 'e'), \$editorMaxchar)", null, "\t\t\t"); + $contentForeach .= $this->xc->getXcEqualsOperator(str_pad("\$block[\$i]['{$rpFieldName}_text']", $lenName), "\${$tableName}['{$rpFieldName}_text']", null, "\t\t\t"); + $truncate = "\$utility::truncateHtml(\$block[\$i]['{$rpFieldName}_text'], \$lenghtTitle)"; + $contentForeach .= $this->xc->getXcEqualsOperator(str_pad("\$block[\$i]['{$rpFieldName}_short']", $lenName), $truncate, false, "\t\t\t"); break; - case 8: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + case Constants::FIELD_ELE_TEXTDATESELECT: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_SELECTUSER: + $contentForeach .= $this->xc->getXcEqualsOperator(str_pad("\$block[\$i]['{$rpFieldName}_text']", $lenName), "\${$tableName}['{$rpFieldName}_text']", null, "\t\t\t"); break; - case 15: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","\\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + case Constants::FIELD_ELE_SELECTSTATUS: + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $contentForeach .= $this->xc->getXcEqualsOperator(str_pad("\$block[\$i]['{$rpFieldName}_text']", $lenName),"\${$tableName}['{$rpFieldName}_text']", null, "\t\t\t"); break; + case 0: + case Constants::FIELD_ELE_TEXT: default: - $contentForeach .= $this->xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","\${$tableName}All[\$i]->getVar('{$fieldName}')", null, "\t\t\t"); + $contentForeach .= $this->xc->getXcEqualsOperator(str_pad("\$block[\$i]['{$rpFieldName}']", $lenName),"\${$tableName}['{$rpFieldName}']", null, "\t\t\t"); break; } } @@ -269,11 +296,13 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab $func .= $this->pc->getPhpCodeConditions("\count(\${$tableName}All)", ' > ', '0', $foreach, false, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_url", "\\{$stuModuleDirname}_URL", true ,"\t"); + $config = $this->xc->getXcGetConfig('table_type'); + $func .= $this->xc->getXcXoopsTplAssign('table_type', $config, true, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); $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, ''); return $ret; } @@ -288,7 +317,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab * * @return string */ - private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $language) + private function getBlocksEdit(string $moduleDirname, string $tableName, string $fieldId, string $fieldMain, string $language) { $stuModuleDirname = \mb_strtoupper($moduleDirname); $stuTableName = \mb_strtoupper($tableName); @@ -296,7 +325,7 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $critName = 'cr' . $ucfTableName; $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); - $func = $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",'',"\t"); + $func = $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",true,"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "{$language}DISPLAY . ' : '", '',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "\"\"", '.',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.',"\t"); @@ -305,11 +334,7 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeArrayShift('$options', "\t"); $func .= $this->pc->getPhpCodeBlankLine(); - $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); - $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); - $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); - $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t"); - $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t"); + $func .= $this->pc->getPhpCodeCommentMultiLine([ 'If you want to filter your results by e.g. a category used in your' . $tableName => '', 'then you can activate the following code, but you have to change it according your category' => '' @@ -317,6 +342,11 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->getSimpleString('/*', "\t"); $func .= $this->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); $func .= $this->xc->getXcHandlerLine($tableName, "\t"); + $func .= $this->xc->getXcCriteriaCompo($critName, "\t"); + $crit = $this->xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); + $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); + $func .= $this->xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t"); + $func .= $this->xc->getXcCriteriaSetOrder($critName, "'ASC'","\t"); $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); $func .= $this->pc->getPhpCodeUnset($critName, "\t"); $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    \"", '.',"\t"); $func .= $this->xc->getXcEqualsOperator('$form', "\" 
    \"", '.',"\t"); @@ -235,7 +285,8 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $func .= $this->xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
    '", '.',"\t"); $func .= $this->pc->getPhpCodeBlankLine(); @@ -250,9 +301,8 @@ private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/CheckData.php b/class/Files/CheckData.php index 7b042e5b..8dba3b1a 100644 --- a/class/Files/CheckData.php +++ b/class/Files/CheckData.php @@ -52,7 +52,6 @@ class CheckData /** * @public function constructor - * @param null */ public function __construct() { @@ -62,8 +61,6 @@ public function __construct() /** * @static function getInstance * - * @param null - * * @return Modulebuilder\Files\CheckData */ public static function getInstance() @@ -102,9 +99,9 @@ public function getCheckPreBuilding($module) /** * @public function getCheckBroken * - * @return array|bool + * @return void */ - private function getCheckBroken() + private function getCheckBroken(): void { foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_broken')) { @@ -126,16 +123,14 @@ private function getCheckBroken() } } } - - return true; } /** * @private function getCheckUserpage * - * @return array|bool + * @return void */ - private function getCheckUserpage() + private function getCheckUserpage(): void { //check field params: minimum one param is selected foreach (\array_keys($this->tables) as $t) { @@ -258,15 +253,14 @@ private function getCheckUserpage() } } - return true; } /** * @private function getCheckBlock * - * @return array|bool + * @return void */ - private function getCheckBlock() + private function getCheckBlock(): void { //use in block but no field selected foreach (\array_keys($this->tables) as $t) { @@ -306,15 +300,14 @@ private function getCheckBlock() } } - return true; } /** * @private function getCheckComments * - * @return array|bool + * @return void */ - private function getCheckComments() + private function getCheckComments(): void { //use comments in multiple tables $count = 0; @@ -350,15 +343,14 @@ private function getCheckComments() } } - return true; } /** * @private function getCheckRatings * - * @return array|bool + * @return void */ - private function getCheckRating() + private function getCheckRating(): void { foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_rate')) { @@ -376,27 +368,26 @@ private function getCheckRating() } } // check whether each table with handling "rating" has also a field "rating" - if (0 == (int)$fieldRatings) { + if (0 == $fieldRatings) { $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) { + if (0 == $fieldVotes) { $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS2); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } } - return true; } /** * @private function getCheckReads * - * @return array|bool + * @return void */ - private function getCheckReads() + private function getCheckReads(): void { foreach (\array_keys($this->tables) as $t) { if (1 == $this->tables[$t]->getVar('table_reads')) { @@ -410,22 +401,21 @@ private function getCheckReads() } } // check whether each table with handling "reads" has also a field "reads" - if (0 == (int)$fieldReads) { + if (0 == $fieldReads) { $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_READS1); $this->infos[] = ['icon' => 'error', 'info' => $info]; } } } - return true; } /** * @private function getCheckSql * - * @return array|bool + * @return void */ - private function getCheckSql() + private function getCheckSql(): void { foreach (\array_keys($this->tables) as $t) { $tableId = $this->tables[$t]->getVar('table_id'); @@ -449,6 +439,5 @@ private function getCheckSql() } } - return true; } } diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index be916e5d..65e88cbe 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -46,6 +46,10 @@ class ClassFiles extends Files\CreateFile * @var mixed */ private $pc = null; + /** + * @var mixed + */ + private $cf = null; /** * @var mixed */ @@ -53,11 +57,11 @@ class ClassFiles extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { parent::__construct(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); @@ -67,8 +71,6 @@ public function __construct() /** * @static function getInstance * - * @param null - * * @return ClassFiles */ public static function getInstance() @@ -84,9 +86,9 @@ public static function getInstance() /** * @public function write * - * @param string $module - * @param string $table - * @param mixed $tables + * @param $module + * @param $table + * @param $tables * @param $filename */ public function write($module, $table, $tables, $filename): void @@ -105,7 +107,7 @@ public function write($module, $table, $tables, $filename): void * * @return string */ - private function getInitVar($fieldName, $type = 'INT') + private function getInitVar(string $fieldName, string $type = 'INT') { return $this->cxc->getClassInitVar($fieldName, $type); } @@ -117,13 +119,14 @@ private function getInitVar($fieldName, $type = 'INT') * * @return string */ - private function getInitVars($fields) + private function getInitVars(array $fields) { $ret = ''; // Creation of the initVar functions list foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldType = $fields[$f]->getVar('field_type'); + //Attention: field_type is not the same as field_ele_type switch ($fieldType) { case 2: case 3: @@ -226,14 +229,15 @@ private function getClassObject($module, $table, $fields) $cCl .= $this->pc->getPhpCodeVariableClass('public', 'start', '0', "\t"); $cCl .= $this->pc->getPhpCodeCommentMultiLine(['@var' => 'int'], "\t"); $cCl .= $this->pc->getPhpCodeVariableClass('public', 'limit', '0', "\t"); - $cCl .= $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); + $cCl .= $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => ''], "\t"); $constr = $this->getInitVars($fields); $cCl .= $this->pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); - $arrayGetInstance = ['@static function' => '&getInstance', '' => '', '@param' => 'null']; + $arrayGetInstance = ['@static function' => 'getInstance', '' => '']; $cCl .= $this->pc->getPhpCodeCommentMultiLine($arrayGetInstance, "\t"); $getInstance = $this->pc->getPhpCodeVariableClass('static', 'instance', 'false', "\t\t"); $instance = $this->xc->getXcEqualsOperator('$instance', 'new self()', null, "\t\t\t"); $getInstance .= $this->pc->getPhpCodeConditions('!$instance', '', '', $instance, false, "\t\t"); + $getInstance .= $this->cf->getSimpleString('return $instance;', "\t\t"); $cCl .= $this->pc->getPhpCodeFunction('getInstance', '', $getInstance, 'public static ', false, "\t"); $cCl .= $this->getNewInsertId($table); @@ -262,7 +266,7 @@ private function getNewInsertId($table) { $tableName = $table->getVar('table_name'); $ucfTableName = \ucfirst($tableName); - $ret = $this->pc->getPhpCodeCommentMultiLine(['The new inserted' => '$Id', '@return' => 'inserted id'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['The new inserted' => '$Id', '@return' => 'int'], "\t"); $getInsertedId = $this->xc->getXcEqualsOperator('$newInsertedId', "\$GLOBALS['xoopsDB']->getInsertId()", null, "\t\t"); $getInsertedId .= $this->getSimpleString('return $newInsertedId;', "\t\t"); @@ -274,8 +278,8 @@ private function getNewInsertId($table) /** * @private function getFunctionForm * - * @param string $module - * @param string $table + * @param $module + * @param $table * @param $fieldId * @param $fieldInForm * @param $fieldUpload @@ -298,14 +302,13 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field $getForm .= $this->pc->getPhpCodeConditions('!', '', '$action', $action, false, "\t\t"); $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); - //$getForm .= $this->pc->getPhpCodeTernaryOperator('isAdmin', '\is_object(' . $xUser . ')', $xUser . '->isAdmin(' . $xModule . '->mid())', 'false', "\t\t"); $getForm .= $this->xc->getXcEqualsOperator('$isAdmin', "\is_object(\$GLOBALS['xoopsUser']) && \$GLOBALS['xoopsUser']->isAdmin(\$GLOBALS['xoopsModule']->mid())", null, "\t\t"); if ($fieldUpload) { $permString = 'upload_groups'; $getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); $getForm .= $this->xc->getXcXoopsHandler('groupperm', "\t\t"); - $getForm .= $this->pc->getPhpCodeTernaryOperator('groups', '\is_object(' . $xUser . ')', $xUser . '->getGroups()', '\XOOPS_GROUP_ANONYMOUS', "\t\t"); - $checkRight = $this->xc->getXcCheckRight('$grouppermHandler', $permString, 32, '$groups', $xModule . '->getVar(\'mid\')', true); + $getForm .= $this->pc->getPhpCodeTernaryOperator('groups', '\is_object(' . $xUser . ')', $xUser . '->getGroups()', '[\XOOPS_GROUP_ANONYMOUS]', "\t\t"); + $checkRight = $this->xc->getXcCheckRight('$grouppermHandler', $permString, '32', '$groups', $xModule . '->getVar(\'mid\')', true); $getForm .= $this->pc->getPhpCodeTernaryOperator('permissionUpload', $checkRight, 'true', 'false', "\t\t"); } $getForm .= $this->pc->getPhpCodeCommentLine('Title', '', "\t\t"); @@ -342,7 +345,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field * @param $tableName * @return string */ - private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) + private function getPermissionsInForm(string $moduleDirname, string $fieldId, $tableName) { $permissionApprove = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_APPROVE'); $permissionSubmit = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_SUBMIT'); @@ -355,13 +358,10 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) $fId = $this->xc->getXcGetVar('', 'this', $fieldId, true); $mId = $this->xc->getXcGetVar('', "GLOBALS['xoopsModule']", 'mid', true); $contElse = $this->xc->getXcGetGroupIds('groupsIdsApprove', 'grouppermHandler', "'{$moduleDirname}_approve_{$tableName}'", $fId, $mId, "\t\t\t"); - $contElse .= $this->pc->getPhpCodeArrayType('groupsIdsApprove', 'values', 'groupsIdsApprove', null, false, "\t\t\t"); $contElse .= $this->cxc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$groupsIdsApprove', false, "\t\t\t"); $contElse .= $this->xc->getXcGetGroupIds('groupsIdsSubmit', 'grouppermHandler', "'{$moduleDirname}_submit_{$tableName}'", $fId, $mId, "\t\t\t"); - $contElse .= $this->pc->getPhpCodeArrayType('groupsIdsSubmit', 'values', 'groupsIdsSubmit', null, false, "\t\t\t"); $contElse .= $this->cxc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$groupsIdsSubmit', false, "\t\t\t"); $contElse .= $this->xc->getXcGetGroupIds('groupsIdsView', 'grouppermHandler', "'{$moduleDirname}_view_{$tableName}'", $fId, $mId, "\t\t\t"); - $contElse .= $this->pc->getPhpCodeArrayType('groupsIdsView', 'values', 'groupsIdsView', null, false, "\t\t\t"); $contElse .= $this->cxc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$groupsIdsView', false, "\t\t\t"); $contIf = $this->cxc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$fullList', false, "\t\t\t"); @@ -394,7 +394,7 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) private function getValuesInObject($moduleDirname, $table, $fields) { $ucfTableName = \ucfirst($table->getVar('table_name')); - $ret = $this->pc->getPhpCodeCommentMultiLine(['Get' => 'Values', '@param null $keys' => '', '@param null $format' => '', '@param null $maxDepth' => '', '@return' => 'array'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Get' => 'Values', '@param string $keys' => '', '@param string $format' => '', '@param string $maxDepth' => '', '@return' => 'array'], "\t"); $ucfModuleDirname = \ucfirst($moduleDirname); $language = $this->getLanguage($moduleDirname, 'AM'); $getValues = $this->xc->getXcEqualsOperator('$ret', '$this->getValues($keys, $format, $maxDepth)', null, "\t\t"); @@ -450,8 +450,8 @@ private function getValuesInObject($moduleDirname, $table, $fields) case Constants::FIELD_ELE_RADIO_ONOFFLINE: $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); $defaultRO = $this->xc->getXcGetConstants('RADIO_OFFLINE'); - $offlineRO = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_OFFLINE'; - $onlineRO = $language . \mb_strtoupper($ucfTableName) . '_' . \mb_strtoupper($rpFieldName) . '_ONLINE'; + $offlineRO = $language . 'STATUS_OFFLINE'; + $onlineRO = $language . 'STATUS_ONLINE'; $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}_text']{$spacer}", "(int)\$this->getVar('{$fieldName}') > $defaultRO ? $onlineRO : $offlineRO", false, "\t\t"); break; case Constants::FIELD_ELE_SELECTUSER: @@ -506,12 +506,17 @@ private function getValuesInObject($moduleDirname, $table, $fields) $fieldMainTopic = $fieldNameTopic; } } - $getValues .= $this->xc->getXcHandlerLine($topicTableName, "\t\t"); + $getValues .= $this->xc->getXcHandlerLine($topicTableName, "\t\t"); $getTopicTable = "\${$topicTableName}Handler->get(\$this->getVar('{$fieldName}'))"; - $getValues .= $this->xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t"); - $fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')"; - $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", $fMainTopic, null, "\t\t"); - $helper = 1; + $getValues .= $this->xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t"); + $fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')"; + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $getValues .= $this->xc->getXcEqualsOperator("\${$ccFieldName}", "''", null, "\t\t"); + $condIf = $this->xc->getXcEqualsOperator("\${$ccFieldName}", $fMainTopic, null, "\t\t\t"); + $tablenameObj = $this->pc->getPhpCodeIsobject($topicTableName . 'Obj'); + $getValues .= $this->pc->getPhpCodeConditions($tablenameObj, '', '', $condIf, false, "\t\t"); + $getValues .= $this->xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", "\${$ccFieldName}", null, "\t\t"); + $helper = 1; } else { $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t"); } @@ -593,9 +598,8 @@ private function getOptionsCheck($table) /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Classes/ClassFormElements.php b/class/Files/Classes/ClassFormElements.php index e7171210..c90ca222 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -39,10 +39,6 @@ class ClassFormElements extends Modulebuilder\Files\CreateAbstractClass * @var mixed */ private $tf = null; - /** - * @var mixed - */ - private $uxc = null; /** * @var mixed */ @@ -62,7 +58,6 @@ class ClassFormElements extends Modulebuilder\Files\CreateAbstractClass /** * @public function constructor - * @param null */ public function __construct() { @@ -71,13 +66,11 @@ public function __construct() $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $this->tf = Modulebuilder\Files\CreateTableFields::getInstance(); - $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); $this->cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * * @return ClassFormElements */ @@ -112,19 +105,17 @@ public function initForm($module, $table): void * @param string $required * @return string */ - private function getXoopsFormText($language, $fieldName, $fieldDefault, $required = 'false') + private function getXoopsFormText($language, $fieldName, $fieldDefault, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); if ('' != $fieldDefault) { - $ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", "\t\t"); $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 20, 150, $ccFieldName, true); - $ret .= $this->cxc->getClassAddElement('form', $formText . $required); } else { - $ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 255, "this->getVar('{$fieldName}')", true); - $ret .= $this->cxc->getClassAddElement('form', $formText . $required); } + $ret .= $this->cxc->getClassAddElement('form', $formText . $required); return $ret; } @@ -134,11 +125,11 @@ private function getXoopsFormText($language, $fieldName, $fieldDefault, $require * * @param $language * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormTextArea($language, $fieldName, $required = 'false') + private function getXoopsFormTextArea($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'TextArea ' . $ccFieldName, "\t\t"); @@ -153,11 +144,11 @@ private function getXoopsFormTextArea($language, $fieldName, $required = 'false' * * @param $language * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'false') + private function getXoopsFormDhtmlTextArea($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t"); @@ -196,7 +187,7 @@ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'f * @param string $required * @return string */ - private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fieldElementId, $required = 'false') + private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fieldElementId, string $required = 'false') { $stuTableSoleName = \mb_strtoupper($tableSoleName); $ucfFieldName = $this->cf->getCamelCase($fieldName, true); @@ -209,17 +200,15 @@ private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fi $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); - $intElem = "\$check{$ucfFieldName}{$required}"; - $ret .= $this->cxc->getClassAddElement('form', $intElem, $t); } else { $ret = $this->pc->getPhpCodeCommentLine('Form Check Box', $ccFieldName, $t); $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); $ret .= $this->cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, $language, $fieldName, "\${$ccFieldName}", false, $t); $option = "1, {$language}"; $ret .= $this->cxc->getClassAddOption('check' . $ucfFieldName, $option, $t); - $intElem = "\$check{$ucfFieldName}{$required}"; - $ret .= $this->cxc->getClassAddElement('form', $intElem, $t); } + $intElem = "\$check{$ucfFieldName}{$required}"; + $ret .= $this->cxc->getClassAddElement('form', $intElem, $t); return $ret; } @@ -248,11 +237,11 @@ private function getXoopsFormHidden($fieldName) * @param $language * @param $moduleDirname * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $required = 'false') + private function getXoopsFormImageList($language, $moduleDirname, $fieldName, string $required = 'false') { $ucfFieldName = $this->cf->getCamelCase($fieldName, true); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -296,11 +285,11 @@ private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $r * @param $moduleDirname * @param $tableName * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') + private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, string $required = 'false') { $ucfFieldName = $this->cf->getCamelCase($fieldName, true); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -348,11 +337,11 @@ private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $ * @param $moduleDirname * @param $fieldName * @param $fieldDefault - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $required = 'false') + private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; @@ -381,7 +370,7 @@ private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fie * @param string $required * @return string */ - private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, $required = 'false') + private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, string $required = 'false') { $ucfFieldName = $this->cf->getCamelCase($fieldName, true); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -418,9 +407,7 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $getConfig = $this->xc->getXcGetConfig('maxheight_image'); $labelInfo3 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_HEIGHT', $getConfig . " . ' px'", true, ''); $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', '', '', $contIf, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', '', '', $contIf, false, "\t\t"); $ret .= $this->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); return $ret; @@ -438,7 +425,7 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, * @param string $required * @return string */ - private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') + private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; @@ -476,7 +463,7 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $ * @param string $required * @return string */ - private function getXoopsFormColorPicker($language, $fieldName, $required = 'false') + private function getXoopsFormColorPicker($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -494,11 +481,11 @@ private function getXoopsFormColorPicker($language, $fieldName, $required = 'fal * @param $language * @param $tableName * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormSelectBox($language, $tableName, $fieldName, $required = 'false') + private function getXoopsFormSelectBox($language, $tableName, $fieldName, string $required = 'false') { $ucfTableName = \ucfirst($tableName); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -522,7 +509,7 @@ private function getXoopsFormSelectBox($language, $tableName, $fieldName, $requi * @param string $required * @return string */ - private function getXoopsFormSelectUser($language, $fieldName, $required = 'false') + private function getXoopsFormSelectUser($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -541,11 +528,11 @@ private function getXoopsFormSelectUser($language, $fieldName, $required = 'fals * * @param $language * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormRadioYN($language, $fieldName, $required = 'false') + private function getXoopsFormRadioYN($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -562,11 +549,11 @@ private function getXoopsFormRadioYN($language, $fieldName, $required = 'false') * * @param $language * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormTextDateSelect($language, $fieldName, $required = 'false') + private function getXoopsFormTextDateSelect($language, $fieldName, string $required = 'false') { $t = "\t\t"; $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -583,11 +570,11 @@ private function getXoopsFormTextDateSelect($language, $fieldName, $required = ' * * @param $language * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormDateTime($language, $fieldName, $required = 'false') + private function getXoopsFormDateTime($language, $fieldName, string $required = 'false') { $t = "\t\t"; $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -610,7 +597,7 @@ private function getXoopsFormDateTime($language, $fieldName, $required = 'false' * * @return string */ - private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required = 'false') + private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; @@ -638,16 +625,16 @@ private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, * * @param $language * @param $fieldName - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormPassword($language, $fieldName, $required = 'false') + private function getXoopsFormPassword($language, $fieldName, string $required = 'false') { $t = "\t\t"; $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Text', 'Enter Password ' . $ccFieldName, $t); - $xoopsPassword = $this->cxc->getClassXoopsFormPassword('', $language, $fieldName, 10, 32, true, $t); + $xoopsPassword = $this->cxc->getClassXoopsFormPassword('', $language, $fieldName, '10', '32', true, $t); $ret .= $this->cxc->getClassAddElement('form', $xoopsPassword . $required, $t); return $ret; @@ -662,7 +649,7 @@ private function getXoopsFormPassword($language, $fieldName, $required = 'false' * * @return string */ - private function getXoopsFormSelectCountry($language, $fieldName, $required = 'false') + private function getXoopsFormSelectCountry($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -685,7 +672,7 @@ private function getXoopsFormSelectCountry($language, $fieldName, $required = 'f * * @return string */ - private function getXoopsFormSelectLang($language, $fieldName, $required = 'false') + private function getXoopsFormSelectLang($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -709,7 +696,7 @@ private function getXoopsFormSelectLang($language, $fieldName, $required = 'fals * * @return string */ - private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $required = 'false') + private function getXoopsFormRadio($language, $moduleDirname, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; @@ -730,13 +717,12 @@ private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $requi * @private function getXoopsFormRadioOnoffline * * @param $language - * @param $moduleDirname * @param $fieldName * @param string $required * * @return string */ - private function getXoopsFormRadioOnoffline($language, $fieldName, $required = 'false') + private function getXoopsFormRadioOnoffline($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; @@ -763,7 +749,7 @@ private function getXoopsFormRadioOnoffline($language, $fieldName, $required = ' * * @return string */ - private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, $required = 'false') + private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, string $required = 'false') { $ucfTableName = \ucfirst($tableName); $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); @@ -788,11 +774,11 @@ private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, * @param $language * @param $fieldName * @param $fieldElement - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormTable($language,$fieldName, $fieldElement, $required = 'false') + private function getXoopsFormTable($language, $fieldName, $fieldElement, string $required = 'false') { $t = "\t\t"; $ret = ''; @@ -847,11 +833,11 @@ private function getXoopsFormTopic($language, $topicTableName, $fieldId, $fieldP * @private function getXoopsFormTag * * @param $fieldId - * @param $required + * @param string $required * * @return string */ - private function getXoopsFormTag($fieldId, $required = 'false') + private function getXoopsFormTag($fieldId, string $required = 'false') { $t = "\t\t"; $ret = $this->pc->getPhpCodeCommentLine('Use tag', 'module', $t); @@ -859,7 +845,7 @@ private function getXoopsFormTag($fieldId, $required = 'false') $ret .= $this->pc->getPhpCodeTernaryOperator('dirTag', $isDir, 'true', 'false', $t); $paramIf = '(' . $this->xc->getXcGetConfig('usetag') . ' == 1)'; $condIf = $this->pc->getPhpCodeTernaryOperator('tagId', '$this->isNew()', '0', "\$this->getVar('{$fieldId}')", $t . "\t"); - $condIf .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'modules/tag/include/formtag', true, false, $type = 'require', $t . "\t"); + $condIf .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'modules/tag/include/formtag', true, false, 'require', $t . "\t"); $paramElem = $this->cxc->getClassXoopsFormTag('', 'tag', 60, 255, 'tagId', 0, true, ''); $condIf .= $this->cxc->getClassAddElement('form', $paramElem . $required, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions($paramIf, ' && ', '$dirTag', $condIf, false, $t); @@ -875,7 +861,7 @@ private function getXoopsFormTag($fieldId, $required = 'false') * @param string $required * @return string */ - private function getXoopsFormTextUuid($language, $fieldName, $required = 'false') + private function getXoopsFormTextUuid($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Text Uuid', $ccFieldName, "\t\t"); @@ -894,12 +880,17 @@ private function getXoopsFormTextUuid($language, $fieldName, $required = 'false' * @param string $required * @return string */ - private function getXoopsFormTextIp($language, $fieldName, $required = 'false') + private function getXoopsFormTextIp($language, $fieldName, string $required = 'false') { $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $ret = $this->pc->getPhpCodeCommentLine('Form Text IP', $ccFieldName, "\t\t"); $ret .= $this->xc->getXcEqualsOperator('$' . $ccFieldName, "\$_SERVER['REMOTE_ADDR']", null, "\t\t"); + + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "(\$_SERVER['REMOTE_ADDR'] ?? '')", "\$this->getVar('{$fieldName}')", "\t\t"); + + + $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 20, 150, $ccFieldName, true); $ret .= $this->cxc->getClassAddElement('form', $formText . $required); @@ -908,7 +899,7 @@ private function getXoopsFormTextIp($language, $fieldName, $required = 'false') /** * @public function renderElements - * @param null + * * @return string */ public function renderElements() @@ -927,7 +918,6 @@ public function renderElements() $fieldPidTopic = ''; $fieldMainTopic = ''; $fieldElementId = []; - $counter = 0; $tagDone = false; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); @@ -946,7 +936,6 @@ public function renderElements() $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); if (1 == $fieldInForm) { - $counter++; // Switch elements switch ($fieldElement) { case 1: diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index 13e25c46..8e08bd24 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -42,18 +42,18 @@ class ClassHandlerFiles extends Files\CreateFile /** * @var mixed */ - private $helper = null; + //private $helper = null; /** * @public function constructor - * @param null + * */ public function __construct() { parent::__construct(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->helper = Modulebuilder\Helper::getInstance(); + //$this->helper = Modulebuilder\Helper::getInstance(); } /** @@ -74,8 +74,8 @@ public static function getInstance() /** * @public function write * - * @param string $module - * @param string $table + * @param $module + * @param $table * @param mixed $tables * @param $filename */ @@ -91,14 +91,14 @@ public function write($module, $table, $tables, $filename): void * @public function getClassHandler * * @param string $moduleDirname - * @param string $table + * @param $table * @param string $fieldId * @param string $fieldMain * @param $fieldParentId * @param $fieldElement * @return string */ - private function getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldMain, $fieldParentId, $fieldElement) + private function getClassObjectHandler(string $moduleDirname, $table, string $fieldId, string $fieldMain, $fieldParentId, $fieldElement) { $tableName = $table->getVar('table_name'); $ucfTableName = \ucfirst($tableName); @@ -162,7 +162,7 @@ private function getClassGet() */ private function getClassGetInsertId() { - $ret = $this->pc->getPhpCodeCommentMultiLine(['get inserted' => 'id', '' => '', '@param' => 'null', '@return int reference to the' => '{@link Get} object'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['get inserted' => 'id', '' => '', '@return int reference to the' => '{@link Get} object'], "\t"); $cClhgid = $this->getSimpleString('return $this->db->getInsertId();', "\t\t"); $ret .= $this->pc->getPhpCodeFunction('getInsertId', '', $cClhgid, 'public ', false, "\t"); @@ -182,13 +182,13 @@ private function getClassGetInsertId() private function getClassCounter($tableName, $fieldId, $fieldMain) { $ucfTableName = \ucfirst($tableName); - $ret = $this->pc->getPhpCodeCommentMultiLine(['Get Count ' . $ucfTableName => 'in the database', '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'int'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Get Count ' . $ucfTableName => 'in the database', '@param string $sort' => '', '@param string $order' => '', '@return' => 'int'], "\t"); $critCount = $this->xc->getXcCriteriaCompo('crCount' . $ucfTableName, "\t\t"); - $paramsCrit = "\$this->get{$ucfTableName}Criteria(\$crCount{$ucfTableName}, \$start, \$limit, \$sort, \$order)"; + $paramsCrit = "\$this->get{$ucfTableName}Criteria(\$crCount{$ucfTableName}, 0, 0, \$sort, \$order)"; $critCount .= $this->xc->getXcEqualsOperator('$crCount' . $ucfTableName, $paramsCrit, null, "\t\t"); $critCount .= $this->getSimpleString("return \$this->getCount(\$crCount{$ucfTableName});", "\t\t"); - $params = "\$start = 0, \$limit = 0, \$sort = '{$fieldId} ASC, {$fieldMain}', \$order = 'ASC'"; + $params = "\$sort = '{$fieldId} ASC, {$fieldMain}', \$order = 'ASC'"; $ret .= $this->pc->getPhpCodeFunction('getCount' . $ucfTableName, $params, $critCount, 'public ', false, "\t"); @@ -278,12 +278,12 @@ private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, private function getClassCriteria($tableName) { $ucfTableName = \ucfirst($tableName); - $ret = $this->pc->getPhpCodeCommentMultiLine(['Get' => 'Criteria ' . $ucfTableName, '@param ' => "\$cr{$ucfTableName}", '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'int'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Get' => 'Criteria ' . $ucfTableName, '@param ' => "\$cr{$ucfTableName}", '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => '\CriteriaCompo'], "\t"); $paramsAllCriteria = "\$cr{$ucfTableName}, \$start, \$limit, \$sort, \$order"; - - $critSets = $this->xc->getXcCriteriaSetStart('cr' . $ucfTableName, '$start', "\t\t"); - $critSets .= $this->xc->getXcCriteriaSetLimit('cr' . $ucfTableName, '$limit', "\t\t"); + $condIf = $this->xc->getXcCriteriaSetStart('cr' . $ucfTableName, '$start', "\t\t\t"); + $condIf .= $this->xc->getXcCriteriaSetLimit('cr' . $ucfTableName, '$limit', "\t\t\t"); + $critSets = $this->pc->getPhpCodeConditions('$limit', ' > ', '0', $condIf, false, "\t\t"); $critSets .= $this->xc->getXcCriteriaSetSort('cr' . $ucfTableName, '$sort', "\t\t"); $critSets .= $this->xc->getXcCriteriaSetOrder('cr' . $ucfTableName, '$order', "\t\t"); $critSets .= $this->getSimpleString("return \$cr{$ucfTableName};", "\t\t"); @@ -323,9 +323,8 @@ private function getClassGetTableSolenameById($table, $fieldMain) /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { @@ -334,7 +333,7 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - $fieldInForm = []; + //$fieldInForm = []; $fieldParentId = []; $fieldId = null; $fieldMain = null; diff --git a/class/Files/Classes/ClassSpecialFiles.php b/class/Files/Classes/ClassSpecialFiles.php index 800cc579..6a9fe6bb 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -51,7 +51,7 @@ class ClassSpecialFiles extends Files\CreateFile /** * @public function constructor - * @param null + * */ public function __construct() { @@ -78,12 +78,12 @@ public static function getInstance() /** * @public function write * - * @param string $module + * @param $module * @param string $table * @param mixed $tables * @param $filename */ - public function write($module, $table, $tables, $filename): void + public function write($module, string $table, $tables, $filename): void { $this->setModule($module); $this->setTable($table); @@ -93,9 +93,8 @@ public function write($module, $table, $tables, $filename): void /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function renderClass() { @@ -107,10 +106,10 @@ public function renderClass() $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); $content .= $this->pc->getPhpCodeDefined(); $content .= $this->pc->getPhpCodeCommentMultiLine(['Class Object' => $this->className]); - $cCl = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); + $cCl = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => ''], "\t"); $constr = ''; $cCl .= $this->pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); - $arrGetInstance = ['@static function' => '&getInstance', '' => '', '@param' => 'null']; + $arrGetInstance = ['@static function' => 'getInstance', '' => '']; $cCl .= $this->pc->getPhpCodeCommentMultiLine($arrGetInstance, "\t"); $getInstance = $this->pc->getPhpCodeVariableClass('static', 'instance', 'false', "\t\t"); $instance = $this->xc->getXcEqualsOperator('$instance', 'new self()', null, "\t\t\t"); @@ -127,7 +126,7 @@ public function renderClass() * @public function getGlobalPerms * @param mixed $permId * - * @return bool|string + * @return string */ public function getGlobalPerms($permId) { @@ -141,23 +140,23 @@ public function getGlobalPerms($permId) $comment = ''; switch ($permId) { case 4: - $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalApprove', 'returns' => 'right for global approve', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); - $right .= $this->xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', 4, '$my_group_ids', '$mid', true, "\t\t\t"); + $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalApprove', 'returns' => 'right for global approve', '' => '', '@return' => 'bool'], "\t"); + $right .= $this->xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', '4', '$my_group_ids', '$mid', true, "\t\t\t"); $cond .= $this->pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\t"); $funcname .= 'getPermGlobalApprove'; break; case 8: - $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalSubmit', 'returns' => 'right for global submit', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); + $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalSubmit', 'returns' => 'right for global submit', '' => '', '@return' => 'bool'], "\t"); $cond .= $this->pc->getPhpCodeConditions('$this->getPermGlobalApprove()', '', '', $returnTrue, false, "\t\t"); - $right .= $this->xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', 8, '$my_group_ids', '$mid', true, "\t\t\t"); + $right .= $this->xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', '8', '$my_group_ids', '$mid', true, "\t\t\t"); $cond .= $this->pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\t"); $funcname .= 'getPermGlobalSubmit'; break; case 16: - $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalView', 'returns' => 'right for global view', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); + $comment .= $this->pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalView', 'returns' => 'right for global view', '' => '', '@return' => 'bool'], "\t"); $cond .= $this->pc->getPhpCodeConditions('$this->getPermGlobalApprove()', '', '', $returnTrue, false, "\t\t"); $cond .= $this->pc->getPhpCodeConditions('$this->getPermGlobalSubmit()', '', '', $returnTrue, false, "\t\t"); - $right .= $this->xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', 16, '$my_group_ids', '$mid', true, "\t\t\t"); + $right .= $this->xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', '16', '$my_group_ids', '$mid', true, "\t\t\t"); $cond .= $this->pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\t"); $funcname .= 'getPermGlobalView'; break; @@ -188,9 +187,8 @@ public function getGlobalPerms($permId) /** * @public function renderPermissionsHandler - * @param null * - * @return bool|string + * @return string */ public function renderPermissionsHandler() { @@ -203,8 +201,8 @@ public function renderPermissionsHandler() $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"); + $constr = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '@param' => '\XoopsDatabase $db'], "\t"); + $constr .= $this->pc->getPhpCodeFunction('__construct', '\XoopsDatabase $db', '', 'public ', false, "\t"); $functions = $constr; $functions .= $this->getGlobalPerms(4); $functions .= $this->getGlobalPerms(8); @@ -218,9 +216,8 @@ public function renderPermissionsHandler() /** * @public function renderConstantsInterface - * @param null * - * @return bool|string + * @return string */ public function renderConstantsInterface() { diff --git a/class/Files/Classes/ClassXoopsCode.php b/class/Files/Classes/ClassXoopsCode.php index d8d5f1c3..f6172c12 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -32,10 +32,7 @@ class ClassXoopsCode { /* * @static function getInstance - * @param null - */ - - /** + * * @return ClassXoopsCode */ public static function getInstance() @@ -58,7 +55,7 @@ public static function getInstance() * * @return string */ - public function getClassInitVar($paramLeft = '', $paramRight = '', $var = 'this', $t = "\t\t") + public function getClassInitVar(string $paramLeft = '', string $paramRight = '', string $var = 'this', string $t = "\t\t") { $stuParamRight = \mb_strtoupper($paramRight); @@ -74,12 +71,12 @@ public function getClassInitVar($paramLeft = '', $paramRight = '', $var = 'this' * @param null $param3 * @param null $param4 * @param null $param5 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsPageNav($var, $param1, $param2 = null, $param3 = null, $param4 = null, $param5 = null, $isParam = false, $t = '') + public function getClassXoopsPageNav($var, $param1, $param2 = null, $param3 = null, $param4 = null, $param5 = null, bool $isParam = false, string $t = '') { $xPageNav = 'new \XoopsPageNav('; if (false === $isParam) { @@ -105,7 +102,7 @@ public function getClassXoopsPageNav($var, $param1, $param2 = null, $param3 = nu * * @return string */ - public function getXoopsSimpleForm($left = '', $element = '', $elementsContent = '', $caption = '', $var = '', $filename = '', $type = 'post', $t = '') + public function getXoopsSimpleForm(string $left = '', string $element = '', string $elementsContent = '', string $caption = '', string $var = '', string $filename = '', string $type = 'post', string $t = '') { $ret = "{$t}\${$left} = new \XoopsSimpleForm({$caption}, '{$var}', '{$filename}.php', '{$type}');\n"; if (!empty($elementsContent)) { @@ -125,12 +122,12 @@ public function getXoopsSimpleForm($left = '', $element = '', $elementsContent = * @param null $param2 * @param null $param3 * @param null $param4 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsThemeForm($var, $param1, $param2 = null, $param3 = null, $param4 = null, $isParam = false, $t = "\t\t") + public function getClassXoopsThemeForm($var, $param1, $param2 = null, $param3 = null, $param4 = null, bool $isParam = false, string $t = "\t\t") { $themeForm = 'new \XoopsThemeForm('; if (false === $isParam) { @@ -152,7 +149,7 @@ public function getClassXoopsThemeForm($var, $param1, $param2 = null, $param3 = * * @return string */ - public function getClassXoopsFormElementTray($var, $param1, $param2 = '', $t = "\t\t") + public function getClassXoopsFormElementTray($var, $param1, string $param2 = '', string $t = "\t\t") { return "{$t}\${$var} = new \XoopsFormElementTray({$param1}, '{$param2}');\n"; } @@ -163,13 +160,13 @@ public function getClassXoopsFormElementTray($var, $param1, $param2 = '', $t = " * @param $var * @param string $param1 * @param null $param2 - * @param bool $isParam + * @param bool $isParam * @param string $t * - * @param bool $useParam + * @param bool $useParam * @return string */ - public function getClassXoopsFormLabel($var, $param1 = '', $param2 = null, $isParam = false, $t = "\t\t", $useParam = false) + public function getClassXoopsFormLabel($var, string $param1 = '', $param2 = null, bool $isParam = false, string $t = "\t\t", bool $useParam = false) { $label = 'new \XoopsFormLabel('; if (false === $useParam) { @@ -193,12 +190,12 @@ public function getClassXoopsFormLabel($var, $param1 = '', $param2 = null, $isPa * @param $param1 * @param $param2 * @param $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormFile($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t") + public function getClassXoopsFormFile($var, $param1, $param2, $param3, bool $isParam = false, string $t = "\t\t") { $file = 'new \XoopsFormFile('; if (false === $isParam) { @@ -216,14 +213,14 @@ public function getClassXoopsFormFile($var, $param1, $param2, $param3, $isParam * @param $var * @param $param1 * @param $param2 - * @param bool $isForm - * @param bool $isParam + * @param bool $isForm + * @param bool $isParam * @param string $t * - * @param bool $useParam + * @param bool $useParam * @return string */ - public function getClassXoopsFormHidden($var, $param1, $param2, $isForm = false, $isParam = false, $t = "\t\t", $useParam = false) + public function getClassXoopsFormHidden($var, $param1, $param2, bool $isForm = false, bool $isParam = false, string $t = "\t\t", bool $useParam = false) { $hidden = 'new \XoopsFormHidden('; $getVarHidden = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true); @@ -251,15 +248,15 @@ public function getClassXoopsFormHidden($var, $param1, $param2, $isForm = false, * @param $var * @param $param1 * @param $param2 - * @param int $param3 - * @param int $param4 + * @param int $param3 + * @param int $param4 * @param $param5 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormText($var, $param1, $param2, $param3, $param4, $param5, $isParam = false, $t = "\t\t") + public function getClassXoopsFormText($var, $param1, $param2, int $param3, int $param4, $param5, bool $isParam = false, string $t = "\t\t") { $text = 'new \XoopsFormText('; if (false === $isParam) { @@ -279,12 +276,12 @@ public function getClassXoopsFormText($var, $param1, $param2, $param3, $param4, * @param $param2 * @param $param3 * @param $param4 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormTextArea($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") + public function getClassXoopsFormTextArea($var, $param1, $param2, $param3, $param4, bool $isParam = false, string $t = "\t\t") { $area = 'new \XoopsFormTextArea('; $getVarTextArea = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true, '', ", 'e'"); @@ -304,12 +301,12 @@ public function getClassXoopsFormTextArea($var, $param1, $param2, $param3, $para * @param $param1 * @param $param2 * @param $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormColorPicker($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t") + public function getClassXoopsFormColorPicker($var, $param1, $param2, $param3, bool $isParam = false, string $t = "\t\t") { $picker = 'new \XoopsFormColorPicker('; if (false === $isParam) { @@ -329,12 +326,12 @@ public function getClassXoopsFormColorPicker($var, $param1, $param2, $param3, $i * @param $param2 * @param string $param3 * @param $ccFieldName - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $ccFieldName, $isParam = false, $t = "\t\t") + public function getClassXoopsFormSelectUser($var, $param1, $param2, string $param3, $ccFieldName, bool $isParam = false, string $t = "\t\t") { $user = 'new \XoopsFormSelectUser('; //$getVarSelectUser = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); @@ -355,12 +352,12 @@ public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $cc * @param $param2 * @param string $param3 * @param $param4 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormTextDateSelect($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") + public function getClassXoopsFormTextDateSelect($var, $param1, $param2, string $param3, $param4, bool $isParam = false, string $t = "\t\t") { $tdate = 'new \XoopsFormTextDateSelect('; $getVarTextDateSelect = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); @@ -381,12 +378,12 @@ public function getClassXoopsFormTextDateSelect($var, $param1, $param2, $param3, * @param $param2 * @param string $param3 * @param $param4 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormDateTime($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") + public function getClassXoopsFormDateTime($var, $param1, $param2, string $param3, $param4, bool $isParam = false, string $t = "\t\t") { $tdate = 'new \XoopsFormDateTime('; $getVarTextDateSelect = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); @@ -406,12 +403,12 @@ public function getClassXoopsFormDateTime($var, $param1, $param2, $param3, $para * @param $param1 * @param $param2 * @param $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormEditor($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t") + public function getClassXoopsFormEditor($var, $param1, $param2, $param3, bool $isParam = false, string $t = "\t\t") { $editor = 'new \XoopsFormEditor('; if (false === $isParam) { @@ -430,12 +427,12 @@ public function getClassXoopsFormEditor($var, $param1, $param2, $param3, $isPara * @param $param1 * @param $param2 * @param $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormCheckBox($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t") + public function getClassXoopsFormCheckBox($var, $param1, $param2, $param3, bool $isParam = false, string $t = "\t\t") { $checkBox = 'new \XoopsFormCheckBox('; if (false === $isParam) { @@ -454,12 +451,12 @@ public function getClassXoopsFormCheckBox($var, $param1, $param2, $param3, $isPa * @param $param1 * @param $param2 * @param $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormRadioYN($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t") + public function getClassXoopsFormRadioYN($var, $param1, $param2, $param3, bool $isParam = false, string $t = "\t\t") { $radioYN = 'new \XoopsFormRadioYN('; if (false === $isParam) { @@ -478,12 +475,12 @@ public function getClassXoopsFormRadioYN($var, $param1, $param2, $param3, $isPar * @param $param1 * @param $param2 * @param $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormRadio($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t") + public function getClassXoopsFormRadio($var, $param1, $param2, $param3, bool $isParam = false, string $t = "\t\t") { $radioYN = 'new \XoopsFormRadio('; if (false === $isParam) { @@ -504,12 +501,12 @@ public function getClassXoopsFormRadio($var, $param1, $param2, $param3, $isParam * @param $param3 * @param null $param4 * @param null $param5 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormSelect($var, $param1, $param2, $param3, $param4 = null, $param5 = null, $isParam = false, $t = "\t\t") + public function getClassXoopsFormSelect($var, $param1, $param2, $param3, $param4 = null, $param5 = null, bool $isParam = false, string $t = "\t\t") { $otherParam = null != $param4 ? ", {$param4}" : (null != $param5 ? ", {$param5}" : ''); $select = 'new \XoopsFormSelect('; @@ -530,13 +527,13 @@ public function getClassXoopsFormSelect($var, $param1, $param2, $param3, $param4 * @param $param2 * @param $param3 * @param $param4 - * @param int $param5 - * @param bool $isParam + * @param int $param5 + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormTag($var, $param1, $param2, $param3, $param4, $param5 = 0, $isParam = false, $t = "\t\t") + public function getClassXoopsFormTag($var, $param1, $param2, $param3, $param4, int $param5 = 0, bool $isParam = false, string $t = "\t\t") { $tag = 'new \XoopsFormTag('; if (false === $isParam) { @@ -556,12 +553,12 @@ public function getClassXoopsFormTag($var, $param1, $param2, $param3, $param4, $ * @param $param2 * @param $param3 * @param $param4 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormButton($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") + public function getClassXoopsFormButton($var, $param1, $param2, $param3, $param4, bool $isParam = false, string $t = "\t\t") { $button = 'new \XoopsFormButton('; if (false === $isParam) { @@ -576,17 +573,17 @@ public function getClassXoopsFormButton($var, $param1, $param2, $param3, $param4 /** * @public function getClassXoopsFormPassword * - * @param $var - * @param $param1 - * @param $param2 + * @param string $var + * @param string $param1 + * @param string $param2 * @param string $param3 - * @param $param4 - * @param bool $isParam + * @param string $param4 + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormPassword($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t") + public function getClassXoopsFormPassword(string $var, string $param1, string $param2, string $param3, string $param4, bool $isParam = false, string $t = "\t\t") { $tpassword = 'new \XoopsFormPassword('; $getVarPassword = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); @@ -608,12 +605,12 @@ public function getClassXoopsFormPassword($var, $param1, $param2, $param3, $para * @param $param3 * @param null $param4 * @param null $param5 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormSelectCountry($var, $param1, $param2, $param3, $param4 = null, $param5 = null, $isParam = false, $t = "\t\t") + public function getClassXoopsFormSelectCountry($var, $param1, $param2, $param3, $param4 = null, $param5 = null, bool $isParam = false, string $t = "\t\t") { $otherParam = null != $param4 ? ", {$param4}" : (null != $param5 ? ", {$param5}" : ''); $select = 'new \XoopsFormSelectCountry('; @@ -637,11 +634,9 @@ public function getClassXoopsFormSelectCountry($var, $param1, $param2, $param3, * * @return string */ - public function getClassXoopsObjectTree($var, $param1, $param2, $param3, $t = '') + public function getClassXoopsObjectTree(string $var, $param1, $param2, $param3, string $t = '') { - $ret = "{$t}\${$var} = new \XoopsObjectTree(\${$param1}, '{$param2}', '{$param3}');\n"; - - return $ret; + return "{$t}\${$var} = new \XoopsObjectTree(\${$param1}, '{$param2}', '{$param3}');\n"; } /** @@ -657,12 +652,10 @@ public function getClassXoopsObjectTree($var, $param1, $param2, $param3, $t = '' * * @return string */ - public function getClassXoopsMakeSelBox($var, $anchor, $param1, $param2, $param3, $param4, $t = '') + public function getClassXoopsMakeSelBox($var, $anchor, $param1, $param2, string $param3, $param4, string $t = '') { $getVar = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); - $ret = "{$t}\${$var} = \${$anchor}->makeSelBox('{$param1}', '{$param2}', '{$param3}', {$getVar}, true );\n"; - - return $ret; + return "{$t}\${$var} = \${$anchor}->makeSelBox('{$param1}', '{$param2}', '{$param3}', {$getVar}, true );\n"; } /** @@ -674,7 +667,7 @@ public function getClassXoopsMakeSelBox($var, $anchor, $param1, $param2, $param3 * * @return string */ - public function getClassAddOption($var, $params, $t = "\t\t") + public function getClassAddOption($var, $params, string $t = "\t\t") { return "{$t}\${$var}->addOption({$params});\n"; } @@ -688,7 +681,7 @@ public function getClassAddOption($var, $params, $t = "\t\t") * * @return string */ - public function getClassAddOptionArray($var, $params, $t = "\t\t") + public function getClassAddOptionArray($var, $params, string $t = "\t\t") { return "{$t}\${$var}->addOptionArray({$params});\n"; } @@ -702,7 +695,7 @@ public function getClassAddOptionArray($var, $params, $t = "\t\t") * * @return string */ - public function getClassAddElement($var = '', $params = '', $t = "\t\t") + public function getClassAddElement(string $var = '', string $params = '', string $t = "\t\t") { return "{$t}\${$var}->addElement({$params});\n"; } @@ -716,7 +709,7 @@ public function getClassAddElement($var = '', $params = '', $t = "\t\t") * * @return string */ - public function getClassSetDescription($var, $params, $t = "\t\t") + public function getClassSetDescription($var, $params, string $t = "\t\t") { return "{$t}\${$var}->setDescription({$params});\n"; } @@ -730,7 +723,7 @@ public function getClassSetDescription($var, $params, $t = "\t\t") * * @return string */ - public function getClassSetExtra($var, $params, $t = "\t\t") + public function getClassSetExtra($var, $params, string $t = "\t\t") { return "{$t}\${$var}->setExtra({$params});\n"; } diff --git a/class/Files/Config/ConfigConfig.php b/class/Files/Config/ConfigConfig.php index 6037fef8..f1954043 100644 --- a/class/Files/Config/ConfigConfig.php +++ b/class/Files/Config/ConfigConfig.php @@ -42,7 +42,6 @@ class ConfigConfig extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -67,11 +66,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $tables * @param string $filename */ - public function write($module, $tables, $filename): void + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setTables($tables); @@ -141,7 +140,7 @@ private function getConfigCode() $ret .= $this->getSimpleString('],', "\t"); $ret .= $this->getSimpleString("'moduleStats' => [", "\t"); $ret .= $this->getSimpleString('],', "\t"); - $ret .= $this->getSimpleString("'modCopyright' => \"XOOPS Project\",", "\t"); + $ret .= $this->getSimpleString("'modCopyright' => \"XOOPS Project\",", "\t"); $ret .= $this->getSimpleString('];'); return $ret; @@ -149,8 +148,8 @@ private function getConfigCode() /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/CreateAbstractClass.php b/class/Files/CreateAbstractClass.php index 3d3102a6..bb0ea06a 100644 --- a/class/Files/CreateAbstractClass.php +++ b/class/Files/CreateAbstractClass.php @@ -62,7 +62,7 @@ abstract class CreateAbstractClass */ public function setModule($module): void { - if (\is_object($module) && ($module instanceof ModuleBuilder\Modules)) { + if (($module instanceof ModuleBuilder\Modules)) { $this->module = $module; } } @@ -84,7 +84,7 @@ public function getModule() */ public function setTable($table): void { - if (\is_object($table) && ($table instanceof Modulebuilder\Tables)) { + if (($table instanceof Modulebuilder\Tables)) { $this->table = $table; } } @@ -128,7 +128,7 @@ public function getTables() */ public function setFields($fields): void { - if (\is_object($fields) && ($fields instanceof Modulebuilder\Fields)) { + if (($fields instanceof Modulebuilder\Fields)) { $this->fields = $fields; } } diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index 80ee51ce..0facd6c5 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -51,7 +51,6 @@ class CreateArchitecture extends CreateStructure /** * @public function constructor - * @param null */ public function __construct() { @@ -64,8 +63,6 @@ public function __construct() /** * @static function getInstance * - * @param null - * * @return Modulebuilder\Files\CreateArchitecture */ public static function getInstance() @@ -156,8 +153,6 @@ public function setBaseFoldersFiles($module): void if (!\file_exists($logoGifFrom)) { // Rename file $copyFile = TDMC_IMAGES_LOGOS_URL . '/xoopsdevelopmentteam_logo.gif'; - $copyNewFile = $logoGifFrom; - \copy($copyFile, $copyNewFile); } else { // Copy file if (!\file_exists($logoPng)) { @@ -165,9 +160,9 @@ public function setBaseFoldersFiles($module): void $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH . '/' . $logoPng; } $copyFile = TDMC_IMAGES_LOGOS_URL . '/' . $logoPng; - $copyNewFile = $logoGifFrom; - \copy($copyFile, $copyNewFile); } + $copyNewFile = $logoGifFrom; + \copy($copyFile, $copyNewFile); // Creation of 'module_author_logo.gif' file $this->copyFile('assets/images', $copyNewFile, $logoPng); @@ -207,7 +202,7 @@ public function setBaseFoldersFiles($module): void /** * @public function setFilesToBuilding * - * @param string $module + * @param $module * * @return array */ @@ -220,7 +215,7 @@ public function setFilesToBuilding($module) $tables = $this->cf->getTableTables($modId); $files = $this->cf->getTableMorefiles($modId); $ret = []; - $templateType = 'defstyle'; + $templateType = 'defstyle'; // currently no other template style is implemented $patterns = [ \mb_strtolower('modulebuilder') => \mb_strtolower($moduleDirname), @@ -231,9 +226,9 @@ public function setFilesToBuilding($module) $this->patValues = \array_values($patterns); $table = null; - $tableCategory = []; + //$tableCategory = []; //$tableName = []; - $tableAdmin = []; + //$tableAdmin = []; $tableUser = []; $tableBlocks = []; $tableSearch = []; @@ -246,17 +241,17 @@ public function setFilesToBuilding($module) $tablePrint = []; $tableRate = []; $tableRss = []; - $tableSingle = []; - $tableSubmit = []; - $tableVisit = []; + //$tableSingle = []; + //$tableSubmit = []; + //$tableVisit = []; $tableTag = []; foreach (\array_keys($tables) as $t) { $tableId = $tables[$t]->getVar('table_id'); $tableName = $tables[$t]->getVar('table_name'); $tableSoleName = $tables[$t]->getVar('table_solename'); - $tableCategory[] = $tables[$t]->getVar('table_category'); + //$tableCategory[] = $tables[$t]->getVar('table_category'); $tableImage = $tables[$t]->getVar('table_image'); - $tableAdmin[] = $tables[$t]->getVar('table_admin'); + //$tableAdmin[] = $tables[$t]->getVar('table_admin'); $tableUser[] = $tables[$t]->getVar('table_user'); $tableBlocks[] = $tables[$t]->getVar('table_blocks'); $tableSearch[] = $tables[$t]->getVar('table_search'); @@ -269,9 +264,9 @@ public function setFilesToBuilding($module) $tablePrint[] = $tables[$t]->getVar('table_print'); $tableRate[] = $tables[$t]->getVar('table_rate'); $tableRss[] = $tables[$t]->getVar('table_rss'); - $tableSingle[] = $tables[$t]->getVar('table_single'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); - $tableVisit[] = $tables[$t]->getVar('table_visit'); + //$tableSingle[] = $tables[$t]->getVar('table_single'); + //$tableSubmit[] = $tables[$t]->getVar('table_submit'); + //$tableVisit[] = $tables[$t]->getVar('table_visit'); $tableTag[] = $tables[$t]->getVar('table_tag'); // Get Table Object @@ -301,11 +296,11 @@ public function setFilesToBuilding($module) $blocksFiles->write($module, $table, $tableName . '.php'); $ret[] = $blocksFiles->render(); // Templates Blocks Files - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Bootstrap\TemplatesBlocks::getInstance(); - } else { + } else {*/ $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Defstyle\TemplatesBlocks::getInstance(); - } + /*}*/ $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl'); $ret[] = $templatesBlocks->render(); // Spotlight block @@ -314,11 +309,11 @@ public function setFilesToBuilding($module) $blocksFiles->write($module, $table, $tableName . '_spotlight.php'); $ret[] = $blocksFiles->render(); // Templates Blocks Files - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Bootstrap\TemplatesBlocksSpotlight::getInstance(); - } else { + } else {*/ $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Defstyle\TemplatesBlocksSpotlight::getInstance(); - } + /*}*/ $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '_spotlight.tpl'); $ret[] = $templatesBlocks->render(); } @@ -343,27 +338,27 @@ public function setFilesToBuilding($module) $userPages->write($module, $table, $tableName . '.php'); $ret[] = $userPages->render(); // User Templates File - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $userTemplatesPages = Modulebuilder\Files\Templates\User\Bootstrap\Pages::getInstance(); - } else { + } else {*/ $userTemplatesPages = Modulebuilder\Files\Templates\User\Defstyle\Pages::getInstance(); - } + /*}*/ $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl'); $ret[] = $userTemplatesPages->render(); // User List Templates File - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $userTemplatesPagesList = Modulebuilder\Files\Templates\User\Bootstrap\PagesList::getInstance(); - } else { + } else {*/ $userTemplatesPagesList = Modulebuilder\Files\Templates\User\Defstyle\PagesList::getInstance(); - } + /*}*/ $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl'); $ret[] = $userTemplatesPagesList->render(); // User Item Templates File - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $userTemplatesPagesItem = Modulebuilder\Files\Templates\User\Bootstrap\PagesItem::getInstance(); - } else { + } else {*/ $userTemplatesPagesItem = Modulebuilder\Files\Templates\User\Defstyle\PagesItem::getInstance(); - } + /*}*/ $userTemplatesPagesItem->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_item' . '.tpl'); $ret[] = $userTemplatesPagesItem->render(); if (1 === (int)$tables[$t]->getVar('table_category')) { @@ -591,6 +586,11 @@ public function setFilesToBuilding($module) if (\in_array(1, $tableComments)) { // Include Comments File $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance(); + foreach (\array_keys($tables) as $t) { + if (1 == (int)$tables[$t]->getVar('table_comments')) { + $table = $tables[$t]; + } + } $includeComments->write($module, $table); $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit'); // Include Comments File @@ -618,27 +618,27 @@ public function setFilesToBuilding($module) if ((1 == $module->getVar('mod_user')) && \in_array(1, $tableUser)) { // Creation of user template files // Templates Index File - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $userTemplatesIndex = Modulebuilder\Files\Templates\User\Bootstrap\Index::getInstance(); - } else { + } else {*/ $userTemplatesIndex = Modulebuilder\Files\Templates\User\Defstyle\Index::getInstance(); - } + /*}*/ $userTemplatesIndex->write($module, $table, $tables, $moduleDirname . '_index.tpl'); $ret[] = $userTemplatesIndex->render(); // Templates Footer File - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $userTemplatesFooter = Modulebuilder\Files\Templates\User\Bootstrap\Footer::getInstance(); - } else { + } else {*/ $userTemplatesFooter = Modulebuilder\Files\Templates\User\Defstyle\Footer::getInstance(); - } + /*}*/ $userTemplatesFooter->write($module, $table, $moduleDirname . '_footer.tpl'); $ret[] = $userTemplatesFooter->render(); // Templates Header File - if ($templateType == 'bootstrap') { +/* if ($templateType == 'bootstrap') { $userTemplatesHeader = Modulebuilder\Files\Templates\User\Bootstrap\Header::getInstance(); - } else { + } else {*/ $userTemplatesHeader = Modulebuilder\Files\Templates\User\Defstyle\Header::getInstance(); - } + /*}*/ $userTemplatesHeader->write($module, $moduleDirname . '_header.tpl'); $ret[] = $userTemplatesHeader->render(); @@ -666,11 +666,11 @@ public function setFilesToBuilding($module) $userPdf->write($module, $table, $tableName . '_pdf.php'); $ret[] = $userPdf->render(); // User Templates Pdf File - if ($templateType == 'bootstrap') { + /*if ($templateType == 'bootstrap') { $userTemplatesPdf = Modulebuilder\Files\Templates\User\Bootstrap\Pdf::getInstance(); - } else { + } else {*/ $userTemplatesPdf = Modulebuilder\Files\Templates\User\Defstyle\Pdf::getInstance(); - } + /*}*/ $userTemplatesPdf->write($module, $table, $moduleDirname . '_' . $tableName . '_pdf.tpl'); $ret[] = $userTemplatesPdf->render(); } @@ -685,11 +685,11 @@ public function setFilesToBuilding($module) $userPrint->write($module, $table, $tableName . '_print.php'); $ret[] = $userPrint->render(); // User Templates Print File - if ($templateType == 'bootstrap') { + /*if ($templateType == 'bootstrap') { $userTemplatesPrint = Modulebuilder\Files\Templates\User\Bootstrap\UserPrint::getInstance(); - } else { + } else {*/ $userTemplatesPrint = Modulebuilder\Files\Templates\User\Defstyle\UserPrint::getInstance(); - } + /*}*/ $userTemplatesPrint->write($module, $table, $moduleDirname . '_' . $tableName . '_print.tpl'); $ret[] = $userTemplatesPrint->render(); } @@ -714,11 +714,11 @@ public function setFilesToBuilding($module) $userRss->write($module, $table, 'rss.php'); $ret[] = $userRss->render(); // User Templates Rss File - if ($templateType == 'bootstrap') { + /*if ($templateType == 'bootstrap') { $userTemplatesRss = Modulebuilder\Files\Templates\User\Bootstrap\Rss::getInstance(); - } else { + } else {*/ $userTemplatesRss = Modulebuilder\Files\Templates\User\Defstyle\Rss::getInstance(); - } + /*}*/ $userTemplatesRss->write($module, $moduleDirname . '_rss.tpl'); $ret[] = $userTemplatesRss->render(); } @@ -741,11 +741,11 @@ public function setFilesToBuilding($module) $languageMain->write($module, $tables, 'main.php'); $ret[] = $languageMain->render(); // User Templates Breadcrumbs File - if ($templateType == 'bootstrap') { + /*if ($templateType == 'bootstrap') { $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Bootstrap\Breadcrumbs::getInstance(); - } else { + } else {*/ $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Defstyle\Breadcrumbs::getInstance(); - } + /*}*/ $userTemplatesUserBreadcrumbs->write($module, $moduleDirname . '_breadcrumbs.tpl'); $ret[] = $userTemplatesUserBreadcrumbs->render(); } diff --git a/class/Files/CreateClone.php b/class/Files/CreateClone.php index 7205ac17..91fae5c7 100644 --- a/class/Files/CreateClone.php +++ b/class/Files/CreateClone.php @@ -31,11 +31,11 @@ class CreateClone /** * @param $src_path * @param $dst_path - * @param bool $replace_code + * @param bool $replace_code * @param array $patKeys * @param array $patValues */ - public static function cloneFileFolder($src_path, $dst_path, $replace_code = false, $patKeys = [], $patValues = []): void + public static function cloneFileFolder($src_path, $dst_path, bool $replace_code = false, array $patKeys = [], array $patValues = []): void { // open the source directory $dir = \opendir($src_path); @@ -58,11 +58,11 @@ public static function cloneFileFolder($src_path, $dst_path, $replace_code = fal /** * @param $src_file * @param $dst_file - * @param bool $replace_code + * @param bool $replace_code * @param array $patKeys * @param array $patValues */ - public static function cloneFile($src_file, $dst_file, $replace_code = false, $patKeys = [], $patValues = []): void + public static function cloneFile($src_file, $dst_file, bool $replace_code = false, array $patKeys = [], array $patValues = []): void { if ($replace_code) { $noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf']; diff --git a/class/Files/CreateCodeIndents.php b/class/Files/CreateCodeIndents.php index 545232b5..6f95e1cf 100644 --- a/class/Files/CreateCodeIndents.php +++ b/class/Files/CreateCodeIndents.php @@ -8,14 +8,9 @@ * * @return string */ -function nl($tabs = 0) +function nl(int $tabs = 0) { - $r = "\n"; - for ($i = 0; $i < $tabs; ++$i) { - $r .= ' '; - } - - return $r; + return "\n" . str_repeat(' ', $tabs); } /* Usage example */ diff --git a/class/Files/CreateFile.php b/class/Files/CreateFile.php index 67a86164..50f9b95b 100644 --- a/class/Files/CreateFile.php +++ b/class/Files/CreateFile.php @@ -84,7 +84,6 @@ class CreateFile extends CreateTableFields /** * @public function constructor - * @param null */ public function __construct() { @@ -94,7 +93,7 @@ public function __construct() /** * @public static function getInstance - * @param null + * * @return Modulebuilder\Files\CreateFile */ public static function getInstance() @@ -113,12 +112,12 @@ public static function getInstance() * @param $moduleDirname * @param $subdir * @param $fileName - * @param $content + * @param string $content * @param $created * @param $notCreated - * @param $mode + * @param string $mode */ - public function create($moduleDirname, $subdir = null, $fileName = null, $content = '', $created = null, $notCreated = null, $mode = 'w+'): void + public function create($moduleDirname, $subdir = null, $fileName = null, string $content = '', $created = null, $notCreated = null, string $mode = 'w+'): void { $this->setFileName($fileName); $this->created = $created; @@ -147,14 +146,14 @@ public function create($moduleDirname, $subdir = null, $fileName = null, $conten * @private function setRepositoryPath * @param string $moduleDirname */ - private function setRepositoryPath($moduleDirname): void + private function setRepositoryPath(string $moduleDirname): void { $this->uploadPath = TDMC_UPLOAD_REPOSITORY_PATH . '/' . $moduleDirname; } /** * @private function getRepositoryPath - * @param null + * * @return string */ private function getRepositoryPath() @@ -173,7 +172,7 @@ private function setSubDir($subdir): void /** * @private function getSubDir - * @param null + * * @return string */ private function getSubDir() @@ -193,7 +192,7 @@ public function setFileName($fileName): void /** * @public function getFileName - * @param null + * * @return mixed */ public function getFileName() @@ -213,7 +212,7 @@ private function setContent($content): void /** * @private function setContent - * @param null + * * @return string */ private function getContent() @@ -223,7 +222,7 @@ private function getContent() /** * @private function getFolderName - * @param null + * * @return string */ private function getFolderName() @@ -243,7 +242,7 @@ private function getFolderName() /** * @public function getUploadPath - * @param null + * * @return string */ private function getUploadPath() @@ -259,7 +258,7 @@ private function getUploadPath() /** * @private function getCreated - * @param null + * * @return bool */ private function getCreated() @@ -269,7 +268,7 @@ private function getCreated() /** * @private function getNotCreated - * @param null + * * @return bool */ private function getNotCreated() @@ -288,7 +287,7 @@ private function setMode($mode): void /** * @private function getMode - * @param null + * * @return string */ private function getMode() @@ -301,10 +300,10 @@ private function getMode() * @param string $moduleDirname * @param string $prefix * @param string $suffix - * @param bool $addFq //add function qualifier + * @param bool $addFq //add function qualifier * @return string */ - public function getLanguage($moduleDirname, $prefix = '', $suffix = '', $addFq = true) + public function getLanguage(string $moduleDirname, string $prefix = '', string $suffix = '', bool $addFq = true) { $lang = ''; if ($addFq) { @@ -327,7 +326,7 @@ public function getLanguage($moduleDirname, $prefix = '', $suffix = '', $addFq = * * @return string */ - public function getLeftString($string) + public function getLeftString(string $string) { $ret = ''; if ('' != $string) { @@ -348,9 +347,7 @@ public function getRightString($string = null) if (\mb_strpos($string, '_')) { $str = \mb_strpos($string, '_'); if (false !== $str) { - $ret = \mb_substr($string, $str + 1, \mb_strlen($string)); - - return $ret; + return \mb_substr($string, $str + 1, \mb_strlen($string)); } } } @@ -361,12 +358,12 @@ public function getRightString($string = null) /** * @public function getCamelCase * @param $string - * @param $ucfirst - * @param $lcfirst + * @param bool $ucfirst + * @param bool $lcfirst * * @return string */ - public function getCamelCase($string, $ucfirst = false, $lcfirst = false) + public function getCamelCase($string, bool $ucfirst = false, bool $lcfirst = false) { $rightString = $this->getRightString($string); $leftString = $this->getLeftString($string); @@ -442,20 +439,20 @@ public function getStrToLower($string) /** * @public function getRequire - * @param $filename + * @param string $filename * @return string */ - public function getRequire($filename = 'header') + public function getRequire(string $filename = 'header') { return "require __DIR__ . '/{$filename}.php';\n"; } /** * @public function getRequireOnce - * @param $filename + * @param string $filename * @return string */ - public function getRequireOnce($filename = 'header') + public function getRequireOnce(string $filename = 'header') { return "require_once __DIR__ . '/{$filename}.php';\n"; } @@ -479,20 +476,20 @@ public function getDashComment($comment) * @param string $t * @return string */ - public function getSimpleString($string, $t = '') + public function getSimpleString($string, string $t = '') { return "{$t}{$string}\n"; } /** * @public function getHeaderFilesComments - * @param string $module + * @param $module * @param $noPhpFile * * @param string $namespace * @return string */ - public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = '') + public function getHeaderFilesComments($module, $noPhpFile = null, string $namespace = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $name = $module->getVar('mod_name'); @@ -548,7 +545,7 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = /** * @public function renderFile - * @param null + * * @return string */ public function renderFile() diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index f867c06a..fb1a2b05 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -33,8 +33,6 @@ class CreateHtmlCode /** * @static function getInstance * - * @param null - * * @return CreateHtmlCode */ public static function getInstance() @@ -50,15 +48,15 @@ public static function getInstance() /** * @public function getHtmlTag * @param string $tag - * @param array $attributes + * @param array $attributes * @param string $content - * @param bool $noClosed + * @param bool $noClosed * @param string $t * @param string $n - * @param bool $multiLine + * @param bool $multiLine * @return string */ - public function getHtmlTag($tag = '', $attributes = [], $content = '', $noClosed = false, $t = '', $n = "\n", $multiLine = false) + public function getHtmlTag(string $tag = '', array $attributes = [], string $content = '', bool $noClosed = false, string $t = '', string $n = "\n", bool $multiLine = false) { if (empty($attributes)) { $attributes = []; @@ -88,7 +86,7 @@ public function getHtmlTag($tag = '', $attributes = [], $content = '', $noClosed * @param array $attributes * @return string */ - private function getAttributes($attributes) + private function getAttributes(array $attributes) { $str = ''; foreach ($attributes as $name => $value) { @@ -107,7 +105,7 @@ private function getAttributes($attributes) * @param string $n * @return string */ - public function getHtmlEmpty($empty = '', $t = '', $n = '') + public function getHtmlEmpty(string $empty = '', string $t = '', string $n = '') { return "{$t}{$empty}{$n}"; } @@ -119,28 +117,23 @@ public function getHtmlEmpty($empty = '', $t = '', $n = '') * @param string $n * @return string */ - public function getHtmlComment($htmlComment = '', $t = '', $n = '') + public function getHtmlComment(string $htmlComment = '', string $t = '', string $n = '') { return "{$t}{$n}"; } /** * @public function getHtmlBr - * @param int $brNumb + * @param int $brNumb * @param string $htmlClass * @param string $t * @param string $n * @return string */ - public function getHtmlBr($brNumb = 1, $htmlClass = '', $t = '', $n = "\n") + public function getHtmlBr(int $brNumb = 1, string $htmlClass = '', string $t = '', string $n = "\n") { $brClass = ('' != $htmlClass) ? " class='{$htmlClass}'" : ''; - $ret = ''; - for ($i = 0; $i < $brNumb; ++$i) { - $ret .= "{$t}{$n}"; - } - - return $ret; + return str_repeat("{$t}{$n}", $brNumb); } /** @@ -152,12 +145,10 @@ public function getHtmlBr($brNumb = 1, $htmlClass = '', $t = '', $n = "\n") * @param string $n * @return string */ - public function getHtmlHNumb($content = '', $l = '1', $htmlHClass = '', $t = '', $n = "\n") + public function getHtmlHNumb(string $content = '', string $l = '1', string $htmlHClass = '', string $t = '', string $n = "\n") { $hClass = ('' != $htmlHClass) ? " class='{$htmlHClass}'" : ''; - $ret = "{$t}{$content}{$n}"; - - return $ret; + return "{$t}{$content}{$n}"; } /** @@ -166,10 +157,10 @@ 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) + public function getHtmlDiv(string $content = '', string $divClass = '', string $t = '', string $n = "\n", bool $split = true) { $rDivClass = ('' != $divClass) ? " class='{$divClass}'" : ''; @@ -192,7 +183,7 @@ public function getHtmlDiv($content = '', $divClass = '', $t = '', $n = "\n", $s * @param string $n * @return string */ - public function getHtmlPre($content = '', $preClass = '', $t = '', $n = "\n") + public function getHtmlPre(string $content = '', string $preClass = '', string $t = '', string $n = "\n") { $rPreClass = ('' != $preClass) ? " class='{$preClass}'" : ''; $ret = "{$t}{$n}"; @@ -208,10 +199,10 @@ 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) + public function getHtmlSpan(string $content = '', string $spanClass = '', string $t = '', string $n = "\n", bool $split = false) { $rSpanClass = ('' != $spanClass) ? " class='{$spanClass}'" : ''; $ret = "{$t}"; @@ -235,7 +226,7 @@ public function getHtmlSpan($content = '', $spanClass = '', $t = '', $n = "\n", * @param string $n * @return string */ - public function getHtmlParagraph($content = '', $pClass = '', $t = '', $n = "\n") + public function getHtmlParagraph(string $content = '', string $pClass = '', string $t = '', string $n = "\n") { $rPClass = ('' != $pClass) ? " class='{$pClass}'" : ''; $ret = "{$t}{$n}"; @@ -254,13 +245,11 @@ public function getHtmlParagraph($content = '', $pClass = '', $t = '', $n = "\n" * @param string $n * @return string */ - public function getHtmlI($content = '', $iClass = '', $iId = '', $t = '', $n = "\n") + public function getHtmlI(string $content = '', string $iClass = '', string $iId = '', string $t = '', string $n = "\n") { $rIClass = ('' != $iClass) ? " class='{$iClass}'" : ''; $rIId = ('' != $iId) ? " id='{$iId}'" : ''; - $ret = "{$t}{$content}{$n}"; - - return $ret; + return "{$t}{$content}{$n}"; } /** @@ -271,7 +260,7 @@ public function getHtmlI($content = '', $iClass = '', $iId = '', $t = '', $n = " * @param string $n * @return string */ - public function getHtmlUl($content = '', $ulClass = '', $t = '', $n = "\n") + public function getHtmlUl(string $content = '', string $ulClass = '', string $t = '', string $n = "\n") { $rUlClass = ('' != $ulClass) ? " class='{$ulClass}'" : ''; $ret = "{$t}{$n}"; @@ -289,7 +278,7 @@ public function getHtmlUl($content = '', $ulClass = '', $t = '', $n = "\n") * @param string $n * @return string */ - public function getHtmlOl($content = '', $olClass = '', $t = '', $n = "\n") + public function getHtmlOl(string $content = '', string $olClass = '', string $t = '', string $n = "\n") { $rOlClass = ('' != $olClass) ? " class='{$olClass}'" : ''; $ret = "{$t}{$n}"; @@ -305,10 +294,10 @@ 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(string $content = '', string $liClass = '', string $t = '', string $n = "\n", bool $split = false) { $rLiClass = ('' != $liClass) ? " class='{$liClass}'" : ''; if ($split) { @@ -330,7 +319,7 @@ public function getHtmlLi($content = '', $liClass = '', $t = '', $n = "\n", $spl * @param string $n * @return string */ - public function getHtmlStrong($content = '', $strongClass = '', $t = '', $n = '') + public function getHtmlStrong(string $content = '', string $strongClass = '', string $t = '', string $n = '') { $rStrongClass = ('' != $strongClass) ? " class='{$strongClass}'" : ''; @@ -349,7 +338,7 @@ public function getHtmlStrong($content = '', $strongClass = '', $t = '', $n = '' * @param string $n * @return string */ - public function getHtmlAnchor($url = '#', $content = ' ', $title = '', $target = '', $aClass = '', $rel = '', $t = '', $n = '') + public function getHtmlAnchor(string $url = '#', string $content = ' ', string $title = '', string $target = '', string $aClass = '', string $rel = '', string $t = '', string $n = '') { $target = ('' != $target) ? " target='{$target}'" : ''; $rAClass = ('' != $aClass) ? " class='{$aClass}'" : ''; @@ -367,7 +356,7 @@ public function getHtmlAnchor($url = '#', $content = ' ', $title = '', $tar * @param string $n * @return string */ - public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '', $t = '', $n = '') + public function getHtmlImage(string $src = 'blank.gif', string $alt = 'blank.gif', string $imgClass = '', string $t = '', string $n = '') { $rImgClass = ('' != $imgClass) ? " class='{$imgClass}'" : ''; if (strpos($src,"'")) { @@ -388,7 +377,7 @@ public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = * @param string $n * @return string */ - public function getHtmlTable($content = '', $tableClass = '', $t = '', $n = "\n") + public function getHtmlTable(string $content = '', string $tableClass = '', string $t = '', string $n = "\n") { $rTableClass = ('' != $tableClass) ? " class='{$tableClass}'" : ''; $ret = "{$t}{$n}"; @@ -406,7 +395,7 @@ public function getHtmlTable($content = '', $tableClass = '', $t = '', $n = "\n" * @param string $n * @return string */ - public function getHtmlTableThead($content = '', $theadClass = '', $t = '', $n = "\n") + public function getHtmlTableThead(string $content = '', string $theadClass = '', string $t = '', string $n = "\n") { $rTheadClass = ('' != $theadClass) ? " class='{$theadClass}'" : ''; $ret = "{$t}{$n}"; @@ -425,7 +414,7 @@ public function getHtmlTableThead($content = '', $theadClass = '', $t = '', $n = * @param string $n * @return string */ - public function getHtmlTableTbody($content = '', $tbodyClass = '', $t = '', $n = "\n") + public function getHtmlTableTbody(string $content = '', string $tbodyClass = '', string $t = '', string $n = "\n") { $rTbodyClass = ('' != $tbodyClass) ? " class='{$tbodyClass}'" : ''; $ret = "{$t}{$n}"; @@ -442,10 +431,10 @@ 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) + public function getHtmlTableTfoot(string $content = '', string $tfootClass = '', string $t = '', string $n = "\n", bool $split = true) { $rTfootClass = ('' != $tfootClass) ? " class='{$tfootClass}'" : ''; if ($split) { @@ -467,7 +456,7 @@ public function getHtmlTableTfoot($content = '', $tfootClass = '', $t = '', $n = * @param string $n * @return string */ - public function getHtmlTableRow($content = '', $trClass = '', $t = '', $n = "\n") + public function getHtmlTableRow(string $content = '', string $trClass = '', string $t = '', string $n = "\n") { $rTrClass = ('' != $trClass) ? " class='{$trClass}'" : ''; $ret = "{$t}{$n}"; @@ -484,10 +473,10 @@ 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) + public function getHtmlTableHead(string $content = '', string $thClass = '', string $colspan = '', string $t = '', string $n = "\n", bool $split = false) { $rThClass = ('' != $thClass) ? " class='{$thClass}'" : ''; $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : ''; @@ -509,10 +498,10 @@ 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) + public function getHtmlTableData(string $content = '', string $tdClass = '', string $colspan = '', string $t = '', string $n = "\n", bool $split = false) { $rTdClass = ('' != $tdClass) ? " class='{$tdClass}'" : ''; $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : ''; diff --git a/class/Files/CreateMoreFiles.php b/class/Files/CreateMoreFiles.php index 23de008f..bfacaac2 100644 --- a/class/Files/CreateMoreFiles.php +++ b/class/Files/CreateMoreFiles.php @@ -41,7 +41,6 @@ class CreateMoreFiles extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -50,7 +49,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return CreateMorefiles */ public static function getInstance() @@ -65,13 +64,13 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename * * @param $folder * @param $extension */ - public function write($module, $filename, $folder, $extension) + public function write($module, string $filename, $folder, $extension) { $this->setModule($module); $this->extension = $extension; @@ -89,7 +88,7 @@ public function write($module, $filename, $folder, $extension) * @param string $header * @return string */ - private function getMorefilesPhp($header = '') + private function getMorefilesPhp(string $header = '') { $ret = " $dim) { @@ -838,7 +842,7 @@ public function getPhpCodeNamespace($dimensions, $t = '', $n = "\n\n") * @param string $n * @return string */ - public function getPhpCodeUseNamespace($dimensions, $t = '', $n = "\n\n") + public function getPhpCodeUseNamespace($dimensions, string $t = '', string $n = "\n\n") { $ret = "\n{$t}use "; foreach ($dimensions as $key => $dim) { @@ -873,7 +877,7 @@ public function getPhpCodeBlankLine() * @param string $type * @return string */ - public function getPhpCodeConstant($const, $value, $t = '', $type = 'const') + public function getPhpCodeConstant($const, $value, string $t = '', string $type = 'const') { return "{$t}{$type} {$const} = {$value};\n"; } @@ -886,10 +890,8 @@ public function getPhpCodeConstant($const, $value, $t = '', $type = 'const') * @param string $t * @return string */ - public function getPhpCodeTriggerError($msg, $type, $t = '') + public function getPhpCodeTriggerError($msg, $type, string $t = '') { - $ret = "{$t}\\trigger_error($msg, {$type});\n"; - - return $ret; + return "{$t}\\trigger_error($msg, {$type});\n"; } } diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index 3d3eaa74..7bae5586 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -33,7 +33,6 @@ class CreateSmartyCode { /** * @public function constructor - * @param null */ public function __construct() { @@ -41,7 +40,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Files\CreateSmartyCode */ public static function getInstance() @@ -58,21 +57,19 @@ public static function getInstance() * @public function getSmartyTag * * @param string $tag - * @param array $attributes + * @param array $attributes * @param string $content * * @param string $t * @return string */ - public function getSmartyTag($tag = '', $attributes = [], $content = '', $t = '') + public function getSmartyTag(string $tag = '', array $attributes = [], string $content = '', string $t = '') { if (empty($attributes)) { $attributes = []; } $attr = $this->getAttributes($attributes); - $ret = "{$t}<{{$tag}{$attr}}>{$content}<{/{$tag}}>"; - - return $ret; + return "{$t}<{{$tag}{$attr}}>{$content}<{/{$tag}}>"; } /** @@ -81,7 +78,7 @@ public function getSmartyTag($tag = '', $attributes = [], $content = '', $t = '' * * @return string */ - private function getAttributes($attributes) + private function getAttributes(array $attributes) { $str = ''; foreach ($attributes as $name => $value) { @@ -99,7 +96,7 @@ private function getAttributes($attributes) * * @return string */ - public function getSmartyEmpty($empty = '') + public function getSmartyEmpty(string $empty = '') { return (string)$empty; } @@ -111,7 +108,7 @@ public function getSmartyEmpty($empty = '') * @param string $n * @return string */ - public function getSmartyComment($comment = '', $t = '', $n = "\n") + public function getSmartyComment(string $comment = '', string $t = '', string $n = "\n") { return "{$t}<{* {$comment} *}>{$n}"; } @@ -122,7 +119,7 @@ public function getSmartyComment($comment = '', $t = '', $n = "\n") * @param string $t * @return string */ - public function getSmartyNoSimbol($noSimbol = '', $t = '') + public function getSmartyNoSimbol(string $noSimbol = '', string $t = '') { return "{$t}<{{$noSimbol}}>"; } @@ -135,7 +132,7 @@ public function getSmartyNoSimbol($noSimbol = '', $t = '') * @param string $n * @return string */ - public function getSmartyConst($language, $const, $t = '', $n = '') + public function getSmartyConst(string $language, $const, string $t = '', string $n = '') { return "{$t}<{\$smarty.const.{$language}{$const}}>{$n}"; } @@ -148,7 +145,7 @@ public function getSmartyConst($language, $const, $t = '', $n = '') * @param string $default * @return string */ - public function getSmartySingleVar($var, $t = '', $n = '', $default = 'false') + public function getSmartySingleVar(string $var, string $t = '', string $n = '', string $default = 'false') { $ret = "{$t}<{\${$var}"; if ('' !== $default) { @@ -167,7 +164,7 @@ public function getSmartySingleVar($var, $t = '', $n = '', $default = 'false') * @param string $n * @return string */ - public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '', $default = 'false') + public function getSmartyDoubleVar(string $leftVar, string $rightVar, string $t = '', string $n = '', $default = 'false') { return "{$t}<{\${$leftVar}.{$rightVar}|default:{$default}}>{$n}"; } @@ -176,15 +173,14 @@ public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = '', $defau * @public function getSmartyIncludeFile * @param $moduleDirname * @param string $fileName - * @param bool $admin + * @param bool $admin * @param string $t * @param string $n * @param string $attributes * @return string */ - public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $t = '', $n = "\n", $attributes = '') + public function getSmartyIncludeFile($moduleDirname, string $fileName = 'header', bool $admin = false, string $t = '', string $n = "\n", string $attributes = '') { - $ret = ''; if (!$admin) { $ret = "{$t}<{include file='db:{$moduleDirname}_{$fileName}.tpl' {$attributes}}>{$n}"; } else { @@ -204,7 +200,7 @@ public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admi * @param string $n * @return string */ - public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $itemName, $arrayName, $t = '', $n = '') + public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $itemName, $arrayName, string $t = '', string $n = '') { return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$itemName}=\${$arrayName}[i]}>{$n}"; } @@ -218,7 +214,7 @@ public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $item * @param string $n * @return string */ - public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tableFieldName, $t = '', $n = '') + public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tableFieldName, string $t = '', string $n = '') { return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}}>{$n}"; } @@ -230,15 +226,15 @@ public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tabl * @param string $type * @param string $contentIf * @param mixed $contentElse - * @param bool $count - * @param bool $noSimbol + * @param mixed $count + * @param mixed $noSimbol * @param string $t * @param string $n - * @param bool $split + * @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') + public function getSmartyConditions(string $condition = '', string $operator = '', string $type = '', string $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, string $t = '', string $n = "\n", bool $split = true, $default = 'string') { $ns = ''; $ts = ''; @@ -267,7 +263,7 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', } $ret .= "{$operator}{$type}}>{$ns}"; } else { - $ret = "{$t}<{if count(\${$condition}){$operator}{$type}}>{$ns}"; + $ret = "{$t}<{if \${$condition}|count{$operator}{$type}}>{$ns}"; } $ret .= "{$contentIf}"; if ($contentElse) { @@ -290,7 +286,7 @@ public function getSmartyConditions($condition = '', $operator = '', $type = '', * @param string $n * @return string */ - public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content', $name = '', $key = '', $t = '', $n = "\n") + public function getSmartyForeach(string $item = 'item', string $from = 'from', string $content = 'content', string $name = '', string $key = '', string $t = '', string $n = "\n") { $name = '' != $name ? " name={$name}" : ''; $key = '' != $key ? " key={$key}" : ''; @@ -313,7 +309,7 @@ public function getSmartyForeach($item = 'item', $from = 'from', $content = 'con * @param string $n * @return string */ - public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content', $loop = 'loop', $key = '', $t = '', $n = "\n") + public function getSmartyForeachQuery(string $item = 'item', string $from = 'from', string $content = 'content', string $loop = 'loop', string $key = '', string $t = '', string $n = "\n") { $loop = '' != $loop ? " loop={$loop}" : ''; $key = '' != $key ? " key={$key}" : ''; @@ -329,13 +325,13 @@ 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 */ - public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content', $start = 0, $step = 0, $t = '', $n = "\n") + public function getSmartySection(string $name = 'name', string $loop = 'loop', string $content = 'content', int $start = 0, int $step = 0, string $t = '', string $n = "\n") { $start = 0 != $start ? " start={$start}" : ''; $step = 0 != $step ? " step={$step}" : ''; diff --git a/class/Files/CreateStructure.php b/class/Files/CreateStructure.php index b0e7e6f3..0cbb2d76 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -49,8 +49,6 @@ class CreateStructure /** * @public function constructor class - * - * @param null */ public function __construct() { @@ -59,8 +57,6 @@ public function __construct() /** * @static function getInstance * - * @param null - * * @return Modulebuilder\Files\CreateStructure */ public static function getInstance() @@ -162,10 +158,8 @@ public function isDir($dname): void if (!\mkdir($dname, 0755) && !\is_dir($dname)) { throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dname)); } - chmod($dname, 0755); - } else { - chmod($dname, 0755); } + chmod($dname, 0755); } /** @@ -173,7 +167,7 @@ public function isDir($dname): void * * @param string $dir */ - protected function makeDir($dir): void + protected function makeDir(string $dir): void { $this->isDir(\trim($dir)); } @@ -183,9 +177,9 @@ protected function makeDir($dir): void * * @param string $dir * - * @return string + * @return bool */ - public function isDirEmpty($dir) + public function isDirEmpty(string $dir) { $content = []; $handle = \opendir($dir); @@ -205,11 +199,11 @@ public function isDirEmpty($dir) /** * @public function addFolderPath * - * @param string $folderName + * @param string $folderName * @param bool|string $fileName * @return string */ - private function addFolderPath($folderName, $fileName = false) + private function addFolderPath(string $folderName, $fileName = false) { $this->setFolderName($folderName); if ($fileName) { @@ -227,7 +221,7 @@ private function addFolderPath($folderName, $fileName = false) * * @param string $dirName */ - public function makeDirInModule($dirName): void + public function makeDirInModule(string $dirName): void { $fname = $this->addFolderPath($dirName); $this->makeDir($fname); @@ -240,7 +234,7 @@ public function makeDirInModule($dirName): void * @param string $fromFile * @param string $toFile */ - public function makeDirAndCopyFile($folderName, $fromFile, $toFile): void + public function makeDirAndCopyFile(string $folderName, string $fromFile, string $toFile): void { $dname = $this->addFolderPath($folderName); $this->makeDir($dname); @@ -254,7 +248,7 @@ public function makeDirAndCopyFile($folderName, $fromFile, $toFile): void * @param string $fromFile * @param string $toFile */ - public function copyFile($folderName, $fromFile, $toFile): void + public function copyFile(string $folderName, string $fromFile, string $toFile): void { $dname = $this->addFolderPath($folderName); $fname = $this->addFolderPath($folderName, $toFile); @@ -268,14 +262,13 @@ public function copyFile($folderName, $fromFile, $toFile): void * @param string $fromFile * @param string $fname */ - public function setCopy($dname, $fromFile, $fname): void + public function setCopy(string $dname, string $fromFile, string $fname): void { if (\is_dir($dname)) { chmod($dname, 0777); - \copy($fromFile, $fname); } else { $this->makeDir($dname); - \copy($fromFile, $fname); } + \copy($fromFile, $fname); } } diff --git a/class/Files/CreateTableFields.php b/class/Files/CreateTableFields.php index c368672a..ad545c9f 100644 --- a/class/Files/CreateTableFields.php +++ b/class/Files/CreateTableFields.php @@ -60,9 +60,9 @@ public static function getInstance() * * @param string $sort * @param string $order - * @return mixed + * @return array */ - public function getTableTables($mId, $sort = 'table_id ASC, table_name', $order = 'ASC') + public function getTableTables($mId, string $sort = 'table_id ASC, table_name', string $order = 'ASC') { $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('table_mid', $mId)); // $mId = module Id @@ -82,9 +82,9 @@ public function getTableTables($mId, $sort = 'table_id ASC, table_name', $order * * @param string $sort * @param string $order - * @return mixed + * @return array */ - public function getTableFields($mId, $tId, $sort = 'field_order ASC, field_id', $order = 'ASC') + public function getTableFields($mId, $tId, string $sort = 'field_order ASC, field_id', string $order = 'ASC') { $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('field_mid', $mId)); // $mId = module Id @@ -105,9 +105,9 @@ public function getTableFields($mId, $tId, $sort = 'field_order ASC, field_id', * * @param string $sort * @param string $order - * @return mixed + * @return array */ - public function getTableFieldelements($mId = null, $tId = null, $sort = 'fieldelement_id ASC, fieldelement_name', $order = 'ASC') + public function getTableFieldelements($mId = null, $tId = null, string $sort = 'fieldelement_id ASC, fieldelement_name', string $order = 'ASC') { $criteria = new \CriteriaCompo(); if (null != $mId) { @@ -133,9 +133,9 @@ public function getTableFieldelements($mId = null, $tId = null, $sort = 'fieldel * * @param string $sort * @param string $order - * @return mixed + * @return array */ - public function getTableMorefiles($mId, $sort = 'file_id ASC, file_name', $order = 'ASC') + public function getTableMorefiles($mId, string $sort = 'file_id ASC, file_name', string $order = 'ASC') { $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('file_mid', $mId)); // $mId = module Id diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index ad7061b2..e0e24ad5 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -32,10 +32,7 @@ class CreateXoopsCode { /** * @static function getInstance - * @param null - */ - - /** + * * @return Modulebuilder\Files\CreateXoopsCode */ public static function getInstance() @@ -51,16 +48,16 @@ public static function getInstance() /** * @public function getXcSwitch * @param string $op - * @param array $cases - * @param bool $defaultAfterCase - * @param bool $default + * @param array $cases + * @param bool $defaultAfterCase + * @param bool $default * @param string $t - Indentation * - * @param bool $isString - * @param bool $isConst + * @param bool $isString + * @param bool $isConst * @return string */ - public function getXcSwitch($op = '', $cases = [], $defaultAfterCase = false, $default = false, $t = '', $isString = true, $isConst = false) + public function getXcSwitch(string $op = '', array $cases = [], bool $defaultAfterCase = false, bool $default = false, string $t = '', bool $isString = true, bool $isConst = false) { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, $defaultAfterCase, $default, $t . "\t", $isConst); @@ -73,11 +70,11 @@ public function getXcSwitch($op = '', $cases = [], $defaultAfterCase = false, $d * @param $var * @param $value * @param $interlock - * @param $t - Indentation + * @param string $t - Indentation * * @return string */ - public function getXcEqualsOperator($var, $value, $interlock = null, $t = '') + public function getXcEqualsOperator($var, $value, $interlock = null, string $t = '') { return "{$t}{$var} {$interlock}= {$value};\n"; } @@ -87,11 +84,11 @@ public function getXcEqualsOperator($var, $value, $interlock = null, $t = '') * @param $anchor * @param $name * @param $vars - * @param $close + * @param bool $close * * @return string */ - public function getXcAnchorFunction($anchor, $name, $vars, $close = false) + public function getXcAnchorFunction($anchor, $name, $vars, bool $close = false) { $semicolon = false !== $close ? ';' : ''; @@ -103,10 +100,10 @@ public function getXcAnchorFunction($anchor, $name, $vars, $close = false) * @param $tableName * @param $fieldName * @param $var - * @param $t + * @param string $t * @return string */ - public function getXcSetVarObj($tableName, $fieldName, $var, $t = '') + public function getXcSetVarObj($tableName, $fieldName, $var, string $t = '') { return "{$t}\${$tableName}Obj->setVar('{$fieldName}', {$var});\n"; } @@ -116,13 +113,13 @@ public function getXcSetVarObj($tableName, $fieldName, $var, $t = '') * @param string $varLeft * @param string $handle * @param string $var - * @param bool $isParam + * @param bool $isParam * @param string $t * * @param string $format * @return string */ - public function getXcGetVar($varLeft = '', $handle = '', $var = '', $isParam = false, $t = '', $format = '') + public function getXcGetVar(string $varLeft = '', string $handle = '', string $var = '', bool $isParam = false, string $t = '', string $format = '') { if (!$isParam) { $ret = "{$t}\${$varLeft} = \${$handle}->getVar('{$var}'{$format});\n"; @@ -135,14 +132,14 @@ public function getXcGetVar($varLeft = '', $handle = '', $var = '', $isParam = f /** * @public function getXcAddItem - * @param $varLeft - * @param $paramLeft - * @param $paramRight - * @param $t + * @param string $varLeft + * @param string $paramLeft + * @param string $paramRight + * @param string $t * * @return string */ - public function getXcAddItem($varLeft = '', $paramLeft = '', $paramRight = '', $t = '') + public function getXcAddItem(string $varLeft = '', string $paramLeft = '', string $paramRight = '', string $t = '') { return "{$t}\${$varLeft}->addItem({$paramLeft}, {$paramRight});\n"; } @@ -157,7 +154,7 @@ public function getXcAddItem($varLeft = '', $paramLeft = '', $paramRight = '', $ * @param string $t * @return string */ - public function getXcGetGroupIds($var = '', $anchor = '', $param1 = null, $param2 = null, $param3 = null, $t = '') + public function getXcGetGroupIds(string $var = '', string $anchor = '', $param1 = null, $param2 = null, $param3 = null, string $t = '') { return "{$t}\${$var} = \${$anchor}->getGroupIds({$param1}, {$param2}, {$param3});\n"; } @@ -172,7 +169,7 @@ public function getXcGetGroupIds($var = '', $anchor = '', $param1 = null, $param * @param string $t * @return string */ - public function getXcGetItemIds($var = '', $anchor = '', $param1 = null, $param2 = null, $param3 = null, $t = '') + public function getXcGetItemIds(string $var = '', string $anchor = '', $param1 = null, $param2 = null, $param3 = null, string $t = '') { return "{$t}\${$var} = \${$anchor}->getItemIds({$param1}, {$param2}, {$param3});\n"; } @@ -183,15 +180,23 @@ public function getXcGetItemIds($var = '', $anchor = '', $param1 = null, $param2 * @param $tableSoleName * @param $fieldName * @param string $t + * @param string $language * @return string */ - public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t = '') + public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, string $t = '', string $language = '') { - $tf = Modulebuilder\Files\CreateFile::getInstance(); - $rightField = $tf->getRightString($fieldName); + $cf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $rightField = $cf->getRightString($fieldName); $ucfRightField = \ucfirst($rightField); $value = "\DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('{$fieldName}'))"; $ret = $this->getXcEqualsOperator("\${$tableSoleName}{$ucfRightField}Obj", $value, null, $t); + $contentIf = $pc->getPhpCodeCommentLine('Get Form', null, $t . "\t"); + $contentIf .= $this->getXcXoopsTplAssign('error', "{$language}INVALID_DATE", true, $t . "\t"); + $contentIf .= $this->getXcGetForm('form', $tableName, 'Obj', $t . "\t"); + $contentIf .= $this->getXcXoopsTplAssign('form', '$form->render()', true, $t . "\t"); + $contentIf .= $cf->getSimpleString('break;', $t . "\t"); + $ret .= $pc->getPhpCodeConditions("\${$tableSoleName}{$ucfRightField}Obj", ' === ', 'false', $contentIf,false,$t); $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\${$tableSoleName}{$ucfRightField}Obj->getTimestamp()", $t); return $ret; @@ -203,20 +208,30 @@ public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName * @param $tableSoleName * @param $fieldName * @param string $t + * @param string $language * @return string */ - public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t = '') + public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, string $t = '', string $language = '') { $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $rightField = $tf->getRightString($fieldName); $ucfRightField = \ucfirst($rightField); $request = "Request::getArray('{$fieldName}')"; $var = "\${$tableSoleName}{$ucfRightField}"; $varArr = "\${$tableSoleName}{$ucfRightField}Arr"; $ret = $this->getXcEqualsOperator($varArr, $request, null, $t); + $varObj = "\${$tableSoleName}{$ucfRightField}Obj"; + $contentIf = $pc->getPhpCodeCommentLine('Get Form', null, $t . "\t"); + $contentIf .= $this->getXcXoopsTplAssign('error', "{$language}INVALID_DATE", true, $t . "\t"); + $contentIf .= $this->getXcGetForm('form', $tableName, 'Obj', $t . "\t"); + $contentIf .= $this->getXcXoopsTplAssign('form', '$form->render()', true, $t . "\t"); + $contentIf .= $tf->getSimpleString('break;', $t . "\t"); + $ret .= $pc->getPhpCodeConditions("!isset(\${$tableSoleName}{$ucfRightField}Arr['date']) || !isset(\${$tableSoleName}{$ucfRightField}Arr['time'])", '', '', $contentIf,false,$t); $value = "\DateTime::createFromFormat(\_SHORTDATESTRING, {$varArr}['date'])"; $ret .= $this->getXcEqualsOperator($varObj, $value, null, $t); + $ret .= $pc->getPhpCodeConditions("\${$tableSoleName}{$ucfRightField}Obj", ' === ', 'false', $contentIf,false,$t); $ret .= "{$t}{$varObj}->setTime(0, 0, 0);\n"; $value = "{$varObj}->getTimestamp() + (int){$varArr}['time']"; $ret .= $this->getXcEqualsOperator($var, $value, null, $t); @@ -229,10 +244,10 @@ public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t = * @public function getXcSetVarCheckBoxOrRadioYN * @param $tableName * @param $fieldName - * @param $t + * @param string $t * @return string */ - public function getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, $t = '') + public function getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, string $t = '') { return $this->getXcSetVarObj($tableName, $fieldName, "Request::getInt('{$fieldName}')", $t); } @@ -246,7 +261,7 @@ public function getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, $t = '') * @param string $t * @return string */ - public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, $t = '') + public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, string $t = '') { $mimetypes_file = $this->getXcGetConfig($mimetype); $maxsize_file = $this->getXcGetConfig($maxsize); @@ -258,13 +273,13 @@ public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, $t = '') /** * @public function getXcXoopsCaptcha - * @param $var - * @param $instance - * @param $t + * @param string $var + * @param string $instance + * @param string $t * * @return string */ - public function getXcGetInstance($var = '', $instance = '', $t = '') + public function getXcGetInstance(string $var = '', string $instance = '', string $t = '') { return "{$t}\${$var} = {$instance}::getInstance();\n"; } @@ -282,10 +297,10 @@ public function getXcGetConfig($name) /** * @public function getXcIdGetVar * @param $lpFieldName - * @param $t + * @param string $t * @return string */ - public function getXcIdGetVar($lpFieldName, $t = '') + public function getXcIdGetVar($lpFieldName, string $t = '') { return "{$t}\${$lpFieldName}['id'] = \$i;\n"; } @@ -296,10 +311,10 @@ public function getXcIdGetVar($lpFieldName, $t = '') * @param $rpFieldName * @param $tableName * @param $fieldName - * @param $t + * @param string $t * @return string */ - public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') + public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}All[\$i]->getVar('{$fieldName}');\n"; } @@ -311,7 +326,7 @@ public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldNam * @param string $t * @return string */ - public function getXcHelperGetInstance($moduleDirname, $t = '') + public function getXcHelperGetInstance($moduleDirname, string $t = '') { $ucfModuleDirname = \ucfirst($moduleDirname); $ret = "{$t}// Get instance of module\n"; @@ -328,7 +343,7 @@ public function getXcHelperGetInstance($moduleDirname, $t = '') * @param string $t * @return string */ - public function getXcFormatTimeStamp($left, $value, $format = 's', $t = '') + public function getXcFormatTimeStamp($left, $value, string $format = 's', string $t = '') { return "{$t}\${$left} = \\formatTimestamp({$value}, '{$format}');\n"; } @@ -344,7 +359,7 @@ public function getXcFormatTimeStamp($left, $value, $format = 's', $t = '') * @param string $t * @return string */ - public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, $t = '') + public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); @@ -366,7 +381,7 @@ public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableN * @param string $t * @return string */ - public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableSoleNameTopic, $tableNameTopic, $fieldNameParent, $t = '') + public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableSoleNameTopic, $tableNameTopic, $fieldNameParent, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $parentTopic = $pc->getPhpCodeCommentLine('Get', $tableNameTopic . ' Handler', $t . "\t"); @@ -388,7 +403,7 @@ public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $ * @param string $t * @return string */ - public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, $t = '') + public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldName, $t); @@ -442,7 +457,7 @@ public function getXcGetVarUrlFile($lpFieldName, $rpFieldName, $tableName, $fiel * @param string $t * @return string */ - public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') + public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $getVar = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true); @@ -459,7 +474,7 @@ public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fie * @param string $t * @return string */ - public function getXcGetVarSelectUser($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') + public function getXcGetVarSelectUser($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; } @@ -473,7 +488,7 @@ public function getXcGetVarSelectUser($lpFieldName, $rpFieldName, $tableName, $f * @param string $t * @return string */ - public function getXcGetVarTextDateSelect($lpFieldName, $rpFieldName, $tableName, $fieldName, $t = '') + public function getXcGetVarTextDateSelect($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; } @@ -485,7 +500,7 @@ public function getXcGetVarTextDateSelect($lpFieldName, $rpFieldName, $tableName * @param string $t * @return string */ - public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, $t = '') + public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, string $t = '') { return "{$t}\$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl';\n"; } @@ -508,7 +523,7 @@ public function getXcUserHeader($moduleDirname, $tableName) /** * @public function getXcPermissionsHeader - * @param null + * * @return string */ public function getXcPermissionsHeader() @@ -519,7 +534,7 @@ public function getXcPermissionsHeader() $ret .= $this->getXcXoopsHandler('groupperm'); $groups = $this->getXcEqualsOperator('$groups', '$xoopsUser->getGroups()'); $elseGroups = $this->getXcEqualsOperator('$groups', '\XOOPS_GROUP_ANONYMOUS'); - $ret .= $pc->getPhpCodeConditions('\is_object($xoopsUser)', '', $type = '', $groups, $elseGroups); + $ret .= $pc->getPhpCodeConditions('\is_object($xoopsUser)', '', '', $groups, $elseGroups); return $ret; } @@ -596,6 +611,7 @@ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName $ret = ''; $fieldMain = ''; $countUploader = 0; + $language = '\_MA_' . \strtoupper($moduleDirname) . '_'; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); @@ -611,7 +627,7 @@ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, '', '', $countUploader); $countUploader++; } elseif (15 == $fieldElement) { - $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName); + $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, '', $language); } else { $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']"); } @@ -626,11 +642,11 @@ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName * @param string $var1 * @param string $var2 * @param string $type - * @param bool $method + * @param bool $method * @param string $t * @return string */ - public function getXcXoopsRequest($left = '', $var1 = '', $var2 = '', $type = 'String', $method = false, $t = '') + public function getXcXoopsRequest(string $left = '', string $var1 = '', string $var2 = '', string $type = 'String', bool $method = false, string $t = '') { $ret = ''; $intVars = ('' != $var2) ? "'{$var1}', {$var2}" : "'{$var1}'"; @@ -658,12 +674,12 @@ public function getXcXoopsRequest($left = '', $var1 = '', $var2 = '', $type = 'S * @param string $var * @param string $groups * @param string $mid - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getXcAddRight($anchor, $permString = '', $var = '', $groups = '', $mid = '', $isParam = false, $t = '') + public function getXcAddRight($anchor, string $permString = '', string $var = '', string $groups = '', string $mid = '', bool $isParam = false, string $t = '') { if (!$isParam) { $ret = "{$t}\${$anchor}->addRight('{$permString}', {$var}, {$groups}, {$mid});\n"; @@ -682,12 +698,12 @@ public function getXcAddRight($anchor, $permString = '', $var = '', $groups = '' * @param string $var * @param string $groups * @param string $mid - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getXcCheckRight($anchor, $permString = '', $var = '', $groups = '', $mid = '', $isParam = false, $t = '') + public function getXcCheckRight($anchor, string $permString = '', string $var = '', string $groups = '', string $mid = '', bool $isParam = false, string $t = '') { if (!$isParam) { $ret = "{$t}{$anchor}->checkRight('{$permString}', {$var}, {$groups}, {$mid});\n"; @@ -705,12 +721,12 @@ 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 */ - public function getXcDeleteRight($anchor, $permString = '', $mid = '', $var = '', $isParam = false, $t = '') + public function getXcDeleteRight($anchor, string $permString = '', string $mid = '', string $var = '', bool $isParam = false, string $t = '') { if (!$isParam) { $ret = "{$t}\${$anchor}->deleteByModule({$mid}, '{$permString}', {$var});\n"; @@ -727,7 +743,7 @@ public function getXcDeleteRight($anchor, $permString = '', $mid = '', $var = '' * @param string $t * @return string */ - public function getXcHandlerLine($tableName, $t = '') + public function getXcHandlerLine($tableName, string $t = '') { $ucfTableName = \ucfirst($tableName); @@ -742,7 +758,7 @@ public function getXcHandlerLine($tableName, $t = '') * @param string $t * @return string */ - public function getXcHandlerCreateObj($tableName, $t = '') + public function getXcHandlerCreateObj($tableName, string $t = '') { return "{$t}\${$tableName}Obj = \${$tableName}Handler->create();\n"; } @@ -755,7 +771,7 @@ public function getXcHandlerCreateObj($tableName, $t = '') * @param string $t * @return string */ - public function getXcHandlerGetObj($tableName, $ccFieldId, $t = '') + public function getXcHandlerGetObj($tableName, $ccFieldId, string $t = '') { return "{$t}\${$tableName}Obj = \${$tableName}Handler->get(\${$ccFieldId});\n"; } @@ -768,28 +784,24 @@ public function getXcHandlerGetObj($tableName, $ccFieldId, $t = '') * @param string $t * @return string */ - public function getXcHandlerCountObj($tableName, $t = '') + public function getXcHandlerCountObj($tableName, string $t = '') { $ucfTableName = \ucfirst($tableName); - $ret = "{$t}\${$tableName}Count = \${$tableName}Handler->getCount{$ucfTableName}();\n"; - - return $ret; + return "{$t}\${$tableName}Count = \${$tableName}Handler->getCount{$ucfTableName}();\n"; } /** * @public function getXcClearCount * @param $left - * @param $anchor - * @param $params - * @param $t + * @param string $anchor + * @param string $params + * @param string $t * * @return string */ - public function getXcHandlerCountClear($left, $anchor = '', $params = '', $t = '') + public function getXcHandlerCountClear($left, string $anchor = '', string $params = '', string $t = '') { - $ret = "{$t}\${$left} = \${$anchor}Handler->getCount({$params});\n"; - - return $ret; + return "{$t}\${$left} = \${$anchor}Handler->getCount({$params});\n"; } /** @@ -803,14 +815,12 @@ public function getXcHandlerCountClear($left, $anchor = '', $params = '', $t = ' * @param string $t * @return string */ - public function getXcHandlerAllObj($tableName, $fieldMain = '', $start = '0', $limit = '0', $t = '') + public function getXcHandlerAllObj($tableName, string $fieldMain = '', string $start = '0', string $limit = '0', string $t = '') { $ucfTableName = \ucfirst($tableName); $startLimit = ('0' != $limit) ? "{$start}, {$limit}" : '0'; $params = ('' != $fieldMain) ? "{$startLimit}, '{$fieldMain}'" : $startLimit; - $ret = "{$t}\${$tableName}All = \${$tableName}Handler->getAll{$ucfTableName}({$params});\n"; - - return $ret; + return "{$t}\${$tableName}All = \${$tableName}Handler->getAll{$ucfTableName}({$params});\n"; } /** @@ -821,11 +831,9 @@ public function getXcHandlerAllObj($tableName, $fieldMain = '', $start = '0', $l * @param string $t * @return string */ - public function getXcHandlerAllClear($left, $anchor = '', $params = '', $t = '') + public function getXcHandlerAllClear($left, string $anchor = '', string $params = '', string $t = '') { - $ret = "{$t}\${$left} = \${$anchor}Handler->getAll({$params});\n"; - - return $ret; + return "{$t}\${$left} = \${$anchor}Handler->getAll({$params});\n"; } /** @@ -835,12 +843,12 @@ public function getXcHandlerAllClear($left, $anchor = '', $params = '', $t = '') * @param $var * @param string $obj * @param string $handler - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getXcHandlerGet($left, $var, $obj = '', $handler = 'Handler', $isParam = false, $t = '') + public function getXcHandlerGet($left, $var, string $obj = '', string $handler = 'Handler', bool $isParam = false, string $t = '') { if ($isParam) { $ret = "\${$left}{$handler}->get(\${$var})"; @@ -856,12 +864,12 @@ public function getXcHandlerGet($left, $var, $obj = '', $handler = 'Handler', $i * * @param $left * @param $var - * @param $obj - * @param $handler + * @param string $obj + * @param string $handler * * @return string */ - public function getXcHandlerInsert($left, $var, $obj = '', $handler = 'Handler') + public function getXcHandlerInsert($left, $var, string $obj = '', string $handler = 'Handler') { return "\${$left}{$handler}->insert(\${$var}{$obj})"; } @@ -875,7 +883,7 @@ public function getXcHandlerInsert($left, $var, $obj = '', $handler = 'Handler') * @param string $handler * @return string */ - public function getXcHandlerDelete($left, $var, $obj = '', $handler = 'Handler') + public function getXcHandlerDelete($left, $var, string $obj = '', string $handler = 'Handler') { return "\${$left}{$handler}->delete(\${$var}{$obj})"; } @@ -887,12 +895,12 @@ public function getXcHandlerDelete($left, $var, $obj = '', $handler = 'Handler') * @param $tableSoleName * * @param string $index - * @param bool $noArray + * @param bool $noArray * @param string $t * @param string $obj * @return string */ - public function getXcGetValues($tableName, $tableSoleName, $index = 'i', $noArray = false, $t = '', $obj = '') + public function getXcGetValues($tableName, $tableSoleName, string $index = 'i', bool $noArray = false, string $t = '', string $obj = '') { $index = '' !== $index ? $index : 'i'; $ucfTableName = \ucfirst($tableName); @@ -920,6 +928,7 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $ret = ''; $fieldMain = ''; $countUploader = 0; + $language = '\_MA_' . \strtoupper($moduleDirname) . '_'; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); @@ -949,7 +958,7 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $countUploader++; break; case 15: - $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName); + $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, '', $language); break; default: $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']"); @@ -969,7 +978,7 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, * @param string $t * @return string */ - public function getXcSecurity($tableName, $t = '') + public function getXcSecurity($tableName, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $securityError = $this->getXcXoopsSecurityErrors(); @@ -987,7 +996,7 @@ public function getXcSecurity($tableName, $t = '') * @param string $t * @return string */ - public function getXcInsertData($tableName, $language, $t = '') + public function getXcInsertData($tableName, $language, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '?op=list', 2, "{$language}FORM_OK"); @@ -1002,11 +1011,11 @@ public function getXcInsertData($tableName, $language, $t = '') * @param $options * @param $numb * @param $var - * @param bool $isString + * @param bool $isString * @param string $t * @return string */ - public function getXcRedirectHeader($directory, $options, $numb, $var, $isString = true, $t = '') + public function getXcRedirectHeader($directory, $options, $numb, $var, bool $isString = true, string $t = '') { if (!$isString) { $ret = "{$t}\\redirect_header({$directory}, {$numb}, {$var});\n"; @@ -1028,7 +1037,7 @@ public function getXcRedirectHeader($directory, $options, $numb, $var, $isString * @param string $t * @return string */ - public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $options = 'delete', $t = '') + public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, string $options = 'delete', string $t = '') { $stuOptions = \mb_strtoupper($options); $ccFieldId = Modulebuilder\Files\CreateFile::getInstance()->getCamelCase($fieldId, false, true); @@ -1039,9 +1048,7 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ $array = "['ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'start' => \$start, 'limit' => \$limit, 'op' => '{$options}']"; $server = $pc->getPhpCodeGlobalsVariables('REQUEST_URI', 'SERVER'); - $getVar = $this->getXcGetVar('', $tableName . 'Obj', $fieldMain, true); - $getVar = "\${$ccFieldMain}"; - $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, $getVar); + $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, "\${$ccFieldMain}"); $confirm = 'new Common\Confirm(' . "\n"; $confirm .= $t . "\t" . $array . ",\n"; $confirm .= $t . "\t" . $server . ",\n"; @@ -1057,13 +1064,13 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $ * @public function getXcHtmlErrors * * @param $tableName - * @param bool $isParam + * @param bool $isParam * @param string $obj * * @param string $t * @return string */ - public function getXcHtmlErrors($tableName, $isParam = false, $obj = 'Obj', $t = '') + public function getXcHtmlErrors($tableName, bool $isParam = false, string $obj = 'Obj', string $t = '') { if ($isParam) { $ret = "\${$tableName}{$obj}->getHtmlErrors()"; @@ -1084,7 +1091,7 @@ public function getXcHtmlErrors($tableName, $isParam = false, $obj = 'Obj', $t = * @param string $t * @return string */ - public function getXcGetForm($left, $tableName, $obj = '', $t = '') + public function getXcGetForm($left, $tableName, string $obj = '', string $t = '') { $ucfTableName = \ucfirst($tableName); @@ -1102,7 +1109,7 @@ public function getXcGetForm($left, $tableName, $obj = '', $t = '') * @param string $t * @return string */ - public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, $t = '') + public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, string $t = '') { $ret = Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); $paramGet = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldNameParent, true); @@ -1135,13 +1142,13 @@ public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fi */ /** - * @public function getXcSaveFieldId + * @public function getXcTableFieldId * * @param $fields * * @return string */ - public function getXcSaveFieldId($fields) + public function getXcTableFieldId($fields) { $fieldId = ''; foreach (\array_keys($fields) as $f) { @@ -1154,13 +1161,13 @@ public function getXcSaveFieldId($fields) } /** - * @public function getXcSaveFieldMain + * @public function getXcTableFieldMain * * @param $fields * * @return string */ - public function getXcSaveFieldMain($fields) + public function getXcTableFieldMain($fields) { $fieldMain = ''; foreach (\array_keys($fields) as $f) { @@ -1183,7 +1190,7 @@ public function getXcSaveFieldMain($fields) * @param string $t * @return string */ - public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t = '') + public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, string $t = '') { $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1191,6 +1198,7 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f $fieldMain = ''; $countUploader = 0; $fieldLines = ''; + $language = '\_MA_' . \strtoupper($moduleDirname) . '_'; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldType = $fields[$f]->getVar('field_type'); @@ -1222,14 +1230,14 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f $countUploader++; break; case 15: - $fieldLines .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t); + $fieldLines .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t, $language); break; case 17: $fieldLines .= $axc->getAxcSetVarPassword($tableName, $fieldName, $t); $countUploader++; break; case 21: - $fieldLines .= $this->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t); + $fieldLines .= $this->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t, $language); break; default: $fieldLines .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t); @@ -1252,16 +1260,18 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f * @param string $t * @param string $paramStart * @param string $paramOp + * @param string $pageNavTplName * @return string */ - public function getXcPageNav($tableName, $t = '', $paramStart = 'start', $paramOp = "'op=list&limit=' . \$limit") + public function getXcPageNav($tableName, string $t = '', string $paramStart = 'start', string $paramOp = "'op=list&limit=' . \$limit", string $pageNavTplName = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Display Navigation', null, $t); $condition = $pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/pagenav', true, false, 'require', $t . "\t"); $condition .= $cxc->getClassXoopsPageNav('pagenav', $tableName . 'Count', 'limit', 'start', $paramStart, $paramOp, false, $t . "\t"); - $condition .= $this->getXcXoopsTplAssign('pagenav', '$pagenav->renderNav()', true, $t . "\t"); + if ('' === $pageNavTplName) { $pageNavTplName = 'pagenav';} + $condition .= $this->getXcXoopsTplAssign($pageNavTplName, '$pagenav->renderNav()', true, $t . "\t"); $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '$limit', $condition, false, $t); return $ret; @@ -1273,7 +1283,7 @@ public function getXcPageNav($tableName, $t = '', $paramStart = 'start', $paramO * @param string $t * @return string */ - public function getXcGetGlobal($globals, $t = '') + public function getXcGetGlobal($globals, string $t = '') { $ret = $t . 'global '; $detail = ''; @@ -1296,7 +1306,7 @@ public function getXcGetGlobal($globals, $t = '') * * @return string */ - public function getXcCriteriaCompo($var, $t = '') + public function getXcCriteriaCompo($var, string $t = '') { return "{$t}\${$var} = new \CriteriaCompo();\n"; } @@ -1308,12 +1318,12 @@ public function getXcCriteriaCompo($var, $t = '') * @param $param1 * @param string $param2 * @param string $param3 - * @param bool $isParam + * @param bool $isParam * @param string $t * * @return string */ - public function getXcCriteria($var, $param1, $param2 = '', $param3 = '', $isParam = false, $t = '') + public function getXcCriteria($var, $param1, string $param2 = '', string $param3 = '', bool $isParam = false, string $t = '') { $params = ('' != $param2) ? ', ' . $param2 : ''; $params .= ('' != $param3) ? ', ' . $param3 : ''; @@ -1337,7 +1347,7 @@ public function getXcCriteria($var, $param1, $param2 = '', $param3 = '', $isPara * @param string $condition * @return string */ - public function getXcCriteriaAdd($var, $param, $t = '', $n = "\n", $condition = '') + public function getXcCriteriaAdd($var, $param, string $t = '', string $n = "\n", string $condition = '') { if ('' !== $condition) { $condition = ", {$condition}"; @@ -1356,7 +1366,7 @@ public function getXcCriteriaAdd($var, $param, $t = '', $n = "\n", $condition = * @param string $n * @return string */ - public function getXcCriteriaSetStart($var, $start, $t = '', $n = "\n") + public function getXcCriteriaSetStart($var, $start, string $t = '', string $n = "\n") { return "{$t}\${$var}->setStart({$start});{$n}"; } @@ -1371,7 +1381,7 @@ public function getXcCriteriaSetStart($var, $start, $t = '', $n = "\n") * @param string $n * @return string */ - public function getXcCriteriaSetLimit($var, $limit, $t = '', $n = "\n") + public function getXcCriteriaSetLimit($var, $limit, string $t = '', string $n = "\n") { return "{$t}\${$var}->setLimit({$limit});{$n}"; } @@ -1386,7 +1396,7 @@ public function getXcCriteriaSetLimit($var, $limit, $t = '', $n = "\n") * @param string $n * @return string */ - public function getXcCriteriaSetSort($var, $sort, $t = '', $n = "\n") + public function getXcCriteriaSetSort($var, $sort, string $t = '', string $n = "\n") { return "{$t}\${$var}->setSort({$sort});{$n}"; } @@ -1401,7 +1411,7 @@ public function getXcCriteriaSetSort($var, $sort, $t = '', $n = "\n") * @param string $n * @return string */ - public function getXcCriteriaSetOrder($var, $order, $t = '', $n = "\n") + public function getXcCriteriaSetOrder($var, $order, string $t = '', string $n = "\n") { return "{$t}\${$var}->setOrder({$order});{$n}"; } @@ -1412,17 +1422,17 @@ public function getXcCriteriaSetOrder($var, $order, $t = '', $n = "\n") /** * @public function getXcXoopsFormGroupPerm - * @param $varLeft - * @param $formTitle - * @param $moduleId - * @param $permName - * @param $permDesc - * @param $filename - * @param $t + * @param string $varLeft + * @param string $formTitle + * @param string $moduleId + * @param string $permName + * @param string $permDesc + * @param string $filename + * @param string $t * * @return string */ - public function getXcXoopsFormGroupPerm($varLeft = '', $formTitle = '', $moduleId = '', $permName = '', $permDesc = '', $filename = '', $t = '') + public function getXcXoopsFormGroupPerm(string $varLeft = '', string $formTitle = '', string $moduleId = '', string $permName = '', string $permDesc = '', string $filename = '', string $t = '') { return "{$t}\${$varLeft} = new \XoopsGroupPermForm({$formTitle}, {$moduleId}, {$permName}, {$permDesc}, {$filename});\n"; } @@ -1432,16 +1442,16 @@ public function getXcXoopsFormGroupPerm($varLeft = '', $formTitle = '', $moduleI * @param string $varSelect * @param string $caption * @param string $var - * @param array $options - * @param bool $setExtra + * @param array $options + * @param string $setExtra * * @param string $t * @return string */ - public function getXoopsFormSelectExtraOptions($varSelect = '', $caption = '', $var = '', $options = [], $setExtra = true, $t = '') + public function getXoopsFormSelectExtraOptions(string $varSelect = '', string $caption = '', string $var = '', array $options = [], string $setExtra = '', string $t = '') { $ret = "{$t}\${$varSelect} = new \XoopsFormSelect({$caption}, '{$var}', \${$var});\n"; - if (false !== $setExtra) { + if ('' !== $setExtra) { $ret .= "{$t}\${$varSelect}->setExtra('{$setExtra}');\n"; } foreach ($options as $key => $value) { @@ -1462,9 +1472,7 @@ public function getXoopsFormSelectExtraOptions($varSelect = '', $caption = '', $ */ public function getXcGetConstants($const) { - $ret = "Constants::{$const}"; - - return $ret; + return "Constants::{$const}"; } /*************************************************************/ @@ -1474,7 +1482,7 @@ public function getXcGetConstants($const) /** * @public function getXcXoopsCPHeader - * @param null + * * @return string */ public function getXcXoopsCPHeader() @@ -1484,7 +1492,7 @@ public function getXcXoopsCPHeader() /** * @public function getXcXoopsCPFooter - * @param null + * * @return string */ public function getXcXoopsCPFooter() @@ -1495,11 +1503,11 @@ public function getXcXoopsCPFooter() /** * @public function getXcXoopsLoad * - * @param $var - * @param $t + * @param string $var + * @param string $t * @return string */ - public function getXcXoopsLoad($var = '', $t = '') + public function getXcXoopsLoad(string $var = '', string $t = '') { return "{$t}\xoops_load('{$var}');\n"; } @@ -1508,12 +1516,12 @@ public function getXcXoopsLoad($var = '', $t = '') * @public function getXcXoopsLoadLanguage * * @param $lang - * @param $t - * @param $domain + * @param string $t + * @param string $domain * * @return string */ - public function getXcXoopsLoadLanguage($lang, $t = '', $domain = '') + public function getXcXoopsLoadLanguage($lang, string $t = '', string $domain = '') { if ('' === $domain) { return "{$t}\xoops_loadLanguage('{$lang}');\n"; @@ -1524,10 +1532,10 @@ public function getXcXoopsLoadLanguage($lang, $t = '', $domain = '') /** * @public function getXcXoopsCaptcha - * @param $t + * @param string $t * @return string */ - public function getXcXoopsCaptcha($t = '') + public function getXcXoopsCaptcha(string $t = '') { return "{$t}\$xoopsCaptcha = \XoopsCaptcha::getInstance();\n"; } @@ -1536,11 +1544,11 @@ public function getXcXoopsCaptcha($t = '') * @public function getXcXoopsListImgListArray * @param $return * @param $var - * @param $t + * @param string $t * * @return string */ - public function getXcXoopsListImgListArray($return, $var, $t = '') + public function getXcXoopsListImgListArray($return, $var, string $t = '') { return "{$t}\${$return} = \XoopsLists::getImgListAsArray( {$var} );\n"; } @@ -1552,7 +1560,7 @@ public function getXcXoopsListImgListArray($return, $var, $t = '') * * @return string */ - public function getXcXoopsListLangList($return, $t = '') + public function getXcXoopsListLangList($return, string $t = '') { return "{$t}\${$return} = \XoopsLists::getLangList();\n"; } @@ -1564,7 +1572,7 @@ public function getXcXoopsListLangList($return, $t = '') * * @return string */ - public function getXcXoopsListCountryList($return, $t = '') + public function getXcXoopsListCountryList($return, string $t = '') { return "{$t}\${$return} = \XoopsLists::getCountryList();\n"; } @@ -1577,7 +1585,7 @@ public function getXcXoopsListCountryList($return, $t = '') * * @return string */ - public function getXcXoopsUserUnameFromId($left, $value, $t = '') + public function getXcXoopsUserUnameFromId($left, $value, string $t = '') { return "{$t}\${$left} = \XoopsUser::getUnameFromId({$value});\n"; } @@ -1587,12 +1595,12 @@ public function getXcXoopsUserUnameFromId($left, $value, $t = '') * * @param $tplString * @param $phpRender - * @param bool $leftIsString + * @param bool $leftIsString * @param string $t * @param string $tpl * @return string */ - public function getXcXoopsTplAssign($tplString, $phpRender, $leftIsString = true, $t = '', $tpl = '') + public function getXcXoopsTplAssign($tplString, $phpRender, bool $leftIsString = true, string $t = '', string $tpl = '') { $assign = "{$t}\$GLOBALS['xoopsTpl']->assign("; if ('' !== $tpl) { @@ -1617,7 +1625,7 @@ public function getXcXoopsTplAssign($tplString, $phpRender, $leftIsString = true * @param string $t * @return string */ - public function getXcXoopsTplAppend($tplString, $phpRender, $t = '') + public function getXcXoopsTplAppend($tplString, $phpRender, string $t = '') { return "{$t}\$GLOBALS['xoopsTpl']->append('{$tplString}', {$phpRender});\n"; } @@ -1631,7 +1639,7 @@ public function getXcXoopsTplAppend($tplString, $phpRender, $t = '') * @param string $t * @return string */ - public function getXcXoopsTplAppendByRef($tplString, $phpRender, $t = '') + public function getXcXoopsTplAppendByRef($tplString, $phpRender, string $t = '') { return "{$t}\$GLOBALS['xoopsTpl']->appendByRef('{$tplString}', {$phpRender});\n"; } @@ -1641,10 +1649,10 @@ public function getXcXoopsTplAppendByRef($tplString, $phpRender, $t = '') * * @param string $displayTpl * @param string $t - * @param bool $usedoublequotes + * @param bool $usedoublequotes * @return string */ - public function getXcXoopsTplDisplay($displayTpl = '{$templateMain}', $t = '', $usedoublequotes = true) + public function getXcXoopsTplDisplay(string $displayTpl = '{$templateMain}', string $t = '', bool $usedoublequotes = true) { if ($usedoublequotes) { return "{$t}\$GLOBALS['xoopsTpl']->display(\"db:{$displayTpl}\");\n"; @@ -1658,12 +1666,12 @@ public function getXcXoopsTplDisplay($displayTpl = '{$templateMain}', $t = '', $ * * @param $directory * @param $filename - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getXcXoopsPath($directory, $filename, $isParam = false, $t = '') + public function getXcXoopsPath($directory, $filename, bool $isParam = false, string $t = '') { if (!$isParam) { $ret = "{$t}\$GLOBALS['xoops']->path({$directory}.'/{$filename}.php');\n"; @@ -1679,12 +1687,12 @@ public function getXcXoopsPath($directory, $filename, $isParam = false, $t = '') * * @param $left * @param $string - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getXcXoopsModuleGetInfo($left, $string, $isParam = false, $t = '') + public function getXcXoopsModuleGetInfo($left, $string, bool $isParam = false, string $t = '') { if (!$isParam) { $ret = "{$t}\${$left} = \$GLOBALS['xoopsModule']->getInfo('{$string}');\n"; @@ -1700,10 +1708,10 @@ public function getXcXoopsModuleGetInfo($left, $string, $isParam = false, $t = ' * @param string $style * * @param string $t - * @param bool $isString + * @param bool $isString * @return string */ - public function getXcXoThemeAddStylesheet($style = 'style', $t = '', $isString = true) + public function getXcXoThemeAddStylesheet(string $style = 'style', string $t = '', bool $isString = true) { $ret = "{$t}\$GLOBALS['xoTheme']->addStylesheet("; if ($isString) { @@ -1716,17 +1724,17 @@ public function getXcXoThemeAddStylesheet($style = 'style', $t = '', $isString = /** * @public function getXcXoopsSecurityCheck - * @param $denial - * @return bool + * @param string $denial + * @return string */ - public function getXcXoopsSecurityCheck($denial = '') + public function getXcXoopsSecurityCheck(string $denial = '') { return "{$denial}\$GLOBALS['xoopsSecurity']->check()"; } /** * @public function getXcXoopsSecurityErrors - * @param null + * * @return string */ public function getXcXoopsSecurityErrors() @@ -1741,7 +1749,7 @@ public function getXcXoopsSecurityErrors() * @param string $n * @return string */ - public function getXcXoopsHandler($left, $t = '', $n = "\n") + public function getXcXoopsHandler($left, string $t = '', string $n = "\n") { return "{$t}\${$left}Handler = \xoops_getHandler('{$left}');{$n}"; } @@ -1756,15 +1764,19 @@ public function getXcXoopsHandler($left, $t = '', $n = "\n") * @param $tableName * @param $ccFieldId * @param string $t + * @param string $language * @return string */ - public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') + public function getXcCommonPagesEdit($tableName, $ccFieldId, string $t = '', string $language = '') { $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); + $tablenameObj = $pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, false, $t); $ret .= $xc->getXcEqualsOperator("\${$tableName}Obj->start", '$start', null, $t); $ret .= $xc->getXcEqualsOperator("\${$tableName}Obj->limit", '$limit', null, $t); $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); @@ -1779,7 +1791,7 @@ public function getXcCommonPagesEdit($tableName, $ccFieldId, $t = '') * @param string $t * @return string */ - public function getXcCommonPagesNew($tableName, $t = '') + public function getXcCommonPagesNew($tableName, string $t = '') { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1797,15 +1809,19 @@ public function getXcCommonPagesNew($tableName, $t = '') * @param $tableName * @param $ccFieldId * @param string $t + * @param string $language * @return string */ - public function getXcCommonPagesClone($tableName, $ccFieldId, $t = '') + public function getXcCommonPagesClone($tableName, $ccFieldId, string $t = '', string $language = '') { $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); + $tablenameObj = $pc->getPhpCodeIsobject($tableName . 'ObjSource'); + $redirectError = $xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, false, $t); $ret .= $xc->getXcEqualsOperator('$' . $tableName . 'Obj', '$' . $tableName . 'ObjSource->xoopsClone()', null, $t); $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); @@ -1822,10 +1838,10 @@ public function getXcCommonPagesClone($tableName, $ccFieldId, $t = '') * @param $fieldMain * @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) + public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, string $t = '', bool $admin = false) { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1835,6 +1851,9 @@ public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $f $ccFieldMain = $cf->getCamelCase($fieldMain, false, true); $ret = $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $tablenameObj = $pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, false, $t); $ret .= $xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t); $reqOk = "_REQUEST['ok']"; $isset = $pc->getPhpCodeIsset($reqOk); diff --git a/class/Files/Docs/DocsChangelog.php b/class/Files/Docs/DocsChangelog.php index 0ac46d81..458bfe55 100644 --- a/class/Files/Docs/DocsChangelog.php +++ b/class/Files/Docs/DocsChangelog.php @@ -33,7 +33,6 @@ class DocsChangelog extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -42,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return DocsChangelog */ public static function getInstance() @@ -68,8 +67,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Docs/DocsFiles.php b/class/Files/Docs/DocsFiles.php index 2648f8c7..82121ec0 100644 --- a/class/Files/Docs/DocsFiles.php +++ b/class/Files/Docs/DocsFiles.php @@ -33,7 +33,6 @@ class DocsFiles extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -42,10 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null - */ - - /** + * * @return DocsFiles */ public static function getInstance() @@ -60,11 +56,6 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $filename - */ - - /** * @param $module * @param $filename */ @@ -91,14 +82,12 @@ public function write($module, $filename): void public function getChangeLogFile($moduleDirname, $mod_version, $mod_author) { $date = date('Y/m/d G:i:s'); - $ret = <<getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); $tableFieldName = $table->getVar('table_fieldname'); + $language = '\_MA_' . strtoupper($moduleDirname) . '_'; + $fieldId = ''; $ccFieldId = ''; $ccFieldMain = ''; @@ -114,6 +115,9 @@ public function getCommentBody($module, $table) $func1 .= $this->xc->getXcHandlerLine($tableName, $t); $func1 .= $this->xc->getXcEqualsOperator("\${$ccFieldId}", '(int)$itemId', '', $t); $func1 .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $func1 .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, 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"); @@ -125,9 +129,13 @@ public function getCommentBody($module, $table) $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->getSimpleString('$' . $ccFieldId . " = (int)\$comment->getVar('com_itemid');", $t); $func2 .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $func2 .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, 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); @@ -146,8 +154,8 @@ public function getCommentBody($module, $table) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Includes/IncludeComments.php b/class/Files/Includes/IncludeComments.php index 12ef9880..c0e39a4f 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -42,7 +42,6 @@ class IncludeComments extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return IncludeComments */ public static function getInstance() @@ -68,8 +67,8 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param mixed $table + * @param $module + * @param mixed $table */ public function write($module, $table): void { @@ -79,12 +78,12 @@ public function write($module, $table): void /** * @public function getCommentsIncludes - * @param string $module + * @param $module * @param string $filename * - * @return bool|string + * @return string */ - public function renderCommentsIncludes($module, $filename) + public function renderCommentsIncludes($module, string $filename) { $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); @@ -98,12 +97,12 @@ public function renderCommentsIncludes($module, $filename) /** * @public function getCommentsNew - * @param string $module + * @param $module * @param string $filename * - * @return bool|string + * @return string */ - public function renderCommentsNew($module, $filename) + public function renderCommentsNew($module, string $filename) { $table = $this->getTable(); $moduleDirname = \mb_strtolower($module->getVar('mod_dirname')); diff --git a/class/Files/Includes/IncludeCommon.php b/class/Files/Includes/IncludeCommon.php index 221c208f..85a59b21 100644 --- a/class/Files/Includes/IncludeCommon.php +++ b/class/Files/Includes/IncludeCommon.php @@ -46,7 +46,6 @@ class IncludeCommon extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return IncludeCommon */ public static function getInstance() @@ -73,11 +72,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param object $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, object $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -102,9 +101,8 @@ private function getCommonDefines($modDirname, $const, $desc) * @param \XoopsObject $module * @return string */ - private function getCommonCode($module) + private function getCommonCode(\XoopsObject $module) { - $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); $stuModuleDirname = \mb_strtoupper($moduleDirname); $moduleAuthor = $module->getVar('mod_author'); @@ -113,10 +111,10 @@ 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); $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->getCommonDefines($moduleDirname, 'DIRNAME', "'{$moduleDirname}'"); + $ret .= $this->pc->getPhpCodeConditions("!\defined('XOOPS_ICONS32_URL')", '', '', $contIf); + $ret .= $this->getCommonDefines($moduleDirname, 'DIRNAME', "\basename(\dirname(__DIR__))"); $ret .= $this->getCommonDefines($moduleDirname, 'PATH', "\XOOPS_ROOT_PATH . '/modules/' . \\{$stuModuleDirname}_DIRNAME"); $ret .= $this->getCommonDefines($moduleDirname, 'URL', "\XOOPS_URL . '/modules/' . \\{$stuModuleDirname}_DIRNAME"); $ret .= $this->getCommonDefines($moduleDirname, 'ICONS_PATH', "\\{$stuModuleDirname}_PATH . '/assets/icons'"); @@ -126,13 +124,14 @@ private function getCommonCode($module) $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_PATH', "\XOOPS_UPLOAD_PATH . '/' . \\{$stuModuleDirname}_DIRNAME"); $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')); $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'"); @@ -155,8 +154,8 @@ private function getCommonCode($module) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Includes/IncludeFunctions.php b/class/Files/Includes/IncludeFunctions.php index f587980e..5dc303f7 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -42,7 +42,6 @@ class IncludeFunctions extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return IncludeFunctions */ public static function getInstance() @@ -84,7 +83,7 @@ public function write($module, $filename): void * * @return string */ - private function getFunctionBlock($moduleDirname) + private function getFunctionBlock(string $moduleDirname) { $t = "\t"; $ret = $this->pc->getPhpCodeCommentMultiLine(['function' => 'add selected cats to block', '' => '', '@param $cats' => '', '@return' => 'string']); @@ -107,7 +106,7 @@ private function getFunctionBlock($moduleDirname) * * @return string */ - private function getFunctionGetMyItemIds($moduleDirname) + private function getFunctionGetMyItemIds(string $moduleDirname) { $t = "\t"; $ret = $this->pc->getPhpCodeCommentMultiLine(['Get the permissions ids' => '', '' => '', '@param $permtype' => '', '@param $dirname' => '', '@return' => 'mixed $itemIds']); @@ -117,6 +116,10 @@ private function getFunctionGetMyItemIds($moduleDirname) $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); + $condIf = $this->getSimpleString('return [];', $t . "\t"); + $func .= $this->pc->getPhpCodeConditions("!\is_object(\${$moduleDirname}Module)", '', '', $condIf, false, $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); @@ -136,7 +139,7 @@ private function getFunctionGetMyItemIds($moduleDirname) * * @return string */ - private function getFunctionNumbersOfEntries($moduleDirname, $tableMid, $tableId, $tableName) + private function getFunctionNumbersOfEntries(string $moduleDirname, $tableMid, $tableId, $tableName) { $fields = $this->getTableFields($tableMid, $tableId); $fieldId = ''; @@ -146,7 +149,7 @@ private function getFunctionNumbersOfEntries($moduleDirname, $tableMid, $tableId $fieldId = $fieldName; // fieldMain = fields parameters main field } } - $ret = <<getHandler('{$tableName}'); \$lenght_id = \$helper->getConfig('lenght_id'); \$rewrite_url = \$helper->getConfig('rewrite_url'); @@ -342,22 +336,18 @@ function {$moduleDirname}_RewriteUrl(\$module, \$array, \$type = 'content') return null; } EOT; - - return $ret; } /** * @private function getRewriteFilter - * * @param string $moduleDirname - * @param string $tableName * * @return string */ - private function getRewriteFilter($moduleDirname, $tableName) + private function getRewriteFilter(string $moduleDirname) { $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 = \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; } /** * @public function render * - * @param null - * - * @return bool|string + * @return string */ public function render() { @@ -425,8 +410,8 @@ public function render() } $content .= $this->getFunctionMetaKeywords($moduleDirname); $content .= $this->getFunctionMetaDescription($moduleDirname); - $content .= $this->getRewriteUrl($moduleDirname, $tableName); - $content .= $this->getRewriteFilter($moduleDirname, $tableName); + $content .= $this->getRewriteUrl($moduleDirname); + $content .= $this->getRewriteFilter($moduleDirname); $this->create($moduleDirname, 'include', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Includes/IncludeJquery.php b/class/Files/Includes/IncludeJquery.php index d273139d..cd8d8a55 100644 --- a/class/Files/Includes/IncludeJquery.php +++ b/class/Files/Includes/IncludeJquery.php @@ -39,7 +39,6 @@ class IncludeJquery extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -48,7 +47,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return IncludeJquery */ public static function getInstance() @@ -63,10 +62,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,8 +73,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Includes/IncludeNotifications.php b/class/Files/Includes/IncludeNotifications.php index 9441b6f9..eee449f8 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -42,7 +42,6 @@ class IncludeNotifications extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return IncludeNotifications */ public static function getInstance() @@ -68,11 +67,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $tables * @param string $filename */ - public function write($module, $tables, $filename): void + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setTables($tables); @@ -85,7 +84,7 @@ public function write($module, $tables, $filename): void * * @return string */ - public function getNotificationsFunction($moduleDirname) + public function getNotificationsFunction(string $moduleDirname) { $stuModuleDirname = \mb_strtoupper($moduleDirname); $tables = $this->getTables(); @@ -97,6 +96,7 @@ public function getNotificationsFunction($moduleDirname) $func .= $this->pc->getPhpCodeConditions("!\defined('{$stuModuleDirname}_URL')", '', '', $contIf, false, $t); $func .= $this->pc->getPhpCodeBlankLine(); + $func .= $this->xc->getXcEqualsOperator("\$itemId", "(int)\$item_id", '', $t); $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"); @@ -130,14 +130,17 @@ 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('$sql ', "'SELECT {$fieldMain} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fieldId} = '. \$itemId", '', $t . "\t\t"); + $case[] = $this->xc->getXcEqualsOperator('$result', '$xoopsDB->query($sql)', '', $t . "\t\t"); + $condIf = $this->getSimpleString('return [];', $t . "\t\t\t"); + $case[] .= $this->pc->getPhpCodeConditions('!$result', '', '', $condIf, false, $t . "\t\t"); $case[] = $this->xc->getXcEqualsOperator('$result_array', '$xoopsDB->fetchArray($result)', '', $t . "\t\t"); + $case[] .= $this->pc->getPhpCodeConditions('!$result_array', '', '', $condIf, false, $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}=' . \$itemId", '', $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}=' . \$itemId", '', $t . "\t\t"); } $case[] = $this->getSimpleString('return $item;', $t . "\t\t"); @@ -158,8 +161,8 @@ public function getNotificationsFunction($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Includes/IncludeSearch.php b/class/Files/Includes/IncludeSearch.php index 723dd244..c9e6fbcc 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -46,7 +46,6 @@ class IncludeSearch extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return IncludeSearch */ public static function getInstance() @@ -73,11 +72,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $tables * @param string $filename */ - public function write($module, $tables, $filename): void + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -105,7 +104,6 @@ public function getSearchFunction($moduleDirname) $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); @@ -203,8 +201,8 @@ public function getSearchFunction($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Language/LanguageAdmin.php b/class/Files/Language/LanguageAdmin.php index 969ee6b7..1169b4ba 100644 --- a/class/Files/Language/LanguageAdmin.php +++ b/class/Files/Language/LanguageAdmin.php @@ -45,7 +45,6 @@ class LanguageAdmin extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return LanguageAdmin */ public static function getInstance() @@ -71,12 +70,12 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $table - * @param string $tables + * @param $tables * @param string $filename */ - public function write($module, $table, $tables, $filename): void + public function write($module, $table, $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -87,10 +86,10 @@ public function write($module, $table, $tables, $filename): void /** * @public function getLanguageAdminIndex * @param string $language - * @param array $tables + * @param array $tables * @return string */ - public function getLanguageAdminIndex($language, $tables) + public function getLanguageAdminIndex(string $language, array $tables) { $thereare = ''; $tableUser = 0; @@ -120,18 +119,18 @@ public function getLanguageAdminIndex($language, $tables) /** * @public function getLanguageAdminPages * @param string $language - * @param array $tables + * @param array $tables * @return string */ - public function getLanguageAdminPages($language, $tables) + public function getLanguageAdminPages(string $language, array $tables) { $ret = $this->ld->getAboveHeadDefines('Admin Files'); - $ret .= $this->ld->getAboveDefines('There aren\'t'); + $ret .= $this->ld->getAboveDefines('There are no'); foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $stuTableName = \mb_strtoupper($tableName); $stlTableName = \mb_strtolower($tableName); - $ret .= $this->ld->getDefine($language, "THEREARENT_{$stuTableName}", "There aren't {$stlTableName}", true); + $ret .= $this->ld->getDefine($language, "THEREARENO_{$stuTableName}", "There are no {$stlTableName}", true); } $ret .= $this->ld->getAboveDefines('Save/Delete'); $ret .= $this->ld->getDefine($language, 'FORM_OK', 'Successfully saved'); @@ -161,10 +160,10 @@ public function getLanguageAdminPages($language, $tables) /** * @public function getLanguageAdminClass * @param string $language - * @param array $tables + * @param array $tables * @return string */ - public function getLanguageAdminClass($language, $tables) + public function getLanguageAdminClass(string $language, array $tables) { $ret = $this->ld->getAboveHeadDefines('Admin Classes'); $fieldStatus = 0; @@ -237,6 +236,9 @@ public function getLanguageAdminClass($language, $tables) } } } + $ret .= $this->ld->getAboveDefines('Errors'); + $ret .= $this->ld->getDefine($language, 'INVALID_DATE', 'Invalid date'); + $ret .= $this->ld->getDefine($language, 'INVALID_PARAM', 'Invalid parameter'); $ret .= $this->ld->getAboveDefines('General'); $ret .= $this->ld->getDefine($language, 'FORM_UPLOAD', 'Upload file'); $ret .= $this->ld->getDefine($language, 'FORM_UPLOAD_NEW', 'Upload new file: '); @@ -248,10 +250,12 @@ public function getLanguageAdminClass($language, $tables) $ret .= $this->ld->getDefine($language, 'FORM_ACTION', 'Action'); $ret .= $this->ld->getDefine($language, 'FORM_EDIT', 'Modification'); $ret .= $this->ld->getDefine($language, 'FORM_DELETE', 'Clear'); + if ($fieldStatus > 0) { $ret .= $this->ld->getAboveDefines('Status'); $ret .= $this->ld->getDefine($language, 'STATUS_NONE', 'No status'); $ret .= $this->ld->getDefine($language, 'STATUS_OFFLINE', 'Offline'); + $ret .= $this->ld->getDefine($language, 'STATUS_ONLINE', 'Online'); $ret .= $this->ld->getDefine($language, 'STATUS_SUBMITTED', 'Submitted'); $ret .= $this->ld->getDefine($language, 'STATUS_APPROVED', 'Approved'); $ret .= $this->ld->getDefine($language, 'STATUS_BROKEN', 'Broken'); @@ -291,7 +295,7 @@ public function getLanguageAdminClass($language, $tables) * @param string $language * @return string */ - public function getLanguageAdminPermissions($language) + public function getLanguageAdminPermissions(string $language) { $ret = $this->ld->getAboveHeadDefines('Admin Permissions'); $ret .= $this->ld->getAboveDefines('Permissions'); @@ -316,7 +320,7 @@ public function getLanguageAdminPermissions($language) * @param string $language * @return string */ - public function getLanguageAdminFoot($language) + public function getLanguageAdminFoot(string $language) { $ret = $this->ld->getAboveHeadDefines('Admin Others'); $ret .= $this->ld->getDefine($language, 'ABOUT_MAKE_DONATION', 'Submit'); @@ -331,8 +335,8 @@ public function getLanguageAdminFoot($language) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Language/LanguageBlocks.php b/class/Files/Language/LanguageBlocks.php index b7721fec..5873e2ab 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -38,7 +38,6 @@ class LanguageBlocks extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -48,7 +47,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return LanguageBlocks */ public static function getInstance() @@ -63,11 +62,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $tables * @param string $filename */ - public function write($module, $tables, $filename): void + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -80,7 +79,7 @@ public function write($module, $tables, $filename): void * * @return string */ - private function getLanguageBlock($language) + private function getLanguageBlock(string $language) { $tables = $this->getTables(); $ret = $this->ld->getAboveDefines('Admin Edit'); @@ -119,7 +118,7 @@ private function getLanguageBlock($language) /** * @private function getFooter - * @param null + * * @return string */ private function getLanguageFooter() @@ -132,8 +131,8 @@ private function getLanguageFooter() /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Language/LanguageDefines.php b/class/Files/Language/LanguageDefines.php index a97d3248..ed15270f 100644 --- a/class/Files/Language/LanguageDefines.php +++ b/class/Files/Language/LanguageDefines.php @@ -32,7 +32,6 @@ class LanguageDefines { /** * @public function constructor - * @param null */ public function __construct() { @@ -40,7 +39,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return LanguageDefines */ public static function getInstance() @@ -58,7 +57,7 @@ public static function getInstance() * @param string $string * @return string */ - public function getAboveHeadDefines($string) + public function getAboveHeadDefines(string $string) { return "// ---------------- {$string} ----------------\n"; } @@ -68,7 +67,7 @@ public function getAboveHeadDefines($string) * @param string $string * @return string */ - public function getAboveDefines($string) + public function getAboveDefines(string $string) { return "// {$string}\n"; } @@ -78,10 +77,10 @@ public function getAboveDefines($string) * @param string $language * @param string $defined * @param string $description - * @param bool $usedoubleqoute + * @param bool $usedoubleqoute * @return string */ - public function getDefine($language, $defined, $description, $usedoubleqoute = false) + public function getDefine(string $language, string $defined, string $description, bool $usedoubleqoute = false) { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); @@ -102,7 +101,7 @@ public function getDefine($language, $defined, $description, $usedoubleqoute = f * * @return string */ - public function getBelowDefines($string) + public function getBelowDefines(string $string) { return "// ---------------- {$string} ----------------"; } diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 83f6a551..709ec765 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -34,21 +34,20 @@ class LanguageHelp extends Files\CreateFile /** * @var mixed */ - private $ld = null; + //private $ld = null; /** * @public function constructor - * @param null */ public function __construct() { parent::__construct(); - $this->ld = LanguageDefines::getInstance(); + //$this->ld = LanguageDefines::getInstance(); } /** * @static function getInstance - * @param null + * * @return LanguageHelp */ public static function getInstance() @@ -63,10 +62,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,8 +73,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Language/LanguageMailTpl.php b/class/Files/Language/LanguageMailTpl.php index baca80da..5bc18e34 100644 --- a/class/Files/Language/LanguageMailTpl.php +++ b/class/Files/Language/LanguageMailTpl.php @@ -33,7 +33,6 @@ class LanguageMailTpl extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -42,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return LanguageMailTpl */ public static function getInstance() @@ -348,7 +347,7 @@ public function getTemplateTableFooter($line) /** * @public function renderFile - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Language/LanguageMain.php b/class/Files/Language/LanguageMain.php index abb2c015..5bfae901 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -42,7 +42,6 @@ class LanguageMain extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return LanguageMain */ public static function getInstance() @@ -68,11 +67,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $tables * @param string $filename */ - public function write($module, $tables, $filename): void + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -81,22 +80,22 @@ public function write($module, $tables, $filename): void /** * @private function getLanguageMain - * @param string $module + * @param $module * @param string $language * * @return string */ - private function getLanguageMain($module, $language) + private function getLanguageMain($module, string $language) { $utility = new \XoopsModules\Modulebuilder\Utility(); - $moduleName = $module->getVar('mod_name'); $tables = $this->getTables(); $ret = $this->ld->getBlankLine(); $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'admin', true); $ret .= $this->ld->getBlankLine(); $ret .= $this->ld->getAboveHeadDefines('Main'); - $ret .= $this->ld->getDefine($language, 'INDEX', 'Overview ' . (string)$module->getVar('mod_name')); + $ret .= $this->ld->getDefine($language, 'HOME', 'Home'); + $ret .= $this->ld->getDefine($language, 'INDEX', 'Overview ' . $module->getVar('mod_name')); $ret .= $this->ld->getDefine($language, 'TITLE', (string)$module->getVar('mod_name')); $ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); $ret .= $this->ld->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); @@ -105,9 +104,6 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getDefine($language, 'BROKEN', 'Notify broken'); $ret .= $this->ld->getAboveHeadDefines('Contents'); $ucfTableName = ''; - $ucfTableSoleName = ''; - $stuTableSoleName = ''; - $tableSoleName = ''; $tableSubmit = 0; $tableBroken = 0; $tableRate = 0; @@ -170,7 +166,6 @@ private function getLanguageMain($module, $language) if (1 === $tableBroken) { $ret .= $this->ld->getDefine($language, 'FORM_SURE_BROKEN', "Are you sure to notify as broken: %s ", true); } - $ret .= $this->ld->getDefine($language, 'INVALID_PARAM', 'Invalid parameter'); } if (1 === $tableRate) { $ret .= $this->ld->getAboveHeadDefines('Ratings'); @@ -205,6 +200,9 @@ private function getLanguageMain($module, $language) $ret .= $this->ld->getAboveHeadDefines('Print'); $ret .= $this->ld->getDefine($language, 'PRINT', 'Print'); } + $ret .= $this->ld->getAboveDefines('Errors'); + $ret .= $this->ld->getDefine($language, 'INVALID_DATE', 'Invalid date'); + $ret .= $this->ld->getDefine($language, 'INVALID_PARAM', 'Invalid parameter'); return $ret; } @@ -215,7 +213,7 @@ private function getLanguageMain($module, $language) * * @return string */ - private function getLanguageMainFooter($language) + private function getLanguageMainFooter(string $language) { $ret = $this->ld->getAboveDefines('Admin link'); $ret .= $this->ld->getDefine($language, 'ADMIN', 'Admin'); @@ -227,8 +225,8 @@ private function getLanguageMainFooter($language) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Language/LanguageModinfo.php b/class/Files/Language/LanguageModinfo.php index 2b87dd1d..2ba32095 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -42,7 +42,6 @@ class LanguageModinfo extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return LanguageModinfo */ public static function getInstance() @@ -167,7 +166,7 @@ private function getLanguageAdmin($language) * * @return string */ - private function getLanguageSubmenu($language, $tables) + private function getLanguageSubmenu($language, array $tables) { $ret = $this->ld->getAboveDefines('Submenu'); $ret .= $this->ld->getDefine($language, 'SMNAME1', 'Index page'); @@ -203,7 +202,7 @@ private function getLanguageSubmenu($language, $tables) * * @return string */ - private function getLanguageBlocks($tables, $language) + private function getLanguageBlocks(array $tables, $language) { $ret = $this->ld->getAboveDefines('Blocks'); foreach (\array_keys($tables) as $i) { @@ -500,7 +499,7 @@ private function getLanguageRatingbars($language) /** * @private function getFooter - * @param null + * * @return string */ private function getLanguageFooter() @@ -513,8 +512,8 @@ private function getLanguageFooter() /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Sql/SqlFile.php b/class/Files/Sql/SqlFile.php index e14a2b83..78ca77f9 100644 --- a/class/Files/Sql/SqlFile.php +++ b/class/Files/Sql/SqlFile.php @@ -110,7 +110,7 @@ private function getHeaderSqlComments($moduleName) * * @return string */ - private function getHeadDatabaseTable($moduleDirname, $tableName, $fieldsNumb) + private function getHeadDatabaseTable($moduleDirname, $tableName, int $fieldsNumb) { $ret = null; $arrayDbTable = [ @@ -384,11 +384,11 @@ private function getFootDatabaseTable() * @param $fieldNull * @param $fieldDefault * @param $autoincrement - * @param $lenMax + * @param int $lenMax * * @return string */ - private function getFieldRow($fieldName, $fieldTypeValue, $fieldAttribute = null, $fieldNull = null, $fieldDefault = null, $autoincrement = null, $lenMax = 0) + private function getFieldRow($fieldName, $fieldTypeValue, $fieldAttribute = null, $fieldNull = null, $fieldDefault = null, $autoincrement = null, int $lenMax = 0) { $fieldNameMax = " `{$fieldName}`"; if ($lenMax > 0) { diff --git a/class/Files/Templates/Admin/TemplatesAdminAbout.php b/class/Files/Templates/Admin/TemplatesAdminAbout.php index b64abd21..62393ab4 100644 --- a/class/Files/Templates/Admin/TemplatesAdminAbout.php +++ b/class/Files/Templates/Admin/TemplatesAdminAbout.php @@ -42,7 +42,6 @@ class TemplatesAdminAbout extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -78,8 +77,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index fae01126..f1843fe0 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -42,7 +42,6 @@ class TemplatesAdminBroken extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return TemplatesAdminBroken */ public static function getInstance() @@ -68,7 +67,7 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $tables * @param $filename */ @@ -84,7 +83,7 @@ public function write($module, $tables, $filename): void * @param string $moduleDirname * @return string */ - private function getTemplatesAdminBrokenHeader($moduleDirname) + private function getTemplatesAdminBrokenHeader(string $moduleDirname) { $ret = $this->hc->getHtmlComment('Header', '', "\n"); $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); @@ -95,57 +94,51 @@ private function getTemplatesAdminBrokenHeader($moduleDirname) /** * @private function getTemplatesAdminBrokenTableThead * @param string $language - * @param $t * @return string */ - private function getTemplatesAdminBrokenTableThead($language, $t) + private function getTemplatesAdminBrokenTableThead(string $language) { $th = ''; $lang = $this->sc->getSmartyConst($language, 'BROKEN_TABLE'); - $th .= $this->hc->getHtmlTableHead($lang, 'center', '', $t . "\t\t"); + $th .= $this->hc->getHtmlTableHead($lang, 'center', '', "\t\t\t\t"); $lang = $this->sc->getSmartyConst($language, 'BROKEN_MAIN'); - $th .= $this->hc->getHtmlTableHead($lang, 'center', '', $t . "\t\t"); + $th .= $this->hc->getHtmlTableHead($lang, 'center', '', "\t\t\t\t"); $lang = $this->sc->getSmartyConst($language, 'FORM_ACTION'); - $th .= $this->hc->getHtmlTableHead($lang, 'center width5', '', $t . "\t\t"); - $tr = $this->hc->getHtmlTableRow($th, 'head', $t . "\t"); - $ret = $this->hc->getHtmlTableThead($tr, '', $t); - - return $ret; + $th .= $this->hc->getHtmlTableHead($lang, 'center width5', '', "\t\t\t\t"); + $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t" . "\t"); + return $this->hc->getHtmlTableThead($tr, '', "\t\t"); } /** * @private function getTemplatesAdminBrokenTableTBody * @param string $tableName * @param $tableSoleName - * @param $t * @return string * @internal param string $language */ - private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $t) + private function getTemplatesAdminBrokenTableTBody(string $tableName, $tableSoleName) { $td = ''; - $doubleKey = $this->sc->getSmartyDoubleVar($tableSoleName, 'key'); - $doubleVal = $this->sc->getSmartyDoubleVar($tableSoleName, 'keyval'); + $doubleKey = $this->sc->getSmartyDoubleVar($tableSoleName, 'key', '', '', "''|escape:'htmlattr'"); + $doubleVal = $this->sc->getSmartyDoubleVar($tableSoleName, 'keyval', '', '', "''|escape:'htmlattr'"); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'table'); - $td .= $this->hc->getHtmlTableData($double, 'center', '', $t . "\t\t"); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'main'); - $td .= $this->hc->getHtmlTableData($double, 'center', '', $t . "\t\t"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'table', '', '', "''|escape:'html'"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'main', '', '', "''|escape:'html'"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_EDIT'); $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'edit.png'"); $img = $this->hc->getHtmlImage($src, $tableName); - $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', $t . "\t\t\t", "\n"); + $anchor = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', "\t\t" . "\t\t\t", "\n"); $lang = $this->sc->getSmartyConst('', '_DELETE'); $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'delete.png'"); $img = $this->hc->getHtmlImage($src, $tableName); - $anchor .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', $t . "\t\t\t", "\n"); - $td .= $this->hc->getHtmlTableData($anchor, 'center width5', '', $t . "\t\t", "\n", true); + $anchor .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', "\t\t" . "\t\t\t", "\n"); + $td .= $this->hc->getHtmlTableData($anchor, 'center width5', '', "\t\t\t\t", "\n", true); $cycle = $this->sc->getSmartyNoSimbol('cycle values=\'odd, even\''); - $tr = $this->hc->getHtmlTableRow($td, $cycle, $t . "\t"); - $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '', '', $t . "\t"); - $tbody = $this->hc->getHtmlTableTbody($foreach, '', $t); - - return $tbody; + $tr = $this->hc->getHtmlTableRow($td, $cycle, "\t\t" . "\t"); + $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '', '', "\t\t" . "\t"); + return $this->hc->getHtmlTableTbody($foreach, '', "\t\t"); } /** @@ -155,13 +148,11 @@ private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $ * @param string $language * @return string */ - private function getTemplatesAdminBrokenTable($tableName, $tableSoleName, $language) + private function getTemplatesAdminBrokenTable(string $tableName, $tableSoleName, string $language) { - $tbody = $this->getTemplatesAdminBrokenTableThead($language, "\t\t"); - $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, "\t\t"); - $ret = $this->hc->getHtmlTable($tbody, 'table table-bordered', "\t"); - - return $ret; + $tbody = $this->getTemplatesAdminBrokenTableThead($language); + $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName); + return $this->hc->getHtmlTable($tbody, 'table table-bordered', "\t"); } /** @@ -171,28 +162,28 @@ private function getTemplatesAdminBrokenTable($tableName, $tableSoleName, $langu * @param string $t * @return string */ - private function getTemplatesAdminBrokenList($table, $language, $t = '') + private function getTemplatesAdminBrokenList($table, string $language, string $t = '') { $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); $ucfTableName = \ucfirst($tableName); $double = $this->sc->getSmartySingleVar($tableName . '_result'); - $ret = $this->hc->getHtmlHNumb($double, 3); + $ret = $this->hc->getHtmlHNumb($double, '3'); $htmlTable = $this->getTemplatesAdminBrokenTable($tableName, $tableSoleName, $language); $htmlTable .= $this->hc->getHtmlDiv(' ', 'clear', $t, "\n", false); - $single = $this->sc->getSmartySingleVar('pagenav'); + $single = $this->sc->getSmartySingleVar('pagenav_' . $tableName, '', '', ''); $div = $this->hc->getHtmlDiv($single, 'xo-pagenav floatright', $t . "\t", "\n", false); $div .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false); - $htmlTable .= $this->sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', $t); + $htmlTable .= $this->sc->getSmartyConditions('pagenav_' . $tableName, '', '', $div, '', '', '', $t); $noData = $this->sc->getSmartySingleVar('nodata' . $ucfTableName, $t . "\t\t"); $src = $this->sc->getSmartyNoSimbol("xoModuleIcons32 'button_ok.png'"); $noData .= $this->hc->getHtmlImage($src, $tableName, '', '', "\n"); - $div = $this->hc->getHtmlDiv($noData, '', $t . "\t", "\n", true); + $div = $this->hc->getHtmlDiv($noData, '', $t . "\t"); $div .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false); - $div .= $this->hc->getHtmlBr('2', '', $t . "\t"); + $div .= $this->hc->getHtmlBr(2, '', $t . "\t"); $contElse = $this->sc->getSmartyConditions('nodata' . $ucfTableName, '', '', $div, false, '', '', $t); $ret .= $this->sc->getSmartyConditions($tableName . '_count', '', '', $htmlTable, $contElse); - $ret .= $this->hc->getHtmlBr('3'); + $ret .= $this->hc->getHtmlBr(3); return $ret; } @@ -202,7 +193,7 @@ private function getTemplatesAdminBrokenList($table, $language, $t = '') * @param string $moduleDirname * @return string */ - private function getTemplatesAdminBrokenFooter($moduleDirname) + private function getTemplatesAdminBrokenFooter(string $moduleDirname) { $single = $this->sc->getSmartySingleVar('error'); $strong = $this->hc->getHtmlTag('strong', [], $single, false, '', ''); @@ -217,8 +208,8 @@ private function getTemplatesAdminBrokenFooter($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/Admin/TemplatesAdminFooter.php b/class/Files/Templates/Admin/TemplatesAdminFooter.php index e11b3cd0..b8b99325 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -42,7 +42,6 @@ class TemplatesAdminFooter extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -67,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -78,8 +77,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -91,11 +90,11 @@ public function render() $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); + $anchor = $this->hc->getHtmlTag('a', ['href' => 'https://xoops.org/', 'title' => 'Visit XOOPS', 'target' => '_blank', 'rel' => 'noopener noreferrer'], $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); + $tree .= $this->hc->getHtmlTag('a', ['href' => '<{$maintainedby|default:\'#\'|escape:\'htmlattr\'}>', '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 6945885d..c3894506 100644 --- a/class/Files/Templates/Admin/TemplatesAdminHeader.php +++ b/class/Files/Templates/Admin/TemplatesAdminHeader.php @@ -42,7 +42,6 @@ class TemplatesAdminHeader extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -67,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -78,8 +77,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/Admin/TemplatesAdminIndex.php b/class/Files/Templates/Admin/TemplatesAdminIndex.php index 88019bb5..c90934e7 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -42,7 +42,6 @@ class TemplatesAdminIndex extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -67,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -78,8 +77,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 36c562e8..2abace26 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -45,7 +45,6 @@ class TemplatesAdminPages extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return TemplatesAdminPages */ public static function getInstance() @@ -75,7 +74,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -87,7 +86,7 @@ public function write($module, $table, $filename): void * @param string $moduleDirname * @return string */ - private function getTemplatesAdminPagesHeader($moduleDirname) + private function getTemplatesAdminPagesHeader(string $moduleDirname) { $ret = $this->hc->getHtmlComment('Header', '',"\n"); $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); @@ -103,7 +102,7 @@ private function getTemplatesAdminPagesHeader($moduleDirname) * @param string $language * @return string */ - private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, array $fields, string $language) { $th = ''; $langHeadId = \mb_strtoupper($tableSoleName) . '_ID'; @@ -124,9 +123,7 @@ private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincr $lang = $this->sc->getSmartyConst($language, 'FORM_ACTION'); $th .= $this->hc->getHtmlTag('th', ['class' => 'center width5'], $lang, false, "\t\t\t\t"); $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t\t"); - $ret = $this->hc->getHtmlTableThead($tr, '', "\t\t"); - - return $ret; + return $this->hc->getHtmlTableThead($tr, '', "\t\t"); } /** @@ -139,7 +136,7 @@ private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincr * @return string * @internal param string $language */ - private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields) + private function getTemplatesAdminPagesTableTBody(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, array $fields) { $td = ''; if (1 == $tableAutoincrement) { @@ -158,7 +155,7 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t switch ($fieldElement) { case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_CHECKBOX: @@ -177,37 +174,34 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t break; case Constants::FIELD_ELE_IMAGELIST: $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); - $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true,'',''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_UPLOADIMAGE: - $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url','','',"''|escape:'htmlattr'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName,'','',"''|escape:'htmlattr'"); $img = $this->hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName, 'style' => 'max-width:100px'], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'status'); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'status', '', '', "''|escape:'html'"); $src = $this->sc->getSmartyNoSimbol('$modPathIcon16') . 'status' . $double . '.png'; - $imgAlt = $this->sc->getSmartyDoubleVar($tableSoleName, 'status_text'); + $imgAlt = $this->sc->getSmartyDoubleVar($tableSoleName, 'status_text', '', '', "''|escape:'html'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $imgAlt, 'title' => $imgAlt], '', true,'',''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_RADIOYN: case Constants::FIELD_ELE_SELECTUSER: case Constants::FIELD_ELE_DATETIME: - case Constants::FIELD_ELE_TEXTDATESELECT: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); - $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); - break; case Constants::FIELD_ELE_RADIO_ONOFFLINE: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + case Constants::FIELD_ELE_TEXTDATESELECT: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); break; default: if (0 != $f) { - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); } break; @@ -248,12 +242,12 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t * @param string $language * @return string */ - private function getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesAdminPagesTable(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, $fields, string $language) { $tbody = $this->getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language); $tbody .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields); - return $this->hc->getHtmlTable($tbody, 'table table-bordered', "\t"); + return $this->hc->getHtmlTable($tbody, 'outer', "\t"); } /** @@ -266,7 +260,7 @@ private function getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableS * @param string $language * @return string */ - private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesAdminPages(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, $fields, string $language) { $htmlTable = $this->getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language); $htmlTable .= $this->hc->getHtmlTag('div', ['class' => 'clear'], ' ', false, "\t"); @@ -291,7 +285,7 @@ private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleNa * @param string $moduleDirname * @return string */ - private function getTemplatesAdminPagesFooter($moduleDirname) + private function getTemplatesAdminPagesFooter(string $moduleDirname) { $ret = $this->hc->getHtmlComment('Footer', '', "\n"); $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); @@ -301,8 +295,8 @@ private function getTemplatesAdminPagesFooter($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/Admin/TemplatesAdminPermissions.php b/class/Files/Templates/Admin/TemplatesAdminPermissions.php index 030e97c4..06ca2611 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -42,7 +42,6 @@ class TemplatesAdminPermissions extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return TemplatesAdminPermissions */ public static function getInstance() @@ -68,7 +67,7 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $filename */ public function write($module, $filename): void @@ -83,22 +82,20 @@ public function write($module, $filename): void * * @return string */ - private function getTemplatesAdminPermissionsHeader($moduleDirname) + private function getTemplatesAdminPermissionsHeader(string $moduleDirname) { return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); } /** * @private function getTemplatesAdminPermissions - * @param null + * * @return string */ private function getTemplatesAdminPermissions() { $form = $this->sc->getSmartySingleVar('form'); - $ret = $this->hc->getHtmlTag('div', ['class' => 'spacer'], $form, '', '', "\n\n"); - - return $ret; + return $this->hc->getHtmlTag('div', ['class' => 'spacer'], $form, false, '', "\n\n"); } /** @@ -107,15 +104,15 @@ private function getTemplatesAdminPermissions() * * @return string */ - private function getTemplatesAdminPermissionsFooter($moduleDirname) + private function getTemplatesAdminPermissionsFooter(string $moduleDirname) { return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index 98072cc7..dccad169 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -45,7 +45,6 @@ class TemplatesBlocks extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return TemplatesBlocks */ public static function getInstance() @@ -71,11 +70,11 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $table + * @param $module + * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -90,7 +89,7 @@ public function write($module, $table, $filename): void * @param $tableAutoincrement * @return string */ - private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement) + private function getTemplatesBlocksTableThead($tableId, $tableMid, string $language, $tableAutoincrement) { $th = ''; if (1 == $tableAutoincrement) { @@ -105,6 +104,7 @@ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $t $th .= $this->hc->getHtmlTableHead($lang, 'center', '', "\t\t\t"); } } + $th .= $this->hc->getHtmlTableHead(' ', '', '', "\t\t\t"); $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t"); return $this->hc->getHtmlTableThead($tr, '', "\t"); @@ -121,7 +121,7 @@ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $t * @param $language * @return string */ - private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + private function getTemplatesBlocksTableTbody(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) { $td = ''; $fieldId = ''; @@ -148,19 +148,19 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi break; case Constants::FIELD_ELE_IMAGELIST: $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); - $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; case Constants::FIELD_ELE_UPLOADIMAGE: - $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $img = $this->hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -169,12 +169,12 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi case Constants::FIELD_ELE_SELECTUSER: case Constants::FIELD_ELE_DATETIME: case Constants::FIELD_ELE_TEXTDATESELECT: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); break; default: if (0 != $f) { - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); } break; @@ -195,8 +195,8 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi // $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'); - $single = $this->sc->getSmartySingleVar($moduleDirname . '_url'); + $lang = $this->sc->getSmartyConst($language, $stuTableSoleName . '_GOTO|escape:"htmlattr"'); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_url', '', '', "''|escape:'htmlattr'"); $anchor = $this->hc->getHtmlAnchor($single . '/' . $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"'); @@ -204,7 +204,7 @@ private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMi $foreach = $this->sc->getSmartyForeach($tableSoleName, 'block', $tr, '', '', "\t\t"); $tbody = $this->hc->getHtmlTableTbody($foreach, '', "\t"); - return $this->sc->getSmartyConditions('block|default:0', ' > ', '0', $tbody, false, true, true, "\t"); + return $this->sc->getSmartyConditions('block', ' > ', '0', $tbody, false, true, true, "\t"); } /** @@ -230,7 +230,7 @@ private function getTemplatesBlocksTableTfoot() * @param string $language * @return string */ - private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + private function getTemplatesBlocksTable(string $moduleDirname, $tableId, $tableMid, string $tableName, $tableSoleName, $tableAutoincrement, string $language) { $tbody = $this->getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement); $tbody .= $this->getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); @@ -242,9 +242,8 @@ private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $t /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php index 59ff5e3a..36a2d94b 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -47,7 +47,6 @@ class TemplatesBlocksSpotlight extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,8 +57,8 @@ public function __construct() /** * @static function getInstance - * @param null - * @return false|TemplatesBlocks|TemplatesBlocksSpotlight + * + * @return false|TemplatesBlocksSpotlight */ public static function getInstance() { @@ -73,11 +72,11 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $table + * @param $module + * @param $table * @param string $filename */ - public function write($module, $table, $filename) + public function write($module, $table, string $filename) { $this->setModule($module); $this->setTable($table); @@ -92,7 +91,7 @@ public function write($module, $table, $filename) * @param $tableAutoincrement * @return string */ - private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement) + private function getTemplatesBlocksTableThead($tableId, $tableMid, string $language, $tableAutoincrement) { $th = ''; if (1 == $tableAutoincrement) { @@ -107,6 +106,7 @@ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $t $th .= $this->hc->getHtmlTableHead($lang, 'center', '', "\t\t\t"); } } + $th .= $this->hc->getHtmlTableHead(' ', '', '', "\t\t\t"); $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t"); return $this->hc->getHtmlTableThead($tr, '', "\t"); @@ -123,7 +123,7 @@ private function getTemplatesBlocksTableThead($tableId, $tableMid, $language, $t * @param $language * @return string */ - private function getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + private function getTemplatesBlocksTableTbody(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) { $td = ''; $fieldId = ''; @@ -231,7 +231,7 @@ private function getTemplatesBlocksTableTfoot() * @param string $language * @return string */ - private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + private function getTemplatesBlocksTable(string $moduleDirname, $tableId, $tableMid, string $tableName, $tableSoleName, $tableAutoincrement, string $language) { $tbody = $this->getTemplatesBlocksTableThead($tableId, $tableMid, $language, $tableAutoincrement); $tbody .= $this->getTemplatesBlocksTableTbody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); @@ -243,9 +243,8 @@ private function getTemplatesBlocksTable($moduleDirname, $tableId, $tableMid, $t /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index 1ed30067..f101fec4 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -47,7 +47,6 @@ class Breadcrumbs extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -76,7 +75,7 @@ public static function getInstance() * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -84,22 +83,25 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $stuModuleDirname = \strtoupper($moduleDirname); - $title = $this->sc->getSmartyDoubleVar('itm', 'title'); - $titleElse = $this->sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n"); - $link = $this->sc->getSmartyDoubleVar('itm', 'link'); + $title = $this->sc->getSmartyDoubleVar('itm', 'title','','','""|escape:"html"'); + $title2 = $this->sc->getSmartyDoubleVar('itm', 'title','','','""|escape:"htmlattr"'); + $titleElse = $this->sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n", '""|escape:"html"'); + $link = $this->sc->getSmartyDoubleVar('itm', 'link','','','""|escape:"htmlattr"'); $glyph = $this->hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home fa fa-home'], '', false, '', ''); - $anchor = $this->hc->getHtmlAnchor("<{xoAppUrl 'index.php'}>", $glyph, 'home'); + $langHome = $this->sc->getSmartyConst('_MA_' . $stuModuleDirname, '_HOME'); + $anchor = $this->hc->getHtmlAnchor("<{xoAppUrl 'index.php'}>", $glyph, $langHome); $into = $this->hc->getHtmlLi($anchor, 'breadcrumb-item', "\t"); - $anchorIf = $this->hc->getHtmlAnchor($link, $title, $title, '', '', '', "\t\t\t", "\n"); + $anchorIf = $this->hc->getHtmlAnchor($link, $title, $title2, '', '', '', "\t\t\t", "\n"); $breadcrumb = $this->sc->getSmartyConditions('itm.link', '', '', $anchorIf, $titleElse, false, false, "\t\t"); $foreach = $this->hc->getHtmlLi($breadcrumb, 'breadcrumb-item', "\t", "\n", true); $into .= $this->sc->getSmartyForeach('itm', 'xoBreadcrumbs', $foreach, 'bcloop', '', "\t"); diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index 2fdb4b33..019156de 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -42,7 +42,6 @@ class Categories extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -71,7 +70,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -83,7 +82,7 @@ public function write($module, $table, $filename): void * @param string $moduleDirname * @return string */ - private function getTemplatesUserCategoriesHeader($moduleDirname) + private function getTemplatesUserCategoriesHeader(string $moduleDirname) { return $this->sc->getSmartyIncludeFile($moduleDirname) . PHP_EOL; } @@ -96,7 +95,7 @@ private function getTemplatesUserCategoriesHeader($moduleDirname) * @param $tableSoleName * @return string */ - private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) + private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, string $language) { $single = $this->sc->getSmartySingleVar('table_type'); $table = $this->getTemplatesAdminPagesTableThead($tableName, $language); @@ -111,7 +110,7 @@ private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $ta * @param $tableName * @return string */ - private function getTemplatesUserCategoriesThead($tableName, $language) + private function getTemplatesUserCategoriesThead($tableName, string $language) { $stuTableName = \mb_strtoupper($tableName); $lang = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE'); @@ -129,7 +128,7 @@ private function getTemplatesUserCategoriesThead($tableName, $language) * @param $tableSoleName * @return string */ - private function getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName) + private function getTemplatesUserCategoriesTbody(string $moduleDirname, $tableName, $tableSoleName) { $single = $this->sc->getSmartySingleVar('panel_type'); $include = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); @@ -179,7 +178,7 @@ private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSo * @param $language * @return string */ - private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language) + private function getTemplatesUserCategoriesPanel(string $moduleDirname, string $tableName, $tableSoleName, $language) { $stuTableName = \mb_strtoupper($tableName); $incl = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; @@ -200,14 +199,14 @@ private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $ta * * @return string */ - private function getTemplatesUserCategoriesFooter($moduleDirname) + private function getTemplatesUserCategoriesFooter(string $moduleDirname) { return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); } /** * @public function render - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php index 099f2244..6327fa9a 100644 --- a/class/Files/Templates/User/Defstyle/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -42,7 +42,6 @@ class CategoriesList extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -71,7 +70,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -84,12 +83,10 @@ public function write($module, $table, $filename): void */ private function getTemplatesUserCategoriesListStartTable() { - $ret = <<
    ' . $i . '' . $fieldName->render() . '
    \n EOT; - - return $ret; } /** @@ -126,11 +123,11 @@ private function getTemplatesUserCategoriesListThead($table) /** * @private function getTemplatesUserCategoriesListTbody * @param string $moduleDirname - * @param string $table + * @param $table * * @return string */ - private function getTemplatesUserCategoriesListTbody($moduleDirname, $table) + private function getTemplatesUserCategoriesListTbody(string $moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = << \n EOT; - - return $ret; } /** @@ -236,7 +230,7 @@ private function getTemplatesUserCategoriesListEndTable() * @param $tableSoleName * @return string */ - private function getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName) + private function getTemplatesUserCategoriesListPanel(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName) { $fields = $this->getTableFields($tableMid, $tableId); $ret = ''; @@ -286,7 +280,7 @@ private function getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $ /** * @public function render - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Footer.php b/class/Files/Templates/User/Defstyle/Footer.php index 4626891a..d76847d0 100644 --- a/class/Files/Templates/User/Defstyle/Footer.php +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -42,7 +42,6 @@ class Footer extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Footer */ public static function getInstance() @@ -72,7 +71,7 @@ public static function getInstance() * @param mixed $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -81,9 +80,8 @@ public function write($module, $table, $filename): void /** * @public function getTemplateUserFooterFacebookLikeButton - * @param null * - * @return bool|string + * @return string */ public function getTemplateUserFooterFacebookLikeButton() { @@ -92,9 +90,8 @@ public function getTemplateUserFooterFacebookLikeButton() /** * @public function getTemplateUserFooterFacebookShareButton - * @param null * - * @return bool|string + * @return string */ public function getTemplateUserFooterFacebookShareButton() { @@ -104,7 +101,7 @@ public function getTemplateUserFooterFacebookShareButton() /** * @public function render * @param $language - * @return bool|string + * @return string */ private function getTemplateUserFooterContent($language) { @@ -122,7 +119,7 @@ private function getTemplateUserFooterContent($language) $contIf .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>', "\t\t"); $contIf .= $this->sc->getSmartyIncludeFile('system_comments', 'nest', 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); + $contIf = $this->hc->getHtmlDiv($contDiv, 'pad2 marg2', "\t"); $ret .= $this->sc->getSmartyConditions('comment_mode', '', '', $contIf); $ret .= $this->sc->getSmartyIncludeFile('system_notification', 'select'); @@ -131,8 +128,8 @@ private function getTemplateUserFooterContent($language) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Header.php b/class/Files/Templates/User/Defstyle/Header.php index 9b579847..9249b6ff 100644 --- a/class/Files/Templates/User/Defstyle/Header.php +++ b/class/Files/Templates/User/Defstyle/Header.php @@ -46,7 +46,6 @@ class Header extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Header */ public static function getInstance() @@ -76,7 +75,7 @@ public static function getInstance() * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -85,7 +84,7 @@ public function write($module, $filename): void /** * @public function getTemplatesUserHeader * @param $moduleDirname - * @return bool|string + * @return string */ public function getTemplatesUserHeader($moduleDirname) { @@ -101,13 +100,12 @@ public function getTemplatesUserHeader($moduleDirname) /** * @public function getTemplateFooterFacebbokSDK - * @param null * - * @return bool|string + * @return string */ public function getTemplateUserHeaderFacebbokSDK() { - $ret = <<<'EOT' + return <<<'EOT'
    EOT; - - return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Index.php b/class/Files/Templates/User/Defstyle/Index.php index 3830516b..cd0fb890 100644 --- a/class/Files/Templates/User/Defstyle/Index.php +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -42,7 +42,6 @@ class Index extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Index */ public static function getInstance() @@ -84,18 +83,18 @@ public function write($module, $table, $tables, $filename): void /** * @public function getTemplateUserIndexHeader * @param $moduleDirname - * @return bool|string + * @return string */ public function getTemplateUserIndexHeader($moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false); + return $this->sc->getSmartyIncludeFile($moduleDirname); } /** * @public function getTemplatesUserIndexBodyDefault * @param $module * @param $language - * @return bool|string + * @return string */ public function getTemplatesUserIndexIntro($module, $language) { @@ -145,9 +144,9 @@ public function getTemplatesUserIndexIntro($module, $language) * @param $tableSoleName * @param $language * @param string $t - * @return bool|string + * @return string */ - public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language, $t = '') + public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language, string $t = '') { $double = $this->sc->getSmartyConst($language, 'INDEX_LATEST_LIST'); $ret = $this->hc->getHtmlDiv($double, "{$moduleDirname}-linetitle", $t, "\n", false); @@ -170,7 +169,7 @@ public function getTemplateUserIndexTable($moduleDirname, $tableName, $tableSole /** * @public function getTemplateUserIndexFooter * @param $moduleDirname - * @return bool|string + * @return string */ public function getTemplateUserIndexFooter($moduleDirname) { @@ -179,8 +178,8 @@ public function getTemplateUserIndexFooter($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php index 2aba6ea2..0e03b7ad 100644 --- a/class/Files/Templates/User/Defstyle/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -36,7 +36,6 @@ class MoreFiles extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -45,7 +44,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Morefiles */ public static function getInstance() @@ -65,7 +64,7 @@ public static function getInstance() * @param $folder * @param $extension */ - public function write($module, $folder, $filename, $extension): void + public function write($module, $folder, string $filename, $extension): void { $this->setModule($module); $this->setFileName($filename); @@ -75,25 +74,22 @@ public function write($module, $folder, $filename, $extension): void /** * @private function getTemplatesUserMoreFile - * @param null * * @return string */ private function getTemplatesUserMoreFile() { - $ret = <<<'EOT' + return <<<'EOT'
    Pleace! Enter here your template code here
    EOT; - - return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Pages.php b/class/Files/Templates/User/Defstyle/Pages.php index e35239d3..dd121013 100644 --- a/class/Files/Templates/User/Defstyle/Pages.php +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -42,7 +42,6 @@ class Pages extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -53,7 +52,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Pages */ public static function getInstance() @@ -72,7 +71,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -84,9 +83,9 @@ public function write($module, $table, $filename): void * @param string $moduleDirname * @return string */ - private function getTemplatesUserPagesHeader($moduleDirname) + private function getTemplatesUserPagesHeader(string $moduleDirname) { - return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', '','',"\n\n"); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false,'',"\n\n"); } /** @@ -97,7 +96,7 @@ private function getTemplatesUserPagesHeader($moduleDirname) * @param string $language * @return string */ - private function getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language) + private function getTemplatesUserPagesTable(string $moduleDirname, string $tableName, $tableSoleName, string $language) { $tbody = $this->getTemplatesUserPagesTableThead($tableName, $language); $tbody .= $this->getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName); @@ -113,7 +112,7 @@ private function getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSo * @param $tableName * @return string */ - private function getTemplatesUserPagesTableThead($tableName, $language) + private function getTemplatesUserPagesTableThead($tableName, string $language) { $stuTableName = \mb_strtoupper($tableName); $single = $this->sc->getSmartySingleVar('divideby'); @@ -131,7 +130,7 @@ private function getTemplatesUserPagesTableThead($tableName, $language) * @param $tableSoleName * @return string */ - private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName) + private function getTemplatesUserPagesTableTbody(string $moduleDirname, $tableName, $tableSoleName) { $single = $this->sc->getSmartySingleVar('panel_type'); $include = $this->sc->getSmartyIncludeFile($moduleDirname, $tableName . '_item', false, "\t\t\t\t\t\t", "\n", $tableSoleName . '=$' . $tableSoleName); @@ -147,7 +146,7 @@ private function getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $ta /** * @private function getTemplatesUserPagesTfoot - * @param null + * * @return string */ private function getTemplatesUserPagesTableTfoot() @@ -176,24 +175,22 @@ private function getTemplatesUserPages($moduleDirname, $tableName, $tableSoleNam /** * @private function getTemplatesUserPagesForm - * @param string $t * @return string */ - private function getTemplatesUserPagesForm($t = "\t") + private function getTemplatesUserPagesForm() { - $var = $this->sc->getSmartySingleVar('form', $t, "\n"); + $var = $this->sc->getSmartySingleVar('form', "\t", "\n"); return $this->sc->getSmartyConditions('form', '', '', $var, false, false, true); } /** * @private function getTemplatesUserPagesError - * @param string $t * @return string */ - private function getTemplatesUserPagesError($t = "\t") + private function getTemplatesUserPagesError() { - $var = $this->sc->getSmartySingleVar('error', $t, "\n"); + $var = $this->sc->getSmartySingleVar('error', "\t", "\n"); return $this->sc->getSmartyConditions('error', '', '', $var, false, false, true); } @@ -204,7 +201,7 @@ private function getTemplatesUserPagesError($t = "\t") * * @return string */ - private function getTemplatesUserPagesFooter($moduleDirname) + private function getTemplatesUserPagesFooter(string $moduleDirname) { $ret = $this->hc->getHtmlEmpty('', '', "\n"); $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); @@ -214,9 +211,8 @@ private function getTemplatesUserPagesFooter($moduleDirname) /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index f0197d4d..dbddf88b 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -45,7 +45,6 @@ class PagesItem extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return PagesItem */ public static function getInstance() @@ -76,7 +75,7 @@ public static function getInstance() * @param string $filename * @param $tables */ - public function write($module, $table, $tables, $filename): void + public function write($module, $table, $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -96,7 +95,7 @@ public function write($module, $table, $tables, $filename): void * @param $language * @return string */ - private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableRate, $tableBroken, $language) + private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableRate, $tableBroken, $language) { $fields = $this->getTableFields($tableMid, $tableId); $ret = ''; @@ -117,14 +116,14 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table default: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -134,14 +133,14 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table case Constants::FIELD_ELE_TEXTDATESELECT: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); unset($img); @@ -149,8 +148,8 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table case Constants::FIELD_ELE_UPLOADIMAGE: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); unset($img); @@ -170,14 +169,14 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table default: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -187,14 +186,14 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table case Constants::FIELD_ELE_TEXTDATESELECT: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify', "\t"); unset($img); @@ -202,8 +201,8 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table case Constants::FIELD_ELE_UPLOADIMAGE: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify',"\t"); unset($img); @@ -225,7 +224,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); break; case Constants::FIELD_ELE_TEXTAREA: @@ -234,7 +233,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -246,25 +245,25 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text'); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - $retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify', "\t"); + //$retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify', "\t"); unset($img); break; case Constants::FIELD_ELE_UPLOADIMAGE: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); - $retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); + //$retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); unset($img); break; } @@ -290,7 +289,7 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table $anchors .= $this->hc->getHtmlAnchor($tableName . ".php?op=broken&{$fieldId}=" . $keyDouble . '&start=<{$start|default:0}>&limit=<{$limit|default:0}>', $lang, $lang, '', 'btn btn-warning right', '', "\t\t", "\n"); } $retFoot .= $this->hc->getHtmlDiv($anchors, 'col-sm-12 right',"\t"); - $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); + $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-footer'); if ($tableRate) { $rate = $this->sc->getSmartyIncludeFile($moduleDirname, 'rate', false, "\t", "\n", 'item=$' . $tableSoleName); $ret .= $this->sc->getSmartyConditions('rating', '', '', $rate, false, false, false, '', "\n", true, 'bool'); @@ -301,8 +300,8 @@ private function getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $table /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index 1bfe3403..fc818059 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -45,7 +45,6 @@ class PagesList extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return PagesList */ public static function getInstance() @@ -76,7 +75,7 @@ public static function getInstance() * @param string $filename * @param $tables */ - public function write($module, $table, $tables, $filename): void + public function write($module, $table, $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -94,7 +93,7 @@ public function write($module, $table, $tables, $filename): void * @param $language * @return string */ - private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) + private function getTemplatesUserPagesListPanel(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) { $fields = $this->getTableFields($tableMid, $tableId); $ret = ''; @@ -278,8 +277,8 @@ private function getTemplatesUserPagesListPanel($moduleDirname, $tableId, $table /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Pdf.php b/class/Files/Templates/User/Defstyle/Pdf.php index 60260c75..5ef1b5ee 100644 --- a/class/Files/Templates/User/Defstyle/Pdf.php +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -45,7 +45,6 @@ class Pdf extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Pdf */ public static function getInstance() @@ -93,7 +92,7 @@ public function write($module, $table, $filename): void * @param $language * @return string */ - private function getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) + private function getTemplatesUserPdfBody(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) { $fields = $this->getTableFields($tableMid, $tableId); $ret = ''; @@ -152,8 +151,8 @@ private function getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $t /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php index b5c69ec8..5c2a716a 100644 --- a/class/Files/Templates/User/Defstyle/Rate.php +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -36,7 +36,6 @@ class Rate extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -45,7 +44,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return Rate */ public static function getInstance() @@ -64,7 +62,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -74,12 +72,12 @@ public function write($module, $table, $filename): void /** * @private function getTemplatesUserRateHeader * @param string $moduleDirname - * @param string $table + * @param $table * @param string $language * * @return string */ - private function getTemplatesUserRateHeader($moduleDirname, $table, $language) + private function getTemplatesUserRateHeader(string $moduleDirname, $table, string $language) { $ret = << @@ -108,11 +106,11 @@ private function getTemplatesUserRateHeader($moduleDirname, $table, $language) /** * @private function getTemplatesUserRateBody * @param string $moduleDirname - * @param string $table + * @param $table * * @return string */ - private function getTemplatesUserRateBody($moduleDirname, $table) + private function getTemplatesUserRateBody(string $moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = <<getVar('table_name'); $ret = << EOT; - - return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Rss.php b/class/Files/Templates/User/Defstyle/Rss.php index bd2b08e2..a83de0bf 100644 --- a/class/Files/Templates/User/Defstyle/Rss.php +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -33,7 +33,6 @@ class Rss extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -42,7 +41,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return Rss */ public static function getInstance() @@ -60,7 +58,7 @@ public static function getInstance() * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -68,54 +66,50 @@ public function write($module, $filename): void /** * @private function getTemplatesUserRssXml - * @param null * @return string */ private function getTemplatesUserRssXml() { - $ret = << - <{\$channel_title}> - <{\$channel_link}> - <{\$channel_desc}> - <{\$channel_lastbuild}> - https://backend.userland.com/rss/ - <{\$channel_generator}> - <{\$channel_category}> - <{\$channel_editor}> - <{\$channel_webmaster}> - <{\$channel_language}> + <{\$channel_title|escape:'html':'UTF-8'}> + <{\$channel_link|escape:'html':'UTF-8'}> + <{\$channel_desc|escape:'html':'UTF-8'}> + <{\$channel_lastbuild|escape:'html':'UTF-8'}> + <{\$docs|escape:'html':'UTF-8'}> + <{\$channel_generator|escape:'html':'UTF-8'}> + <{\$channel_category|escape:'html':'UTF-8'}> + <{\$channel_editor|escape:'html':'UTF-8'}> + <{\$channel_webmaster|escape:'html':'UTF-8'}> + <{\$channel_language|escape:'html':'UTF-8'}> <{if \$image_url != ""}> - <{\$channel_title}> - <{\$image_url}> - <{\$channel_link}> + <{\$channel_title|escape:'html':'UTF-8'}> + <{\$image_url|escape:'html':'UTF-8'}> + <{\$channel_link|escape:'html':'UTF-8'}> <{\$image_width}> <{\$image_height}> <{/if}> <{foreach item=item from=\$items}> - <{\$item.title}> - <{\$item.link}> - <{\$item.description}> - <{\$item.pubdate}> - <{\$item.guid}> + <{\$item.title|escape:'html':'UTF-8'}> + <{\$item.link|escape:'html':'UTF-8'}> + <{\$item.description|escape:'html':'UTF-8'}> + <{\$item.pubdate|escape:'html':'UTF-8'}> + <{\$item.guid|escape:'html':'UTF-8'}> <{/foreach}> \n EOT; - - return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/Search.php b/class/Files/Templates/User/Defstyle/Search.php index d83e8add..d7d78ae1 100644 --- a/class/Files/Templates/User/Defstyle/Search.php +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -33,7 +33,6 @@ class Search extends Files\CreateFile { /** * @public function constructor - * @param null */ public function __construct() { @@ -42,7 +41,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return Search */ public static function getInstance() @@ -61,7 +59,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -71,12 +69,12 @@ public function write($module, $table, $filename): void /** * @private function getTemplatesUserSearchHeader * @param string $moduleDirname - * @param string $table + * @param $table * @param string $language * * @return string */ - private function getTemplatesUserSearchHeader($moduleDirname, $table, $language) + private function getTemplatesUserSearchHeader(string $moduleDirname, $table, string $language) { $ret = << @@ -105,11 +103,11 @@ private function getTemplatesUserSearchHeader($moduleDirname, $table, $language) /** * @private function getTemplatesUserSearchBody * @param string $moduleDirname - * @param string $table + * @param $table * * @return string */ - private function getTemplatesUserSearchBody($moduleDirname, $table) + private function getTemplatesUserSearchBody(string $moduleDirname, $table) { $tableName = $table->getVar('table_name'); $ret = <<getVar('table_name'); $ret = << EOT; - - return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/Templates/User/Defstyle/UserPrint.php b/class/Files/Templates/User/Defstyle/UserPrint.php index deb80c91..17a08323 100644 --- a/class/Files/Templates/User/Defstyle/UserPrint.php +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -45,7 +45,6 @@ class UserPrint extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -56,7 +55,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserPrint */ public static function getInstance() @@ -75,7 +73,7 @@ public static function getInstance() * @param $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -87,7 +85,7 @@ public function write($module, $table, $filename): void * @param string $moduleDirname * @return string */ - private function getTemplatesUserPrintHeader($moduleDirname) + private function getTemplatesUserPrintHeader(string $moduleDirname) { $ret = $this->hc->getHtmlComment('Header', '', "\n"); $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, '', "\n\n"); @@ -99,11 +97,11 @@ private function getTemplatesUserPrintHeader($moduleDirname) * @private function getTemplatesUserPrintTableThead * @param $tableSoleName * @param $tableAutoincrement - * @param array $fields + * @param array $fields * @param string $language * @return string */ - private function getTemplatesUserPrintTableThead($tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesUserPrintTableThead($tableSoleName, $tableAutoincrement, array $fields, string $language) { $th = ''; $langHeadId = \mb_strtoupper($tableSoleName) . '_ID'; @@ -122,9 +120,7 @@ private function getTemplatesUserPrintTableThead($tableSoleName, $tableAutoincre } $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t"); - $ret = $this->hc->getHtmlTableThead($tr, '', "\t"); - - return $ret; + return $this->hc->getHtmlTableThead($tr, '', "\t"); } /** @@ -133,11 +129,11 @@ private function getTemplatesUserPrintTableThead($tableSoleName, $tableAutoincre * @param string $tableName * @param $tableSoleName * @param $tableAutoincrement - * @param array $fields + * @param array $fields * @return string * @internal param string $language */ - private function getTemplatesUserPrintTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields) + private function getTemplatesUserPrintTableTBody(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, array $fields) { $td = ''; if (1 == $tableAutoincrement) { @@ -207,9 +203,7 @@ private function getTemplatesUserPrintTableTBody($moduleDirname, $tableName, $ta $cycle = $this->sc->getSmartyNoSimbol('cycle values=\'odd, even\''); $tr = $this->hc->getHtmlTableRow($td, $cycle, "\t\t"); $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '', '', "\t\t"); - $tbody = $this->hc->getHtmlTableTbody($foreach, '', "\t"); - - return $tbody; + return $this->hc->getHtmlTableTbody($foreach, '', "\t"); } /** @@ -222,7 +216,7 @@ private function getTemplatesUserPrintTableTBody($moduleDirname, $tableName, $ta * @param string $language * @return string */ - private function getTemplatesUserPrintTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesUserPrintTable(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, $fields, string $language) { $tbody = $this->getTemplatesUserPrintTableThead($tableSoleName, $tableAutoincrement, $fields, $language); $tbody .= $this->getTemplatesUserPrintTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields); @@ -240,11 +234,9 @@ private function getTemplatesUserPrintTable($moduleDirname, $tableName, $tableSo * @param string $language * @return string */ - private function getTemplatesUserPrint($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesUserPrint(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, $fields, string $language) { - $htmlTable = $this->getTemplatesUserPrintTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language); - - return $htmlTable; + return $this->getTemplatesUserPrintTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language); } /** @@ -252,18 +244,17 @@ private function getTemplatesUserPrint($moduleDirname, $tableName, $tableSoleNam * @param string $moduleDirname * @return string */ - private function getTemplatesUserPrintFooter($moduleDirname) + private function getTemplatesUserPrintFooter(string $moduleDirname) { $ret = $this->hc->getHtmlComment('Footer', '', "\n"); - $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', false); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserFooter.php b/class/Files/User/UserFooter.php index 15e76361..1532ebce 100644 --- a/class/Files/User/UserFooter.php +++ b/class/Files/User/UserFooter.php @@ -46,7 +46,6 @@ class UserFooter extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserFooter */ public static function getInstance() @@ -73,10 +71,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -103,7 +101,7 @@ private function getUserFooter($moduleDirname, $language) $ret .= $this->xc->getXcXoopsTplAssign('admin', "\\{$stuModuleDirname}_ADMIN"); $ret .= $this->xc->getXcXoopsTplAssign('copyright', '$copyright'); $ret .= $this->pc->getPhpCodeCommentLine('Meta description'); - $ret .= $this->uxc->getUserMetaDesc($moduleDirname, $language); + $ret .= $this->uxc->getUserMetaDesc($moduleDirname); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Paths'); $ret .= $this->xc->getXcXoopsTplAssign('xoops_mpageurl', "\\{$stuModuleDirname}_URL.'/index.php'"); @@ -118,8 +116,7 @@ private function getUserFooter($moduleDirname, $language) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserHeader.php b/class/Files/User/UserHeader.php index e52d2932..da25d5e1 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -31,10 +31,6 @@ */ class UserHeader extends Files\CreateFile { - /** - * @var mixed - */ - private $uxc = null; /** * @var mixed */ @@ -46,19 +42,16 @@ class UserHeader extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { parent::__construct(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserHeader */ public static function getInstance() @@ -73,12 +66,12 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param array $tables * @param string $filename */ - public function write($module, $table, $tables, $filename): void + public function write($module, $table, array $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -142,8 +135,7 @@ private function getUserHeader($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index 64dd9b4a..f5cc860f 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -46,7 +46,6 @@ class UserIndex extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserIndex */ public static function getInstance() @@ -73,11 +71,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $table * @param string $filename */ - public function write($module, $table, $filename) + public function write($module, $table, string $filename) { $this->setModule($module); $this->setTable($table); @@ -93,8 +91,6 @@ public function write($module, $table, $filename) */ private function getUserIndexHeader($language, $moduleDirname) { - $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->getRequire(); $ret .= $this->uxc->getUserTplMain($moduleDirname); $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'header', true); @@ -130,7 +126,7 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS $ret .= $this->pc->getPhpCodeCommentLine('If there are ', $tableName); $ret .= $this->getSimpleString('$count = 1;'); - $contentIf = $this->xc->getXcHandlerAllObj($tableName, '', 0, 0, "\t"); + $contentIf = $this->xc->getXcHandlerAllObj($tableName, '', '0', '0', "\t"); $contentIf .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/tree', true, false, 'require', "\t"); //$contentIf .= $cc->getClassXoopsObjectTree('mytree', $tableName, $fieldId, $fieldParent, "\t"); $contentIf .= $this->pc->getPhpCodeArray($tableName, "\t"); @@ -143,7 +139,7 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS $contentIf .= $this->pc->getPhpCodeUnset($tableName, "\t"); $getConfig = $this->xc->getXcGetConfig('numb_col'); $contentIf .= $this->xc->getXcXoopsTplAssign('numb_col', $getConfig, true, "\t"); - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contentIf, false); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contentIf); $ret .= $this->pc->getPhpCodeUnset('count'); } unset($fieldParentId); @@ -154,15 +150,15 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS /** * @private function getBodyPagesIndex * @param $tableName - * @param $tableSoleName * @param $language + * @param $tableMid + * @param $tableId * @return string */ - private function getBodyPagesIndex($tableName, $tableSoleName, $language) + private function getBodyPagesIndex($tableName, $language, $tableMid, $tableId) { $ucfTableName = \ucfirst($tableName); - $table = $this->getTable(); - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fields = $this->getTableFields($tableMid, $tableId); $ret = $this->pc->getPhpCodeCommentLine('Tables'); $ret .= $this->xc->getXcHandlerCountObj($tableName); @@ -174,7 +170,7 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) $condIf .= $this->xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', "\t"); $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, "\t"); $condIf .= $this->pc->getPhpCodeArray($tableName . '_list', null, false, "\t"); - $foreach = $this->xc->getXcGetValues($tableName, $tableSoleName . '_list[]', 'i', false, "\t\t"); + $foreach = $this->xc->getXcGetValues($tableName, $tableName . '_list[]', 'i', false, "\t\t"); //$foreach .= $this->pc->getPhpCodeArray('acount', ["'count'", '$count']); //$foreach .= $this->pc->getPhpCodeArrayType($tableName . '_list', 'merge', $tableSoleName . '_list', '$acount'); // Fields @@ -208,10 +204,10 @@ private function getBodyPagesIndex($tableName, $tableSoleName, $language) /** * @private function getUserPagesFooter * @param $moduleDirname - * @param $language + * * @return string */ - private function getUserIndexFooter($moduleDirname, $language) + private function getUserIndexFooter($moduleDirname) { $ret = $this->pc->getPhpCodeCommentLine('Meta keywords'); $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); @@ -223,8 +219,7 @@ private function getUserIndexFooter($moduleDirname, $language) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -252,10 +247,10 @@ public function render() $content .= $this->getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableSoleName, $tableFieldname); } if (0 == $tableCategory && 1 == $tableIndex) { - $content .= $this->getBodyPagesIndex($tableName, $tableSoleName, $language); + $content .= $this->getBodyPagesIndex($tableName, $language, $tableMid, $tableId); } } - $content .= $this->getUserIndexFooter($moduleDirname, $language); + $content .= $this->getUserIndexFooter($moduleDirname); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/User/UserListTag.php b/class/Files/User/UserListTag.php index abd98e55..d88699a3 100644 --- a/class/Files/User/UserListTag.php +++ b/class/Files/User/UserListTag.php @@ -38,7 +38,6 @@ class UserListTag extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -48,7 +47,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserListTag */ public static function getInstance() @@ -63,10 +61,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,7 +72,6 @@ public function write($module, $filename): void /** * @public function getUserListTag - * @param null * @return string */ public function getUserListTag() @@ -87,8 +84,7 @@ public function getUserListTag() /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserNotificationUpdate.php b/class/Files/User/UserNotificationUpdate.php index 5a34ef8b..a494d813 100644 --- a/class/Files/User/UserNotificationUpdate.php +++ b/class/Files/User/UserNotificationUpdate.php @@ -38,7 +38,6 @@ class UserNotificationUpdate extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -48,7 +47,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserNotificationUpdate */ public static function getInstance() @@ -63,10 +61,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,8 +72,7 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index aae5e3ef..2449c596 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -49,7 +49,6 @@ class UserPages extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -61,7 +60,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserPages */ public static function getInstance() @@ -98,7 +96,6 @@ public function write($module, $table, $filename) */ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $tablePermissions, $language) { - $stuModuleDirname = \mb_strtoupper($moduleDirname); $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); @@ -160,7 +157,7 @@ private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $table * @param string $t * @return string */ - private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language, $t = '') + private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language, string $t = '') { $ucfTableName = \ucfirst($tableName); $stuTableName = \mb_strtoupper($tableName); @@ -169,8 +166,7 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $ccFieldReads = $this->getCamelCase($fieldReads, false, true); $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = ''; - $ret .= $this->uxc->getUserBreadcrumbs($language, $tableName, 'list', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableName, 'list', '', "\t\t"); if ($tableRate) { $varRate = '$ratingbars'; $ret .= $this->xc->getXcEqualsOperator($varRate, '(int)' . $this->xc->getXcGetConfig('ratingbars'),'', $t); @@ -190,7 +186,7 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $contIf = $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contIf, false, $t); $ret .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t); - $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count", '', $t); + $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count", true, $t); $contIf = $this->xc->getXcCriteriaSetStart($critName, '$start', $t . "\t"); $contIf .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' === ', '0', $contIf, false, $t); @@ -203,8 +199,11 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $foreach .= $this->xc->getXcEqualsOperator('$keywords[$i]', "\${$ccFieldMain}",'', $t . "\t\t"); if ($tableRate) { $itemId = $this->xc->getXcGetVar($ccFieldId, "{$tableName}All[\$i]", $fieldId, true); - $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); - $foreach .= $this->xc->getXcEqualsOperator("\${$tableName}[\$i]['rating']", "\$ratingsHandler->getItemRating({$itemId}, {$const})",'', $t . "\t\t"); + $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); + $foreach .= $this->xc->getXcEqualsOperator("\${$tableName}List[\$i]['rating']", "\$ratingsHandler->getItemRating({$itemId}, {$const})",'', $t . "\t\t"); + $foreach .= $this->xc->getXcEqualsOperator("\${$tableName}List[\$i]['rating_source']", "{$const}",'', $t . "\t\t"); + $foreach .= $this->xc->getXcEqualsOperator("\$token", "\$GLOBALS['xoopsSecurity']->createToken()",'', $t . "\t\t"); + $foreach .= $this->xc->getXcXoopsTplAssign('xoops_token', '$token', true, $t . "\t\t"); } $condIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t . "\t"); $condIf .= $this->xc->getXcXoopsTplAssign($tableName . '_list', "\${$tableName}List", true, $t . "\t"); @@ -223,9 +222,18 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $condIf .= $this->pc->getPhpCodeConditions("'show' == \$op && '' != \${$ccFieldMain}", '', '', $condIf2, false, $t . "\t"); if ('' !== $fieldReads) { - $condIf3 = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t\t"); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t\t\t"); + $condIf3 = $this->pc->getPhpCodeConditions('0 === $' . $ccFieldId, '', '', $redirectError, false, $t . "\t\t"); + + $condIf3 .= $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t\t"); $getVar = $this->xc->getXcGetVar('', "{$tableName}Obj", $fieldReads, true); + + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $condIf3 .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, 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"); @@ -253,7 +261,7 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa * @param string $t * @return string */ - public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, $t = '') + public function getUserPagesSave(string $moduleDirname, $fields, string $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, string $t = '') { $ucfTableName = \ucfirst($tableName); $countUploader = 0; @@ -290,6 +298,7 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole $implode = $this->pc->getPhpCodeImplode(',', $securityError); $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectError, false, $t); + if (1 == $tablePermissions) { $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, '\_NOPERM', true, $t . "\t"); @@ -298,6 +307,9 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole $getObj = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t"); $createObj = $this->xc->getXcHandlerCreateObj($tableName, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $getObj, $createObj, $t); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, false, $t); $ret .= $this->xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t); $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t); $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); @@ -323,7 +335,10 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole } $contentInsert .= $this->pc->getPhpCodeArray('tags', [], false, $t . "\t"); $contentInsert .= $this->xc->getXcEqualsOperator("\$tags['ITEM_NAME']", "\${$ccFieldMain}", '', $t . "\t"); - $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \${$ccFieldId}"; + $url = "\XOOPS_URL . '/modules/{$moduleDirname}/{$tableName}.php?op=show&{$fieldId}=' . \$new{$ucfFieldId}"; + + + $contentInsert .= $this->xc->getXcEqualsOperator("\$tags['ITEM_URL'] ", $url, '', $t . "\t"); $contentInsert .= $this->xc->getXcXoopsHandler('notification', $t . "\t"); if ('' === $fieldStatus) { @@ -345,17 +360,17 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole $not2Else = $this->pc->getPhpCodeCommentLine('Event new notification', null, $t . "\t\t\t"); $not2Else .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_new', \$tags);", $t . "\t\t\t"); $not1Else = $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $not2If, $not2Else, $t . "\t\t"); - $contentInsert .= $this->pc->getPhpCodeConditions("\${$ccFieldStatus}", ' == ', $this->xc->getXcGetConstants('STATUS_SUBMITTED'), $not1If, $not1Else, $t . "\t"); + $contentInsert .= $this->pc->getPhpCodeConditions("\${$ccFieldStatus}", ' == ', $this->xc->getXcGetConstants('STATUS_APPROVED'), $not1If, $not1Else, $t . "\t"); } } $contentInsert .= $this->pc->getPhpCodeCommentLine('redirect after insert', null, $t . "\t"); if ($countUploader > 0) { $errIf = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=edit&{$fieldId}=' . \$new{$ucfFieldId}", '', '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"); + $errElse = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); $confirmOk = $this->pc->getPhpCodeConditions('$uploaderErrors', ' !== ', "''", $errIf, $errElse, $t . "\t"); } else { - $confirmOk = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); + $confirmOk = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); } $contentInsert .= $confirmOk; $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); @@ -376,7 +391,7 @@ public function getUserPagesSave($moduleDirname, $fields, $tableName, $tableSole * * @return string */ - private function getPermissionsSave($moduleDirname, $ucfFieldId, $perm = 'view') + private function getPermissionsSave($moduleDirname, $ucfFieldId, string $perm = 'view') { $ret = $this->pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); $ret .= $this->xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', "\$new{$ucfFieldId}", false, "\t\t\t"); @@ -396,7 +411,7 @@ private function getPermissionsSave($moduleDirname, $ucfFieldId, $perm = 'view') * @param string $t * @return string */ - public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, $t = '') + public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, string $t = '') { $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'add', '', "\t\t"); if (1 == $tablePermissions) { @@ -419,7 +434,7 @@ public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $ * @param string $t * @return string */ - public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t = '') + public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, string $t = '') { $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'edit', '', "\t\t"); $ccFieldId = $this->getCamelCase($fieldId, false, true); @@ -431,7 +446,7 @@ public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); - $ret .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t); + $ret .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t, $language); return $ret; } @@ -446,7 +461,7 @@ public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, * @param string $t * @return string */ - public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t = '') + public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, string $t = '') { $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'clone', '', "\t\t"); $ccFieldId = $this->getCamelCase($fieldId, false, true); @@ -460,7 +475,7 @@ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}Source", ' == ', '0', $contIf, false, $t); - $ret .= $this->xc->getXcCommonPagesClone($tableName, $ccFieldId, $t); + $ret .= $this->xc->getXcCommonPagesClone($tableName, $ccFieldId, $t, $language); return $ret; } @@ -477,7 +492,7 @@ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, * @param string $t * @return string */ - private function getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications, $t = '') + private function getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications, string $t = '') { $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'delete', '', "\t\t"); $ccFieldId = $this->getCamelCase($fieldId, false, true); @@ -507,7 +522,7 @@ private function getUserPagesDelete($tableName, $tableSoleName, $tablePermission * @param string $t * @return string */ - private function getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, $t = '') + private function getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, string $t = '') { $ccFieldId = $this->getCamelCase($fieldId, false, true); $ccFieldMain = $this->getCamelCase($fieldMain, false, true); @@ -517,6 +532,9 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); $ret .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, false, $t); $ret .= $this->xc->getXcGetVar($ccFieldMain, "{$tableName}Obj", $fieldMain, false, $t); $reqOk = "_REQUEST['ok']"; $isset = $this->pc->getPhpCodeIsset($reqOk); @@ -540,7 +558,7 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl $contInsert .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_broken', \$tags);", $t . "\t\t"); $contInsert .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \${$ccFieldId}, '{$tableSoleName}_broken', \$tags);", $t . "\t\t"); } - $contInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); + $contInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); $htmlErrors = $this->xc->getXcHtmlErrors($tableName, true); $internalElse = $this->xc->getXcXoopsTplAssign('error', $htmlErrors, true, $t . "\t\t"); $condition .= $this->pc->getPhpCodeConditions($insert, '', '', $contInsert, $internalElse, $t . "\t"); @@ -553,16 +571,12 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl /** * @private function getUserPagesFooter * @param $moduleDirname - * @param $tableName * @param $tableComments - * @param $language * * @return string */ - private function getUserPagesFooter($moduleDirname, $tableName, $tableComments, $language) + private function getUserPagesFooter($moduleDirname, $tableComments) { - $stuModuleDirname = \mb_strtoupper($moduleDirname); - $stuTableName = \mb_strtoupper($tableName); $ret = $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Meta keywords'); $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); @@ -570,7 +584,7 @@ private function getUserPagesFooter($moduleDirname, $tableName, $tableComments, if (1 == $tableComments) { $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('View comments'); - $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'include/comment_view', true, false); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'include/comment_view', true); } $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->getRequire('footer'); @@ -595,32 +609,30 @@ private function getUserPagesFooter($moduleDirname, $tableName, $tableComments, * @param $tableRate * @param $fieldReads * @param $language - * @param $t * @return string */ - private function getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldStatus, $tableNotifications, $tableRate, $fieldReads, $language, $t) + private function getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldStatus, $tableNotifications, $tableRate, $fieldReads, $language) { $fields = $this->getTableFields($tableMid, $tableId); $cases['show'] = []; - $cases['list'] = [$this->getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language,$t . "\t")]; + $cases['list'] = [$this->getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language, "\t\t")]; if (1 == $tableSubmit) { - $cases['save'] = [$this->getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, $t . "\t")]; - $cases['new'] = [$this->getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, $t . "\t")]; - $cases['edit'] = [$this->getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t . "\t")]; - $cases['clone'] = [$this->getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, $t . "\t")]; - $cases['delete'] = [$this->getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications,$t . "\t")]; + $cases['save'] = [$this->getUserPagesSave($moduleDirname, $fields, $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, "\t\t")]; + $cases['new'] = [$this->getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, "\t\t")]; + $cases['edit'] = [$this->getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, "\t\t")]; + $cases['clone'] = [$this->getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, "\t\t")]; + $cases['delete'] = [$this->getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications, "\t\t")]; } if (1 == $tableBroken) { - $cases['broken'] = [$this->getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, $t . "\t")]; + $cases['broken'] = [$this->getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, "\t\t")]; } - return $this->xc->getXcSwitch('op', $cases, true, false); + return $this->xc->getXcSwitch('op', $cases, true); } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -663,8 +675,8 @@ public function render() } $content = $this->getHeaderFilesComments($module); $content .= $this->getUserPagesHeader($moduleDirname, $tableName, $fieldId, $tablePermissions, $language); - $content .= $this->getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldStatus, $tableNotifications, $tableRate, $fieldReads, $language, "\t"); - $content .= $this->getUserPagesFooter($moduleDirname, $tableName, $tableComments, $language); + $content .= $this->getUserPagesSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $tableBroken, $fieldId, $fieldMain, $fieldStatus, $tableNotifications, $tableRate, $fieldReads, $language); + $content .= $this->getUserPagesFooter($moduleDirname, $tableComments); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index d3461fd9..edc5628a 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -3,7 +3,10 @@ namespace XoopsModules\Modulebuilder\Files\User; use XoopsModules\Modulebuilder; -use XoopsModules\Modulebuilder\Files; +use XoopsModules\Modulebuilder\{ + Files, + Constants +}; /* You may not change or alter any portion of this comment or credits @@ -34,31 +37,29 @@ class UserPdf extends Files\CreateFile /** * @var mixed */ - private $uxc = null; + private $xc = null; /** * @var mixed */ - private $xc = null; + private $pc = null; /** * @var mixed */ - private $pc = null; + private $cf = null; /** * @public function constructor - * @param null */ public function __construct() { parent::__construct(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); } /** * @static function getInstance - * @param null * @return UserPdf */ public static function getInstance() @@ -73,11 +74,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -94,29 +95,34 @@ public function write($module, $table, $filename): void */ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language) { - $fieldId = $this->xc->getXcSaveFieldId($fields); + $fieldId = $this->xc->getXcTableFieldId($fields); $ccFieldId = $this->getCamelCase($fieldId, false, true); $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); $ret .= $this->getRequire(); $ret .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/header.php'", '', true, true); - $fileExist = $this->pc->getPhpCodeFileExists("\$tcpdf = \XOOPS_ROOT_PATH.'/Frameworks/tcpdf/'"); + $ret .= $this->xc->getXcEqualsOperator('$tcpdf', "\XOOPS_ROOT_PATH.'/Frameworks/tcpdf/'"); + $fileExist = $this->pc->getPhpCodeFileExists("\$tcpdf . 'tcpdf.php'"); $requireOnce = $this->pc->getPhpCodeIncludeDir("\$tcpdf . 'tcpdf.php'", '', true, true, 'require', "\t"); - $redirectHeader = $this->xc->getXcRedirectHeader($tableName, '', $numb = '2', "{$language}NO_PDF_LIBRARY", true, "\t"); + $redirectHeader = $this->xc->getXcRedirectHeader($tableName, '', '2', "{$language}NO_PDF_LIBRARY", true, "\t"); $ret .= $this->pc->getPhpCodeConditions($fileExist, '', '', $requireOnce, $redirectHeader); $ret .= $this->pc->getPhpCodeIncludeDir("\$tcpdf . 'config/tcpdf_config.php'", '', true, true); $ret .= $this->pc->getPhpCodeCommentLine('Get new template'); $ret .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/class/template.php'", '', true, true); - $ret .= $this->xc->getXcEqualsOperator('$pdfTpl', 'new $xoopsTpl()'); + $ret .= $this->xc->getXcEqualsOperator('$pdfTpl', 'new \XoopsTpl()'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Get requests'); $ret .= $this->xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int'); $ret .= $this->pc->getPhpCodeCommentLine('Get Instance of Handler'); $ret .= $this->xc->getXcHandlerLine($tableName); $ret .= $this->xc->getXcHandlerGetObj($tableName, $ccFieldId); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, "\t"); + $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); + $ret .= $this->cf->getSimpleString("\$pdfTpl->assign('wgtestmb_upload_url', \\" . strtoupper($moduleDirname) . '_UPLOAD_URL);'); $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; @@ -133,60 +139,84 @@ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields) { $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->pc->getPhpCodeCommentLine('Set defaults'); + + $fieldId = $this->xc->getXcTableFieldId($fields); + $ccFieldId = $this->getCamelCase($fieldId, false, true); + $fieldMain = $this->xc->getXcTableFieldMain($fields); + + $ret = $this->pc->getPhpCodeCommentLine('Check permissions'); + $ret .= $this->getSimpleString('$currentuid = 0;'); + $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); + $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); + $ret .= $this->xc->getXcXoopsHandler('groupperm'); + $ret .= $this->xc->getXcXoopsHandler('member'); + $condIf = $this->getSimpleString('$my_group_ids = [\XOOPS_GROUP_ANONYMOUS];', "\t"); + $condElse = $this->getSimpleString('$my_group_ids = $memberHandler->getGroupsByUser($currentuid);', "\t"); + $ret .= $this->pc->getPhpCodeConditions('0', ' === ', '$currentuid', $condIf, $condElse); + $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view_{$tableName}", "\${$ccFieldId}", '$my_group_ids', "\$GLOBALS['xoopsModule']->getVar('mid')", true); + $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); + $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); + $noPerm .= $this->getSimpleString('exit();', "\t"); + $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); + + $ret .= $this->pc->getPhpCodeCommentLine('Set defaults'); $ret .= $this->xc->getXcEqualsOperator('$pdfFilename', "'$tableName.pdf'"); - $ret .= $this->xc->getXcEqualsOperator('$title ', "'Pdf Title'"); - $ret .= $this->xc->getXcEqualsOperator('$subject ', "'Pdf Subject'"); $ret .= $this->xc->getXcEqualsOperator('$content ', "''"); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Read data from table and create pdfData'); + + $titleFound = false; foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldDefault = $fields[$f]->getVar('field_default'); $fieldElement = $fields[$f]->getVar('field_element'); $getVar = $this->xc->getXcGetVar('', $tableName . 'Obj', $fieldName, true); switch ($fieldElement) { - case 2: + case Constants::FIELD_ELE_TEXT: if (false !== mb_strpos($fieldName, 'title') || false !== mb_strpos($fieldName, 'name') && '' == $fieldDefault) { $ret .= $this->pc->getPhpCodeStripTags("pdfData['title'] ", $getVar); $ret .= $this->pc->getPhpCodeStripTags("pdfData['subject'] ", $getVar); + $titleFound = true; } break; - case 3: - case 4: - $ret .= $this->pc->getPhpCodeStripTags('content', $getVar); + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $ret .= $this->pc->getPhpCodeStripTags('content', $getVar, false, '', '.='); break; - case 8: + case Constants::FIELD_ELE_SELECTUSER: $ret .= $this->xc->getXcXoopsUserUnameFromId("pdfData['author'] ", $getVar); break; - case 15: + case Constants::FIELD_ELE_TEXTDATESELECT: $ret .= $this->xc->getXcFormatTimeStamp("pdfData['date'] ", $getVar); break; } } - $ret .= $this->pc->getPhpCodeStripTags("pdfData['title'] ", '$myts->undoHtmlSpecialChars($title)'); - $ret .= $this->pc->getPhpCodeStripTags("pdfData['subject'] ", '$subject'); + if (!$titleFound) { + $getVar = $this->xc->getXcGetVar('', $tableName . 'Obj', $fieldMain, true); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['title'] ", $getVar); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", $getVar); + } $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(); - $ret .= $this->pc->getPhpCodeCommentLine('Get Config'); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['creator'] ", "\$GLOBALS['xoopsConfig']['sitename']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['keywords'] ", "\$helper->getConfig('keywords')"); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Defines'); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_CREATOR", "\$pdfData['creator']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_AUTHOR", "\$pdfData['author']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_TITLE", "\$pdfData['title']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_STRING", "\$pdfData['subject']"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_LOGO", "'logo.gif'"); - $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_IMAGES_PATH", "\XOOPS_ROOT_PATH.'/images/'"); - $ret .= $this->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Assign customs tpl fields'); - $ret .= $this->xc->getXcXoopsTplAssign('content_header', "'$tableName'", true, '', 'pdfTpl'); - $ret .= $this->xc->getXcGetValues($tableName, $tableSolename, '', true, '', 'Obj'); - $ret .= $this->xc->getXcXoopsTplAssign($tableSolename, '$' .$tableSolename, true, '', 'pdfTpl'); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontname']", 'PDF_FONT_NAME_MAIN'); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontsize']", 'PDF_FONT_SIZE_MAIN'); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Get Config'); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['creator'] ", "\$GLOBALS['xoopsConfig']['sitename']"); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); + $ret .= $this->xc->getXcEqualsOperator("\$pdfData['keywords'] ", "\$helper->getConfig('keywords')"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Defines'); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_CREATOR", "\$pdfData['creator']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_AUTHOR", "\$pdfData['author']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_TITLE", "\$pdfData['title']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_STRING", "\$pdfData['subject']"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_HEADER_LOGO", "'logo.gif'"); + $ret .= $this->pc->getPhpCodeDefine("{$stuModuleDirname}_IMAGES_PATH", "\XOOPS_ROOT_PATH.'/images/'"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Assign customs tpl fields'); + $ret .= $this->xc->getXcXoopsTplAssign('content_header', "'$tableName'", true, '', 'pdfTpl'); + $ret .= $this->xc->getXcGetValues($tableName, $tableSolename, '', true, '', 'Obj'); + $ret .= $this->xc->getXcXoopsTplAssign($tableSolename, '$' .$tableSolename, true, '', 'pdfTpl'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Create pdf'); @@ -197,7 +227,7 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie $ret .= $this->pc->getPhpCodeCommentLine('Set document information'); $ret .= $this->getSimpleString("\$pdf->SetCreator(\$pdfData['creator']);"); $ret .= $this->getSimpleString("\$pdf->SetAuthor(\$pdfData['author']);"); - $ret .= $this->getSimpleString('$pdf->SetTitle($title);'); + $ret .= $this->getSimpleString("\$pdf->SetTitle(\$pdfData['title']);"); $ret .= $this->getSimpleString("\$pdf->SetKeywords(\$pdfData['keywords']);"); $ret .= $this->pc->getPhpCodeCommentLine('Set default header data'); $ret .= $this->getSimpleString("\$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, {$stuModuleDirname}_HEADER_TITLE, {$stuModuleDirname}_HEADER_STRING);"); @@ -211,16 +241,17 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie $ret .= $this->pc->getPhpCodeCommentLine('For chinese'); $ifLang = $this->getSimpleString("\$pdf->setHeaderFont(['gbsn00lp', '', \$pdfData['fontsize']]);", "\t"); $ifLang .= $this->getSimpleString("\$pdf->SetFont('gbsn00lp', '', \$pdfData['fontsize']);", "\t"); - $ifLang .= $this->getSimpleString("\$pdf->setFooterFont('gbsn00lp', '', \$pdfData['fontsize']]);", "\t"); - $elseLang = $this->getSimpleString("\$pdf->setHeaderFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);", "\t"); + $ifLang .= $this->getSimpleString("\$pdf->setFooterFont(['gbsn00lp', '', \$pdfData['fontsize']]);", "\t"); + $elseLang = $this->getSimpleString("\$pdf->setHeaderFont([PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN]);", "\t"); $elseLang .= $this->getSimpleString("\$pdf->SetFont(\$pdfData['fontname'], '', \$pdfData['fontsize']);", "\t"); - $elseLang .= $this->getSimpleString("\$pdf->setFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA);", "\t"); + $elseLang .= $this->getSimpleString("\$pdf->setFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA]);", "\t"); $ret .= $this->pc->getPhpCodeConditions('_LANGCODE', ' == ', "'cn'", $ifLang, $elseLang); $ret .= $this->pc->getPhpCodeCommentLine('Set some language-dependent strings (optional)'); - $ret .= $this->xc->getXcEqualsOperator('$lang', "\XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php'"); - $fileExist = $this->pc->getPhpCodeFileExists('$lang'); - $contIf = $this->pc->getPhpCodeIncludeDir('$lang', '', true, true, 'require', "\t"); - $contIf .= $this->getSimpleString('$pdf->setLanguageArray($lang);', "\t"); + $ret .= $this->xc->getXcEqualsOperator('$langFile', "\XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php'"); + $fileExist = $this->pc->getPhpCodeFileExists('$langFile'); + $contIf = $this->pc->getPhpCodeIncludeDir('$langFile', '', true, true, 'require', "\t"); + $contIfInt = $this->getSimpleString('$pdf->setLanguageArray($l);', "\t\t"); + $contIf .= $this->pc->getPhpCodeConditions('isset($l) && \is_array($l)', '', '', $contIfInt, false, "\t"); $ret .= $this->pc->getPhpCodeConditions("@{$fileExist}", '', '', $contIf); return $ret; @@ -249,8 +280,7 @@ private function getUserPdfFooter($moduleDirname, $tableName) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 2ffd5655..65fb8622 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -31,10 +31,6 @@ */ class UserPrint extends Files\CreateFile { - /** - * @var mixed - */ - private $uxc = null; /** * @var mixed */ @@ -46,19 +42,16 @@ class UserPrint extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { parent::__construct(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->uxc = UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserPrint */ public static function getInstance() @@ -73,11 +66,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -91,7 +84,7 @@ public function write($module, $table, $filename): void * * @return string */ - public function getUserPrint($moduleDirname, $language) + public function getUserPrint(string $moduleDirname, string $language) { $stuModuleDirname = \mb_strtoupper($moduleDirname); $table = $this->getTable(); @@ -124,11 +117,19 @@ public function getUserPrint($moduleDirname, $language) $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet'); $ret .= $this->xc->getXcXoThemeAddStylesheet(); $redirectHeader = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '2', "{$language}INVALID_PARAM", false, "\t"); - $ret .= $this->pc->getPhpCodeConditions("empty(\${$ccFieldId})", '', '', $redirectHeader); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $redirectHeader); $ret .= $this->pc->getPhpCodeCommentLine('Get Instance of Handler'); $ret .= $this->xc->getXcHandlerLine($tableName); + + $ret .= $this->getSimpleString('$currentuid = 0;'); + $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); + $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); $ret .= $this->xc->getXcXoopsHandler('groupperm'); + $ret .= $this->xc->getXcXoopsHandler('member'); + $condIf = $this->getSimpleString('$my_group_ids = [\XOOPS_GROUP_ANONYMOUS];', "\t"); + $condElse = $this->getSimpleString('$my_group_ids = $memberHandler->getGroupsByUser($currentuid);', "\t"); + $ret .= $this->pc->getPhpCodeConditions('0', ' === ', '$currentuid', $condIf, $condElse); $ret .= $this->pc->getPhpCodeCommentLine('Verify that the article is published'); if (false !== mb_strpos($fieldName, 'published')) { @@ -151,28 +152,30 @@ public function getUserPrint($moduleDirname, $language) $redirectHeader .= $this->getSimpleString('exit();'); $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < \time()", '', '', $redirectHeader); } - $ret .= $this->xc->getXcHandlerGet($tableName, $ccFieldId, '', $tableName . 'Handler',false); - $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view", "\${$ccFieldId}->getVar('{$fieldId}')", '$groups', "\$GLOBALS['xoopsModule']->getVar('mid')", true); + $ret .= $this->xc->getXcHandlerGet($tableName . 'Obj', $ccFieldId, '', $tableName . 'Handler'); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, "\t"); + $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError); + $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view_{$tableName}", "\${$tableName}Obj->getVar('{$fieldId}')", '$my_group_ids', "\$GLOBALS['xoopsModule']->getVar('mid')", true); $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); $noPerm .= $this->getSimpleString('exit();', "\t"); $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); - $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName . 'List', '', true); + $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName . 'List', '', true, '', 'Obj'); $ret .= $this->xc->getXcXoopsTplAppend($tableName . '_list', '$' . $tableSoleName . 'List'); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcXoopsTplAssign('xoops_sitename', "\$GLOBALS['xoopsConfig']['sitename']"); - $getVar = $this->xc->getXcGetVar('', $tableName, $fieldMain, true); + $getVar = $this->xc->getXcGetVar('', $tableName . 'Obj', $fieldMain, true); $stripTags = $this->pc->getPhpCodeStripTags('', $getVar . " . ' - ' . " . "{$language}PRINT" . " . ' - ' . " . "\$GLOBALS['xoopsModule']->getVar('name')", true); $ret .= $this->xc->getXcXoopsTplAssign('xoops_pagetitle', $stripTags); - $ret .= $this->xc->getXcXoopsTplDisplay($tableName . '_print.tpl', '', false); + $ret .= $this->xc->getXcXoopsTplDisplay($moduleDirname . '_' . $tableName . '_print.tpl', '', false); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index 2eb27ff8..b9ad4e67 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -39,28 +39,21 @@ class UserRate extends Files\CreateFile * @var mixed */ private $pc = null; - /** - * @var mixed - */ - private $uxc = null; - + /** * @public function constructor * - * @param null */ public function __construct() { parent::__construct(); $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->uxc = UserXoopsCode::getInstance(); } /** * @static function getInstance * - * @param null * * @return UserRate */ @@ -76,11 +69,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $tables * @param string $filename */ - public function write($module, $tables, $filename) + public function write($module, $tables, string $filename) { $this->setModule($module); $this->setTables($tables); @@ -109,14 +102,15 @@ public function getUserRateHeader($moduleDirname) * @private function getUserRateSwitch * @param $tables * @param $language + * @param $moduleDirname * @return string */ - private function getUserRateSwitch($tables, $language) + private function getUserRateSwitch($tables, $language, $moduleDirname) { $t = "\t\t"; $cases = [ 'list' => [$this->getUserRateDefault( $t)], - 'save' => [$this->getUserRateSave($tables, $language, $t)], + 'save' => [$this->getUserRateSave($tables, $language, $t, $moduleDirname)], ]; return $this->xc->getXcSwitch('op', $cases, true); @@ -127,7 +121,7 @@ private function getUserRateSwitch($tables, $language) * @param string $t * @return string */ - public function getUserRateDefault($t = '') + public function getUserRateDefault(string $t = '') { $ret = $this->pc->getPhpCodeCommentLine('default should not happen','', $t); $ret .= $this->xc->getXcRedirectHeader('index', '', '3', '\_NOPERM', true, $t); @@ -140,16 +134,17 @@ public function getUserRateDefault($t = '') * @param $tables * @param $language * @param $t + * @param $moduleDirname * @return string */ - public function getUserRateSave($tables, $language, $t) + public function getUserRateSave($tables, $language, $t, $moduleDirname) { $ret = $this->pc->getPhpCodeCommentLine('Security Check', '', $t); $xoopsSecurityCheck = $this->xc->getXcXoopsSecurityCheck(); $securityError = $this->xc->getXcXoopsSecurityErrors(); $implode = $this->pc->getPhpCodeImplode(',', $securityError); $redirectError = $this->xc->getXcRedirectHeader('index', '', '3', $implode, true, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions($xoopsSecurityCheck, '', '', $redirectError, false, $t); + $ret .= $this->pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectError, false, $t); $ret .= $this->xc->getXcXoopsRequest('rating', 'rating', '', 'Int', false, $t); $ret .= $this->xc->getXcEqualsOperator('$itemid', '0','', $t); @@ -166,17 +161,19 @@ public function getUserRateSave($tables, $language, $t) } } $contIf = $this->xc->getXcXoopsRequest('itemid', $fieldId, '', 'Int', false, $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$redir', "'{$tableName}.php?op=show&{$fieldId}=' . \$itemid",'', $t . "\t"); + $contIf .= $this->xc->getXcEqualsOperator('$redir', "'{$tableName}.php?op=show&{$fieldId}=' . \$itemid",'', $t . "\t"); $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); $ret .= $this->pc->getPhpCodeConditions('$source', ' === ', $const, $contIf, false, $t); } } + $redirectError = $this->xc->getXcRedirectHeader('$redir', '', '3', "{$language}INVALID_PARAM", false, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('(int)$itemid', ' === ', '0', $redirectError, false, $t); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); $ret .= $this->xc->getXcEqualsOperator('$rate_allowed', 'false','', $t); $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); - $ret .= $this->pc->getPhpCodeTernaryOperator('groups', '(isset(' . $xUser . ') && \is_object(' . $xUser . '))', $xUser . '->getGroups()', '\XOOPS_GROUP_ANONYMOUS', "\t\t"); + $ret .= $this->pc->getPhpCodeTernaryOperator('groups', '(isset(' . $xUser . ') && \is_object(' . $xUser . '))', $xUser . '->getGroups()', '[\XOOPS_GROUP_ANONYMOUS]', "\t\t"); $contIf = $this->xc->getXcEqualsOperator('$rate_allowed', 'true','', $t . "\t\t"); $contIf .= $this->getSimpleString('break;', $t . "\t\t"); $cond = '\XOOPS_GROUP_ADMIN == $group || \in_array($group, $helper->getConfig(\'ratingbar_groups\'))'; @@ -195,7 +192,7 @@ public function getUserRateSave($tables, $language, $t) $contIf = $this->xc->getXcRedirectHeader('index', '', '3', $language . 'RATING_VOTE_BAD', true, $t . "\t\t\t"); $contIf .= $this->getSimpleString('exit;', $t . "\t\t\t"); $const = $this->xc->getXcGetConstants('RATING_LIKES'); - $cases[$const] = [$this->pc->getPhpCodeConditions('$rating > 1 || $rating < -1', '', '', $contIf, false, $t . "\t\t")]; + $cases[$const] = [$this->pc->getPhpCodeConditions('!\in_array($rating, [-1, 1], true)', '', '', $contIf, false, $t . "\t\t")]; $const = $this->xc->getXcGetConstants('RATING_5STARS'); $cases[$const] = [$this->pc->getPhpCodeConditions('$rating > 5 || $rating < 1', '', '', $contIf, false, $t . "\t\t")]; $const = $this->xc->getXcGetConstants('RATING_10STARS'); @@ -227,38 +224,41 @@ public function getUserRateSave($tables, $language, $t) $contIf = $this->pc->getPhpCodeUnset('ratingsObj', $t . "\t"); $contIf .= $this->pc->getPhpCodeCommentLine('Calc average rating value', null, $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$nb_ratings ', '0','', $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$avg_rate_value', '0','', $t . "\t"); - $contIf .= $this->xc->getXcEqualsOperator('$current_rating', '0','', $t . "\t"); - $tableName = 'ratings'; - $ucfTableName = \ucfirst($tableName); - $critName = 'cr' . $ucfTableName; - $contIf .= $this->xc->getXcCriteriaCompo($critName, $t . "\t"); - $crit = $this->xc->getXcCriteria('', "'rate_source'", '$source','',true); - $contIf .= $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); - $crit = $this->xc->getXcCriteria('', "'rate_itemid'", '$itemid','',true); - $contIf .= $this->xc->getXcCriteriaAdd($critName, $crit, $t . "\t"); - $contIf .= $this->xc->getXcHandlerCountClear($tableName . 'Count', $tableName, '$' . $critName, $t . "\t"); - $contIf .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $t . "\t"); - $contFe = $this->xc->getXcEqualsOperator('$current_rating', "\$ratingsAll[\$i]->getVar('rate_value')",'+', $t . "\t\t"); - $contIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contFe, $t . "\t"); - $contIf .= $this->pc->getPhpCodeUnset($tableName . 'All', $t . "\t"); - $contIfInt = $this->xc->getXcEqualsOperator('$avg_rate_value', 'number_format($current_rating / $ratingsCount, 2)','', $t . "\t\t"); - $contIf .= $this->pc->getPhpCodeConditions('$ratingsCount', ' > ', '0', $contIfInt, false, $t . "\t"); - - $contIf .= $this->pc->getPhpCodeCommentLine('Update related table', null, $t . "\t"); foreach ($tables as $table) { $tableName = $table->getVar('table_name'); - $tableFieldName = $table->getVar('table_fieldname'); $stuTableName = \mb_strtoupper($tableName); if (1 == $table->getVar('table_rate')) { - //$contIfInt = $this->xc->getXcEqualsOperator('$tableName', "'{$tableName}'",'', $t . "\t\t"); - //$contIfInt .= $this->xc->getXcEqualsOperator('$fieldRatings', "'{$tableFieldName}_ratings'",'', $t . "\t\t"); - //$contIfInt .= $this->xc->getXcEqualsOperator('$fieldVotes ', "'{$tableFieldName}_votes'",'', $t . "\t\t"); - $contIfInt = $this->xc->getXcHandlerGetObj($tableName, 'itemid', $t . "\t\t"); - $contIfInt .= $this->xc->getXcSetVarObj($tableName, "{$tableFieldName}_ratings", '$avg_rate_value', $t . "\t\t"); - $contIfInt .= $this->xc->getXcSetVarObj($tableName, "{$tableFieldName}_votes", '$ratingsCount', $t . "\t\t"); - $insertInt = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldId = ''; + $fieldRatings = ''; + $fieldVotes = ''; + foreach (\array_keys($fields) as $f) { + if (0 == $f) { + $fieldId = $fields[$f]->getVar('field_name'); + } + $fieldElement = $fields[$f]->getVar('field_element'); + if($fieldElement == Modulebuilder\Constants::FIELD_ELE_TEXTRATINGS) { + $fieldRatings = $fields[$f]->getVar('field_name'); + } + if($fieldElement == Modulebuilder\Constants::FIELD_ELE_TEXTVOTES) { + $fieldVotes = $fields[$f]->getVar('field_name'); + } + } + $sql = $this->getSimpleString("\$sql = '", $t . "\t\t"); + $sql .= $this->getSimpleString("UPDATE ' . \$GLOBALS['xoopsDB']->prefix('" . $moduleDirname . '_' . $tableName . "') . ' t", $t . "\t\t\t"); + $sql .= $this->getSimpleString('LEFT JOIN (', $t . "\t\t\t"); + $sql .= $this->getSimpleString('SELECT', $t . "\t\t\t\t"); + $sql .= $this->getSimpleString('rate_itemid, rate_source, COUNT(*) AS votes, ROUND(AVG(rate_value), 2) AS avg_rating', $t . "\t\t\t\t\t"); + $sql .= $this->getSimpleString("FROM ' . \$GLOBALS['xoopsDB']->prefix('{$moduleDirname}_ratings') . '", $t . "\t\t\t\t"); + $sql .= $this->getSimpleString('GROUP BY rate_itemid, rate_source', $t . "\t\t\t\t"); + $sql .= $this->getSimpleString(") r ON r.rate_itemid = t." . $fieldId . " and r.rate_source = ' . \$source . '", $t . "\t\t\t"); + $sql .= $this->getSimpleString('SET', $t . "\t\t\t"); + $sql .= $this->getSimpleString('t.' . $fieldVotes . ' = COALESCE(r.votes, 0),', $t . "\t\t\t\t"); + $sql .= $this->getSimpleString('t.' . $fieldRatings . ' = COALESCE(r.avg_rating, 0),', $t . "\t\t\t\t"); + $sql .= $this->getSimpleString("WHERE t." . $fieldId . " = ' . \$itemid;", $t . "\t\t\t"); + $contIfInt = $sql; + + $insertInt = "\$GLOBALS['xoopsDB']->queryF(\$sql)"; $insertOK = $this->xc->getXcRedirectHeader('$redir', '', '2', "{$language}RATING_VOTE_THANKS", false, $t . "\t\t\t"); $insertErr = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}RATING_ERROR1", true, $t . "\t\t\t"); @@ -270,7 +270,7 @@ public function getUserRateSave($tables, $language, $t) } $contIf .= $this->pc->getPhpCodeBlankLine(); - $contIf .= $this->xc->getXcRedirectHeader('index', '', '2', "{$language}RATING_VOTE_THANKS", true, $t . "\t"); + $contIf .= $this->xc->getXcRedirectHeader('index', '', '2', "{$language}INVALID_PARAM", true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contIf, false, $t); $ret .= $this->pc->getPhpCodeCommentLine('Get Error', null, $t); @@ -290,8 +290,7 @@ public function getUserRateFooter() /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -302,7 +301,7 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module); $content .= $this->getUserRateHeader($moduleDirname); - $content .= $this->getUserRateSwitch($tables, $language); + $content .= $this->getUserRateSwitch($tables, $language, $moduleDirname); $content .= $this->getUserRateFooter(); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/User/UserRss.php b/class/Files/User/UserRss.php index 4643fa54..14a32bad 100644 --- a/class/Files/User/UserRss.php +++ b/class/Files/User/UserRss.php @@ -31,14 +31,6 @@ */ class UserRss extends Files\CreateFile { - /** - * @var mixed - */ - private $uxc = null; - /** - * @var mixed - */ - private $xc = null; /** * @var mixed */ @@ -46,19 +38,15 @@ class UserRss extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { parent::__construct(); - $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $this->uxc = UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserRss */ public static function getInstance() @@ -73,11 +61,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param string $filename */ - public function write($module, $table, $filename): void + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -89,7 +77,7 @@ public function write($module, $table, $filename): void * @param string $moduleDirname * @return string */ - public function getUserRss($moduleDirname) + public function getUserRss(string $moduleDirname) { $table = $this->getTable(); $tableName = $table->getVar('table_name'); @@ -153,11 +141,11 @@ public function getUserRss($moduleDirname) \$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_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_generator', 'XOOPS - ' . \htmlspecialchars(\$xoopsModule->getVar('name'), ENT_QUOTES)); \$tpl->assign('channel_language', _LANGCODE); if ( 'fr' == _LANGCODE ) { \$tpl->assign('docs', 'https://www.scriptol.fr/rss/RSS-2.0.html'); @@ -165,16 +153,17 @@ public function getUserRss($moduleDirname) \$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]; + \$logoPath = \XOOPS_ROOT_PATH . \$xoopsModuleConfig['logorss']; + \$width = 88; + \$height = 31; + if (\\file_exists(\$logoPath)) { + \$dimension = \getimagesize(\$logoPath); + if (!empty(\$dimension[0])) { + \$width = (\$dimension[0] > 144) ? 144 : \$dimension[0]; + } + if (!empty(\$dimension[1])) { + \$height = (\$dimension[1] > 400) ? 400 : \$dimension[1]; + } } \$tpl->assign('image_width', \$width); \$tpl->assign('image_height', \$height); @@ -187,8 +176,8 @@ public function getUserRss($moduleDirname) \$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}'), + '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) ]); @@ -204,8 +193,7 @@ public function getUserRss($moduleDirname) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserSearch.php b/class/Files/User/UserSearch.php index d8963199..913bd9d4 100644 --- a/class/Files/User/UserSearch.php +++ b/class/Files/User/UserSearch.php @@ -46,7 +46,6 @@ class UserSearch extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -58,7 +57,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserSearch */ public static function getInstance() @@ -73,11 +71,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param string $filename */ - public function write($module, $table, $filename) + public function write($module, $table, string $filename) { $this->setModule($module); $this->setTable($table); @@ -130,12 +128,10 @@ private function getUserSearchHeader($moduleDirname, $table, $fields) */ public function getUserSearch() { - $ret = <<<'EOT' + /*$ret = <<<'EOT' -EOT; - $ret .= $this->getSimpleString('$keywords = [];'); - - return $ret; +EOT;*/ + return $this->getSimpleString('$keywords = [];'); } /** @@ -149,7 +145,6 @@ public function getUserSearch() */ private function getUserSearchFooter($moduleDirname, $tableName, $language) { - $stuModuleDirname = \mb_strtoupper($moduleDirname); $stuTableName = \mb_strtoupper($tableName); $ret = $this->getDashComment('Breadcrumbs'); $ret .= $this->uxc->getUserBreadcrumbs((string)$stuTableName, $language); @@ -163,8 +158,7 @@ private function getUserSearchFooter($moduleDirname, $tableName, $language) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserViewTag.php b/class/Files/User/UserViewTag.php index 4ecefb3c..2a6fce3c 100644 --- a/class/Files/User/UserViewTag.php +++ b/class/Files/User/UserViewTag.php @@ -38,7 +38,6 @@ class UserViewTag extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -48,7 +47,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserViewTag */ public static function getInstance() @@ -63,10 +61,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename): void + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,7 +72,6 @@ public function write($module, $filename): void /** * @public function getUserViewTag - * @param null * @return string */ public function getUserViewTag() @@ -87,8 +84,7 @@ public function getUserViewTag() /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index 1a9cffd9..00cfa5df 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -41,7 +41,6 @@ class UserXoopsCode /** * @public function constructor - * @param null */ public function __construct() { @@ -75,7 +74,7 @@ public static function getInstance() * * @return string */ - public function getUserTplMain($moduleDirname, $tableName = 'index') + public function getUserTplMain($moduleDirname, string $tableName = 'index') { return "\$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl';\n"; } @@ -90,7 +89,7 @@ public function getUserTplMain($moduleDirname, $tableName = 'index') * @param string $t * @return string */ - public function getUserAddMeta($type, $language, $tableName, $t = '') + public function getUserAddMeta(string $type, $language, $tableName, string $t = '') { $stuTableName = \mb_strtoupper($tableName); $stripTags = $this->pc->getPhpCodeStripTags('', $language . $stuTableName, true); @@ -115,13 +114,11 @@ public function getUserMetaKeywords($moduleDirname) /** * @public function getUserMetaDesc * - * @param $moduleDirname - * @param $language - * @param string $file + * @param string $moduleDirname * * @return string */ - public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') + public function getUserMetaDesc(string $moduleDirname) { return $moduleDirname. 'MetaDescription((string)$helper->' . "getConfig('metadescription'));\n"; } @@ -137,7 +134,7 @@ public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') * * @return string */ - public function getUserBreadcrumbs($language, $tableName = 'index', $op = '', $link = '', $t = '') + public function getUserBreadcrumbs($language, string $tableName = 'index', string $op = '', string $link = '', string $t = '') { $stuTableName = \mb_strtoupper($tableName); $stuOp = ''; @@ -167,24 +164,22 @@ public function getUserBreadcrumbs($language, $tableName = 'index', $op = '', $l public function getUserBreadcrumbsFooterFile() { $cond = $this->xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs'); - $ret = $this->pc->getPhpCodeConditions('\count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); - - return $ret; + return $this->pc->getPhpCodeConditions('\count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); } /** * @public function getUserModVersionArray * - * @param int $eleArray + * @param int $eleArray * @param string|array $descriptions - * @param null $name - * @param null $index - * @param bool $num - * @param string $t + * @param null $name + * @param null $index + * @param null $num + * @param string $t * * @return string */ - public function getUserModVersionArray($eleArray, $descriptions, $name = null, $index = null, $num = false, $t = '') + public function getUserModVersionArray(int $eleArray, $descriptions, $name = null, $index = null, $num = null, string $t = '') { $ret = $t . '$modversion'; $isArray = false; @@ -241,16 +236,16 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ /** * @public function getUserModVersionText * - * @param int $eleArray + * @param int $eleArray * @param $text * @param null $name * @param null $index - * @param bool $num + * @param null $num * @param string $t * * @return string */ - public function getUserModVersionText($eleArray, $text, $name = null, $index = null, $num = false, $t = '') + public function getUserModVersionText(int $eleArray, $text, $name = null, $index = null, $num = null, string $t = '') { $ret = $t . '$modversion'; diff --git a/class/Files/User/UserXoopsVersion.php b/class/Files/User/UserXoopsVersion.php index 53671d25..f590aa7d 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -50,7 +50,6 @@ class UserXoopsVersion extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -62,7 +61,6 @@ public function __construct() /** * @static function getInstance - * @param null * @return UserXoopsVersion */ public static function getInstance() @@ -109,7 +107,6 @@ public function setKeywords($keywords): void /** * @public function getKeywords - * @param null * @return array */ public function getKeywords() @@ -141,7 +138,7 @@ private function getXoopsVersionHeader($module, $language) $descriptions = [ 'name' => "{$language}NAME", - 'version' => "'" . (string)$module->getVar('mod_version') . "'", + 'version' => "'" . $module->getVar('mod_version') . "'", 'description' => "{$language}DESC", 'author' => "'{$module->getVar('mod_author')}'", 'author_mail' => "'{$module->getVar('mod_author_mail')}'", @@ -319,25 +316,25 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm $item[] = $this->pc->getPhpCodeCommentLine('User templates'); $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header'); $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index'); - $tableBroken = []; + //$tableBroken = []; $tablePdf = []; $tablePrint = []; $tableRate = []; $tableRss = []; $tableSearch = []; $tableSingle = []; - $tableSubmit = []; + //$tableSubmit = []; foreach (\array_keys($tables) as $t) { if (1 == $tables[$t]->getVar('table_user')) { $tableName = $tables[$t]->getVar('table_name'); - $tableBroken[] = $tables[$t]->getVar('table_broken'); + //$tableBroken[] = $tables[$t]->getVar('table_broken'); $tablePdf[] = $tables[$t]->getVar('table_pdf'); $tablePrint[] = $tables[$t]->getVar('table_print'); $tableRate[] = $tables[$t]->getVar('table_rate'); $tableRss[] = $tables[$t]->getVar('table_rss'); $tableSearch[] = $tables[$t]->getVar('table_search'); $tableSingle[] = $tables[$t]->getVar('table_single'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); + //$tableSubmit[] = $tables[$t]->getVar('table_submit'); $tableRate[] = $tables[$t]->getVar('table_rate'); $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName); $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'list'); @@ -383,13 +380,13 @@ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $adm /** * @private function getXoopsVersionTemplatesLine - * @param $moduleDirname - * @param $type + * @param string $moduleDirname + * @param string $type * @param string $extra - * @param bool $isAdmin + * @param bool $isAdmin * @return string */ - private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '', $isAdmin = false) + private function getXoopsVersionTemplatesLine(string $moduleDirname, string $type, string $extra = '', bool $isAdmin = false) { $ret = ''; $desc = "'description' => ''"; @@ -429,10 +426,10 @@ private function getXoopsVersionSubmenu($language, $tables) $contentIf = $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); ++$i; - $tableSearch = []; + //$tableSearch = []; foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); - $tableSearch[] = $tables[$t]->getVar('table_search'); + //$tableSearch[] = $tables[$t]->getVar('table_search'); if (1 == $tables[$t]->getVar('table_submenu')) { $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); $descriptions = [ @@ -496,7 +493,7 @@ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); if (0 == $tables[$i]->getVar('table_category') && 1 == $tables[$i]->getVar('table_blocks')) { - $ret .= $this->getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $language, 'spotlight'); + $ret .= $this->getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $language); } } @@ -536,14 +533,13 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable * @param $moduleDirname * @param $tableName * @param $language - * @param $type * @return string */ - private function getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $language, $type) + private function getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $language) { $stuTableName = \mb_strtoupper($tableName); $ucfTableName = \ucfirst($tableName); - $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' spotlight'); $blocks = [ 'file' => "'{$tableName}_spotlight.php'", 'name' => "{$language}{$stuTableName}_BLOCK_SPOTLIGHT", @@ -551,7 +547,7 @@ private function getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $lan 'show_func' => "'b_{$moduleDirname}_{$tableName}_spotlight_show'", 'edit_func' => "'b_{$moduleDirname}_{$tableName}_spotlight_edit'", 'template' => "'{$moduleDirname}_block_{$tableName}_spotlight.tpl'", - 'options' => "'{$type}|5|25|0'", + 'options' => "'spotlight|5|25|0'", ]; $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); @@ -900,7 +896,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'title' => "'{$language}TABLE_TYPE'", 'description' => "'{$language}DIVIDEBY_DESC'", 'formtype' => "'select'", - 'valuetype' => "'int'", + 'valuetype' => "'text'", 'default' => "'bordered'", 'options' => "['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed']", ]; @@ -923,7 +919,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'title' => "'{$language}IDPAYPAL'", 'description' => "'{$language}IDPAYPAL_DESC'", 'formtype' => "'textbox'", - 'valuetype' => "'textbox'", + 'valuetype' => "'text'", 'default' => "'XYZ123'", ]; $ret .= $this->uxc->getUserModVersionArray(2, $paypal, 'config'); @@ -1026,30 +1022,30 @@ private function getXoopsVersionNotifications($module, $language) $notifyFiles = []; $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - $tableCategory = []; + //$tableCategory = []; $tableBroken = []; $tableComments = []; - $tableSubmit = []; - $tableId = null; - $tableMid = null; + //$tableSubmit = []; + //$tableId = null; + //$tableMid = null; $notifyCategory = ''; $notifyEventGlobal = $this->pc->getPhpCodeCommentLine('Global events notification'); $notifyEventTable = $this->pc->getPhpCodeCommentLine('Event notifications for items'); //global events - $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_new', 'global', 0, 'global_new', 'global_new_notify'); - $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_modify', 'global', 0, 'global_modify', 'global_modify_notify'); - $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_delete', 'global', 0, 'global_delete', 'global_delete_notify'); - $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_approve', 'global', 1, 'global_approve', 'global_approve_notify'); + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_new', 'global', 0, 'global_new', 'global_new_notify'); + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_modify', 'global', 0, 'global_modify', 'global_modify_notify'); + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_delete', 'global', 0, 'global_delete', 'global_delete_notify'); + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_approve', 'global', 1, 'global_approve', 'global_approve_notify'); foreach (\array_keys($tables) as $t) { $tableBroken[] = $tables[$t]->getVar('table_broken'); $tableComments[] = $tables[$t]->getVar('table_comments'); } if (\in_array(1, $tableBroken)) { - $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_broken', 'global', 1, 'global_broken', 'global_broken_notify'); + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_broken', 'global', 1, 'global_broken', 'global_broken_notify'); } if (\in_array(1, $tableComments)) { - $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_comment', 'global', 0, 'global_comment', 'global_comment_notify'); + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_comment', 'global', 0, 'global_comment', 'global_comment_notify'); } foreach (\array_keys($tables) as $t) { @@ -1057,8 +1053,8 @@ private function getXoopsVersionNotifications($module, $language) $tableMid = $tables[$t]->getVar('table_mid'); $tableName = $tables[$t]->getVar('table_name'); $tableSoleName = $tables[$t]->getVar('table_solename'); - $tableCategory[] = $tables[$t]->getVar('table_category'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); + //$tableCategory[] = $tables[$t]->getVar('table_category'); + //$tableSubmit[] = $tables[$t]->getVar('table_submit'); $fields = $this->getTableFields($tableMid, $tableId); $fieldId = 0; foreach (\array_keys($fields) as $f) { @@ -1069,13 +1065,13 @@ private function getXoopsVersionNotifications($module, $language) } if (1 == $tables[$t]->getVar('table_notifications')) { $notifyFiles[] = $tableName; - $notifyCategory .= $this->getXoopsVersionNotificationTableName($language, 'category', $tableName, $tableSoleName, $tableName, $fieldId, 1); + $notifyCategory .= $this->getXoopsVersionNotificationTableName($language, $tableName, $tableSoleName, $tableName, $fieldId); //$notifyEvent .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_new', $tableName, 0, $tableSoleName, $tableSoleName . '_new_notify'); - $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_modify', $tableName, 0, $tableSoleName . '_modify', $tableSoleName . '_modify_notify'); - $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_delete', $tableName, 0, $tableSoleName . '_delete', $tableSoleName . '_delete_notify'); - $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_approve', $tableName, 0, $tableSoleName . '_approve', $tableSoleName . '_approve_notify'); + $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, $tableSoleName . '_modify', $tableName, 0, $tableSoleName . '_modify', $tableSoleName . '_modify_notify'); + $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, $tableSoleName . '_delete', $tableName, 0, $tableSoleName . '_delete', $tableSoleName . '_delete_notify'); + $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, $tableSoleName . '_approve', $tableName, 0, $tableSoleName . '_approve', $tableSoleName . '_approve_notify'); if (1 == $tables[$t]->getVar('table_broken')) { - $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_broken', $tableName, 0, $tableSoleName . '_broken', $tableSoleName . '_broken_notify'); + $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, $tableSoleName . '_broken', $tableName, 0, $tableSoleName . '_broken', $tableSoleName . '_broken_notify'); } /*event will be added by xoops if (1 == $tables[$t]->getVar('table_comments')) { @@ -1084,7 +1080,7 @@ private function getXoopsVersionNotifications($module, $language) } } $ret .= $this->pc->getPhpCodeCommentLine('Categories of notification'); - $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', 'global', $notifyFiles); + $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', $notifyFiles); //$ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1'); @@ -1097,19 +1093,18 @@ private function getXoopsVersionNotifications($module, $language) * @private function getXoopsVersionNotificationGlobal * @param $language * @param $type - * @param $name * @param $title * @param $from * * @return string */ - private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from) + private function getXoopsVersionNotificationGlobal($language, $type, $title, $from) { $title = \mb_strtoupper($title); $implodeFrom = \implode(".php', '", $from); $ret = $this->pc->getPhpCodeCommentLine('Global Notify'); $global = [ - 'name' => "'{$name}'", + 'name' => "'global'", 'title' => "{$language}NOTIFY_{$title}", 'description' => "''", 'subscribe_from' => "['index.php', '{$implodeFrom}.php']", @@ -1122,17 +1117,16 @@ private function getXoopsVersionNotificationGlobal($language, $type, $name, $tit /** * @private function getXoopsVersionNotificationTableName * @param $language - * @param $type * @param $name * @param $title * @param $file * @param $item - * @param $allow * * @return string */ - private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $file, $item, $allow) + private function getXoopsVersionNotificationTableName($language, $name, $title, $file, $item) { + $allow = 1; $stuTitle = \mb_strtoupper($title); $ucfTitle = \ucfirst($title); $ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); @@ -1142,9 +1136,9 @@ private function getXoopsVersionNotificationTableName($language, $type, $name, $ 'description' => "''", 'subscribe_from' => "'{$file}.php'", 'item_name' => "'{$item}'", - 'allow_bookmark' => (string)$allow, + 'allow_bookmark' => (string)(1), ]; - $ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'{$type}'"); + $ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'category'"); return $ret; } @@ -1152,7 +1146,6 @@ private function getXoopsVersionNotificationTableName($language, $type, $name, $ /** * @private function getXoopsVersionNotifications * @param $language - * @param $type * @param $name * @param $category * @param $admin @@ -1161,7 +1154,7 @@ private function getXoopsVersionNotificationTableName($language, $type, $name, $ * * @return string */ - private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin, $title, $mail) + private function getXoopsVersionNotificationCodeComplete($language, $name, $category, $admin, $title, $mail) { $title = \mb_strtoupper($title); $ucfTitle = \ucfirst($title); @@ -1176,7 +1169,7 @@ private function getXoopsVersionNotificationCodeComplete($language, $type, $name 'mail_template' => "'{$mail}'", 'mail_subject' => "{$language}NOTIFY_{$title}_SUBJECT", ]; - $ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'{$type}'"); + $ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'event'"); return $ret; } @@ -1184,10 +1177,9 @@ private function getXoopsVersionNotificationCodeComplete($language, $type, $name /** * @private function getXoopsVersionNotifications * @param $moduleDirname - * @param string $t * @return string */ - private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') + private function getXoopsVersionSelectSizeMB($moduleDirname) { $ucModuleDirname = \mb_strtoupper($moduleDirname); @@ -1196,28 +1188,28 @@ private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') $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)'); - $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"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '100', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '5000 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '50', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '2500 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '10', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '1000 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '5', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '500 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '2', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '100 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '1', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '50 * 1048576', $cond, false, $t); - $cond = $this->xc->getXcEqualsOperator('$increment', '0.5', null, $t . "\t"); - $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '25 * 1048576', $cond, false, $t); + $cond = $this->xc->getXcEqualsOperator('$increment', '500', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' > ', '10000 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '200', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '100', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '5000 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '50', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '2500 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '10', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '1000 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '5', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '500 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '2', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '100 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '1', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '50 * 1048576', $cond, false, ''); + $cond = $this->xc->getXcEqualsOperator('$increment', '0.5', null, "\t"); + $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '25 * 1048576', $cond, false, ''); $ret .= $this->xc->getXcEqualsOperator('$optionMaxsize', '[]'); $ret .= $this->xc->getXcEqualsOperator('$i', '$increment'); - $while = $this->xc->getXcEqualsOperator("\$optionMaxsize[\$i . ' ' . _MI_{$ucModuleDirname}_SIZE_MB]", '$i * 1048576', null, $t . "\t"); - $while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+',$t . "\t"); + $while = $this->xc->getXcEqualsOperator("\$optionMaxsize[\$i . ' ' . _MI_{$ucModuleDirname}_SIZE_MB]", '$i * 1048576', null, "\t"); + $while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+', "\t"); $ret .= $this->pc->getPhpCodeWhile('i * 1048576', $while, '$maxSize', '<='); return $ret; @@ -1225,8 +1217,7 @@ private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/admin/AdminAbout.php b/class/Files/admin/AdminAbout.php index 4128773e..8a135fcd 100644 --- a/class/Files/admin/AdminAbout.php +++ b/class/Files/admin/AdminAbout.php @@ -42,8 +42,8 @@ class AdminAbout extends Files\CreateFile /** * @public function constructor - * @param null */ + public function __construct() { parent::__construct(); @@ -53,7 +53,7 @@ public function __construct() /** * @static function getInstance - * @param null + * @return AdminAbout */ public static function getInstance() @@ -68,8 +68,8 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $filename + * @param $module + * @param $filename */ public function write($module, $filename) { @@ -79,8 +79,8 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { @@ -93,7 +93,7 @@ public function render() $content .= $this->getRequire(); $content .= $this->axc->getAdminTemplateMain($moduleDirname, 'about'); $content .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('about.php')"); - $content .= $this->getSimpleString("\$adminObject->setPaypal('{$moduleDonations}');"); + $content .= $this->getSimpleString("\$adminObject->setPaypal('$moduleDonations');"); $content .= $this->xc->getXcXoopsTplAssign('about', "\$adminObject->renderAbout(false)"); $content .= $this->getRequire('footer'); diff --git a/class/Files/admin/AdminFooter.php b/class/Files/admin/AdminFooter.php index f8f20769..cb5f744d 100644 --- a/class/Files/admin/AdminFooter.php +++ b/class/Files/admin/AdminFooter.php @@ -42,7 +42,6 @@ class AdminFooter extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -67,8 +66,8 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $filename + * @param $module + * @param $filename */ public function write($module, $filename): void { @@ -78,8 +77,8 @@ public function write($module, $filename): void /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { @@ -91,7 +90,7 @@ public function render() $isset = $this->pc->getPhpCodeIsset('templateMain'); $display = "\t" . $this->xc->getXcXoopsTplAssign('maintainedby', "\$helper->getConfig('maintainedby')"); $display .= "\t" . $this->xc->getXcXoopsTplDisplay(); - $content .= $this->pc->getPhpCodeConditions($isset, '', '', $display, false) . PHP_EOL; + $content .= $this->pc->getPhpCodeConditions($isset, '', '', $display) . PHP_EOL; $content .= $this->xc->getXcXoopsCPFooter(); $this->create($moduleDirname, 'admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index d22309d3..cd1825ce 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -48,7 +48,6 @@ class AdminPages extends Files\CreateFile /** * @public function constructor - * @param null */ public function __construct() { @@ -60,7 +59,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return AdminPages */ @@ -119,9 +118,9 @@ private function getAdminPagesHeader($moduleDirname, $fieldId) } $ret .= $this->xc->getXcXoopsRequest($leftOp, 'op', 'list', 'Cmd'); $ret .= $this->xc->getXcXoopsRequest($leftField, $fieldId, '', 'Int'); - $ret .= $this->xc->getXcXoopsRequest($leftStart, 'start', '', 'Int', false); + $ret .= $this->xc->getXcXoopsRequest($leftStart, 'start', '', 'Int'); $config = $this->xc->getXcGetConfig('adminpager'); - $ret .= $this->xc->getXcXoopsRequest($leftLimit, 'limit', $config, 'Int', false); + $ret .= $this->xc->getXcXoopsRequest($leftLimit, 'limit', $config, 'Int'); $ret .= $this->xc->getXcXoopsTplAssign('start', '$start'); $ret .= $this->xc->getXcXoopsTplAssign('limit', '$limit'); $ret .= $this->pc->getPhpCodeBlankLine(); @@ -131,11 +130,11 @@ private function getAdminPagesHeader($moduleDirname, $fieldId) /** * @private function getAdminPagesSwitch - * @param $cases + * @param array $cases * * @return string */ - private function getAdminPagesSwitch($cases = []) + private function getAdminPagesSwitch(array $cases = []) { $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t"); @@ -151,7 +150,7 @@ private function getAdminPagesSwitch($cases = []) * @param string $t * @return string */ - private function getAdminPagesList($moduleDirname, $table, $language, $fieldInForm, $t = '') + private function getAdminPagesList($moduleDirname, $table, $language, $fieldInForm, string $t = '') { $stuModuleDirname = \mb_strtoupper($moduleDirname); $tableName = $table->getVar('table_name'); @@ -182,7 +181,7 @@ private function getAdminPagesList($moduleDirname, $table, $language, $fieldInFo $contentForeach .= $this->pc->getPhpCodeUnset($tableSoleName, $t . "\t\t"); $condIf = $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, $t . "\t"); $condIf .= $this->xc->getXcPageNav($tableName, $t . "\t"); - $condElse = $this->xc->getXcXoopsTplAssign('error', "{$language}THEREARENT_{$stuTableName}", true, $t . "\t"); + $condElse = $this->xc->getXcXoopsTplAssign('error', "{$language}THEREARENO_{$stuTableName}", true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, $condElse, $t); return $ret; @@ -197,7 +196,7 @@ private function getAdminPagesList($moduleDirname, $table, $language, $fieldInFo * @param string $t * @return string */ - private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $language, $t = '') + private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $language, string $t = '') { $stuTableName = \mb_strtoupper($tableName); $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); @@ -224,7 +223,7 @@ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $lan * @param string $t * @return string */ - private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $fieldInForm, $fieldId, $language, $t = '') + private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $fieldInForm, $fieldId, $language, string $t = '') { $stuTableName = \mb_strtoupper($tableName); $stuTableSoleName = \mb_strtoupper($tableSoleName); @@ -240,7 +239,12 @@ private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, } $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); + + $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); + $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}Source", ' === ', '0', $contIf, false, $t); + + $ret .= $this->xc->getXcCommonPagesClone($tableName, $ccFieldId, $t, $language); return $ret; } @@ -248,11 +252,11 @@ private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, /** * @private function getPermissionsSave * @param $moduleDirname - * @param $perm + * @param string $perm * * @return string */ - private function getPermissionsSave($moduleDirname, $perm = 'view') + private function getPermissionsSave($moduleDirname, string $perm = 'view') { $ret = $this->pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); $ret .= $this->xc->getXcDeleteRight('grouppermHandler', "{$moduleDirname}_{$perm}", '$mid', '$permId', false, "\t\t\t"); @@ -276,10 +280,11 @@ private function getPermissionsSave($moduleDirname, $perm = 'view') * @param string $t * @return string */ - private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, $t = '') + private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, string $t = '') { + $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $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); @@ -289,6 +294,9 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ $contentIf = $this->xc->getXcHandlerGetObj($tableName, $ccFieldId, $t . "\t"); $contentElse = $this->xc->getXcHandlerCreateObj($tableName, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' > ', '0', $contentIf, $contentElse, $t); + $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); + $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError, false, $t); $ret .= $this->pc->getPhpCodeCommentLine('Set Vars', null, $t); $countUploader = 0; $fieldLines = ''; @@ -320,13 +328,13 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ $countUploader++; break; case Constants::FIELD_ELE_TEXTDATESELECT: - $fieldLines .= $this->xc->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t); + $fieldLines .= $this->xc->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t, $language); break; case Constants::FIELD_ELE_PASSWORD: $fieldLines .= $this->axc->getAxcSetVarPassword($tableName, $fieldName, $t); break; case Constants::FIELD_ELE_DATETIME: - $fieldLines .= $this->xc->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t); + $fieldLines .= $this->xc->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t, $language); break; default: $fieldLines .= $this->axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t); @@ -340,12 +348,12 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ $ret .= $fieldLines; $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t); $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); - $contentInsert = ''; + $ucfTableName = \ucfirst($tableName); + $ucfFieldId = $this->getCamelCase($fieldId, true); + $contentInsert = $this->xc->getXcEqualsOperator("\$saved{$ucfFieldId}", "\${$ccFieldId} > 0 ? \${$ccFieldId} : \${$tableName}Obj->getNewInsertedId{$ucfTableName}()", null, $t . "\t"); + if (1 == $tablePerms) { - $ucfTableName = \ucfirst($tableName); - $ucfFieldId = $this->getCamelCase($fieldId, true); - $contentInsert = $this->xc->getXcEqualsOperator("\$new{$ucfFieldId}", "\${$tableName}Obj->getNewInsertedId{$ucfTableName}()", null, $t . "\t"); - $contentInsert .= $this->pc->getPhpCodeTernaryOperator('permId', "isset(\$_REQUEST['{$fieldId}'])", "\${$ccFieldId}", "\$new{$ucfFieldId}", $t . "\t"); + $contentInsert .= $this->xc->getXcEqualsOperator("\$permId", "\$saved{$ucfFieldId}",'', "\t\t\t"); $contentInsert .= $this->xc->getXcXoopsHandler('groupperm', $t . "\t"); $contentInsert .= $this->xc->getXcEqualsOperator('$mid', "\$GLOBALS['xoopsModule']->getVar('mid')", null, $t . "\t"); $contentInsert .= $this->getPermissionsSave($moduleDirname, 'view_' . $tableName); @@ -353,11 +361,11 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ $contentInsert .= $this->getPermissionsSave($moduleDirname, 'approve_' . $tableName); } 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"); + $errIf = $this->xc->getXcRedirectHeader("'{$tableName}.php?op=edit&{$fieldId}=' . \$saved{$ucfFieldId}", '', '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"); } else { - $contentInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); + $contentInsert .= $this->xc->getXcRedirectHeader("'{$tableName}.php?op=list&start=' . \$start . '&limit=' . \$limit", '', '2', "{$language}FORM_OK", false, $t . "\t\t"); } $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); $ret .= $this->pc->getPhpCodeCommentLine('Get Form', null, $t); @@ -378,7 +386,7 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ * @param string $t * @return string */ - private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, $t = '') + private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $fieldInForm, string $t = '') { $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); @@ -395,7 +403,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, $ret .= $this->axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); $ret .= $this->xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); } - $ret .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t); + $ret .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t, $language); return $ret; } @@ -412,7 +420,7 @@ private function getAdminPagesEdit($moduleDirname, $table, $language, $fieldId, * @param string $t * @return string */ - private function getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, $language, $fieldId, $fieldMain, $tableNotifications, $t = '') + private function getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, $language, $fieldId, $fieldMain, $tableNotifications, string $t = '') { $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); $navigation = $this->axc->getAdminDisplayNavigation($tableName); @@ -423,9 +431,9 @@ private function getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, /** * @public function render - * @param null + * - * @return bool|string + * @return string */ public function render() { diff --git a/class/Files/admin/AdminXoopsCode.php b/class/Files/admin/AdminXoopsCode.php index 183d5951..1b94fe7f 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -38,20 +38,24 @@ class AdminXoopsCode * @var mixed */ private $pc = null; + /** + * @var mixed + */ + private $cf = null; /** * @public function constructor - * @param null */ public function __construct() { $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); } /** * @static function getInstance - * @param null + * @return AdminXoopsCode */ public static function getInstance() @@ -72,7 +76,7 @@ public static function getInstance() * @param string $t * @return string */ - public function getAdminTemplateMain($moduleDirname, $tableName, $t = '') + public function getAdminTemplateMain($moduleDirname, $tableName, string $t = '') { return "{$t}\$templateMain = '{$moduleDirname}_admin_{$tableName}.tpl';\n"; } @@ -88,7 +92,7 @@ public function getAdminTemplateMain($moduleDirname, $tableName, $t = '') * @param string $t * @return string */ - public function getAdminItemButton($language, $tableName, $stuTableSoleName, $op = '?op=new', $type = 'add', $t = '') + public function getAdminItemButton($language, $tableName, $stuTableSoleName, string $op = '?op=new', string $type = 'add', string $t = '') { $stuType = \mb_strtoupper($type); $aM = $t . '$adminObject->addItemButton('; @@ -115,7 +119,7 @@ public function getAdminItemButton($language, $tableName, $stuTableSoleName, $op * @param string $t * @return string */ - public function getAdminDisplayButton($type, $t = '') + public function getAdminDisplayButton($type, string $t = '') { return "{$t}\$adminObject->displayButton('{$type}');\n"; } @@ -128,7 +132,7 @@ public function getAdminDisplayButton($type, $t = '') * @param string $t * @return string */ - public function getAdminDisplayNavigation($tableName, $t = '') + public function getAdminDisplayNavigation($tableName, string $t = '') { return "{$t}\$adminObject->displayNavigation('{$tableName}.php')"; } @@ -140,7 +144,7 @@ public function getAdminDisplayNavigation($tableName, $t = '') * @param string $t * @return string */ - public function getAxcAddInfoBox($language, $t = '') + public function getAxcAddInfoBox($language, string $t = '') { return "{$t}\$adminObject->addInfoBox({$language});\n"; } @@ -153,7 +157,7 @@ public function getAxcAddInfoBox($language, $t = '') * @param string $t * @return string */ - public function getAxcAddInfoBoxLine($label = '', $var = '', $t = '') + public function getAxcAddInfoBoxLine(string $label = '', string $var = '', string $t = '') { $aMenu = $t . '$adminObject->addInfoBoxLine(\sprintf('; if ('' != $var) { @@ -174,7 +178,7 @@ public function getAxcAddInfoBoxLine($label = '', $var = '', $t = '') * @param string $t * @return string */ - public function getAxcAddConfigBoxLine($language, $label = '', $var = '', $t = '') + public function getAxcAddConfigBoxLine($language, string $label = '', string $var = '', string $t = '') { $aMenu = $t . '$adminObject->addConfigBoxLine('; if ('' != $var) { @@ -194,7 +198,7 @@ public function getAxcAddConfigBoxLine($language, $label = '', $var = '', $t = ' * @param int $countUploader * @return string */ - public function getAxcSetVarImageList($tableName, $fieldName, $t = '', $countUploader = 0) + public function getAxcSetVarImageList(string $tableName, string $fieldName, string $t = '', int $countUploader = 0) { $ret = $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); @@ -221,51 +225,51 @@ public function getAxcSetVarImageList($tableName, $fieldName, $t = '', $countUpl * @param string $fieldName * @param $fieldMain * @param string $t - * @param int $countUploader + * @param int $countUploader * @return string */ - public function getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, $t = '', $countUploader = 0) + public function getAxcSetVarUploadImage(string $moduleDirname, string $tableName, string $fieldName, $fieldMain, string $t = '', int $countUploader = 0) { $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ucfModuleDirname = \ucfirst($moduleDirname); + $ret = $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); - $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); + $condIf = $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t . "\t"); $file = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; - $ret .= $this->xc->getXcEqualsOperator('$filename ', $file, null, $t); + $ret .= $this->xc->getXcEqualsOperator('$filename', $file, null, $t); $mimetype = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['type']"; - $ret .= $this->xc->getXcEqualsOperator('$imgMimetype ', $mimetype, null, $t); - $ret .= $this->xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t); + $condIf .= $this->xc->getXcEqualsOperator('$imgMimetype ', $mimetype, null, $t . "\t"); + $condIf .= $this->xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t . "\t"); $xUploadImage = "\\{$stuModuleDirname}_UPLOAD_IMAGE_PATH"; - $ret .= $this->xc->getXcMediaUploader('uploader', $xUploadImage . " . '/{$tableName}/'", 'mimetypes_image', 'maxsize_image', $t); + $condIf .= $this->xc->getXcMediaUploader('uploader', $xUploadImage . " . '/{$tableName}/'", 'mimetypes_image', 'maxsize_image', $t . "\t"); + $isset = "isset(\$_POST['xoops_upload_file'][" . $countUploader . '])'; $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 .= $t . "\t\$imgName = \str_replace(' ', '', \$imgNameDef) . '.' . \$extension;\n"; - $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; - $ifelse .= $t . "\t{$fetchMedia};\n"; - $contIf = $this->xc->getXcEqualsOperator('$savedFilename', '$uploader->getSavedFileName()', null, $t . "\t\t"); + $ifelse = $this->xc->getXcEqualsOperator('$extension', '\pathinfo($filename, \PATHINFO_EXTENSION)',null, $t . "\t\t"); + $ifelse .= $this->xc->getXcEqualsOperator('$imgName', "\str_replace(' ', '', \$imgNameDef) . '.' . \$extension", null,$t . "\t\t"); + $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t\t") . ";\n"; + $contIf = $this->xc->getXcEqualsOperator('$savedFilename', '$uploader->getSavedFileName()', null, $t . "\t\t\t"); $config = $this->xc->getXcGetConfig('maxwidth_image'); - $contIf .= $this->xc->getXcEqualsOperator('$maxwidth ', "(int){$config}", null, $t . "\t\t"); + $contIf .= $this->xc->getXcEqualsOperator('$maxwidth ', "(int){$config}", null, $t . "\t\t\t"); $config = $this->xc->getXcGetConfig('maxheight_image'); - $contIf .= $this->xc->getXcEqualsOperator('$maxheight', "(int){$config}", null, $t . "\t\t"); + $contIf .= $this->xc->getXcEqualsOperator('$maxheight', "(int){$config}", null, $t . "\t\t\t"); $resizer = $this->pc->getPhpCodeCommentLine('Resize image', '', $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler ', "new {$ucfModuleDirname}\Common\Resizer()", null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->sourceFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->endFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->imageMimetype', '$imgMimetype', null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxWidth ', '$maxwidth', null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxHeight ', '$maxheight', null, $t . "\t\t\t"); - $resizer .= $this->xc->getXcEqualsOperator('$result ', '$imgHandler->resizeImage()', null, $t . "\t\t\t"); - $contIf .= $this->pc->getPhpCodeConditions('$maxwidth > 0 && $maxheight > 0', '', '', $resizer, false, $t . "\t\t"); - $contIf .= $this->xc->getXcSetVarObj($tableName, $fieldName, '$savedFilename', $t . "\t\t"); - $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->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - - $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler ', "new Common\Resizer()", null, $t . "\t\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->sourceFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->endFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->imageMimetype', '$imgMimetype', null, $t . "\t\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxWidth ', '$maxwidth', null, $t . "\t\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$imgHandler->maxHeight ', '$maxheight', null, $t . "\t\t\t\t"); + $resizer .= $this->xc->getXcEqualsOperator('$result ', '$imgHandler->resizeImage()', null, $t . "\t\t\t\t"); + $contIf .= $this->pc->getPhpCodeConditions('$maxwidth > 0 && $maxheight > 0', '', '', $resizer, false, $t . "\t\t\t"); + $contIf .= $this->xc->getXcSetVarObj($tableName, $fieldName, '$savedFilename', $t . "\t\t\t"); + $contElseInt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
    ' . \$uploader->getErrors()", '.', $t . "\t\t\t"); + $ifelse .= $this->pc->getPhpCodeConditions('$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t\t"); + $ifelseExt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
    ' . \$uploader->getErrors()", '.', $t . "\t\t\t"); + $contElseExt = $this->pc->getPhpCodeConditions('$filename', ' > ', "''", $ifelseExt, false, $t . "\t\t"); + $contElseExt .= $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t\t"); + $condIf .= $this->pc->getPhpCodeConditions($isset . ' && ' . $fetchMedia, '', '', $ifelse, $contElseExt, $t . "\t"); + $condElse = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("'' !== (string)\$filename", '', '', $condIf, $condElse, $t); return $ret; } @@ -275,18 +279,16 @@ public function getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, * @param $moduleDirname * @param $tableName * @param $fieldName - * @param bool $formatUrl + * @param bool $formatUrl * @param string $t - * @param int $countUploader + * @param int $countUploader * @param string $fieldMain * @return string */ - public function getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, $formatUrl = false, $t = '', $countUploader = 0, $fieldMain = '') + public function getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, bool $formatUrl = false, string $t = '', int $countUploader = 0, string $fieldMain = '') { $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->getAxcSetVarImageFile('\\' . $stuModuleDirname . '_UPLOAD_FILES_PATH', $tableName, $fieldName, $formatUrl, $t, $countUploader, $fieldMain, 'mimetypes_file', 'maxsize_file'); - - return $ret; + return $this->getAxcSetVarImageFile('\\' . $stuModuleDirname . '_UPLOAD_FILES_PATH', $tableName, $fieldName, $formatUrl, $t, $countUploader, $fieldMain, 'mimetypes_file', 'maxsize_file'); } /** @@ -302,35 +304,45 @@ public function getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, $ * @param string $maxsize * @return string */ - private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $formatUrl = false, $t = '', $countUploader = 0, $fieldMain = '', $mimetype = 'mimetypes_image', $maxsize = 'maxsize_image') + private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, bool $formatUrl = false, string $t = '', int $countUploader = 0, string $fieldMain = '', string $mimetype = 'mimetypes_image', string $maxsize = 'maxsize_image') { $ret = ''; $files = ''; + $rpFieldName = '$' . $this->cf->getCamelCase($fieldName, false, true); + if ($formatUrl) { - $ret .= $this->xc->getXcSetVarObj($tableName, $fieldName, "formatURL(\$_REQUEST['{$fieldName}'])", $t); + $ret .= $this->xc->getXcEqualsOperator($rpFieldName, "formatURL((string)(\$_REQUEST['{$fieldName}'] ?? ''))", null, $t); } $ret .= $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); - $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); $file = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; - $ret .= $this->xc->getXcEqualsOperator('$filename ', $file, null, $t); - $ret .= $this->xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t); - $ret .= $this->xc->getXcMediaUploader('uploader', $dirname . " . '/{$tableName}{$files}/'", $mimetype, $maxsize, $t); + $ret .= $this->xc->getXcEqualsOperator('$filename', $file, null, $t); + $condIf = $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t . "\t"); + $condIf .= $this->xc->getXcEqualsOperator('$imgNameDef', "Request::getString('{$fieldMain}')", null, $t . "\t"); + $condIf .= $this->xc->getXcMediaUploader('uploader', $dirname . " . '/{$tableName}{$files}/'", $mimetype, $maxsize, $t . "\t"); + $isset = "isset(\$_POST['xoops_upload_file'][" . $countUploader . '])'; $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 .= $t . "\t\$imgName = \str_replace(' ', '', \$imgNameDef) . '.' . \$extension;\n"; - $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t") . ";\n"; - $ifelse .= $t . "\t{$fetchMedia};\n"; - $contIf = $this->xc->getXcSetVarObj($tableName, $fieldName, '$uploader->getSavedFileName()', $t . "\t\t"); - $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->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - - $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); + $ifelse = $this->xc->getXcEqualsOperator('$extension', '\pathinfo($filename, \PATHINFO_EXTENSION)',null, $t . "\t\t"); + $ifelse .= $this->xc->getXcEqualsOperator('$imgName', "\str_replace(' ', '', \$imgNameDef) . '.' . \$extension", null,$t . "\t\t"); + $ifelse .= $this->getAxcSetPrefix('uploader', '$imgName', $t . "\t\t") . ";\n"; + $contIf = $this->xc->getXcSetVarObj($tableName, $fieldName, '$uploader->getSavedFileName()', $t . "\t\t\t"); + $contElseInt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
    ' . \$uploader->getErrors()", '.', $t . "\t\t\t"); + $ifelse .= $this->pc->getPhpCodeConditions('$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t\t"); + $ifelseExt = $this->xc->getXcEqualsOperator('$uploaderErrors', "'
    ' . \$uploader->getErrors()", '.', $t . "\t\t\t"); + $contElseExt = $this->pc->getPhpCodeConditions('$filename', ' > ', "''", $ifelseExt, false, $t . "\t\t"); + if ($formatUrl) { + $contElseExt .= $this->xc->getXcSetVarObj($tableName, $fieldName, $rpFieldName, $t . "\t\t"); + } else { + $contElseExt .= $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t\t"); + } + $condIf.= $this->pc->getPhpCodeConditions($isset . ' && ' . $fetchMedia, '', '', $ifelse, $contElseExt, $t . "\t"); + if ($formatUrl) { + $condElse= $this->xc->getXcSetVarObj($tableName, $fieldName, $rpFieldName, $t . "\t"); + } else { + $condElse = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); + } + $ret .= $this->pc->getPhpCodeConditions("'' !== (string)\$filename", '', '', $condIf, $condElse, $t); return $ret; } @@ -342,7 +354,7 @@ private function getAxcSetVarImageFile($dirname, $tableName, $fieldName, $format * @param string $t * @return string */ - public function getAxcSetVarPassword($tableName, $fieldName, $t = '') + public function getAxcSetVarPassword($tableName, $fieldName, string $t = '') { $cf = Modulebuilder\Files\CreateFile::getInstance(); $ccFieldId = $cf->getCamelCase($fieldName, false, true); @@ -362,7 +374,7 @@ public function getAxcSetVarPassword($tableName, $fieldName, $t = '') * @param string $t * @return string */ - public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t = '') + public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, string $t = '') { switch ((int)$fieldType){ case 2: @@ -407,7 +419,7 @@ public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldEleme * @param string $t * @return string */ - public function getAxcFetchMedia($anchor, $var, $t = '') + public function getAxcFetchMedia($anchor, $var, string $t = '') { return "{$t}\${$anchor}->fetchMedia({$var})"; } @@ -421,7 +433,7 @@ public function getAxcFetchMedia($anchor, $var, $t = '') * @param string $t * @return string */ - public function getAxcSetPrefix($anchor, $var, $t = '') + public function getAxcSetPrefix($anchor, $var, string $t = '') { return "{$t}\${$anchor}->setPrefix({$var})"; } diff --git a/class/Form/FormRadio.php b/class/Form/FormRadio.php index 23bef86c..df10ea43 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -31,8 +31,8 @@ public function render() { $ret = ''; $ele_name = $this->getName(); - $ele_title = (string)$this->getTitle(); - $ele_value = (string)$this->getValue(); + $ele_title = $this->getTitle(); + $ele_value = $this->getValue(); $ele_options = $this->getOptions(); $ele_extra = $this->getExtra(); $ele_delimeter = empty($this->columns) ? $this->getDelimeter() : ''; diff --git a/class/Form/FormRaw.php b/class/Form/FormRaw.php index 221feef4..35dfc1e1 100644 --- a/class/Form/FormRaw.php +++ b/class/Form/FormRaw.php @@ -34,7 +34,7 @@ class FormRaw extends \XoopsFormElement * * @param string $value value */ - public function __construct($value = '') + public function __construct(string $value = '') { $this->setValue($value); } diff --git a/class/Form/FormTab.php b/class/Form/FormTab.php index 03420d21..53369760 100644 --- a/class/Form/FormTab.php +++ b/class/Form/FormTab.php @@ -50,7 +50,6 @@ 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 5198a0a9..fae47ebb 100644 --- a/class/Form/FormTabTray.php +++ b/class/Form/FormTabTray.php @@ -48,7 +48,7 @@ class FormTabTray extends \XoopsFormElementTray * @param string $uiTheme Theme to use for jquery UI (remove? now set by theme) * @param string $delimiter delimiter */ - public function __construct($caption, $name, $uiTheme = 'base', $delimiter = ' ') + public function __construct($caption, $name, $uiTheme = 'base', string $delimiter = ' ') { $this->setName($name); $this->setCaption($caption); diff --git a/class/Form/ThemeForm.php b/class/Form/ThemeForm.php index a87c5ac4..3a37ca3b 100644 --- a/class/Form/ThemeForm.php +++ b/class/Form/ThemeForm.php @@ -51,7 +51,7 @@ public function render() //$ret = ($this->getTitle() ? '
    ' . $this->getTitle() . '
    ' : ''); $ret = NWLINE . 'getExtra() . '>' . NWLINE; $hidden = ''; - $class = 'even'; + //$class = 'even'; foreach ($this->getElements() as $ele) { if (!is_object($ele)) { $ret .= $ele; @@ -64,7 +64,7 @@ public function render() } } $ret .= NWLINE . ' ' . $hidden . NWLINE . ''; - $ret .= $this->renderValidationJS(true); + $ret .= $this->renderValidationJS(); return $ret; } diff --git a/class/Helper.php b/class/Helper.php index 613be9b3..090b8897 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -42,7 +42,7 @@ public function __construct($debug = false) * * @return \XoopsModules\Modulebuilder\Helper */ - public static function getInstance($debug = false) + public static function getInstance(bool $debug = false) { static $instance; if (null === $instance) { diff --git a/class/Html/FormLabel.php b/class/Html/FormLabel.php index f9940d98..af6ea50a 100644 --- a/class/Html/FormLabel.php +++ b/class/Html/FormLabel.php @@ -29,7 +29,7 @@ class FormLabel extends \XoopsFormElement /** * @param string $caption */ - public function __construct($caption = '') + public function __construct(string $caption = '') { $this->setCaption($caption); } diff --git a/class/Import.php b/class/Import.php index b279f368..54a084b3 100644 --- a/class/Import.php +++ b/class/Import.php @@ -74,7 +74,7 @@ public static function importModule(): array if ($modulesHandler->insert($newModuleObj)) { // get the ID of the new module $criteria = new \Criteria('mod_name', $moduleNewName); - $moduleObject = $modulesHandler->getObjects($criteria, false, true); + $moduleObject = $modulesHandler->getObjects($criteria); $moduleId = $moduleObject[0]->getVar('mod_id'); $tables = self::importTables($moduleId, $moduleName); if (null === $tables) { @@ -258,7 +258,7 @@ public static function importTables($moduleId, $moduleName): ?array * * @return array */ - public static function importFields($tableName) + public static function importFields(string $tableName) { $table = $GLOBALS['xoopsDB']->prefix((string)$tableName); $sql = 'SHOW COLUMNS FROM ' . $table; diff --git a/class/Logo.php b/class/Logo.php index 2cf921ad..64165fa5 100644 --- a/class/Logo.php +++ b/class/Logo.php @@ -128,7 +128,7 @@ public static function createLogo($logoIcon, $moduleDirname) // Write text $textColor = imagecolorallocate($imageModule, 0, 0, 0); $spaceToBorder = (92 - mb_strlen($moduleDirname) * 7.5) / 2; - imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($moduleDirname), []); + imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($moduleDirname)); imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32); diff --git a/class/LogoGenerator.php b/class/LogoGenerator.php index 10974a58..b2449770 100644 --- a/class/LogoGenerator.php +++ b/class/LogoGenerator.php @@ -28,7 +28,7 @@ /** * @param string $val */ -function phpFunction($val = ''): void +function phpFunction(string $val = ''): void { // create php function here echo $val; @@ -86,7 +86,7 @@ public static function createLogo($logoIcon, $moduleName) // Write text $textColor = imagecolorallocate($imageModule, 0, 0, 0); $spaceToBorder = (int)\floor((92 - mb_strlen($moduleName) * 7.5) / 2); - imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, $moduleName, []); + imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, $moduleName); imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32); diff --git a/class/Modules.php b/class/Modules.php index cf4e6a48..230ef42e 100644 --- a/class/Modules.php +++ b/class/Modules.php @@ -46,7 +46,6 @@ class Modules extends \XoopsObject /** * @public function constructor class - * @param null */ public function __construct() { @@ -97,11 +96,11 @@ public function __construct() /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { $arg = $args[0] ?? null; @@ -110,7 +109,6 @@ public function __call($method, $args) /** * @static function getInstance - * @param null * @return Modules */ public static function getInstance() @@ -179,7 +177,7 @@ public function getFormModules($action = false) } $isNew = $this->isNew(); - $title = $isNew ? \sprintf(\_AM_MODULEBUILDER_MODULE_NEW) : \sprintf(\_AM_MODULEBUILDER_MODULE_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_MODULE_NEW : \_AM_MODULEBUILDER_MODULE_EDIT; require_once \XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; @@ -362,7 +360,7 @@ public function getFormModules($action = false) * * @return bool|string */ - private static function createLogo($logoIcon, $moduleDirname) + private static function createLogo($logoIcon, string $moduleDirname) { if (!\extension_loaded('gd')) { return false; @@ -384,7 +382,7 @@ private static function createLogo($logoIcon, $moduleDirname) // Write text $textColor = imagecolorallocate($imageModule, 0, 0, 0); $spaceBorder = (92 - mb_strlen($moduleDirname) * 7.5) / 2; - imagefttext($imageModule, 8.5, 0, $spaceBorder, 45, $textColor, $font, \ucfirst($moduleDirname), []); + imagefttext($imageModule, 8.5, 0, $spaceBorder, 45, $textColor, $font, \ucfirst($moduleDirname)); imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32); $logoImg = '/' . 'logoModule.png'; \imagepng($imageModule, TDMC_UPLOAD_IMGMOD_PATH . $logoImg); diff --git a/class/ModulesHandler.php b/class/ModulesHandler.php index b25656c9..955ed9be 100644 --- a/class/ModulesHandler.php +++ b/class/ModulesHandler.php @@ -52,21 +52,20 @@ public function create($isNew = true) /** * retrieve a field. * - * @param int $i field id + * @param int $id field id * @param null $fields * - * @return mixed reference to the Fields object + * @return \XoopsObject|null reference to the Fields object * object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** * get inserted id. * - * @param null * * @return int reference to the {@link Tables} object */ @@ -78,14 +77,14 @@ public function getInsertId() /** * Get Count Modules. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return int */ - public function getCountModules($start = 0, $limit = 0, $sort = 'mod_id', $order = 'DESC') + public function getCountModules(int $start = 0, int $limit = 0, string $sort = 'mod_id', string $order = 'DESC') { $crCountModules = new \CriteriaCompo(); $crCountModules = $this->getModulesCriteria($crCountModules, $start, $limit, $sort, $order); @@ -96,14 +95,14 @@ public function getCountModules($start = 0, $limit = 0, $sort = 'mod_id', $order /** * Get All Modules. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return array */ - public function getAllModules($start = 0, $limit = 0, $sort = 'mod_id', $order = 'DESC') + public function getAllModules(int $start = 0, int $limit = 0, string $sort = 'mod_id', string $order = 'DESC') { $crAllModules = new \CriteriaCompo(); $crAllModules = $this->getModulesCriteria($crAllModules, $start, $limit, $sort, $order); diff --git a/class/Morefiles.php b/class/Morefiles.php index 65d13d05..79d925b1 100644 --- a/class/Morefiles.php +++ b/class/Morefiles.php @@ -39,7 +39,6 @@ class Morefiles extends \XoopsObject /** * @public function constructor class * - * @param null */ public function __construct() { @@ -54,11 +53,11 @@ public function __construct() /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { $arg = $args[0] ?? null; @@ -68,7 +67,6 @@ public function __call($method, $args) /** * @static function getInstance * - * @param null * * @return Morefiles */ @@ -96,7 +94,7 @@ public function getFormMorefiles($action = false) } $isNew = $this->isNew(); - $title = $isNew ? \sprintf(\_AM_MODULEBUILDER_MORE_FILES_NEW) : \sprintf(\_AM_MODULEBUILDER_MORE_FILES_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_MORE_FILES_NEW : \_AM_MODULEBUILDER_MORE_FILES_EDIT; \xoops_load('XoopsFormLoader'); @@ -137,7 +135,7 @@ public function getFormMorefiles($action = false) $fileSelect->addOption("{$file1}", $file1); } } - $fileTray->addElement($fileSelect, false); + $fileTray->addElement($fileSelect); $form->addElement($fileTray); $fileInfolder = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); diff --git a/class/MorefilesHandler.php b/class/MorefilesHandler.php index 74ecac64..9fffe629 100644 --- a/class/MorefilesHandler.php +++ b/class/MorefilesHandler.php @@ -52,21 +52,20 @@ public function create($isNew = true) /** * retrieve a field. * - * @param int $i field id + * @param int $id field id * @param null $fields * - * @return mixed reference to the Fields object + * @return \XoopsObject|null reference to the Fields object * object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** * get inserted id. * - * @param null * * @return int reference to the {@link Tables} object */ @@ -78,14 +77,14 @@ public function getInsertId() /** * Get Count Morefiles. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return int */ - public function getCountMorefiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') + public function getCountMorefiles(int $start = 0, int $limit = 0, string $sort = 'file_id ASC, file_name', string $order = 'ASC') { $crMorefilesCount = new \CriteriaCompo(); $crMorefilesCount = $this->getMorefilesCriteria($crMorefilesCount, $start, $limit, $sort, $order); @@ -96,14 +95,14 @@ public function getCountMorefiles($start = 0, $limit = 0, $sort = 'file_id ASC, /** * Get All Morefiles. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return array */ - public function getAllMorefiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') + public function getAllMorefiles(int $start = 0, int $limit = 0, string $sort = 'file_id ASC, file_name', string $order = 'ASC') { $crMorefilesAdd = new \CriteriaCompo(); $crMorefilesAdd = $this->getMorefilesCriteria($crMorefilesAdd, $start, $limit, $sort, $order); @@ -115,14 +114,14 @@ public function getAllMorefiles($start = 0, $limit = 0, $sort = 'file_id ASC, fi * Get All Morefiles By Module Id. * * @param $modId - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return array */ - public function getAllMorefilesByModuleId($modId, $start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') + public function getAllMorefilesByModuleId($modId, int $start = 0, int $limit = 0, string $sort = 'file_id ASC, file_name', string $order = 'ASC') { $crMorefilesByModuleId = new \CriteriaCompo(); $crMorefilesByModuleId->add(new \Criteria('file_mid', $modId)); diff --git a/class/Session.php b/class/Session.php index 27cb300e..74e87881 100644 --- a/class/Session.php +++ b/class/Session.php @@ -68,7 +68,7 @@ public static function getInstance() * @param string $name name of variable * @param mixed $value value of variable */ - public function setSession($name, $value): void + public function setSession(string $name, $value): void { $_SESSION[$name] = $value; } @@ -80,7 +80,7 @@ public function setSession($name, $value): void * * @return mixed value of session variable */ - public function getSession($name) + public function getSession(string $name) { if (isset($_SESSION[$name])) { return $_SESSION[$name]; @@ -94,7 +94,7 @@ public function getSession($name) * * @param string $name name of variable */ - public function deleteSession($name): void + public function deleteSession(string $name): void { unset($_SESSION[$name]); } diff --git a/class/Settings.php b/class/Settings.php index 1ad122b6..7386dbac 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -52,7 +52,6 @@ class Settings extends \XoopsObject /** * @public function constructor class * - * @param null */ public function __construct() { @@ -101,11 +100,11 @@ public function __construct() /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { $arg = $args[0] ?? null; @@ -115,7 +114,6 @@ public function __call($method, $args) /** * @static function getInstance * - * @param null * * @return Settings */ @@ -143,7 +141,7 @@ public function getFormSettings($action = false) } $isNew = $this->isNew(); - $title = $isNew ? \sprintf(\_AM_MODULEBUILDER_SETTING_NEW) : \sprintf(\_AM_MODULEBUILDER_SETTING_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_SETTING_NEW : \_AM_MODULEBUILDER_SETTING_EDIT; require_once \XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; diff --git a/class/SettingsHandler.php b/class/SettingsHandler.php index 1a7fbead..6589408c 100644 --- a/class/SettingsHandler.php +++ b/class/SettingsHandler.php @@ -49,21 +49,20 @@ public function create($isNew = true) /** * retrieve a field. * - * @param int $i field id + * @param int $id field id * @param null $fields * - * @return mixed reference to the Settings object + * @return \XoopsObject|null reference to the Settings object * object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** * get inserted id. * - * @param null * * @return int reference to the {@link Tables} object */ @@ -75,14 +74,14 @@ public function getInsertId() /** * Get Count Settings. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return int */ - public function getCountSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_name', $order = 'ASC') + public function getCountSettings(int $start = 0, int $limit = 0, string $sort = 'set_id ASC, set_name', string $order = 'ASC') { $crCountSettings = new \CriteriaCompo(); $crCountSettings = $this->getSettingsCriteria($crCountSettings, $start, $limit, $sort, $order); @@ -93,14 +92,14 @@ public function getCountSettings($start = 0, $limit = 0, $sort = 'set_id ASC, se /** * Get All Settings. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return array */ - public function getAllSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_name', $order = 'ASC') + public function getAllSettings(int $start = 0, int $limit = 0, string $sort = 'set_id ASC, set_name', string $order = 'ASC') { $crAllSettings = new \CriteriaCompo(); $crAllSettings = $this->getSettingsCriteria($crAllSettings, $start, $limit, $sort, $order); diff --git a/class/SplClassLoader.php b/class/SplClassLoader.php index 210c7f75..29ca1d9f 100644 --- a/class/SplClassLoader.php +++ b/class/SplClassLoader.php @@ -49,10 +49,10 @@ class SplClassLoader * Creates a new SplClassLoader that loads classes of the * specified namespace. * - * @param string $ns The namespace to use + * @param string|null $ns The namespace to use * @param null $includePath */ - public function __construct($ns = null, $includePath = null) + public function __construct(string $ns = null, $includePath = null) { $this->_namespace = $ns; $this->_includePath = $includePath; @@ -63,7 +63,7 @@ public function __construct($ns = null, $includePath = null) * * @param string $sep The separator to use */ - public function setNamespaceSeparator($sep): void + public function setNamespaceSeparator(string $sep): void { $this->_namespaceSeparator = $sep; } @@ -81,7 +81,7 @@ public function getNamespaceSeparator() * * @param string $includePath */ - public function setIncludePath($includePath): void + public function setIncludePath(string $includePath): void { $this->_includePath = $includePath; } @@ -89,7 +89,7 @@ public function setIncludePath($includePath): void /** * Gets the base include path for all class files in the namespace of this class loader. * - * @return string + * @return string|null */ public function getIncludePath() { @@ -101,7 +101,7 @@ public function getIncludePath() * * @param string $fileExtension */ - public function setFileExtension($fileExtension): void + public function setFileExtension(string $fileExtension): void { $this->_fileExtension = $fileExtension; } @@ -137,7 +137,7 @@ public function unregister(): void * * @param string $className The name of the class to load */ - public function loadClass($className): void + public function loadClass(string $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 94a3ec52..a9cd9340 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -58,7 +58,6 @@ class Tables extends \XoopsObject /** * @public function constructor class - * @param null */ public function __construct() { @@ -96,11 +95,11 @@ public function __construct() /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { $arg = $args[0] ?? null; @@ -109,7 +108,6 @@ public function __call($method, $args) /** * @static function getInstance - * @param null * @return Tables */ public static function getInstance() @@ -137,7 +135,7 @@ public function getFormTables($action = false) $isNew = $this->isNew(); $tableName = $this->getVar('table_name'); $tableMid = $this->getVar('table_mid'); - $title = $isNew ? \sprintf(\_AM_MODULEBUILDER_TABLES_NEW) : \sprintf(\_AM_MODULEBUILDER_TABLES_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_TABLES_NEW : \_AM_MODULEBUILDER_TABLES_EDIT; \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'tableform', $action, 'post', true); @@ -196,7 +194,7 @@ public function getFormTables($action = false) $imageSelect1->addOption($image1, $image1); } $imageSelect1->setExtra("onchange='showImgSelected(\"image1\", \"table_image\", \"" . $iconsDirectory . '", "", "' . \XOOPS_URL . "\")'"); - $imgtray1->addElement($imageSelect1, false); + $imgtray1->addElement($imageSelect1); $imgtray1->addElement(new \XoopsFormLabel('', "
    ")); $fileseltray1 = new \XoopsFormElementTray('', '
    '); $fileseltray1->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); diff --git a/class/TablesHandler.php b/class/TablesHandler.php index 54d6bd4f..da9d9fb2 100644 --- a/class/TablesHandler.php +++ b/class/TablesHandler.php @@ -54,21 +54,20 @@ public function create($isNew = true) /** * retrieve a field. * - * @param int $i field id + * @param int $id field id * @param null $fields * - * @return mixed reference to the Fields object + * @return \XoopsObject|null reference to the Fields object * object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** * get inserted id. * - * @param null * * @return int reference to the {@link Tables} object */ @@ -80,14 +79,14 @@ public function getInsertId() /** * Get Count Modules. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return int */ - public function getCountTables($start = 0, $limit = 0, $sort = 'table_id ASC, table_name', $order = 'ASC') + public function getCountTables(int $start = 0, int $limit = 0, string $sort = 'table_id ASC, table_name', string $order = 'ASC') { $crCountTables = new \CriteriaCompo(); $crCountTables = $this->getTablesCriteria($crCountTables, $start, $limit, $sort, $order); @@ -98,14 +97,14 @@ public function getCountTables($start = 0, $limit = 0, $sort = 'table_id ASC, ta /** * Get All Modules. * - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return array */ - public function getAllTables($start = 0, $limit = 0, $sort = 'table_mid DESC, table_order ASC, table_id', $order = 'DESC') + public function getAllTables(int $start = 0, int $limit = 0, string $sort = 'table_mid DESC, table_order ASC, table_id', string $order = 'DESC') { $crAllTables = new \CriteriaCompo(); $crAllTables = $this->getTablesCriteria($crAllTables, $start, $limit, $sort, $order); @@ -117,14 +116,14 @@ public function getAllTables($start = 0, $limit = 0, $sort = 'table_mid DESC, ta * Get All Tables By Module Id. * * @param $modId - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * * @return array */ - public function getAllTablesByModuleId($modId, $start = 0, $limit = 0, $sort = 'table_order ASC, table_id, table_name', $order = 'ASC') + public function getAllTablesByModuleId($modId, int $start = 0, int $limit = 0, string $sort = 'table_order ASC, table_id, table_name', string $order = 'ASC') { $crAllTablesByModuleId = new \CriteriaCompo(); $crAllTablesByModuleId->add(new \Criteria('table_mid', $modId)); diff --git a/class/Utility.php b/class/Utility.php index 20f7ade0..18781adb 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -71,17 +71,15 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; 5 => '', ]; for ($key = 0; $key <= 4; ++$key) { - switch ($key) { - case 2: - $donationform[$key] = \sprintf( - $donationform[$key], - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), - $GLOBALS['xoopsUser']->getVar('email'), - \XOOPS_LICENSE_KEY, - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') - ); - break; + if ($key == 2) { + $donationform[$key] = \sprintf( + $donationform[$key], + $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), + $GLOBALS['xoopsUser']->getVar('email'), + \XOOPS_LICENSE_KEY, + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') + ); } } $aboutRes = ''; diff --git a/class/autoload.php b/class/autoload.php index f7a4aab4..e8086d34 100644 --- a/class/autoload.php +++ b/class/autoload.php @@ -39,7 +39,7 @@ function application_autoloader($class): void $classFilename = $class . '.php'; $cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache'; if (!\is_dir($cachePath)) { - if (!\mkdir($cachePath, 0777) && !\is_dir($cachePath)) { + if (!\mkdir($cachePath) && !\is_dir($cachePath)) { throw new \RuntimeException(\sprintf('Directory "%s" was not created', $cachePath)); } chmod($cachePath, 0777); diff --git a/xoops_version.php b/xoops_version.php index 465f6584..11b4dd0c 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -25,9 +25,9 @@ $moduleDirName = \basename(__DIR__); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -$modversion['version'] = '3.7.0'; +$modversion['version'] = '3.7.1'; $modversion['module_status'] = 'Alpha'; -$modversion['release_date'] = '2023/07/06'; // format: yyyy/mm/dd +$modversion['release_date'] = '2026/04/05'; // format: yyyy/mm/dd $modversion['name'] = \_MI_MODULEBUILDER_NAME; $modversion['description'] = \_MI_MODULEBUILDER_DESC; $modversion['author'] = 'Xoops TDM'; @@ -54,8 +54,8 @@ $modversion['targetdir'] = XOOPS_UPLOAD_PATH . "/{$moduleDirName}/repository/"; $modversion['module_website_url'] = 'https://github.com/XoopsModules25x/modulebuilder'; $modversion['module_website_name'] = 'GitHub Xoops'; -$modversion['min_php'] = '7.4'; -$modversion['min_xoops'] = '2.5.11-RC2'; +$modversion['min_php'] = '8.3'; +$modversion['min_xoops'] = '2.5.11'; $modversion['min_admin'] = '1.2'; $modversion['min_db'] = ['mysql' => '5.5']; //about From be917c6d87e73308f8faa720725b31b3c79ef33d Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Tue, 7 Apr 2026 20:05:41 +0200 Subject: [PATCH 256/266] corrections coderabbigtai 1 --- class/Building.php | 4 ++-- class/Common/DirectoryChecker.php | 11 +++++----- class/Common/FileChecker.php | 22 +++++++++---------- class/Common/Migrate.php | 2 +- class/Common/TableChecker.php | 2 +- class/Common/VersionChecks.php | 2 +- class/Devtools.php | 17 +++++++------- class/Files/Admin/AdminBroken.php | 4 ++-- class/Files/Admin/AdminPermissions.php | 2 +- class/Files/Blocks/BlocksFiles.php | 2 +- class/Files/Classes/ClassFiles.php | 2 +- class/Files/CreateClone.php | 17 ++++++++++---- class/Files/CreatePhpCode.php | 17 +++++--------- class/Files/CreateStructure.php | 20 +++++++++-------- class/Files/CreateXoopsCode.php | 17 +++++--------- class/Files/Includes/IncludeNotifications.php | 8 +++---- class/Files/Language/LanguageHelp.php | 2 +- class/Files/Sql/SqlFile.php | 2 +- .../Templates/Admin/TemplatesAdminBroken.php | 2 +- .../Templates/User/Defstyle/Categories.php | 4 ++-- .../Templates/User/Defstyle/MoreFiles.php | 2 +- .../Templates/User/Defstyle/PagesItem.php | 4 ++-- .../Templates/User/Defstyle/PagesList.php | 2 +- class/Files/User/UserIndex.php | 4 ++-- class/Files/User/UserPages.php | 2 +- class/Files/User/UserPdf.php | 4 ++-- class/Files/User/UserRate.php | 6 ++--- class/Files/admin/AdminPages.php | 4 ++-- class/Form/FormRadio.php | 4 ++-- class/Helper.php | 2 +- class/LogoGenerator.php | 4 +++- class/Modules.php | 2 +- class/SplClassLoader.php | 4 ++-- class/Utility.php | 2 +- 34 files changed, 102 insertions(+), 103 deletions(-) diff --git a/class/Building.php b/class/Building.php index eaf07224..5bd7f965 100644 --- a/class/Building.php +++ b/class/Building.php @@ -46,11 +46,11 @@ public static function getInstance() } /** - * @param bool $action + * @param string|bool $action * * @return \XoopsThemeForm */ - public function getForm(bool $action = false) + public function getForm(string|bool $action = false) { $helper = Modulebuilder\Helper::getInstance(); if (false === $action) { diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 5ad1d848..4aeb0f0f 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -134,12 +134,11 @@ public static function dirExists($dir_path) $op = Request::getString('op', '', 'POST'); switch ($op) { case 'createdir': - if (\Xmf\Request::hasVar('path', 'POST')) { - $path = $_POST['path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; + if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST')) { + break; } + $path = $_POST['path']; + $redirect = $_POST['redirect']; $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED'); \redirect_header($redirect, 2, $msg . ': ' . $path); break; @@ -153,7 +152,7 @@ public static function dirExists($dir_path) if (\Xmf\Request::hasVar('mode', 'POST')) { $mode = $_POST['mode']; } - $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); + $msg = DirectoryChecker::setDirectoryPermissions($path, (int)$mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); \redirect_header($redirect, 2, $msg . ': ' . $path); break; } diff --git a/class/Common/FileChecker.php b/class/Common/FileChecker.php index 638475fa..c05e0e1a 100644 --- a/class/Common/FileChecker.php +++ b/class/Common/FileChecker.php @@ -38,11 +38,12 @@ class FileChecker { /** * @param string $file_path - * @param string|null $original_file_path * @param string $redirectFile + * @param string|null $original_file_path + * * @return bool|string */ - public static function getFileStatus(string $file_path, string $original_file_path = null, string $redirectFile) + public static function getFileStatus(string $file_path, string $redirectFile, string $original_file_path = null) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -145,15 +146,14 @@ public static function setFilePermissions($target, int $mode = 0777) $op = Request::getString('op', '', 'POST'); if ($op == 'copyfile') { - if (\Xmf\Request::hasVar('original_file_path', 'POST')) { - $original_file_path = $_POST['original_file_path']; - } - if (\Xmf\Request::hasVar('file_path', 'POST')) { - $file_path = $_POST['file_path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; - } + if (!\Xmf\Request::hasVar('original_file_path', 'POST') + || !\Xmf\Request::hasVar('file_path', 'POST') + || !\Xmf\Request::hasVar('redirect', 'POST')) { + return; + } + $original_file_path = $_POST['original_file_path']; + $file_path = $_POST['file_path']; + $redirect = $_POST['redirect']; $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); \redirect_header($redirect, 2, $msg . ': ' . $file_path); } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index d56fc374..c570a58b 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -58,7 +58,7 @@ private function changePrefix(): void * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses(string $tableName, string $columnName): void + protected function convertIPAddresses(string $tableName, string $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index 5bf140a6..9fe70478 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -71,7 +71,7 @@ public function processSQL() if ($numRows) { //table exist $this->result[] = 'Table exist:' . $table; - //$ret = $this->checkTableFields($table, $tabledef['fields']); + $this->checkTableFields($table, $tabledef['fields']); } else { if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) { // create new table diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index fa19754f..a18c6f28 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } $success = true; - if ($module->versionCompare($currentVer, $requiredVer)) { + if ($module->versionCompare($currentVer, $requiredVer, '<')) { $success = false; $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } diff --git a/class/Devtools.php b/class/Devtools.php index 6481db7c..54b246cb 100644 --- a/class/Devtools.php +++ b/class/Devtools.php @@ -498,10 +498,10 @@ private static function cloneFile($src_file, $dst_file, array $patKeys, array $p /** * get form with all existing modules - * @param bool $action + * @param string|false $action * @return \XoopsSimpleForm */ - public static function getFormModulesFq(bool $action = false) + public static function getFormModulesFq(string|false $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -527,10 +527,10 @@ public static function getFormModulesFq(bool $action = false) /** * get form with all existing modules - * @param bool $action + * @param string|false $action * @return \XoopsSimpleForm */ - public static function getFormModulesCl(bool $action = false) + public static function getFormModulesCl(string|false $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -556,10 +556,10 @@ public static function getFormModulesCl(bool $action = false) /** * get form with all existing modules - * @param bool $action + * @param string|false $action * @return \XoopsSimpleForm */ - public static function getFormModulesTab(bool $action = false) + public static function getFormModulesTab(string|false $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; @@ -585,10 +585,11 @@ public static function getFormModulesTab(bool $action = false) /** * get form with all existing modules - * @param bool $action + * @param string $dst_path + * @param string|false $action * @return \XoopsSimpleForm */ - public static function getFormModulesRemovePrefix($dst_path, bool $action = false) + public static function getFormModulesRemovePrefix(string $dst_path, string|false $action = false) { if (!$action) { $action = $_SERVER['REQUEST_URI']; diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php index 5f7755ed..0f615b6b 100644 --- a/class/Files/Admin/AdminBroken.php +++ b/class/Files/Admin/AdminBroken.php @@ -122,9 +122,9 @@ private function getAdminBrokenList($tables, string $language) $ucfTableName = \ucfirst($tableName); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Check table', $tableName, ''); - $ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', false, ''); + $ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', ''); $adminpager = $this->xc->getXcGetConfig('adminpager'); - $ret .= $this->xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', false, ''); + $ret .= $this->xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', ''); $critName = 'cr' . $ucfTableName; $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); diff --git a/class/Files/Admin/AdminPermissions.php b/class/Files/Admin/AdminPermissions.php index 18cf7d81..ac41eb0f 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -182,7 +182,7 @@ private function getPermissionsSwitch($module, $language) ]; } } - $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t"); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true,"\t"); return $this->pc->getPhpCodeSwitch('op', $contentSwitch); } diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 382b2e00..718f1aa5 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -206,7 +206,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab 'top' => $case4, 'random' => $case5, ]; - $contSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t\t"); + $contSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, "\t\t"); $contElse = $this->pc->getPhpCodeSwitch('typeBlock', $contSwitch, "\t"); //end: content else: parent if (1 == $fieldParent) { diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 65e88cbe..86fd6147 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -481,7 +481,7 @@ private function getValuesInObject($moduleDirname, $table, $fields) $contCase5 = $this->xc->getXcEqualsOperator('$status_text', $language . 'STATUS_BROKEN', false, "\t\t\t\t"); $cases[$this->xc->getXcGetConstants('STATUS_BROKEN')] = [$contCase5]; } - $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t\t\t", true); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, "\t\t\t", true); $getValues .= $this->pc->getPhpCodeSwitch('status', $contentSwitch, "\t\t"); $len = $lenMaxName - \mb_strlen('status_text'); $spacer = $len > 0 ? str_repeat(' ', $len) : ''; diff --git a/class/Files/CreateClone.php b/class/Files/CreateClone.php index 91fae5c7..2d5665f0 100644 --- a/class/Files/CreateClone.php +++ b/class/Files/CreateClone.php @@ -68,20 +68,29 @@ public static function cloneFile($src_file, $dst_file, bool $replace_code = fals $noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf']; if (\in_array(\mb_strtolower(\pathinfo($src_file, PATHINFO_EXTENSION)), $noChangeExtensions)) { // image - \copy($src_file, $dst_file); + if (!\copy($src_file, $dst_file)) { + throw new \RuntimeException("Unable to copy {$src_file} to {$dst_file}"); + } } else { // file, read it and replace text - $content = file_get_contents($src_file); + $content = \file_get_contents($src_file); + if (false === $content) { + throw new \RuntimeException("Unable to read source file: {$src_file}"); + } $content = \str_replace($patKeys, $patValues, $content); //check file name whether it contains replace code $path_parts = \pathinfo($dst_file); $path = $path_parts['dirname']; $file = $path_parts['basename']; $dst_file = $path . '/' . \str_replace($patKeys, $patValues, $file); - file_put_contents($dst_file, $content); + if (false === \file_put_contents($dst_file, $content)) { + throw new \RuntimeException("Unable to write destination file: {$dst_file}"); + } } } else { - \copy($src_file, $dst_file); + if (!\copy($src_file, $dst_file)) { + throw new \RuntimeException("Unable to copy {$src_file} to {$dst_file}"); + } } } } diff --git a/class/Files/CreatePhpCode.php b/class/Files/CreatePhpCode.php index 8908ab15..b57e2823 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -470,13 +470,11 @@ public function getPhpCodeSwitch($op = null, $content = null, string $t = '', bo * * @param array $cases * @param bool $defaultAfterCase - * @param bool $default * @param string $t - * * @param bool $isConst * @return string */ - public function getPhpCodeCaseSwitch(array $cases = [], bool $defaultAfterCase = false, bool $default = false, string $t = '', bool $isConst = false) + public function getPhpCodeCaseSwitch(array $cases = [], bool $defaultAfterCase = false, string $t = '', bool $isConst = false) { $ret = ''; $def = "{$t}default:\n"; @@ -502,11 +500,6 @@ public function getPhpCodeCaseSwitch(array $cases = [], bool $defaultAfterCase = $defaultAfterCase = false; } } - if (false !== $default) { - $ret .= $def; - $ret .= "{$t}{$default}\n"; - $ret .= "{$t}\tbreak;\n"; - } return $ret; } @@ -791,10 +784,10 @@ public function getPhpCodeStripTags($left, $value, bool $isParam = false, string /** * @public function getPhpCodeHtmlentities * @param $entitiesVar - * @param bool $entitiesQuote + * @param int|string|false $entitiesQuote * @return string */ - public function getPhpCodeHtmlentities($entitiesVar, bool $entitiesQuote = false) + public function getPhpCodeHtmlentities($entitiesVar, int|string|false $entitiesQuote = false) { $entitiesVar = (false !== $entitiesQuote) ? $entitiesVar . ', ' . $entitiesQuote : $entitiesVar; return "htmlentities({$entitiesVar})"; @@ -803,10 +796,10 @@ public function getPhpCodeHtmlentities($entitiesVar, bool $entitiesQuote = false /** * @public function getPhpCodeHtmlspecialchars * @param $specialVar - * @param bool $specialQuote + * @param int|string|false $specialQuote * @return string */ - public function getPhpCodeHtmlspecialchars($specialVar, bool $specialQuote = false) + public function getPhpCodeHtmlspecialchars($specialVar, int|string|false $specialQuote = false) { $specialVar = (false !== $specialQuote) ? $specialVar . ', ' . $specialQuote : $specialVar; return "htmlspecialchars({$specialVar})"; diff --git a/class/Files/CreateStructure.php b/class/Files/CreateStructure.php index 0cbb2d76..ca933992 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -173,7 +173,7 @@ protected function makeDir(string $dir): void } /** - * @protected function isDirEmpty + * function isDirEmpty * * @param string $dir * @@ -181,19 +181,19 @@ protected function makeDir(string $dir): void */ public function isDirEmpty(string $dir) { - $content = []; - $handle = \opendir($dir); + $handle = \opendir($dir); + if (false === $handle) { + throw new \RuntimeException(\sprintf('Directory "%s" cannot be opened', $dir)); + } while (false !== ($entry = \readdir($handle))) { if ('.' !== $entry && '..' !== $entry) { - $content[] = $entry; + \closedir($handle); + return false; } } \closedir($handle); - if (\count($content) > 0) { - return true; - } - return false; + return true; } /** @@ -269,6 +269,8 @@ public function setCopy(string $dname, string $fromFile, string $fname): void } else { $this->makeDir($dname); } - \copy($fromFile, $fname); + if (!\copy($fromFile, $fname)) { + throw new \RuntimeException(\sprintf('Failed to copy "%s" to "%s"', $fromFile, $fname)); + } } } diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index e0e24ad5..0130c218 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -50,17 +50,15 @@ public static function getInstance() * @param string $op * @param array $cases * @param bool $defaultAfterCase - * @param bool $default - * @param string $t - Indentation - * + * @param string $t * @param bool $isString * @param bool $isConst * @return string */ - public function getXcSwitch(string $op = '', array $cases = [], bool $defaultAfterCase = false, bool $default = false, string $t = '', bool $isString = true, bool $isConst = false) + public function getXcSwitch(string $op = '', array $cases = [], bool $defaultAfterCase = false, string $t = '', bool $isString = true, bool $isConst = false) { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); - $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, $defaultAfterCase, $default, $t . "\t", $isConst); + $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, $defaultAfterCase, $t . "\t", $isConst); return $pc->getPhpCodeSwitch($op, $contentSwitch, $t, $isString); } @@ -642,11 +640,10 @@ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName * @param string $var1 * @param string $var2 * @param string $type - * @param bool $method * @param string $t * @return string */ - public function getXcXoopsRequest(string $left = '', string $var1 = '', string $var2 = '', string $type = 'String', bool $method = false, string $t = '') + public function getXcXoopsRequest(string $left = '', string $var1 = '', string $var2 = '', string $type = 'String', string $t = '') { $ret = ''; $intVars = ('' != $var2) ? "'{$var1}', {$var2}" : "'{$var1}'"; @@ -654,11 +651,7 @@ public function getXcXoopsRequest(string $left = '', string $var1 = '', string $ if ('String' === $type) { $ret .= "{$t}\${$left} = Request::getString({$stringVars});\n"; } elseif ('Int' === $type) { - if (false !== $method) { - $ret .= "{$t}\${$left} = Request::getInt({$intVars}, '{$method}');\n"; - } else { - $ret .= "{$t}\${$left} = Request::getInt({$intVars});\n"; - } + $ret .= "{$t}\${$left} = Request::getInt({$intVars});\n"; } else { $ret .= "{$t}\${$left} = Request::get{$type}('{$var1}', '{$var2}');\n"; } diff --git a/class/Files/Includes/IncludeNotifications.php b/class/Files/Includes/IncludeNotifications.php index eee449f8..5eff8d98 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -103,7 +103,7 @@ public function getNotificationsFunction(string $moduleDirname) $cases = [ 'global' => $case, ]; - $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, false, false, $t . "\t"); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, false, $t . "\t"); unset($case); foreach (\array_keys($tables) as $i) { @@ -133,9 +133,9 @@ public function getNotificationsFunction(string $moduleDirname) $case[] = $this->xc->getXcEqualsOperator('$sql ', "'SELECT {$fieldMain} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fieldId} = '. \$itemId", '', $t . "\t\t"); $case[] = $this->xc->getXcEqualsOperator('$result', '$xoopsDB->query($sql)', '', $t . "\t\t"); $condIf = $this->getSimpleString('return [];', $t . "\t\t\t"); - $case[] .= $this->pc->getPhpCodeConditions('!$result', '', '', $condIf, false, $t . "\t\t"); + $case[] = $this->pc->getPhpCodeConditions('!$result', '', '', $condIf, false, $t . "\t\t"); $case[] = $this->xc->getXcEqualsOperator('$result_array', '$xoopsDB->fetchArray($result)', '', $t . "\t\t"); - $case[] .= $this->pc->getPhpCodeConditions('!$result_array', '', '', $condIf, false, $t . "\t\t"); + $case[] = $this->pc->getPhpCodeConditions('!$result_array', '', '', $condIf, false, $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}=' . \$itemId", '', $t . "\t\t"); @@ -147,7 +147,7 @@ public function getNotificationsFunction(string $moduleDirname) $cases = [ $tableName => $case, ]; - $contentSwitch .= $this->pc->getPhpCodeCaseSwitch($cases, false, false, $t . "\t"); + $contentSwitch .= $this->pc->getPhpCodeCaseSwitch($cases, false, $t . "\t"); unset($case); } } diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 709ec765..fbec75d4 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -115,7 +115,7 @@ public function render() if ('english' !== $language) { $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); } - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/english/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } diff --git a/class/Files/Sql/SqlFile.php b/class/Files/Sql/SqlFile.php index 78ca77f9..ce2b6033 100644 --- a/class/Files/Sql/SqlFile.php +++ b/class/Files/Sql/SqlFile.php @@ -149,7 +149,7 @@ private function getDatabaseTables($module) $tableMid = $tables[$t]->getVar('table_mid'); $tableName = $tables[$t]->getVar('table_name'); $tableAutoincrement = $tables[$t]->getVar('table_autoincrement'); - $fieldsNumb = $tables[$t]->getVar('table_nbfields'); + $fieldsNumb = (int)$tables[$t]->getVar('table_nbfields'); if (1 === (int)$tables[$t]->getVar('table_rate')) { $tableRate = 1; } diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index f1843fe0..7057998d 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -152,7 +152,7 @@ private function getTemplatesAdminBrokenTable(string $tableName, $tableSoleName, { $tbody = $this->getTemplatesAdminBrokenTableThead($language); $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName); - return $this->hc->getHtmlTable($tbody, 'table table-bordered', "\t"); + return $this->hc->getHtmlTable($tbody, 'outer', "\t"); } /** diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index 019156de..35d7e8db 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -98,8 +98,8 @@ private function getTemplatesUserCategoriesHeader(string $moduleDirname) private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, string $language) { $single = $this->sc->getSmartySingleVar('table_type'); - $table = $this->getTemplatesAdminPagesTableThead($tableName, $language); - $table .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $language); + $table = $this->getTemplatesUserCategoriesThead($tableName, $language); + $table .= $this->getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName); return $this->hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; } diff --git a/class/Files/Templates/User/Defstyle/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php index 0e03b7ad..392ccf21 100644 --- a/class/Files/Templates/User/Defstyle/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -60,8 +60,8 @@ public static function getInstance() /** * @public function write * @param $module - * @param string $filename * @param $folder + * @param string $filename * @param $extension */ public function write($module, $folder, string $filename, $extension): void diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index dbddf88b..d2eaab21 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -254,7 +254,7 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); - //$retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify', "\t"); + $retFoot .= $this->hc->getHtmlSpan($img, 'block-pie justify', "\t"); unset($img); break; case Constants::FIELD_ELE_UPLOADIMAGE: @@ -263,7 +263,7 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); - //$retElem .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); + $retFoot .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); unset($img); break; } diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index fc818059..7c31342a 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -72,8 +72,8 @@ public static function getInstance() * @public function write * @param $module * @param $table - * @param string $filename * @param $tables + * @param string $filename */ public function write($module, $table, $tables, string $filename): void { diff --git a/class/Files/User/UserIndex.php b/class/Files/User/UserIndex.php index f5cc860f..36e77fcc 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -164,9 +164,9 @@ private function getBodyPagesIndex($tableName, $language, $tableMid, $tableId) $ret .= $this->xc->getXcHandlerCountObj($tableName); $ret .= $this->xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count"); //$ret .= $this->getSimpleString('$count = 1;'); - $condIf = $this->xc->getXcXoopsRequest('start', 'start', '', 'Int', false, "\t"); + $condIf = $this->xc->getXcXoopsRequest('start', 'start', '', 'Int', "\t"); $userpager = $this->xc->getXcGetConfig('userpager'); - $condIf .= $this->xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int', false, "\t"); + $condIf .= $this->xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int', "\t"); $condIf .= $this->xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', "\t"); $condIf .= $this->pc->getPhpCodeCommentLine('Get All', $ucfTableName, "\t"); $condIf .= $this->pc->getPhpCodeArray($tableName . '_list', null, false, "\t"); diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 2449c596..41aefeb9 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -471,7 +471,7 @@ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $ret .= $this->pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); } $ret .= $this->pc->getPhpCodeCommentLine('Request source', '', $t); - $ret .= $this->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', false, $t); + $ret .= $this->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', $t); $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}Source", ' == ', '0', $contIf, false, $t); diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index edc5628a..b6a2da57 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -122,7 +122,7 @@ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); - $ret .= $this->cf->getSimpleString("\$pdfTpl->assign('wgtestmb_upload_url', \\" . strtoupper($moduleDirname) . '_UPLOAD_URL);'); + $ret .= $this->cf->getSimpleString("\$pdfTpl->assign('" . $moduleDirname . "_upload_url', \\" . strtoupper($moduleDirname) . '_UPLOAD_URL);'); $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; @@ -202,7 +202,7 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Get Config'); $ret .= $this->xc->getXcEqualsOperator("\$pdfData['creator'] ", "\$GLOBALS['xoopsConfig']['sitename']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); + //$ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); $ret .= $this->xc->getXcEqualsOperator("\$pdfData['keywords'] ", "\$helper->getConfig('keywords')"); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Defines'); diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index b9ad4e67..0510f2e7 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -146,7 +146,7 @@ public function getUserRateSave($tables, $language, $t, $moduleDirname) $redirectError = $this->xc->getXcRedirectHeader('index', '', '3', $implode, true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectError, false, $t); - $ret .= $this->xc->getXcXoopsRequest('rating', 'rating', '', 'Int', false, $t); + $ret .= $this->xc->getXcXoopsRequest('rating', 'rating', '', 'Int', $t); $ret .= $this->xc->getXcEqualsOperator('$itemid', '0','', $t); $ret .= $this->xc->getXcEqualsOperator('$redir ', "\Xmf\Request::getString('HTTP_REFERER', '', 'SERVER')",'', $t); foreach ($tables as $table) { @@ -160,7 +160,7 @@ public function getUserRateSave($tables, $language, $t, $moduleDirname) $fieldId = $fields[$f]->getVar('field_name'); } } - $contIf = $this->xc->getXcXoopsRequest('itemid', $fieldId, '', 'Int', false, $t . "\t"); + $contIf = $this->xc->getXcXoopsRequest('itemid', $fieldId, '', 'Int', $t . "\t"); $contIf .= $this->xc->getXcEqualsOperator('$redir', "'{$tableName}.php?op=show&{$fieldId}=' . \$itemid",'', $t . "\t"); $const = $this->xc->getXcGetConstants('TABLE_' . $stuTableName); $ret .= $this->pc->getPhpCodeConditions('$source', ' === ', $const, $contIf, false, $t); @@ -200,7 +200,7 @@ public function getUserRateSave($tables, $language, $t, $moduleDirname) $const = $this->xc->getXcGetConstants('RATING_10NUM'); $cases[$const] = [$this->pc->getPhpCodeConditions('$rating > 10 || $rating < 1', '', '', $contIf, false, $t . "\t\t")]; $config = '(int)' . $this->xc->getXcGetConfig('ratingbars'); - $ret .= $this->xc->getXcSwitch($config, $cases, true, false, $t, false, true); + $ret .= $this->xc->getXcSwitch($config, $cases, true, $t, false, true); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->pc->getPhpCodeCommentLine('Get existing rating', null, $t); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index cd1825ce..386e639b 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -136,7 +136,7 @@ private function getAdminPagesHeader($moduleDirname, $fieldId) */ private function getAdminPagesSwitch(array $cases = []) { - $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t"); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, "\t"); return $this->pc->getPhpCodeSwitch('op', $contentSwitch); } @@ -238,7 +238,7 @@ private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $ret .= $this->xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); } $ret .= $this->pc->getPhpCodeCommentLine('Request source', '', $t); - $ret .= $this->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', false, $t); + $ret .= $this->xc->getXcXoopsRequest($ccFieldId . 'Source', $fieldId . '_source', '', 'Int', $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/Form/FormRadio.php b/class/Form/FormRadio.php index df10ea43..23bef86c 100644 --- a/class/Form/FormRadio.php +++ b/class/Form/FormRadio.php @@ -31,8 +31,8 @@ public function render() { $ret = ''; $ele_name = $this->getName(); - $ele_title = $this->getTitle(); - $ele_value = $this->getValue(); + $ele_title = (string)$this->getTitle(); + $ele_value = (string)$this->getValue(); $ele_options = $this->getOptions(); $ele_extra = $this->getExtra(); $ele_delimeter = empty($this->columns) ? $this->getDelimeter() : ''; diff --git a/class/Helper.php b/class/Helper.php index 090b8897..2ab01f0a 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -30,7 +30,7 @@ class Helper extends \Xmf\Module\Helper /** * @param bool $debug */ - public function __construct($debug = false) + public function __construct(bool $debug = false) { $this->debug = $debug; $moduleDirName = \basename(\dirname(__DIR__)); diff --git a/class/LogoGenerator.php b/class/LogoGenerator.php index b2449770..1269d914 100644 --- a/class/LogoGenerator.php +++ b/class/LogoGenerator.php @@ -38,7 +38,9 @@ function phpFunction(string $val = ''): void if (\function_exists($myfunction)) { $ret = \XoopsModules\Modulebuilder\LogoGenerator::createLogo($_GET['iconName'], $_GET['caption']); - phpFunction($ret); + if (false !== $ret) { + phpFunction($ret); + } } else { echo 'Method Not Exist'; } diff --git a/class/Modules.php b/class/Modules.php index 230ef42e..f18bbd3e 100644 --- a/class/Modules.php +++ b/class/Modules.php @@ -100,7 +100,7 @@ public function __construct() * * @return mixed */ - public function __call(string $method, array $args) + public function __call(string $method, array $args): mixed { $arg = $args[0] ?? null; diff --git a/class/SplClassLoader.php b/class/SplClassLoader.php index 29ca1d9f..a308991a 100644 --- a/class/SplClassLoader.php +++ b/class/SplClassLoader.php @@ -79,9 +79,9 @@ public function getNamespaceSeparator() /** * Sets the base include path for all class files in the namespace of this class loader. * - * @param string $includePath + * @param string|null $includePath */ - public function setIncludePath(string $includePath): void + public function setIncludePath(?string $includePath): void { $this->_includePath = $includePath; } diff --git a/class/Utility.php b/class/Utility.php index 18781adb..7973c924 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -76,7 +76,7 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; $donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), - \XOOPS_LICENSE_KEY, + \defined('XOOPS_LICENSE_KEY') ? \XOOPS_LICENSE_KEY : '', \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') ); From a11a782fd5901d020be165b1fde255e3df0c58c1 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Tue, 7 Apr 2026 23:33:24 +0200 Subject: [PATCH 257/266] corrections coderabbitai 2 --- class/Common/DirectoryChecker.php | 26 +-- class/Common/TableChecker.php | 2 +- class/Files/Blocks/BlocksFiles.php | 4 +- class/Files/Classes/ClassFiles.php | 4 +- class/Files/CreateClone.php | 8 +- class/Files/CreateSmartyCode.php | 17 +- class/Files/CreateStructure.php | 6 +- class/Files/CreateXoopsCode.php | 189 +++++++++--------- class/Files/Language/LanguageHelp.php | 5 - .../Templates/Admin/TemplatesAdminBroken.php | 8 +- .../Templates/Admin/TemplatesAdminPages.php | 16 +- .../Blocks/Defstyle/TemplatesBlocks.php | 14 +- .../Templates/User/Defstyle/Breadcrumbs.php | 8 +- .../Templates/User/Defstyle/Categories.php | 18 +- .../Templates/User/Defstyle/PagesItem.php | 44 ++-- .../Templates/User/Defstyle/PagesList.php | 4 +- class/Files/User/UserPages.php | 14 +- class/Files/User/UserPdf.php | 63 +++--- class/Files/User/UserPrint.php | 45 +++-- class/Files/User/UserRate.php | 2 +- class/Modules.php | 39 ---- 21 files changed, 258 insertions(+), 278 deletions(-) diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 4aeb0f0f..77172127 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -104,7 +104,11 @@ public static function createDirectory($target, int $mode = 0777) $target = \str_replace('..', '', $target); // https://www.php.net/manual/en/function.mkdir.php - return \is_dir($target) || (self::createDirectory(\dirname($target), $mode) && !\mkdir($target, $mode) && !\is_dir($target)); + return \is_dir($target) + || ( + self::createDirectory(\dirname($target), $mode) + && (\mkdir($target, $mode) || \is_dir($target)) + ); } /** @@ -137,22 +141,20 @@ public static function dirExists($dir_path) if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST')) { break; } - $path = $_POST['path']; - $redirect = $_POST['redirect']; + $path = \Xmf\Request::getString('path', 'POST'); + $redirect = \Xmf\Request::getString('redirect', 'POST'); $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED'); \redirect_header($redirect, 2, $msg . ': ' . $path); break; case 'setdirperm': - if (\Xmf\Request::hasVar('path', 'POST')) { - $path = $_POST['path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; - } - if (\Xmf\Request::hasVar('mode', 'POST')) { - $mode = $_POST['mode']; + if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST') || !\Xmf\Request::hasVar('mode', 'POST')) { + break; } - $msg = DirectoryChecker::setDirectoryPermissions($path, (int)$mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); + $path = \Xmf\Request::getString('path', 'POST'); + $redirect = \Xmf\Request::getString('redirect', 'POST'); + $mode = \Xmf\Request::getInt('mode', 'POST'); + $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); + \redirect_header($redirect, 2, $msg . ': ' . $path); break; } diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php index 9fe70478..70c85b25 100644 --- a/class/Common/TableChecker.php +++ b/class/Common/TableChecker.php @@ -76,7 +76,7 @@ public function processSQL() if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) { // create new table $sql = $tabledef['sql']; - if ($this->result = $GLOBALS['xoopsDB']->queryF($sql)) { + if ($GLOBALS['xoopsDB']->queryF($sql)) { $this->result[] = 'Table created:' . $table; } else { \xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); diff --git a/class/Files/Blocks/BlocksFiles.php b/class/Files/Blocks/BlocksFiles.php index 718f1aa5..9490942d 100644 --- a/class/Files/Blocks/BlocksFiles.php +++ b/class/Files/Blocks/BlocksFiles.php @@ -157,8 +157,8 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab } } if ('' !== $fieldStatus) { - $constant = $this->xc->getXcGetConstants('STATUS_OFFLINE'); - $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'>'", true); + $constant = $this->xc->getXcGetConstants('STATUS_APPROVED'); + $crit = $this->xc->getXcCriteria('', "'{$fieldStatus}'", $constant, "'='", true); $func .= $this->pc->getPhpCodeCommentLine("Criteria for status field",'',"\t"); $func .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t"); $func .= $this->pc->getPhpCodeBlankLine(); diff --git a/class/Files/Classes/ClassFiles.php b/class/Files/Classes/ClassFiles.php index 86fd6147..6907ec07 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -340,12 +340,12 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field * @private function getPermissionsInForm * * @param string $moduleDirname - * @param string $fieldId + * @param string|null $fieldId * * @param $tableName * @return string */ - private function getPermissionsInForm(string $moduleDirname, string $fieldId, $tableName) + private function getPermissionsInForm(string $moduleDirname, ?string $fieldId, $tableName) { $permissionApprove = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_APPROVE'); $permissionSubmit = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_SUBMIT'); diff --git a/class/Files/CreateClone.php b/class/Files/CreateClone.php index 2d5665f0..2bfb541f 100644 --- a/class/Files/CreateClone.php +++ b/class/Files/CreateClone.php @@ -39,8 +39,14 @@ public static function cloneFileFolder($src_path, $dst_path, bool $replace_code { // open the source directory $dir = \opendir($src_path); + if (false === $dir) { + throw new \RuntimeException("Unable to open source directory: {$src_path}"); + } // Make the destination directory if not exist - @\mkdir($dst_path); + if (!\is_dir($dst_path) && !\mkdir($dst_path, 0755) && !\is_dir($dst_path)) { + throw new \RuntimeException("Unable to create destination directory: {$dst_path}"); + } + // Loop through the files in source directory while ($file = \readdir($dir)) { if (($file != '.') && ($file != '..')) { diff --git a/class/Files/CreateSmartyCode.php b/class/Files/CreateSmartyCode.php index 7bae5586..9fee1358 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -143,14 +143,18 @@ public function getSmartyConst(string $language, $const, string $t = '', string * @param string $t * @param string $n * @param string $default + * @param string $escape * @return string */ - public function getSmartySingleVar(string $var, string $t = '', string $n = '', string $default = 'false') + public function getSmartySingleVar(string $var, string $t = '', string $n = '', string $default = 'false', string $escape = '') { $ret = "{$t}<{\${$var}"; if ('' !== $default) { $ret .= '|default:' . $default; } + if ('' !== $escape) { + $ret .= '|escape:' . $escape; + } $ret .= "}>{$n}"; return $ret; @@ -162,11 +166,18 @@ public function getSmartySingleVar(string $var, string $t = '', string $n = '', * @param string $rightVar * @param string $t * @param string $n + * @param string $default + * @param string $escape * @return string */ - public function getSmartyDoubleVar(string $leftVar, string $rightVar, string $t = '', string $n = '', $default = 'false') + public function getSmartyDoubleVar(string $leftVar, string $rightVar, string $t = '', string $n = '', string $default = 'false', string $escape = '') { - return "{$t}<{\${$leftVar}.{$rightVar}|default:{$default}}>{$n}"; + $ret = "{$t}<{\${$leftVar}.{$rightVar}|default:{$default}"; + if ('' !== $escape) { + $ret .= '|escape:' . $escape; + } + $ret .= "}>{$n}"; + return $ret; } /** diff --git a/class/Files/CreateStructure.php b/class/Files/CreateStructure.php index ca933992..f9a74872 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -179,7 +179,7 @@ protected function makeDir(string $dir): void * * @return bool */ - public function isDirEmpty(string $dir) + public function isDirEmpty(string $dir): bool { $handle = \opendir($dir); if (false === $handle) { @@ -197,13 +197,13 @@ public function isDirEmpty(string $dir) } /** - * @public function addFolderPath + * @private function addFolderPath * * @param string $folderName * @param bool|string $fileName * @return string */ - private function addFolderPath(string $folderName, $fileName = false) + private function addFolderPath(string $folderName, $fileName = false): string { $this->setFolderName($folderName); if ($fileName) { diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 0130c218..8c2b9e2e 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -55,7 +55,7 @@ public static function getInstance() * @param bool $isConst * @return string */ - public function getXcSwitch(string $op = '', array $cases = [], bool $defaultAfterCase = false, string $t = '', bool $isString = true, bool $isConst = false) + public function getXcSwitch(string $op = '', array $cases = [], bool $defaultAfterCase = false, string $t = '', bool $isString = true, bool $isConst = false): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, $defaultAfterCase, $t . "\t", $isConst); @@ -72,7 +72,7 @@ public function getXcSwitch(string $op = '', array $cases = [], bool $defaultAft * * @return string */ - public function getXcEqualsOperator($var, $value, $interlock = null, string $t = '') + public function getXcEqualsOperator($var, $value, $interlock = null, string $t = ''): string { return "{$t}{$var} {$interlock}= {$value};\n"; } @@ -86,7 +86,7 @@ public function getXcEqualsOperator($var, $value, $interlock = null, string $t = * * @return string */ - public function getXcAnchorFunction($anchor, $name, $vars, bool $close = false) + public function getXcAnchorFunction($anchor, $name, $vars, bool $close = false): string { $semicolon = false !== $close ? ';' : ''; @@ -101,7 +101,7 @@ public function getXcAnchorFunction($anchor, $name, $vars, bool $close = false) * @param string $t * @return string */ - public function getXcSetVarObj($tableName, $fieldName, $var, string $t = '') + public function getXcSetVarObj($tableName, $fieldName, $var, string $t = ''): string { return "{$t}\${$tableName}Obj->setVar('{$fieldName}', {$var});\n"; } @@ -117,7 +117,7 @@ public function getXcSetVarObj($tableName, $fieldName, $var, string $t = '') * @param string $format * @return string */ - public function getXcGetVar(string $varLeft = '', string $handle = '', string $var = '', bool $isParam = false, string $t = '', string $format = '') + public function getXcGetVar(string $varLeft = '', string $handle = '', string $var = '', bool $isParam = false, string $t = '', string $format = ''): string { if (!$isParam) { $ret = "{$t}\${$varLeft} = \${$handle}->getVar('{$var}'{$format});\n"; @@ -137,7 +137,7 @@ public function getXcGetVar(string $varLeft = '', string $handle = '', string $v * * @return string */ - public function getXcAddItem(string $varLeft = '', string $paramLeft = '', string $paramRight = '', string $t = '') + public function getXcAddItem(string $varLeft = '', string $paramLeft = '', string $paramRight = '', string $t = ''): string { return "{$t}\${$varLeft}->addItem({$paramLeft}, {$paramRight});\n"; } @@ -152,7 +152,7 @@ public function getXcAddItem(string $varLeft = '', string $paramLeft = '', strin * @param string $t * @return string */ - public function getXcGetGroupIds(string $var = '', string $anchor = '', $param1 = null, $param2 = null, $param3 = null, string $t = '') + public function getXcGetGroupIds(string $var = '', string $anchor = '', $param1 = null, $param2 = null, $param3 = null, string $t = ''): string { return "{$t}\${$var} = \${$anchor}->getGroupIds({$param1}, {$param2}, {$param3});\n"; } @@ -167,7 +167,7 @@ public function getXcGetGroupIds(string $var = '', string $anchor = '', $param1 * @param string $t * @return string */ - public function getXcGetItemIds(string $var = '', string $anchor = '', $param1 = null, $param2 = null, $param3 = null, string $t = '') + public function getXcGetItemIds(string $var = '', string $anchor = '', $param1 = null, $param2 = null, $param3 = null, string $t = ''): string { return "{$t}\${$var} = \${$anchor}->getItemIds({$param1}, {$param2}, {$param3});\n"; } @@ -181,7 +181,7 @@ public function getXcGetItemIds(string $var = '', string $anchor = '', $param1 = * @param string $language * @return string */ - public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, string $t = '', string $language = '') + public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, string $t = '', string $language = ''): string { $cf = Modulebuilder\Files\CreateFile::getInstance(); $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); @@ -209,7 +209,7 @@ public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName * @param string $language * @return string */ - public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, string $t = '', string $language = '') + public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, string $t = '', string $language = ''): string { $tf = Modulebuilder\Files\CreateFile::getInstance(); $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); @@ -245,7 +245,7 @@ public function getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, stri * @param string $t * @return string */ - public function getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, string $t = '') + public function getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, string $t = ''): string { return $this->getXcSetVarObj($tableName, $fieldName, "Request::getInt('{$fieldName}')", $t); } @@ -259,7 +259,7 @@ public function getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, string $t = * @param string $t * @return string */ - public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, string $t = '') + public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, string $t = ''): string { $mimetypes_file = $this->getXcGetConfig($mimetype); $maxsize_file = $this->getXcGetConfig($maxsize); @@ -277,7 +277,7 @@ public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, string $ * * @return string */ - public function getXcGetInstance(string $var = '', string $instance = '', string $t = '') + public function getXcGetInstance(string $var = '', string $instance = '', string $t = ''): string { return "{$t}\${$var} = {$instance}::getInstance();\n"; } @@ -287,7 +287,7 @@ public function getXcGetInstance(string $var = '', string $instance = '', string * @param $name * @return string */ - public function getXcGetConfig($name) + public function getXcGetConfig($name): string { return "\$helper->getConfig('{$name}')"; } @@ -298,7 +298,7 @@ public function getXcGetConfig($name) * @param string $t * @return string */ - public function getXcIdGetVar($lpFieldName, string $t = '') + public function getXcIdGetVar($lpFieldName, string $t = ''): string { return "{$t}\${$lpFieldName}['id'] = \$i;\n"; } @@ -312,7 +312,7 @@ public function getXcIdGetVar($lpFieldName, string $t = '') * @param string $t * @return string */ - public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') + public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = ''): string { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}All[\$i]->getVar('{$fieldName}');\n"; } @@ -324,7 +324,7 @@ public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldNam * @param string $t * @return string */ - public function getXcHelperGetInstance($moduleDirname, string $t = '') + public function getXcHelperGetInstance($moduleDirname, string $t = ''): string { $ucfModuleDirname = \ucfirst($moduleDirname); $ret = "{$t}// Get instance of module\n"; @@ -341,7 +341,7 @@ public function getXcHelperGetInstance($moduleDirname, string $t = '') * @param string $t * @return string */ - public function getXcFormatTimeStamp($left, $value, string $format = 's', string $t = '') + public function getXcFormatTimeStamp($left, $value, string $format = 's', string $t = ''): string { return "{$t}\${$left} = \\formatTimestamp({$value}, '{$format}');\n"; } @@ -357,7 +357,7 @@ public function getXcFormatTimeStamp($left, $value, string $format = 's', string * @param string $t * @return string */ - public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, string $t = '') + public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); @@ -379,7 +379,7 @@ public function getXcTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableN * @param string $t * @return string */ - public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableSoleNameTopic, $tableNameTopic, $fieldNameParent, string $t = '') + public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableSoleNameTopic, $tableNameTopic, $fieldNameParent, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $parentTopic = $pc->getPhpCodeCommentLine('Get', $tableNameTopic . ' Handler', $t . "\t"); @@ -401,7 +401,7 @@ public function getXcParentTopicGetVar($lpFieldName, $rpFieldName, $tableName, $ * @param string $t * @return string */ - public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, string $t = '') + public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Get Var', $fieldName, $t); @@ -441,7 +441,7 @@ public function getXcGetVarUploadImage($lpFieldName, $rpFieldName, $tableName, $ * @param $fieldName * @return string */ - public function getXcGetVarUrlFile($lpFieldName, $rpFieldName, $tableName, $fieldName) + public function getXcGetVarUrlFile($lpFieldName, $rpFieldName, $tableName, $fieldName): string { return $this->getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldName); } @@ -455,7 +455,7 @@ public function getXcGetVarUrlFile($lpFieldName, $rpFieldName, $tableName, $fiel * @param string $t * @return string */ - public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') + public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $getVar = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true); @@ -472,7 +472,7 @@ public function getXcGetVarTextArea($lpFieldName, $rpFieldName, $tableName, $fie * @param string $t * @return string */ - public function getXcGetVarSelectUser($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') + public function getXcGetVarSelectUser($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = ''): string { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; } @@ -486,7 +486,7 @@ public function getXcGetVarSelectUser($lpFieldName, $rpFieldName, $tableName, $f * @param string $t * @return string */ - public function getXcGetVarTextDateSelect($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = '') + public function getXcGetVarTextDateSelect($lpFieldName, $rpFieldName, $tableName, $fieldName, string $t = ''): string { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; } @@ -498,7 +498,7 @@ public function getXcGetVarTextDateSelect($lpFieldName, $rpFieldName, $tableName * @param string $t * @return string */ - public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, string $t = '') + public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, string $t = ''): string { return "{$t}\$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl';\n"; } @@ -509,7 +509,7 @@ public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, string * @param $tableName * @return string */ - public function getXcUserHeader($moduleDirname, $tableName) + public function getXcUserHeader($moduleDirname, $tableName): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeIncludeDir('__DIR__', 'header'); @@ -524,7 +524,7 @@ public function getXcUserHeader($moduleDirname, $tableName) * * @return string */ - public function getXcPermissionsHeader() + public function getXcPermissionsHeader(): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $ret = $pc->getPhpCodeCommentLine('Permission'); @@ -544,7 +544,7 @@ public function getXcPermissionsHeader() * * @return string */ - public function getXcGetFieldId($fields) + public function getXcGetFieldId($fields): string { $fieldId = 'id'; foreach (\array_keys($fields) as $f) { @@ -564,7 +564,7 @@ public function getXcGetFieldId($fields) * * @return string */ - public function getXcGetFieldName($fields) + public function getXcGetFieldName($fields): string { $fieldName = ''; foreach (\array_keys($fields) as $f) { @@ -581,7 +581,7 @@ public function getXcGetFieldName($fields) * * @return string */ - public function getXcGetFieldParentId($fields) + public function getXcGetFieldParentId($fields): string { $fieldPid = 'pid'; foreach (\array_keys($fields) as $f) { @@ -603,7 +603,7 @@ public function getXcGetFieldParentId($fields) * @param $fields * @return string */ - public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName, $fields) + public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName, $fields): string { $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ret = ''; @@ -643,7 +643,7 @@ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName * @param string $t * @return string */ - public function getXcXoopsRequest(string $left = '', string $var1 = '', string $var2 = '', string $type = 'String', string $t = '') + public function getXcXoopsRequest(string $left = '', string $var1 = '', string $var2 = '', string $type = 'String', string $t = ''): string { $ret = ''; $intVars = ('' != $var2) ? "'{$var1}', {$var2}" : "'{$var1}'"; @@ -672,7 +672,7 @@ public function getXcXoopsRequest(string $left = '', string $var1 = '', string $ * @param string $t * @return string */ - public function getXcAddRight($anchor, string $permString = '', string $var = '', string $groups = '', string $mid = '', bool $isParam = false, string $t = '') + public function getXcAddRight($anchor, string $permString = '', string $var = '', string $groups = '', string $mid = '', bool $isParam = false, string $t = ''): string { if (!$isParam) { $ret = "{$t}\${$anchor}->addRight('{$permString}', {$var}, {$groups}, {$mid});\n"; @@ -696,7 +696,7 @@ public function getXcAddRight($anchor, string $permString = '', string $var = '' * @param string $t * @return string */ - public function getXcCheckRight($anchor, string $permString = '', string $var = '', string $groups = '', string $mid = '', bool $isParam = false, string $t = '') + public function getXcCheckRight($anchor, string $permString = '', string $var = '', string $groups = '', string $mid = '', bool $isParam = false, string $t = ''): string { if (!$isParam) { $ret = "{$t}{$anchor}->checkRight('{$permString}', {$var}, {$groups}, {$mid});\n"; @@ -719,7 +719,7 @@ public function getXcCheckRight($anchor, string $permString = '', string $var = * @param string $t * @return string */ - public function getXcDeleteRight($anchor, string $permString = '', string $mid = '', string $var = '', bool $isParam = false, string $t = '') + public function getXcDeleteRight($anchor, string $permString = '', string $mid = '', string $var = '', bool $isParam = false, string $t = ''): string { if (!$isParam) { $ret = "{$t}\${$anchor}->deleteByModule({$mid}, '{$permString}', {$var});\n"; @@ -736,7 +736,7 @@ public function getXcDeleteRight($anchor, string $permString = '', string $mid = * @param string $t * @return string */ - public function getXcHandlerLine($tableName, string $t = '') + public function getXcHandlerLine($tableName, string $t = ''): string { $ucfTableName = \ucfirst($tableName); @@ -751,7 +751,7 @@ public function getXcHandlerLine($tableName, string $t = '') * @param string $t * @return string */ - public function getXcHandlerCreateObj($tableName, string $t = '') + public function getXcHandlerCreateObj($tableName, string $t = ''): string { return "{$t}\${$tableName}Obj = \${$tableName}Handler->create();\n"; } @@ -764,7 +764,7 @@ public function getXcHandlerCreateObj($tableName, string $t = '') * @param string $t * @return string */ - public function getXcHandlerGetObj($tableName, $ccFieldId, string $t = '') + public function getXcHandlerGetObj($tableName, $ccFieldId, string $t = ''): string { return "{$t}\${$tableName}Obj = \${$tableName}Handler->get(\${$ccFieldId});\n"; } @@ -777,7 +777,7 @@ public function getXcHandlerGetObj($tableName, $ccFieldId, string $t = '') * @param string $t * @return string */ - public function getXcHandlerCountObj($tableName, string $t = '') + public function getXcHandlerCountObj($tableName, string $t = ''): string { $ucfTableName = \ucfirst($tableName); return "{$t}\${$tableName}Count = \${$tableName}Handler->getCount{$ucfTableName}();\n"; @@ -792,7 +792,7 @@ public function getXcHandlerCountObj($tableName, string $t = '') * * @return string */ - public function getXcHandlerCountClear($left, string $anchor = '', string $params = '', string $t = '') + public function getXcHandlerCountClear($left, string $anchor = '', string $params = '', string $t = ''): string { return "{$t}\${$left} = \${$anchor}Handler->getCount({$params});\n"; } @@ -808,7 +808,7 @@ public function getXcHandlerCountClear($left, string $anchor = '', string $param * @param string $t * @return string */ - public function getXcHandlerAllObj($tableName, string $fieldMain = '', string $start = '0', string $limit = '0', string $t = '') + public function getXcHandlerAllObj($tableName, string $fieldMain = '', string $start = '0', string $limit = '0', string $t = ''): string { $ucfTableName = \ucfirst($tableName); $startLimit = ('0' != $limit) ? "{$start}, {$limit}" : '0'; @@ -824,7 +824,7 @@ public function getXcHandlerAllObj($tableName, string $fieldMain = '', string $s * @param string $t * @return string */ - public function getXcHandlerAllClear($left, string $anchor = '', string $params = '', string $t = '') + public function getXcHandlerAllClear($left, string $anchor = '', string $params = '', string $t = ''): string { return "{$t}\${$left} = \${$anchor}Handler->getAll({$params});\n"; } @@ -841,7 +841,7 @@ public function getXcHandlerAllClear($left, string $anchor = '', string $params * @param string $t * @return string */ - public function getXcHandlerGet($left, $var, string $obj = '', string $handler = 'Handler', bool $isParam = false, string $t = '') + public function getXcHandlerGet($left, $var, string $obj = '', string $handler = 'Handler', bool $isParam = false, string $t = ''): string { if ($isParam) { $ret = "\${$left}{$handler}->get(\${$var})"; @@ -862,7 +862,7 @@ public function getXcHandlerGet($left, $var, string $obj = '', string $handler = * * @return string */ - public function getXcHandlerInsert($left, $var, string $obj = '', string $handler = 'Handler') + public function getXcHandlerInsert($left, $var, string $obj = '', string $handler = 'Handler'): string { return "\${$left}{$handler}->insert(\${$var}{$obj})"; } @@ -876,7 +876,7 @@ public function getXcHandlerInsert($left, $var, string $obj = '', string $handle * @param string $handler * @return string */ - public function getXcHandlerDelete($left, $var, string $obj = '', string $handler = 'Handler') + public function getXcHandlerDelete($left, $var, string $obj = '', string $handler = 'Handler'): string { return "\${$left}{$handler}->delete(\${$var}{$obj})"; } @@ -893,7 +893,7 @@ public function getXcHandlerDelete($left, $var, string $obj = '', string $handle * @param string $obj * @return string */ - public function getXcGetValues($tableName, $tableSoleName, string $index = 'i', bool $noArray = false, string $t = '', string $obj = '') + public function getXcGetValues($tableName, $tableSoleName, string $index = 'i', bool $noArray = false, string $t = '', string $obj = ''): string { $index = '' !== $index ? $index : 'i'; $ucfTableName = \ucfirst($tableName); @@ -915,7 +915,7 @@ public function getXcGetValues($tableName, $tableSoleName, string $index = 'i', * @param $fields * @return string */ - public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $fields) + public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $fields): string { $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ret = ''; @@ -971,7 +971,7 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, * @param string $t * @return string */ - public function getXcSecurity($tableName, string $t = '') + public function getXcSecurity($tableName, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $securityError = $this->getXcXoopsSecurityErrors(); @@ -989,7 +989,7 @@ public function getXcSecurity($tableName, string $t = '') * @param string $t * @return string */ - public function getXcInsertData($tableName, $language, string $t = '') + public function getXcInsertData($tableName, $language, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '?op=list', 2, "{$language}FORM_OK"); @@ -1008,7 +1008,7 @@ public function getXcInsertData($tableName, $language, string $t = '') * @param string $t * @return string */ - public function getXcRedirectHeader($directory, $options, $numb, $var, bool $isString = true, string $t = '') + public function getXcRedirectHeader($directory, $options, $numb, $var, bool $isString = true, string $t = ''): string { if (!$isString) { $ret = "{$t}\\redirect_header({$directory}, {$numb}, {$var});\n"; @@ -1021,7 +1021,6 @@ public function getXcRedirectHeader($directory, $options, $numb, $var, bool $isS /** * @public function getXcXoopsConfirm - * @param $tableName * @param $language * @param $fieldId * @param $fieldMain @@ -1030,7 +1029,7 @@ public function getXcRedirectHeader($directory, $options, $numb, $var, bool $isS * @param string $t * @return string */ - public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, string $options = 'delete', string $t = '') + public function getXcXoopsConfirm($language, $fieldId, $fieldMain, string $options = 'delete', string $t = ''): string { $stuOptions = \mb_strtoupper($options); $ccFieldId = Modulebuilder\Files\CreateFile::getInstance()->getCamelCase($fieldId, false, true); @@ -1063,7 +1062,7 @@ public function getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, s * @param string $t * @return string */ - public function getXcHtmlErrors($tableName, bool $isParam = false, string $obj = 'Obj', string $t = '') + public function getXcHtmlErrors($tableName, bool $isParam = false, string $obj = 'Obj', string $t = ''): string { if ($isParam) { $ret = "\${$tableName}{$obj}->getHtmlErrors()"; @@ -1084,7 +1083,7 @@ public function getXcHtmlErrors($tableName, bool $isParam = false, string $obj = * @param string $t * @return string */ - public function getXcGetForm($left, $tableName, string $obj = '', string $t = '') + public function getXcGetForm($left, $tableName, string $obj = '', string $t = ''): string { $ucfTableName = \ucfirst($tableName); @@ -1102,7 +1101,7 @@ public function getXcGetForm($left, $tableName, string $obj = '', string $t = '' * @param string $t * @return string */ - public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, string $t = '') + public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic, string $t = ''): string { $ret = Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); $paramGet = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldNameParent, true); @@ -1141,7 +1140,7 @@ public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fi * * @return string */ - public function getXcTableFieldId($fields) + public function getXcTableFieldId($fields): string { $fieldId = ''; foreach (\array_keys($fields) as $f) { @@ -1160,7 +1159,7 @@ public function getXcTableFieldId($fields) * * @return string */ - public function getXcTableFieldMain($fields) + public function getXcTableFieldMain($fields): string { $fieldMain = ''; foreach (\array_keys($fields) as $f) { @@ -1183,7 +1182,7 @@ public function getXcTableFieldMain($fields) * @param string $t * @return string */ - public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, string $t = '') + public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, string $t = ''): string { $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1256,7 +1255,7 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f * @param string $pageNavTplName * @return string */ - public function getXcPageNav($tableName, string $t = '', string $paramStart = 'start', string $paramOp = "'op=list&limit=' . \$limit", string $pageNavTplName = '') + public function getXcPageNav($tableName, string $t = '', string $paramStart = 'start', string $paramOp = "'op=list&limit=' . \$limit", string $pageNavTplName = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); @@ -1276,7 +1275,7 @@ public function getXcPageNav($tableName, string $t = '', string $paramStart = 's * @param string $t * @return string */ - public function getXcGetGlobal($globals, string $t = '') + public function getXcGetGlobal($globals, string $t = ''): string { $ret = $t . 'global '; $detail = ''; @@ -1299,7 +1298,7 @@ public function getXcGetGlobal($globals, string $t = '') * * @return string */ - public function getXcCriteriaCompo($var, string $t = '') + public function getXcCriteriaCompo($var, string $t = ''): string { return "{$t}\${$var} = new \CriteriaCompo();\n"; } @@ -1316,7 +1315,7 @@ public function getXcCriteriaCompo($var, string $t = '') * * @return string */ - public function getXcCriteria($var, $param1, string $param2 = '', string $param3 = '', bool $isParam = false, string $t = '') + public function getXcCriteria($var, $param1, string $param2 = '', string $param3 = '', bool $isParam = false, string $t = ''): string { $params = ('' != $param2) ? ', ' . $param2 : ''; $params .= ('' != $param3) ? ', ' . $param3 : ''; @@ -1340,7 +1339,7 @@ public function getXcCriteria($var, $param1, string $param2 = '', string $param3 * @param string $condition * @return string */ - public function getXcCriteriaAdd($var, $param, string $t = '', string $n = "\n", string $condition = '') + public function getXcCriteriaAdd($var, $param, string $t = '', string $n = "\n", string $condition = ''): string { if ('' !== $condition) { $condition = ", {$condition}"; @@ -1359,7 +1358,7 @@ public function getXcCriteriaAdd($var, $param, string $t = '', string $n = "\n", * @param string $n * @return string */ - public function getXcCriteriaSetStart($var, $start, string $t = '', string $n = "\n") + public function getXcCriteriaSetStart($var, $start, string $t = '', string $n = "\n"): string { return "{$t}\${$var}->setStart({$start});{$n}"; } @@ -1374,7 +1373,7 @@ public function getXcCriteriaSetStart($var, $start, string $t = '', string $n = * @param string $n * @return string */ - public function getXcCriteriaSetLimit($var, $limit, string $t = '', string $n = "\n") + public function getXcCriteriaSetLimit($var, $limit, string $t = '', string $n = "\n"): string { return "{$t}\${$var}->setLimit({$limit});{$n}"; } @@ -1389,7 +1388,7 @@ public function getXcCriteriaSetLimit($var, $limit, string $t = '', string $n = * @param string $n * @return string */ - public function getXcCriteriaSetSort($var, $sort, string $t = '', string $n = "\n") + public function getXcCriteriaSetSort($var, $sort, string $t = '', string $n = "\n"): string { return "{$t}\${$var}->setSort({$sort});{$n}"; } @@ -1404,7 +1403,7 @@ public function getXcCriteriaSetSort($var, $sort, string $t = '', string $n = "\ * @param string $n * @return string */ - public function getXcCriteriaSetOrder($var, $order, string $t = '', string $n = "\n") + public function getXcCriteriaSetOrder($var, $order, string $t = '', string $n = "\n"): string { return "{$t}\${$var}->setOrder({$order});{$n}"; } @@ -1425,7 +1424,7 @@ public function getXcCriteriaSetOrder($var, $order, string $t = '', string $n = * * @return string */ - public function getXcXoopsFormGroupPerm(string $varLeft = '', string $formTitle = '', string $moduleId = '', string $permName = '', string $permDesc = '', string $filename = '', string $t = '') + public function getXcXoopsFormGroupPerm(string $varLeft = '', string $formTitle = '', string $moduleId = '', string $permName = '', string $permDesc = '', string $filename = '', string $t = ''): string { return "{$t}\${$varLeft} = new \XoopsGroupPermForm({$formTitle}, {$moduleId}, {$permName}, {$permDesc}, {$filename});\n"; } @@ -1441,7 +1440,7 @@ public function getXcXoopsFormGroupPerm(string $varLeft = '', string $formTitle * @param string $t * @return string */ - public function getXoopsFormSelectExtraOptions(string $varSelect = '', string $caption = '', string $var = '', array $options = [], string $setExtra = '', string $t = '') + public function getXoopsFormSelectExtraOptions(string $varSelect = '', string $caption = '', string $var = '', array $options = [], string $setExtra = '', string $t = ''): string { $ret = "{$t}\${$varSelect} = new \XoopsFormSelect({$caption}, '{$var}', \${$var});\n"; if ('' !== $setExtra) { @@ -1463,7 +1462,7 @@ public function getXoopsFormSelectExtraOptions(string $varSelect = '', string $c * @param mixed $const * @return string */ - public function getXcGetConstants($const) + public function getXcGetConstants($const): string { return "Constants::{$const}"; } @@ -1478,7 +1477,7 @@ public function getXcGetConstants($const) * * @return string */ - public function getXcXoopsCPHeader() + public function getXcXoopsCPHeader(): string { return "xoops_cp_header();\n"; } @@ -1488,7 +1487,7 @@ public function getXcXoopsCPHeader() * * @return string */ - public function getXcXoopsCPFooter() + public function getXcXoopsCPFooter(): string { return "xoops_cp_footer();\n"; } @@ -1500,7 +1499,7 @@ public function getXcXoopsCPFooter() * @param string $t * @return string */ - public function getXcXoopsLoad(string $var = '', string $t = '') + public function getXcXoopsLoad(string $var = '', string $t = ''): string { return "{$t}\xoops_load('{$var}');\n"; } @@ -1514,7 +1513,7 @@ public function getXcXoopsLoad(string $var = '', string $t = '') * * @return string */ - public function getXcXoopsLoadLanguage($lang, string $t = '', string $domain = '') + public function getXcXoopsLoadLanguage($lang, string $t = '', string $domain = ''): string { if ('' === $domain) { return "{$t}\xoops_loadLanguage('{$lang}');\n"; @@ -1528,7 +1527,7 @@ public function getXcXoopsLoadLanguage($lang, string $t = '', string $domain = ' * @param string $t * @return string */ - public function getXcXoopsCaptcha(string $t = '') + public function getXcXoopsCaptcha(string $t = ''): string { return "{$t}\$xoopsCaptcha = \XoopsCaptcha::getInstance();\n"; } @@ -1541,7 +1540,7 @@ public function getXcXoopsCaptcha(string $t = '') * * @return string */ - public function getXcXoopsListImgListArray($return, $var, string $t = '') + public function getXcXoopsListImgListArray($return, $var, string $t = ''): string { return "{$t}\${$return} = \XoopsLists::getImgListAsArray( {$var} );\n"; } @@ -1553,7 +1552,7 @@ public function getXcXoopsListImgListArray($return, $var, string $t = '') * * @return string */ - public function getXcXoopsListLangList($return, string $t = '') + public function getXcXoopsListLangList($return, string $t = ''): string { return "{$t}\${$return} = \XoopsLists::getLangList();\n"; } @@ -1565,7 +1564,7 @@ public function getXcXoopsListLangList($return, string $t = '') * * @return string */ - public function getXcXoopsListCountryList($return, string $t = '') + public function getXcXoopsListCountryList($return, string $t = ''): string { return "{$t}\${$return} = \XoopsLists::getCountryList();\n"; } @@ -1578,7 +1577,7 @@ public function getXcXoopsListCountryList($return, string $t = '') * * @return string */ - public function getXcXoopsUserUnameFromId($left, $value, string $t = '') + public function getXcXoopsUserUnameFromId($left, $value, string $t = ''): string { return "{$t}\${$left} = \XoopsUser::getUnameFromId({$value});\n"; } @@ -1593,7 +1592,7 @@ public function getXcXoopsUserUnameFromId($left, $value, string $t = '') * @param string $tpl * @return string */ - public function getXcXoopsTplAssign($tplString, $phpRender, bool $leftIsString = true, string $t = '', string $tpl = '') + public function getXcXoopsTplAssign($tplString, $phpRender, bool $leftIsString = true, string $t = '', string $tpl = ''): string { $assign = "{$t}\$GLOBALS['xoopsTpl']->assign("; if ('' !== $tpl) { @@ -1618,7 +1617,7 @@ public function getXcXoopsTplAssign($tplString, $phpRender, bool $leftIsString = * @param string $t * @return string */ - public function getXcXoopsTplAppend($tplString, $phpRender, string $t = '') + public function getXcXoopsTplAppend($tplString, $phpRender, string $t = ''): string { return "{$t}\$GLOBALS['xoopsTpl']->append('{$tplString}', {$phpRender});\n"; } @@ -1632,7 +1631,7 @@ public function getXcXoopsTplAppend($tplString, $phpRender, string $t = '') * @param string $t * @return string */ - public function getXcXoopsTplAppendByRef($tplString, $phpRender, string $t = '') + public function getXcXoopsTplAppendByRef($tplString, $phpRender, string $t = ''): string { return "{$t}\$GLOBALS['xoopsTpl']->appendByRef('{$tplString}', {$phpRender});\n"; } @@ -1645,7 +1644,7 @@ public function getXcXoopsTplAppendByRef($tplString, $phpRender, string $t = '') * @param bool $usedoublequotes * @return string */ - public function getXcXoopsTplDisplay(string $displayTpl = '{$templateMain}', string $t = '', bool $usedoublequotes = true) + public function getXcXoopsTplDisplay(string $displayTpl = '{$templateMain}', string $t = '', bool $usedoublequotes = true): string { if ($usedoublequotes) { return "{$t}\$GLOBALS['xoopsTpl']->display(\"db:{$displayTpl}\");\n"; @@ -1664,7 +1663,7 @@ public function getXcXoopsTplDisplay(string $displayTpl = '{$templateMain}', str * @param string $t * @return string */ - public function getXcXoopsPath($directory, $filename, bool $isParam = false, string $t = '') + public function getXcXoopsPath($directory, $filename, bool $isParam = false, string $t = ''): string { if (!$isParam) { $ret = "{$t}\$GLOBALS['xoops']->path({$directory}.'/{$filename}.php');\n"; @@ -1685,7 +1684,7 @@ public function getXcXoopsPath($directory, $filename, bool $isParam = false, str * @param string $t * @return string */ - public function getXcXoopsModuleGetInfo($left, $string, bool $isParam = false, string $t = '') + public function getXcXoopsModuleGetInfo($left, $string, bool $isParam = false, string $t = ''): string { if (!$isParam) { $ret = "{$t}\${$left} = \$GLOBALS['xoopsModule']->getInfo('{$string}');\n"; @@ -1704,7 +1703,7 @@ public function getXcXoopsModuleGetInfo($left, $string, bool $isParam = false, s * @param bool $isString * @return string */ - public function getXcXoThemeAddStylesheet(string $style = 'style', string $t = '', bool $isString = true) + public function getXcXoThemeAddStylesheet(string $style = 'style', string $t = '', bool $isString = true): string { $ret = "{$t}\$GLOBALS['xoTheme']->addStylesheet("; if ($isString) { @@ -1720,7 +1719,7 @@ public function getXcXoThemeAddStylesheet(string $style = 'style', string $t = ' * @param string $denial * @return string */ - public function getXcXoopsSecurityCheck(string $denial = '') + public function getXcXoopsSecurityCheck(string $denial = ''): string { return "{$denial}\$GLOBALS['xoopsSecurity']->check()"; } @@ -1730,7 +1729,7 @@ public function getXcXoopsSecurityCheck(string $denial = '') * * @return string */ - public function getXcXoopsSecurityErrors() + public function getXcXoopsSecurityErrors(): string { return "\$GLOBALS['xoopsSecurity']->getErrors()"; } @@ -1742,7 +1741,7 @@ public function getXcXoopsSecurityErrors() * @param string $n * @return string */ - public function getXcXoopsHandler($left, string $t = '', string $n = "\n") + public function getXcXoopsHandler($left, string $t = '', string $n = "\n"): string { return "{$t}\${$left}Handler = \xoops_getHandler('{$left}');{$n}"; } @@ -1760,7 +1759,7 @@ public function getXcXoopsHandler($left, string $t = '', string $n = "\n") * @param string $language * @return string */ - public function getXcCommonPagesEdit($tableName, $ccFieldId, string $t = '', string $language = '') + public function getXcCommonPagesEdit($tableName, $ccFieldId, string $t = '', string $language = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1784,7 +1783,7 @@ public function getXcCommonPagesEdit($tableName, $ccFieldId, string $t = '', str * @param string $t * @return string */ - public function getXcCommonPagesNew($tableName, string $t = '') + public function getXcCommonPagesNew($tableName, string $t = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1805,7 +1804,7 @@ public function getXcCommonPagesNew($tableName, string $t = '') * @param string $language * @return string */ - public function getXcCommonPagesClone($tableName, $ccFieldId, string $t = '', string $language = '') + public function getXcCommonPagesClone($tableName, $ccFieldId, string $t = '', string $language = ''): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1834,7 +1833,7 @@ public function getXcCommonPagesClone($tableName, $ccFieldId, string $t = '', st * @param bool $admin * @return string */ - public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, string $t = '', bool $admin = false) + public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, string $t = '', bool $admin = false): string { $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); @@ -1869,7 +1868,7 @@ public function getXcCommonPagesDelete($language, $tableName, $tableSoleName, $f $htmlErrors = $xc->getXcHtmlErrors($tableName, true); $internalElse = $xc->getXcXoopsTplAssign('error', $htmlErrors, true, $t . "\t\t"); $condition .= $pc->getPhpCodeConditions($delete, '', '', $contInsert, $internalElse, $t . "\t"); - $mainElse = $xc->getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, 'delete', $t . "\t"); + $mainElse = $xc->getXcXoopsConfirm($language, $fieldId, $fieldMain, 'delete', $t . "\t"); $ret .= $pc->getPhpCodeConditions($isset, ' && ', "1 == \${$reqOk}", $condition, $mainElse, $t); return $ret; diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index fbec75d4..55bc8bc4 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -31,10 +31,6 @@ */ class LanguageHelp extends Files\CreateFile { - /** - * @var mixed - */ - //private $ld = null; /** * @public function constructor @@ -42,7 +38,6 @@ class LanguageHelp extends Files\CreateFile public function __construct() { parent::__construct(); - //$this->ld = LanguageDefines::getInstance(); } /** diff --git a/class/Files/Templates/Admin/TemplatesAdminBroken.php b/class/Files/Templates/Admin/TemplatesAdminBroken.php index 7057998d..404892d7 100644 --- a/class/Files/Templates/Admin/TemplatesAdminBroken.php +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -119,12 +119,12 @@ private function getTemplatesAdminBrokenTableThead(string $language) private function getTemplatesAdminBrokenTableTBody(string $tableName, $tableSoleName) { $td = ''; - $doubleKey = $this->sc->getSmartyDoubleVar($tableSoleName, 'key', '', '', "''|escape:'htmlattr'"); - $doubleVal = $this->sc->getSmartyDoubleVar($tableSoleName, 'keyval', '', '', "''|escape:'htmlattr'"); + $doubleKey = $this->sc->getSmartyDoubleVar($tableSoleName, 'key', '', '', "''", "'htmlattr'"); + $doubleVal = $this->sc->getSmartyDoubleVar($tableSoleName, 'keyval', '', '', "''", "'htmlattr'"); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'table', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'table', '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'main', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'main', '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); $lang = $this->sc->getSmartyConst('', '_EDIT'); $src = $this->sc->getSmartyNoSimbol("xoModuleIcons16 'edit.png'"); diff --git a/class/Files/Templates/Admin/TemplatesAdminPages.php b/class/Files/Templates/Admin/TemplatesAdminPages.php index 2abace26..76328a6d 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -155,7 +155,7 @@ private function getTemplatesAdminPagesTableTBody(string $moduleDirname, string switch ($fieldElement) { case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_CHECKBOX: @@ -174,20 +174,20 @@ private function getTemplatesAdminPagesTableTBody(string $moduleDirname, string break; case Constants::FIELD_ELE_IMAGELIST: $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); - $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true,'',''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_UPLOADIMAGE: - $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url','','',"''|escape:'htmlattr'"); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName,'','',"''|escape:'htmlattr'"); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url','','',"''", "'htmlattr'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName,'','',"''", "'htmlattr'"); $img = $this->hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName, 'style' => 'max-width:100px'], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'status', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'status', '', '', "''", "'html'"); $src = $this->sc->getSmartyNoSimbol('$modPathIcon16') . 'status' . $double . '.png'; - $imgAlt = $this->sc->getSmartyDoubleVar($tableSoleName, 'status_text', '', '', "''|escape:'html'"); + $imgAlt = $this->sc->getSmartyDoubleVar($tableSoleName, 'status_text', '', '', "''", "'html'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $imgAlt, 'title' => $imgAlt], '', true,'',''); $td .= $this->hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); break; @@ -196,12 +196,12 @@ private function getTemplatesAdminPagesTableTBody(string $moduleDirname, string case Constants::FIELD_ELE_DATETIME: case Constants::FIELD_ELE_RADIO_ONOFFLINE: case Constants::FIELD_ELE_TEXTDATESELECT: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); break; default: if (0 != $f) { - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); } break; diff --git a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php index dccad169..3ee8c03e 100644 --- a/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocks.php @@ -148,19 +148,19 @@ private function getTemplatesBlocksTableTbody(string $moduleDirname, $tableId, $ break; case Constants::FIELD_ELE_IMAGELIST: $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); - $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $src .= $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; case Constants::FIELD_ELE_UPLOADIMAGE: - $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''", "'htmlattr'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $img = $this->hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName], '', true, '', ''); $td .= $this->hc->getHtmlTableData($img, 'center', '', "\t\t\t"); break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -169,12 +169,12 @@ private function getTemplatesBlocksTableTbody(string $moduleDirname, $tableId, $ case Constants::FIELD_ELE_SELECTUSER: case Constants::FIELD_ELE_DATETIME: case Constants::FIELD_ELE_TEXTDATESELECT: - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); break; default: if (0 != $f) { - $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); } break; @@ -196,7 +196,7 @@ private function getTemplatesBlocksTableTbody(string $moduleDirname, $tableId, $ // $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|escape:"htmlattr"'); - $single = $this->sc->getSmartySingleVar($moduleDirname . '_url', '', '', "''|escape:'htmlattr'"); + $single = $this->sc->getSmartySingleVar($moduleDirname . '_url', '', '', "''", "'htmlattr'"); $anchor = $this->hc->getHtmlAnchor($single . '/' . $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"'); diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index f101fec4..42c55926 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -93,10 +93,10 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $stuModuleDirname = \strtoupper($moduleDirname); - $title = $this->sc->getSmartyDoubleVar('itm', 'title','','','""|escape:"html"'); - $title2 = $this->sc->getSmartyDoubleVar('itm', 'title','','','""|escape:"htmlattr"'); - $titleElse = $this->sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n", '""|escape:"html"'); - $link = $this->sc->getSmartyDoubleVar('itm', 'link','','','""|escape:"htmlattr"'); + $title = $this->sc->getSmartyDoubleVar('itm', 'title','','',"''", "'html'"); + $title2 = $this->sc->getSmartyDoubleVar('itm', 'title','','',"''", "'htmlattr'"); + $titleElse = $this->sc->getSmartyDoubleVar('itm', 'title', "\t\t\t", "\n", "''", "'html'"); + $link = $this->sc->getSmartyDoubleVar('itm', 'link','','',"''", "'htmlattr'"); $glyph = $this->hc->getHtmlTag('i', ['class' => 'glyphicon glyphicon-home fa fa-home'], '', false, '', ''); $langHome = $this->sc->getSmartyConst('_MA_' . $stuModuleDirname, '_HOME'); $anchor = $this->hc->getHtmlAnchor("<{xoAppUrl 'index.php'}>", $glyph, $langHome); diff --git a/class/Files/Templates/User/Defstyle/Categories.php b/class/Files/Templates/User/Defstyle/Categories.php index 35d7e8db..6dda46ff 100644 --- a/class/Files/Templates/User/Defstyle/Categories.php +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -82,7 +82,7 @@ public function write($module, $table, string $filename): void * @param string $moduleDirname * @return string */ - private function getTemplatesUserCategoriesHeader(string $moduleDirname) + private function getTemplatesUserCategoriesHeader(string $moduleDirname): string { return $this->sc->getSmartyIncludeFile($moduleDirname) . PHP_EOL; } @@ -95,7 +95,7 @@ private function getTemplatesUserCategoriesHeader(string $moduleDirname) * @param $tableSoleName * @return string */ - private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, string $language) + private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, string $language): string { $single = $this->sc->getSmartySingleVar('table_type'); $table = $this->getTemplatesUserCategoriesThead($tableName, $language); @@ -110,7 +110,7 @@ private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $ta * @param $tableName * @return string */ - private function getTemplatesUserCategoriesThead($tableName, string $language) + private function getTemplatesUserCategoriesThead($tableName, string $language): string { $stuTableName = \mb_strtoupper($tableName); $lang = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE'); @@ -128,7 +128,7 @@ private function getTemplatesUserCategoriesThead($tableName, string $language) * @param $tableSoleName * @return string */ - private function getTemplatesUserCategoriesTbody(string $moduleDirname, $tableName, $tableSoleName) + private function getTemplatesUserCategoriesTbody(string $moduleDirname, $tableName, $tableSoleName): string { $single = $this->sc->getSmartySingleVar('panel_type'); $include = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); @@ -146,7 +146,7 @@ private function getTemplatesUserCategoriesTbody(string $moduleDirname, $tableNa * @private function getTemplatesUserCategoriesTfoot * @return string */ - private function getTemplatesUserCategoriesTfoot() + private function getTemplatesUserCategoriesTfoot(): string { $td = $this->hc->getHtmlTableData(' ') . PHP_EOL; $tr = $this->hc->getHtmlTableRow($td) . PHP_EOL; @@ -162,7 +162,7 @@ private function getTemplatesUserCategoriesTfoot() * @param $language * @return string */ - private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSoleName, $language) + private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSoleName, $language): string { $tab = $this->getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) . PHP_EOL; $div = $this->hc->getHtmlDiv($tab, 'table-responsive') . PHP_EOL; @@ -178,7 +178,7 @@ private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSo * @param $language * @return string */ - private function getTemplatesUserCategoriesPanel(string $moduleDirname, string $tableName, $tableSoleName, $language) + private function getTemplatesUserCategoriesPanel(string $moduleDirname, string $tableName, $tableSoleName, $language): string { $stuTableName = \mb_strtoupper($tableName); $incl = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL; @@ -199,7 +199,7 @@ private function getTemplatesUserCategoriesPanel(string $moduleDirname, string $ * * @return string */ - private function getTemplatesUserCategoriesFooter(string $moduleDirname) + private function getTemplatesUserCategoriesFooter(string $moduleDirname): string { return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); } @@ -208,7 +208,7 @@ private function getTemplatesUserCategoriesFooter(string $moduleDirname) * @public function render * @return string */ - public function render() + public function render(): string { $module = $this->getModule(); $table = $this->getTable(); diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php index d2eaab21..208c1438 100644 --- a/class/Files/Templates/User/Defstyle/PagesItem.php +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -72,8 +72,8 @@ public static function getInstance() * @public function write * @param $module * @param $table - * @param string $filename * @param $tables + * @param string $filename */ public function write($module, $table, $tables, string $filename): void { @@ -116,14 +116,14 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, default: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''", "'html'"); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -133,14 +133,14 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, case Constants::FIELD_ELE_TEXTDATESELECT: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''", "'html'"); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''", "'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); unset($img); @@ -148,8 +148,8 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, case Constants::FIELD_ELE_UPLOADIMAGE: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''", "'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); $retNumb .= $this->hc->getHtmlHNumb($doubleVar, '3', 'panel-title', "\t"); unset($img); @@ -169,14 +169,14 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, default: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; case Constants::FIELD_ELE_TEXTAREA: case Constants::FIELD_ELE_DHTMLTEXTAREA: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''", "'html'"); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -186,14 +186,14 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, case Constants::FIELD_ELE_TEXTDATESELECT: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''", "'html'"); $retElem .= $this->hc->getHtmlSpan($doubleVar, 'col-sm-9 justify', "\t"); break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''", "'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify', "\t"); unset($img); @@ -201,8 +201,8 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, case Constants::FIELD_ELE_UPLOADIMAGE: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''", "'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); $retElem .= $this->hc->getHtmlSpan($img, 'col-sm-9 justify',"\t"); unset($img); @@ -224,7 +224,7 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); break; case Constants::FIELD_ELE_TEXTAREA: @@ -233,7 +233,7 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''", "'html'"); $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); break; case Constants::FIELD_ELE_SELECTSTATUS: @@ -245,14 +245,14 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $rpFieldName = $this->getRightString($fieldName); $langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $lang = $this->sc->getSmartyConst($language, $langConst); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''|escape:'html'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''", "'html'"); $retFoot .= $this->hc->getHtmlSpan($lang . ': ' . $doubleVar, 'block-pie justify',"\t"); break; case Constants::FIELD_ELE_IMAGELIST: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''|escape:'htmlattr'"); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url', '', '', "''", "'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName); $retFoot .= $this->hc->getHtmlSpan($img, 'block-pie justify', "\t"); unset($img); @@ -260,8 +260,8 @@ private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, case Constants::FIELD_ELE_UPLOADIMAGE: $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''|escape:'htmlattr'"); - $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''|escape:'htmlattr'"); + $singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url', '', '', "''", "'htmlattr'"); + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'htmlattr'"); $img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName); $retFoot .= $this->hc->getHtmlSpan($img, 'block-pie justify',"\t"); unset($img); diff --git a/class/Files/Templates/User/Defstyle/PagesList.php b/class/Files/Templates/User/Defstyle/PagesList.php index 7c31342a..db294997 100644 --- a/class/Files/Templates/User/Defstyle/PagesList.php +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -93,7 +93,7 @@ public function write($module, $table, $tables, string $filename): void * @param $language * @return string */ - private function getTemplatesUserPagesListPanel(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) + private function getTemplatesUserPagesListPanel(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language): string { $fields = $this->getTableFields($tableMid, $tableId); $ret = ''; @@ -280,7 +280,7 @@ private function getTemplatesUserPagesListPanel(string $moduleDirname, $tableId, * * @return string */ - public function render() + public function render(): string { $module = $this->getModule(); $table = $this->getTable(); diff --git a/class/Files/User/UserPages.php b/class/Files/User/UserPages.php index 41aefeb9..74b2b211 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -166,7 +166,7 @@ private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMa $ccFieldReads = $this->getCamelCase($fieldReads, false, true); $stuModuleDirname = \mb_strtoupper($moduleDirname); - $ret = $this->uxc->getUserBreadcrumbs($language, $tableName, 'list', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableName, 'list', '', $t); if ($tableRate) { $varRate = '$ratingbars'; $ret .= $this->xc->getXcEqualsOperator($varRate, '(int)' . $this->xc->getXcGetConfig('ratingbars'),'', $t); @@ -413,7 +413,7 @@ private function getPermissionsSave($moduleDirname, $ucfFieldId, string $perm = */ public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, string $t = '') { - $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'add', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'add', '', $t); if (1 == $tablePermissions) { $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, '\_NOPERM', true, $t . "\t"); @@ -436,7 +436,7 @@ public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $ */ public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, string $t = '') { - $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'edit', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'edit', '', $t); $ccFieldId = $this->getCamelCase($fieldId, false, true); if (1 == $tablePermissions) { $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); @@ -463,7 +463,7 @@ public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, */ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, string $t = '') { - $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'clone', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'clone', '', $t); $ccFieldId = $this->getCamelCase($fieldId, false, true); if (1 == $tablePermissions) { $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); @@ -494,7 +494,7 @@ public function getUserPagesClone($tableName, $tableSoleName, $tablePermissions, */ private function getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications, string $t = '') { - $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'delete', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, $tableSoleName, 'delete', '', $t); $ccFieldId = $this->getCamelCase($fieldId, false, true); if (1 == $tablePermissions) { $ret .= $this->pc->getPhpCodeCommentLine('Check permissions', '', $t); @@ -526,7 +526,7 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl { $ccFieldId = $this->getCamelCase($fieldId, false, true); $ccFieldMain = $this->getCamelCase($fieldMain, false, true); - $ret = $this->uxc->getUserBreadcrumbs($language, '', 'broken', '', "\t\t"); + $ret = $this->uxc->getUserBreadcrumbs($language, '', 'broken', '', $t); $ret .= $this->pc->getPhpCodeCommentLine('Check params', '', $t); $contIf = $this->xc->getXcRedirectHeader($tableName, '?op=list', 3, "{$language}INVALID_PARAM", true, $t . "\t"); $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $contIf, false, $t); @@ -562,7 +562,7 @@ private function getUserPagesBroken($language, $moduleDirname, $tableName, $tabl $htmlErrors = $this->xc->getXcHtmlErrors($tableName, true); $internalElse = $this->xc->getXcXoopsTplAssign('error', $htmlErrors, true, $t . "\t\t"); $condition .= $this->pc->getPhpCodeConditions($insert, '', '', $contInsert, $internalElse, $t . "\t"); - $mainElse = $this->xc->getXcXoopsConfirm($tableName, $language, $fieldId, $fieldMain, 'broken', $t . "\t"); + $mainElse = $this->xc->getXcXoopsConfirm($language, $fieldId, $fieldMain, 'broken', $t . "\t"); $ret .= $this->pc->getPhpCodeConditions($isset, ' && ', "1 == \${$reqOk}", $condition, $mainElse, $t); return $ret; diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index b6a2da57..0a1c7035 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -134,9 +134,10 @@ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language * @param $tableName * @param $tableSolename * @param $fields + * @param $tablePermissions * @return string */ - public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields) + public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields, $tablePermissions) { $stuModuleDirname = \mb_strtoupper($moduleDirname); @@ -144,21 +145,22 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie $ccFieldId = $this->getCamelCase($fieldId, false, true); $fieldMain = $this->xc->getXcTableFieldMain($fields); - $ret = $this->pc->getPhpCodeCommentLine('Check permissions'); - $ret .= $this->getSimpleString('$currentuid = 0;'); - $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); - $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); - $ret .= $this->xc->getXcXoopsHandler('groupperm'); - $ret .= $this->xc->getXcXoopsHandler('member'); - $condIf = $this->getSimpleString('$my_group_ids = [\XOOPS_GROUP_ANONYMOUS];', "\t"); - $condElse = $this->getSimpleString('$my_group_ids = $memberHandler->getGroupsByUser($currentuid);', "\t"); - $ret .= $this->pc->getPhpCodeConditions('0', ' === ', '$currentuid', $condIf, $condElse); - $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view_{$tableName}", "\${$ccFieldId}", '$my_group_ids', "\$GLOBALS['xoopsModule']->getVar('mid')", true); - $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); - $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); - $noPerm .= $this->getSimpleString('exit();', "\t"); - $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); - + if (1 === $tablePermissions) { + $ret = $this->pc->getPhpCodeCommentLine('Check permissions'); + $ret .= $this->getSimpleString('$currentuid = 0;'); + $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); + $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); + $ret .= $this->xc->getXcXoopsHandler('groupperm'); + $ret .= $this->xc->getXcXoopsHandler('member'); + $condIf = $this->getSimpleString('$my_group_ids = [\XOOPS_GROUP_ANONYMOUS];', "\t"); + $condElse = $this->getSimpleString('$my_group_ids = $memberHandler->getGroupsByUser($currentuid);', "\t"); + $ret .= $this->pc->getPhpCodeConditions('0', ' === ', '$currentuid', $condIf, $condElse); + $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view_{$tableName}", "\${$ccFieldId}", '$my_group_ids', "\$GLOBALS['xoopsModule']->getVar('mid')", true); + $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); + $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); + $noPerm .= $this->getSimpleString('exit();', "\t"); + $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); + } $ret .= $this->pc->getPhpCodeCommentLine('Set defaults'); $ret .= $this->xc->getXcEqualsOperator('$pdfFilename', "'$tableName.pdf'"); $ret .= $this->xc->getXcEqualsOperator('$content ', "''"); @@ -284,20 +286,21 @@ private function getUserPdfFooter($moduleDirname, $tableName) */ public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $tableName = $table->getVar('table_name'); - $tableSolename = $table->getVar('table_solename'); - $fields = $this->getTableFields($tableMid, $tableId); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserPdfHeader($moduleDirname, $tableName, $fields, $language); - $content .= $this->getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields); - $content .= $this->getUserPdfFooter($moduleDirname, $tableName); + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableId = $table->getVar('table_id'); + $tableMid = $table->getVar('table_mid'); + $tableName = $table->getVar('table_name'); + $tableSolename = $table->getVar('table_solename'); + $tablePermissions = (int)$table->getVar('table_permissions'); + $fields = $this->getTableFields($tableMid, $tableId); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getHeaderFilesComments($module); + $content .= $this->getUserPdfHeader($moduleDirname, $tableName, $fields, $language); + $content .= $this->getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields, $tablePermissions); + $content .= $this->getUserPdfFooter($moduleDirname, $tableName); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 65fb8622..75a30cc4 100644 --- a/class/Files/User/UserPrint.php +++ b/class/Files/User/UserPrint.php @@ -84,7 +84,7 @@ public function write($module, $table, string $filename): void * * @return string */ - public function getUserPrint(string $moduleDirname, string $language) + public function getUserPrint(string $moduleDirname, string $language, int $tablePermissions) { $stuModuleDirname = \mb_strtoupper($moduleDirname); $table = $this->getTable(); @@ -122,15 +122,6 @@ public function getUserPrint(string $moduleDirname, string $language) $ret .= $this->pc->getPhpCodeCommentLine('Get Instance of Handler'); $ret .= $this->xc->getXcHandlerLine($tableName); - $ret .= $this->getSimpleString('$currentuid = 0;'); - $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); - $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); - $ret .= $this->xc->getXcXoopsHandler('groupperm'); - $ret .= $this->xc->getXcXoopsHandler('member'); - $condIf = $this->getSimpleString('$my_group_ids = [\XOOPS_GROUP_ANONYMOUS];', "\t"); - $condElse = $this->getSimpleString('$my_group_ids = $memberHandler->getGroupsByUser($currentuid);', "\t"); - $ret .= $this->pc->getPhpCodeConditions('0', ' === ', '$currentuid', $condIf, $condElse); - $ret .= $this->pc->getPhpCodeCommentLine('Verify that the article is published'); if (false !== mb_strpos($fieldName, 'published')) { $ret .= $this->pc->getPhpCodeCommentLine('Not yet', $fieldName); @@ -156,11 +147,21 @@ public function getUserPrint(string $moduleDirname, string $language) $tablenameObj = $this->pc->getPhpCodeIsobject($tableName . 'Obj'); $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', "{$language}INVALID_PARAM", true, "\t"); $ret .= $this->pc->getPhpCodeConditions('!' . $tablenameObj, '', '', $redirectError); - $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view_{$tableName}", "\${$tableName}Obj->getVar('{$fieldId}')", '$my_group_ids', "\$GLOBALS['xoopsModule']->getVar('mid')", true); - $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); - $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); - $noPerm .= $this->getSimpleString('exit();', "\t"); - $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); + if (1 === $tablePermissions) { + $ret .= $this->getSimpleString('$currentuid = 0;'); + $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); + $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); + $ret .= $this->xc->getXcXoopsHandler('groupperm'); + $ret .= $this->xc->getXcXoopsHandler('member'); + $condIf = $this->getSimpleString('$my_group_ids = [\XOOPS_GROUP_ANONYMOUS];', "\t"); + $condElse = $this->getSimpleString('$my_group_ids = $memberHandler->getGroupsByUser($currentuid);', "\t"); + $ret .= $this->pc->getPhpCodeConditions('0', ' === ', '$currentuid', $condIf, $condElse); + $gperm = $this->xc->getXcCheckRight('!$grouppermHandler', "{$moduleDirname}_view_{$tableName}", "\${$tableName}Obj->getVar('{$fieldId}')", '$my_group_ids', "\$GLOBALS['xoopsModule']->getVar('mid')", true); + $ret .= $this->pc->getPhpCodeCommentLine('Verify permissions'); + $noPerm = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '3', '\_NOPERM', false, "\t"); + $noPerm .= $this->getSimpleString('exit();', "\t"); + $ret .= $this->pc->getPhpCodeConditions($gperm, '', '', $noPerm); + } $ret .= $this->xc->getXcGetValues($tableName, $tableSoleName . 'List', '', true, '', 'Obj'); $ret .= $this->xc->getXcXoopsTplAppend($tableName . '_list', '$' . $tableSoleName . 'List'); $ret .= $this->pc->getPhpCodeBlankLine(); @@ -179,12 +180,14 @@ public function getUserPrint(string $moduleDirname, string $language) */ public function render() { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserPrint($moduleDirname, $language); + $module = $this->getModule(); + $filename = $this->getFileName(); + $table = $this->getTable(); + $tablePermissions = (int)$table->getVar('table_permissions'); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + $content = $this->getHeaderFilesComments($module); + $content .= $this->getUserPrint($moduleDirname, $language, $tablePermissions); $this->create($moduleDirname, '/', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index 0510f2e7..85861d08 100644 --- a/class/Files/User/UserRate.php +++ b/class/Files/User/UserRate.php @@ -254,7 +254,7 @@ public function getUserRateSave($tables, $language, $t, $moduleDirname) $sql .= $this->getSimpleString(") r ON r.rate_itemid = t." . $fieldId . " and r.rate_source = ' . \$source . '", $t . "\t\t\t"); $sql .= $this->getSimpleString('SET', $t . "\t\t\t"); $sql .= $this->getSimpleString('t.' . $fieldVotes . ' = COALESCE(r.votes, 0),', $t . "\t\t\t\t"); - $sql .= $this->getSimpleString('t.' . $fieldRatings . ' = COALESCE(r.avg_rating, 0),', $t . "\t\t\t\t"); + $sql .= $this->getSimpleString('t.' . $fieldRatings . ' = COALESCE(r.avg_rating, 0)', $t . "\t\t\t\t"); $sql .= $this->getSimpleString("WHERE t." . $fieldId . " = ' . \$itemid;", $t . "\t\t\t"); $contIfInt = $sql; diff --git a/class/Modules.php b/class/Modules.php index f18bbd3e..c2d379a7 100644 --- a/class/Modules.php +++ b/class/Modules.php @@ -353,45 +353,6 @@ public function getFormModules($action = false) return $form; } - /** - * @private static function createLogo - * @param mixed $logoIcon - * @param string $moduleDirname - * - * @return bool|string - */ - private static function createLogo($logoIcon, string $moduleDirname) - { - if (!\extension_loaded('gd')) { - return false; - } - $requiredFunctions = ['imagecreatefrompng', 'imagefttext', 'imagecopy', 'imagepng', 'imagedestroy', 'imagecolorallocate']; - foreach ($requiredFunctions as $func) { - if (!\function_exists($func)) { - return false; - } - } - - if (!\file_exists($imageBase = TDMC_IMAGES_LOGOS_PATH . '/empty.png') - || !\file_exists($font = TDMC_FONTS_PATH . '/VeraBd.ttf') - || !\file_exists($iconFile = XOOPS_ICONS32_PATH . '/' . \basename($logoIcon))) { - return false; - } - $imageModule = \imagecreatefrompng($imageBase); - $imageIcon = \imagecreatefrompng($iconFile); - // Write text - $textColor = imagecolorallocate($imageModule, 0, 0, 0); - $spaceBorder = (92 - mb_strlen($moduleDirname) * 7.5) / 2; - imagefttext($imageModule, 8.5, 0, $spaceBorder, 45, $textColor, $font, \ucfirst($moduleDirname)); - imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32); - $logoImg = '/' . 'logoModule.png'; - \imagepng($imageModule, TDMC_UPLOAD_IMGMOD_PATH . $logoImg); - \imagedestroy($imageModule); - \imagedestroy($imageIcon); - - return TDMC_UPLOAD_IMGMOD_URL . $logoImg; - } - /** * Get Values. * From 85be4bfdab97c20e49d01766b22710e4d725b099 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 09:38:20 +0200 Subject: [PATCH 258/266] corrections coderabbitai 3 --- class/Common/DirectoryChecker.php | 6 +++--- class/Files/CreateXoopsCode.php | 15 ++++++++------- class/Files/Language/LanguageHelp.php | 5 ++++- .../Files/Templates/User/Defstyle/Breadcrumbs.php | 2 +- class/Files/User/UserPdf.php | 3 ++- class/Files/admin/AdminPages.php | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 77172127..1ed64fd4 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -150,9 +150,9 @@ public static function dirExists($dir_path) if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST') || !\Xmf\Request::hasVar('mode', 'POST')) { break; } - $path = \Xmf\Request::getString('path', 'POST'); - $redirect = \Xmf\Request::getString('redirect', 'POST'); - $mode = \Xmf\Request::getInt('mode', 'POST'); + $path = \Xmf\Request::getString('path'); + $redirect = \Xmf\Request::getString('redirect'); + $mode = \Xmf\Request::getInt('mode'); $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); \redirect_header($redirect, 2, $msg . ': ' . $path); diff --git a/class/Files/CreateXoopsCode.php b/class/Files/CreateXoopsCode.php index 8c2b9e2e..45820900 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -177,11 +177,12 @@ public function getXcGetItemIds(string $var = '', string $anchor = '', $param1 = * @param $tableName * @param $tableSoleName * @param $fieldName - * @param string $t * @param string $language + * @param string $t + * * @return string */ - public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, string $t = '', string $language = ''): string + public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, string $language, string $t = ''): string { $cf = Modulebuilder\Files\CreateFile::getInstance(); $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); @@ -622,10 +623,10 @@ public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName $ret .= $axc->getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, '', $countUploader); $countUploader++; } elseif (14 == $fieldElement) { - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, '', '', $countUploader); + $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, '', $countUploader); $countUploader++; } elseif (15 == $fieldElement) { - $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, '', $language); + $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language); } else { $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']"); } @@ -947,11 +948,11 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $countUploader++; break; case 14: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $countUploader, $fieldMain); + $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, '', $countUploader, $fieldMain); $countUploader++; break; case 15: - $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, '', $language); + $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language); break; default: $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']"); @@ -1222,7 +1223,7 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f $countUploader++; break; case 15: - $fieldLines .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t, $language); + $fieldLines .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language, $t); break; case 17: $fieldLines .= $axc->getAxcSetVarPassword($tableName, $fieldName, $t); diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 55bc8bc4..47de7a28 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -60,7 +60,7 @@ public static function getInstance() * @param $module * @param string $filename */ - public function write($module, string $filename): void + public function write(Modulebuilder\Modules $module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -109,6 +109,9 @@ public function render() EOT; if ('english' !== $language) { $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + if (!$this->renderFile()) { + throw new \RuntimeException("The help.tpl file in 'language/" . $language . "/help' could not be created."); + } } $this->create($moduleDirname, 'language/english/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); diff --git a/class/Files/Templates/User/Defstyle/Breadcrumbs.php b/class/Files/Templates/User/Defstyle/Breadcrumbs.php index 42c55926..30d39485 100644 --- a/class/Files/Templates/User/Defstyle/Breadcrumbs.php +++ b/class/Files/Templates/User/Defstyle/Breadcrumbs.php @@ -86,7 +86,7 @@ public function write($module, string $filename): void * * @return string */ - public function render() + public function render(): string { $module = $this->getModule(); $filename = $this->getFileName(); diff --git a/class/Files/User/UserPdf.php b/class/Files/User/UserPdf.php index 0a1c7035..b38f7b7d 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -145,8 +145,9 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fie $ccFieldId = $this->getCamelCase($fieldId, false, true); $fieldMain = $this->xc->getXcTableFieldMain($fields); + $ret = ''; if (1 === $tablePermissions) { - $ret = $this->pc->getPhpCodeCommentLine('Check permissions'); + $ret .= $this->pc->getPhpCodeCommentLine('Check permissions'); $ret .= $this->getSimpleString('$currentuid = 0;'); $condIf = $this->getSimpleString('$currentuid = $xoopsUser->uid();', "\t"); $ret .= $this->pc->getPhpCodeConditions('isset($xoopsUser) && \is_object($xoopsUser)', '', '', $condIf); diff --git a/class/Files/admin/AdminPages.php b/class/Files/admin/AdminPages.php index 386e639b..2273b5eb 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -328,7 +328,7 @@ private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $ $countUploader++; break; case Constants::FIELD_ELE_TEXTDATESELECT: - $fieldLines .= $this->xc->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t, $language); + $fieldLines .= $this->xc->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language, $t); break; case Constants::FIELD_ELE_PASSWORD: $fieldLines .= $this->axc->getAxcSetVarPassword($tableName, $fieldName, $t); From 031e944f6a18b19cc352c234ff142a642d5bf9f5 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 09:58:48 +0200 Subject: [PATCH 259/266] corrections coderabbitai 4 --- class/Common/DirectoryChecker.php | 10 +++++----- class/Files/Language/LanguageHelp.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 1ed64fd4..695fe35e 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -141,8 +141,8 @@ public static function dirExists($dir_path) if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST')) { break; } - $path = \Xmf\Request::getString('path', 'POST'); - $redirect = \Xmf\Request::getString('redirect', 'POST'); + $path = \Xmf\Request::getString('path','', 'POST'); + $redirect = \Xmf\Request::getString('redirect','', 'POST'); $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED'); \redirect_header($redirect, 2, $msg . ': ' . $path); break; @@ -150,9 +150,9 @@ public static function dirExists($dir_path) if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST') || !\Xmf\Request::hasVar('mode', 'POST')) { break; } - $path = \Xmf\Request::getString('path'); - $redirect = \Xmf\Request::getString('redirect'); - $mode = \Xmf\Request::getInt('mode'); + $path = \Xmf\Request::getString('path','', 'POST'); + $redirect = \Xmf\Request::getString('redirect','', 'POST'); + $mode = \Xmf\Request::getInt('mode','', 'POST'); $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); \redirect_header($redirect, 2, $msg . ': ' . $path); diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 47de7a28..e2e7aec9 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -110,7 +110,7 @@ public function render() if ('english' !== $language) { $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); if (!$this->renderFile()) { - throw new \RuntimeException("The help.tpl file in 'language/" . $language . "/help' could not be created."); + throw new \RuntimeException("The {$filename} file in 'language/" . $language . "/help' could not be created."); } } $this->create($moduleDirname, 'language/english/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); From fe27e7b39b0dec475769992dc12d0a07e67bc419 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 16:46:51 +0200 Subject: [PATCH 260/266] corrections coderabbitai 5 --- class/Common/DirectoryChecker.php | 2 +- class/Files/Language/LanguageHelp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/Common/DirectoryChecker.php b/class/Common/DirectoryChecker.php index 695fe35e..d8b7baae 100644 --- a/class/Common/DirectoryChecker.php +++ b/class/Common/DirectoryChecker.php @@ -152,7 +152,7 @@ public static function dirExists($dir_path) } $path = \Xmf\Request::getString('path','', 'POST'); $redirect = \Xmf\Request::getString('redirect','', 'POST'); - $mode = \Xmf\Request::getInt('mode','', 'POST'); + $mode = \Xmf\Request::getInt('mode',0 , 'POST'); $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); \redirect_header($redirect, 2, $msg . ': ' . $path); diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index e2e7aec9..3b87c4cf 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -57,7 +57,7 @@ public static function getInstance() /** * @public function write - * @param $module + * @param Modulebuilder\Modules $module * @param string $filename */ public function write(Modulebuilder\Modules $module, string $filename): void From da685c4d37b56bdd87aa8830bac41975d3a42185 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 16:48:10 +0200 Subject: [PATCH 261/266] corrections coderabbitai 6 --- class/Files/Language/LanguageHelp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Files/Language/LanguageHelp.php b/class/Files/Language/LanguageHelp.php index 3b87c4cf..be96ba22 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -71,7 +71,7 @@ public function write(Modulebuilder\Modules $module, string $filename): void * * @return string */ - public function render() + public function render(): string { $module = $this->getModule(); $filename = $this->getFileName(); From 028e3924d1062fa9df6856619c77f75781f5cebe Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 16:53:20 +0200 Subject: [PATCH 262/266] update modulbuilder itself --- admin/building.php | 2 +- admin/devtools.php | 4 +- admin/fields.php | 2 +- admin/logo.php | 2 +- admin/modules.php | 2 +- admin/settings.php | 2 +- admin/tables.php | 4 +- assets/css/admin/style.css | 1 + docs/changelog.txt | 6 + docs/license.txt | 2 +- files/commonfiles/admin/clone.php | 2 +- files/commonfiles/class/Common/Breadcrumb.php | 2 +- files/commonfiles/class/Common/Confirm.php | 16 +- .../class/Common/DirectoryChecker.php | 6 +- .../commonfiles/class/Common/FileChecker.php | 34 ++- files/commonfiles/class/Common/Migrate.php | 2 +- .../class/Common/ModuleFeedback.php | 25 +- .../commonfiles/class/Common/ModuleStats.php | 4 +- files/commonfiles/class/Common/Resizer.php | 58 ++++- files/commonfiles/class/Common/SysUtility.php | 14 +- .../class/Common/VersionChecks.php | 2 +- files/commonfiles/class/Helper.php | 2 +- files/commonfiles/class/Utility.php | 38 ++- files/commonfiles/include/install.php | 24 +- files/commonfiles/include/uninstall.php | 5 +- files/commonfiles/include/update.php | 3 +- .../commonfiles/include/xoops_version.inc.php | 44 ++-- files/commonfiles/language/english/common.php | 4 +- .../commonfiles/language/english/feedback.php | 4 +- files/commonfiles/testdata/index.php | 7 +- files/ratingfiles/class/Ratings.php | 20 +- files/ratingfiles/class/RatingsHandler.php | 8 +- .../templates/modulebuilder_rate.tpl | 54 ++-- include/functions.php | 20 +- include/install.php | 2 +- include/update.php | 242 +++++++----------- templates/admin/modulebuilder_building.tpl | 1 + 37 files changed, 333 insertions(+), 337 deletions(-) diff --git a/admin/building.php b/admin/building.php index 096557b7..80b1a8ea 100644 --- a/admin/building.php +++ b/admin/building.php @@ -38,7 +38,7 @@ $cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_'; if (!\is_dir($cachePath)) { - if (!\mkdir($cachePath, 0777) && !\is_dir($cachePath)) { + if (!\mkdir($cachePath) && !\is_dir($cachePath)) { throw new \RuntimeException(\sprintf('Directory "%s" was not created', $cachePath)); } \chmod($cachePath, 0777); diff --git a/admin/devtools.php b/admin/devtools.php index fb176e14..ddf32cc0 100644 --- a/admin/devtools.php +++ b/admin/devtools.php @@ -85,8 +85,8 @@ $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) { - $file = str_replace('\\', '/', $regexFiles[0]); + foreach ($regexFiles as $regexFile) { + $file = str_replace('\\', '/', $regexFile[0]); if (!\in_array($file, $langfiles)) { $modfiles[] = $file; } diff --git a/admin/fields.php b/admin/fields.php index 82f953dc..4acaa2f4 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -209,7 +209,7 @@ if ($order > 0) { $fieldOrder = $fieldsObj->get($order); $fieldOrder->setVar('field_order', $i); - if (!$fieldsObj->insert($fieldOrder)) { + if (!$fieldsObj->insert()) { $error = true; } ++$i; diff --git a/admin/logo.php b/admin/logo.php index 80b7e52d..93f0d649 100644 --- a/admin/logo.php +++ b/admin/logo.php @@ -35,7 +35,7 @@ /** * @param string $val */ -function phpFunction($val = ''): void +function phpFunction(string $val = ''): void { // create php function here echo $val; diff --git a/admin/modules.php b/admin/modules.php index 13ac8978..709f30a5 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -167,7 +167,7 @@ 'mod_subversion' => Request::getString('mod_subversion', '', 'POST'), ] ); - $moduleOption = Request::getArray('module_option', []); + $moduleOption = Request::getArray('module_option'); $modulesObj->setVar('mod_admin', \in_array('admin', $moduleOption)); $modulesObj->setVar('mod_user', \in_array('user', $moduleOption)); $modulesObj->setVar('mod_blocks', \in_array('blocks', $moduleOption)); diff --git a/admin/settings.php b/admin/settings.php index 8062178d..3d2cb32c 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -123,7 +123,7 @@ 'set_subversion' => \Xmf\Request::getString('set_subversion', '', 'POST'), ] ); - $settingOption = \Xmf\Request::getArray('setting_option', []); + $settingOption = \Xmf\Request::getArray('setting_option'); $settingsObj->setVar('set_admin', \in_array('admin', $settingOption)); $settingsObj->setVar('set_user', \in_array('user', $settingOption)); $settingsObj->setVar('set_blocks', \in_array('blocks', $settingOption)); diff --git a/admin/tables.php b/admin/tables.php index 406fac93..bfc9c786 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -163,7 +163,7 @@ } $tablesObj->setVar('table_autoincrement', (1 == $_REQUEST['table_autoincrement']) ? 1 : 0); // Options - $tableOption = \Xmf\Request::getArray('table_option', []); + $tableOption = \Xmf\Request::getArray('table_option'); $tablesObj->setVar('table_install', \in_array('install', $tableOption)); $tablesObj->setVar('table_index', \in_array('index', $tableOption)); $tablesObj->setVar('table_blocks', \in_array('blocks', $tableOption)); @@ -245,7 +245,7 @@ if ($order > 0) { $tableOrder = $tablesObj->get($order); $tableOrder->setVar('table_order', $i); - if (!$tablesObj->insert($tableOrder)) { + if (!$tablesObj->insert()) { $error = true; } ++$i; diff --git a/assets/css/admin/style.css b/assets/css/admin/style.css index 2d4e62e6..5648807c 100644 --- a/assets/css/admin/style.css +++ b/assets/css/admin/style.css @@ -183,6 +183,7 @@ img.imageToggle { .portlet { margin: 0 0.1em 1em 0; padding: 0 0.3em; + min-width: 250px; } .portlet-header { diff --git a/docs/changelog.txt b/docs/changelog.txt index 81a59fd1..1694a678 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,7 @@ +
    3.7.1 Alpha [2026-04-05]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 + - updated creation code to generate module with no errors from coderabbitai (goffy) + - checked modulebuilder code by PHPStorm > Inspect code (goffy) +
    3.7.0 RC1 [2024-02-01]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 - updated version check for XOOPS 2.5.11 Stable (goffy) - moved to singular table names (mamba/goffy) @@ -15,6 +19,8 @@ - added field prefix again (goffy) - fixed bug in block links (goffy) - fixed bug with short text in block (goffy) + - changed admin tables default class to outer (goffy) + - fixed bug with add stylesheet in admin/header (goffy)
    3.7.0 Alpha [2023-07-06]
    Dev: XOOPS 2.5.11 RC2, PHP 8.0 - implemented smarty 3 (zivXP/goffy) diff --git a/docs/license.txt b/docs/license.txt index aac9317c..fb3516d9 100644 --- a/docs/license.txt +++ b/docs/license.txt @@ -54,7 +54,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software was created to be free of defects and is designed to -function on PC computers only. While this software has been tested +function on PC only. While this software has been tested and proven to run accurately, in the unlikely event of any user or computer incompatibility issues, the end user assumes complete liability of usage. This software contains no adware, scumware or diff --git a/files/commonfiles/admin/clone.php b/files/commonfiles/admin/clone.php index f377a6a7..687c141b 100644 --- a/files/commonfiles/admin/clone.php +++ b/files/commonfiles/admin/clone.php @@ -176,7 +176,7 @@ function createLogo($dirname) // Write text $textColor = \imagecolorallocate($imageModule, 0, 0, 0); $spaceToBorder = (int)((80 - \mb_strlen($dirname) * 6.5) / 2); - \imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($dirname), []); + \imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($dirname)); // Set transparency color //$white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); diff --git a/files/commonfiles/class/Common/Breadcrumb.php b/files/commonfiles/class/Common/Breadcrumb.php index dbd19c3b..c4cb3d3c 100644 --- a/files/commonfiles/class/Common/Breadcrumb.php +++ b/files/commonfiles/class/Common/Breadcrumb.php @@ -52,7 +52,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = ''): void + public function addLink(string $title = '', string $link = ''): void { $this->bread[] = [ 'link' => $link, diff --git a/files/commonfiles/class/Common/Confirm.php b/files/commonfiles/class/Common/Confirm.php index 45df19bf..26957ea5 100644 --- a/files/commonfiles/class/Common/Confirm.php +++ b/files/commonfiles/class/Common/Confirm.php @@ -40,11 +40,11 @@ */ class Confirm { - private $hiddens = []; - private $action = ''; - private $title = ''; - private $label = ''; - private $object = ''; + private array $hiddens = []; + private string $action = ''; + private string $title = ''; + private string $label = ''; + private string $object = ''; /** * @public function constructor class @@ -54,7 +54,7 @@ class Confirm * @param string $title * @param string $label */ - public function __construct($hiddens, $action, $object, $title = '', $label = '') + public function __construct($hiddens, $action, $object, string $title = '', string $label = '') { $this->hiddens = $hiddens; $this->action = $action; @@ -67,9 +67,9 @@ public function __construct($hiddens, $action, $object, $title = '', $label = '' * @public function getFormConfirm * @return \XoopsThemeForm */ - public function getFormConfirm() + public function getFormConfirm(): \XoopsThemeForm { - $moduleDirName = \basename(__DIR__); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); //in order to be accessable from user and admin area this should be place in language common.php if (!\defined('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM')) { diff --git a/files/commonfiles/class/Common/DirectoryChecker.php b/files/commonfiles/class/Common/DirectoryChecker.php index 6c450a96..5ad1d848 100644 --- a/files/commonfiles/class/Common/DirectoryChecker.php +++ b/files/commonfiles/class/Common/DirectoryChecker.php @@ -41,7 +41,7 @@ class DirectoryChecker * * @return bool|string */ - public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null) + public static function getDirectoryStatus($path, int $mode = 0777, $redirectFile = null) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -99,7 +99,7 @@ public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = n * * @return bool */ - public static function createDirectory($target, $mode = 0777) + public static function createDirectory($target, int $mode = 0777) { $target = \str_replace('..', '', $target); @@ -113,7 +113,7 @@ public static function createDirectory($target, $mode = 0777) * * @return bool */ - public static function setDirectoryPermissions($target, $mode = 0777) + public static function setDirectoryPermissions($target, int $mode = 0777) { $target = \str_replace('..', '', $target); diff --git a/files/commonfiles/class/Common/FileChecker.php b/files/commonfiles/class/Common/FileChecker.php index c8282eb1..638475fa 100644 --- a/files/commonfiles/class/Common/FileChecker.php +++ b/files/commonfiles/class/Common/FileChecker.php @@ -37,12 +37,12 @@ class FileChecker { /** - * @param string $file_path + * @param string $file_path * @param string|null $original_file_path - * @param string $redirectFile + * @param string $redirectFile * @return bool|string */ - public static function getFileStatus($file_path, $original_file_path = null, $redirectFile) + public static function getFileStatus(string $file_path, string $original_file_path = null, string $redirectFile) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -135,7 +135,7 @@ public static function fileExists($file_path) * * @return bool */ - public static function setFilePermissions($target, $mode = 0777) + public static function setFilePermissions($target, int $mode = 0777) { $target = \str_replace('..', '', $target); @@ -144,18 +144,16 @@ public static function setFilePermissions($target, $mode = 0777) } $op = Request::getString('op', '', 'POST'); -switch ($op) { - case 'copyfile': - if (\Xmf\Request::hasVar('original_file_path', 'POST')) { - $original_file_path = $_POST['original_file_path']; - } - if (\Xmf\Request::hasVar('file_path', 'POST')) { - $file_path = $_POST['file_path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; - } - $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); - \redirect_header($redirect, 2, $msg . ': ' . $file_path); - break; +if ($op == 'copyfile') { + if (\Xmf\Request::hasVar('original_file_path', 'POST')) { + $original_file_path = $_POST['original_file_path']; + } + if (\Xmf\Request::hasVar('file_path', 'POST')) { + $file_path = $_POST['file_path']; + } + if (\Xmf\Request::hasVar('redirect', 'POST')) { + $redirect = $_POST['redirect']; + } + $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); + \redirect_header($redirect, 2, $msg . ': ' . $file_path); } diff --git a/files/commonfiles/class/Common/Migrate.php b/files/commonfiles/class/Common/Migrate.php index 5e46abac..d56fc374 100644 --- a/files/commonfiles/class/Common/Migrate.php +++ b/files/commonfiles/class/Common/Migrate.php @@ -58,7 +58,7 @@ private function changePrefix(): void * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName): void + private function convertIPAddresses(string $tableName, string $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); diff --git a/files/commonfiles/class/Common/ModuleFeedback.php b/files/commonfiles/class/Common/ModuleFeedback.php index f4b68532..f2af0fdd 100644 --- a/files/commonfiles/class/Common/ModuleFeedback.php +++ b/files/commonfiles/class/Common/ModuleFeedback.php @@ -28,16 +28,14 @@ */ class ModuleFeedback extends \XoopsObject { - public $name = ''; - public $email = ''; - public $site = ''; - public $type = ''; - public $content = ''; + public string $name = ''; + public string $email = ''; + public string $site = ''; + public string $type = ''; + public string $content = ''; /** * Constructor - * - * @param null */ public function __construct() { @@ -45,15 +43,14 @@ public function __construct() /** * @static function &getInstance - * - * @param null */ - public static function getInstance(): void + public static function getInstance(): self { static $instance = false; if (!$instance) { $instance = new self(); } + return $instance; } /** @@ -61,7 +58,7 @@ public static function getInstance(): void * provide form for sending a feedback to module author * @return \XoopsThemeForm */ - public function getFormFeedback() + public function getFormFeedback(): \XoopsThemeForm { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -70,7 +67,9 @@ public function getFormFeedback() $form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true); $form->setExtra('enctype="multipart/form-data"'); - $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail')); + $xoopsModule = $GLOBALS['xoopsModule'] ?? null; + $authorMail = $xoopsModule ? (string)$xoopsModule->getInfo('author_mail') : ''; + $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $authorMail); $recipient->setExtra('disabled="disabled"'); $form->addElement($recipient); $your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); @@ -102,7 +101,7 @@ public function getFormFeedback() $moduleHandler = \xoops_getHandler('module'); $module = $moduleHandler->getByDirname('system'); $configHandler = \xoops_getHandler('config'); - $config = &$configHandler->getConfigsByCat(0, $module->getVar('mid')); + $config = $configHandler->getConfigsByCat(0, $module->getVar('mid')); $editorConfigs['editor'] = $config['general_editor']; $editor = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs); $form->addElement($editor, true); diff --git a/files/commonfiles/class/Common/ModuleStats.php b/files/commonfiles/class/Common/ModuleStats.php index 7fb40989..674b69c0 100644 --- a/files/commonfiles/class/Common/ModuleStats.php +++ b/files/commonfiles/class/Common/ModuleStats.php @@ -23,10 +23,10 @@ trait ModuleStats { /** * @param \XoopsModules\Modulebuilder\Common\Configurator $configurator - * @param array $moduleStats + * @param array $moduleStats * @return array */ - public static function getModuleStats($configurator, $moduleStats) + public static function getModuleStats(Configurator $configurator, array $moduleStats) { if (\count($configurator->moduleStats) > 0) { foreach (\array_keys($configurator->moduleStats) as $i) { diff --git a/files/commonfiles/class/Common/Resizer.php b/files/commonfiles/class/Common/Resizer.php index 5d58d672..2e762939 100644 --- a/files/commonfiles/class/Common/Resizer.php +++ b/files/commonfiles/class/Common/Resizer.php @@ -24,16 +24,16 @@ */ class Resizer { - public $sourceFile = ''; - public $endFile = ''; - public $maxWidth = 0; - public $maxHeight = 0; - public $imageMimetype = ''; - public $jpgQuality = 90; - public $mergeType = 0; - public $mergePos = 0; - public $degrees = 0; - public $error = ''; + public string $sourceFile = ''; + public string $endFile = ''; + public int $maxWidth = 0; + public int $maxHeight = 0; + public string $imageMimetype = ''; + public int $jpgQuality = 90; + public int $mergeType = 0; + public int $mergePos = 0; + public int $degrees = 0; + public string $error = ''; /** * resize image if size exceed given width/height @@ -45,15 +45,24 @@ public function resizeImage() switch ($this->imageMimetype) { case 'image/png': $img = \imagecreatefrompng($this->sourceFile); + if (!$img) { + return false; + } break; case 'image/jpeg': $img = \imagecreatefromjpeg($this->sourceFile); if (!$img) { $img = \imagecreatefromstring(file_get_contents($this->sourceFile)); } + if (!$img) { + return false; + } break; case 'image/gif': $img = \imagecreatefromgif($this->sourceFile); + if (!$img) { + return false; + } break; default: return 'Unsupported format'; @@ -83,12 +92,12 @@ public function resizeImage() } // Create a new temporary image. - $tmpimg = \imagecreatetruecolor($new_width, $new_height); + $tmpimg = \imagecreatetruecolor((int)$new_width, (int)$new_height); \imagealphablending($tmpimg, false); \imagesavealpha($tmpimg, true); // Copy and resize old image into new image. - \imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + \imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, (int)$new_width, (int)$new_height, (int)$width, (int)$height); \unlink($this->endFile); //compressing the file @@ -185,8 +194,29 @@ public function resizeAndCrop() public function mergeImage(): void { - $dest = \imagecreatefromjpeg($this->endFile); - $src = \imagecreatefromjpeg($this->sourceFile); + $dest = null; + $src = null; + switch ($this->imageMimetype) { + case 'image/png': + $dest = \imagecreatefrompng($this->endFile); + $src = \imagecreatefrompng($this->sourceFile); + break; + case 'image/jpeg': + $dest = \imagecreatefromjpeg($this->endFile); + $src = \imagecreatefromjpeg($this->sourceFile); + break; + case 'image/gif': + $dest = \imagecreatefromgif($this->endFile); + $src = \imagecreatefromgif($this->sourceFile); + break; + default: + $this->error = 'Unsupported format'; + return; + } + if (!$dest || !$src) { + $this->error = 'Failed to load images'; + return; + } if (4 == $this->mergeType) { $imgWidth = (int)\round($this->maxWidth / 2 - 1); $imgHeight = (int)\round($this->maxHeight / 2 - 1); diff --git a/files/commonfiles/class/Common/SysUtility.php b/files/commonfiles/class/Common/SysUtility.php index e8d4d9de..48840524 100644 --- a/files/commonfiles/class/Common/SysUtility.php +++ b/files/commonfiles/class/Common/SysUtility.php @@ -62,14 +62,14 @@ public static function getInstance() * www.cakephp.org * * @param string $text String to truncate. - * @param int $length Length of returned string, including ellipsis. + * @param int $length Length of returned string, including ellipsis. * @param string $ending Ending to be appended to the trimmed string. - * @param bool $exact If false, $text will not be cut mid-word - * @param bool $considerHtml If true, HTML tags would be handled correctly + * @param bool $exact If false, $text will not be cut mid-word + * @param bool $considerHtml If true, HTML tags would be handled correctly * * @return string Trimmed string. */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) + public static function truncateHtml(string $text, int $length = 100, string $ending = '...', bool $exact = false, bool $considerHtml = true) { if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text @@ -161,11 +161,11 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options + * @param \Xmf\Module\Helper|null $helper + * @param array|null $options * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ - public static function getEditor($helper = null, $options = null) + public static function getEditor(\Xmf\Module\Helper $helper = null, array $options = null) { /** @var Helper $helper */ if (null === $options) { diff --git a/files/commonfiles/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php index a18c6f28..fa19754f 100644 --- a/files/commonfiles/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } $success = true; - if ($module->versionCompare($currentVer, $requiredVer, '<')) { + if ($module->versionCompare($currentVer, $requiredVer)) { $success = false; $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } diff --git a/files/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php index 87696bf4..5dd9592c 100644 --- a/files/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -42,7 +42,7 @@ public function __construct($debug = false) * * @return \XoopsModules\Modulebuilder\Helper */ - public static function getInstance($debug = false) + public static function getInstance(bool $debug = false) { static $instance; if (null === $instance) { diff --git a/files/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php index af519771..cd3a886b 100644 --- a/files/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -50,14 +50,14 @@ class Utility * www.cakephp.org * * @param string $text String to truncate. - * @param int $length Length of returned string, including ellipsis. + * @param int $length Length of returned string, including ellipsis. * @param string $ending Ending to be appended to the trimmed string. - * @param bool $exact If false, $text will not be cut mid-word - * @param bool $considerHtml If true, HTML tags would be handled correctly + * @param bool $exact If false, $text will not be cut mid-word + * @param bool $considerHtml If true, HTML tags would be handled correctly * * @return string Trimmed string. */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) + public static function truncateHtml(string $text, int $length = 100, string $ending = '...', bool $exact = false, bool $considerHtml = true) { if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text @@ -151,11 +151,11 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options + * @param \Xmf\Module\Helper|null $helper + * @param array|null $options * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ - public static function getEditor($helper = null, $options = null) + public static function getEditor(\Xmf\Module\Helper $helper = null, array $options = null) { /** @var Modulebuilder\Helper $helper */ if (null === $options) { @@ -172,9 +172,9 @@ public static function getEditor($helper = null, $options = null) if (\class_exists('XoopsFormEditor')) { if ($isAdmin) { - $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editor_admin'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editor_admin'), $options, false, 'textarea'); } else { - $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editor_user'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editor_user'), $options, false, 'textarea'); } } else { $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); @@ -225,17 +225,15 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; 5 => '', ]; for ($key = 0; $key <= 4; ++$key) { - switch ($key) { - case 2: - $donationform[$key] = \sprintf( - $donationform[$key], - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), - $GLOBALS['xoopsUser']->getVar('email'), - \XOOPS_LICENSE_KEY, - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') - ); - break; + if ($key == 2) { + $donationform[$key] = \sprintf( + $donationform[$key], + $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), + $GLOBALS['xoopsUser']->getVar('email'), + \XOOPS_LICENSE_KEY, + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') + ); } } $aboutRes = ''; diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index c0703920..3551aa5b 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -38,13 +38,6 @@ function xoops_module_pre_install_modulebuilder(\XoopsModule $module) // check for minimum PHP version $phpSuccess = $utility::checkVerPhp($module); - if ($xoopsSuccess && $phpSuccess) { - $moduleTables = &$module->getInfo('tables'); - foreach ($moduleTables as $table) { - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); - } - } - return $xoopsSuccess && $phpSuccess; } @@ -66,10 +59,17 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) $helper->loadLanguage('common'); // --- CREATE FOLDERS --------------- + $success = true; if ($configurator->uploadFolders && \is_array($configurator->uploadFolders)) { foreach (\array_keys($configurator->uploadFolders) as $i) { - $utility::createFolder($configurator->uploadFolders[$i]); - chmod($configurator->uploadFolders[$i], 0777); + $path = $configurator->uploadFolders[$i]; + if (!\is_dir($path) && !$utility::createFolder($path)) { + $success = false; + continue; + } + if (!\chmod($path, 0775) && !\is_writable($path)) { + $success = false; + } } } @@ -78,9 +78,11 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) $file = \dirname(__DIR__) . '/assets/images/blank.gif'; foreach (\array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.gif'; - $utility::copyFile($file, $dest); + if (!$utility::copyFile($file, $dest)) { + $success = false; + } } } - return true; + return $success; } diff --git a/files/commonfiles/include/uninstall.php b/files/commonfiles/include/uninstall.php index ae7758ed..9fa2a315 100644 --- a/files/commonfiles/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -46,8 +46,9 @@ function xoops_module_uninstall_modulebuilder(\XoopsModule $module) $dirInfo = new \SplFileInfo($uploadDirectory); if ($dirInfo->isDir()) { // The directory exists so rename it - $date = date('Y-m-d'); - if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) { + $suffix = \date('Y-m-d_His'); + $target = $uploadDirectory . "_bak_$suffix"; + if (!\rename($uploadDirectory, $target)) { $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $uploadDirectory)); $success = false; } diff --git a/files/commonfiles/include/update.php b/files/commonfiles/include/update.php index 3abf56e2..e3139ca1 100644 --- a/files/commonfiles/include/update.php +++ b/files/commonfiles/include/update.php @@ -57,7 +57,6 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) */ function modulebuilder_check_db($module) { - $ret = true; //insert here code for database check /* @@ -95,5 +94,5 @@ function modulebuilder_check_db($module) } } */ - return $ret; + return true; } diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php index b2a521d9..19bd72fa 100644 --- a/files/commonfiles/include/xoops_version.inc.php +++ b/files/commonfiles/include/xoops_version.inc.php @@ -18,21 +18,35 @@ /** * @param $val - * @return float|int + * @return int */ -function modulebuilderReturnBytes($val) + +function modulebuilderReturnBytes($val): int { - switch (\mb_substr($val, -1)) { - case 'K': - case 'k': - return (int)$val * 1024; - case 'M': - case 'm': - return (int)$val * 1048576; - case 'G': - case 'g': - return (int)$val * 1073741824; - default: - return $val; + + $raw = \trim((string)$val); + if ($raw === '') { + return 0; + } + if ($raw === '-1') { + return -1; + } + if (\is_numeric($raw)) { + return (int)$raw; } -} + + $unit = \strtoupper(\substr($raw, -1)); + $number = (float)\substr($raw, 0, -1); + + switch ($unit) { + case 'K': + return (int)\round($number * 1024); + case 'M': + return (int)\round($number * 1048576); + case 'G': + + return (int)\round($number * 1073741824); + default: + return (int)$raw; + } + } \ No newline at end of file diff --git a/files/commonfiles/language/english/common.php b/files/commonfiles/language/english/common.php index 45b0c285..0237c7af 100644 --- a/files/commonfiles/language/english/common.php +++ b/files/commonfiles/language/english/common.php @@ -10,7 +10,7 @@ */ /** - * Wfdownloads module + * Modulebuilder module * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) @@ -23,7 +23,7 @@ \define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); \define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); \define('CO_' . $moduleDirNameUpper . '_GDOFF', "Disabled (No thumbnails available)"); -\define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails available)"); +\define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbnails available)"); \define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); \define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); \define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); diff --git a/files/commonfiles/language/english/feedback.php b/files/commonfiles/language/english/feedback.php index 8739c191..b5b9d97a 100644 --- a/files/commonfiles/language/english/feedback.php +++ b/files/commonfiles/language/english/feedback.php @@ -21,7 +21,7 @@ $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -\define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send feedback'); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); @@ -38,4 +38,4 @@ \define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT', 'Feedback content'); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR', 'Feedback for module '); \define('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS', 'Feedback successfully sent'); -\define('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_ERROR', 'An errror occured when feedback was sent!'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_ERROR', 'An errror occured while sending feedback!'); diff --git a/files/commonfiles/testdata/index.php b/files/commonfiles/testdata/index.php index 49c8e781..62388943 100644 --- a/files/commonfiles/testdata/index.php +++ b/files/commonfiles/testdata/index.php @@ -45,7 +45,7 @@ loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK'), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); xoops_cp_footer(); } break; @@ -159,16 +159,15 @@ function exportSchema(): void * * @param string $table value with should be used insead of original value of $search * - * @param array $data array of rows to insert + * @param array $data array of rows to insert * Each element of the outer array represents a single table row. * Each row is an associative array in 'column' => 'value' format. * @param string $search name of column for which the value should be replaced * @param $replace * @return int number of rows inserted */ -function loadTableFromArrayWithReplace($table, $data, $search, $replace) +function loadTableFromArrayWithReplace(string $table, array $data, string $search, $replace) { - /** @var \XoopsDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); $prefixedTable = $db->prefix($table); $count = 0; diff --git a/files/ratingfiles/class/Ratings.php b/files/ratingfiles/class/Ratings.php index c696072b..4a35ff34 100644 --- a/files/ratingfiles/class/Ratings.php +++ b/files/ratingfiles/class/Ratings.php @@ -30,8 +30,6 @@ class Ratings extends \XoopsObject { /** * Constructor - * - * @param null */ public function __construct() { @@ -46,16 +44,16 @@ public function __construct() /** * @static function &getInstance - * - * @param null + * @return Ratings */ - public static function getInstance(): void + public static function getInstance(): self { - static $instance = false; - if (!$instance) { + static $instance = null; + if (null === $instance) { $instance = new self(); } - } + return $instance; + } /** * The new inserted $Id @@ -63,9 +61,7 @@ public static function getInstance(): void */ public function getNewInsertedIdRatings() { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - - return $newInsertedId; + return $GLOBALS['xoopsDB']->getInsertId(); } /** @@ -99,7 +95,7 @@ public function toArrayRatings() $ret = []; $vars = $this->getVars(); foreach (\array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); + $ret[$var] = $this->getVar($var); } return $ret; diff --git a/files/ratingfiles/class/RatingsHandler.php b/files/ratingfiles/class/RatingsHandler.php index 6d6e0713..d40b9eab 100644 --- a/files/ratingfiles/class/RatingsHandler.php +++ b/files/ratingfiles/class/RatingsHandler.php @@ -50,13 +50,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param array $fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** @@ -76,7 +76,7 @@ public function getInsertId() * @param int $source * @return array */ - public function getItemRating($itemid = 0, $source = 0) + public function getItemRating(int $itemid = 0, int $source = 0) { $helper = \XoopsModules\Modulebuilder\Helper::getInstance(); diff --git a/files/ratingfiles/templates/modulebuilder_rate.tpl b/files/ratingfiles/templates/modulebuilder_rate.tpl index b7da0467..b8e29607 100644 --- a/files/ratingfiles/templates/modulebuilder_rate.tpl +++ b/files/ratingfiles/templates/modulebuilder_rate.tpl @@ -5,19 +5,19 @@
    <{$item.rating.text}>
    - 1 + 1
    - 2 + 2
    - 3 + 3
    - 4 + 4
    - 5 + 5
    @@ -32,34 +32,34 @@
    <{$item.rating.text}>
    - 1 + 1
    - 2 + 2
    - 3 + 3
    - 4 + 4
    - 5 + 5
    - 6 + 6
    - 7 + 7
    - 8 + 8
    - 9 + 9
    - 10 + 10
    @@ -72,16 +72,16 @@
    - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
    <{$item.rating.text}> @@ -91,10 +91,10 @@ <{/if}> <{if $rating_likes}> <{/if}> diff --git a/include/functions.php b/include/functions.php index 6d6bc624..e2134507 100644 --- a/include/functions.php +++ b/include/functions.php @@ -62,17 +62,15 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; 5 => '', ]; for ($key = 0; $key <= 4; ++$key) { - switch ($key) { - case 2: - $donationform[$key] = \sprintf( - $donationform[$key], - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), - $GLOBALS['xoopsUser']->getVar('email'), - \XOOPS_LICENSE_KEY, - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') - ); - break; + if ($key == 2) { + $donationform[$key] = \sprintf( + $donationform[$key], + $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), + $GLOBALS['xoopsUser']->getVar('email'), + \XOOPS_LICENSE_KEY, + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') + ); } } $aboutRes = ''; diff --git a/include/install.php b/include/install.php index bc9ac2b6..0983e330 100644 --- a/include/install.php +++ b/include/install.php @@ -49,7 +49,7 @@ function xoops_module_pre_install_modulebuilder(\XoopsModule $module) /** * @param \XoopsModule $module - * @return bool|string + * @return true */ function xoops_module_install_modulebuilder(\XoopsModule $module) { diff --git a/include/update.php b/include/update.php index d08fcf0b..57dc40b3 100644 --- a/include/update.php +++ b/include/update.php @@ -55,7 +55,7 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) print_r($errors); } - return $ret; + return null; } // irmtfan bug fix: solve templates duplicate issue @@ -104,7 +104,7 @@ function update_modulebuilder_v191($module) return true; } $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)) { + if (!$xoopsDB->queryF($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." @@ -139,27 +139,26 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $sqlQueryFid = 'SELECT fieldelement_mid, fieldelement_tid, fieldelement_name, fieldelement_value, fieldelement_sort, fieldelement_deftype, fieldelement_defvalue, fieldelement_deffield + FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . ' as fe WHERE fe.fieldelement_id =%s'; + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 16 $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); + $xoopsDB->query($sql); // update 16 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field Password @@ -171,27 +170,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 17 $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); + $xoopsDB->query($sql); // update 17 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field SelectCountry @@ -203,27 +199,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 18 $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); + $xoopsDB->query($sql); // update 18 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field SelectLanguage @@ -235,27 +228,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 19 $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); + $xoopsDB->query($sql); // update 19 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field Radio @@ -267,27 +257,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 20 $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); + $xoopsDB->query($sql); // update 20 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field DateTime @@ -299,27 +286,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 21 $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); + $xoopsDB->query($sql); // update 21 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field DateTime @@ -331,27 +315,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value] = $xoopsDB->fetchRow($result); + [$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); + $xoopsDB->query($sql); // update table fields to new id of previous 22 $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); + $xoopsDB->query($sql); // update 22 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' 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`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); } + $xoopsDB->query($sql); } // update table 'modulebuilder_fieldelements' @@ -361,7 +342,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `fieldelement_value`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -375,7 +356,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` INT(10) NOT NULL DEFAULT '0' AFTER `fieldelement_sort`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -389,7 +370,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` int(10) NULL DEFAULT '0' AFTER `fieldelement_deftype`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -403,7 +384,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `field_user`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -416,7 +397,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `field_user`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -429,7 +410,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `field_user`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -443,7 +424,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `file_mid`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -457,7 +438,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` varchar(255) NOT NULL DEFAULT '' AFTER `file_extension`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -476,33 +457,30 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); + [$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}')"; - $result = $xoopsDB->query($sql); + $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); + $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};"; - $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}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field text IP @@ -517,40 +495,37 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); + [$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}')"; - $result = $xoopsDB->query($sql); + $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); + $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};"; - $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}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // update table 'modulebuilder_fieldelements' $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); $field = 'fieldelement_defvalue'; $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(5) NULL DEFAULT NULL;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); $ret = false; @@ -568,33 +543,30 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); + [$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}')"; - $result = $xoopsDB->query($sql); + $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); + $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};"; - $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}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field text ratings $fname = 'TextRatings'; @@ -608,33 +580,30 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); + [$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}')"; - $result = $xoopsDB->query($sql); + $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); + $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};"; - $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}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field text votes $fname = 'TextVotes'; @@ -648,33 +617,30 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); + [$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}')"; - $result = $xoopsDB->query($sql); + $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); + $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};"; - $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}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field text votes $fname = 'TextReads'; @@ -688,33 +654,30 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { - [$fe_id, $fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue] = $xoopsDB->fetchRow($result); + [$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}')"; - $result = $xoopsDB->query($sql); + $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); + $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};"; - $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}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // update table 'modulebuilder_tables' @@ -724,7 +687,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` TINYINT(1) NOT NULL DEFAULT '0' AFTER `table_rss`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -735,7 +698,7 @@ function modulebuilder_check_db($module) $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_settings'); $field = 'set_min_xoops'; $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(15) NOT NULL DEFAULT '1.0';"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); $ret = false; @@ -745,7 +708,7 @@ function modulebuilder_check_db($module) $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); $field = 'mod_min_xoops'; $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(15) NOT NULL DEFAULT '1.0';"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); $ret = false; @@ -755,7 +718,7 @@ function modulebuilder_check_db($module) $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_modules'); $field = 'mod_since'; $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when changing '$field' in table '$table'."); $ret = false; @@ -768,7 +731,7 @@ function modulebuilder_check_db($module) $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); if (!$numRows) { $sql = "ALTER TABLE `$table` ADD `$field` VARCHAR(5) NOT NULL DEFAULT '' AFTER `fieldelement_defvalue`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; @@ -788,27 +751,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $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, $fe_deffield) = $xoopsDB->fetchRow($result); + list($fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); // update table fields to new id of previous 29 $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); + $xoopsDB->query($sql); // update 29 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}', `fieldelement_deffield` = '{$fdeffield}' 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // new form field text votes $fname = 'TextFloat'; @@ -823,27 +783,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $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, $fe_deffield) = $xoopsDB->fetchRow($result); + list($fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); // update table fields to new id of previous 30 $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); + $xoopsDB->query($sql); // update 30 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}', `fieldelement_deffield` = '{$fdeffield}' 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; - $result = $xoopsDB->query($sql); } + $xoopsDB->query($sql); } // new form field Radio On-/Offline @@ -859,27 +816,24 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . " as fe WHERE fe.fieldelement_id ={$fid}" - ); + $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $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, $fe_deffield) = $xoopsDB->fetchRow($result); + list($fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); // update table fields to new id of previous 31 $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); + $xoopsDB->query($sql); // update 31 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}', `fieldelement_deffield` = '{$fdeffield}' 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; - $result = $xoopsDB->query($sql); } + $result = $xoopsDB->query($sql); } // resorting elements diff --git a/templates/admin/modulebuilder_building.tpl b/templates/admin/modulebuilder_building.tpl index d6eac59b..c59ad39b 100644 --- a/templates/admin/modulebuilder_building.tpl +++ b/templates/admin/modulebuilder_building.tpl @@ -57,6 +57,7 @@ <{if $checkResultsNice|default:''}>

    <{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_RESULT}>

    <{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_NOERRORS}>

    + <{/if}> <{if $form|default:''}> <{$form}> From 6bc7427dbd29fc1111825322a6d3a073ef3c427a Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 19:02:11 +0200 Subject: [PATCH 263/266] update modulbuilder itself - correction 1 --- admin/fields.php | 8 +- admin/logo.php | 4 +- admin/tables.php | 8 +- class/Common/Confirm.php | 23 ++-- class/Common/FileChecker.php | 8 +- class/Common/Resizer.php | 46 +++++--- docs/changelog.txt | 2 +- files/commonfiles/class/Common/Confirm.php | 8 +- .../class/Common/DirectoryChecker.php | 29 ++--- .../commonfiles/class/Common/FileChecker.php | 22 ++-- files/commonfiles/class/Common/Migrate.php | 2 +- .../class/Common/ModuleFeedback.php | 17 ++- files/commonfiles/class/Common/Resizer.php | 14 +-- .../class/Common/VersionChecks.php | 2 +- files/commonfiles/class/Helper.php | 2 +- files/commonfiles/class/Utility.php | 7 +- files/commonfiles/include/install.php | 11 +- .../commonfiles/include/xoops_version.inc.php | 9 +- files/ratingfiles/class/Ratings.php | 2 +- .../templates/modulebuilder_rate.tpl | 54 ++++----- include/functions.php | 2 +- include/update.php | 33 +++--- .../english/modulebuilder_fieldelements.yml | 108 +++++------------- testdata/index.php | 10 +- 24 files changed, 198 insertions(+), 233 deletions(-) diff --git a/admin/fields.php b/admin/fields.php index 4acaa2f4..3e571e99 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -202,14 +202,14 @@ break; case 'order': // Initialize fields handler - $fieldsObj = $helper->getHandler('Fields'); + $fieldsHandler = $helper->getHandler('Fields'); if (isset($_POST['forder'])) { $i = 0; foreach ($_POST['forder'] as $order) { if ($order > 0) { - $fieldOrder = $fieldsObj->get($order); - $fieldOrder->setVar('field_order', $i); - if (!$fieldsObj->insert()) { + $fieldsObj = $fieldsHandler->get($order); + $fieldsObj->setVar('field_order', $i); + if ($fieldsHandler->insert($fieldsObj)) { $error = true; } ++$i; diff --git a/admin/logo.php b/admin/logo.php index 93f0d649..869f6e10 100644 --- a/admin/logo.php +++ b/admin/logo.php @@ -27,7 +27,9 @@ $caption = \Xmf\Request::getString('caption', '', 'GET'); if (\function_exists($funct)) { $ret = Modulebuilder\Logo::getInstance()->createLogo($iconName, $caption); - phpFunction($ret); + if (false !== $ret) { + phpFunction($ret); + } } else { \redirect_header('logo.php', 3, 'Method Not Exist'); } diff --git a/admin/tables.php b/admin/tables.php index bfc9c786..86bab486 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -238,14 +238,14 @@ break; case 'order': // Initialize tables handler - $tablesObj = $helper->getHandler('Tables'); + $tablesHandler = $helper->getHandler('Tables'); if (isset($_POST['torder'])) { $i = 0; foreach ($_POST['torder'] as $order) { if ($order > 0) { - $tableOrder = $tablesObj->get($order); - $tableOrder->setVar('table_order', $i); - if (!$tablesObj->insert()) { + $tablesObj = $tablesHandler->get($order); + $tablesObj->setVar('table_order', $i); + if (!$tablesHandler->insert($tablesObj)) { $error = true; } ++$i; diff --git a/class/Common/Confirm.php b/class/Common/Confirm.php index 60580058..b3d4a38c 100644 --- a/class/Common/Confirm.php +++ b/class/Common/Confirm.php @@ -17,6 +17,7 @@ * * @copyright 2020 XOOPS Project (https://xoops.org) * @license GPL 2.0 or later + * @package Modulebuilder * @since 1.0 * @min_xoops 2.5.9 * @author Goffy - Email: - Website: @@ -39,21 +40,21 @@ */ class Confirm { - private $hiddens = []; - private $action = ''; - private $title = ''; - private $label = ''; - private $object = ''; + private array $hiddens = []; + private string $action = ''; + private string $title = ''; + private string $label = ''; + private string $object = ''; /** * @public function constructor class - * @param $hiddens - * @param $action - * @param $object + * @param array $hiddens + * @param string $action + * @param string $object * @param string $title * @param string $label */ - public function __construct($hiddens, $action, $object, string $title = '', string $label = '') + public function __construct(array $hiddens, string $action, string $object, string $title = '', string $label = '') { $this->hiddens = $hiddens; $this->action = $action; @@ -66,9 +67,9 @@ public function __construct($hiddens, $action, $object, string $title = '', stri * @public function getFormConfirm * @return \XoopsThemeForm */ - public function getFormConfirm() + public function getFormConfirm(): \XoopsThemeForm { - $moduleDirName = \basename(__DIR__); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); //in order to be accessable from user and admin area this should be place in language common.php if (!\defined('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM')) { diff --git a/class/Common/FileChecker.php b/class/Common/FileChecker.php index c05e0e1a..8d0872d6 100644 --- a/class/Common/FileChecker.php +++ b/class/Common/FileChecker.php @@ -43,7 +43,7 @@ class FileChecker * * @return bool|string */ - public static function getFileStatus(string $file_path, string $redirectFile, string $original_file_path = null) + public static function getFileStatus(string $file_path, string $redirectFile, ?string $original_file_path = null) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -151,9 +151,9 @@ public static function setFilePermissions($target, int $mode = 0777) || !\Xmf\Request::hasVar('redirect', 'POST')) { return; } - $original_file_path = $_POST['original_file_path']; - $file_path = $_POST['file_path']; - $redirect = $_POST['redirect']; + $original_file_path = \Xmf\Request::getString('original_file_path'); + $file_path = \Xmf\Request::getString('file_path'); + $redirect =\Xmf\Request::getString('redirect'); $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); \redirect_header($redirect, 2, $msg . ': ' . $file_path); } diff --git a/class/Common/Resizer.php b/class/Common/Resizer.php index 5d58d672..be4c40f5 100644 --- a/class/Common/Resizer.php +++ b/class/Common/Resizer.php @@ -24,16 +24,16 @@ */ class Resizer { - public $sourceFile = ''; - public $endFile = ''; - public $maxWidth = 0; - public $maxHeight = 0; - public $imageMimetype = ''; - public $jpgQuality = 90; - public $mergeType = 0; - public $mergePos = 0; - public $degrees = 0; - public $error = ''; + public string $sourceFile = ''; + public string $endFile = ''; + public int $maxWidth = 0; + public int $maxHeight = 0; + public string $imageMimetype = ''; + public int $jpgQuality = 90; + public int $mergeType = 0; + public int $mergePos = 0; + public int $degrees = 0; + public string $error = ''; /** * resize image if size exceed given width/height @@ -45,15 +45,24 @@ public function resizeImage() switch ($this->imageMimetype) { case 'image/png': $img = \imagecreatefrompng($this->sourceFile); + if (!$img) { + return false; + } break; case 'image/jpeg': $img = \imagecreatefromjpeg($this->sourceFile); if (!$img) { $img = \imagecreatefromstring(file_get_contents($this->sourceFile)); } + if (!$img) { + return false; + } break; case 'image/gif': $img = \imagecreatefromgif($this->sourceFile); + if (!$img) { + return false; + } break; default: return 'Unsupported format'; @@ -83,12 +92,12 @@ public function resizeImage() } // Create a new temporary image. - $tmpimg = \imagecreatetruecolor($new_width, $new_height); + $tmpimg = \imagecreatetruecolor((int)$new_width, (int)$new_height); \imagealphablending($tmpimg, false); \imagesavealpha($tmpimg, true); // Copy and resize old image into new image. - \imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + \imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, (int)$new_width, (int)$new_height, (int)$width, (int)$height); \unlink($this->endFile); //compressing the file @@ -185,8 +194,17 @@ public function resizeAndCrop() public function mergeImage(): void { - $dest = \imagecreatefromjpeg($this->endFile); - $src = \imagecreatefromjpeg($this->sourceFile); + switch ($this->imageMimetype) { + case 'image/png': + $dest = \imagecreatefrompng($this->endFile); + $src = \imagecreatefrompng($this->sourceFile); + break; + case 'image/jpeg': + $dest = \imagecreatefromjpeg($this->endFile); + $src = \imagecreatefromjpeg($this->sourceFile); + break; + // ... etc + } if (4 == $this->mergeType) { $imgWidth = (int)\round($this->maxWidth / 2 - 1); $imgHeight = (int)\round($this->maxHeight / 2 - 1); diff --git a/docs/changelog.txt b/docs/changelog.txt index 1694a678..1d8bf712 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,6 +1,6 @@
    3.7.1 Alpha [2026-04-05]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 - updated creation code to generate module with no errors from coderabbitai (goffy) - - checked modulebuilder code by PHPStorm > Inspect code (goffy) + - reviewed modulebuilder code by PHPStorm > Inspect code (goffy)
    3.7.0 RC1 [2024-02-01]
    Dev: XOOPS 2.5.11 Stable, PHP 8.0 - updated version check for XOOPS 2.5.11 Stable (goffy) diff --git a/files/commonfiles/class/Common/Confirm.php b/files/commonfiles/class/Common/Confirm.php index 26957ea5..b3d4a38c 100644 --- a/files/commonfiles/class/Common/Confirm.php +++ b/files/commonfiles/class/Common/Confirm.php @@ -48,13 +48,13 @@ class Confirm /** * @public function constructor class - * @param $hiddens - * @param $action - * @param $object + * @param array $hiddens + * @param string $action + * @param string $object * @param string $title * @param string $label */ - public function __construct($hiddens, $action, $object, string $title = '', string $label = '') + public function __construct(array $hiddens, string $action, string $object, string $title = '', string $label = '') { $this->hiddens = $hiddens; $this->action = $action; diff --git a/files/commonfiles/class/Common/DirectoryChecker.php b/files/commonfiles/class/Common/DirectoryChecker.php index 5ad1d848..d8b7baae 100644 --- a/files/commonfiles/class/Common/DirectoryChecker.php +++ b/files/commonfiles/class/Common/DirectoryChecker.php @@ -104,7 +104,11 @@ public static function createDirectory($target, int $mode = 0777) $target = \str_replace('..', '', $target); // https://www.php.net/manual/en/function.mkdir.php - return \is_dir($target) || (self::createDirectory(\dirname($target), $mode) && !\mkdir($target, $mode) && !\is_dir($target)); + return \is_dir($target) + || ( + self::createDirectory(\dirname($target), $mode) + && (\mkdir($target, $mode) || \is_dir($target)) + ); } /** @@ -134,26 +138,23 @@ public static function dirExists($dir_path) $op = Request::getString('op', '', 'POST'); switch ($op) { case 'createdir': - if (\Xmf\Request::hasVar('path', 'POST')) { - $path = $_POST['path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; + if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST')) { + break; } + $path = \Xmf\Request::getString('path','', 'POST'); + $redirect = \Xmf\Request::getString('redirect','', 'POST'); $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED'); \redirect_header($redirect, 2, $msg . ': ' . $path); break; case 'setdirperm': - if (\Xmf\Request::hasVar('path', 'POST')) { - $path = $_POST['path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; - } - if (\Xmf\Request::hasVar('mode', 'POST')) { - $mode = $_POST['mode']; + if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST') || !\Xmf\Request::hasVar('mode', 'POST')) { + break; } + $path = \Xmf\Request::getString('path','', 'POST'); + $redirect = \Xmf\Request::getString('redirect','', 'POST'); + $mode = \Xmf\Request::getInt('mode',0 , 'POST'); $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET'); + \redirect_header($redirect, 2, $msg . ': ' . $path); break; } diff --git a/files/commonfiles/class/Common/FileChecker.php b/files/commonfiles/class/Common/FileChecker.php index 638475fa..8d0872d6 100644 --- a/files/commonfiles/class/Common/FileChecker.php +++ b/files/commonfiles/class/Common/FileChecker.php @@ -38,11 +38,12 @@ class FileChecker { /** * @param string $file_path - * @param string|null $original_file_path * @param string $redirectFile + * @param string|null $original_file_path + * * @return bool|string */ - public static function getFileStatus(string $file_path, string $original_file_path = null, string $redirectFile) + public static function getFileStatus(string $file_path, string $redirectFile, ?string $original_file_path = null) { $pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16'); @@ -145,15 +146,14 @@ public static function setFilePermissions($target, int $mode = 0777) $op = Request::getString('op', '', 'POST'); if ($op == 'copyfile') { - if (\Xmf\Request::hasVar('original_file_path', 'POST')) { - $original_file_path = $_POST['original_file_path']; - } - if (\Xmf\Request::hasVar('file_path', 'POST')) { - $file_path = $_POST['file_path']; - } - if (\Xmf\Request::hasVar('redirect', 'POST')) { - $redirect = $_POST['redirect']; - } + if (!\Xmf\Request::hasVar('original_file_path', 'POST') + || !\Xmf\Request::hasVar('file_path', 'POST') + || !\Xmf\Request::hasVar('redirect', 'POST')) { + return; + } + $original_file_path = \Xmf\Request::getString('original_file_path'); + $file_path = \Xmf\Request::getString('file_path'); + $redirect =\Xmf\Request::getString('redirect'); $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED'); \redirect_header($redirect, 2, $msg . ': ' . $file_path); } diff --git a/files/commonfiles/class/Common/Migrate.php b/files/commonfiles/class/Common/Migrate.php index d56fc374..c570a58b 100644 --- a/files/commonfiles/class/Common/Migrate.php +++ b/files/commonfiles/class/Common/Migrate.php @@ -58,7 +58,7 @@ private function changePrefix(): void * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses(string $tableName, string $columnName): void + protected function convertIPAddresses(string $tableName, string $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); diff --git a/files/commonfiles/class/Common/ModuleFeedback.php b/files/commonfiles/class/Common/ModuleFeedback.php index f2af0fdd..b756fa70 100644 --- a/files/commonfiles/class/Common/ModuleFeedback.php +++ b/files/commonfiles/class/Common/ModuleFeedback.php @@ -28,11 +28,11 @@ */ class ModuleFeedback extends \XoopsObject { - public string $name = ''; - public string $email = ''; - public string $site = ''; - public string $type = ''; - public string $content = ''; + public $name = ''; + public $email = ''; + public $site = ''; + public $type = ''; + public $content = ''; /** * Constructor @@ -44,13 +44,12 @@ public function __construct() /** * @static function &getInstance */ - public static function getInstance(): self + public static function getInstance(): void { static $instance = false; if (!$instance) { $instance = new self(); } - return $instance; } /** @@ -58,7 +57,7 @@ public static function getInstance(): self * provide form for sending a feedback to module author * @return \XoopsThemeForm */ - public function getFormFeedback(): \XoopsThemeForm + public function getFormFeedback() { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -101,7 +100,7 @@ public function getFormFeedback(): \XoopsThemeForm $moduleHandler = \xoops_getHandler('module'); $module = $moduleHandler->getByDirname('system'); $configHandler = \xoops_getHandler('config'); - $config = $configHandler->getConfigsByCat(0, $module->getVar('mid')); + $config = &$configHandler->getConfigsByCat(0, $module->getVar('mid')); $editorConfigs['editor'] = $config['general_editor']; $editor = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs); $form->addElement($editor, true); diff --git a/files/commonfiles/class/Common/Resizer.php b/files/commonfiles/class/Common/Resizer.php index 2e762939..be4c40f5 100644 --- a/files/commonfiles/class/Common/Resizer.php +++ b/files/commonfiles/class/Common/Resizer.php @@ -194,8 +194,6 @@ public function resizeAndCrop() public function mergeImage(): void { - $dest = null; - $src = null; switch ($this->imageMimetype) { case 'image/png': $dest = \imagecreatefrompng($this->endFile); @@ -205,17 +203,7 @@ public function mergeImage(): void $dest = \imagecreatefromjpeg($this->endFile); $src = \imagecreatefromjpeg($this->sourceFile); break; - case 'image/gif': - $dest = \imagecreatefromgif($this->endFile); - $src = \imagecreatefromgif($this->sourceFile); - break; - default: - $this->error = 'Unsupported format'; - return; - } - if (!$dest || !$src) { - $this->error = 'Failed to load images'; - return; + // ... etc } if (4 == $this->mergeType) { $imgWidth = (int)\round($this->maxWidth / 2 - 1); diff --git a/files/commonfiles/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php index fa19754f..a18c6f28 100644 --- a/files/commonfiles/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } $success = true; - if ($module->versionCompare($currentVer, $requiredVer)) { + if ($module->versionCompare($currentVer, $requiredVer, '<')) { $success = false; $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } diff --git a/files/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php index 5dd9592c..8e52ee58 100644 --- a/files/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -30,7 +30,7 @@ class Helper extends \Xmf\Module\Helper /** * @param bool $debug */ - public function __construct($debug = false) + public function __construct(bool $debug = false) { $this->debug = $debug; $moduleDirName = \basename(\dirname(__DIR__)); diff --git a/files/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php index cd3a886b..b9171734 100644 --- a/files/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -158,6 +158,9 @@ public static function truncateHtml(string $text, int $length = 100, string $end public static function getEditor(\Xmf\Module\Helper $helper = null, array $options = null) { /** @var Modulebuilder\Helper $helper */ + if (null === $helper) { + $helper = Helper::getInstance(); + } if (null === $options) { $options = []; $options['name'] = 'Editor'; @@ -180,8 +183,6 @@ public static function getEditor(\Xmf\Module\Helper $helper = null, array $optio $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); } - // $form->addElement($descEditor); - return $descEditor; } @@ -230,7 +231,7 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; $donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), - \XOOPS_LICENSE_KEY, + \defined('XOOPS_LICENSE_KEY') ? \XOOPS_LICENSE_KEY : '', \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') ); diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index 3551aa5b..39bf2394 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -49,6 +49,8 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) { require \dirname(__DIR__) . '/preloads/autoloader.php'; + /** @var Modulebuilder\Helper $helper */ /** @var Modulebuilder\Utility $utility */ + /** @var Common\Configurator $configurator */ $helper = Modulebuilder\Helper::getInstance(); $utility = new Modulebuilder\Utility(); $configurator = new Common\Configurator(); @@ -63,9 +65,12 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) if ($configurator->uploadFolders && \is_array($configurator->uploadFolders)) { foreach (\array_keys($configurator->uploadFolders) as $i) { $path = $configurator->uploadFolders[$i]; - if (!\is_dir($path) && !$utility::createFolder($path)) { - $success = false; - continue; + if (!\is_dir($path)) { + $utility::createFolder($path); + if (!\is_dir($path)) { + $success = false; + continue; + } } if (!\chmod($path, 0775) && !\is_writable($path)) { $success = false; diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php index 19bd72fa..2055ea1a 100644 --- a/files/commonfiles/include/xoops_version.inc.php +++ b/files/commonfiles/include/xoops_version.inc.php @@ -39,14 +39,13 @@ function modulebuilderReturnBytes($val): int $number = (float)\substr($raw, 0, -1); switch ($unit) { - case 'K': + case 'K': return (int)\round($number * 1024); - case 'M': + case 'M': return (int)\round($number * 1048576); - case 'G': - + case 'G': return (int)\round($number * 1073741824); - default: + default: return (int)$raw; } } \ No newline at end of file diff --git a/files/ratingfiles/class/Ratings.php b/files/ratingfiles/class/Ratings.php index 4a35ff34..71cfe7e1 100644 --- a/files/ratingfiles/class/Ratings.php +++ b/files/ratingfiles/class/Ratings.php @@ -53,7 +53,7 @@ public static function getInstance(): self $instance = new self(); } return $instance; - } + } /** * The new inserted $Id diff --git a/files/ratingfiles/templates/modulebuilder_rate.tpl b/files/ratingfiles/templates/modulebuilder_rate.tpl index b8e29607..ec208a0d 100644 --- a/files/ratingfiles/templates/modulebuilder_rate.tpl +++ b/files/ratingfiles/templates/modulebuilder_rate.tpl @@ -5,19 +5,19 @@
    <{$item.rating.text}>
    - 1 + 1
    - 2 + 2
    - 3 + 3
    - 4 + 4
    - 5 + 5
    @@ -32,34 +32,34 @@
    <{$item.rating.text}>
    - 1 + 1
    - 2 + 2
    - 3 + 3
    - 4 + 4
    - 5 + 5
    - 6 + 6
    - 7 + 7
    - 8 + 8
    - 9 + 9
    - 10 + 10
    @@ -72,16 +72,16 @@
    - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
    <{$item.rating.text}> @@ -91,10 +91,10 @@ <{/if}> <{if $rating_likes}> <{/if}> diff --git a/include/functions.php b/include/functions.php index e2134507..d4726331 100644 --- a/include/functions.php +++ b/include/functions.php @@ -67,7 +67,7 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; $donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), - \XOOPS_LICENSE_KEY, + \defined('XOOPS_LICENSE_KEY') ? \XOOPS_LICENSE_KEY : '', \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') ); diff --git a/include/update.php b/include/update.php index 57dc40b3..a641d7c5 100644 --- a/include/update.php +++ b/include/update.php @@ -130,6 +130,9 @@ function modulebuilder_check_db($module) //insert here code for database check global $xoopsDB; + $sqlQueryFid = 'SELECT fieldelement_mid, fieldelement_tid, fieldelement_name, fieldelement_value, fieldelement_sort, fieldelement_deftype, fieldelement_defvalue, fieldelement_deffield + FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . ' as fe WHERE fe.fieldelement_id =%s'; + // new form field SelectStatus $fname = 'SelectStatus'; $fid = 16; @@ -139,8 +142,6 @@ function modulebuilder_check_db($module) ); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows == 0) { - $sqlQueryFid = 'SELECT fieldelement_mid, fieldelement_tid, fieldelement_name, fieldelement_value, fieldelement_sort, fieldelement_deftype, fieldelement_defvalue, fieldelement_deffield - FROM ' . $xoopsDB->prefix('modulebuilder_fieldelements') . ' as fe WHERE fe.fieldelement_id =%s'; $result = $xoopsDB->query(sprintf($sqlQueryFid, $fid)); $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); if ($num_rows > 0) { @@ -158,7 +159,7 @@ function modulebuilder_check_db($module) //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field Password @@ -187,7 +188,7 @@ function modulebuilder_check_db($module) //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field SelectCountry @@ -216,7 +217,7 @@ function modulebuilder_check_db($module) //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field SelectLanguage @@ -245,7 +246,7 @@ function modulebuilder_check_db($module) //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field Radio @@ -274,7 +275,7 @@ function modulebuilder_check_db($module) //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field DateTime @@ -303,7 +304,7 @@ function modulebuilder_check_db($module) //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field DateTime @@ -480,7 +481,7 @@ function modulebuilder_check_db($module) . $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); + $xoopsDB->query($sql); } // new form field text IP @@ -518,7 +519,7 @@ function modulebuilder_check_db($module) . $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); + $xoopsDB->query($sql); } // update table 'modulebuilder_fieldelements' @@ -566,7 +567,7 @@ function modulebuilder_check_db($module) . $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); + $xoopsDB->query($sql); } // new form field text ratings $fname = 'TextRatings'; @@ -603,7 +604,7 @@ function modulebuilder_check_db($module) . $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); + $xoopsDB->query($sql); } // new form field text votes $fname = 'TextVotes'; @@ -640,7 +641,7 @@ function modulebuilder_check_db($module) . $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); + $xoopsDB->query($sql); } // new form field text votes $fname = 'TextReads'; @@ -677,7 +678,7 @@ function modulebuilder_check_db($module) . $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); + $xoopsDB->query($sql); } // update table 'modulebuilder_tables' @@ -768,7 +769,7 @@ function modulebuilder_check_db($module) //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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // new form field text votes $fname = 'TextFloat'; @@ -833,7 +834,7 @@ function modulebuilder_check_db($module) //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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; } - $result = $xoopsDB->query($sql); + $xoopsDB->query($sql); } // resorting elements diff --git a/testdata/english/modulebuilder_fieldelements.yml b/testdata/english/modulebuilder_fieldelements.yml index dea98e8f..9e0d64c0 100644 --- a/testdata/english/modulebuilder_fieldelements.yml +++ b/testdata/english/modulebuilder_fieldelements.yml @@ -64,7 +64,7 @@ fieldelement_tid: '0' fieldelement_name: SelectBox fieldelement_value: XoopsFormSelect - fieldelement_sort: '9' + fieldelement_sort: '10' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -74,7 +74,7 @@ fieldelement_tid: '0' fieldelement_name: SelectUser fieldelement_value: XoopsFormSelectUser - fieldelement_sort: '11' + fieldelement_sort: '12' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -84,7 +84,7 @@ fieldelement_tid: '0' fieldelement_name: ColorPicker fieldelement_value: XoopsFormColorPicker - fieldelement_sort: '23' + fieldelement_sort: '24' fieldelement_deftype: '14' fieldelement_defvalue: '7' fieldelement_deffield: '' @@ -94,7 +94,7 @@ fieldelement_tid: '0' fieldelement_name: ImageList fieldelement_value: XoopsFormImageList - fieldelement_sort: '12' + fieldelement_sort: '13' fieldelement_deftype: '14' fieldelement_defvalue: '255' fieldelement_deffield: '' @@ -104,7 +104,7 @@ fieldelement_tid: '0' fieldelement_name: SelectFile fieldelement_value: XoopsFormSelectFile - fieldelement_sort: '13' + fieldelement_sort: '14' fieldelement_deftype: '14' fieldelement_defvalue: '255' fieldelement_deffield: '' @@ -114,7 +114,7 @@ fieldelement_tid: '0' fieldelement_name: UrlFile fieldelement_value: XoopsFormUrlFile - fieldelement_sort: '16' + fieldelement_sort: '17' fieldelement_deftype: '14' fieldelement_defvalue: '255' fieldelement_deffield: '' @@ -124,7 +124,7 @@ fieldelement_tid: '0' fieldelement_name: UploadImage fieldelement_value: XoopsFormUploadImage - fieldelement_sort: '14' + fieldelement_sort: '15' fieldelement_deftype: '14' fieldelement_defvalue: '255' fieldelement_deffield: '' @@ -134,7 +134,7 @@ fieldelement_tid: '0' fieldelement_name: UploadFile fieldelement_value: XoopsFormUploadFile - fieldelement_sort: '15' + fieldelement_sort: '16' fieldelement_deftype: '14' fieldelement_defvalue: '255' fieldelement_deffield: '' @@ -144,7 +144,7 @@ fieldelement_tid: '0' fieldelement_name: TextDateSelect fieldelement_value: XoopsFormTextDateSelect - fieldelement_sort: '18' + fieldelement_sort: '19' fieldelement_deftype: '2' fieldelement_defvalue: '11' fieldelement_deffield: '' @@ -154,7 +154,7 @@ fieldelement_tid: '0' fieldelement_name: SelectStatus fieldelement_value: XoopsFormSelectStatus - fieldelement_sort: '19' + fieldelement_sort: '20' fieldelement_deftype: '2' fieldelement_defvalue: '1' fieldelement_deffield: '' @@ -164,7 +164,7 @@ fieldelement_tid: '0' fieldelement_name: Password fieldelement_value: XoopsFormPassword - fieldelement_sort: '22' + fieldelement_sort: '23' fieldelement_deftype: '14' fieldelement_defvalue: '255' fieldelement_deffield: '' @@ -174,7 +174,7 @@ fieldelement_tid: '0' fieldelement_name: SelectCountry fieldelement_value: XoopsFormSelectCountry - fieldelement_sort: '20' + fieldelement_sort: '21' fieldelement_deftype: '14' fieldelement_defvalue: '3' fieldelement_deffield: '' @@ -184,7 +184,7 @@ fieldelement_tid: '0' fieldelement_name: SelectLang fieldelement_value: XoopsFormSelectLang - fieldelement_sort: '21' + fieldelement_sort: '22' fieldelement_deftype: '14' fieldelement_defvalue: '100' fieldelement_deffield: '' @@ -194,7 +194,7 @@ fieldelement_tid: '0' fieldelement_name: Radio fieldelement_value: XoopsFormRadio - fieldelement_sort: '8' + fieldelement_sort: '9' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -204,7 +204,7 @@ fieldelement_tid: '0' fieldelement_name: DateTime fieldelement_value: XoopsFormDateTime - fieldelement_sort: '17' + fieldelement_sort: '18' fieldelement_deftype: '2' fieldelement_defvalue: '11' fieldelement_deffield: '' @@ -214,7 +214,7 @@ fieldelement_tid: '0' fieldelement_name: SelectCombo fieldelement_value: XoopsFormSelectCombo - fieldelement_sort: '10' + fieldelement_sort: '11' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -224,7 +224,7 @@ fieldelement_tid: '0' fieldelement_name: TextUuid fieldelement_value: XoopsFormTextUuid - fieldelement_sort: '24' + fieldelement_sort: '25' fieldelement_deftype: '14' fieldelement_defvalue: '45' fieldelement_deffield: '' @@ -234,7 +234,7 @@ fieldelement_tid: '0' fieldelement_name: TextIp fieldelement_value: XoopsFormTextIp - fieldelement_sort: '25' + fieldelement_sort: '26' fieldelement_deftype: '14' fieldelement_defvalue: '45' fieldelement_deffield: '' @@ -244,7 +244,7 @@ fieldelement_tid: '0' fieldelement_name: TextComments fieldelement_value: XoopsFormTextComments - fieldelement_sort: '26' + fieldelement_sort: '27' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -254,7 +254,7 @@ fieldelement_tid: '0' fieldelement_name: TextRatings fieldelement_value: XoopsFormTextRatings - fieldelement_sort: '27' + fieldelement_sort: '28' fieldelement_deftype: '7' fieldelement_defvalue: '10, 2' fieldelement_deffield: '' @@ -264,7 +264,7 @@ fieldelement_tid: '0' fieldelement_name: TextVotes fieldelement_value: XoopsFormTextVotes - fieldelement_sort: '28' + fieldelement_sort: '29' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -274,7 +274,7 @@ fieldelement_tid: '0' fieldelement_name: TextReads fieldelement_value: XoopsFormTextReads - fieldelement_sort: '29' + fieldelement_sort: '30' fieldelement_deftype: '2' fieldelement_defvalue: '10' fieldelement_deffield: '' @@ -300,61 +300,11 @@ fieldelement_deffield: '0.00' - fieldelement_id: '31' - fieldelement_mid: '1' - fieldelement_tid: '1' - fieldelement_name: 'Table : Categories' - fieldelement_value: XoopsFormTables-Categories - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' - fieldelement_deffield: '' -- - fieldelement_id: '32' - fieldelement_mid: '1' - fieldelement_tid: '2' - fieldelement_name: 'Table : Articles' - fieldelement_value: XoopsFormTables-Articles - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' - fieldelement_deffield: '' -- - fieldelement_id: '33' - fieldelement_mid: '1' - fieldelement_tid: '3' - fieldelement_name: 'Table : Testfields' - fieldelement_value: XoopsFormTables-Testfields - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' - fieldelement_deffield: '' -- - fieldelement_id: '34' - fieldelement_mid: '2' - fieldelement_tid: '4' - fieldelement_name: 'Table : Categories' - fieldelement_value: XoopsFormTables-Categories - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' - fieldelement_deffield: '' -- - fieldelement_id: '35' - fieldelement_mid: '2' - fieldelement_tid: '5' - fieldelement_name: 'Table : Articles' - fieldelement_value: XoopsFormTables-Articles - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' - fieldelement_deffield: '' -- - fieldelement_id: '36' - fieldelement_mid: '2' - fieldelement_tid: '6' - fieldelement_name: 'Table : Testfields' - fieldelement_value: XoopsFormTables-Testfields - fieldelement_sort: '0' + fieldelement_mid: '0' + fieldelement_tid: '0' + fieldelement_name: RadioOnoffline + fieldelement_value: XoopsFormRadioOnoffline + fieldelement_sort: '8' fieldelement_deftype: '2' - fieldelement_defvalue: '10' - fieldelement_deffield: '' + fieldelement_defvalue: '1' + fieldelement_deffield: '0' diff --git a/testdata/index.php b/testdata/index.php index 19195930..b1883375 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -48,7 +48,7 @@ loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM'), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); xoops_cp_footer(); } break; @@ -56,14 +56,14 @@ saveSampleData(); break; case 'clear': - if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok')) { if (!$GLOBALS['xoopsSecurity']->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_confirm(['ok' => 1, 'op' => 'clear'], 'index.php', constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); xoops_cp_footer(); } break; @@ -163,14 +163,14 @@ function exportSchema(): void * * @param string $table value with should be used insead of original value of $search * - * @param array $data array of rows to insert + * @param array $data array of rows to insert * Each element of the outer array represents a single table row. * Each row is an associative array in 'column' => 'value' format. * @param string $search name of column for which the value should be replaced * @param $replace * @return int number of rows inserted */ -function loadTableFromArrayWithReplace($table, $data, $search, $replace) +function loadTableFromArrayWithReplace(string $table, array $data, string $search, $replace) { /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); From 85f1754f6f427ba7f8e121baa2bc1d8f75e98d9a Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 20:53:40 +0200 Subject: [PATCH 264/266] update modulbuilder itself - correction 2 --- admin/fields.php | 2 +- class/Common/Resizer.php | 23 ++++++++++++++++++++-- files/commonfiles/class/Common/Resizer.php | 23 ++++++++++++++++++++-- files/commonfiles/include/install.php | 8 ++++++-- files/ratingfiles/class/RatingsHandler.php | 14 ++++++------- include/update.php | 10 +++++++--- 6 files changed, 63 insertions(+), 17 deletions(-) diff --git a/admin/fields.php b/admin/fields.php index 3e571e99..7e9adefe 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -209,7 +209,7 @@ if ($order > 0) { $fieldsObj = $fieldsHandler->get($order); $fieldsObj->setVar('field_order', $i); - if ($fieldsHandler->insert($fieldsObj)) { + if (!$fieldsHandler->insert($fieldsObj)) { $error = true; } ++$i; diff --git a/class/Common/Resizer.php b/class/Common/Resizer.php index be4c40f5..035193c5 100644 --- a/class/Common/Resizer.php +++ b/class/Common/Resizer.php @@ -203,7 +203,15 @@ public function mergeImage(): void $dest = \imagecreatefromjpeg($this->endFile); $src = \imagecreatefromjpeg($this->sourceFile); break; - // ... etc + case 'image/gif': + $dest = \imagecreatefromgif($this->endFile); + $src = \imagecreatefromgif($this->sourceFile); + break; + default: + return; + } + if (!$dest || !$src) { + return; } if (4 == $this->mergeType) { $imgWidth = (int)\round($this->maxWidth / 2 - 1); @@ -253,7 +261,18 @@ public function mergeImage(): void break; } } - \imagejpeg($dest, $this->endFile); + // image output + switch ($this->imageMimetype) { + case 'image/png': + \imagepng($dest, $this->endFile, 0); + break; + case 'image/jpeg': + \imagejpeg($dest, $this->endFile, $this->jpgQuality); + break; + case 'image/gif': + \imagegif($dest, $this->endFile); + break; + } \imagedestroy($src); \imagedestroy($dest); diff --git a/files/commonfiles/class/Common/Resizer.php b/files/commonfiles/class/Common/Resizer.php index be4c40f5..035193c5 100644 --- a/files/commonfiles/class/Common/Resizer.php +++ b/files/commonfiles/class/Common/Resizer.php @@ -203,7 +203,15 @@ public function mergeImage(): void $dest = \imagecreatefromjpeg($this->endFile); $src = \imagecreatefromjpeg($this->sourceFile); break; - // ... etc + case 'image/gif': + $dest = \imagecreatefromgif($this->endFile); + $src = \imagecreatefromgif($this->sourceFile); + break; + default: + return; + } + if (!$dest || !$src) { + return; } if (4 == $this->mergeType) { $imgWidth = (int)\round($this->maxWidth / 2 - 1); @@ -253,7 +261,18 @@ public function mergeImage(): void break; } } - \imagejpeg($dest, $this->endFile); + // image output + switch ($this->imageMimetype) { + case 'image/png': + \imagepng($dest, $this->endFile, 0); + break; + case 'image/jpeg': + \imagejpeg($dest, $this->endFile, $this->jpgQuality); + break; + case 'image/gif': + \imagegif($dest, $this->endFile); + break; + } \imagedestroy($src); \imagedestroy($dest); diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php index 39bf2394..22438b2e 100644 --- a/files/commonfiles/include/install.php +++ b/files/commonfiles/include/install.php @@ -72,8 +72,12 @@ function xoops_module_install_modulebuilder(\XoopsModule $module) continue; } } - if (!\chmod($path, 0775) && !\is_writable($path)) { - $success = false; + if (!@\is_writable($path)) { + \chmod($path, 0775); + \clearstatcache(false, $path); + if (!@\is_writable($path)) { + $success = false; + } } } } diff --git a/files/ratingfiles/class/RatingsHandler.php b/files/ratingfiles/class/RatingsHandler.php index d40b9eab..182e6623 100644 --- a/files/ratingfiles/class/RatingsHandler.php +++ b/files/ratingfiles/class/RatingsHandler.php @@ -120,15 +120,15 @@ public function getItemRating(int $itemid = 0, int $source = 0) $ItemRating['avg_rate_value'] = \number_format($current_rating / $count, 2); } if (1 == $count) { - $text = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_1); - $shorttext = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_SHORT_1); + $text = \str_replace('%c', (string)$ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_1); + $shorttext = \str_replace('%c', (string)$ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_SHORT_1); } else { - $text = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_X); - $shorttext = \str_replace('%c', $ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_SHORT_X); + $text = \str_replace('%c', (string)$ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_X); + $shorttext = \str_replace('%c', (string)$ItemRating['avg_rate_value'], \_MA_MODULEBUILDER_RATING_CURRENT_SHORT_X); } - $text = \str_replace('%m', $max_units, $text); - $text = \str_replace('%t', $ItemRating['nb_ratings'], $text); - $shorttext = \str_replace('%t', $ItemRating['nb_ratings'], $shorttext); + $text = \str_replace('%m', (string)$max_units, $text); + $text = \str_replace('%t', (string)$ItemRating['nb_ratings'], $text); + $shorttext = \str_replace('%t', (string)$ItemRating['nb_ratings'], $shorttext); $ItemRating['text'] = $text; $ItemRating['shorttext'] = $shorttext; $ItemRating['size'] = ($ItemRating['avg_rate_value'] * $rating_unitwidth) . 'px'; diff --git a/include/update.php b/include/update.php index a641d7c5..91680fa4 100644 --- a/include/update.php +++ b/include/update.php @@ -33,29 +33,33 @@ */ function xoops_module_update_modulebuilder($module, $prev_version = null) { - $ret = null; + $ret = true; if ($prev_version < 191) { update_modulebuilder_v191($module); } if (!modulebuilder_check_db($module)) { + $ret = false; print_r($module->getErrors()); } if (!clean_index_files()) { + $ret = false; print_r($module->getErrors()); } //check upload directory require_once __DIR__ . '/install.php'; - xoops_module_install_modulebuilder($module); + if (!xoops_module_install_modulebuilder($module)) { + $ret = false; + } $errors = $module->getErrors(); if (!empty($errors)) { print_r($errors); } - return null; + return $ret; } // irmtfan bug fix: solve templates duplicate issue From d36f84ad6e2d5338f7c391ce84d4c121862d8687 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 21:23:28 +0200 Subject: [PATCH 265/266] update modulbuilder itself - correction 3 --- admin/fields.php | 16 +++++-- admin/tables.php | 15 +++++-- include/update.php | 101 +++++++++++++++++++++++---------------------- 3 files changed, 75 insertions(+), 57 deletions(-) diff --git a/admin/fields.php b/admin/fields.php index 7e9adefe..d6b56a17 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -201,21 +201,29 @@ $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'order': + $error = false; // Initialize fields handler $fieldsHandler = $helper->getHandler('Fields'); if (isset($_POST['forder'])) { $i = 0; foreach ($_POST['forder'] as $order) { if ($order > 0) { - $fieldsObj = $fieldsHandler->get($order); - $fieldsObj->setVar('field_order', $i); - if (!$fieldsHandler->insert($fieldsObj)) { + $fieldsObj = $fieldsHandler->get((int)$order); + if ($fieldsObj instanceof \XoopsObject) { + $fieldsObj->setVar('field_order', $i); + if (!$fieldsHandler->insert($fieldsObj)) { + $error = true; + } + } else { $error = true; + continue; } ++$i; } } - \redirect_header('fields.php', 5, \_AM_MODULEBUILDER_FIELD_ORDER_ERROR); + if ($error) { + \redirect_header('fields.php', 5, \_AM_MODULEBUILDER_FIELD_ORDER_ERROR); + } unset($i); } exit; diff --git a/admin/tables.php b/admin/tables.php index 86bab486..615b3f6a 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -237,21 +237,30 @@ $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'order': + $error = false; // Initialize tables handler $tablesHandler = $helper->getHandler('Tables'); if (isset($_POST['torder'])) { $i = 0; foreach ($_POST['torder'] as $order) { if ($order > 0) { - $tablesObj = $tablesHandler->get($order); + $tablesObj = $tablesHandler->get((int)$order); $tablesObj->setVar('table_order', $i); - if (!$tablesHandler->insert($tablesObj)) { + if ($tablesObj instanceof \XoopsObject) { + $tablesObj->setVar('field_order', $i); + if (!$tablesHandler->insert($tablesObj)) { + $error = true; + } + } else { $error = true; + continue; } ++$i; } } - \redirect_header('tables.php', 5, \_AM_MODULEBUILDER_TABLE_ORDER_ERROR); + if ($error) { + \redirect_header('tables.php', 5, \_AM_MODULEBUILDER_TABLE_ORDER_ERROR); + } unset($i); } exit; diff --git a/include/update.php b/include/update.php index 91680fa4..93ab0744 100644 --- a/include/update.php +++ b/include/update.php @@ -34,8 +34,9 @@ function xoops_module_update_modulebuilder($module, $prev_version = null) { $ret = true; - if ($prev_version < 191) { - update_modulebuilder_v191($module); + + if ($prev_version < 191 && !update_modulebuilder_v191($module)) { + $ret = false; } if (!modulebuilder_check_db($module)) { @@ -152,18 +153,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 16 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 16 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field Password @@ -181,18 +182,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 17 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 17 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field SelectCountry @@ -210,18 +211,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 18 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 18 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field SelectLanguage @@ -239,18 +240,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 19 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 19 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field Radio @@ -268,18 +269,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 20 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 20 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field DateTime @@ -297,18 +298,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 21 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 21 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field DateTime @@ -326,18 +327,18 @@ function modulebuilder_check_db($module) [$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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 22 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 22 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; } else { //add missing element $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // update table 'modulebuilder_fieldelements' @@ -470,11 +471,11 @@ function modulebuilder_check_db($module) $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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // 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}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 23 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') @@ -485,7 +486,7 @@ function modulebuilder_check_db($module) . $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}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field text IP @@ -508,11 +509,11 @@ function modulebuilder_check_db($module) $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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // 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}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 23 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') @@ -523,7 +524,7 @@ function modulebuilder_check_db($module) . $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}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // update table 'modulebuilder_fieldelements' @@ -556,11 +557,11 @@ function modulebuilder_check_db($module) $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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // 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}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 25 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') @@ -571,7 +572,7 @@ function modulebuilder_check_db($module) . $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}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field text ratings $fname = 'TextRatings'; @@ -593,11 +594,11 @@ function modulebuilder_check_db($module) $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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // 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}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 26 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') @@ -608,7 +609,7 @@ function modulebuilder_check_db($module) . $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}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field text votes $fname = 'TextVotes'; @@ -630,11 +631,11 @@ function modulebuilder_check_db($module) $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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // 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}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 27 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') @@ -645,7 +646,7 @@ function modulebuilder_check_db($module) . $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}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field text votes $fname = 'TextReads'; @@ -667,11 +668,11 @@ function modulebuilder_check_db($module) $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}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // 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}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 28 to new element $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fieldelements') @@ -682,7 +683,7 @@ function modulebuilder_check_db($module) . $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}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // update table 'modulebuilder_tables' @@ -762,18 +763,18 @@ function modulebuilder_check_db($module) list($fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 29 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 29 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}', `fieldelement_deffield` = '{$fdeffield}' WHERE `fieldelement_id` = {$fid};"; } 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field text votes $fname = 'TextFloat'; @@ -794,18 +795,18 @@ function modulebuilder_check_db($module) list($fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 30 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 30 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}', `fieldelement_deffield` = '{$fdeffield}' WHERE `fieldelement_id` = {$fid};"; } 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field Radio On-/Offline @@ -827,18 +828,18 @@ function modulebuilder_check_db($module) list($fe_mid, $fe_tid, $fe_name, $fe_value, $fe_sort, $fe_deftype, $fe_defvalue, $fe_deffield) = $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`, `fieldelement_deffield`) VALUES (NULL, '{$fe_mid}', '{$fe_tid}', '{$fe_name}', '{$fe_value}', '{$fe_sort}', '{$fe_deftype}', '{$fe_defvalue}', '{$fe_deffield}')"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 31 $newId = $xoopsDB->getInsertId(); $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } // update 31 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}', `fieldelement_deffield` = '{$fdeffield}' WHERE `fieldelement_id` = {$fid};"; } 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`, `fieldelement_deffield`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}', '{$fsort}', '{$fdeftype}', '{$fdefvalue}', '{$fdeffield}')"; } - $xoopsDB->query($sql); + if (!$xoopsDB->query($sql)) { $ret = false; } } // resorting elements From a3c097b7e6027995bc838481e931e38dc7211dc6 Mon Sep 17 00:00:00 2001 From: "NB-GABOR02\\Goffy" Date: Wed, 8 Apr 2026 21:56:03 +0200 Subject: [PATCH 266/266] update modulbuilder itself - correction 4 --- admin/tables.php | 3 +-- include/update.php | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/tables.php b/admin/tables.php index 615b3f6a..b6805908 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -245,9 +245,8 @@ foreach ($_POST['torder'] as $order) { if ($order > 0) { $tablesObj = $tablesHandler->get((int)$order); - $tablesObj->setVar('table_order', $i); if ($tablesObj instanceof \XoopsObject) { - $tablesObj->setVar('field_order', $i); + $tablesObj->setVar('table_order', $i); if (!$tablesHandler->insert($tablesObj)) { $error = true; } diff --git a/include/update.php b/include/update.php index 93ab0744..68c02806 100644 --- a/include/update.php +++ b/include/update.php @@ -875,8 +875,9 @@ function modulebuilder_check_db($module) $sortElements[] = 'TextVotes'; $sortElements[] = 'TextReads'; foreach ($sortElements as $key => $sortElement) { - $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . ' SET `fieldelement_sort` = ' . ($key + 1) . ' WHERE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "`.`fieldelement_name` = '" . $sortElement . "'"); - + if (!$xoopsDB->query('UPDATE ' . $xoopsDB->prefix('modulebuilder_fieldelements') . ' SET `fieldelement_sort` = ' . ($key + 1) . ' WHERE `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "`.`fieldelement_name` = '" . $sortElement . "'")) { + $ret = false; + } } return $ret;