diff --git a/.atoum.php b/.atoum.php index e9c8ba6c..902a12dc 100644 --- a/.atoum.php +++ b/.atoum.php @@ -1,4 +1,5 @@ -. + 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/README.md b/README.md index eb30f954..017dfd98 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,35 @@ +![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) + +![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp81.png) + # 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 3.x -[![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/ggoffy/modulebuilder/badges/build.png?b=master)](https://travis-ci.org/ggoffy/modulebuilder) +[![Jenkins coverage](https://img.shields.io/jenkins/c/https/jenkins.qa.ubuntu.com/address-book-service-utopic-i386-ci.svg)](https://github.com/XoopsModules25x/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) - -

-Issue Stats -Issue Stats - -

+[![Quality Score](https://img.shields.io/scrutinizer/g/ggoffy/modulebuilder.svg?style=flat)](https://scrutinizer-ci.com/g/ggoffy/modulebuilder) +[![Gem](https://img.shields.io/gem/dt/rails.svg)](XoopsModules25x/modulebuilder) +[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/modulebuilder.svg?style=flat)](https://github.com/XoopsModules25x/modulebuilder/releases/latest) -> **Note:** This repository contains the code of the tdmcreate 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. +> **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 [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: -

- TDMCreate 1.9.1 dashboard +

+ ModuleBuilder 1.9.1 dashboard

Clear version # Require: -- XOOPS 2.5.8; +- XOOPS 2.5.11; - XOOPS Admin 1.2; -- PHP 5.3 or high; +- PHP 7.3 or higher; - MySQL 5.5; -> Minimum Recommended Using InnoDB Version 5.1 or Later # Adding @@ -43,29 +41,36 @@ 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. + +**ModuleBuilder is tested with PHP 8. Created modules are ready for PHP 8.0** -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. +Tested with XOOPS 2.5.11, you can not use it with earlier versions, unless because you don't fit some core files in the background and after some tests. -That is ahead XOOPS versions, and goes to 2.6.0, you should download XOOPS 2.5.7.2 and use with this latest version. +That is ahead XOOPS versions, and goes to 2.6.0, you should download XOOPS 2.5 and use with this latest version. -Therefore recommended not to use tdmcreate 1.91, with previous versions of XOOPS 2.5.7 +Therefore recommended not to use modulebuilder 3.x, with previous versions of XOOPS 2.5.10 # System - Tests -PHP = 5.5.15, 5.6.19, 5.7.0 +PHP = 7.3, 7.4, 8.0 MySQL = 5.6.20, 5.7.11 Apache = 2.4.10, 2.4.18 -XOOPS = 2.5.7.1, 2.5.7.2, 2.5.8 +XOOPS = 2.5.11 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) +#### Tutorial: +[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://xoops.gitbook.io/modulebuilder-tutorial/) Tutorial: coming soon on [GitBook](https://xoops.gitbook.io/modulebuilder-tutorial/). +To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/modulebuilder-tutorial) + +#### Translation: +[![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) + +Please visit us on https://xoops.org -[![Throughput Graph](https://graphs.waffle.io/txmodxoops/tdmcreate/throughput.svg)](https://waffle.io/txmodxoops/tdmcreate/metrics) +Current and upcoming "next generation" versions of XOOPS CMS are being crafted on GitHub at: https://github.com/XOOPS diff --git a/_TODO.txt b/_TODO.txt index 82801835..e69de29b 100644 --- a/_TODO.txt +++ b/_TODO.txt @@ -1,51 +0,0 @@ -**************************************************************************************** - -IMPORTANT: -I moved files, where I do not know whether they are still needed into folder _archive - -**************************************************************************************** - - - -TODOs: - -implement constants interface - - - - - -Notifications: -there are too much notification, which are not needed/working -- reduce xoops_version.php to needed -- adapt language/modinfo.php (make nice text of e.g.: Global newcategory notify caption) - - -rate.php: -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/_archive/Preloads/PreloadsCore.php b/_archive/Preloads/PreloadsCore.php deleted file mode 100644 index b3380cd6..00000000 --- a/_archive/Preloads/PreloadsCore.php +++ /dev/null @@ -1,108 +0,0 @@ -tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); - } - - /** - * @static function getInstance - * @param null - * @return PreloadsCore - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /** - * @public function write - * @param $module - * @param $filename - */ - public function write($module, $filename) - { - $this->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'); - $ucfModuleDirname = ucfirst($moduleDirname); - $content = $this->getHeaderFilesComments($module, $filename); - - $content .= <<tdmcfile->create($moduleDirname, 'preloads', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->tdmcfile->renderFile(); - } -} diff --git a/_archive/Preloads/index.html b/_archive/Preloads/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/_archive/Preloads/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/_archive/class/Files/CreateHtmlSmartyCodes.php b/_archive/class/Files/CreateHtmlSmartyCodes.php deleted file mode 100644 index 8b427e73..00000000 --- a/_archive/class/Files/CreateHtmlSmartyCodes.php +++ /dev/null @@ -1,760 +0,0 @@ -getAttributes($attributes); - if ('br' === $tag) { - $ret = "{$t}<{$tag}{$attr}>{$n}"; - } elseif ($noClosed) { - $ret = "{$t}<{$tag}{$attr} />{$n}"; - } else { - $ret = "{$t}<{$tag}{$attr}>{$content}{$n}"; - } - - return $ret; - } - - /** - * @private function setAttributes - * @param array $attributes - * - * @return string - */ - private function getAttributes($attributes) - { - $str = ''; - foreach ($attributes as $name => $value) { - if ('_' !== $name) { - $str .= ' ' . $name . '="' . $value . '"'; - } - } - - return $str; - } - - /** - * @public function getHtmlEmpty - * @param string $empty - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlEmpty($empty = '', $t = '', $n = "") - { - return "{$t}{$empty}{$n}"; - } - - /** - * @public function getHtmlComment - * @param string $htmlComment - * - * @param string $n - * @return string - */ - public function getHtmlComment($htmlComment = '', $n = '') - { - return "{$n}"; - } - - /** - * @public function getHtmlBr - * @param int $brNumb - * @param string $htmlClass - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlBr($brNumb = 1, $htmlClass = '', $t = '', $n = "\n") - { - $brClass = ('' != $htmlClass) ? " class='{$htmlClass}'" : ''; - $ret = ''; - for ($i = 0; $i < $brNumb; ++$i) { - $ret .= "{$t}{$n}"; - } - - return $ret; - } - - /** - * @public function getHtmlHNumb - * @param string $content - * - * @param string $l - * @param string $htmlHClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlHNumb($content = '', $l = '1', $htmlHClass = '', $t = '', $n = "\n") - { - $hClass = ('' != $htmlHClass) ? " class='{$htmlHClass}'" : ''; - $ret = "{$t}{$content}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlDiv - * @param string $content - * - * @param string $divClass - * @param string $t - * @param string $n - * @param bool $split - * @return string - */ - public function getHtmlDiv($content = '', $divClass = '', $t = '', $n = "\n", $split = true) - { - $rDivClass = ('' != $divClass) ? " class='{$divClass}'" : ''; - - if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - } else { - $ret = "{$t}{$content}{$n}"; - } - - return $ret; - } - - /** - * @public function getHtmlPre - * @param string $content - * - * @param string $preClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlPre($content = '', $preClass = '', $t = '', $n = "\n") - { - $rPreClass = ('' != $preClass) ? " class='{$preClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlSpan - * @param string $content - * - * @param string $spanClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlSpan($content = '', $spanClass = '', $t = '', $n = "\n") - { - $rSpanClass = ('' != $spanClass) ? " class='{$spanClass}'" : ''; - $ret = "{$t}{$content}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlParagraph - * @param string $content - * - * @param string $pClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlParagraph($content = '', $pClass = '', $t = '', $n = "\n") - { - $rPClass = ('' != $pClass) ? " class='{$pClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}

{$n}"; - - return $ret; - } - - /** - * @public function getHtmlI - * @param string $content - * - * @param string $iClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlI($content = '', $iClass = '', $t = '', $n = "\n") - { - $rIClass = ('' != $iClass) ? " class='{$iClass}'" : ''; - $ret = "{$t}{$content}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlUl - * @param string $content - * - * @param string $ulClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlUl($content = '', $ulClass = '', $t = '', $n = "\n") - { - $rUlClass = ('' != $ulClass) ? " class='{$ulClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlOl - * @param string $content - * - * @param string $olClass - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlOl($content = '', $olClass = '', $t = '', $n = "\n") - { - $rOlClass = ('' != $olClass) ? " class='{$olClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlLi - * @param string $content - * @param string $liClass - * - * @param string $t - * @param string $n - * @param bool $split - * @return string - */ - public function getHtmlLi($content = '', $liClass = '', $t = '', $n = "\n", $split = false) - { - $rLiClass = ('' != $liClass) ? " class='{$liClass}'" : ''; - if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - } else { - $ret = "{$t}{$content}{$n}"; - } - - return $ret; - } - - /** - * @public function getHtmlStrong - * @param string $content - * @param string $strongClass - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlStrong($content = '', $strongClass = '', $t = '', $n = '') - { - $rStrongClass = ('' != $strongClass) ? " class='{$strongClass}'" : ''; - - return "{$t}{$content}{$n}"; - } - - /** - * @public function getHtmlAnchor - * @param string $url - * @param string $content - * @param string $title - * @param string $target - * @param string $aClass - * - * @param string $rel - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlAnchor($url = '#', $content = ' ', $title = '', $target = '', $aClass = '', $rel = '', $t = '', $n = '') - { - $target = ('' != $target) ? " target='{$target}'" : ''; - $rAClass = ('' != $aClass) ? " class='{$aClass}'" : ''; - $rel = ('' != $rel) ? " rel='{$rel}'" : ''; - - return "{$t}{$content}{$n}"; - } - - /** - * @public function getHtmlImage - * @param string $src - * @param string $alt - * @param string $imgClass - * - * @param string $t - * @return string - */ - public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '', $t = '') - { - $rImgClass = ('' != $imgClass) ? " class='{$imgClass}'" : ''; - $ret = "{$t}"; - - return $ret; - } - - /** - * @public function getHtmlTable - * @param string $content - * @param string $tableClass - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlTable($content = '', $tableClass = '', $t = '', $n = "\n") - { - $rTableClass = ('' != $tableClass) ? " class='{$tableClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlTableThead - * @param string $content - * @param string $theadClass - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlTableThead($content = '', $theadClass = '', $t = '', $n = "\n") - { - $rTheadClass = ('' != $theadClass) ? " class='{$theadClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlTableTbody - * @param string $content - * @param string $tbodyClass - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlTableTbody($content = '', $tbodyClass = '', $t = '', $n = "\n") - { - $rTbodyClass = ('' != $tbodyClass) ? " class='{$tbodyClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlTableTfoot - * @param string $content - * @param string $tfootClass - * - * @param string $t - * @param string $n - * @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}"; - } else { - $ret = "{$t}{$content}{$n}"; - } - - return $ret; - } - - /** - * @public function getHtmlTableRow - * @param string $content - * @param string $trClass - * - * @param string $t - * @param string $n - * @return string - */ - public function getHtmlTableRow($content = '', $trClass = '', $t = '', $n = "\n") - { - $rTrClass = ('' != $trClass) ? " class='{$trClass}'" : ''; - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - - return $ret; - } - - /** - * @public function getHtmlTableHead - * @param string $content - * @param string $thClass - * @param string $colspan - * - * @param string $t - * @param string $n - * @param bool $split - * @return string - */ - public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', $t = '', $n = "\n", $split = false) - { - $rThClass = ('' != $thClass) ? " class='{$thClass}'" : ''; - $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : ''; - if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - } else { - $ret = "{$t}{$content}{$n}"; - } - return $ret; - } - - /** - * @public function getHtmlTableData - * @param string $content - * @param string $tdClass - * @param string $colspan - * - * @param string $t - * @param string $n - * @param bool $split - * @return string - */ - public function getHtmlTableData($content = '', $tdClass = '', $colspan = '', $t = '', $n = "\n", $split = false) - { - $rTdClass = ('' != $tdClass) ? " class='{$tdClass}'" : ''; - $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : ''; - if ($split) { - $ret = "{$t}{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}{$n}"; - } else { - $ret = "{$t}{$content}{$n}"; - } - return $ret; - } - - /** - * @public function getSmartyComment - * @param string $comment - * - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyComment($comment = '', $t = '', $n = "\n") - { - return "{$t}<{* {$comment} *}>{$n}"; - } - - /** - * @public function getSmartyNoSimbol - * @param string $noSimbol - * - * @return string - */ - public function getSmartyNoSimbol($noSimbol = '') - { - return "<{{$noSimbol}}>"; - } - - /** - * @public function getSmartyConst - * @param string $language - * @param mixed $const - * - * @return string - */ - public function getSmartyConst($language, $const) - { - return "<{\$smarty.const.{$language}{$const}}>"; - } - - /** - * @public function getSmartySingleVar - * @param string $var - * - * @param string $t - * @param string $n - * @return string - */ - public function getSmartySingleVar($var, $t = '', $n = "") - { - return "{$t}<{\${$var}}>{$n}"; - } - - /** - * @public function getSmartyDoubleVar - * @param string $leftVar - * @param string $rightVar - * - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = "") - { - return "{$t}<{\${$leftVar}.{$rightVar}}>{$n}"; - } - - /** - * @public function getSmartyIncludeFile - * @param $moduleDirname - * @param string $fileName - * @param bool $admin - * - * @param bool $q - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $q = false, $t = '', $n = "\n") - { - $ret = ''; - if (!$admin && !$q) { - $ret = "{$t}<{include file='db:{$moduleDirname}_{$fileName}.tpl'}>{$n}"; - } elseif ($admin && !$q) { - $ret = "{$t}<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>{$n}"; - } elseif (!$admin && $q) { - $ret = "{$t}<{includeq file='db:{$moduleDirname}_{$fileName}.tpl'}>{$n}"; - } elseif ($admin && $q) { - $ret = "{$t}<{includeq file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>{$n}"; - } - - return $ret; - } - - /** - * @public function getSmartyIncludeFileListSection - * @param $moduleDirname - * @param $fileName - * @param $tableFieldName - * - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $tableFieldName, $t = '', $n = '') - { - return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}[i]}>{$n}"; - } - - /** - * @public function getSmartyIncludeFileListForeach - * @param $moduleDirname - * @param $fileName - * @param $tableFieldName - * - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tableFieldName, $t = '', $n = '') - { - return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}}>{$n}"; - } - - /** - * @public function getSmartyConditions - * @param string $condition - * @param string $operator - * @param string $type - * @param string $contentIf - * @param mixed $contentElse - * @param bool $count - * - * @param bool $noSimbol - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '', $n = "\n") - { - 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}"; - } 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 .= "{$contentElse}"; - $ret .= "{$t}<{/if}>{$n}"; - } - - return $ret; - } - - /** - * @public function getSmartyForeach - * @param string $item - * @param string $from - * @param string $content - * - * @param string $name - * @param string $key - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content', $name = '', $key = '', $t = '', $n = "\n") - { - $name = '' != $name ? " name={$name}" : ''; - $key = '' != $key ? " key={$key}" : ''; - $ret = "{$t}<{foreach item={$item} from=\${$from}{$key}{$name}}>{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}<{/foreach}>{$n}"; - - return $ret; - } - - /** - * @public function getSmartyForeachQuery - * @param string $item - * @param string $from - * @param string $content - * - * @param string $loop - * @param string $key - * @param string $t - * @param string $n - * @return string - */ - public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content', $loop = 'loop', $key = '', $t = '', $n = "\n") - { - $loop = '' != $loop ? " loop={$loop}" : ''; - $key = '' != $key ? " key={$key}" : ''; - $ret = "{$t}<{foreachq item={$item} from=\${$from}{$key}{$loop}}>{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}<{/foreachq}>{$n}"; - - return $ret; - } - - /** - * @public function getSmartySection - * @param string $name - * @param string $loop - * @param string $content - * - * @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") - { - $start = 0 != $start ? " start={$start}" : ''; - $step = 0 != $step ? " step={$step}" : ''; - $ret = "{$t}<{section name={$name} loop=\${$loop}{$start}{$step}}>{$n}"; - $ret .= "{$content}"; - $ret .= "{$t}<{/section}>{$n}"; - - return $ret; - } -} diff --git a/_archive/class/Files/Templates/User/DisqusComments.php b/_archive/class/Files/Templates/User/DisqusComments.php deleted file mode 100644 index 39c3388a..00000000 --- a/_archive/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/_archive/class/Files/Templates/User/FacebookComments.php b/_archive/class/Files/Templates/User/FacebookComments.php deleted file mode 100644 index 30c530d6..00000000 --- a/_archive/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/_archive/class/Files/User/UserObjects.php b/_archive/class/Files/User/UserObjects.php deleted file mode 100644 index 20770a35..00000000 --- a/_archive/class/Files/User/UserObjects.php +++ /dev/null @@ -1,482 +0,0 @@ -setVar('{$fieldName}', \$_POST['{$fieldName}']);\n -EOT; - - return $ret; - } - - /** - * @public function getTextDateSelectSetVar - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getTextDateSelectSetVar($tableName, $fieldName) - { - $ret = <<setVar('{$fieldName}', strtotime(\$_POST['{$fieldName}']));\n -EOT; - - return $ret; - } - - /** - * @public function getCheckBoxOrRadioYNSetVar - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getCheckBoxOrRadioYNSetVar($tableName, $fieldName) - { - $ret = <<setVar('{$fieldName}', ((1 == \$_REQUEST['{$fieldName}']) ? '1' : '0'));\n -EOT; - - return $ret; - } - - /** - * @public function getUrlFileSetVar - * @param $moduleDirname - * @param $tableName - * @param $fieldName - * @return string - */ - public function getUrlFileSetVar($moduleDirname, $tableName, $fieldName) - { - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ret = <<setVar('{$fieldName}', formatUrl(\$_REQUEST['{$fieldName}']));\n - // Set Var {$fieldName} - include_once XOOPS_ROOT_PATH.'/class/uploader.php'; - \$uploaddir = {$stuModuleDirname}_UPLOAD_PATH.'/files/{$tableName}'; - \$uploader = new \XoopsMediaUploader(\$uploaddir, \$helper->getConfig('mimetypes_file'), - \$helper->getConfig('maxsize_file'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][])) { - \$uploader->fetchMedia(\$_POST['xoops_upload_file'][]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - }\n -EOT; - - return $ret; - } - - /** - * @public function getImageListSetVar - * @param string $moduleDirname - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getImageListSetVar($moduleDirname, $tableName, $fieldName) - { - $ret = <<getConfig('mimetypes_image'), - \$helper->getConfig('maxsize_image'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][])) { - //\$uploader->setPrefix('{$fieldName}_'); - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']); - }\n -EOT; - - return $ret; - } - - /** - * @public function getUploadImageSetVar - * @param string $moduleDirname - * @param string $tableName - * @param string $fieldName - * @param $fpmf - * @return string - */ - public function getUploadImageSetVar($moduleDirname, $tableName, $fieldName, $fpmf) - { - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ret = <<getConfig('mimetypes_image'), - \$helper->getConfig('maxsize_image'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][0])) { - \$extension = preg_replace( '/^.+\.([^.]+)$/sU' , '' , \$_FILES['attachedfile']['name']); - \$imgName = str_replace(' ', '', \$_POST['{$fpmf}']).'.'.\$extension; - \$uploader->setPrefix(\$imgName); - \$uploader->fetchMedia(\$_POST['xoops_upload_file'][0]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$_POST['{$fieldName}']); - }\n -EOT; - - return $ret; - } - - /** - * @public function getUploadFileSetVar - * @param string $moduleDirname - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getUploadFileSetVar($moduleDirname, $tableName, $fieldName) - { - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ret = <<getConfig('mimetypes_file'), - \$helper->getConfig('maxsize_file'), null, null); - if (\$uploader->fetchMedia(\$_POST['xoops_upload_file'][])) { - //\$uploader->setPrefix('{$fieldName}_') ; - //\$uploader->fetchMedia(\$_POST['xoops_upload_file'][]); - if (!\$uploader->upload()) { - \$errors = \$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, \$errors); - } else { - \${$tableName}Obj->setVar('{$fieldName}', \$uploader->getSavedFileName()); - } - }\n -EOT; - - return $ret; - } - - /** - * @public function getUserSaveFieldId - * @param $fields - * - * @return string - */ - public function getUserSaveFieldId($fields) - { - foreach (array_keys($fields) as $f) { - if (0 == $f) { - $fieldId = $fields[$f]->getVar('field_name'); - } - } - - return $fieldId; - } - - /** - * @public function getUserSaveFieldMain - * @param $fields - * - * @return string - */ - public function getUserSaveFieldMain($fields) - { - foreach (array_keys($fields) as $f) { - if (1 == $fields[$f]->getVar('field_main')) { - $fieldMain = $fields[$f]->getVar('field_name'); - } - } - - return $fieldMain; - } - - /** - * @public function getUserSaveElements - * @param $moduleDirname - * @param $tableName - * @param $fields - * - * @return string - */ - public function getUserSaveElements($moduleDirname, $tableName, $fields) - { - $ret = ''; - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldElement = $fields[$f]->getVar('field_element'); - if (1 == $fields[$f]->getVar('field_main')) { - $fieldMain = $fieldName; - } - if ((5 == $fieldElement) || (6 == $fieldElement)) { - $ret .= $this->getCheckBoxOrRadioYNSetVar($tableName, $fieldName); - } elseif (13 == $fieldElement) { - $ret .= $this->getUploadImageSetVar($moduleDirname, $tableName, $fieldName, $fieldMain); - } elseif (14 == $fieldElement) { - $ret .= $this->getUploadFileSetVar($moduleDirname, $tableName, $fieldName); - } elseif (15 == $fieldElement) { - $ret .= $this->getTextDateSelectSetVar($tableName, $fieldName); - } else { - $ret .= $this->getSimpleSetVar($tableName, $fieldName); - } - } - - return $ret; - } - - /** - * @public function getSimpleGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getSimpleGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) - { - $ret = <<getVar('{$fieldName}');\n -EOT; - - return $ret; - } - - /** - * @public function getTopicGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $tableNameTopic - * @param string $fieldNameParent - * @param string $fieldNameTopic - * @return string - */ - public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNameTopic, $fieldNameParent, $fieldNameTopic) - { - $ret = <<get(\${$tableName}All[\$i]->getVar('{$fieldNameParent}')); -\t\t\${$lpFieldName}['{$rpFieldName}'] = \${$rpFieldName}->getVar('{$fieldNameTopic}');\n -EOT; - - return $ret; - } - - /** - * @public function getUploadImageGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) - { - $ret = <<getVar('{$fieldName}'); -\t\t\$upload_image = \${$fieldName} ? \${$fieldName} : 'blank.gif'; -\t\t\${$lpFieldName}['{$rpFieldName}'] = \$upload_image;\n -EOT; - - return $ret; - } - - /** - * @public function getUrlFileGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getUrlFileGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) - { - $ret = <<getVar('{$fieldName}');\n -EOT; - - return $ret; - } - - /** - * @public function getTextAreaGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getTextAreaGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) - { - $ret = <<getVar('{$fieldName}'));\n -EOT; - - return $ret; - } - - /** - * @public function getSelectUserGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getSelectUserGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) - { - $ret = <<getVar('{$fieldName}'), 's');\n -EOT; - - return $ret; - } - - /** - * @public function getTextDateSelectGetVar - * @param string $lpFieldName - * @param string $rpFieldName - * @param string $tableName - * @param string $fieldName - * @return string - */ - public function getTextDateSelectGetVar($lpFieldName, $rpFieldName, $tableName, $fieldName) - { - $ret = <<getVar('{$fieldName}'), 's');\n -EOT; - - return $ret; - } -} diff --git a/admin/PUBLISHER_ROOT_PATH b/admin/PUBLISHER_ROOT_PATH deleted file mode 100644 index e69de29b..00000000 diff --git a/admin/about.php b/admin/about.php index cf9b5f43..1475203a 100644 --- a/admin/about.php +++ b/admin/about.php @@ -1,4 +1,4 @@ -displayNavigation(basename(__FILE__)); +$adminObject->displayNavigation(\basename(__FILE__)); $adminObject::setPaypal('xoopsfoundation@gmail.com'); $adminObject->displayAbout(false); -include __DIR__ . '/footer.php'; +require __DIR__ . '/footer.php'; diff --git a/admin/addfiles.php b/admin/addfiles.php deleted file mode 100644 index 09676dcc..00000000 --- a/admin/addfiles.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - */ -$GLOBALS['xoopsOption']['template_main'] = 'tdmcreate_addfiles.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('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'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addfiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_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); - $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); - } - $addfilesCount = $helper->getHandler('Addfiles')->getCountAddFiles(); - $addfilesAll = $helper->getHandler('Addfiles')->getAllAddFiles($start, $limit); - // Display addfiles list - if ($addfilesCount > 0) { - foreach (array_keys($addfilesAll) as $i) { - $files = $addfilesAll[$i]->getAddFilesValues(); - $GLOBALS['xoopsTpl']->append('files_list', $files); - unset($files); - } - if ($addfilesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($addfilesCount, $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_addfiles.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('addfiles.php')); - $adminObject->addItemButton(_AM_TDMCREATE_ADDFILES_LIST, 'addfiles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - - $addfilesObj = $helper->getHandler('Addfiles')->create(); - $form = $addfilesObj->getFormAddFiles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('addfiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($fileId)) { - $addfilesObj = $helper->getHandler('Addfiles')->get($fileId); - } else { - $addfilesObj = $helper->getHandler('Addfiles')->create(); - } - // Form file save - $addfilesObj->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('Addfiles')->insert($addfilesObj)) { - if ($addfilesObj->isNew()) { - redirect_header('addfiles.php', 5, sprintf(_AM_TDMCREATE_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'))); - } - } - - $GLOBALS['xoopsTpl']->assign('error', $addfilesObj->getHtmlErrors()); - $form = $addfilesObj->getFormAddFiles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'edit': - // Define main template - // $templateMain = 'tdmcreate_addfiles.tpl'; - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/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'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - - $addfilesObj = $helper->getHandler('Addfiles')->get($fileId); - $form = $addfilesObj->getFormAddFiles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'delete': - $addfilesObj = $helper->getHandler('Addfiles')->get($fileId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - 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); - } 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'))); - } - break; -} - -include __DIR__ . '/footer.php'; 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/building.php b/admin/building.php index 599d7ceb..80b1a8ea 100644 --- a/admin/building.php +++ b/admin/building.php @@ -1,6 +1,4 @@ -getHandler('Modules')->get($mid); -$cachePath = XOOPS_VAR_PATH . '/caches/tdmcreate_cache'; -if (!is_dir($cachePath)) { - if (!mkdir($cachePath, 0777) && !is_dir($cachePath)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $cachePath)); +use Xmf\Request; +use XoopsModules\Modulebuilder; +use XoopsModules\Modulebuilder\Files; + +$templateMain = 'modulebuilder_building.tpl'; + +require __DIR__ . '/header.php'; +$op = Request::getString('op', 'default'); +$mid = Request::getInt('mod_id'); +$inrootCopy = Request::getInt('inroot_copy'); +$testdataRestore = Request::getInt('testdata_restore'); +$checkData = Request::hasVar('check_data'); +$moduleObj = $helper->getHandler('Modules')->get($mid); + +$cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_'; +if (!\is_dir($cachePath)) { + if (!\mkdir($cachePath) && !\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')) { - unlink($cache); +if (\file_exists($cache = $cachePath . '/classpaths.cache')) { + \unlink($cache); +} +if (!\file_exists($indexFile = $cachePath . '/index.php')) { + \copy('index.php', $indexFile); } -if (!file_exists($indexFile = $cachePath . '/index.html')) { - copy('index.html', $indexFile); + +if ($checkData > 0) { + $op = 'check_data'; } // Switch option switch ($op) { + case 'check_data': + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); + $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); + $checkdata = Modulebuilder\Files\CheckData::getInstance(); + + // check data for inconsistences + $checkResults = []; + $checkResults = $checkdata->getCheckPreBuilding($moduleObj); + + if (\count($checkResults) > 0) { + //$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); + $GLOBALS['xoopsTpl']->assign('checkResults', $checkResults); + } else { + $GLOBALS['xoopsTpl']->assign('checkResultsNice', true); + } + + break; case 'build': $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); + $building = Modulebuilder\Building::getInstance(); + $structure = Modulebuilder\Files\CreateStructure::getInstance(); + $architecture = Modulebuilder\Files\CreateArchitecture::getInstance(); + $checkdata = Modulebuilder\Files\CheckData::getInstance(); // Get var module dirname $moduleDirname = $moduleObj->getVar('mod_dirname'); + + //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'; + if (\is_dir($fromDir)) { + // Directories for copy to + $toDir = TDMC_UPLOAD_TEMP_PATH . '/' . \mb_strtolower($moduleDirname); + $structure->isDir($toDir); + $toDir .= '/testdata'; + if (\is_dir($toDir)) { + $building->clearDir($toDir); + } else { + $structure->isDir($toDir); + } + $building->copyDir($fromDir, $toDir); + } else { + $testdataRestore = 0; + } + } + // Directories for copy from to - $fromDir = TDMC_UPLOAD_REPOSITORY_PATH . '/' . mb_strtolower($moduleDirname); - $toDir = XOOPS_ROOT_PATH . '/modules/' . mb_strtolower($moduleDirname); - // include_once TDMC_CLASS_PATH . '/building.php'; + $fromDir = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleDirname); + $toDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname); if (isset($moduleDirname)) { // Clear this module if it's in repository - $building = Tdmcreate\Building::getInstance(); - if (is_dir($fromDir)) { + $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(); // Creation of the structure of folders and files - $baseArchitecture = $handler->setBaseFoldersFiles($moduleObj); + $baseArchitecture = $architecture->setBaseFoldersFiles($moduleObj); if (false !== $baseArchitecture) { $GLOBALS['xoopsTpl']->assign('base_architecture', true); } else { @@ -73,7 +122,7 @@ } // Get files $build = []; - $files = $handler->setFilesToBuilding($moduleObj); + $files = $architecture->setFilesToBuilding($moduleObj); foreach ($files as $file) { if ($file) { $build['list'] = $file; @@ -83,31 +132,41 @@ unset($build); // Get common files - $resCommon = $handler->setCommonFiles($moduleObj); - $build['list'] = _AM_TDMCREATE_BUILDING_COMMON; + $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_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(); + if (1 === $inrootCopy) { if (isset($moduleDirname)) { // Clear this module if it's in root/modules // Warning: If you have an older operating module with the same name, // it's good to make a copy in another safe folder, // otherwise it will be deleted irreversibly. - if (is_dir($fromDir)) { + if (\is_dir($fromDir)) { $building->clearDir($toDir); } } $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); + if (1 === $testdataRestore) { + // Directories for copy from to + $fromDir = TDMC_UPLOAD_TEMP_PATH . '/' . \mb_strtolower($moduleDirname) . '/testdata'; + $toDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata'; + if (\is_dir($toDir)) { + $building->clearDir($toDir); + } + if (\is_dir($fromDir)) { + $building->copyDir($fromDir, $toDir); + } + } + + $GLOBALS['xoopsTpl']->assign('building_directory', $building_directory); break; case 'default': default: @@ -115,13 +174,13 @@ // 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_THEREARENT_MODULES2); } 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; } -include __DIR__ . '/footer.php'; +require __DIR__ . '/footer.php'; diff --git a/admin/devtools.php b/admin/devtools.php new file mode 100644 index 00000000..ddf32cc0 --- /dev/null +++ b/admin/devtools.php @@ -0,0 +1,233 @@ +assign('navigation', $adminObject->displayNavigation('devtools.php')); + $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/' . $modName . '/language/english/'; + $langfiles = []; + foreach (scandir($src_path) as $scan) { + if (is_file($src_path . $scan) && 'index.html' !== $scan) { + $langfiles[] = $src_path . $scan; + } + } + $moduleConstants = []; + foreach ($langfiles as $langfile) { + //$constantsBeforeInclude = getUserDefinedConstants(); + require_once($langfile); + //$constantsAfterInclude = getUserDefinedConstants(); + //$moduleConstants[$langfile] = array_diff_assoc($constantsAfterInclude, $constantsBeforeInclude); + } + $constantsAfterInclude = getUserDefinedConstants(); + foreach ($constantsAfterInclude as $constKey => $constValue) { + if (mb_strpos($constKey, '_' . $modNameUpper . '_') > 0) { + $moduleConstants[$constKey] = $constKey; + } + } + + //get all php and tpl files from module + $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); + //$files = new RegexIterator($flattened, '#^(?:[A-Z]:)?(?:/(?!\.Trash)[^/]+)+/[^/]+\.(?:php|html)$#Di'); + $modfiles = []; + foreach ($regexFiles as $regexFile) { + $file = str_replace('\\', '/', $regexFile[0]); + if (!\in_array($file, $langfiles)) { + $modfiles[] = $file; + } + } + + //check all constants in all files + $resultCheck = []; + foreach ($moduleConstants as $constKey) { + $foundMod = 0; + $first = ''; + $foundLang = 'not defined'; + //search for complete string + foreach ($modfiles as $modfile) { + if (mb_strpos(file_get_contents($modfile), $constKey) !== false) { + $foundMod = 1; + $first = $modfile; + break; + } + } + if (0 == $foundMod) { + //search for concatenated string + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey); + foreach ($modfiles as $modfile) { + if (mb_strpos(file_get_contents($modfile), $needle) !== false) { + $foundMod = 1; + $first = $modfile; + break; + } + } + } + if (0 == $foundMod) { + //search for concatenated string + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey); + foreach ($modfiles as $modfile) { + if (mb_strpos(file_get_contents($modfile), $needle) !== false) { + $foundMod = 1; + $first = $modfile; + break; + } + } + } + foreach ($langfiles as $langfile) { + if (mb_strpos(file_get_contents($langfile), $constKey) !== false) { + $foundLang = $langfile; + break; + } + } + if ('' == $foundLang) { + //search for concatenated string + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey); + foreach ($langfiles as $langfile) { + if (mb_strpos(file_get_contents($langfile), $needle) !== false) { + $foundLang = $langfile; + break; + } + } + } + if ('' == $foundLang) { + //search for concatenated string + $needle = str_replace('_' . $modNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey); + foreach ($langfiles as $langfile) { + if (mb_strpos(file_get_contents($langfile), $needle) !== false) { + $foundLang = $langfile; + break; + } + } + } + $resultCheck[\basename($foundLang)][] = ['define' => $constKey, 'found' => $foundMod, 'first' => $first]; + } + $GLOBALS['xoopsTpl']->assign('clresults', $resultCheck); + $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); + + break; + case 'tab_replacer': + $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/' . $modName; + @\mkdir($dst_path); + + Devtools::function_tabreplacer($src_path, $dst_path); + \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_TAB_SUCCESS); + 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; + + 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': + 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)); + $fq_form = Devtools::getFormModulesFq(); + $GLOBALS['xoopsTpl']->assign('fq_form', $fq_form->render()); + + $cl_form = Devtools::getFormModulesCl(); + $GLOBALS['xoopsTpl']->assign('cl_form', $cl_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', \_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); + + break; +} + +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 124f7e43..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) */ use Xmf\Request; -include __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; $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'); $moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname'); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -xoops_loadLanguage('feedback', $moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); +\xoops_loadLanguage('feedback', $moduleDirName); //xoops_cp_header(); @@ -41,31 +41,31 @@ $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); $feedback->name = $GLOBALS['xoopsUser']->getVar('name'); $feedback->email = $GLOBALS['xoopsUser']->getVar('email'); - $feedback->site = XOOPS_URL; + $feedback->site = \XOOPS_URL; $form = $feedback->getFormFeedback(); $form->display(); break; case 'send': // Security Check if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('index.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } $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', ''); - $fb_content = str_replace(["\r\n", "\n", "\r"], '
', $fb_content); //clean line break from dhtmltextarea + $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'); - $body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
'; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
'; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
'; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

'; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
'; + $title = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname'); + $body = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
'; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
'; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
'; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

'; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
'; $body .= $fb_content; $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); @@ -73,11 +73,11 @@ $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) { - redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); + \redirect_header('index.php', 3, \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); } // show form with content again @@ -86,8 +86,8 @@ $feedback->site = $your_site; $feedback->type = $fb_type; $feedback->content = $fb_content; - echo '
-

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

+ echo '
+

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

'; $form = $feedback->getFormFeedback(); $form->display(); diff --git a/admin/fields.php b/admin/fields.php index eaf4e8f3..d6b56a17 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -1,4 +1,4 @@ -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_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 $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_THEREARENT_MODULES2); } 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_THEREARENT_TABLES2); } // Get the list of tables - $tablesAll = $helper->getHandler('Tables')->getAllTables($start, $limit, 'table_order'); + $tablesAll = $helper->getHandler('Tables')->getAllTables($start, $limit); if ($tablesCount > 0) { $tlid = 1; - foreach (array_keys($tablesAll) as $tid) { + foreach (\array_keys($tablesAll) as $tid) { // Display tables list $table = $tablesAll[$tid]->getValuesTables(); $talid = ['lid' => $tlid]; $table = array_merge($table, $talid); // Get the list of fields $fieldsCount = $helper->getHandler('Fields')->getCountFields(); - $fieldsAll = $helper->getHandler('Fields')->getAllFieldsByModuleAndTableId($table['mid'], $tid); + $fieldsAll = $helper->getHandler('Fields')->getAllFieldsByTableId($tid); // Display fields list $fields = []; $lid = 1; if ($fieldsCount > 0) { - foreach (array_keys($fieldsAll) as $fid) { + foreach (\array_keys($fieldsAll) as $fid) { $field = $fieldsAll[$fid]->getValuesFields(); $falid = ['lid' => $lid]; $fields[] = array_merge($field, $falid); @@ -100,21 +100,21 @@ unset($tlid); unset($fields); if ($tablesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + 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_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(); @@ -123,7 +123,7 @@ break; case 'save': if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('fields.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } $fieldId = \Xmf\Request::getInt('field_id'); // Fields Handler @@ -154,6 +154,9 @@ $fieldsObj->setVar('field_inlist', (1 == $_REQUEST['field_inlist'][$key]) ? 1 : 0); $fieldsObj->setVar('field_inform', (1 == $_REQUEST['field_inform'][$key]) ? 1 : 0); $fieldsObj->setVar('field_user', (1 == $_REQUEST['field_user'][$key]) ? 1 : 0); + $fieldsObj->setVar('field_ihead', (1 == $_REQUEST['field_ihead'][$key]) ? 1 : 0); + $fieldsObj->setVar('field_ibody', (1 == $_REQUEST['field_ibody'][$key]) ? 1 : 0); + $fieldsObj->setVar('field_ifoot', (1 == $_REQUEST['field_ifoot'][$key]) ? 1 : 0); $fieldsObj->setVar('field_thead', (1 == $_REQUEST['field_thead'][$key]) ? 1 : 0); $fieldsObj->setVar('field_tbody', (1 == $_REQUEST['field_tbody'][$key]) ? 1 : 0); $fieldsObj->setVar('field_tfoot', (1 == $_REQUEST['field_tfoot'][$key]) ? 1 : 0); @@ -172,10 +175,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 +186,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_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')); // Form Edit $fieldId = \Xmf\Request::getInt('field_id'); @@ -198,39 +201,34 @@ $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'order': + $error = false; // 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($fieldOrder)) { + $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_TDMCREATE_FIELD_ORDER_ERROR); + if ($error) { + \redirect_header('fields.php', 5, \_AM_MODULEBUILDER_FIELD_ORDER_ERROR); + } unset($i); } exit; - break; case 'delete': - $tablesObj = $helper->getHandler('Tables')->get($fieldTid); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($helper->getHandler('Tables')->delete($tablesObj)) { - redirect_header('fields.php', 3, _AM_TDMCREATE_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'))); - } + //delete is not needed as deletion is done by deleting whole table break; case 'display': $fieldsArray = ['parent', 'inlist', 'inform', 'admin', 'user', 'block', 'main', 'search', 'required']; @@ -244,10 +242,10 @@ } } 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()); } break; } -include __DIR__ . '/footer.php'; +require __DIR__ . '/footer.php'; diff --git a/admin/footer.php b/admin/footer.php index 8bd0b22d..2e0e4289 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -1,4 +1,4 @@ -display("db:{$templateMain}"); diff --git a/admin/header.php b/admin/header.php index 3f2bc7e7..94043ee4 100644 --- a/admin/header.php +++ b/admin/header.php @@ -1,4 +1,4 @@ -getVar('dirname'); // Link System Icons @@ -34,14 +34,13 @@ $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(); +$helper = \XoopsModules\Modulebuilder\Helper::getInstance(); +$utility = new \XoopsModules\Modulebuilder\Utility(); // MyTextSanitizer $myts = MyTextSanitizer::getInstance(); -if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once XOOPS_ROOT_PATH . '/class/template.php'; +if (!isset($xoopsTpl) || !\is_object($xoopsTpl)) { + require_once \XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new \XoopsTpl(); } // System Icons diff --git a/admin/import_module.php b/admin/import_module.php new file mode 100644 index 00000000..82c66b41 --- /dev/null +++ b/admin/import_module.php @@ -0,0 +1,77 @@ +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, ''); +/** @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')); +} +$select_table = new \XoopsFormSelect(_AM_MODULEBUILDER_TABLE_ID, 'table_id', ''); + +$sql = 'SHOW TABLES'; +$result = $GLOBALS['xoopsDB']->queryF($sql); + +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))) { + $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); + +$GLOBALS['xoopsTpl']->assign('form', $formImportModule->render()); + +require __DIR__ . '/footer.php'; diff --git a/admin/index.html b/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 79976ec8..13c16d96 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,4 +1,4 @@ -getHandler('Settings')->getCount(); $countModules = $helper->getHandler('Modules')->getCount(); $countTables = $helper->getHandler('Tables')->getCount(); @@ -31,13 +42,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, @@ -46,89 +57,35 @@ TDMC_UPLOAD_IMGTAB_PATH, ]; -// Uploads Folders Created -foreach (array_keys($folder) as $i) { - $adminObject->addConfigBoxLine($folder[$i], 'folder'); - $adminObject->addConfigBoxLine([$folder[$i], '777'], 'chmod'); -} +//------ check Upload Folders --------------- +$adminObject->addConfigBoxLine(); +$redirectFile = $_SERVER['SCRIPT_NAME']; -$adminObject->displayNavigation(basename(__FILE__)); +foreach (\array_keys($folder) as $i) { + $adminObject->addConfigBoxLine(Common\DirectoryChecker::getDirectoryStatus($folder[$i], 0777, $redirectFile)); +} -//------------- Test Data ---------------------------- +$adminObject->displayNavigation(\basename(__FILE__)); +//------------- 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 . '_' . 'ADD_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()); - -include __DIR__ . '/footer.php'; +//codeDump(__FILE__); +require __DIR__ . '/footer.php'; diff --git a/admin/logo.php b/admin/logo.php index 9cb82bed..869f6e10 100644 --- a/admin/logo.php +++ b/admin/logo.php @@ -1,6 +1,6 @@ - - * */ -include __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; $funct = \Xmf\Request::getString('funct', '', 'GET'); $iconName = \Xmf\Request::getString('iconName', '', 'GET'); $caption = \Xmf\Request::getString('caption', '', 'GET'); -if (function_exists($funct)) { - $ret = Tdmcreate\Logo::getInstance()->createLogo($iconName, $caption); - phpFunction($ret); +if (\function_exists($funct)) { + $ret = Modulebuilder\Logo::getInstance()->createLogo($iconName, $caption); + if (false !== $ret) { + phpFunction($ret); + } } else { - redirect_header('logo.php', 3, 'Method Not Exist'); + \redirect_header('logo.php', 3, 'Method Not Exist'); } // phpFunction /** * @param string $val */ -function phpFunction($val = '') +function phpFunction(string $val = ''): void { // create php function here echo $val; diff --git a/admin/menu.php b/admin/menu.php index ce75c3d7..11f358be 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -1,4 +1,4 @@ -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'); +$moduleHandler = \xoops_getHandler('module'); $xoopsModule = \XoopsModule::getByDirname($moduleDirName); $moduleInfo = $moduleHandler->get($xoopsModule->getVar('mid')); $sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); $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', ]; +$adminmenu[] = [ + 'title' => \_MI_MODULEBUILDER_ADMENU8, + 'link' => 'admin/devtools.php', + 'icon' => $modPathIcon32 . '/devtools.png', +]; + //Feedback $adminmenu[] = [ - 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK'), + 'title' => \constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK'), 'link' => 'admin/feedback.php', 'icon' => $pathIcon32 . 'mail_foward.png', ]; -if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) { +if (\is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) { $adminmenu[] = [ - 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), + 'title' => \constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), 'link' => 'admin/migrate.php', 'icon' => $pathIcon32 . 'database_go.png', ]; } $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..6c690352 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -1,71 +1,58 @@ - // -// ------------------------------------------------------------------------ // -// 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\Tdmcreate; +use XoopsModules\Modulebuilder; require_once __DIR__ . '/header.php'; //xoops_cp_header(); -$adminObject->displayNavigation(basename(__FILE__)); +$adminObject->displayNavigation(\basename(__FILE__)); echo << -
- -
-
- -
-
- -
- -EOF; +
+
+ +
+
+ +
+
+ +
+
+ EOF; //XoopsLoad::load('migrate', 'newbb'); -/** @var Tdmcreate\Common\Configurator $configurator */ -$configurator = new Tdmcreate\Common\Configurator(); +$configurator = new Modulebuilder\Common\Configurator(); -/** @var \XoopsModules\Tdmcreate\Common\Migrate $migrator */ -$migrator = new \XoopsModules\Tdmcreate\Common\Migrate($configurator); +$migrator = new \XoopsModules\Modulebuilder\Common\Migrate($configurator); -$op = Request::getCmd('op', 'default'); -$opShow = Request::getCmd('show', null, 'POST'); +$op = Request::getCmd('op', 'default'); +$opShow = Request::getCmd('show', null, 'POST'); $opMigrate = Request::getCmd('migrate', null, 'POST'); -$opSchema = Request::getCmd('schema', null, 'POST'); -$op = !empty($opShow) ? 'show' : $op; -$op = !empty($opMigrate) ? 'migrate' : $op; -$op = !empty($opSchema) ? 'schema' : $op; +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; $message = ''; diff --git a/admin/modules.php b/admin/modules.php index e4144805..709f30a5 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -1,4 +1,4 @@ - - * */ +use Xmf\Request; +use XoopsModules\Modulebuilder\{ + Helper, + Import +}; + +/** @var Helper $helper */ +/** @var Admin $adminObject */ + // Define main template -$templateMain = 'tdmcreate_modules.tpl'; +$templateMain = 'modulebuilder_modules.tpl'; -include __DIR__ . '/header.php'; +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')); - $GLOBALS['xoTheme']->addScript('modules/tdmcreate/assets/js/functions.js'); - $GLOBALS['xoTheme']->addStylesheet('modules/tdmcreate/assets/css/admin/style.css'); + $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_TDMCREATE_ADD_MODULE, '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'); + $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,71 +58,86 @@ $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_THEREARENT_MODULES2); } // Display modules list if ($modulesCount > 0) { - foreach (array_keys($modulesAll) as $i) { + foreach (\array_keys($modulesAll) as $i) { $module = $modulesAll[$i]->getValuesModules(); $GLOBALS['xoopsTpl']->append('modules_list', $module); unset($module); } if ($modulesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + 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_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')); + $settings = $helper->getHandler('Settings')->getActiveSetting(); + if (0 == \count($settings)) { + \redirect_header('settings.php', 5, \_AM_MODULEBUILDER_MODULE_NOACTSET); + } $modulesObj = $helper->getHandler('Modules')->create(); $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'); + $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': if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('modules.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('modules.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if (isset($modId)) { $modulesObj = $helper->getHandler('Modules')->get($modId); } 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 - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; + require_once \XOOPS_ROOT_PATH . '/class/uploader.php'; $uploader = new \XoopsMediaUploader( TDMC_UPLOAD_IMGMOD_PATH, $helper->getConfig('mimetypes_image'), $helper->getConfig('maxsize_image'), null, null ); @@ -119,43 +145,43 @@ $uploader->fetchMedia($_POST['xoops_upload_file'][0]); if (!$uploader->upload()) { $errors = &$uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, $errors); + \redirect_header('javascript:history.go(-1)', 3, $errors); } else { $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', []); - $modulesObj->setVar('mod_admin', in_array('admin', $moduleOption)); - $modulesObj->setVar('mod_user', in_array('user', $moduleOption)); - $modulesObj->setVar('mod_blocks', in_array('blocks', $moduleOption)); - $modulesObj->setVar('mod_search', in_array('search', $moduleOption)); - $modulesObj->setVar('mod_comments', in_array('comments', $moduleOption)); - $modulesObj->setVar('mod_notifications', in_array('notifications', $moduleOption)); - $modulesObj->setVar('mod_permissions', in_array('permissions', $moduleOption)); - //$modulesObj->setVar('mod_inroot_copy', in_array('inroot_copy', $moduleOption)); + $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)); + $modulesObj->setVar('mod_search', \in_array('search', $moduleOption)); + $modulesObj->setVar('mod_comments', \in_array('comments', $moduleOption)); + $modulesObj->setVar('mod_notifications', \in_array('notifications', $moduleOption)); + $modulesObj->setVar('mod_permissions', \in_array('permissions', $moduleOption)); + //$modulesObj->setVar('mod_inroot_copy', \in_array('inroot_copy', $moduleOption)); 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, 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, Request::getString('mod_name', '', 'POST'))); } } @@ -164,10 +190,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_MODULES_ADD, 'modules.php?op=new'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_MODULES_LIST, 'modules.php', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $modulesObj = $helper->getHandler('Modules')->get($modId); @@ -178,21 +204,42 @@ $modulesObj = $helper->getHandler('Modules')->get($modId); if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('modules.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('modules.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } + //delete all morefiles + $critDelete = new \CriteriaCompo(); + $critDelete->add(new \Criteria('file_mid', $modId)); + $helper->getHandler('Morefiles')->deleteAll($critDelete); + unset($critDelete); + //delete all fields + $critDelete = new \CriteriaCompo(); + $critDelete->add(new \Criteria('field_mid', $modId)); + $helper->getHandler('Fields')->deleteAll($critDelete); + unset($critDelete); + //delete all tables + $critDelete = new \CriteriaCompo(); + $critDelete->add(new \Criteria('table_mid', $modId)); + $helper->getHandler('Tables')->deleteAll($critDelete); + unset($critDelete); + //delete module 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'))); + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'], + \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), + $modulesObj->getVar('mod_name') + ); + $form = $customConfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); } - 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) { @@ -202,12 +249,121 @@ } } 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()); } break; -} + case 'clone': + $modIdSource = Request::getInt('mod_id'); + 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'])) { + $uniqValue = ''; + 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); + } -include __DIR__ . '/footer.php'; + //clone data table tables + $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))) { + $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}'" + ); + 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))) { + $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/admin/morefiles.php b/admin/morefiles.php index c6b1d4f3..4d1cce46 100644 --- a/admin/morefiles.php +++ b/admin/morefiles.php @@ -1,4 +1,4 @@ - - * */ // Define main template -$templateMain = 'tdmcreate_morefiles.tpl'; +$templateMain = 'modulebuilder_morefiles.tpl'; -include __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; // Recovered value of argument op in the URL $ $op = \Xmf\Request::getString('op', 'list'); @@ -34,12 +33,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/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_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); @@ -48,39 +47,39 @@ $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_THEREARENT_MODULES2); } - $morefilesCount = $helper->getHandler('Morefiles')->getCountMoreFiles(); - $morefilesAll = $helper->getHandler('Morefiles')->getAllMoreFiles($start, $limit); + $morefilesCount = $helper->getHandler('Morefiles')->getCountMorefiles(); + $morefilesAll = $helper->getHandler('Morefiles')->getAllMorefiles($start, $limit); // Display morefiles list if ($morefilesCount > 0) { - foreach (array_keys($morefilesAll) as $i) { - $files = $morefilesAll[$i]->getValuesMoreFiles(); + foreach (\array_keys($morefilesAll) as $i) { + $files = $morefilesAll[$i]->getValuesMorefiles(); $GLOBALS['xoopsTpl']->append('files_list', $files); unset($files); } if ($morefilesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + 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_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(); - $form = $morefilesObj->getFormMoreFiles(); + $form = $morefilesObj->getFormMorefiles(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'save': if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('morefiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('morefiles.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if (isset($fileId)) { $morefilesObj = $helper->getHandler('Morefiles')->get($fileId); @@ -91,52 +90,56 @@ $morefilesObj->setVars( [ 'file_mid' => \Xmf\Request::getInt('file_mid', 0, 'POST'), + 'file_type' => \Xmf\Request::getString('file_type', '', 'POST'), 'file_name' => \Xmf\Request::getString('file_name', '', 'POST'), 'file_extension' => \Xmf\Request::getString('file_extension', '', 'POST'), + 'file_upload' => \Xmf\Request::getString('file_upload', '', 'POST'), 'file_infolder' => \Xmf\Request::getString('file_infolder', '', 'POST'), ] ); 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'))); } } $GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors()); - $form = $morefilesObj->getFormMoreFiles(); + $form = $morefilesObj->getFormMorefiles(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'edit': - // Define main template - // $templateMain = 'tdmcreate_morefiles.tpl'; - $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_ADD_MODULE, 'morefiles.php?op=new', 'add'); - $adminObject->addItemButton(_AM_TDMCREATE_MORE_FILES_LIST, 'morefiles.php', 'list'); + $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')); $morefilesObj = $helper->getHandler('Morefiles')->get($fileId); - $form = $morefilesObj->getFormMoreFiles(); + $form = $morefilesObj->getFormMorefiles(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'delete': $morefilesObj = $helper->getHandler('Morefiles')->get($fileId); if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('morefiles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \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'))); + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + ['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $morefilesObj->getVar('file_name') + ); + $form = $customConfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; } -include __DIR__ . '/footer.php'; +require __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/admin/settings.php b/admin/settings.php index 5e6caab7..3d2cb32c 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -1,4 +1,4 @@ - - * */ // Define main template -$templateMain = 'tdmcreate_settings.tpl'; +$templateMain = 'modulebuilder_settings.tpl'; -include __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; // Recovered value of argument op in the URL $ $op = \Xmf\Request::getString('op', 'list'); @@ -34,12 +33,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/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_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); @@ -49,24 +48,24 @@ $settingsAll = $helper->getHandler('Settings')->getAllSettings($start, $limit); // Display settings list if ($settingsCount > 0) { - foreach (array_keys($settingsAll) as $i) { + foreach (\array_keys($settingsAll) as $i) { $setting = $settingsAll[$i]->getValuesSettings(); $GLOBALS['xoopsTpl']->append('settings_list', $setting); unset($setting); } if ($settingsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + 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_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(); @@ -75,14 +74,14 @@ break; case 'save': if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('settings.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('settings.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if (isset($setId)) { $settingsObj = $helper->getHandler('Settings')->get($setId); } else { $settingsObj = $helper->getHandler('Settings')->create(); } - $setModuleDirname = preg_replace('/[^a-zA-Z0-9]\s+/', '', mb_strtolower($_POST['set_dirname'])); + $setModuleDirname = \preg_replace('/[^a-zA-Z0-9]\s+/', '', \mb_strtolower($_POST['set_dirname'])); //Form module save $settingsObj->setVars( [ @@ -124,21 +123,25 @@ 'set_subversion' => \Xmf\Request::getString('set_subversion', '', 'POST'), ] ); - $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)); - $settingsObj->setVar('set_search', in_array('search', $settingOption)); - $settingsObj->setVar('set_comments', in_array('comments', $settingOption)); - $settingsObj->setVar('set_notifications', in_array('notifications', $settingOption)); - $settingsObj->setVar('set_permissions', in_array('permissions', $settingOption)); - //$settingsObj->setVar('set_inroot_copy', in_array('inroot', $settingOption)); - if (\Xmf\Request::hasVar('set_type')) { - $settingsObj->setVar('set_type', \Xmf\Request::getString('set_type', '', 'POST')); + $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)); + $settingsObj->setVar('set_search', \in_array('search', $settingOption)); + $settingsObj->setVar('set_comments', \in_array('comments', $settingOption)); + $settingsObj->setVar('set_notifications', \in_array('notifications', $settingOption)); + $settingsObj->setVar('set_permissions', \in_array('permissions', $settingOption)); + $settingsObj->setVar('set_inroot_copy', \in_array('inroot', $settingOption)); + $setType = \Xmf\Request::getString('set_type', '', 'POST'); + if (1 == $setType) { + // reset all + $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 0'; + $GLOBALS['xoopsDB']->queryF($strSQL); } + $settingsObj->setVar('set_type', $setType); 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 +150,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_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); $form = $settingsObj->getFormSettings(); @@ -158,27 +161,36 @@ $settingsObj = $helper->getHandler('Settings')->get($setId); if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('settings.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \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'))); + $customConfirm = new \XoopsModules\Modulebuilder\Common\Confirm( + ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), $settingsObj->getVar('set_name') + ); + $form = $customConfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; case 'display': - $id = \Xmf\Request::getInt('set_id', 0, 'POST'); - if ($id > 0) { - $settingsObj = $helper->getHandler('Settings')->get($id); - if (isset($_POST['set_type'])) { - $setType = $settingsObj->getVar('set_type'); - $settingsObj->setVar('set_type', !$setType); + $setId = \Xmf\Request::getInt('set_id'); + if ($setId > 0) { + $settingsHandler = $helper->getHandler('Settings'); + $settingsObj = $settingsHandler->get($setId); + $setType = $settingsObj->getVar('set_type'); + // reset all + $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 0'; + $GLOBALS['xoopsDB']->queryF($strSQL); + $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_type = 1 WHERE ' . $GLOBALS['xoopsDB']->prefix('modulebuilder_settings') . '.set_id = ' . $setId; + if ($GLOBALS['xoopsDB']->queryF($strSQL)) { + \redirect_header('settings.php', 5, \sprintf(\_AM_MODULEBUILDER_MODULE_FORM_UPDATED_OK, \Xmf\Request::getString('set_name', '', 'POST'))); } $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); } break; } -include __DIR__ . '/footer.php'; +require __DIR__ . '/footer.php'; diff --git a/admin/tables.php b/admin/tables.php index 267f1211..b6805908 100644 --- a/admin/tables.php +++ b/admin/tables.php @@ -1,4 +1,4 @@ -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_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); @@ -55,18 +55,18 @@ $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_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_TDMCREATE_NOTTABLES); + \redirect_header('tables.php?op=new', 10, \_AM_MODULEBUILDER_THEREARENT_TABLES2); } unset($tablesCount); // Display modules list if ($modulesCount > 0) { - foreach (array_keys($modulesAll) as $i) { + foreach (\array_keys($modulesAll) as $i) { $module = $modulesAll[$i]->getValuesModules(); // Get the list of tables $tablesCount = $helper->getHandler('Tables')->getCountTables(); @@ -75,7 +75,7 @@ $tables = []; $lid = 1; if ($tablesCount > 0) { - foreach (array_keys($tablesAll) as $t) { + foreach (\array_keys($tablesAll) as $t) { $table = $tablesAll[$t]->getValuesTables(); $alid = ['lid' => $lid]; $tables[] = array_merge($table, $alid); @@ -89,29 +89,29 @@ unset($module); } if ($modulesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + 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_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(); if ($tableMid > 0) { $tablesObj->setVar('table_mid', $tableMid); } - $form = $tablesObj->getFormTables(); + $form = $tablesObj->getFormTables(); $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'save': if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('tables.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } $tables = $helper->getHandler('Tables'); if (isset($tableId)) { @@ -123,9 +123,9 @@ $tableNameSearch = $tables->getObjects($criteria); unset($criteria); //unset($criteria); - foreach (array_keys($tableNameSearch) as $t) { + 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_TABLE_ERROR_NAME_EXIST, \Xmf\Request::getString('table_name', '', 'POST'))); } } $tablesObj = $tables->create(); @@ -145,8 +145,8 @@ ] ); //Form table_image - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploaddir = is_dir(XOOPS_ICONS32_PATH) ? XOOPS_ICONS32_PATH : TDMC_UPLOAD_IMGTAB_PATH; + require_once \XOOPS_ROOT_PATH . '/class/uploader.php'; + $uploaddir = \is_dir(\XOOPS_ICONS32_PATH) ? \XOOPS_ICONS32_PATH : TDMC_UPLOAD_IMGTAB_PATH; $uploader = new \XoopsMediaUploader( $uploaddir, $helper->getConfig('mimetypes_image'), $helper->getConfig('maxsize_image'), null, null ); @@ -154,7 +154,7 @@ $uploader->fetchMedia(\Xmf\Request::getString('xoops_upload_file', '', 'POST')[0]); if (!$uploader->upload()) { $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, $errors); + \redirect_header('javascript:history.go(-1)', 3, $errors); } else { $tablesObj->setVar('table_image', $uploader->getSavedFileName()); } @@ -163,26 +163,27 @@ } $tablesObj->setVar('table_autoincrement', (1 == $_REQUEST['table_autoincrement']) ? 1 : 0); // Options - $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)); - $tablesObj->setVar('table_admin', in_array('admin', $tableOption)); - $tablesObj->setVar('table_user', in_array('user', $tableOption)); - $tablesObj->setVar('table_submenu', in_array('submenu', $tableOption)); - $tablesObj->setVar('table_submit', in_array('submit', $tableOption)); - $tablesObj->setVar('table_tag', in_array('tag', $tableOption)); - $tablesObj->setVar('table_broken', in_array('broken', $tableOption)); - $tablesObj->setVar('table_search', in_array('search', $tableOption)); - $tablesObj->setVar('table_comments', in_array('comments', $tableOption)); - $tablesObj->setVar('table_notifications', in_array('notifications', $tableOption)); - $tablesObj->setVar('table_permissions', in_array('permissions', $tableOption)); - $tablesObj->setVar('table_rate', in_array('rate', $tableOption)); - $tablesObj->setVar('table_print', in_array('print', $tableOption)); - $tablesObj->setVar('table_pdf', in_array('pdf', $tableOption)); - $tablesObj->setVar('table_rss', in_array('rss', $tableOption)); - $tablesObj->setVar('table_single', in_array('single', $tableOption)); - $tablesObj->setVar('table_visit', in_array('visit', $tableOption)); + $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)); + $tablesObj->setVar('table_admin', \in_array('admin', $tableOption)); + $tablesObj->setVar('table_user', \in_array('user', $tableOption)); + $tablesObj->setVar('table_submenu', \in_array('submenu', $tableOption)); + $tablesObj->setVar('table_submit', \in_array('submit', $tableOption)); + $tablesObj->setVar('table_tag', \in_array('tag', $tableOption)); + $tablesObj->setVar('table_broken', \in_array('broken', $tableOption)); + $tablesObj->setVar('table_search', \in_array('search', $tableOption)); + $tablesObj->setVar('table_comments', \in_array('comments', $tableOption)); + $tablesObj->setVar('table_notifications', \in_array('notifications', $tableOption)); + $tablesObj->setVar('table_permissions', \in_array('permissions', $tableOption)); + $tablesObj->setVar('table_rate', \in_array('rate', $tableOption)); + $tablesObj->setVar('table_print', \in_array('print', $tableOption)); + $tablesObj->setVar('table_pdf', \in_array('pdf', $tableOption)); + $tablesObj->setVar('table_rss', \in_array('rss', $tableOption)); + $tablesObj->setVar('table_reads', \in_array('reads', $tableOption)); + $tablesObj->setVar('table_single', \in_array('single', $tableOption)); + $tablesObj->setVar('table_visit', \in_array('visit', $tableOption)); if ($tables->insert($tablesObj)) { if ($tablesObj->isNew()) { @@ -192,15 +193,32 @@ $fieldelementObj = $helper->getHandler('Fieldelements')->create(); $fieldelementObj->setVar('fieldelement_mid', $tableMid); $fieldelementObj->setVar('fieldelement_tid', $tableTid); - $fieldelementObj->setVar('fieldelement_name', 'Table : ' . ucfirst(\Xmf\Request::getString('table_name', '', 'POST'))); - $fieldelementObj->setVar('fieldelement_value', 'XoopsFormTables-' . ucfirst(\Xmf\Request::getString('table_name', '', 'POST'))); + $fieldelementObj->setVar('fieldelement_name', 'Table : ' . \ucfirst(\Xmf\Request::getString('table_name', '', 'POST'))); + $fieldelementObj->setVar('fieldelement_value', 'XoopsFormTables-' . \ucfirst(\Xmf\Request::getString('table_name', '', 'POST'))); + $fieldelementObj->setVar('fieldelement_deftype', 2); + $fieldelementObj->setVar('fieldelement_defvalue', 10); // Insert new field element id for table name 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'))); + // 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'))); } } @@ -210,8 +228,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_TABLES_ADD, 'tables.php?op=new'); + $adminObject->addItemButton(\_AM_MODULEBUILDER_TABLES_LIST, 'tables.php?op=list', 'list'); $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); $tablesObj = $helper->getHandler('Tables')->get($tableId); @@ -219,47 +237,68 @@ $GLOBALS['xoopsTpl']->assign('form', $form->render()); break; case 'order': + $error = false; // 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($tableOrder)) { + $tablesObj = $tablesHandler->get((int)$order); + if ($tablesObj instanceof \XoopsObject) { + $tablesObj->setVar('table_order', $i); + if (!$tablesHandler->insert($tablesObj)) { + $error = true; + } + } else { $error = true; + continue; } ++$i; } } - redirect_header('tables.php', 5, _AM_TDMCREATE_TABLE_ORDER_ERROR); + if ($error) { + \redirect_header('tables.php', 5, \_AM_MODULEBUILDER_TABLE_ORDER_ERROR); + } unset($i); } exit; - break; case 'delete': $tablesObj = $helper->getHandler('Tables')->get($tableId); if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('tables.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } + $fieldelements = $helper->getHandler('Fieldelements')->getAllFieldelementsByTableId($tableId); if ($helper->getHandler('Tables')->delete($tablesObj)) { - // Delete items in table fieldelements - idea by goffy - $fieldelements = $helper->getHandler('Fieldelements')->getAllFieldElementsByModuleAndTableId($tableMid, $tableId); - foreach (array_keys($fieldelements) as $fe) { + // Delete items in table fieldelements + $fieldelements = $helper->getHandler('Fieldelements')->getAllFieldelementsByTableId($tableId); + foreach (\array_keys($fieldelements) as $fe) { $fieldElementsObj = $helper->getHandler('Fieldelements')->get($fieldelements[$fe]->getVar('fieldelement_id')); if (!$helper->getHandler('Fieldelements')->delete($fieldElementsObj)) { $GLOBALS['xoopsTpl']->assign('error', $fieldElementsObj->getHtmlErrors()); } unset($fieldElementsObj); } - redirect_header('tables.php', 3, _AM_TDMCREATE_FORMDELOK); + // Delete items in table fields + $fields = $helper->getHandler('Fields')->getAllFieldsByTableId($tableId); + foreach (\array_keys($fields) as $fd) { + $fieldsObj = $helper->getHandler('Fields')->get($fields[$fd]->getVar('field_id')); + if (!$helper->getHandler('Fields')->delete($fieldsObj)) { + $GLOBALS['xoopsTpl']->assign('error', $fieldsObj->getHtmlErrors()); + } + unset($fieldElementsObj); + } + \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'))); + $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 = $customConfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); } break; case 'display': @@ -274,7 +313,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,10 +328,10 @@ } } 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()); } break; } -include __DIR__ . '/footer.php'; +require __DIR__ . '/footer.php'; diff --git a/assets/css/admin/index.html b/assets/css/admin/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/assets/css/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/css/admin/index.php b/assets/css/admin/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/css/admin/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/css/index.php b/assets/css/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/css/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/fonts/index.php b/assets/fonts/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/fonts/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/16/index.php b/assets/images/icons/16/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/images/icons/16/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/24/index.php b/assets/images/icons/24/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/images/icons/24/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/32/index.php b/assets/images/icons/32/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/images/icons/32/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/index.php b/assets/images/icons/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/images/icons/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/index.php b/assets/images/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/images/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/logos/index.php b/assets/images/logos/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/images/logos/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/index.php b/assets/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/js/index.php b/assets/js/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/assets/js/index.php @@ -0,0 +1,2 @@ + - - * - */ -//include __DIR__.'/autoload.php'; - -/** - * Class MoreFiles. - */ -class AddFiles extends \XoopsObject -{ - /** - * Tdmcreate. - * - * @var mixed - */ - private $helper; - - /** - * Settings. - * - * @var mixed - */ - private $settings; - - /** - * @public function constructor class - * @param null - */ - public function __construct() - { - $this->helper = Tdmcreate\Helper::getInstance(); - - $this->initVar('file_id', XOBJ_DTYPE_INT); - $this->initVar('file_mid', XOBJ_DTYPE_INT); - $this->initVar('file_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('file_extension', XOBJ_DTYPE_TXTBOX); - $this->initVar('file_infolder', XOBJ_DTYPE_TXTBOX); - } - - /** - * @param string $method - * @param array $args - * - * @return mixed - */ - public function __call($method, $args) - { - $arg = isset($args[0]) ? $args[0] : null; - - return $this->getVar($method, $arg); - } - - /** - * @static function getInstance - * @param null - * @return AddFiles - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /** - * @public function getFormMoreFiles - * @param mixed $action - * - * @return \XoopsThemeForm - */ - public function getFormAddFiles($action = false) - { - if (false === $action) { - $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); - } - - $isNew = $this->isNew(); - $title = $isNew ? sprintf(_AM_TDMCREATE_ADDFILES_NEW) : sprintf(_AM_TDMCREATE_ADDFILES_EDIT); - - xoops_load('XoopsFormLoader'); - - $form = new \XoopsThemeForm($title, 'addfilesform', $action, 'post', true); - $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); - 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); - $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); - $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); - $form->addElement($fileInfolder, true); - - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButton(_REQUIRED . ' *', 'submit', _SUBMIT, 'submit')); - - return $form; - } - - /** - * Get AddFiles Values. - * @param null $keys - * @param null $format - * @param null $maxDepth - * @return array - */ - public function getAddFilesValues($keys = null, $format = null, $maxDepth = null) - { - $ret = $this->getValues($keys, $format, $maxDepth); - // Values - $ret['id'] = $this->getVar('file_id'); - $ret['mid'] = $this->helper->getHandler('modules')->get($this->getVar('file_mid'))->getVar('mod_name'); - $ret['name'] = $this->getVar('file_name'); - $ret['extension'] = $this->getVar('file_extension'); - $ret['infolder'] = $this->getVar('file_infolder'); - - return $ret; - } -} diff --git a/class/AddFilesHandler.php b/class/AddFilesHandler.php deleted file mode 100644 index 0b7495d7..00000000 --- a/class/AddFilesHandler.php +++ /dev/null @@ -1,163 +0,0 @@ - - - * - */ -//include __DIR__.'/autoload.php'; - -/** - * Class MoreFilesHandler. - */ -class AddFilesHandler extends \XoopsPersistableObjectHandler -{ - /** - * @public function constructor class - * @param null|\XoopsDatabase|\XoopsMySQLDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'tdmcreate_addfiles', AddFiles::class, 'file_id', 'file_name'); - } - - /** - * @param bool $isNew - * - * @return \XoopsObject - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field. - * - * @param int $i field id - * @param null $fields - * - * @return mixed reference to the Fields object - * object - */ - public function &get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id. - * - * @param null - * - * @return int reference to the {@link Tables} object - */ - public function &getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * insert a new field in the database. - * - * @param \XoopsObject $field reference to the {@link Fields} object - * @param bool $force - * - * @return bool FALSE if failed, TRUE if already present and unchanged or successful - */ - public function insert(\XoopsObject $field, $force = false) - { - if (!parent::insert($field, $force)) { - return false; - } - - return true; - } - - /** - * Get Count AddFiles. - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountAddFiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') - { - $criteriaAddFilesCount = new \CriteriaCompo(); - $criteriaAddFilesCount = $this->getAddFilesCriteria($criteriaAddFilesCount, $start, $limit, $sort, $order); - - return $this->getCount($criteriaAddFilesCount); - } - - /** - * Get All AddFiles. - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllAddFiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') - { - $criteriaAddFilesAdd = new \CriteriaCompo(); - $criteriaAddFilesAdd = $this->getAddFilesCriteria($criteriaAddFilesAdd, $start, $limit, $sort, $order); - - return $this->getAll($criteriaAddFilesAdd); - } - - /** - * Get All AddFiles By Module Id. - * @param $modId - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllAddFilesByModuleId($modId, $start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') - { - $criteriaAddFilesByModuleId = new \CriteriaCompo(); - $criteriaAddFilesByModuleId->add(new \Criteria('file_mid', $modId)); - $criteriaAddFilesByModuleId = $this->getAddFilesCriteria($criteriaAddFilesByModuleId, $start, $limit, $sort, $order); - - return $this->getAll($criteriaAddFilesByModuleId); - } - - /** - * Get AddFiles Criteria. - * @param $criteriaAddFiles - * @param $start - * @param $limit - * @param $sort - * @param $order - * @return mixed - */ - private function getAddFilesCriteria($criteriaAddFiles, $start, $limit, $sort, $order) - { - $criteriaAddFiles->setStart($start); - $criteriaAddFiles->setLimit($limit); - $criteriaAddFiles->setSort($sort); - $criteriaAddFiles->setOrder($order); - - return $criteriaAddFiles; - } -} diff --git a/class/Building.php b/class/Building.php index 6e01007c..5bd7f965 100644 --- a/class/Building.php +++ b/class/Building.php @@ -1,8 +1,8 @@ -setExtra('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); + $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) { $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_BUILDING_INROOT_COPY, 'inroot_copy', $helper->getConfig('inroot_copy'))); + $form->addElement(new \XoopsFormRadioYN(\_AM_MODULEBUILDER_BUILDING_TEST . \_AM_MODULEBUILDER_BUILDING_TEST_DESC, 'testdata_restore', 0)); + $form->addElement(new \XoopsFormHidden('op', 'build')); - $form->addElement(new \XoopsFormButton(_REQUIRED . ' *', 'submit', _SUBMIT, 'submit')); + $btnTray = new \XoopsFormElementTray(\_REQUIRED . ' *', ' '); + $btnTray->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit')); + $btnTray->addElement(new \XoopsFormButton('', 'check_data', \_AM_MODULEBUILDER_BUILDING_CHECK, 'submit')); + $form->addElement($btnTray); return $form; } @@ -82,23 +83,35 @@ public function getForm($action = false) * @param string $dir * @param string $pattern */ - public function clearDir($dir, $pattern = '*') + public function clearDir(string $dir, string $pattern = '*'): void { // Find all files and folders matching pattern $files = glob($dir . "/$pattern"); // Interate thorugh the files and folders foreach ($files as $file) { // if it's a directory then re-call clearDir function to delete files inside this directory - if (is_dir($file) && !in_array($file, ['..', '.'])) { + if (\is_dir($file) && !\in_array($file, ['..', '.'])) { // Remove the directory itself $this->clearDir($file, $pattern); } elseif ((__FILE__ != $file) && is_file($file)) { // Make sure you don't delete the current script - unlink($file); + \unlink($file); } } - if (is_dir($dir)) { - rmdir($dir); + $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); } } @@ -106,23 +119,23 @@ public function clearDir($dir, $pattern = '*') * @param string $src * @param string $dst */ - public function copyDir($src, $dst) + public function copyDir(string $src, string $dst): void { - $dir = opendir($src); - if (!mkdir($dst) && !is_dir($dst)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dst)); + $dir = \opendir($src); + if (!\mkdir($dst) && !\is_dir($dst)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dst)); } - while (false !== ($file = readdir($dir))) { + while (false !== ($file = \readdir($dir))) { if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { + if (\is_dir($src . '/' . $file)) { // Copy the directory itself $this->copyDir($src . '/' . $file, $dst . '/' . $file); } else { // Make sure you copy the current script - copy($src . '/' . $file, $dst . '/' . $file); + \copy($src . '/' . $file, $dst . '/' . $file); } } } - closedir($dir); + \closedir($dir); } } diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 29b08f7a..c4cb3d3c 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,22 +28,22 @@ * 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'); +\defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); /** * Class Breadcrumb */ class Breadcrumb { - public $dirname; - private $bread = []; + public string $dirname; + private array $bread = []; public function __construct() { - $this->dirname = basename(dirname(dirname(__DIR__))); + $this->dirname = \basename(\dirname(__DIR__, 2)); } /** @@ -52,7 +52,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = '') + public function addLink(string $title = '', string $link = ''): void { $this->bread[] = [ 'link' => $link, @@ -65,7 +65,7 @@ public function addLink($title = '', $link = '') */ public function render() { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) { require $GLOBALS['xoops']->path('class/theme.php'); $GLOBALS['xoTheme'] = new \xos_opal_Theme(); } diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 2f06d4b5..5435ccd9 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,6 +1,6 @@ -name = $config->name; $this->paths = $config->paths; diff --git a/class/Common/Confirm.php b/class/Common/Confirm.php new file mode 100644 index 00000000..b3d4a38c --- /dev/null +++ b/class/Common/Confirm.php @@ -0,0 +1,109 @@ + - Website: + * + * + * Example: + $customConfirm = new Common\Confirm( + ['ok' => 1, 'item_id' => $itemId, 'op' => 'delete'], + $_SERVER['REQUEST_URI'], + \sprintf(\_MA_MYMODULE_FORM_SURE_DELETE, + $itemsObj->getCaption())); + $form = $customConfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + */ + +\defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +/** + * Class Object Confirm + */ +class Confirm +{ + private array $hiddens = []; + private string $action = ''; + private string $title = ''; + private string $label = ''; + private string $object = ''; + + /** + * @public function constructor class + * @param array $hiddens + * @param string $action + * @param string $object + * @param string $title + * @param string $label + */ + public function __construct(array $hiddens, string $action, string $object, string $title = '', string $label = '') + { + $this->hiddens = $hiddens; + $this->action = $action; + $this->object = $object; + $this->title = $title; + $this->label = $label; + } + + /** + * @public function getFormConfirm + * @return \XoopsThemeForm + */ + public function getFormConfirm(): \XoopsThemeForm + { + $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')) { + \define('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM', 'Confirm delete'); + \define('CO_' . $moduleDirNameUpper . '_DELETE_LABEL', 'Do you really want to delete:'); + } + + // Get Theme Form + if ('' === $this->action) { + $this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); + } + if ('' === $this->title) { + $this->title = \constant('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM'); + } + if ('' === $this->label) { + $this->label = \constant('CO_' . $moduleDirNameUpper . '_DELETE_LABEL'); + } + + \xoops_load('XoopsFormLoader'); + $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 + foreach ($this->hiddens as $key => $value) { + $form->addElement(new \XoopsFormHidden($key, $value)); + } + $form->addElement(new \XoopsFormHidden('ok', 1)); + $buttonTray = new \XoopsFormElementTray(''); + $buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', \_YES, 'submit')); + $buttonBack = new \XoopsFormButton('', 'confirm_back', \_NO, 'button'); + $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 new file mode 100644 index 00000000..d8b7baae --- /dev/null +++ b/class/Common/DirectoryChecker.php @@ -0,0 +1,160 @@ +"; + $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE') . ') '; + $path_status .= "
"; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
'; + } elseif (@\is_writable($path)) { + $path_status = ""; + $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE') . ') '; + $currentMode = \mb_substr(\decoct(\fileperms($path)), 2); + if ($currentMode != \decoct($mode)) { + $path_status = ""; + $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode); + $path_status .= "
"; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
'; + } + } else { + $currentMode = \mb_substr(\decoct(\fileperms($path)), 2); + $path_status = ""; + $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode); + $path_status .= "
"; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
'; + } + + return $path_status; + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + 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)) + ); + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function setDirectoryPermissions($target, int $mode = 0777) + { + $target = \str_replace('..', '', $target); + + return @\chmod($target, (int)$mode); + } + + /** + * @param $dir_path + * + * @return bool + */ + public static function dirExists($dir_path) + { + return \is_dir($dir_path); + } +} + +$op = Request::getString('op', '', 'POST'); +switch ($op) { + case 'createdir': + 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') || !\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/class/Common/FileChecker.php b/class/Common/FileChecker.php new file mode 100644 index 00000000..8d0872d6 --- /dev/null +++ b/class/Common/FileChecker.php @@ -0,0 +1,159 @@ +"; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') '; + } else { + $path_status = ""; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') '; + } + } else { + if (self::compareFiles($file_path, $original_file_path)) { + $path_status = ""; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') '; + } else { + $path_status = ""; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') '; + $path_status .= "
"; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
'; + } + } + + return $path_status; + } + + /** + * @param $source_path + * @param $destination_path + * + * @return bool + */ + public static function copyFile($source_path, $destination_path) + { + $source_path = \str_replace('..', '', $source_path); + $destination_path = \str_replace('..', '', $destination_path); + + return @\copy($source_path, $destination_path); + } + + /** + * @param $file1_path + * @param $file2_path + * + * @return bool + */ + public static function compareFiles($file1_path, $file2_path) + { + if (!self::fileExists($file1_path) || !self::fileExists($file2_path)) { + return false; + } + if (\filetype($file1_path) !== \filetype($file2_path)) { + return false; + } + if (\filesize($file1_path) !== \filesize($file2_path)) { + return false; + } + $crc1 = \mb_strtoupper(\dechex(\crc32(\file_get_contents($file1_path)))); + $crc2 = \mb_strtoupper(\dechex(\crc32(\file_get_contents($file2_path)))); + + return !($crc1 !== $crc2); + } + + /** + * @param $file_path + * + * @return bool + */ + public static function fileExists($file_path) + { + return \is_file($file_path); + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function setFilePermissions($target, int $mode = 0777) + { + $target = \str_replace('..', '', $target); + + return @\chmod($target, (int)$mode); + } +} + +$op = Request::getString('op', '', 'POST'); +if ($op == 'copyfile') { + 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/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 549ef697..e9ca0196 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -1,6 +1,6 @@ - */ trait FilesManagement { /** - * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * Function responsible for checking if a directory exists, we can also write in and create an index.php file * * @param string $folder The full path of the directory to check * * @return void * @throws \RuntimeException */ - public static function createFolder($folder) + public static function createFolder($folder): void { try { - if (!file_exists($folder)) { - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); + if (!\file_exists($folder)) { + if (!\is_dir($folder) && !\mkdir($folder) && !\is_dir($folder)) { + throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); } - file_put_contents($folder . '/index.html', ''); + \file_put_contents($folder . '/index.php', "getMessage(), '
'; @@ -43,36 +43,36 @@ 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); + return \copy($file, $folder); } /** * @param $src * @param $dst */ - public static function recurseCopy($src, $dst) + public static function recurseCopy($src, $dst): void { - $dir = opendir($src); - // @mkdir($dst); - if (!@mkdir($dst) && !is_dir($dst)) { + $dir = \opendir($src); + // @\mkdir($dst); + if (!@\mkdir($dst) && !\is_dir($dst)) { throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); } - while (false !== ($file = readdir($dir))) { + while (false !== ($file = \readdir($dir))) { if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { + if (\is_dir($src . '/' . $file)) { self::recurseCopy($src . '/' . $file, $dst . '/' . $file); } else { - copy($src . '/' . $file, $dst . '/' . $file); + \copy($src . '/' . $file, $dst . '/' . $file); } } } - closedir($dir); + \closedir($dir); } /** @@ -82,30 +82,30 @@ 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) { // Check for symlinks - if (is_link($source)) { - return symlink(readlink($source), $dest); + if (\is_link($source)) { + return \symlink(\readlink($source), $dest); } // Simple copy for a file - if (is_file($source)) { - return copy($source, $dest); + if (\is_file($source)) { + return \copy($source, $dest); } // Make destination directory - if (!is_dir($dest)) { - if (!mkdir($dest) && !is_dir($dest)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dest)); + if (!\is_dir($dest)) { + if (!\mkdir($dest) && !\is_dir($dest)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dest)); } } // Loop through the folder - $dir = dir($source); - if (@is_dir($dir)) { + $dir = \dir($source); + if (@\is_dir($dir)) { while (false !== $entry = $dir->read()) { // Skip pointers if ('.' === $entry || '..' === $entry) { @@ -143,7 +143,7 @@ public static function deleteDirectory($src) $dirInfo = new \SplFileInfo($src); // validate is a directory if ($dirInfo->isDir()) { - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); + $fileList = \array_diff(\scandir($src, \SCANDIR_SORT_NONE), ['..', '.']); foreach ($fileList as $k => $v) { $fileInfo = new \SplFileInfo("{$src}/{$v}"); if ($fileInfo->isDir()) { @@ -153,14 +153,14 @@ public static function deleteDirectory($src) } } else { // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { + if (!($success = \unlink($fileInfo->getRealPath()))) { break; } } } // now delete this (sub)directory if all the files are gone if ($success) { - $success = rmdir($dirInfo->getRealPath()); + $success = \rmdir($dirInfo->getRealPath()); } } else { // input is not a valid directory @@ -187,7 +187,7 @@ public static function rrmdir($src) } // If source is not a directory stop processing - if (!is_dir($src)) { + if (!\is_dir($src)) { return false; } @@ -199,7 +199,7 @@ public static function rrmdir($src) if ($fObj->isFile()) { $filename = $fObj->getPathname(); $fObj = null; // clear this iterator object to close the file - if (!unlink($filename)) { + if (!\unlink($filename)) { return false; // couldn't delete the file } } elseif (!$fObj->isDot() && $fObj->isDir()) { @@ -208,7 +208,8 @@ public static function rrmdir($src) } } $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results + + return \rmdir($src); // remove the directory & return results } /** @@ -227,12 +228,12 @@ public static function rmove($src, $dest) } // If source is not a directory stop processing - if (!is_dir($src)) { + if (!\is_dir($src)) { return false; } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { + if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) { return false; } @@ -240,15 +241,16 @@ public static function rmove($src, $dest) $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } elseif (!$fObj->isDot() && $fObj->isDir()) { // Try recursively on directory self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - // rmdir($fObj->getPath()); // now delete the directory + // \rmdir($fObj->getPath()); // now delete the directory } } $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results + + return \rmdir($src); // remove the directory & return results } /** @@ -270,12 +272,12 @@ public static function rcopy($src, $dest) } // If source is not a directory stop processing - if (!is_dir($src)) { + if (!\is_dir($src)) { return false; } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { + if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) { return false; } @@ -283,7 +285,7 @@ public static function rcopy($src, $dest) $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } elseif (!$fObj->isDot() && $fObj->isDir()) { self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 9d0f495a..c570a58b 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -1,6 +1,6 @@ - * @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.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ - class Migrate extends \Xmf\Database\Migrate { private $renameTables; /** - * Migrate constructor. - * @param Common\Configurator $configurator - * @throws \RuntimeException - * @throws \InvalidArgumentException + * @param \XoopsModules\Modulebuilder\Common\Configurator|null $configurator */ public function __construct(Common\Configurator $configurator = null) { if (null !== $configurator) { $this->renameTables = $configurator->renameTables; - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = \basename(\dirname(__DIR__, 2)); parent::__construct($moduleDirName); } } @@ -47,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)) { @@ -62,12 +58,12 @@ private function changePrefix() * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName) + protected function convertIPAddresses(string $tableName, string $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); - if (false !== mb_strpos($attributes, ' int(')) { - if (false === mb_strpos($attributes, 'unsigned')) { + if (false !== \mb_strpos($attributes, ' int(')) { + if (false === \mb_strpos($attributes, 'unsigned')) { $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); } @@ -80,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'; @@ -104,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 be7ffeac..b756fa70 100644 --- a/class/Common/ModuleFeedback.php +++ b/class/Common/ModuleFeedback.php @@ -1,6 +1,6 @@ - + * @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) */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); +\defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class Object ModuleFeedback @@ -36,8 +36,6 @@ class ModuleFeedback extends \XoopsObject /** * Constructor - * - * @param null */ public function __construct() { @@ -45,10 +43,8 @@ public function __construct() /** * @static function &getInstance - * - * @param null */ - public static function getInstance() + public static function getInstance(): void { static $instance = false; if (!$instance) { @@ -59,41 +55,39 @@ public static function getInstance() /** * @public function getFormFeedback: * provide form for sending a feedback to module author - * @param bool $action * @return \XoopsThemeForm */ - public function getFormFeedback($action = false) + public function getFormFeedback() { - if (false === $action) { - $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); - } - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true); + \xoops_load('XoopsFormLoader'); + $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); - $your_name->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); + $your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); + $your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); $form->addElement($your_name); - $your_site = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); - $your_site->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); + $your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); + $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); $form->addElement($your_site); - $your_mail = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); - $your_mail->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); + $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); + $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); $form->addElement($your_mail); - $fbtypeSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); - $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')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); + $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); + $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')); + $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); + $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); $form->addElement($fbtypeSelect, true); $editorConfigs = []; @@ -103,16 +97,16 @@ public function getFormFeedback($action = false) $editorConfigs['cols'] = 40; $editorConfigs['width'] = '100%'; $editorConfigs['height'] = '400px'; - $moduleHandler = xoops_getHandler('module'); + $moduleHandler = \xoops_getHandler('module'); $module = $moduleHandler->getByDirname('system'); - $configHandler = xoops_getHandler('config'); + $configHandler = \xoops_getHandler('config'); $config = &$configHandler->getConfigsByCat(0, $module->getVar('mid')); $editorConfigs['editor'] = $config['general_editor']; - $editor = new \XoopsFormEditor(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs); + $editor = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs); $form->addElement($editor, true); $form->addElement(new \XoopsFormHidden('op', 'send')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); + $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); return $form; } diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index 4e9ccda1..674b69c0 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -1,6 +1,6 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck */ trait ModuleStats { /** - * @param \XoopsModules\Tdmcreate\Common\Configurator $configurator - * @param array $moduleStats + * @param \XoopsModules\Modulebuilder\Common\Configurator $configurator + * @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) { + if (\count($configurator->moduleStats) > 0) { + foreach (\array_keys($configurator->moduleStats) as $i) { $moduleStats[$i] = $configurator->moduleStats[$i]; } } diff --git a/class/Common/Resizer.php b/class/Common/Resizer.php index 3462d6a8..035193c5 100644 --- a/class/Common/Resizer.php +++ b/class/Common/Resizer.php @@ -1,6 +1,6 @@ - - Website: + * @author Goffy - Wedega - Email: - Website: + * @version $Id: 1.0 Resizer.php 1 Mon 2019-02-09 10:04:49Z XOOPS Project (www.xoops.org) $ */ class Resizer { - public $sourceFile = ''; - public $endFile = ''; - public $maxWidth = 0; - public $maxHeight = 0; - public $imageMimetype = ''; - public $jpgQuality = 90; - public $mergeType = 0; - public $mergePos = 0; + 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 @@ -42,75 +44,85 @@ public function resizeImage() // check file extension switch ($this->imageMimetype) { case 'image/png': - $img = imagecreatefrompng($this->sourceFile); + $img = \imagecreatefrompng($this->sourceFile); + if (!$img) { + return false; + } break; case 'image/jpeg': - $img = imagecreatefromjpeg($this->sourceFile); + $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); + $img = \imagecreatefromgif($this->sourceFile); + if (!$img) { + return false; + } break; default: return 'Unsupported format'; } - $width = imagesx($img); - $height = imagesy($img); - $new_width = 0; - $new_height = 0; + $width = \imagesx($img); + $height = \imagesy($img); if ($width > $this->maxWidth || $height > $this->maxHeight) { // recalc image size based on this->maxWidth/this->maxHeight + $new_width = 0; + $new_height = 0; if ($width > $height) { if ($width < $this->maxWidth) { $new_width = $width; } else { $new_width = $this->maxWidth; $divisor = $width / $new_width; - $new_height = floor($height / $divisor); + $new_height = \floor($height / $divisor); } } elseif ($height < $this->maxHeight) { $new_height = $height; } else { $new_height = $this->maxHeight; $divisor = $height / $new_height; - $new_width = floor($width / $divisor); + $new_width = \floor($width / $divisor); } // Create a new temporary image. - $tmpimg = imagecreatetruecolor($new_width, $new_height); - imagealphablending($tmpimg, false); - imagesavealpha($tmpimg, true); + $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); + \unlink($this->endFile); //compressing the file switch ($this->imageMimetype) { case 'image/png': - imagepng($tmpimg, $this->endFile, 0); + \imagepng($tmpimg, $this->endFile, 0); break; case 'image/jpeg': - imagejpeg($tmpimg, $this->endFile, 100); + \imagejpeg($tmpimg, $this->endFile, 100); break; case 'image/gif': - imagegif($tmpimg, $this->endFile); + \imagegif($tmpimg, $this->endFile); break; } // release the memory - imagedestroy($tmpimg); + \imagedestroy($tmpimg); } else { return 'copy'; } - imagedestroy($img); + \imagedestroy($img); return true; } - // public function resizeAndCrop($this->sourceFile, $this->imageMimetype, $this->endFile, $this->maxWidth, $this->maxHeight, $this->jpgQuality=90) - /** * @return bool|string */ @@ -119,13 +131,13 @@ public function resizeAndCrop() // check file extension switch ($this->imageMimetype) { case 'image/png': - $original = imagecreatefrompng($this->sourceFile); + $original = \imagecreatefrompng($this->sourceFile); break; case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); + $original = \imagecreatefromjpeg($this->sourceFile); break; case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); + $original = \imagecreatefromgif($this->sourceFile); break; default: return 'Unsupported format'; @@ -135,107 +147,186 @@ public function resizeAndCrop() return false; } // GET ORIGINAL IMAGE DIMENSIONS - list($original_w, $original_h) = getimagesize($this->sourceFile); + [$original_w, $original_h] = \getimagesize($this->sourceFile); // RESIZE IMAGE AND PRESERVE PROPORTIONS $max_width_resize = $this->maxWidth; $max_height_resize = $this->maxHeight; if ($original_w > $original_h) { $max_height_ratio = $this->maxHeight / $original_h; - $max_width_resize = (int)round($original_w * $max_height_ratio); + $max_width_resize = (int)\round($original_w * $max_height_ratio); } else { $max_width_ratio = $this->maxWidth / $original_w; - $max_height_resize = (int)round($original_h * $max_width_ratio); + $max_height_resize = (int)\round($original_h * $max_width_ratio); } if ($max_width_resize < $this->maxWidth) { $max_height_ratio = $this->maxWidth / $max_width_resize; - $max_height_resize = (int)round($this->maxHeight * $max_height_ratio); + $max_height_resize = (int)\round($this->maxHeight * $max_height_ratio); $max_width_resize = $this->maxWidth; } // CREATE THE PROPORTIONAL IMAGE RESOURCE - $thumb = imagecreatetruecolor($max_width_resize, $max_height_resize); - if (!imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { + $thumb = \imagecreatetruecolor($max_width_resize, $max_height_resize); + if (!\imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { return false; } // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS - $final = imagecreatetruecolor($this->maxWidth, $this->maxHeight); + $final = \imagecreatetruecolor($this->maxWidth, $this->maxHeight); $max_width_offset = 0; $max_height_offset = 0; if ($this->maxWidth < $max_width_resize) { - $max_width_offset = (int)round(($max_width_resize - $this->maxWidth) / 2); + $max_width_offset = (int)\round(($max_width_resize - $this->maxWidth) / 2); } else { - $max_height_offset = (int)round(($max_height_resize - $this->maxHeight) / 2); + $max_height_offset = (int)\round(($max_height_resize - $this->maxHeight) / 2); } - if (!imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { + if (!\imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { return false; } // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile - if (!imagejpeg($final, $this->endFile, $this->jpgQuality)) { + if (!\imagejpeg($final, $this->endFile, $this->jpgQuality)) { return false; } return true; } - // public function mergeImage($this->sourceFile, $this->endFile, $this->mergePos, $this->mergeType) - public function mergeImage() + 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; + 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); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 2 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); + $imgWidth = (int)\round($this->maxWidth / 2 - 1); + $imgHeight = (int)\round($this->maxHeight / 2 - 1); + $posCol2 = (int)\round($this->maxWidth / 2 + 1); + $posRow2 = (int)\round($this->maxHeight / 2 + 1); switch ($this->mergePos) { case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left + \imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left break; case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right + \imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right break; case 3: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left + \imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left break; case 4: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right + \imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right break; } } if (6 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 3 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 3 + 1); - $posCol3 = $posCol2 + (int)round($this->maxWidth / 3 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); + $imgWidth = (int)\round($this->maxWidth / 3 - 1); + $imgHeight = (int)\round($this->maxHeight / 2 - 1); + $posCol2 = (int)\round($this->maxWidth / 3 + 1); + $posCol3 = $posCol2 + (int)\round($this->maxWidth / 3 + 1); + $posRow2 = (int)\round($this->maxHeight / 2 + 1); switch ($this->mergePos) { case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left + \imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left break; case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center + \imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center break; case 3: - imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right + \imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right break; case 4: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left + \imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left break; case 5: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center + \imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center break; case 6: - imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right + \imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right 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); + } + + /** + * @return bool|string + */ + public function rotateImage() + { + // check file extension + switch ($this->imageMimetype) { + case 'image/png': + $original = \imagecreatefrompng($this->sourceFile); + break; + case 'image/jpeg': + $original = \imagecreatefromjpeg($this->sourceFile); + break; + case 'image/gif': + $original = \imagecreatefromgif($this->sourceFile); + break; + default: + return 'Unsupported format'; + } + + if (!$original) { + return false; + } + // Rotate + $tmpimg = \imagerotate($original, $this->degrees, 0); - imagedestroy($src); - imagedestroy($dest); + \unlink($this->endFile); + //compressing the file + switch ($this->imageMimetype) { + case 'image/png': + if (!\imagepng($tmpimg, $this->endFile, 0)) { + return false; + } + break; + case 'image/jpeg': + if (!\imagejpeg($tmpimg, $this->endFile, $this->jpgQuality)) { + return false; + } + break; + case 'image/gif': + if (!\imagegif($tmpimg, $this->endFile)) { + return false; + } + break; + } + + // release the memory + \imagedestroy($tmpimg); + + return true; } } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index d574d2d9..7227cb9b 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -1,6 +1,6 @@ - */ trait ServerStats @@ -26,9 +26,9 @@ trait ServerStats */ public static function getServerStats() { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - xoops_loadLanguage('common', $moduleDirName); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + \xoops_loadLanguage('common', $moduleDirName); $html = ''; // $sql = 'SELECT metavalue'; // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); @@ -36,40 +36,40 @@ public static function getServerStats() // $query = $GLOBALS['xoopsDB']->query($sql); // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); $html .= '
'; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; + $html .= "" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; $html .= "
"; - // $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
"; + // $html .= '
' . \constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
"; // $html .= "
"; // $html .= "
"; - $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
'; + $html .= '
' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
'; $html .= '
    '; - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { + $gdlib = \function_exists('gd_info') ? '' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + if (\function_exists('gd_info')) { if (true === ($gdlib = gd_info())) { - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); - // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; + // $safemode = \ini_get('safe_mode') ? \constant('CO_' . $moduleDirNameUpper . '_ON') . \constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : \constant('CO_' . $moduleDirNameUpper . '_OFF'); + // $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; - // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; + // $registerglobals = (!\ini_get('register_globals')) ? "" . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . \constant('CO_' . $moduleDirNameUpper . '_ON') . ''; + // $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; + $downloads = \ini_get('file_uploads') ? '' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . \ini_get('upload_max_filesize') . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . \ini_get('post_max_size') . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . \ini_get('memory_limit') . ''; $html .= '
'; $html .= '
    '; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; + $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . \XOOPS_ROOT_PATH . ''; $html .= '
'; $html .= '
'; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; + $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; $html .= '
'; $html .= '

'; diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php new file mode 100644 index 00000000..48840524 --- /dev/null +++ b/class/Common/SysUtility.php @@ -0,0 +1,215 @@ + + * @author Mamba + */ + +use XoopsModules\Modulebuilder\Helper; + +/** + * Class Utility + */ +class SysUtility +{ + use VersionChecks; + + //checkVerXoops, checkVerPhp Traits + + use ServerStats; + + // getServerStats Trait + + use FilesManagement; + + // Files Management Trait + + /** + * Access the only instance of this class + * + * @return object + */ + public static function getInstance() + { + static $instance; + if (null === $instance) { + $instance = new static(); + } + + return $instance; + } + + /** + * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags + * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags + * www.cakephp.org + * + * @param string $text String to truncate. + * @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 + * + * @return string Trimmed string. + */ + 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 + 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); + $open_tags = []; + $truncate = ''; + foreach ($lines as $line_matchings) { + // if there is any html-tag in this line, handle it and add it (uncounted) to the output + if (!empty($line_matchings[1])) { + // if it's an "empty element" with or without xhtml-conform closing slash + if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + // do nothing + // if tag is a closing tag + } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { + // delete tag from $open_tags list + $pos = \array_search($tag_matchings[1], $open_tags, true); + if (false !== $pos) { + unset($open_tags[$pos]); + } + // if tag is an opening tag + } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { + // add tag to the beginning of $open_tags list + \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); + } + // add html-tag to $truncate'd text + $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])); + 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)) { + // 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]); + } else { + // no more characters left + break; + } + } + } + $truncate .= \mb_substr($line_matchings[2], 0, $left + $entities_length); + // maximum lenght is reached, so get off the loop + break; + } + $truncate .= $line_matchings[2]; + $total_length += $content_length; + + // if the maximum length is reached, get off the loop + if ($total_length >= $length) { + break; + } + } + } else { + if (\mb_strlen($text) <= $length) { + return $text; + } + $truncate = \mb_substr($text, 0, $length - mb_strlen($ending)); + } + // if the words shouldn't be cut in the middle... + if (!$exact) { + // ...search the last occurance of a space... + $spacepos = \mb_strrpos($truncate, ' '); + if (isset($spacepos)) { + // ...and cut the text in this position + $truncate = \mb_substr($truncate, 0, $spacepos); + } + } + // add the defined ending to the text + $truncate .= $ending; + if ($considerHtml) { + // close all unclosed html-tags + foreach ($open_tags as $tag) { + $truncate .= ''; + } + } + + return $truncate; + } + + /** + * @param \Xmf\Module\Helper|null $helper + * @param array|null $options + * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor + */ + public static function getEditor(\Xmf\Module\Helper $helper = null, array $options = null) + { + /** @var Helper $helper */ + if (null === $options) { + $options = []; + $options['name'] = 'Editor'; + $options['value'] = 'Editor'; + $options['rows'] = 10; + $options['cols'] = '100%'; + $options['width'] = '100%'; + $options['height'] = '400px'; + } + + if (null === $helper) { + $helper = Helper::getInstance(); + } + + $isAdmin = $helper->isUserAdmin(); + + if (\class_exists('XoopsFormEditor')) { + if ($isAdmin) { + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); + } else { + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); + } + } else { + $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); + } + + // $form->addElement($descEditor); + + return $descEditor; + } + + /** + * @param $fieldname + * @param $table + * + * @return bool + */ + public function fieldExists($fieldname, $table) + { + global $xoopsDB; + $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + + return ($xoopsDB->getRowsNum($result) > 0); + } +} diff --git a/class/Common/TableChecker.php b/class/Common/TableChecker.php new file mode 100644 index 00000000..70c85b25 --- /dev/null +++ b/class/Common/TableChecker.php @@ -0,0 +1,242 @@ + + * @copyright 2021 XOOPS Project (https://xoops.org) + * @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_UPDATE_REPORT = 2; //update and report + + /** + * @param mixed $mydirname + * @param mixed $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; + $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 ($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; + } + + return []; + } + + 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 === \mb_stripos(\trim($line), $needle2)) { + $tabledefs[$countTable][$needle2] = $line; + } elseif (0 === \mb_stripos(\trim($line), $needle3)) { + $tabledefs[$countTable][$needle3] = $line; + } elseif (0 === \mb_stripos(\trim($line), $needle4)) { + $tabledefs[$countTable][$needle4] = $line; + } else { + if (\mb_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 = ')'; + return \substr($key_text, 0, \strpos($key_text, $needle)); + } + + 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($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 ($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($field): void + { + //to be created + $this->result[] = 'Field exist:' . $field['name'] . ' - no changes'; + + } +} diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php new file mode 100644 index 00000000..3c7791df --- /dev/null +++ b/class/Common/TestdataButtons.php @@ -0,0 +1,83 @@ + + * @copyright {@link https://xoops.org/ XOOPS Project} + * @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 */ + +/** + * Class SysUtility + */ +class TestdataButtons +{ + /** 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): void + { + $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 (self::SHOW_BUTTONS == $displaySampleButton) { + \xoops_loadLanguage('admin/modulesadmin', 'system'); + $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'); + // $displaySampleButton = $config['displaySampleButton']; + } + } + + public static function hideButtons(): void + { + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $app = []; + $app['displaySampleButton'] = 0; + Yaml::save($app, $yamlFile); + \redirect_header('index.php', 0); + } + + public static function showButtons(): void + { + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $app = []; + $app['displaySampleButton'] = 1; + Yaml::save($app, $yamlFile); + \redirect_header('index.php', 0); + } +} diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 25c18881..a18c6f28 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -1,6 +1,6 @@ - */ trait VersionChecks @@ -29,24 +29,24 @@ trait VersionChecks */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); + \xoops_loadLanguage('admin', $moduleDirName); + \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 } $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)); + $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } return $success; @@ -61,21 +61,21 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = */ public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } - xoops_loadLanguage('admin', $moduleDirName); + \xoops_loadLanguage('admin', $moduleDirName); // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; + $verNum = \PHP_VERSION; $reqVer = &$module->getInfo('min_php'); if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); + if (\version_compare($verNum, $reqVer, '<')) { + $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); $success = false; } } @@ -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,52 +92,52 @@ 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(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $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())) { - 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 (\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"]); + $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); + \trigger_error(\curl_error($curlHandle)); } elseif (mb_strpos($curlReturn, 'Not Found')) { - trigger_error('Repository Not Found: ' . $infoReleasesUrl); + \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); + $file = \json_decode($curlReturn, false); + $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) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; + $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; } //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); + $latestVersion = \mb_strtolower($latestVersion); if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); + $latestVersion = \str_replace('_', '', \mb_strtolower($latestVersion)); + $latestVersion = \str_replace('final', '', \mb_strtolower($latestVersion)); } $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); + $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); // $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { + if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { $ret = []; $ret[] = $update; $ret[] = $latestVersionLink; } } - curl_close($curlHandle); + \curl_close($curlHandle); } } diff --git a/class/Common/index.html b/class/Common/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/Common/index.php b/class/Common/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Common/index.php @@ -0,0 +1,2 @@ + - Website: + */ + +/** + * Interface Constants + */ +interface Constants +{ + // Constants for morefiles + public const MORE_FILES_TYPE_EMPTY = 1; + public const MORE_FILES_TYPE_COPY = 2; + + // ------------------- 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_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/Devtools.php b/class/Devtools.php new file mode 100644 index 00000000..54b246cb --- /dev/null +++ b/class/Devtools.php @@ -0,0 +1,619 @@ + + * @since + */ + +use XoopsModules\Modulebuilder; + +/** + * Class Devtools + */ +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 + { + $patKeys = []; + $patValues = []; + + $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 $tid => $tablename) { + $crFields = new \CriteriaCompo(); + $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'); + $rpFieldName = ''; + if (\mb_strpos($fieldName, '_')) { + $str = \mb_strpos($fieldName, '_'); + if (false !== $str) { + $rpFieldName = \mb_substr($fieldName, $str + 1, \mb_strlen($fieldName)); + } + } + // for getVar, setVar, forms, .... + $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"; + //clone feature + $patKeys[] = "'" . $fieldName . "_source'"; + $patValues[] = "'" . $rpFieldName . "_source'"; + // for tpl files + 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='; + } + //<{$article.art_id|default:false}> + $patKeys[] = '<{$' . $tablename . '.' . $fieldName . '|default:false}>'; + $patValues[] = '<{$' . $tablename . '.' . $rpFieldName . '|default:false}>'; + // for sql file + $patKeys[] = '`' . $fieldName . '`'; + $patValues[] = '`' . $rpFieldName . '`'; + } + } + + $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 $moduleDirName + */ + public static function function_qualifier($src_path, $dst_path, $moduleDirName): void + { + $functions = []; + $constants = []; + + //php functions + $functions[] = [ + 'array_diff', + 'array_filter', + 'array_key_exists', + 'array_keys', + 'array_search', + 'array_slice', + 'array_unshift', + 'array_shift', + 'array_values', + 'array_flip', + 'assert', + 'basename', + 'boolval', + 'call_user_func', + 'call_user_func_array', + 'chr', + 'class_exists', + 'closedir', + 'constant', + 'copy', + 'count', + 'curl_close', + 'curl_error', + 'curl_exec', + 'curl_file_create', + 'curl_getinfo', + 'curl_init', + 'curl_setopt', + 'define', + 'defined', + 'dirname', + 'doubleval', + 'explode', + 'extension_loaded', + 'file_exists', + 'file_get_contents', + 'file_put_contents', + 'filemtime', + 'finfo_open', + 'floatval', + 'floor', + 'formatTimestamp', + 'func_get_args', + 'func_num_args', + 'function_exists', + 'get_called_class', + 'get_class', + 'getimagesize', + 'gettype', + 'http_build_query', + 'imagealphablending', + 'imagecopyresampled', + 'imagecreatefromgif', + 'imagecreatefromjpeg', + 'imagecreatefrompng', + 'imagecreatefromstring', + 'imagecreatetruecolor', + 'imagesavealpha', + 'imagedestroy', + 'imagegif', + 'imagejpeg', + 'imagepng', + 'imagerotate', + 'imagesx', + 'imagesy', + 'implode', + 'in_array', + 'ini_get', + 'intval', + 'include', + 'is_array', + 'is_bool', + 'is_callable', + 'is_dir', + 'is_double', + 'is_file', + 'is_float', + 'is_int', + 'is_integer', + 'is_link', + 'is_long', + 'is_null', + 'is_object', + 'is_real', + 'is_resource', + 'is_string', + 'json_decode', + 'json_encode', + 'libxml_get_errors', + 'libxml_clear_errors', + 'mime_content_type', + 'mkdir', + 'mktime', + 'opendir', + 'ord', + 'pathinfo', + 'preg_match', + 'preg_match_all', + 'preg_replace', + 'readdir', + 'readlink', + 'redirect_header', + 'rename', + 'require', + 'rmdir', + 'round', + 'scandir', + 'sprintf', + 'mb_strtoupper', + 'mb_strtolower', + 'mb_strpos', + 'mb_strlen', + 'mb_strrpos', + 'setcookie', + 'simplexml_load_string', + 'str_repeat', + 'str_replace', + 'stream_context_create', + 'strip_tags', + 'strlen', + 'strpos', + 'strtotime', + 'strval', + 'substr', + 'symlink', + 'time', + 'trigger_error', + 'trim', + 'ucfirst', + 'unlink', + 'version_compare', + ]; + + // xoops functions + $functions[] = [ + 'xoops_getHandler', + 'xoops_load', + 'xoops_loadLanguage', + ]; + // xoops const + $constants[] = [ + 'XOBJ_DTYPE_', + 'XOOPS_URL', + 'XOOPS_ROOT_PATH', + 'XOOPS_GROUP_', + ]; + + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + // module language defines + $constants[] = [ + '_AM_' . $moduleDirNameUpper .'_', + '_MI_' . $moduleDirNameUpper .'_', + '_MB_' . $moduleDirNameUpper .'_', + '_MA_' . $moduleDirNameUpper .'_', + $moduleDirNameUpper .'_', + ]; + + // xoops objects + $xobjects[] = [ + 'XoopsThemeForm', + 'XoopsSimpleForm', + 'XoopsTableForm', + 'XoopsFormText', //XoopsFormTextArea, XoopsFormTextDateSelect + 'XoopsFormHidden', + 'XoopsFormButton', //XoopsFormButtonTray + 'XoopsFormEditor', + 'XoopsFormCheckBox', + 'XoopsFormRadio', //XoopsFormRadioYN + 'XoopsFormSelect', //XoopsFormSelectUser + 'XoopsFormColorPicker', + 'XoopsFormElementTray', + 'XoopsFormLabel', + 'XoopsFormFile', + 'XoopsFormPassword', + 'XoopsFormDateTime', + 'XoopsTpl', + 'XoopsPageNav', + 'XoopsUser', + 'XoopsLists', + 'XoopsDatabase', + 'XoopsMediaUploader', + 'XoopsModule', + 'XoopsPreloadItem', + ]; + + // misc corrections + $misc = [ + 'new Criteria(' => 'new \Criteria(', + 'new CriteriaCompo(' => 'new \CriteriaCompo(', + "\define('\\" => "\define('", + ]; + + // 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(', + 'filem\time' => 'filemtime', + "_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_", + "prefix = '\XoopsModules\\" => "prefix = 'XoopsModules\\", + '\XoopsModules25x' => 'XoopsModules25x', + '@link \XoopsModule' => '@link XoopsModule', + ]; + + $patterns = []; + foreach ($functions as $function) { + //reset existing in order to avoid double \\ + foreach ($function as $item) { + $patterns['\\' . $item . '('] = $item . '('; + } + //apply now for all + foreach ($function as $item) { + $patterns[$item . '('] = '\\' . $item . '('; + } + } + foreach ($constants as $constant) { + //reset existing in order to avoid double \\ + foreach ($constant as $item) { + $patterns['\\' . $item ] = $item; + } + //apply now for all + foreach ($constant as $item) { + $patterns[$item] = '\\' . $item; + } + } + foreach ($xobjects as $xobject) { + //reset existing in order to avoid double \\ + foreach ($xobject as $item) { + $patterns['\\' . $item ] = $item; + } + //apply now for all + foreach ($xobject as $item) { + $patterns[$item] = '\\' . $item; + } + } + + //add misc + foreach ($misc as $key => $value) { + $patterns[$key] = $value; + } + //add errors + foreach ($errors as $key => $value) { + $patterns[$key] = $value; + } + + $patKeys = \array_keys($patterns); + $patValues = \array_values($patterns); + 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): void + { + $patKeys = []; + $patValues = []; + self::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues, true); + } + + // recursive cloning script + + /** + * @param $src_path + * @param $dst_path + * @param array $patKeys + * @param array $patValues + * @param bool $replaceTabs + * @param string[] $extensions + */ + 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); + // 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) ) { + // Recursively calling custom copy function for sub directory + self::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs, $extensions); + } else { + self::cloneFile($src_path . '/' . $file, $dst_path . '/' . $file, $patKeys, $patValues, $replaceTabs, $extensions); + } + } + } + \closedir($dir); + } + + /** + * @param $src_file + * @param $dst_file + * @param array $patKeys + * @param array $patValues + * @param bool $replaceTabs + * @param $extensions + */ + 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)) { + $replace_code = true; + } + if (\mb_strpos($dst_file, \basename(__FILE__)) > 0) { + //skip myself + $replace_code = false; + } + if ($replace_code) { + // file, read it and replace text + $content = \file_get_contents($src_file); + if ($replaceTabs) { + $content = \preg_replace("/[\t]+/", ' ', $content); + } else { + $content = \str_replace($patKeys, $patValues, $content); + } + //check file name whether it contains replace code + $path_parts = \pathinfo($dst_file); + $path = $path_parts['dirname']; + $file = $path_parts['basename']; + $dst_file = $path . '/' . \str_replace($patKeys, $patValues, $file); + \file_put_contents($dst_file, $content); + } else { + \copy($src_file, $dst_file); + } + } + + /** + * get form with all existing modules + * @param string|false $action + * @return \XoopsSimpleForm + */ + public static function getFormModulesFq(string|false $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_FQ_MODULE, 'fq_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', 'fq')); + $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); + + return $form; + } + + /** + * get form with all existing modules + * @param string|false $action + * @return \XoopsSimpleForm + */ + public static function getFormModulesCl(string|false $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_CL_MODULE, 'cl_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', 'check_lang')); + $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); + + return $form; + } + + /** + * get form with all existing modules + * @param string|false $action + * @return \XoopsSimpleForm + */ + public static function getFormModulesTab(string|false $action = false) + { + if (!$action) { + $action = $_SERVER['REQUEST_URI']; + } + // Get Theme Form + \xoops_load('XoopsFormLoader'); + $form = new \XoopsSimpleForm('', 'form', $action, 'post', true); + $form->setExtra('enctype="multipart/form-data"'); + // Form Select Module + $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_DEVTOOLS_TAB_MODULE, 'tab_module', ''); + $modulesArr = \XoopsLists::getModulesList(); + $modulesSelect->addOption('', ' '); + foreach ($modulesArr as $mod) { + $modulesSelect->addOption($mod, $mod); + } + $form->addElement($modulesSelect, true); + // To Save + $form->addElement(new \XoopsFormHidden('op', 'tab_replacer')); + $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); + + return $form; + } + + /** + * get form with all existing modules + * @param string $dst_path + * @param string|false $action + * @return \XoopsSimpleForm + */ + public static function getFormModulesRemovePrefix(string $dst_path, string|false $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); + $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)); + + return $form; + } +} diff --git a/class/Fieldattributes.php b/class/Fieldattributes.php index 1bc23d22..0b292d5c 100644 --- a/class/Fieldattributes.php +++ b/class/Fieldattributes.php @@ -1,8 +1,8 @@ - - - * + * @author Txmod Xoops - */ /** @@ -37,7 +36,6 @@ class Fieldattributes extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -48,7 +46,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldattributes */ public static function getInstance() diff --git a/class/FieldattributesHandler.php b/class/FieldattributesHandler.php index 2ceb8662..88290684 100644 --- a/class/FieldattributesHandler.php +++ b/class/FieldattributesHandler.php @@ -1,8 +1,8 @@ - - - * + * @author Txmod Xoops - */ /** @@ -35,6 +34,6 @@ class FieldattributesHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_fieldattributes', Fieldattributes::class, 'fieldattribute_id', 'fieldattribute_name'); + parent::__construct($db, 'modulebuilder_fieldattributes', Fieldattributes::class, 'fieldattribute_id', 'fieldattribute_name'); } } diff --git a/class/FieldElements.php b/class/Fieldelements.php similarity index 76% rename from class/FieldElements.php rename to class/Fieldelements.php index 4afca4b8..4dec54eb 100644 --- a/class/FieldElements.php +++ b/class/Fieldelements.php @@ -1,8 +1,8 @@ - - * */ /** - * Class FieldElements. + * Class Fieldelements. */ -class FieldElements extends \XoopsObject +class Fieldelements extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -43,26 +41,27 @@ public function __construct() $this->initVar('fieldelement_value', XOBJ_DTYPE_TXTBOX); $this->initVar('fieldelement_sort', XOBJ_DTYPE_INT); $this->initVar('fieldelement_deftype', XOBJ_DTYPE_TXTBOX); - $this->initVar('fieldelement_defvalue', XOBJ_DTYPE_INT); + $this->initVar('fieldelement_defvalue', XOBJ_DTYPE_TXTBOX); + $this->initVar('fieldelement_deffield', XOBJ_DTYPE_TXTBOX); } /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } /** * @static function getInstance - * @param null - * @return FieldElements + * + * @return Fieldelements */ public static function getInstance() { @@ -81,7 +80,7 @@ public static function getInstance() * @param null $maxDepth * @return array */ - public function getValuesFieldElements($keys = null, $format = null, $maxDepth = null) + public function getValuesFieldelements($keys = null, $format = null, $maxDepth = null) { $ret = $this->getValues($keys, $format, $maxDepth); // Values @@ -93,6 +92,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/FieldElementsHandler.php b/class/FieldelementsHandler.php similarity index 55% rename from class/FieldElementsHandler.php rename to class/FieldelementsHandler.php index 48c64f73..503491ef 100644 --- a/class/FieldElementsHandler.php +++ b/class/FieldelementsHandler.php @@ -1,8 +1,8 @@ - - * */ /** - * Class FieldElementsHandler. + * Class FieldelementsHandler. */ -class FieldElementsHandler extends \XoopsPersistableObjectHandler +class FieldelementsHandler extends \XoopsPersistableObjectHandler { /** * @public function constructor class @@ -36,79 +35,77 @@ class FieldElementsHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_fieldelements', FieldElements::class, 'fieldelement_id', 'fieldelement_name'); + parent::__construct($db, 'modulebuilder_fieldelements', Fieldelements::class, 'fieldelement_id', 'fieldelement_name'); } /** * 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); + $crCountFieldElems = $this->getFieldelementsCriteria($crCountFieldElems, $start, $limit, $sort, $order); return parent::getCount($crCountFieldElems); } /** * 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); + $crObjectsFieldElems = $this->getFieldelementsCriteria($crObjectsFieldElems, $start, $limit, $sort, $order); return $this->getObjects($crObjectsFieldElems); } /** * 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); + $crAllFieldElems = $this->getFieldelementsCriteria($crAllFieldElems, $start, $limit, $sort, $order); return $this->getAll($crAllFieldElems); } /** * Get All Fields By Module & Table Id. - * @param $modId * @param $tabId - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getAllFieldElementsByModuleAndTableId($modId, $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_mid', $modId)); $crAllFieldElemsByModule->add(new \Criteria('fieldelement_tid', $tabId)); - $crAllFieldElemsByModule = $this->getFieldElementsCriteria($crAllFieldElemsByModule, $start, $limit, $sort, $order); + $crAllFieldElemsByModule = $this->getFieldelementsCriteria($crAllFieldElemsByModule, $start, $limit, $sort, $order); return $this->getAll($crAllFieldElemsByModule); } /** - * Get FieldElements Criteria. + * Get Fieldelements Criteria. * @param $crFieldElemsCriteria * @param $start * @param $limit @@ -116,7 +113,7 @@ public function getAllFieldElementsByModuleAndTableId($modId, $tabId, $start = 0 * @param $order * @return mixed */ - private function getFieldElementsCriteria($crFieldElemsCriteria, $start, $limit, $sort, $order) + private function getFieldelementsCriteria($crFieldElemsCriteria, $start, $limit, $sort, $order) { $crFieldElemsCriteria->setStart($start); $crFieldElemsCriteria->setLimit($limit); @@ -127,27 +124,28 @@ private function getFieldElementsCriteria($crFieldElemsCriteria, $start, $limit, } /** - * Get FieldElements Criteria. + * 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); + $crFieldElems = $this->getFieldelementsCriteria($crFieldElemsCriteria, $start, $limit, $sort, $order); $fieldeleArr = $this->getAll($crFieldElems); $fieldele = []; - foreach (array_keys($fieldeleArr) as $i) { - $stuFeName = mb_strtoupper($fieldeleArr[$i]->getVar('fieldelement_name')); + foreach (\array_keys($fieldeleArr) as $i) { + $stuFeName = \mb_strtoupper($fieldeleArr[$i]->getVar('fieldelement_name')); if (1 == $i) { $fieldele[$i] = '...'; } else { - $fieldele[$i] = constant ('_AM_TDMCREATE_FIELD_ELE_' . $stuFeName); + $fieldele[$i] = constant('\_AM_MODULEBUILDER_FIELD_ELE_' . $stuFeName); } } + return $fieldele; } } diff --git a/class/Fieldkey.php b/class/Fieldkey.php index a801043d..b9556d7f 100644 --- a/class/Fieldkey.php +++ b/class/Fieldkey.php @@ -1,8 +1,8 @@ - - * */ /** @@ -32,7 +31,6 @@ class Fieldkey extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -43,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldkey */ public static function getInstance() diff --git a/class/FieldkeyHandler.php b/class/FieldkeyHandler.php index 2c798ec9..72e7c22f 100644 --- a/class/FieldkeyHandler.php +++ b/class/FieldkeyHandler.php @@ -1,8 +1,8 @@ - - * */ /** @@ -35,6 +34,6 @@ class FieldkeyHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_fieldkey', Fieldkey::class, 'fieldkey_id', 'fieldkey_name'); + parent::__construct($db, 'modulebuilder_fieldkey', Fieldkey::class, 'fieldkey_id', 'fieldkey_name'); } } diff --git a/class/Fieldnull.php b/class/Fieldnull.php index ea555166..6bb16940 100644 --- a/class/Fieldnull.php +++ b/class/Fieldnull.php @@ -1,8 +1,8 @@ - - * */ /** @@ -32,7 +31,6 @@ class Fieldnull extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -43,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldnull */ public static function getInstance() diff --git a/class/FieldnullHandler.php b/class/FieldnullHandler.php index 4e6dc798..727d2492 100644 --- a/class/FieldnullHandler.php +++ b/class/FieldnullHandler.php @@ -1,8 +1,8 @@ - - * */ /** @@ -35,6 +34,6 @@ class FieldnullHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_fieldnull', Fieldnull::class, 'fieldnull_id', 'fieldnull_name'); + parent::__construct($db, 'modulebuilder_fieldnull', Fieldnull::class, 'fieldnull_id', 'fieldnull_name'); } } diff --git a/class/Fields.php b/class/Fields.php index ee54ada2..c857279c 100644 --- a/class/Fields.php +++ b/class/Fields.php @@ -1,8 +1,8 @@ - - - * + * @author Txmod Xoops - */ -//include __DIR__.'/autoload.php'; /** * Class Fields. @@ -34,8 +32,6 @@ class Fields extends \XoopsObject { /** * @public function constructor class - * - * @param null */ public function __construct() { @@ -56,6 +52,9 @@ public function __construct() $this->initVar('field_inlist', XOBJ_DTYPE_INT); $this->initVar('field_inform', XOBJ_DTYPE_INT); $this->initVar('field_user', XOBJ_DTYPE_INT); + $this->initVar('field_ihead', XOBJ_DTYPE_INT); + $this->initVar('field_ibody', XOBJ_DTYPE_INT); + $this->initVar('field_ifoot', XOBJ_DTYPE_INT); $this->initVar('field_thead', XOBJ_DTYPE_INT); $this->initVar('field_tbody', XOBJ_DTYPE_INT); $this->initVar('field_tfoot', XOBJ_DTYPE_INT); @@ -67,13 +66,13 @@ 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 = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } @@ -97,39 +96,39 @@ public static function getInstance() * @private function getHeaderForm * * @param bool $action - * @param $prefix - * @return Tdmcreate\Form\ThemeForm + * @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_TDMCREATE_FIELDS_NEW) : sprintf(_AM_TDMCREATE_FIELDS_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_FIELDS_NEW : \_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; } @@ -144,15 +143,15 @@ 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 = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); // Get handler tables - $tableObj = $helper->getHandler('Tables'); + $tableObj = $helper->getHandler('Tables'); // Header function class - $fieldsForm = self::getInstance(); - $prefix = $tableObj->get($fieldTid)->getVar('table_fieldname'); - $form = $fieldsForm->getHeaderForm($prefix, $action); + $fieldsForm = self::getInstance(); + $prefix = $tableObj->get($fieldTid)->getVar('table_fieldname'); + $form = $fieldsForm->getHeaderForm($prefix, $action); $tableAutoincrement = $tableObj->get($fieldTid)->getVar('table_autoincrement'); // Loop for fields number $class = 'even'; @@ -177,137 +176,155 @@ 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 = 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'))); $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)); $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('')); + //$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 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->addOptionArray($helper->getHandler('Fieldelements')->getFieldElementsList($crElement)); + $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 . ")' "); + $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); + //$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 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_ihead = 0; + $checkFieldIhead = new \XoopsFormCheckBox(' ', 'field_ihead[' . $i . ']', $field_ihead); + $checkFieldIhead->addOption(1, \_AM_MODULEBUILDER_FIELD_IHEAD); + $parametersTray->addElement($checkFieldIhead); + + $field_ibody = 0; + $checkFieldIbody = new \XoopsFormCheckBox(' ', 'field_ibody[' . $i . ']', $field_ibody); + $checkFieldIbody->addOption(1, \_AM_MODULEBUILDER_FIELD_IBODY); + $parametersTray->addElement($checkFieldIbody); + + $field_ifoot = 0; + $checkFieldIfoot = new \XoopsFormCheckBox(' ', 'field_ifoot[' . $i . ']', $field_ifoot); + $checkFieldIfoot->addOption(1, \_AM_MODULEBUILDER_FIELD_IFOOT); + $parametersTray->addElement($checkFieldIfoot); + $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('')); } } @@ -319,9 +336,9 @@ 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 = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); $tablesHandler = $helper->getHandler('Tables'); $tables = $tablesHandler->get($fieldTid); $prefix = $tables->getVar('table_fieldname'); @@ -329,7 +346,7 @@ public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false) $fieldsForm = self::getInstance(); $form = $fieldsForm->getHeaderForm($prefix, $action); - $class = 'even'; + $class = 'even'; $tableAutoincrement = $tables->getVar('table_autoincrement'); $fieldNumb = $tables->getVar('table_nbfields'); $fName = $tables->getVar('table_fieldname'); @@ -345,6 +362,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) { @@ -357,108 +375,120 @@ 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->addOptionArray($helper->getHandler('Fieldelements')->getFieldElementsList($crElement)); + $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 . ")' "); + $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); + $checkFieldIhead = new \XoopsFormCheckBox(' ', 'field_ihead[' . $id . ']', $field->getVar('field_ihead')); + $checkFieldIhead->addOption(1, \_AM_MODULEBUILDER_FIELD_IHEAD); + $parametersTray->addElement($checkFieldIhead); + + $checkFieldIbody = new \XoopsFormCheckBox(' ', 'field_ibody[' . $id . ']', $field->getVar('field_ibody')); + $checkFieldIbody->addOption(1, \_AM_MODULEBUILDER_FIELD_IBODY); + $parametersTray->addElement($checkFieldIbody); + + $checkFieldIfoot = new \XoopsFormCheckBox(' ', 'field_ifoot[' . $id . ']', $field->getVar('field_ifoot')); + $checkFieldIfoot->addOption(1, \_AM_MODULEBUILDER_FIELD_IFOOT); + $parametersTray->addElement($checkFieldIfoot); + $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 +516,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() . '
')); + $formButton = new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit'); + $form->addElement(new Modulebuilder\Html\FormLabel('' . $formHidden->render() . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('' . $formButton->render() . '')); + $form->addElement(new Modulebuilder\Html\FormLabel('')); return $form; } @@ -511,7 +541,7 @@ public function getValuesFields($keys = null, $format = null, $maxDepth = null) $ret['mid'] = $this->getVar('field_mid'); $ret['tid'] = $this->getVar('field_tid'); $ret['order'] = $this->getVar('field_order'); - $ret['name'] = str_replace('_', ' ', ucfirst($this->getVar('field_name'))); + $ret['name'] = \str_replace('_', ' ', \ucfirst($this->getVar('field_name'))); $ret['parent'] = $this->getVar('field_parent'); $ret['inlist'] = $this->getVar('field_inlist'); $ret['inform'] = $this->getVar('field_inform'); diff --git a/class/FieldsHandler.php b/class/FieldsHandler.php index 38428df5..96074e00 100644 --- a/class/FieldsHandler.php +++ b/class/FieldsHandler.php @@ -1,6 +1,6 @@ - - - * + * @author Txmod Xoops - */ -//include __DIR__.'/autoload.php'; /** * Class FieldsHandler. @@ -37,7 +35,7 @@ class FieldsHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_fields', Fields::class, 'field_id', 'field_name'); + parent::__construct($db, 'modulebuilder_fields', Fields::class, 'field_id', 'field_name'); } /** @@ -53,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() @@ -78,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); @@ -94,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); @@ -110,18 +106,16 @@ public function getAllFields($start = 0, $limit = 0, $sort = 'field_id ASC, fiel /** * Get All Fields By Module & Table Id. - * @param $modId * @param $tabId - * @param int $start - * @param int $limit + * @param int $start + * @param int $limit * @param string $sort * @param string $order * @return array */ - public function getAllFieldsByModuleAndTableId($modId, $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_mid', $modId)); $crAllFieldsByModule->add(new \Criteria('field_tid', $tabId)); $crAllFieldsByModule = $this->getFieldsCriteria($crAllFieldsByModule, $start, $limit, $sort, $order); diff --git a/class/Fieldtype.php b/class/Fieldtype.php index 6a625091..1b3d32dc 100644 --- a/class/Fieldtype.php +++ b/class/Fieldtype.php @@ -1,8 +1,8 @@ - - * */ /** @@ -32,7 +31,6 @@ class Fieldtype extends \XoopsObject { /** * @public function constructor class - * @param null */ public function __construct() { @@ -43,7 +41,7 @@ public function __construct() /** * @static function getInstance - * @param null + * * @return Fieldtype */ public static function getInstance() diff --git a/class/FieldtypeHandler.php b/class/FieldtypeHandler.php index 2eae7919..feab00c1 100644 --- a/class/FieldtypeHandler.php +++ b/class/FieldtypeHandler.php @@ -1,8 +1,8 @@ - - * */ /** @@ -35,6 +34,6 @@ class FieldtypeHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_fieldtype', Fieldtype::class, 'fieldtype_id', 'fieldtype_name'); + parent::__construct($db, 'modulebuilder_fieldtype', Fieldtype::class, 'fieldtype_id', 'fieldtype_name'); } } diff --git a/class/Files/Admin/AdminBroken.php b/class/Files/Admin/AdminBroken.php new file mode 100644 index 00000000..0f615b6b --- /dev/null +++ b/class/Files/Admin/AdminBroken.php @@ -0,0 +1,204 @@ +xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); + } + + /** + * @static function getInstance + + * + * @return AdminBroken + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $tables + * @param $filename + */ + public function write($module, $tables, $filename) + { + $this->setModule($module); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @private function getAdminBrokenHeader + * @param $moduleDirname + * @return string + */ + 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', ''); + $ret .= $this->xc->getXcXoThemeAddStylesheet(); + $ret .= $this->axc->getAdminTemplateMain($moduleDirname, $tableName); + $navigation = $this->axc->getAdminDisplayNavigation($tableName); + $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation); + + return $ret; + } + + /** + * @private function getAdminBrokenList + * @param $tables + * @param string $language + * @return string + */ + private function getAdminBrokenList($tables, string $language) + { + $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 .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Check table', $tableName, ''); + $ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', ''); + $adminpager = $this->xc->getXcGetConfig('adminpager'); + $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')); + $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 .= $this->xc->getXcCriteriaCompo($critName, ''); + $constant = $this->xc->getXcGetConstants('STATUS_BROKEN'); + $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, ''); + + $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"); + + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contIf, $contElse, ''); + $ret .= $this->pc->getPhpCodeUnset($critName, ''); + } + } + + $ret .= $this->pc->getPhpCodeBlankLine(); + + return $ret; + } + + /** + * @public function render + + * + * @return string + */ + public function render() + { + $tf = Modulebuilder\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); + $content .= $this->getAdminBrokenList($tables, $language); + $content .= $this->getRequire('footer'); + + $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..4d2a438a 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(); } /** * @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) + public function write($module, $table, array $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -89,12 +88,12 @@ public function write($module, $table, $tables, $filename) */ private function getAdminHeader($moduleDirname) { - $ucfModuleDirname = ucfirst($moduleDirname); - $stuModuleDirname = mb_strtoupper($moduleDirname); + $ucfModuleDirname = \ucfirst($moduleDirname); + $stuModuleDirname = \mb_strtoupper($moduleDirname); $table = $this->getTable(); $tables = $this->getTables(); - $ret = $this->pc->getPhpCodeIncludeDir('dirname(dirname(dirname(__DIR__)))', 'include/cp_header'); - $ret .= $this->pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'include/common', true); + $ret = $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__, 3)', 'include/cp_header'); + $ret .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__)', 'include/common', true); $ret .= $this->pc->getPhpCodeBlankLine(); $sysicons16 = $this->xc->getXcXoopsModuleGetInfo('', 'sysicons16', true); $sysicons32 = $this->xc->getXcXoopsModuleGetInfo('', 'sysicons32', true); @@ -104,34 +103,35 @@ private function getAdminHeader($moduleDirname) $ret .= $this->xc->getXcEqualsOperator('$sysPathIcon16 ', "'../' . {$sysicons16}"); $ret .= $this->xc->getXcEqualsOperator('$sysPathIcon32 ', "'../' . {$sysicons32}"); $ret .= $this->xc->getXcEqualsOperator('$pathModuleAdmin', $dirmoduleadmin); - $ret .= $this->xc->getXcEqualsOperator('$modPathIcon16 ', "{$stuModuleDirname}_URL . '/' . {$modicons16} . '/'"); - $ret .= $this->xc->getXcEqualsOperator('$modPathIcon32 ', "{$stuModuleDirname}_URL . '/' . {$modicons32} . '/'"); - if (is_object($table) && '' != $table->getVar('table_name')) { + $ret .= $this->xc->getXcEqualsOperator('$modPathIcon16 ', "\\{$stuModuleDirname}_URL . '/' . {$modicons16} . '/'"); + $ret .= $this->xc->getXcEqualsOperator('$modPathIcon32 ', "\\{$stuModuleDirname}_URL . '/' . {$modicons32} . '/'"); + 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) { + if (\is_array($tables)) { + foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); $ret .= $this->xc->getXcHandlerLine($tableName); } } $ret .= $this->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); $ret .= $this->pc->getPhpCodeCommentLine(); - $template = $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/template', true, false, 'include', "\t"); - $template .= $this->xc->getXcEqualsOperator('$xoopsTpl', 'new \XoopsTpl()', null,"\t"); - $ret .= $this->pc->getPhpCodeConditions('!isset($xoopsTpl)', ' || ', '!is_object($xoopsTpl)', $template, false); + $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); $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); $fileExists = $this->pc->getPhpCodeFileExists($xoopsPathCond); - $moduleadmin = $this->pc->getPhpCodeIncludeDir($xoopsPathCond, '', true, true, 'include', "\t"); - $redirectHeader = $this->xc->getXcRedirectHeader("'../../../admin.php'", '', '5', '_AM_MODULEADMIN_MISSING', false, "\t"); + $moduleadmin = $this->pc->getPhpCodeIncludeDir($xoopsPathCond, '', true, true, 'require', "\t"); + $redirectHeader = $this->xc->getXcRedirectHeader("'../../../admin.php'", '', '5', '\_AM_MODULEADMIN_MISSING', false, "\t"); $ret .= $this->pc->getPhpCodeConditions($fileExists, '', '', $moduleadmin, $redirectHeader); $ret .= $this->pc->getPhpCodeBlankLine(); $ret .= $this->xc->getXcXoopsCPHeader(); @@ -143,15 +143,16 @@ private function getAdminHeader($moduleDirname) $ret .= $this->xc->getXcXoopsTplAssign('modPathIcon32', '$modPathIcon32'); $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->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() { @@ -159,9 +160,10 @@ 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_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..f2d8eeab 100644 --- a/class/Files/Admin/AdminIndex.php +++ b/class/Files/Admin/AdminIndex.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); } /** * @static function getInstance - * @param null + * @return AdminIndex */ public static function getInstance() @@ -57,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); @@ -76,83 +91,84 @@ public function write($module, $tables, $filename) */ private function getAdminIndex($module) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); $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 .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); - $ret .= $pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'preloads/autoloader', true); - $ret .= $this->getInclude(); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Template Index'); - $ret .= $axc->getAdminTemplateMain((string)$moduleDirname, 'index'); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Count elements'); + $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; - foreach (array_keys($tables) as $i) { + foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); - $ucfTableName = ucfirst($tableName); - $ret .= $xc->getXcEqualsOperator("\$count{$ucfTableName}", "\${$tableName}Handler->getCount()"); + $ucfTableName = \ucfirst($tableName); + $ret .= $this->xc->getXcEqualsOperator("\$count{$ucfTableName}", "\${$tableName}Handler->getCount()"); } - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('InfoBox Statistics'); - $ret .= $axc->getAxcAddInfoBox($language . 'STATISTICS'); - $ret .= $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) { + foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); $tableInstall[] = $tables[$i]->getVar('table_install'); - $stuTableName = $languageThereAre . mb_strtoupper($tableName); - $ucfTableName = ucfirst($tableName); - $ret .= $axc->getAxcAddInfoBoxLine($stuTableName, "\$count{$ucfTableName}"); + $stuTableName = $languageThereAre . \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $ret .= $this->axc->getAxcAddInfoBoxLine($stuTableName, "\$count{$ucfTableName}"); } if (null === $tableName) { - $ret .= $axc->getAxcAddInfoBoxLine('No statistics', '0'); + $ret .= $this->axc->getAxcAddInfoBoxLine('No statistics', '0'); } - if (is_array($tables) && in_array(1, $tableInstall)) { - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Upload Folders'); - $ret .= $xc->getXcEqualsOperator('$configurator', 'new Common\Configurator()'); - $cond = '$configurator->uploadFolders && is_array($configurator->uploadFolders)'; - $fe_action = $xc->getXcEqualsOperator('$folder[]', '$configurator->uploadFolders[$i]', '',"\t\t"); - $condIf = $pc->getPhpCodeForeach('configurator->uploadFolders', true, false, 'i', $fe_action, "\t"); - $ret .= $pc->getPhpCodeConditions($cond, '', '', $condIf, false); - - $ret .= $pc->getPhpCodeCommentLine('Uploads Folders Created'); - $boxLine = $axc->getAxcAddConfigBoxLine('$folder[$i]', 'folder', '', "\t"); - $boxLine .= $axc->getAxcAddConfigBoxLine("array(\$folder[\$i], '777')", 'chmod', '', "\t"); - $ret .= $pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, '') . PHP_EOL; + 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); + + $ret .= $this->pc->getPhpCodeCommentLine('Uploads Folders Created'); + $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 .= $pc->getPhpCodeCommentLine('Render Index'); - $ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')"); - $ret .= $pc->getPhpCodeCommentLine('Test Data'); - $condIf = $xc->getXcXoopsLoadLanguage('admin/modulesadmin',"\t", 'system'); - $condIf .= $pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'testdata/index', true, '','',"\t"); - $condIf .= $axc->getAdminItemButton("constant('CO_' . \$moduleDirNameUpper . '_ADD_SAMPLEDATA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=load', $type = 'samplebutton', $t = "\t"); - $condIf .= $axc->getAdminItemButton("constant('CO_' . \$moduleDirNameUpper . '_SAVE_SAMPLEDATA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=save', $type = 'samplebutton', $t = "\t"); - $condIf .= "//" . $axc->getAdminItemButton("constant('CO_' . \$moduleDirNameUpper . '_EXPORT_SCHEMA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=exportschema', $type = 'samplebutton', $t = "\t"); - $condIf .= $axc->getAdminDisplayButton('left', "\t"); - $cond = $xc->getXcGetConfig('displaySampleButton'); - $ret .= $pc->getPhpCodeConditions($cond, '', '', $condIf, false); - $ret .= $xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()'); - $ret .= $pc->getPhpCodeCommentLine('End Test Data'); - - $ret .= $this->getInclude('footer'); + + $ret .= $this->pc->getPhpCodeCommentLine('Render Index'); + $ret .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')"); + $condIf = $this->xc->getXcXoopsLoadLanguage('admin/modulesadmin',"\t", 'system'); + $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); + $ret .= $this->xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()'); + + $ret .= $this->pc->getPhpCodeBlankLine(); + + $ret .= $this->getRequire('footer'); return $ret; } /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { @@ -162,7 +178,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 c2b27972..57ca4d9d 100644 --- a/class/Files/Admin/AdminMenu.php +++ b/class/Files/Admin/AdminMenu.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); } /** * @static function getInstance - * @param null + * @return AdminMenu */ public static function getInstance() @@ -57,10 +62,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -72,19 +77,18 @@ public function write($module, $filename) * @param bool $adminObject * @return string */ - private function getAdminMenuArray($param = [], $adminObject = false) + private function getAdminMenuArray(array $param = [], bool $adminObject = false) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $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 .= $xc->getXcEqualsOperator((string)$key, (string)$value); + $ret .= $this->xc->getXcEqualsOperator((string)$key, (string)$value); } } @@ -93,17 +97,17 @@ private function getAdminMenuArray($param = [], $adminObject = false) /** * @private function getAdminMenuHeader - * @param null + * @return string */ private function getAdminMenuHeader() { $ret = $this->getSimpleString(''); - $mod = [ - '$dirname ' => 'basename(dirname(__DIR__))', - '$moduleHandler' => "xoops_getHandler('module')", - '$xoopsModule ' => 'XoopsModule::getByDirname($dirname)', - '$moduleInfo ' => "\$moduleHandler->get(\$xoopsModule->getVar('mid'))", + $mod = [ + '$dirname ' => '\basename(\dirname(__DIR__))', + '$moduleHandler' => "\xoops_getHandler('module')", + '$xoopsModule ' => 'XoopsModule::getByDirname($dirname)', + '$moduleInfo ' => "\$moduleHandler->get(\$xoopsModule->getVar('mid'))", '$sysPathIcon32' => "\$moduleInfo->getInfo('sysicons32')", ]; $ret .= $this->getAdminMenuArray($mod); @@ -115,73 +119,54 @@ 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; - } - - /** - * @private function getAdminMenuImagesPath - * @param array $tables - * @param int $t - * - * @return string - */ - private function getAdminMenuImagesPath($tables, $t) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ret = ''; - $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 13: - $ret = $xc->getXcEqualsOperator("\$adminmenu[\$i]['icon']", "'assets/icons/32/{$tables[$t]->getVar('table_image')}'"); - break; - default: - $ret = $xc->getXcEqualsOperator("\$adminmenu[\$i]['icon']", "\$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}'"); - break; - } - } - - 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'); + $ret = ''; + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $tablePermissions = []; - foreach (array_keys($tables) as $t) { + $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, $tablePermissions)) { + 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'"]; $ret .= $this->getAdminMenuArray($param2, true); } ++$menu; + $param3 = ['title' => "{$language}{$menu}", 'link' => "'admin/clone.php'", 'icon' => "\$sysPathIcon32.'/page_copy.png'"]; + $ret .= $this->getAdminMenuArray($param3, true); + ++$menu; $param3 = ['title' => "{$language}{$menu}", 'link' => "'admin/feedback.php'", 'icon' => "\$sysPathIcon32.'/mail_foward.png'"]; $ret .= $this->getAdminMenuArray($param3, true); unset($menu); @@ -193,8 +178,8 @@ private function getAdminMenuList($module, $language, $langAbout, $menu) /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { @@ -209,7 +194,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..ac41eb0f 100644 --- a/class/Files/Admin/AdminPermissions.php +++ b/class/Files/Admin/AdminPermissions.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); + $this->cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); } /** * @static function getInstance * - * @param null + * * @return AdminPermissions */ @@ -61,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); @@ -85,41 +104,37 @@ public function write($module, $tables, $filename) */ private function getPermissionsHeader($module, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id')); $tableNames = []; - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { if (1 == $tables[$t]->getVar('table_permissions')) { $tableNames[] = $tables[$t]->getVar('table_name'); } } - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude('header'); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Template Index'); - $ret .= $axc->getAdminTemplateMain($moduleDirname, 'permissions'); - $ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('permissions.php')"); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $xc->getXcXoopsRequest('op', 'op', 'global'); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Get Form'); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); - $ret .= $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(); + $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}'"; } - $formSelect = $xc->getXoopsFormSelectExtraOptions('formSelect', '\'\'', 'op', $optionsSelect, 'onchange="document.fselperm.submit()"'); - $ret .= $cc->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; } @@ -133,8 +148,6 @@ private function getPermissionsHeader($module, $language) */ private function getPermissionsSwitch($module, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $moduleDirname = $module->getVar('mod_dirname'); $tables = $this->getTableTables($module->getVar('mod_id')); $t = "\t\t"; @@ -143,12 +156,12 @@ private function getPermissionsSwitch($module, $language) "{$t}\$formTitle = {$language}PERMISSIONS_GLOBAL;{$n}", "{$t}\$permName = '{$moduleDirname}_ac';{$n}", "{$t}\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;{$n}", - "{$t}\$globalPerms = array( '4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 );{$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) { + foreach (\array_keys($tables) as $i) { if (1 == $tables[$i]->getVar('table_permissions')) { $tableName = $tables[$i]->getVar('table_name'); - $ucfTablename = ucfirst($tableName); + $ucfTablename = \ucfirst($tableName); $cases["approve_{$tableName}"] = [ "{$t}\$formTitle = {$language}PERMISSIONS_APPROVE;{$n}", "{$t}\$permName = '{$moduleDirname}_approve_{$tableName}';{$n}", @@ -169,69 +182,58 @@ private function getPermissionsSwitch($module, $language) ]; } } - $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, true, false, "\t"); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true,"\t"); - return $pc->getPhpCodeSwitch('op', $contentSwitch); + return $this->pc->getPhpCodeSwitch('op', $contentSwitch); } /** * @private function getPermissionsBody * - * @param string $module + * @param $module * @param string $language * * @return string */ - private function getPermissionsBody($module, $language) + private function getPermissionsBody($module, string $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $tables = $this->getTableTables($module->getVar('mod_id')); - $ret = $xc->getXcGetVar('moduleId', 'xoopsModule', 'mid'); - $ret .= $xc->getXcXoopsFormGroupPerm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'"); - $ret .= $xc->getXcEqualsOperator('$permFound', 'false'); - $foreach1 = $xc->getXcAddItem('permform', '$gPermId', '$gPermName', "\t\t"); - $if1 = $pc->getPhpCodeForeach('globalPerms', false, 'gPermId', 'gPermName', $foreach1, "\t"); - $if1 .= $xc->getXcXoopsTplAssign('form', '$permform->render()', true, "\t"); - $if1 .= $xc->getXcEqualsOperator('$permFound', 'true', null, "\t"); - $ret .= $pc->getPhpCodeConditions('$op', ' === ', "'global'", $if1, false); + $ret = $this->xc->getXcGetVar('moduleId', 'xoopsModule', 'mid'); + $ret .= $this->xc->getXcXoopsFormGroupPerm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'"); + $ret .= $this->xc->getXcEqualsOperator('$permFound', 'false'); + $foreach1 = $this->xc->getXcAddItem('permform', '$gPermId', '$gPermName', "\t\t"); + $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); - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { if (1 == $tables[$t]->getVar('table_permissions')) { $tableId = $tables[$t]->getVar('table_id'); $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 = $xc->getXcHandlerAllObj($tableName, $fieldMain, 0, 0, "\t\t"); - $getVar1 = $xc->getXcGetVar('', "{$tableName}All[\$i]", $fieldId, true); - $getVar2 = $xc->getXcGetVar('', "{$tableName}All[\$i]", $fieldMain, true); - $fe_content = $xc->getXcAddItem('permform', $getVar1, $getVar2, "\t\t\t"); - $if_table = $xc->getXcHandlerCountObj($tableName, "\t"); - $if_count .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $fe_content, "\t\t"); - $if_count .= $xc->getXcXoopsTplAssign('form', '$permform->render()', true, "\t\t"); - $if_table .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $if_count, false, "\t"); - $if_table .= $xc->getXcEqualsOperator('$permFound', 'true', null, "\t"); - $cond = "\$op === 'approve_{$tableName}' || \$op === 'submit_{$tableName}' || \$op === 'view_{$tableName}'"; - $ret .= $pc->getPhpCodeConditions($cond, '', '', $if_table, false); + $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"); + $if_table = $this->xc->getXcHandlerCountObj($tableName, "\t"); + $if_count .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $fe_content, "\t\t"); + $if_count .= $this->xc->getXcXoopsTplAssign('form', '$permform->render()', true, "\t\t"); + $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); } } - $ret .= $pc->getPhpCodeUnset('permform'); - $elseInter = $xc->getXcRedirectHeader("'permissions.php'", '', '3', "{$language}NO_PERMISSIONS_SET", false, "\t"); - $elseInter .= $this->getSimpleString("exit();", "\t"); - $ret .= $pc->getPhpCodeConditions('$permFound', ' !== ', 'true', $elseInter, false); + $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); return $ret; } @@ -239,9 +241,9 @@ private function getPermissionsBody($module, $language) /** * @public function render * - * @param null + * - * @return bool|string + * @return string */ public function render() { @@ -253,9 +255,9 @@ public function render() $content .= $this->getPermissionsHeader($module, $language); $content .= $this->getPermissionsSwitch($module, $language); $content .= $this->getPermissionsBody($module, $language); - $content .= $this->getInclude('footer'); + $content .= $this->getRequire('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/index.php b/class/Files/Admin/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Admin/index.php @@ -0,0 +1,2 @@ +setModule($module); $this->setFileName($filename); @@ -67,8 +66,8 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -77,11 +76,11 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module, '@charset "UTF-8";'); $content .= <<<'EOT' -img { - max-width: 200px; -} -EOT; - $this->create($moduleDirname, 'assets/css/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + 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 new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Assets/Css/Admin/index.php @@ -0,0 +1,2 @@ +setModule($module); $this->setFileName($filename); @@ -67,8 +66,8 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -77,29 +76,29 @@ 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; - $this->create($moduleDirname, 'assets/css', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + 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 new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Assets/Css/index.php @@ -0,0 +1,2 @@ +setModule($module); $this->setFileName($filename); @@ -68,118 +67,111 @@ public function write($module, $filename) /** * @public function getJavascriptJQueryButtons - * @param null * * @return string */ public function getJavascriptJQueryButtons() { - $ret = << -EOT; - - return $ret; + return <<<'EOT' + // + EOT; } /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getHeaderFilesComments($module); - $content = $this->getJavascriptJQueryButtons(); + $content = $this->getHeaderFilesComments($module, true); + $content .= $this->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..38d4698b 100644 --- a/class/Files/Assets/Js/JsJquery.php +++ b/class/Files/Assets/Js/JsJquery.php @@ -1,9 +1,9 @@ -setModule($module); $this->setFileName($filename); @@ -75,25 +74,25 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $this->getHeaderFilesComments($module, 0); + $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_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/Assets/Js/index.php b/class/Files/Assets/Js/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Assets/Js/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/class/Files/Assets/index.php b/class/Files/Assets/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Assets/index.php @@ -0,0 +1,2 @@ +xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } - /** + /** * @static function getInstance - * @param null + * * @return BlocksFiles */ public static function getInstance() @@ -58,11 +70,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param $filename */ - public function write($module, $table, $filename) + public function write($module, $table, $filename): void { $this->setModule($module); $this->setTable($table); @@ -74,98 +86,119 @@ public function write($module, $table, $filename) * @param $moduleDirname * @param $tableName * @param $tableFieldname + * @param $tablePermissions * @param $fields * @param $fieldId * @param int $fieldParent * @return string */ - private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fields, $fieldId, $fieldParent = 0) + private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tablePermissions, $fields, $fieldId, int $fieldParent = 0) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ucfTableName = ucfirst($tableName); + $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; + $stuModuleDirname = \mb_strtoupper($moduleDirname); + $ucfModuleDirname = \ucfirst($moduleDirname); - $ret = $pc->getPhpCodeCommentMultiLine(['Function' => 'show block', '@param $options' => '', '@return' => 'array']); - - $func = $pc->getPhpCodeIncludeDir("XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); - $func .= $xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()', '',"\t"); - $func .= $xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","{$stuModuleDirname}_UPLOAD_URL",'',"\t"); - $func .= $xc->getXcEqualsOperator('$block ', '[]', '',"\t"); - $func .= $xc->getXcEqualsOperator('$typeBlock ', '$options[0]','',"\t"); - $func .= $xc->getXcEqualsOperator('$limit ', '$options[1]','',"\t"); - $func .= $xc->getXcEqualsOperator('$lenghtTitle', '$options[2]','',"\t"); - $func .= $xc->getXcEqualsOperator('$helper ', 'Helper::getInstance()','',"\t"); - $func .= $xc->getXcHandlerLine($tableName, "\t"); - $func .= $xc->getXcCriteriaCompo($critName, "\t"); - $func .= $pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $pc->getPhpCodeBlankLine(); + $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('$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->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 = $xc->getXcEqualsOperator("\${$tableName}", "{$moduleDirname}_getMyItemIds('{$moduleDirname}_view', '{$moduleDirname}')", null, "\t"); - $crit = $xc->getXcCriteria('', "'cid'", "'(' . implode(',', \${$tableName}) . ')'", "'IN'", true); - $contIf .= $xc->getXcCriteriaAdd($critName, $crit, "\t"); - $crit = $xc->getXcCriteria('', "'{$fieldId}'", "{$moduleDirname}_block_addCatSelect(\$options)", "'IN'", true); - $contIf2 = $xc->getXcCriteriaAdd($critName, $crit, "\t\t"); - $contIf .= $pc->getPhpCodeConditions('1 != (count(\$options) && 0 == \$options[0])', null, null, $contIf2, false, "\t"); - $crit = $xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); - $contIf2 = $xc->getXcCriteriaAdd($critName, $crit, "\t\t"); - $contIf2 .= $xc->getXcCriteriaSetSort($critName, "'{$fieldId}'", "\t\t"); - $contIf2 .= $xc->getXcCriteriaSetOrder($critName, "'ASC'", "\t\t"); - $contIf .= $pc->getPhpCodeConditions('$typeBlock', null, null, $contIf2, false, "\t"); + $contIf = $this->xc->getXcEqualsOperator("\${$tableName}", "{$moduleDirname}_getMyItemIds('{$moduleDirname}_view', '{$moduleDirname}')", null, "\t"); + $crit = $this->xc->getXcCriteria('', "'cid'", "'(' . \implode(',', \${$tableName}) . ')'", "'IN'", true); + $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])', '', '', $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', '', '', $contIf2, false, "\t"); //content else: parent - //search for SelectStatus field - $fieldStatus = ''; - $critStatus = ''; + $fieldDate = ''; + $fieldRating = ''; foreach ($fields as $field) { - if ($field->getVar('field_element') == 16) { - $fieldStatus = $field->getVar('field_name'); + 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'); } } - if ('' !== $fieldStatus) { - $crit = $xc->getXcCriteria('', "'{$fieldStatus}'", 'Constants::PERM_GLOBAL_VIEW', '', true); - $critStatus .= $xc->getXcCriteriaAdd($critName, $crit, "\t\t\t"); + //search for SelectStatus field + $fieldStatus = ''; + if (1 == $tablePermissions) { + foreach ($fields as $field) { + if ($field->getVar('field_element') == Constants::FIELD_ELE_SELECTSTATUS) { + $fieldStatus = $field->getVar('field_name'); + } + } + if ('' !== $fieldStatus) { + $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(); + } } - $case1[] = $pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case1[] = $critStatus; + $case1 = []; + $case2 = []; + $case3 = []; + $case4 = []; + $case5 = []; + $case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\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"); + $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"); } - $case1[] = $xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_date'","\t\t\t"); - $case1[] = $xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); - $case2[] = $pc->getPhpCodeCommentLine("For the block: {$tableName} new",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case2[] = $critStatus; - } - $crit = $xc->getXcCriteria('', "'{$tableFieldname}_date'", 'strtotime(date(_SHORTDATESTRING))', "'>='", true); - $case2[] = $xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); - $crit = $xc->getXcCriteria('', "'{$tableFieldname}_date'", 'strtotime(date(_SHORTDATESTRING))+86400', "'<='", true); - $case2[] = $xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); - $case2[] = $xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_date'","\t\t\t"); - $case2[] = $xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); - $case3[] = $pc->getPhpCodeCommentLine("For the block: {$tableName} hits",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case3[] = $critStatus; - } - $case3[] = $xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_hits'","\t\t\t"); - $case3[] = $xc->getXcCriteriaSetOrder($critName, "'DESC'","\t\t\t"); - $case4[] = $pc->getPhpCodeCommentLine("For the block: {$tableName} top",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case4[] = $critStatus; - } - $case4[] = $xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); - $case4[] = $xc->getXcCriteriaSetSort($critName, "'{$tableFieldname}_top'","\t\t\t"); - $case4[] = $xc->getXcCriteriaSetOrder($critName, "'ASC'","\t\t\t"); - $case5[] = $pc->getPhpCodeCommentLine("For the block: {$tableName} random",'',"\t\t\t"); - if ('' !== $fieldStatus) { - $case5[] = $critStatus; + $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, "'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->xc->getXcCriteriaSetSort($critName, "'{$fieldRating}'","\t\t\t"); + } else { + $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"); } - $case5[] = $xc->getXcCriteriaAdd($critName, $crit,"\t\t\t"); - $case5[] = $xc->getXcCriteriaSetSort($critName, "'RAND()'","\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 = [ 'last' => $case1, 'new' => $case2, @@ -173,55 +206,103 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fie 'top' => $case4, 'random' => $case5, ]; - $contSwitch = $pc->getPhpCodeCaseSwitch($cases, true, false, "\t\t"); - $contElse = $pc->getPhpCodeSwitch('typeBlock', $contSwitch, "\t"); + $contSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, "\t\t"); + $contElse = $this->pc->getPhpCodeSwitch('typeBlock', $contSwitch, "\t"); //end: content else: parent if (1 == $fieldParent) { $func .= $contIf; } else { $func .= $contElse; } - $func .= $pc->getPhpCodeBlankLine(); + $func .= $this->pc->getPhpCodeBlankLine(); - $func .= $xc->getXcCriteriaSetLimit($critName, '$limit', "\t"); - $func .= $xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); - $func .= $pc->getPhpCodeUnset($critName, "\t"); - $contentForeach = ''; - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - // Verify if table_fieldname is not empty - //$lpFieldName = !empty($tableFieldname) ? substr($fieldName, 0, strpos($fieldName, '_')) : $tableName; - $rpFieldName = $this->getRightString($fieldName); + $func .= $this->xc->getXcCriteriaSetLimit($critName, '$limit', "\t"); + $func .= $this->xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); + $func .= $this->pc->getPhpCodeUnset($critName, "\t"); + $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' => '', + "\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); + $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 2: - $contentForeach .= $xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\$myts->htmlSpecialChars(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $lenName = max(strlen($this->getRightString($fieldName)) + 6, $lenName); break; - case 3: - case 4: - $contentForeach .= $xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "strip_tags(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + 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 8: - $contentForeach .= $xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']", "\XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + case 0: + default: + $lenName = max(strlen($this->getRightString($fieldName)), $lenName); break; - case 15: - $contentForeach .= $xc->getXcEqualsOperator("\$block[\$i]['{$rpFieldName}']","formatTimeStamp(\${$tableName}All[\$i]->getVar('{$fieldName}'))", null, "\t\t\t"); + } + } + } + $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(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_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $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 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 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 .= $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; } } } - $foreach = $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, "\t\t"); + $foreach = $this->pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, "\t\t"); - $func .= $pc->getPhpCodeConditions("count(\${$tableName}All)", ' > ', '0', $foreach, false, "\t"); - $func .= $pc->getPhpCodeBlankLine(); + $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 .= $pc->getPhpCodeBlankLine(); + $func .= $this->pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_show", '$options', $func, '', false, ""); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_show", '$options', $func, ''); return $ret; } @@ -236,72 +317,74 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fie * * @return string */ - private function getBlocksEdit($moduleDirname, $tableName, $fieldId, $fieldMain, $language) + private function getBlocksEdit(string $moduleDirname, string $tableName, string $fieldId, string $fieldMain, string $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $stuTableName = mb_strtoupper($tableName); - $ucfTableName = ucfirst($tableName); + $stuModuleDirname = \mb_strtoupper($moduleDirname); + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); $critName = 'cr' . $ucfTableName; - $ret = $pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); - $func = $pc->getPhpCodeIncludeDir("XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true, '', "\t"); - $func .= $xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); - $func .= $xc->getXcHandlerLine($tableName, "\t"); - $func .= $xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","{$stuModuleDirname}_UPLOAD_URL",'',"\t"); - $func .= $xc->getXcEqualsOperator('$form', "{$language}DISPLAY", '',"\t"); - $func .= $xc->getXcEqualsOperator('$form', "\"\"", '.',"\t"); - $func .= $xc->getXcEqualsOperator('$form', "\" 
\"", '.',"\t"); - $func .= $xc->getXcEqualsOperator('$form', "{$language}TITLE_LENGTH . \" :

\"", '.',"\t"); - $func .= $pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $pc->getPhpCodeArrayShift('$options', "\t"); - $func .= $pc->getPhpCodeBlankLine(); - $func .= $xc->getXcCriteriaCompo($critName, "\t"); - $crit = $xc->getXcCriteria('', "'{$fieldId}'", '0', "'!='", true); - $func .= $xc->getXcCriteriaAdd($critName, $crit, "\t", "\n"); - $func .= $xc->getXcCriteriaSetSort($critName, "'{$fieldId}'","\t","\n"); - $func .= $xc->getXcCriteriaSetOrder($critName, "'ASC'","\t","\n"); - $func .= $xc->getXcHandlerAllClear("{$tableName}All", $tableName, "\${$critName}", "\t"); - $func .= $pc->getPhpCodeUnset($critName, "\t"); - $func .= $xc->getXcEqualsOperator('$form', "{$language}{$stuTableName}_TO_DISPLAY . \"
'", '.',"\t"); - $func .= $pc->getPhpCodeBlankLine(); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Function' => 'edit block', '@param $options' => '', '@return' => 'string']); + $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"); + $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->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->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->pc->getPhpCodeBlankLine(); + $func .= $this->getSimpleString('*/', "\t"); $func .= $this->getSimpleString('return $form;', "\t"); - $func .= $pc->getPhpCodeBlankLine(); + $func .= $this->pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, '', false, ""); + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_edit", '$options', $func, ''); return $ret; - } /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $module = $this->getModule(); - $filename = $this->getFileName(); - $table = $this->getTable(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MB'); - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - $fieldId = null; - $fieldParent = null; - $fieldMain = null; - foreach (array_keys($fields) as $f) { + $module = $this->getModule(); + $filename = $this->getFileName(); + $table = $this->getTable(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableFieldname = $table->getVar('table_fieldname'); + $tablePermissions = $table->getVar('table_permissions'); + $language = $this->getLanguage($moduleDirname, 'MB'); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldId = null; + $fieldParent = null; + $fieldMain = null; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldParent = $fields[$f]->getVar('field_parent'); if (0 == $f) { @@ -312,14 +395,14 @@ public function render() } } $content = $this->getHeaderFilesComments($module); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Helper'], '', ''); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $content .= $pc->getPhpCodeIncludeDir("XOOPS_ROOT_PATH . '/modules/{$moduleDirname}/include/common.php'",'',true, true); - $content .= $this->getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fields, $fieldId, $fieldParent); + $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, $tableFieldname, $tablePermissions, $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/Blocks/BlocksFilesSpotlight.php b/class/Files/Blocks/BlocksFilesSpotlight.php new file mode 100644 index 00000000..5c550768 --- /dev/null +++ b/class/Files/Blocks/BlocksFilesSpotlight.php @@ -0,0 +1,340 @@ +xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return BlocksFilesSpotlight|false + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $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; + $stuModuleDirname = \mb_strtoupper($moduleDirname); + $ucfModuleDirname = \ucfirst($moduleDirname); + + $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('$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"); + if (1 === $configMaxchar) { + $func .= $this->xc->getXcEqualsOperator('$utility ', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\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('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"); + $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', '', '', $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 = $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' => '', + "\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); + + + $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(str_pad("\$block[\$i]['id']", $lenName), "\${$tableName}['{$fieldId}']", null, "\t\t\t"); + } + if (1 == $fields[$f]->getVar('field_block')) { + switch ($fieldElement) { + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $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 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 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(str_pad("\$block[\$i]['{$rpFieldName}']", $lenName),"\${$tableName}['{$rpFieldName}']", 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->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}_spotlight_show", '$options', $func, ''); + + 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(string $moduleDirname, string $tableName, string $fieldId, string $fieldMain, string $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->xc->getXcEqualsOperator('$helper', 'Helper::getInstance()', '',"\t"); + $func .= $this->xc->getXcHandlerLine($tableName, "\t"); + $func .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url","\\{$stuModuleDirname}_UPLOAD_URL",true,"\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"); + $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->pc->getPhpCodeBlankLine(); + $func .= $this->getSimpleString('return $form;', "\t"); + $func .= $this->pc->getPhpCodeBlankLine(); + + $ret .= $this->pc->getPhpCodeFunction("b_{$moduleDirname}_{$tableName}_spotlight_edit", '$options', $func, ''); + + return $ret; + + } + + /** + * @public function render + * + * @return 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/Blocks/index.php b/class/Files/Blocks/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Blocks/index.php @@ -0,0 +1,2 @@ +cf = Modulebuilder\Files\CreateFile::getInstance(); + } + + /** + * @static function getInstance + * + * @return Modulebuilder\Files\CheckData + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function getCheckResult + * + * @param $module + * @return array + */ + public function getCheckPreBuilding($module) + { + $this->modId = $module->getVar('mod_id'); + $this->tables = $this->cf->getTableTables($this->modId); + $this->infos = []; + + $this->getCheckBlock(); + $this->getCheckBroken(); + $this->getCheckComments(); + $this->getCheckUserpage(); + $this->getCheckRating(); + $this->getCheckReads(); + $this->getCheckSql(); + + return $this->infos; + } + + /** + * @public function getCheckBroken + * + * @return void + */ + private function getCheckBroken(): void + { + 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); + $fieldSatus = ''; + + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (Constants::FIELD_ELE_SELECTSTATUS == $fields[$f]->getVar('field_element')) { + $fieldSatus = $fieldName; + } + } + // check whether each table with handling "broken" has also a field "status" + if ('' == $fieldSatus) { + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_BROKEN1); + $this->infos[] = ['icon' => 'error', 'info' => $info]; + } + } + } + } + + /** + * @private function getCheckUserpage + * + * @return void + */ + private function getCheckUserpage(): void + { + //check field params: minimum one param is selected + foreach (\array_keys($this->tables) as $t) { + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $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'); + if (0 == $fieldParams) { + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS1); + $this->infos[] = ['icon' => 'error', 'info' => $info]; + } + } + } + } + + //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'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); + + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + 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') + + (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); + $this->infos[] = ['icon' => 'warning', 'info' => $info]; + } + } + } + } + } + //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'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); + + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + 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'); + if ($fieldParams > 1) { + $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); + $this->infos[] = ['icon' => 'warning', 'info' => $info]; + } + } + } + } + } + + //check table params: user submit or rate or broken, but table not for user side + 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); + $this->infos[] = ['icon' => 'error', 'info' => $info]; + } + } + + //check field/table params: params for index file, but table param table_index = 0 + //check field/table params: params for user file, but table param table_user = 0 + foreach (\array_keys($this->tables) as $t) { + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $tableIndex = (int)$this->tables[$t]->getVar('table_index'); + $tableUser = (int)$this->tables[$t]->getVar('table_user'); + $fields = $this->cf->getTableFields($this->modId, $tableId); + + $fieldParamsIndex = 0; + $fieldParamsUser = 0; + $fieldName = ''; + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + 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'); + $fieldParamsIndex += $fieldParams; + if ($fieldParams >= 1 && 0 == $tableIndex) { + $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'); + $fieldParamsUser += $fieldParams; + if ($fieldParams >= 1 && 0 == $tableUser) { + $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); + $this->infos[] = ['icon' => 'warning', 'info' => $info]; + } + if (0 == $fieldParamsUser && 1 == $tableUser) { + $info = \str_replace(['%f', '%t'], [$fieldName, $tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS6); + $this->infos[] = ['icon' => 'warning', 'info' => $info]; + } + } + + } + + /** + * @private function getCheckBlock + * + * @return void + */ + private function getCheckBlock(): void + { + //use in block but no field selected + foreach (\array_keys($this->tables) as $t) { + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $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')) { + $count++; + } + } + if (0 == $count) { + $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'); + $tableName = $this->tables[$t]->getVar('table_name'); + + $count = 0; + if (1 == $this->tables[$t]->getVar('table_blocks')) { + $fields = $this->cf->getTableFields($this->modId, $tableId); + foreach (\array_keys($fields) as $f) { + if (Constants::FIELD_ELE_TEXTDATESELECT == $fields[$f]->getVar('field_element') || Constants::FIELD_ELE_DATETIME == $fields[$f]->getVar('field_element')) { + $count++; + } + } + if (0 == $count) { + $info = \str_replace(['%t'], [$tableName], \_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK2); + $this->infos[] = ['icon' => 'warning', 'info' => $info]; + } + } + } + + } + + /** + * @private function getCheckComments + * + * @return void + */ + private function getCheckComments(): void + { + //use comments in multiple tables + $count = 0; + $tableComments = []; + foreach (\array_keys($this->tables) as $t) { + if (1 == $this->tables[$t]->getVar('table_comments')) { + $count++; + $tableComments[] = $this->tables[$t]->getVar('table_name'); + } + } + if ($count > 1) { + $tablesComments = \implode(', ', $tableComments); + $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); + $fieldComments = 0; + foreach (\array_keys($fields) as $f) { + if (Constants::FIELD_ELE_TEXTCOMMENTS == (int)$fields[$f]->getVar('field_element')) { + $fieldComments++; + } + } + // 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); + $this->infos[] = ['icon' => 'warning', 'info' => $info]; + } + } + } + + } + + /** + * @private function getCheckRatings + * + * @return void + */ + private function getCheckRating(): void + { + 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); + $fieldRatings = 0; + $fieldVotes = 0; + foreach (\array_keys($fields) as $f) { + if (Constants::FIELD_ELE_TEXTRATINGS == (int)$fields[$f]->getVar('field_element')) { + $fieldRatings++; + } + if (Constants::FIELD_ELE_TEXTVOTES == (int)$fields[$f]->getVar('field_element')) { + $fieldVotes++; + } + } + // check whether each table with handling "rating" has also a field "rating" + 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 == $fieldVotes) { + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_RATINGS2); + $this->infos[] = ['icon' => 'error', 'info' => $info]; + } + } + } + + } + + /** + * @private function getCheckReads + * + * @return void + */ + private function getCheckReads(): void + { + 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); + $fieldReads = 0; + foreach (\array_keys($fields) as $f) { + if (Constants::FIELD_ELE_TEXTREADS == (int)$fields[$f]->getVar('field_element')) { + $fieldReads++; + } + } + // check whether each table with handling "reads" has also a field "reads" + if (0 == $fieldReads) { + $info = \str_replace('%t', $tableName, \_AM_MODULEBUILDER_BUILDING_CHECK_READS1); + $this->infos[] = ['icon' => 'error', 'info' => $info]; + } + } + } + + } + + /** + * @private function getCheckSql + * + * @return void + */ + private function getCheckSql(): void + { + foreach (\array_keys($this->tables) as $t) { + $tableId = $this->tables[$t]->getVar('table_id'); + $tableName = $this->tables[$t]->getVar('table_name'); + $fields = $this->cf->getTableFields($this->modId, $tableId); + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldType = $fields[$f]->getVar('field_type'); + if (6 == $fieldType || 7 == $fieldType || 8 == $fieldType) { + $fieldValue = $fields[$f]->getVar('field_value'); + 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 == \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 d2e9410e..6907ec07 100644 --- a/class/Files/Classes/ClassFiles.php +++ b/class/Files/Classes/ClassFiles.php @@ -1,9 +1,12 @@ -cf = Modulebuilder\Files\CreateFile::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); + $this->helper = Modulebuilder\Helper::getInstance(); } /** * @static function getInstance * - * @param null - * * @return ClassFiles */ public static function getInstance() @@ -61,12 +86,12 @@ 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) + public function write($module, $table, $tables, $filename): void { $this->setModule($module); $this->setTable($table); @@ -82,11 +107,9 @@ public function write($module, $table, $tables, $filename) * * @return string */ - private function getInitVar($fieldName, $type = 'INT') + private function getInitVar(string $fieldName, string $type = 'INT') { - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - - return $cxc->getClassInitVar($fieldName, $type); + return $this->cxc->getClassInitVar($fieldName, $type); } /** @@ -96,19 +119,20 @@ 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) { + 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: case 4: case 5: - $ret .= $this->getInitVar($fieldName, 'INT'); + $ret .= $this->getInitVar($fieldName); break; case 6: $ret .= $this->getInitVar($fieldName, 'FLOAT'); @@ -134,7 +158,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: @@ -158,29 +186,30 @@ private function getInitVars($fields) */ private function getClassObject($module, $table, $fields) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); - $ucfTableName = ucfirst($tableName); - $ret = $pc->getPhpCodeDefined(); - $ret .= $pc->getPhpCodeCommentMultiLine(['Class Object' => $ucfTableName]); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeDefined(); + $ret .= $this->pc->getPhpCodeCommentMultiLine(['Class Object' => $ucfTableName]); $cCl = ''; $fieldInForm = []; $fieldElementId = []; $optionsFieldName = []; + $fieldUpload = false; $fieldId = null; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $fieldInForm[] = $fields[$f]->getVar('field_inform'); - $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); + if (Constants::FIELD_ELE_UPLOADIMAGE == $fieldElements->getVar('fieldelement_id') || Constants::FIELD_ELE_UPLOADFILE == $fieldElements->getVar('fieldelement_id')) { + $fieldUpload = true; + } $rpFieldName = $this->getRightString($fieldName); - if (in_array(5, $fieldElementId)) { - //if (count($rpFieldName) % 5) { + if (\in_array(5, $fieldElementId)) { + //if (\count($rpFieldName) % 5) { //$optionsFieldName[] = "'" . $rpFieldName . "'"; //} else { $optionsFieldName[] = "'" . $rpFieldName . "'\n"; @@ -190,34 +219,38 @@ private function getClassObject($module, $table, $fields) $fieldId = $fieldName; } } - if (in_array(5, $fieldElementId) > 1) { - $cCl .= $pc->getPhpCodeCommentMultiLine(['Options' => '']); - $options = $pc->getPhpCodeArray('', $optionsFieldName, true); - $cCl .= $pc->getPhpCodeVariableClass('private', 'options', $options); + if (\in_array(5, $fieldElementId) > 1) { + $cCl .= $this->pc->getPhpCodeCommentMultiLine(['Options' => '']); + $options = $this->pc->getPhpCodeArray('', $optionsFieldName, true); + $cCl .= $this->pc->getPhpCodeVariableClass('private', 'options', $options); } unset($optionsFieldName); - - $cCl .= $pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); + $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' => '', '' => ''], "\t"); $constr = $this->getInitVars($fields); - $cCl .= $pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); - $arrayGetInstance = ['@static function' => '&getInstance', '' => '', '@param' => 'null']; - $cCl .= $pc->getPhpCodeCommentMultiLine($arrayGetInstance, "\t"); - $getInstance = $pc->getPhpCodeVariableClass('static', 'instance', 'false', "\t\t"); - $instance = $xc->getXcEqualsOperator('$instance', 'new self()', null, "\t\t\t"); - $getInstance .= $pc->getPhpCodeConditions('!$instance', '', '', $instance, false, "\t\t"); - $cCl .= $pc->getPhpCodeFunction('getInstance', '', $getInstance, 'public static ', false, "\t"); + $cCl .= $this->pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); + $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); - $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); - if (in_array(5, $fieldElementId) > 1) { + if (\in_array(5, $fieldElementId) > 1) { $cCl .= $this->getOptionsCheck($table); } unset($fieldElementId); - $ret .= $pc->getPhpCodeClass($ucfTableName, $cCl, '\XoopsObject'); + $ret .= $this->pc->getPhpCodeClass($ucfTableName, $cCl, '\XoopsObject'); return $ret; } @@ -231,15 +264,13 @@ private function getClassObject($module, $table, $fields) */ private function getNewInsertId($table) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); - $ucfTableName = ucfirst($tableName); - $ret = $pc->getPhpCodeCommentMultiLine(['The new inserted' => '$Id', '@return' => 'inserted id'], "\t"); - $getInsertedId = $xc->getXcEqualsOperator('$newInsertedId', "\$GLOBALS['xoopsDB']->getInsertId()", null, "\t\t"); + $ucfTableName = \ucfirst($tableName); + $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"); - $ret .= $pc->getPhpCodeFunction('getNewInsertedId' . $ucfTableName, '', $getInsertedId, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('getNewInsertedId' . $ucfTableName, '', $getInsertedId, 'public ', false, "\t"); return $ret; } @@ -247,66 +278,60 @@ private function getNewInsertId($table) /** * @private function getFunctionForm * - * @param string $module - * @param string $table - * + * @param $module + * @param $table * @param $fieldId * @param $fieldInForm + * @param $fieldUpload * @return string */ - private function getFunctionForm($module, $table, $fieldId, $fieldInForm) + private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $fieldUpload) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); $fe = ClassFormElements::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); - $tableCategory = $table->getVar('table_category'); - $ucfTableName = ucfirst($tableName); - $stuTableSoleName = mb_strtoupper($tableSoleName); + $ucfTableName = \ucfirst($tableName); + $stuTableSoleName = \mb_strtoupper($tableSoleName); $language = $this->getLanguage($moduleDirname, 'AM'); $fe->initForm($module, $table); - $ret = $pc->getPhpCodeCommentMultiLine(['@public function' => 'getForm', '@param bool' => '$action', '@return' => '\XoopsThemeForm'], "\t"); - $action = $xc->getXcEqualsOperator('$action', "\$_SERVER['REQUEST_URI']", null, "\t\t\t"); - $ucfModuleDirname = ucfirst($moduleDirname); - $getForm = $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); - $getForm .= $pc->getPhpCodeConditions('false', ' === ', '$action', $action, false, "\t\t"); - $xUser = $pc->getPhpCodeGlobals('xoopsUser'); - $xModule = $pc->getPhpCodeGlobals('xoopsModule'); - $permString = 'upload_groups'; - if (1 != $tableCategory/* && (1 == $tablePermissions)*/) { - $getForm .= $pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t"); - $getForm .= $xc->getXcXoopsHandler('groupperm', "\t\t"); - $getForm .= $pc->getPhpCodeTernaryOperator('groups', 'is_object(' . $xUser . ')', $xUser . '->getGroups()', 'XOOPS_GROUP_ANONYMOUS', "\t\t"); - $checkRight = $xc->getXcCheckRight('$grouppermHandler', $permString, 32, '$groups', $xModule . '->getVar(\'mid\')', true); - $ternaryOperator = $pc->getPhpCodeTernaryOperator('permissionUpload', $checkRight, 'true', 'false', "\t\t\t"); - $permissionUpload = $xc->getXcEqualsOperator('$permissionUpload', 'true', null, "\t\t\t\t"); - $ternOperator = $pc->getPhpCodeRemoveCarriageReturn($ternaryOperator, '', "\r"); - $if = $pc->getPhpCodeConditions('!' . $xUser . '->isAdmin(' . $xModule . '->mid())', '', '', "\t" . $ternaryOperator, $permissionUpload, "\t\t\t"); - $getForm .= $pc->getPhpCodeConditions($xUser, '', '', $if, $ternOperator, "\t\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['@public function' => 'getForm', '@param bool' => '$action', '@return' => '\XoopsThemeForm'], "\t"); + $action = $this->xc->getXcEqualsOperator('$action', "\$_SERVER['REQUEST_URI']", null, "\t\t\t"); + $ucfModuleDirname = \ucfirst($moduleDirname); + $getForm = $this->xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); + $getForm .= $this->pc->getPhpCodeConditions('!', '', '$action', $action, false, "\t\t"); + $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); + $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); + $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('permissionUpload', $checkRight, 'true', 'false', "\t\t"); } - $getForm .= $pc->getPhpCodeCommentLine('Title', '', "\t\t"); - $getForm .= $pc->getPhpCodeTernaryOperator('title', '$this->isNew()', "sprintf({$language}{$stuTableSoleName}_ADD)", "sprintf({$language}{$stuTableSoleName}_EDIT)", "\t\t"); - $getForm .= $pc->getPhpCodeCommentLine('Get Theme', 'Form', "\t\t"); - $getForm .= $xc->getXcXoopsLoad('XoopsFormLoader', "\t\t"); - $getForm .= $cxc->getClassXoopsThemeForm('form', 'title', 'form', 'action', 'post'); - $getForm .= $cxc->getClassSetExtra('form', "'enctype=\"multipart/form-data\"'"); + $getForm .= $this->pc->getPhpCodeCommentLine('Title', '', "\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'); + $getForm .= $this->cxc->getClassSetExtra('form', "'enctype=\"multipart/form-data\"'"); $getForm .= $fe->renderElements(); - if (in_array(1, $fieldInForm)) { + if (\in_array(1, $fieldInForm)) { if (1 == $table->getVar('table_permissions')) { $getForm .= $this->getPermissionsInForm($moduleDirname, $fieldId, $tableName); } } - $getForm .= $pc->getPhpCodeCommentLine('To Save', '', "\t\t"); - //$hiddenSave = $cc->getClassXoopsFormHidden('', "'op'", "'save'", true, false); - $getForm .= $cxc->getClassAddElement('form', "new \XoopsFormHidden('op', 'save')"); - $getForm .= $cxc->getClassAddElement('form', "new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)"); + $getForm .= $this->pc->getPhpCodeCommentLine('To Save', '', "\t\t"); + $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"); - $ret .= $pc->getPhpCodeFunction('getForm' . $ucfTableName, '$action = false', $getForm, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('getForm' . $ucfTableName, '$action = false', $getForm, 'public ', false, "\t"); return $ret; } @@ -315,50 +340,44 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm) * @private function getPermissionsInForm * * @param string $moduleDirname - * @param string $fieldId + * @param string|null $fieldId * * @param $tableName * @return string */ - private function getPermissionsInForm($moduleDirname, $fieldId, $tableName) + private function getPermissionsInForm(string $moduleDirname, ?string $fieldId, $tableName) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\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'); - $ret = $pc->getPhpCodeCommentLine('Permissions', '', "\t\t"); - $ret .= $xc->getXcXoopsHandler('member', "\t\t"); - $ret .= $xc->getXcEqualsOperator('$groupList', '$memberHandler->getGroupList()', null, "\t\t"); - $ret .= $xc->getXcXoopsHandler('groupperm', "\t\t"); - $ret .= $pc->getPhpCodeArrayType('fullList', 'keys', 'groupList', null, false, "\t\t"); - $fId = $xc->getXcGetVar('', 'this', $fieldId, true); - $mId = $xc->getXcGetVar('', "GLOBALS['xoopsModule']", 'mid', true); - $ifGroups = $xc->getXcGetGroupIds('groupsIdsApprove', 'grouppermHandler', "'{$moduleDirname}_approve_{$tableName}'", $fId, $mId, "\t\t\t"); - $ifGroups .= $pc->getPhpCodeArrayType('groupsIdsApprove', 'values', 'groupsIdsApprove', null, false, "\t\t\t"); - $ifGroups .= $cxc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$groupsIdsApprove', false, "\t\t\t"); - $ifGroups .= $xc->getXcGetGroupIds('groupsIdsSubmit', 'grouppermHandler', "'{$moduleDirname}_submit_{$tableName}'", $fId, $mId, "\t\t\t"); - $ifGroups .= $pc->getPhpCodeArrayType('groupsIdsSubmit', 'values', 'groupsIdsSubmit', null, false, "\t\t\t"); - $ifGroups .= $cxc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$groupsIdsSubmit', false, "\t\t\t"); - $ifGroups .= $xc->getXcGetGroupIds('groupsIdsView', 'grouppermHandler', "'{$moduleDirname}_view_{$tableName}'", $fId, $mId, "\t\t\t"); - $ifGroups .= $pc->getPhpCodeArrayType('groupsIdsView', 'values', 'groupsIdsView', null, false, "\t\t\t"); - $ifGroups .= $cxc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$groupsIdsView', false, "\t\t\t"); - - $else = $cxc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$fullList', false, "\t\t\t"); - $else .= $cxc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$fullList', false, "\t\t\t"); - $else .= $cxc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$fullList', false, "\t\t\t"); - - $ret .= $pc->getPhpCodeConditions('!$this->isNew()', null, null, $ifGroups, $else, "\t\t"); - $ret .= $pc->getPhpCodeCommentLine('To Approve', '', "\t\t"); - $ret .= $cxc->getClassAddOptionArray('groupsCanApproveCheckbox', '$groupList'); - $ret .= $cxc->getClassAddElement('form', '$groupsCanApproveCheckbox'); - $ret .= $pc->getPhpCodeCommentLine('To Submit', '', "\t\t"); - $ret .= $cxc->getClassAddOptionArray('groupsCanSubmitCheckbox', '$groupList'); - $ret .= $cxc->getClassAddElement('form', '$groupsCanSubmitCheckbox'); - $ret .= $pc->getPhpCodeCommentLine('To View', '', "\t\t"); - $ret .= $cxc->getClassAddOptionArray('groupsCanViewCheckbox', '$groupList'); - $ret .= $cxc->getClassAddElement('form', '$groupsCanViewCheckbox'); + $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->pc->getPhpCodeArrayType('fullList', 'keys', 'groupList'); + $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->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->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->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"); + $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()', '', '', $contIf, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeCommentLine('To Approve', '', "\t\t"); + $ret .= $this->cxc->getClassAddOptionArray('groupsCanApproveCheckbox', '$groupList'); + $ret .= $this->cxc->getClassAddElement('form', '$groupsCanApproveCheckbox'); + $ret .= $this->pc->getPhpCodeCommentLine('To Submit', '', "\t\t"); + $ret .= $this->cxc->getClassAddOptionArray('groupsCanSubmitCheckbox', '$groupList'); + $ret .= $this->cxc->getClassAddElement('form', '$groupsCanSubmitCheckbox'); + $ret .= $this->pc->getPhpCodeCommentLine('To View', '', "\t\t"); + $ret .= $this->cxc->getClassAddOptionArray('groupsCanViewCheckbox', '$groupList'); + $ret .= $this->cxc->getClassAddElement('form', '$groupsCanViewCheckbox'); return $ret; } @@ -374,66 +393,145 @@ 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(); - $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"); + $ucfTableName = \ucfirst($table->getVar('table_name')); + $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"); + $tablePermissions = $table->getVar('table_permissions'); + $tableBroken = $table->getVar('table_broken'); $fieldMainTopic = null; - foreach (array_keys($fields) as $f) { + $helper = 0; + $utility = 0; + $header = ''; + $configMaxchar = 0; + $lenMaxName = 0; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); + $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'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + $spacer = str_repeat(' ', $lenMaxName - \mb_strlen($rpFieldName)); switch ($fieldElement) { - case 3: - case 4: - $getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", false, "\t\t"); + 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}_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; + $utility = 1; break; - case 6: - $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t"); + 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}_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; + $utility = 1; break; - case 8: - $getValues .= $xc->getXcXoopsUserUnameFromId("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", "\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 15: - $getValues .= $xc->getXcFormatTimeStamp("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", 's', "\t\t"); + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + $spacer = str_repeat(' ', \max(0, $lenMaxName - 5 - \mb_strlen($rpFieldName))); + $defaultRO = $this->xc->getXcGetConstants('RADIO_OFFLINE'); + $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 21: - $getValues .= $xc->getXcFormatTimeStamp("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", 'm', "\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 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 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')); + $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"); + $cases[$this->xc->getXcGetConstants('STATUS_APPROVED')] = [$contCase4]; + } + if (1 == $tableBroken) { + $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, "\t\t\t", true); + $getValues .= $this->pc->getPhpCodeSwitch('status', $contentSwitch, "\t\t"); + $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; + 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 = $tc->getHandler('fieldelements')->get($fieldElement); + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementTid = $fieldElements->getVar('fieldelement_tid'); if ((int)$fieldElementTid > 0 ) { $fieldElementMid = $fieldElements->getVar('fieldelement_mid'); - $fieldElementName = $fieldElements->getVar('fieldelement_name'); - $fieldNameDesc = mb_substr($fieldElementName, mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); - $topicTableName = str_replace(': ', '', mb_strtolower($fieldNameDesc)); + $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); - foreach (array_keys($fieldsTopics) as $g) { + foreach (\array_keys($fieldsTopics) as $g) { $fieldNameTopic = $fieldsTopics[$g]->getVar('field_name'); if (1 == $fieldsTopics[$g]->getVar('field_main')) { $fieldMainTopic = $fieldNameTopic; } } - $getValues .= $xc->getXcHandlerLine($topicTableName, "\t\t"); + $getValues .= $this->xc->getXcHandlerLine($topicTableName, "\t\t"); $getTopicTable = "\${$topicTableName}Handler->get(\$this->getVar('{$fieldName}'))"; - $getValues .= $xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t"); - $fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')"; - $getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']", $fMainTopic, null, "\t\t"); - + $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 .= $xc->getXcGetVar("ret['{$rpFieldName}']", 'this', $fieldName, false, "\t\t"); + $getValues .= $this->xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t"); } break; } } + if ($helper > 0) { + $header .= $this->xc->getXcGetInstance('helper ', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t"); + } + if ($utility > 0) { + $header .= $this->xc->getXcEqualsOperator('$utility', "new \XoopsModules\\{$ucfModuleDirname}\Utility()", '',"\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 .= $this->pc->getPhpCodeFunction('getValues' . $ucfTableName, '$keys = null, $format = null, $maxDepth = null', $header . $getValues, 'public ', false, "\t"); return $ret; } @@ -447,20 +545,18 @@ private function getValuesInObject($moduleDirname, $table, $fields) */ private function getToArrayInObject($table) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); - $ucfTableName = ucfirst($tableName); + $ucfTableName = \ucfirst($tableName); $multiLineCom = ['Returns an array representation' => 'of the object', '' => '', '@return' => 'array']; - $ret = $pc->getPhpCodeCommentMultiLine($multiLineCom, "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine($multiLineCom, "\t"); - $getToArray = $pc->getPhpCodeArray('ret', [], false, "\t\t"); - $getToArray .= $xc->getXcEqualsOperator('$vars', '$this->getVars()', null, "\t\t"); - $foreach = $xc->getXcGetVar('ret[$var]', 'this', '"{$var}"', false, "\t\t\t"); - $getToArray .= $pc->getPhpCodeForeach('vars', true, false, 'var', $foreach, "\t\t"); + $getToArray = $this->pc->getPhpCodeArray('ret', []); + $getToArray .= $this->xc->getXcEqualsOperator('$vars', '$this->getVars()', null, "\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"); - $ret .= $pc->getPhpCodeFunction('toArray' . $ucfTableName, '', $getToArray, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('toArray' . $ucfTableName, '', $getToArray, 'public ', false, "\t"); return $ret; } @@ -474,55 +570,51 @@ private function getToArrayInObject($table) */ private function getOptionsCheck($table) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $tableName = $table->getVar('table_name'); - $ucfTableName = ucfirst($tableName); - $ret = $pc->getPhpCodeCommentMultiLine(['Get' => 'Options'], "\t"); - $getOptions = $pc->getPhpCodeArray('ret', [], false, "\t"); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Get' => 'Options'], "\t"); + $getOptions = $this->pc->getPhpCodeArray('ret', [], false, "\t"); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); - $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementId = $fieldElements->getVar('fieldelement_id'); $rpFieldName = $this->getRightString($fieldName); if (5 == $fieldElementId) { - $arrayPush = $pc->getPhpCodeArrayType('ret', 'push', "'{$rpFieldName}'", null, false, "\t\t\t"); - $getOptions .= $pc->getPhpCodeConditions(1, ' == ', "\$this->getVar('{$fieldName}')", $arrayPush, false, "\t\t"); + $arrayPush = $this->pc->getPhpCodeArrayType('ret', 'push', "'{$rpFieldName}'", null, false, "\t\t\t"); + $getOptions .= $this->pc->getPhpCodeConditions("\$this->getVar('{$fieldName}')", ' == ', '1', $arrayPush, false, "\t\t"); } } $getOptions .= $this->getSimpleString('return $ret;', "\t\t"); - $ret .= $pc->getPhpCodeFunction('getOptions' . $ucfTableName, '', $getOptions, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('getOptions' . $ucfTableName, '', $getOptions, 'public ', false, "\t"); return $ret; } /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $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 = $pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); + $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); $content = $this->getHeaderFilesComments($module, null, $namespace); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); + $content .= $this->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 3ff31b95..c90ca222 100644 --- a/class/Files/Classes/ClassFormElements.php +++ b/class/Files/Classes/ClassFormElements.php @@ -1,8 +1,9 @@ -helper = Modulebuilder\Helper::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->tf = Modulebuilder\Files\CreateTableFields::getInstance(); + $this->cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); + } + /** * @static function getInstance - * @param null * * @return ClassFormElements */ @@ -52,7 +90,7 @@ public static function getInstance() * @param $module * @param $table */ - public function initForm($module, $table) + public function initForm($module, $table): void { $this->setModule($module); $this->setTable($table); @@ -67,22 +105,17 @@ public function initForm($module, $table) * @param string $required * @return string */ - private function getXoopsFormText($language, $fieldName, $fieldDefault, $required = 'false') + private function getXoopsFormText($language, $fieldName, $fieldDefault, string $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); if ('' != $fieldDefault) { - $ret = $pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", "\t\t"); - $formText = $cxc->getClassXoopsFormText('', $language, $fieldName, 20, 150, $ccFieldName, true); - $ret .= $cxc->getClassAddElement('form', $formText . $required); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", "\t\t"); + $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 20, 150, $ccFieldName, true); } else { - $ret = $pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); - $formText = $cxc->getClassXoopsFormText('', $language, $fieldName, 50, 255, "this->getVar('{$fieldName}')", true); - $ret .= $cxc->getClassAddElement('form', $formText . $required); + $formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 255, "this->getVar('{$fieldName}')", true); } + $ret .= $this->cxc->getClassAddElement('form', $formText . $required); return $ret; } @@ -92,19 +125,16 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\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); - $ret .= $cxc->getClassAddElement('form', $formTextArea . $required); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'TextArea ' . $ccFieldName, "\t\t"); + $formTextArea = $this->cxc->getClassXoopsFormTextArea('', $language, $fieldName, 4, 47, true); + $ret .= $this->cxc->getClassAddElement('form', $formTextArea . $required); return $ret; } @@ -114,21 +144,21 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $rpFieldName = $tf->getRightString($fieldName); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $ret = $pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t"); - $ret .= $pc->getPhpCodeArray('editorConfigs', null, false, "\t\t"); - $getConfig = $xc->getXcGetConfig('editor_' . $rpFieldName); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $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"); + $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 = [ 'name' => "'{$fieldName}'", 'value' => "\$this->getVar('{$fieldName}', 'e')", @@ -136,13 +166,13 @@ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'f 'cols' => 40, 'width' => "'100%'", 'height' => "'400px'", - 'editor' => $getConfig, + 'editor' => '$editor', ]; foreach ($configs as $c => $d) { - $ret .= $xc->getXcEqualsOperator("\$editorConfigs['{$c}']", $d, null, "\t\t"); + $ret .= $this->xc->getXcEqualsOperator("\$editorConfigs['{$c}']", $d, null, "\t\t"); } - $formEditor = $cxc->getClassXoopsFormEditor('', $language, $fieldName, 'editorConfigs', true); - $ret .= $cxc->getClassAddElement('form', $formEditor . $required); + $formEditor = $this->cxc->getClassXoopsFormEditor('', $language, $fieldName, 'editorConfigs', true); + $ret .= $this->cxc->getClassAddElement('form', $formEditor . $required); return $ret; } @@ -157,34 +187,28 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $stuTableSoleName = mb_strtoupper($tableSoleName); - $ucfFieldName = $tf->getCamelCase($fieldName, true); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $stuTableSoleName = \mb_strtoupper($tableSoleName); + $ucfFieldName = $this->cf->getCamelCase($fieldName, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - if (in_array(5, $fieldElementId) > 1) { - $ret = $pc->getPhpCodeCommentLine('Form Check Box', 'List Options ' . $ccFieldName, $t); - $ret .= $xc->getXcEqualsOperator('$checkOption', '$this->getOptions()'); - $foreach = $cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, '
', $tableSoleName . '_option', '$checkOption', false, $t . "\t"); - $foreach .= $cxc->getClassSetDescription('check' . $ucfFieldName, "{$language}{$stuTableSoleName}_OPTIONS_DESC", $t . "\t"); - $foreach .= $cxc->getClassAddOption('check' . $ucfFieldName, "\$option, {$language}{$stuTableSoleName}_ . strtoupper(\$option)", $t . "\t"); - $ret .= $pc->getPhpCodeForeach("{$tableSoleName}All", false, false, 'option', $foreach, $t); - $intElem = "\$check{$ucfFieldName}{$required}"; - $ret .= $cxc->getClassAddElement('form', $intElem, $t); + 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->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); } else { - $ret = $pc->getPhpCodeCommentLine('Form Check Box', $ccFieldName, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); - $ret .= $cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, (string)$language, $fieldName, "\${$ccFieldName}", false, $t); + $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 .= $cxc->getClassAddOption('check' . $ucfFieldName, $option, $t); - $intElem = "\$check{$ucfFieldName}{$required}"; - $ret .= $cxc->getClassAddElement('form', $intElem, $t); + $ret .= $this->cxc->getClassAddOption('check' . $ucfFieldName, $option, $t); } + $intElem = "\$check{$ucfFieldName}{$required}"; + $ret .= $this->cxc->getClassAddElement('form', $intElem, $t); return $ret; } @@ -198,13 +222,10 @@ 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(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $ret = $pc->getPhpCodeCommentLine('Form Hidden', $ccFieldName, "\t\t"); - $formHidden = $cxc->getClassXoopsFormHidden('', $fieldName, $fieldName, true, true); - $ret .= $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; } @@ -216,48 +237,42 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ucfFieldName = $tf->getCamelCase($fieldName, true); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $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 = $pc->getPhpCodeCommentLine('Form Frameworks Images', 'Files ' . $ccFieldName, $t); - $ret .= $pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName .': Select Uploaded Image', $t); - $ret .= $xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '$get' . $ucfFieldName, "'blank.gif'", $t); - $ret .= $xc->getXcEqualsOperator('$imageDirectory', "'/Frameworks/moduleclasses/icons/32'", null, $t); - $ret .= $cxc->getClassXoopsFormElementTray('imageTray', $language, '
', $t); - $sprintf = $pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$imageDirectory}/"'); - $ret .= $cxc->getClassXoopsFormSelect('imageSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); - $ret .= $xc->getXcXoopsListImgListArray('imageArray', 'XOOPS_ROOT_PATH . $imageDirectory', $t); - $contForeach = $cxc->getClassAddOption('imageSelect', '"{$image1}", $image1', $t . "\t"); - $ret .= $pc->getPhpCodeForeach('imageArray', false, false, 'image1', $contForeach, $t); - $setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . \"\\\", \\\"\\\", \\\"\" . XOOPS_URL . \"\\\")'\""; - $ret .= $cxc->getClassSetExtra('imageSelect', $setExtraParam, $t); - $ret .= $cxc->getClassAddElement('imageTray', '$imageSelect, false', $t); - - $paramLabel = "\"
\""; - $xoopsFormLabel = $cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); - - $ret .= $cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); - $ret .= $pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName .': Upload new image', $t); - $ret .= $cxc->getClassXoopsFormElementTray('fileSelectTray', "''", '
', $t); - $getConfig = $xc->getXcGetConfig('maxsize_image'); - $xoopsFormFile = $cxc->getClassXoopsFormFile('', $languageShort . 'FORM_UPLOAD_NEW', $fieldName, $getConfig, true, ''); - $ret .= $cxc->getClassAddElement('fileSelectTray', $xoopsFormFile, $t); - $xoopsFormLabel1 = $cxc->getClassXoopsFormLabel('', "''", null, true, $t); - $ret .= $cxc->getClassAddElement('fileSelectTray', $xoopsFormLabel1, $t); - $ret .= $cxc->getClassAddElement('imageTray', '$fileSelectTray', $t); - $ret .= $cxc->getClassAddElement('form', "\$imageTray{$required}", $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->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); + $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 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, ''); + $ret .= $this->cxc->getClassAddElement('fileSelectTray', $xoopsFormFile, $t); + $xoopsFormLabel1 = $this->cxc->getClassXoopsFormLabel('', "''", null, true, $t); + $ret .= $this->cxc->getClassAddElement('fileSelectTray', $xoopsFormLabel1, $t); + $ret .= $this->cxc->getClassAddElement('imageTray', '$fileSelectTray', $t); + $ret .= $this->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); return $ret; } @@ -270,50 +285,46 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ucfFieldName = $tf->getCamelCase($fieldName, true); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $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 = $pc->getPhpCodeCommentLine('Form File', $ccFieldName, $t); - $ret .= $pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Select Uploaded File ', $t); - $ret .= $xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '$get' . $ucfFieldName, "'blank.gif'", $t); - $ret .= $xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); - $ret .= $cxc->getClassXoopsFormElementTray('fileTray', $language, '
', $t); - $sprintf = $pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); - $ret .= $cxc->getClassXoopsFormSelect('fileSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); - $ret .= $xc->getXcXoopsListImgListArray('fileArray', 'XOOPS_ROOT_PATH . $fileDirectory', $t); - $contForeach = $cxc->getClassAddOption('fileSelect', '"{$file1}", $file1', $t . "\t"); - $ret .= $pc->getPhpCodeForeach('fileArray', false, false, 'file1', $contForeach, $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(\\\"filelabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\".\$fileDirectory.\"\\\", \\\"\\\", \\\"\".XOOPS_URL.\"\\\")'\""; + //$setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . \XOOPS_URL . \"\\\")'\""; //$ret .= $cc->getClassSetExtra('fileSelect', $setExtraParam, $t); - $ret .= $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 .= $pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Upload new file', $t); - $getConfigSize = $xc->getXcGetConfig('maxsize_file'); - $contIf = $xc->getXcEqualsOperator('$maxsize', $getConfigSize,'', "\t\t\t"); - $xoopsFormFile = $cxc->getClassXoopsFormFile('fileTray', "'
' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); - $contIf .= $cxc->getClassAddElement('fileTray', $xoopsFormFile, $t . "\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 = $cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); - $contIf .= $cxc->getClassAddElement('fileTray', $labelInfo1, $t . "\t"); - $formHidden = $cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, $t, true); - $contElse = $cxc->getClassAddElement('fileTray', $formHidden, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$permissionUpload', null, null, $contIf, $contElse, "\t\t"); - $ret .= $cxc->getClassAddElement('form', "\$fileTray, {$required}", $t); + $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', '', '', $contIf, $contElse, "\t\t"); + $ret .= $this->cxc->getClassAddElement('form', "\$fileTray{$required}", $t); return $ret; } @@ -326,28 +337,24 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Url', 'Text File ' . $ccFieldName, $t); - $ret .= $cxc->getClassXoopsFormElementTray('formUrlFile', $language, '

', $t); - $ret .= $pc->getPhpCodeTernaryOperator('formUrl', '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", $t); - $ret .= $cxc->getClassXoopsFormText('formText', $language . '_UPLOADS', $fieldName, 75, 255, 'formUrl', false, $t); - $ret .= $cxc->getClassAddElement('formUrlFile', '$formText' . $required, $t); - $getConfig = $xc->getXcGetConfig('maxsize_file'); - $xoopsFormFile = $cxc->getClassXoopsFormFile('', $languageShort . 'FORM_UPLOAD', $fieldName, $getConfig, true, ''); - $ret .= $cxc->getClassAddElement('formUrlFile', $xoopsFormFile . $required, $t); - $ret .= $cxc->getClassAddElement('form', '$formUrlFile', $t); + $ret = $this->pc->getPhpCodeCommentLine('Form Url', 'Text File ' . $ccFieldName, $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); + $getConfig = $this->xc->getXcGetConfig('maxsize_file'); + $xoopsFormFile = $this->cxc->getClassXoopsFormFile('', $languageShort . 'FORM_UPLOAD', $fieldName, $getConfig, true, ''); + $ret .= $this->cxc->getClassAddElement('formUrlFile', $xoopsFormFile . $required, $t); + $ret .= $this->cxc->getClassAddElement('form', '$formUrlFile', $t); return $ret; } @@ -363,51 +370,45 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ucfFieldName = $tf->getCamelCase($fieldName, true); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $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 = $pc->getPhpCodeCommentLine('Form Image', $ccFieldName, $t); - $ret .= $pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Select Uploaded Image ', $t); - $ret .= $xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '$get' . $ucfFieldName, "'blank.gif'", $t); - $ret .= $xc->getXcEqualsOperator('$imageDirectory', "'/uploads/{$moduleDirname}/images/{$tableName}'", null, $t); - $ret .= $cxc->getClassXoopsFormElementTray('imageTray', $language, '
', $t); - $sprintf = $pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$imageDirectory}/"'); - $ret .= $cxc->getClassXoopsFormSelect('imageSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); - $ret .= $xc->getXcXoopsListImgListArray('imageArray', 'XOOPS_ROOT_PATH . $imageDirectory', $t); - $contForeach = $cxc->getClassAddOption('imageSelect', '"{$image1}", $image1', $t . "\t"); - $ret .= $pc->getPhpCodeForeach('imageArray', false, false, 'image1', $contForeach, $t); - $setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . \"\\\", \\\"\\\", \\\"\" . XOOPS_URL . \"\\\")'\""; - $ret .= $cxc->getClassSetExtra('imageSelect', $setExtraParam, $t); - $ret .= $cxc->getClassAddElement('imageTray', '$imageSelect, false', $t); - $paramLabel = "\"
\""; - $xoopsFormLabel = $cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); - $ret .= $cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); - $ret .= $pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Upload new image', $t); - $getConfigSize = $xc->getXcGetConfig('maxsize_image'); - $contIf = $xc->getXcEqualsOperator('$maxsize', $getConfigSize,'', "\t\t\t"); - $xoopsFormFile = $cxc->getClassXoopsFormFile('imageTray', "'
' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); - $contIf .= $cxc->getClassAddElement('imageTray', $xoopsFormFile, $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 = $cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); - $contIf .= $cxc->getClassAddElement('imageTray', $labelInfo1, $t . "\t"); - $getConfig = $xc->getXcGetConfig('maxwidth_image'); - $labelInfo2 = $cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_WIDTH', $getConfig . " . ' px'", true, ''); - $contIf .= $cxc->getClassAddElement('imageTray', $labelInfo2, $t . "\t"); - $getConfig = $xc->getXcGetConfig('maxheight_image'); - $labelInfo3 = $cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_HEIGHT', $getConfig . " . ' px'", true, ''); - $contIf .= $cxc->getClassAddElement('imageTray', $labelInfo3, $t . "\t"); - $formHidden = $cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, $t, true); - $contElse = $cxc->getClassAddElement('imageTray', $formHidden, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$permissionUpload', null, null, $contIf, $contElse, "\t\t"); - $ret .= $cxc->getClassAddElement('form', "\$imageTray, {$required}", $t); + $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"); + $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', '', '', $contIf, false, "\t\t"); + $ret .= $this->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); return $ret; } @@ -424,35 +425,31 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form File', 'Upload ' . $ccFieldName, "\t\t"); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "''", "\$this->getVar('{$fieldName}')", "\t\t"); - $uForm = $cxc->getClassXoopsFormElementTray('fileUploadTray', $language, '
', $t); - $uForm .= $xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); - $sprintf = $pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); - $xoopsFormLabel = $cxc->getClassXoopsFormLabel('', $sprintf, $ccFieldName, true, "\t\t", true); - $condIf = $cxc->getClassAddElement('fileUploadTray', $xoopsFormLabel, $t . "\t"); - $uForm .= $pc->getPhpCodeConditions('!$this->isNew()', null, null, $condIf, false, "\t\t\t"); - $getConfig = $xc->getXcGetConfig('maxsize_file'); - $uForm .= $xc->getXcEqualsOperator('$maxsize', $getConfig,'', "\t\t\t"); - $xoopsFormFile = $cxc->getClassXoopsFormFile('', "''", $fieldName, '$maxsize', true, ''); - $uForm .= $cxc->getClassAddElement('fileUploadTray', $xoopsFormFile, $t); + $ret = $this->pc->getPhpCodeCommentLine('Form File:', 'Upload ' . $ccFieldName, "\t\t"); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "''", "\$this->getVar('{$fieldName}')", "\t\t"); + $uForm = $this->cxc->getClassXoopsFormElementTray('fileUploadTray', $language, '
', $t); + $uForm .= $this->xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); + $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()', '', '', $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, ''); + $uForm .= $this->cxc->getClassAddElement('fileUploadTray', $xoopsFormFile, $t); $configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; - $labelInfo1 = $cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); - $uForm .= $cxc->getClassAddElement('fileUploadTray', $labelInfo1, $t ); - $uForm .= $cxc->getClassAddElement('form', "\$fileUploadTray, {$required}", $t); - $formHidden = $cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, "\t\t", true); - $contElse = $cxc->getClassAddElement('form', $formHidden, $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 .= $pc->getPhpCodeConditions('$permissionUpload', null, null, $uForm, $contElse, "\t\t"); + $ret .= $this->pc->getPhpCodeConditions('$permissionUpload', '', '', $uForm, $contElse, "\t\t"); return $ret; } @@ -466,18 +463,14 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Color', 'Picker ' . $ccFieldName, $t); - $getVar = $xc->getXcGetVar('', 'this', $fieldName, true); - $xoopsFormFile = $cxc->getClassXoopsFormColorPicker('', $language, $fieldName, $getVar, true, ''); - $ret .= $cxc->getClassAddElement('form', $xoopsFormFile. $required, $t); + $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); return $ret; } @@ -488,26 +481,22 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ucfTableName = ucfirst($tableName); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ucfTableName = \ucfirst($tableName); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine($ucfTableName, 'handler', $t); - $ret .= $xc->getXcHandlerLine($tableName, $t); - $ret .= $pc->getPhpCodeCommentLine('Form', 'Select ' . $ccFieldName, $t); - $ret .= $cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'Empty'", $t); - $ret .= $cxc->getClassAddOptionArray($ccFieldName . 'Select', "\${$tableName}Handler->getList()", $t); - $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName, 'Handler', $t); + $ret .= $this->xc->getXcHandlerLine($tableName, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Form', 'Select ' . $ccFieldName, $t); + $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'Empty'", $t); + $ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', "\${$tableName}Handler->getList()", $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; } @@ -520,16 +509,16 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Select', 'User ' . $ccFieldName, $t); - $xoopsSelectUser = $cxc->getClassXoopsFormSelectUser('', $language, $fieldName, 'false', $fieldName, true, $t); - $ret .= $cxc->getClassAddElement('form', $xoopsSelectUser . $required, $t); + $ret = $this->pc->getPhpCodeCommentLine('Form Select', 'User ' . $ccFieldName, $t); + $xUser = $this->pc->getPhpCodeGlobals('xoopsUser'); + $ret .= $this->pc->getPhpCodeTernaryOperator('uidCurrent', '\is_object(' . $xUser . ')', $xUser . '->uid()', '0', "\t\t"); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '$uidCurrent', "\$this->getVar('{$fieldName}')", $t); + $xoopsSelectUser = $this->cxc->getClassXoopsFormSelectUser('', $language, $fieldName, 'false', '$' . $ccFieldName, true, $t); + $ret .= $this->cxc->getClassAddElement('form', $xoopsSelectUser . $required, $t); return $ret; } @@ -539,21 +528,18 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Radio', 'Yes/No ' . $ccFieldName, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); - $xoopsRadioYN = $cxc->getClassXoopsFormRadioYN('', $language, $fieldName, $ccFieldName, true, $t); - $ret .= $cxc->getClassAddElement('form', $xoopsRadioYN . $required, $t); + $ret = $this->pc->getPhpCodeCommentLine('Form Radio', 'Yes/No ' . $ccFieldName, $t); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); + $xoopsRadioYN = $this->cxc->getClassXoopsFormRadioYN('', $language, $fieldName, $ccFieldName, true, $t); + $ret .= $this->cxc->getClassAddElement('form', $xoopsRadioYN . $required, $t); return $ret; } @@ -563,21 +549,18 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $ret = $pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); - $xoopsTextDateSelect = $cxc->getClassXoopsFormTextDateSelect('', $language, $fieldName, $fieldName, $ccFieldName, true, $t); - $ret .= $cxc->getClassAddElement('form', $xoopsTextDateSelect . $required, $t); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '\time()', "\$this->getVar('{$fieldName}')", $t); + $xoopsTextDateSelect = $this->cxc->getClassXoopsFormTextDateSelect('', $language, $fieldName, $fieldName, $ccFieldName, true, $t); + $ret .= $this->cxc->getClassAddElement('form', $xoopsTextDateSelect . $required, $t); return $ret; } @@ -587,21 +570,18 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $ret = $pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); - $xoopsTextDateSelect = $cxc->getClassXoopsFormDateTime('', $language, $fieldName, $fieldName, $ccFieldName, true, $t); - $ret .= $cxc->getClassAddElement('form', $xoopsTextDateSelect . $required, $t); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $ret = $this->pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); + $ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '\time()', "\$this->getVar('{$fieldName}')", $t); + $xoopsTextDateSelect = $this->cxc->getClassXoopsFormDateTime('', $language, $fieldName, $fieldName, $ccFieldName, true, $t); + $ret .= $this->cxc->getClassAddElement('form', $xoopsTextDateSelect . $required, $t); return $ret; } @@ -612,25 +592,30 @@ private function getXoopsFormDateTime($language, $fieldName, $required = 'false' * @param $language * @param $moduleDirname * @param $fieldName + * @param $tablePermissions * @param string $required * * @return string */ - private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $required = 'false') + private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, string $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Select', 'Status ' . $ccFieldName, $t); - $ret .= $cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "Constants::STATUS_NONE, {$languageShort}STATUS_NONE", $t); - $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->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $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); + 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->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_BROKEN') . ", {$languageShort}STATUS_BROKEN", $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; } @@ -640,20 +625,17 @@ 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') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $ret = $pc->getPhpCodeCommentLine('Form Text', 'Enter Password ' . $ccFieldName, $t); - $xoopsPassword = $cxc->getClassXoopsFormPassword('', $language, $fieldName, 10, 32, true, $t); - $ret .= $cxc->getClassAddElement('form', $xoopsPassword . $required, $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); + $ret .= $this->cxc->getClassAddElement('form', $xoopsPassword . $required, $t); return $ret; } @@ -667,20 +649,16 @@ private function getXoopsFormPassword($language, $fieldName, $required = 'false' * * @return string */ - private function getXoopsFormSelectCountry($language, $fieldName, $required = 'false') + private function getXoopsFormSelectCountry($language, $fieldName, string $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Select', 'Country ' . $ccFieldName, $t); - $ret .= $cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'', _NONE", $t); - $ret .= $xc->getXcXoopsListCountryList('countryArray', $t); - $ret .= $cxc->getClassAddOptionArray($ccFieldName . 'Select', '$countryArray', $t); - $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $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; } @@ -694,20 +672,16 @@ private function getXoopsFormSelectCountry($language, $fieldName, $required = 'f * * @return string */ - private function getXoopsFormSelectLang($language, $fieldName, $required = 'false') + private function getXoopsFormSelectLang($language, $fieldName, string $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Select', 'Lang ' . $ccFieldName, $t); - $ret .= $cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'', _NONE", $t); - $ret .= $xc->getXcXoopsListLangList('langArray', $t); - $ret .= $cxc->getClassAddOptionArray($ccFieldName . 'Select', '$langArray', $t); - $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $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; } @@ -722,22 +696,44 @@ 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) . '_'; + $t = "\t\t"; + $ret = $this->pc->getPhpCodeCommentLine('Form Radio', $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', \_NONE", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$languageShort}LIST_1", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'2', {$languageShort}LIST_2", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'3', {$languageShort}LIST_3", $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + + return $ret; + } + + /** + * @private function getXoopsFormRadioOnoffline + * + * @param $language + * @param $fieldName + * @param string $required + * + * @return string + */ + private function getXoopsFormRadioOnoffline($language, $fieldName, string $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Radio', $ccFieldName, $t); - $ret .= $pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '0', "\$this->getVar('{$fieldName}')", $t); - $ret .= $cxc->getClassXoopsFormRadio($ccFieldName . 'Select', $language, $fieldName, "{$ccFieldName}", false, $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'0', _NONE", $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$languageShort}LIST_1", $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'2', {$languageShort}LIST_2", $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'3', {$languageShort}LIST_3", $t); - $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $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); + $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; } @@ -753,25 +749,21 @@ private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $requi * * @return string */ - private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, $required = 'false') + private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, string $required = 'false') { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); - $ucfTableName = ucfirst($tableName); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $languageShort = substr($language, 0, 4) . mb_strtoupper($moduleDirname) . '_'; + $ucfTableName = \ucfirst($tableName); + $ccFieldName = $this->cf->getCamelCase($fieldName, false, true); + $languageShort = \mb_substr($language, 0, 5) . \mb_strtoupper($moduleDirname) . '_'; $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine($ucfTableName, 'handler', $t); - $ret .= $xc->getXcHandlerLine($tableName, $t); - $ret .= $pc->getPhpCodeCommentLine('Form', 'Select ' . $ccFieldName, $t); - $ret .= $cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", '5', '', false, $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'0', _NONE", $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$languageShort}LIST_1", $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'2', {$languageShort}LIST_2", $t); - $ret .= $cxc->getClassAddOption($ccFieldName . 'Select', "'3', {$languageShort}LIST_3", $t); - $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName, 'Handler', $t); + $ret .= $this->xc->getXcHandlerLine($tableName, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Form', 'Select ' . $ccFieldName, $t); + $ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", '5', '', false, $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'0', \_NONE", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$languageShort}LIST_1", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'2', {$languageShort}LIST_2", $t); + $ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'3', {$languageShort}LIST_3", $t); + $ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); return $ret; } @@ -782,28 +774,25 @@ 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') { - $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(); - $t = "\t\t"; $ret = ''; - $fElement = $tc->getHandler('fieldelements')->get($fieldElement); - $rpFieldelementName = mb_strtolower(str_replace('Table : ', '', $fElement->getVar('fieldelement_name'))); - $ret .= $pc->getPhpCodeCommentLine('Form Table', $rpFieldelementName, $t); - $ccFieldName = $tf->getCamelCase($fieldName, false, true); - $ret .= $xc->getXcHandlerLine($rpFieldelementName, $t); - $ret .= $cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); - $ret .= $cxc->getClassAddOptionArray($ccFieldName . 'Select', "\${$rpFieldelementName}Handler->getList()", $t); - $ret .= $cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); + $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); + $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); return $ret; } @@ -820,26 +809,22 @@ 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(); - $ucfTopicTableName = ucfirst($topicTableName); - $stlTopicTableName = mb_strtolower($topicTableName); - $ccFieldPid = $tf->getCamelCase($fieldPid, false, true); + $ucfTopicTableName = \ucfirst($topicTableName); + $stlTopicTableName = \mb_strtolower($topicTableName); + $ccFieldPid = $this->cf->getCamelCase($fieldPid, false, true); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Form Table', $ucfTopicTableName, $t); - $ret .= $xc->getXcHandlerLine($stlTopicTableName, $t); - $ret .= $xc->getXcCriteriaCompo('cr' . $ucfTopicTableName, $t); - $ret .= $xc->getXcHandlerCountClear($stlTopicTableName . 'Count', $stlTopicTableName, '$cr' . $ucfTopicTableName, $t); - $contIf = $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/tree', true, false, 'include', $t . "\t"); - $contIf .= $xc->getXcHandlerAllClear($stlTopicTableName . 'All', $stlTopicTableName, '$cr' . $ucfTopicTableName, $t . "\t"); - $contIf .= $cxc->getClassXoopsObjectTree($stlTopicTableName . 'Tree', $stlTopicTableName . 'All', $fieldId, $fieldPid, $t . "\t"); - $contIf .= $cxc->getClassXoopsMakeSelBox($ccFieldPid, $stlTopicTableName . 'Tree', $fieldPid, $fieldMain, '--', $fieldPid, $t . "\t"); - $formLabel = $cxc->getClassXoopsFormLabel('', $language, "\${$ccFieldPid}", true, ''); - $contIf .= $cxc->getClassAddElement('form', $formLabel, $t . "\t"); - $ret .= $pc->getPhpCodeConditions("\${$stlTopicTableName}Count", null, null, $contIf, false, $t); - $ret .= $pc->getPhpCodeUnset('cr' . $ucfTopicTableName, $t); + $ret = $this->pc->getPhpCodeCommentLine('Form Table', $ucfTopicTableName, $t); + $ret .= $this->xc->getXcHandlerLine($stlTopicTableName, $t); + $ret .= $this->xc->getXcCriteriaCompo('cr' . $ucfTopicTableName, $t); + $ret .= $this->xc->getXcHandlerCountClear($stlTopicTableName . 'Count', $stlTopicTableName, '$cr' . $ucfTopicTableName, $t); + $contIf = $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/tree', true, false, 'require', $t . "\t"); + $contIf .= $this->xc->getXcHandlerAllClear($stlTopicTableName . 'All', $stlTopicTableName, '$cr' . $ucfTopicTableName, $t . "\t"); + $contIf .= $this->cxc->getClassXoopsObjectTree($stlTopicTableName . 'Tree', $stlTopicTableName . 'All', $fieldId, $fieldPid, $t . "\t"); + $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", '', '', $contIf, false, $t); + $ret .= $this->pc->getPhpCodeUnset('cr' . $ucfTopicTableName, $t); return $ret; } @@ -848,55 +833,93 @@ 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') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance(); $t = "\t\t"; - $ret = $pc->getPhpCodeCommentLine('Use tag', 'module', $t); - $isDir = $pc->getPhpCodeIsDir("XOOPS_ROOT_PATH . '/modules/tag'"); - $ret .= $pc->getPhpCodeTernaryOperator('dirTag', $isDir, 'true', 'false', $t); - $paramIf = '(' . $xc->getXcGetConfig('usetag') . ' == 1)'; - $condIf = $pc->getPhpCodeTernaryOperator('tagId', '$this->isNew()', '0', "\$this->getVar('{$fieldId}')", $t . "\t"); - $condIf .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'modules/tag/include/formtag', true, false, $type = 'include', $t . "\t"); - $paramElem = $cxc->getClassXoopsFormTag('', 'tag', 60, 255, 'tagId', 0, true, ''); - $condIf .= $cxc->getClassAddElement('form', $paramElem . $required, $t . "\t"); - $ret .= $pc->getPhpCodeConditions($paramIf, ' && ', '$dirTag', $condIf, false, $t); + $ret = $this->pc->getPhpCodeCommentLine('Use tag', 'module', $t); + $isDir = $this->pc->getPhpCodeIsDir("\XOOPS_ROOT_PATH . '/modules/tag'"); + $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, '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); + + return $ret; + } + + /** + * @private function getXoopsFormTextUuid + * + * @param $language + * @param $fieldName + * @param string $required + * @return string + */ + 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"); + $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 + * + * @param $language + * @param $fieldName + * @param string $required + * @return string + */ + 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); return $ret; } /** * @public function renderElements - * @param null + * * @return string */ public function renderElements() { - $tc = Tdmcreate\Helper::getInstance(); - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $ttf = Tdmcreate\Files\CreateTableFields::getInstance(); - $module = $this->getModule(); - $table = $this->getTable(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $languageFunct = $tf->getLanguage($moduleDirname, 'AM'); - //$language_table = $languageFunct . strtoupper($tableName); - $ret = ''; - $fields = $ttf->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order ASC, field_id'); - $fieldId = ''; - $fieldIdTopic = ''; - $fieldPidTopic = ''; - $fieldMainTopic = ''; - $fieldElementId = []; - $counter = 0; - foreach (array_keys($fields) as $f) { + $module = $this->getModule(); + $table = $this->getTable(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $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')); + $fieldId = ''; + $fieldIdTopic = ''; + $fieldPidTopic = ''; + $fieldMainTopic = ''; + $fieldElementId = []; + $tagDone = 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'); @@ -905,86 +928,101 @@ public function renderElements() if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { $fieldId = $fieldName; } - $rpFieldName = $tf->getRightString($fieldName); - $language = $languageFunct . mb_strtoupper($tableSoleName) . '_' . mb_strtoupper($rpFieldName); + $rpFieldName = $this->cf->getRightString($fieldName); + $language = $languageFunct . \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); $required = (1 == $fields[$f]->getVar('field_required')) ? ', true' : ''; - $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); if (1 == $fieldInForm) { - $counter++; // Switch elements switch ($fieldElement) { case 1: break; - case 2: + 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 + case Constants::FIELD_ELE_TEXTREADS: // textbox reads $ret .= $this->getXoopsFormText($language, $fieldName, $fieldDefault, $required); break; - case 3: + case Constants::FIELD_ELE_TEXTAREA: $ret .= $this->getXoopsFormTextArea($language, $fieldName, $required); break; - case 4: + case Constants::FIELD_ELE_DHTMLTEXTAREA: $ret .= $this->getXoopsFormDhtmlTextArea($language, $fieldName, $required); break; - case 5: + case Constants::FIELD_ELE_CHECKBOX: $ret .= $this->getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fieldElementId, $required); break; - case 6: + case Constants::FIELD_ELE_RADIOYN: $ret .= $this->getXoopsFormRadioYN($language, $fieldName, $required); break; - case 7: + 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; - case 8: + case Constants::FIELD_ELE_SELECTUSER: $ret .= $this->getXoopsFormSelectUser($language, $fieldName, $required); break; - case 9: + case Constants::FIELD_ELE_COLORPICKER: $ret .= $this->getXoopsFormColorPicker($language, $fieldName, $required); break; - case 10: + case Constants::FIELD_ELE_IMAGELIST: $ret .= $this->getXoopsFormImageList($language, $moduleDirname, $fieldName, $required); break; - case 11: + case Constants::FIELD_ELE_SELECTFILE: $ret .= $this->getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, $required); break; - case 12: + case Constants::FIELD_ELE_URLFILE: $ret .= $this->getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $required); break; - case 13: + case Constants::FIELD_ELE_UPLOADIMAGE: $ret .= $this->getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, $required); break; - case 14: + case Constants::FIELD_ELE_UPLOADFILE: $ret .= $this->getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required); break; - case 15: + case Constants::FIELD_ELE_TEXTDATESELECT: $ret .= $this->getXoopsFormTextDateSelect($language, $fieldName, $required); break; - case 16: - $ret .= $this->getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $required); + case Constants::FIELD_ELE_SELECTSTATUS: + $ret .= $this->getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required); break; - case 17: + case Constants::FIELD_ELE_PASSWORD: $ret .= $this->getXoopsFormPassword($language, $fieldName, $required); break; - case 18: + case Constants::FIELD_ELE_SELECTCOUNTRY: $ret .= $this->getXoopsFormSelectCountry($language, $fieldName, $required); break; - case 19: + case Constants::FIELD_ELE_SELECTLANG: $ret .= $this->getXoopsFormSelectLang($language, $fieldName, $required); break; - case 20: + case Constants::FIELD_ELE_RADIO: $ret .= $this->getXoopsFormRadio($language, $moduleDirname, $fieldName, $required); break; - case 21: + case Constants::FIELD_ELE_DATETIME: $ret .= $this->getXoopsFormDateTime($language, $fieldName, $required); break; - case 22: + case Constants::FIELD_ELE_SELECTCOMBO: $ret .= $this->getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, $required); break; + case Constants::FIELD_ELE_TEXTUUID: + $ret .= $this->getXoopsFormTextUuid($language, $fieldName, $required); + break; + case Constants::FIELD_ELE_TEXTIP: + $ret .= $this->getXoopsFormTextIp($language, $fieldName, $required); + break; default: // If we use tag module - if (1 == $table->getVar('table_tag')) { + if (!$tagDone && 1 == $table->getVar('table_tag')) { $ret .= $this->getXoopsFormTag($fieldId, $required); + $tagDone = true; } // If we want to hide XoopsFormHidden() or field id if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { @@ -993,16 +1031,16 @@ public function renderElements() break; } - $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); + $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'); - $fieldNameDesc = mb_substr($fieldElementName, mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); - $topicTableName = str_replace(': ', '', $fieldNameDesc); - $fieldsTopics = $ttf->getTableFields($fieldElementMid, $fieldElementTid); - foreach (array_keys($fieldsTopics) as $g) { + $fieldNameDesc = mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); + $topicTableName = \str_replace(': ', '', $fieldNameDesc); + $fieldsTopics = $this->tf->getTableFields($fieldElementMid, $fieldElementTid); + foreach (\array_keys($fieldsTopics) as $g) { $fieldNameTopic = $fieldsTopics[$g]->getVar('field_name'); if ((0 == $g) && (1 == $table->getVar('table_autoincrement'))) { $fieldIdTopic = $fieldNameTopic; diff --git a/class/Files/Classes/ClassHandlerFiles.php b/class/Files/Classes/ClassHandlerFiles.php index b46be306..8e08bd24 100644 --- a/class/Files/Classes/ClassHandlerFiles.php +++ b/class/Files/Classes/ClassHandlerFiles.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + //$this->helper = Modulebuilder\Helper::getInstance(); } /** @@ -59,12 +74,12 @@ public static function getInstance() /** * @public function write * - * @param string $module - * @param string $table + * @param $module + * @param $table * @param mixed $tables * @param $filename */ - public function write($module, $table, $tables, $filename) + public function write($module, $table, $tables, $filename): void { $this->setModule($module); $this->setTable($table); @@ -76,39 +91,36 @@ public function write($module, $table, $tables, $filename) * @public function getClassHandler * * @param string $moduleDirname - * @param string $table + * @param $table * @param string $fieldId - * @param $fieldName * @param string $fieldMain * @param $fieldParentId * @param $fieldElement * @return string */ - private function getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldName, $fieldMain, $fieldParentId, $fieldElement) + private function getClassObjectHandler(string $moduleDirname, $table, string $fieldId, string $fieldMain, $fieldParentId, $fieldElement) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $tableName = $table->getVar('table_name'); - $tableFieldName = $table->getVar('table_fieldname'); - $ucfTableName = ucfirst($tableName); - $multiLineCom = ['Class Object Handler' => $ucfTableName]; - $ret = $pc->getPhpCodeCommentMultiLine($multiLineCom); + $tableName = $table->getVar('table_name'); + $ucfTableName = \ucfirst($tableName); + $multiLineCom = ['Class Object Handler' => $ucfTableName]; + $ret = $this->pc->getPhpCodeCommentMultiLine($multiLineCom); - $cClh = $pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => '\XoopsDatabase $db'], "\t"); + $cClh = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => '\XoopsDatabase $db'], "\t"); $constr = "\t\tparent::__construct(\$db, '{$moduleDirname}_{$tableName}', {$ucfTableName}::class, '{$fieldId}', '{$fieldMain}');\n"; - $cClh .= $pc->getPhpCodeFunction('__construct', '\XoopsDatabase $db', $constr, 'public ', false, "\t"); + $cClh .= $this->pc->getPhpCodeFunction('__construct', '\XoopsDatabase $db', $constr, 'public ', false, "\t"); $cClh .= $this->getClassCreate(); $cClh .= $this->getClassGet(); $cClh .= $this->getClassGetInsertId(); $cClh .= $this->getClassCounter($tableName, $fieldId, $fieldMain); $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); + if ($fieldElement > 16 && \in_array(1, $fieldParentId)) { + //$cClh .= $this->getClassByCategory($moduleDirname, $tableName, $tableFieldName, $fieldId, $fieldName, $fieldMain, $fieldElement); $cClh .= $this->getClassGetTableSolenameById($table, $fieldMain); } - $ret .= $pc->getPhpCodeClass("{$ucfTableName}Handler", $cClh, '\XoopsPersistableObjectHandler'); + $ret .= $this->pc->getPhpCodeClass("{$ucfTableName}Handler", $cClh, '\XoopsPersistableObjectHandler'); return $ret; } @@ -120,11 +132,10 @@ private function getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldN */ private function getClassCreate() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $ret = $pc->getPhpCodeCommentMultiLine(['@param bool' => '$isNew', '' => '', '@return' => 'object'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(['@param bool' => '$isNew', '' => '', '@return' => 'object'], "\t"); $cClhc = $this->getSimpleString('return parent::create($isNew);', "\t\t"); - $ret .= $pc->getPhpCodeFunction('create', '$isNew = true', $cClhc, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('create', '$isNew = true', $cClhc, 'public ', false, "\t"); return $ret; } @@ -136,11 +147,10 @@ private function getClassCreate() */ private function getClassGet() { - $pc = Tdmcreate\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"); + $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 .= $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; } @@ -152,11 +162,10 @@ private function getClassGet() */ private function getClassGetInsertId() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $ret = $pc->getPhpCodeCommentMultiLine(['get inserted' => 'id', '' => '', '@param' => 'null', '@return integer 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 .= $pc->getPhpCodeFunction('getInsertId', '', $cClhgid, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('getInsertId', '', $cClhgid, 'public ', false, "\t"); return $ret; } @@ -172,18 +181,16 @@ private function getClassGetInsertId() */ private function getClassCounter($tableName, $fieldId, $fieldMain) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\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"); - - $critCount = $xc->getXcCriteriaCompo('crCount' . $ucfTableName, "\t\t"); - $paramsCrit = "\$this->get{$ucfTableName}Criteria(\$crCount{$ucfTableName}, \$start, \$limit, \$sort, \$order)"; - $critCount .= $xc->getXcEqualsOperator('$crCount' . $ucfTableName, $paramsCrit, null, "\t\t"); - $critCount .= $this->getSimpleString("return parent::getCount(\$crCount{$ucfTableName});", "\t\t"); - $params = "\$start = 0, \$limit = 0, \$sort = '{$fieldId} ASC, {$fieldMain}', \$order = 'ASC'"; + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Get Count ' . $ucfTableName => 'in the database', '@param string $sort' => '', '@param string $order' => '', '@return' => 'int'], "\t"); - $ret .= $pc->getPhpCodeFunction('getCount' . $ucfTableName, $params, $critCount, 'public ', false, "\t"); + $critCount = $this->xc->getXcCriteriaCompo('crCount' . $ucfTableName, "\t\t"); + $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 = "\$sort = '{$fieldId} ASC, {$fieldMain}', \$order = 'ASC'"; + + $ret .= $this->pc->getPhpCodeFunction('getCount' . $ucfTableName, $params, $critCount, 'public ', false, "\t"); return $ret; } @@ -199,22 +206,21 @@ private function getClassCounter($tableName, $fieldId, $fieldMain) */ private function getClassAll($tableName, $fieldId, $fieldMain) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\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"); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentMultiLine(['Get All ' . $ucfTableName => 'in the database', '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'array'], "\t"); - $critAll = $xc->getXcCriteriaCompo('crAll' . $ucfTableName, "\t\t"); + $critAll = $this->xc->getXcCriteriaCompo('crAll' . $ucfTableName, "\t\t"); $paramsCrit = "\$this->get{$ucfTableName}Criteria(\$crAll{$ucfTableName}, \$start, \$limit, \$sort, \$order)"; - $critAll .= $xc->getXcEqualsOperator('$crAll' . $ucfTableName, $paramsCrit, null, "\t\t"); - $critAll .= $this->getSimpleString("return parent::getAll(\$crAll{$ucfTableName});", "\t\t"); + $critAll .= $this->xc->getXcEqualsOperator('$crAll' . $ucfTableName, $paramsCrit, null, "\t\t"); + $critAll .= $this->getSimpleString("return \$this->getAll(\$crAll{$ucfTableName});", "\t\t"); $params = "\$start = 0, \$limit = 0, \$sort = '{$fieldId} ASC, {$fieldMain}', \$order = 'ASC'"; - $ret .= $pc->getPhpCodeFunction('getAll' . $ucfTableName, $params, $critAll, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction('getAll' . $ucfTableName, $params, $critAll, 'public ', false, "\t"); return $ret; } + /*remark from goffy: 'getClassByCategory' currently not in use*/ /** * @public function getClassByCategory * @@ -227,41 +233,41 @@ private function getClassAll($tableName, $fieldId, $fieldMain) * @param $fieldElement * @return string */ + /* private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, $fieldId, $fieldName, $fieldMain, $fieldElement) { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ucfTableName = ucfirst($tableName); - $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); + $ucfTableName = \ucfirst($tableName); + $fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); $fieldElementName = $fieldElements->getVar('fieldelement_name'); - $fieldNameDesc = ucfirst(mb_substr($fieldElementName, mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName))); - $topicTableName = str_replace(': ', '', $fieldNameDesc); + $fieldNameDesc = \ucfirst(mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName))); + $topicTableName = \str_replace(': ', '', $fieldNameDesc); $lcfTopicTableName = lcfirst($topicTableName); - $ret = $pc->getPhpCodeCommentMultiLine(["Get All {$ucfTableName} By" => "{$fieldNameDesc} Id", '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'array'], "\t"); + $ret = $this->pc->getPhpCodeCommentMultiLine(["Get All {$ucfTableName} By" => "{$fieldNameDesc} Id", '@param int $start' => '', '@param int $limit' => '', '@param string $sort' => '', '@param string $order' => '', '@return' => 'array'], "\t"); - $critAll = $xc->getXcXoopsHandler('groupperm', "\t\t"); + $critAll = $this->xc->getXcXoopsHandler('groupperm', "\t\t"); $param1 = "'{$moduleDirname}_view'"; $param2 = "\$GLOBALS['xoopsUser']->getGroups()"; $param3 = "\$GLOBALS['xoopsModule']->getVar('mid')"; - $critAll .= $xc->getXcGetItemIds($lcfTopicTableName, 'grouppermHandler', $param1, $param2, $param3, "\t\t"); - $critAll .= $xc->getXcCriteriaCompo('crAll' . $ucfTableName, "\t\t"); + $critAll .= $this->xc->getXcGetItemIds($lcfTopicTableName, 'grouppermHandler', $param1, $param2, $param3, "\t\t"); + $critAll .= $this->xc->getXcCriteriaCompo('crAll' . $ucfTableName, "\t\t"); if (false !== mb_strpos($fieldName, 'status')) { - $crit = $xc->getXcCriteria('', "'{$fieldName}'", '0', "'!='", true); - $critAll .= $xc->getXcCriteriaAdd('crAll' . $ucfTableName, $crit, "\t\t"); + $crit = $this->xc->getXcCriteria('', "'{$fieldName}'", '0', "'!='", true); + $critAll .= $this->xc->getXcCriteriaAdd('crAll' . $ucfTableName, $crit, "\t\t"); } $paramsCritAll = "\$this->get{$ucfTableName}Criteria(\$crAll{$ucfTableName}, \$start, \$limit, \$sort, \$order)"; - $critAll .= $xc->getXcEqualsOperator('$crAll' . $ucfTableName, $paramsCritAll, null, "\t\t"); + $critAll .= $this->xc->getXcEqualsOperator('$crAll' . $ucfTableName, $paramsCritAll, null, "\t\t"); - $critAll .= $this->getSimpleString("return parent::getAll(\$crAll{$ucfTableName});", "\t\t"); + $critAll .= $this->getSimpleString("return \$this->getAll(\$crAll{$ucfTableName});", "\t\t"); $params = "\${$tableFieldName}Id, \$start = 0, \$limit = 0, \$sort = '{$fieldId} ASC, {$fieldMain}', \$order = 'ASC'"; - $ret .= $pc->getPhpCodeFunction("getAll{$ucfTableName}By{$fieldNameDesc}Id" . $ucfTableName, $params, $critAll, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction("getAll{$ucfTableName}By{$fieldNameDesc}Id" . $ucfTableName, $params, $critAll, 'public ', false, "\t"); return $ret; + } + */ /** * @public function getClassCriteria @@ -271,20 +277,18 @@ private function getClassByCategory($moduleDirname, $tableName, $tableFieldName, */ private function getClassCriteria($tableName) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\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"); + $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' => '\CriteriaCompo'], "\t"); $paramsAllCriteria = "\$cr{$ucfTableName}, \$start, \$limit, \$sort, \$order"; - - $critSets = $xc->getXcCriteriaSetStart('cr' . $ucfTableName, '$start', "\t\t"); - $critSets .= $xc->getXcCriteriaSetLimit('cr' . $ucfTableName, '$limit', "\t\t"); - $critSets .= $xc->getXcCriteriaSetSort('cr' . $ucfTableName, '$sort', "\t\t"); - $critSets .= $xc->getXcCriteriaSetOrder('cr' . $ucfTableName, '$order', "\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"); - $ret .= $pc->getPhpCodeFunction("get{$ucfTableName}Criteria", $paramsAllCriteria, $critSets, 'private ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction("get{$ucfTableName}Criteria", $paramsAllCriteria, $critSets, 'private ', false, "\t"); return $ret; } @@ -298,53 +302,44 @@ private function getClassCriteria($tableName) */ private function getClassGetTableSolenameById($table, $fieldMain) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); - $ucfTableSoleName = ucfirst($tableSoleName); - $ccTableSoleName = $this->getCamelCase($tableSoleName, true); + $ucfTableSoleName = \ucfirst($tableSoleName); - $ret = $pc->getPhpCodeCommentMultiLine(['Returns the' => $ucfTableSoleName . ' from id', '' => '', '@return' => 'string'], "\t"); - $soleName = $xc->getXcEqualsOperator("\${$tableSoleName}Id", "(int)( \${$tableSoleName}Id )", null, "\t\t"); - $soleName .= $xc->getXcEqualsOperator("\${$tableSoleName}", "''", null, "\t\t"); - $contentIf = $xc->getXcHandlerLine($tableName, "\t\t\t"); - $contentIf .= $xc->getXcHandlerGet($tableName, "\${$tableSoleName}Id", 'Obj', true, false, "\t\t\t"); - $getVar = $xc->getXcGetVar($ccTableSoleName, "{$tableSoleName}Obj", $fieldMain, false, "\t\t\t\t"); - $contentIf .= $pc->getPhpCodeConditions("is_object( \${$tableSoleName}Obj )", '', '', $getVar, false, "\t\t\t"); - $soleName .= $pc->getPhpCodeConditions("\${$tableSoleName}Id", ' > ', '0', $contentIf, false, "\t\t"); - $soleName .= $this->getSimpleString("return \${$tableSoleName};", "\t\t"); + $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', $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"); - $ret .= $pc->getPhpCodeFunction("get{$ucfTableSoleName}FromId", "\${$tableSoleName}Id", $soleName, 'public ', false, "\t"); + $ret .= $this->pc->getPhpCodeFunction("get{$ucfTableSoleName}FromId", "\${$tableSoleName}Id", $soleName, 'public ', false, "\t"); return $ret; } /** * @public function render - * @param null * - * @return bool|string + * @return string */ public function render() { - $tc = Tdmcreate\Helper::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $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')); - $fieldInForm = []; + //$fieldInForm = []; $fieldParentId = []; - $fieldElementId = []; $fieldId = null; - $fieldName = null; $fieldMain = null; $fieldElement = null; - foreach (array_keys($fields) as $f) { + 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 @@ -353,16 +348,13 @@ public function render() $fieldMain = $fieldName; // $fieldMain = fields parameter main field } $fieldElement = $fields[$f]->getVar('field_element'); - - $fieldElements = $tc->getHandler('fieldelements')->get($fieldElement); - $fieldElementId[] = $fieldElements->getVar('fieldelement_id'); } - $namespace = $pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); + $namespace = $this->pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); $content = $this->getHeaderFilesComments($module, null, $namespace); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); - $content .= $this->getClassObjectHandler($moduleDirname, $table, $fieldId, $fieldName, $fieldMain, $fieldParentId, $fieldElement); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); + $content .= $this->getClassObjectHandler($moduleDirname, $table, $fieldId, $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 6c1a7f94..6a9fe6bb 100644 --- a/class/Files/Classes/ClassSpecialFiles.php +++ b/class/Files/Classes/ClassSpecialFiles.php @@ -1,9 +1,12 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -68,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) + public function write($module, string $table, $tables, $filename): void { $this->setModule($module); $this->setTable($table); @@ -82,223 +92,213 @@ public function write($module, $table, $tables, $filename) } /** - * @public function renderPermissionsHandler - * @param null + * @public function render * - * @return bool|string + * @return string */ - public function getGlobalPerms($permId) + public function renderClass() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $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]); + $cCl = $this->pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => ''], "\t"); + $constr = ''; + $cCl .= $this->pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); + $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"); + $getInstance .= $this->pc->getPhpCodeConditions('!$instance', '', '', $instance, false, "\t\t"); + $cCl .= $this->pc->getPhpCodeFunction('getInstance', '', $getInstance, 'public static ', false, "\t"); + $content .= $this->pc->getPhpCodeClass($this->className, $cCl, '\XoopsObject'); + + $this->create($moduleDirname, 'class', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } - $returnTrue = $this->getSimpleString("return true;", "\t\t\t"); - $right = ''; - $cond = ''; - $funcname = ''; - $comment = ''; + /** + * @public function getGlobalPerms + * @param mixed $permId + * + * @return string + */ + public function getGlobalPerms($permId) + { + $module = $this->getModule(); + $moduleDirname = $module->getVar('mod_dirname'); + + $returnTrue = $this->getSimpleString('return true;', "\t\t\t"); + $right = ''; + $cond = ''; + $funcname = ''; + $comment = ''; switch ($permId) { case 4: - $comment .= $pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalApprove', 'returns' => 'right for global approve', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); - $right .= $xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', 4, '$my_group_ids', '$mid', true, "\t\t\t"); - $cond .= $pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\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 .= $pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalSubmit', 'returns' => 'right for global submit', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); - $cond .= $pc->getPhpCodeConditions('$this->getGlobalApprove()', '', '', $returnTrue, false, "\t\t"); - $right .= $xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', 8, '$my_group_ids', '$mid', true, "\t\t\t"); - $cond .= $pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\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"); + $cond .= $this->pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\t"); $funcname .= 'getPermGlobalSubmit'; break; case 16: - $comment .= $pc->getPhpCodeCommentMultiLine(['@public' => 'function permGlobalView', 'returns' => 'right for global view', '' => '', '@param' => 'null', '@return' => 'bool'], "\t"); - $cond .= $pc->getPhpCodeConditions('$this->getGlobalApprove()', '', '', $returnTrue, false, "\t\t"); - $cond .= $pc->getPhpCodeConditions('$this->getGlobalSubmit()', '', '', $returnTrue, false, "\t\t"); - $right .= $xc->getXcCheckRight('$grouppermHandler', $moduleDirname . '_ac', 16, '$my_group_ids', '$mid', true, "\t\t\t"); - $cond .= $pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\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"); + $cond .= $this->pc->getPhpCodeConditions($right, '', '', $returnTrue, false, "\t\t"); $funcname .= 'getPermGlobalView'; break; case 0: default: break; } - $functions = $comment; - $globalContent = $xc->getXcGetGlobal(['xoopsUser', 'xoopsModule'], "\t\t"); - $globalContent .= $xc->getXcEqualsOperator('$currentuid', '0', null, "\t\t"); - - $contIf = $pc->getPhpCodeConditions("\$xoopsUser->isAdmin(\$xoopsModule->mid())", '', '', "\t" . $returnTrue, false, "\t\t\t"); - $contIf .= $xc->getXcEqualsOperator('$currentuid', '$xoopsUser->uid()', null, "\t\t\t"); - $globalContent .= $pc->getPhpCodeConditions('isset($xoopsUser)', ' && ', 'is_object($xoopsUser)', $contIf, false, "\t\t"); - $globalContent .= $xc->getXcXoopsHandler('groupperm', "\t\t"); - $globalContent .= $xc->getXcEqualsOperator('$mid', '$xoopsModule->mid()', null, "\t\t"); - $globalContent .= $xc->getXcXoopsHandler('member', "\t\t"); - - $contIfInt = $xc->getXcEqualsOperator('$my_group_ids', '[XOOPS_GROUP_ANONYMOUS]', null, "\t\t\t"); - $contElseInt = $xc->getXcEqualsOperator('$my_group_ids', '$memberHandler->getGroupsByUser($currentuid);', null, "\t\t\t"); - $globalContent .= $pc->getPhpCodeConditions('0', ' == ', '$currentuid', $contIfInt, $contElseInt, "\t\t"); - $globalContent .= $cond; - $globalContent .= $this->getSimpleString("return false;", "\t\t"); - $functions .= $pc->getPhpCodeFunction($funcname, '', $globalContent, 'public ', false, "\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"); + + $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; } - /** - * @public function render - * @param null - * - * @return bool|string - */ - public function renderClass() - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $namespace = $pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); - $content = $this->getHeaderFilesComments($module, null, $namespace); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); - $content .= $pc->getPhpCodeDefined(); - $content .= $pc->getPhpCodeCommentMultiLine(['Class Object' => $this->className]); - $cCl = $pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); - $constr = ''; - $cCl .= $pc->getPhpCodeFunction('__construct', '', $constr, 'public ', false, "\t"); - $arrGetInstance = ['@static function' => '&getInstance', '' => '', '@param' => 'null']; - $cCl .= $pc->getPhpCodeCommentMultiLine($arrGetInstance, "\t"); - $getInstance = $pc->getPhpCodeVariableClass('static', 'instance', 'false', "\t\t"); - $instance = $xc->getXcEqualsOperator('$instance', 'new self()', null, "\t\t\t"); - $getInstance .= $pc->getPhpCodeConditions('!$instance', '', '', $instance, false, "\t\t"); - $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); - - - - return $this->renderFile(); - } - /** * @public function renderPermissionsHandler - * @param null * - * @return bool|string + * @return string */ public function renderPermissionsHandler() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $namespace = $pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); - $content = $this->getHeaderFilesComments($module, null, $namespace); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); - $content .= $pc->getPhpCodeDefined(); - $content .= $pc->getPhpCodeCommentMultiLine(['Class Object' => $this->className]); - - $constr = $pc->getPhpCodeCommentMultiLine(['Constructor' => '', '' => '', '@param' => 'null'], "\t"); - $constr .= $pc->getPhpCodeFunction('__construct', '', '', 'public ', false, "\t"); - $functions = $constr; - $functions .= $this->getGlobalPerms(4); - $functions .= $this->getGlobalPerms(8); - $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); + $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' => '\XoopsDatabase $db'], "\t"); + $constr .= $this->pc->getPhpCodeFunction('__construct', '\XoopsDatabase $db', '', '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'); + $this->create($moduleDirname, 'class', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } /** - * @public function renderConstants - * @param null + * @public function renderConstantsInterface * - * @return bool|string + * @return string */ - public function renderConstants() + public function renderConstantsInterface() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $module = $this->getModule(); $filename = $this->getFileName(); $tables = $this->getTables(); - $tablePermissions = []; - foreach (array_keys($tables) as $t) { - $tablePermissions[] = $tables[$t]->getVar('table_permissions'); - } - $moduleDirname = $module->getVar('mod_dirname'); - $namespace = $pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); - $contentFile = $this->getHeaderFilesComments($module, null, $namespace); - $contentFile .= $pc->getPhpCodeDefined(); - $contentFile .= $pc->getPhpCodeCommentMultiLine(['Class ' => $this->className]); - $contentClass = $pc->getPhpCodeBlankLine(); - $contentClass .= $pc->getPhpCodeCommentLine('Constants for status', '', "\t"); - $contentClass .= $pc->getPhpCodeConstant("STATUS_NONE ", 0, "\t"); - $contentClass .= $pc->getPhpCodeConstant("STATUS_OFFLINE ", 1, "\t"); - $contentClass .= $pc->getPhpCodeConstant("STATUS_SUBMITTED", 2, "\t"); - $contentClass .= $pc->getPhpCodeConstant("STATUS_APPROVED ", 3, "\t"); - if (in_array(1, $tablePermissions)) { - $constPerm = $pc->getPhpCodeBlankLine(); - $constPerm .= $pc->getPhpCodeCommentLine('Constants for permissions', '', "\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_NONE ", 0, "\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_VIEW ", 1, "\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_SUBMIT ", 2, "\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_APPROVE", 3, "\t"); - $contentClass .= $constPerm; + $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]); + $contentFile = $this->getHeaderFilesComments($module, null, $namespace); + $contentFile .= $this->pc->getPhpCodeCommentMultiLine(['Interface ' => $this->className]); + + $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'); } - $contentClass .= $pc->getPhpCodeBlankLine(); - $contentFile .= $pc->getPhpCodeClass($this->className, $contentClass); - - $this->create($moduleDirname, 'class', $filename, $contentFile, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } - - public function renderConstantsTestInterface() - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $module = $this->getModule(); - $filename = $this->getFileName(); - $tables = $this->getTables(); - $tablePermissions = []; - foreach (array_keys($tables) as $t) { - $tablePermissions[] = $tables[$t]->getVar('table_permissions'); + 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'); } - $moduleDirname = $module->getVar('mod_dirname'); - $namespace = $pc->getPhpCodeNamespace(['XoopsModules', $moduleDirname]); - $contentFile = $this->getHeaderFilesComments($module, null, $namespace); - $contentFile .= $pc->getPhpCodeDefined(); - $contentFile .= $pc->getPhpCodeCommentMultiLine(['Interface ' => $this->className]); - $contentClass = ''; - if (in_array(1, $tablePermissions)) { - $constPerm = $pc->getPhpCodeBlankLine(); - $constPerm .= $pc->getPhpCodeCommentLine('Constants for permissions', '', "\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_NONE ", 0, 'protected static',"\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_VIEW ", 1, 'protected static',"\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_SUBMIT ", 2, 'protected static',"\t"); - $constPerm .= $pc->getPhpCodeConstant("PERM_GLOBAL_APPROVE", 3, 'protected static',"\t"); + 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"); + $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; } - $contentClass .= $pc->getPhpCodeBlankLine(); - $func = $pc->getPhpCodeCommentLine('trigger a warning if invalid "constant" requested', '', "\t\t"); - $if = $pc->getPhpCodeTriggerError("\"Invalid Constant requested ('{\$val}')\"", 'E_USER_WARNING', "\t\t\t"); - $if .= $this->getSimpleString("return false;", "\t\t\t"); - $func .= $pc->getPhpCodeConditions('!isset($$val)', null, null, $if, false, "\t\t"); - $func .= $this->getSimpleString('return self::$$val;', "\t"); - $contentClass .= $pc->getPhpCodeFunction('getConstant', '$val', $func, 'final public static ', false, "\t"); + 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'); + $contentClass .= $constRate; + } + $contentClass .= $this->pc->getPhpCodeBlankLine(); - $contentFile .= $pc->getPhpCodeInterface($this->className, $contentClass); + $contentFile .= $this->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 cdd05ffa..f6172c12 100644 --- a/class/Files/Classes/ClassXoopsCode.php +++ b/class/Files/Classes/ClassXoopsCode.php @@ -1,8 +1,8 @@ -initVar('{$paramLeft}', XOBJ_DTYPE_{$stuParamRight});\n"; + return "{$t}\${$var}->initVar('{$paramLeft}', \XOBJ_DTYPE_{$stuParamRight});\n"; } /** @@ -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,9 +149,9 @@ 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"; + return "{$t}\${$var} = new \XoopsFormElementTray({$param1}, '{$param2}');\n"; } /** @@ -162,16 +159,16 @@ public function getClassXoopsFormElementTray($var, $param1, $param2 = '', $t = " * * @param $var * @param string $param1 - * @param null $param2 + * @param null $param2 * @param bool $isParam * @param string $t * * @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('; + $label = 'new \XoopsFormLabel('; if (false === $useParam) { $params = null != $param2 ? "{$param1}, {$param2}" : $param1; } else { @@ -193,18 +190,18 @@ 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( '; + $file = 'new \XoopsFormFile('; if (false === $isParam) { - $ret = "{$t}\${$var} = {$file}{$param1}, '{$param2}', {$param3} );\n"; + $ret = "{$t}\${$var} = {$file}{$param1}, '{$param2}', {$param3});\n"; } else { - $ret = "{$file}{$param1}, '{$param2}', {$param3} )"; + $ret = "{$file}{$param1}, '{$param2}', {$param3})"; } return $ret; @@ -223,21 +220,21 @@ public function getClassXoopsFormFile($var, $param1, $param2, $param3, $isParam * @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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true); + $hidden = 'new \XoopsFormHidden('; + $getVarHidden = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true); $ret = ''; if (false === $isParam) { - $ret .= "{$t}\${$var} = {$hidden}{$param1}, {$getVarHidden} );\n"; + $ret .= "{$t}\${$var} = {$hidden}{$param1}, {$getVarHidden});\n"; } else { if (false === $isForm) { - $ret .= "{$hidden}{$param1}, {$param2} )"; + $ret .= "{$hidden}{$param1}, {$param2})"; } else { if (false === $useParam) { - $ret .= "{$hidden}'{$param1}', '{$param2}' )"; + $ret .= "{$hidden}'{$param1}', '{$param2}')"; } else { - $ret .= "{$hidden}'{$param1}', \${$param2} )"; + $ret .= "{$hidden}'{$param1}', \${$param2})"; } } } @@ -251,21 +248,21 @@ 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( '; + $text = 'new \XoopsFormText('; if (false === $isParam) { - $ret = "{$t}\${$var} = {$text}{$param1}, '{$param2}', {$param3}, {$param4}, \${$param5} );\n"; + $ret = "{$t}\${$var} = {$text}{$param1}, '{$param2}', {$param3}, {$param4}, \${$param5});\n"; } else { - $ret = "{$text}{$param1}, '{$param2}', {$param3}, {$param4}, \${$param5} )"; + $ret = "{$text}{$param1}, '{$param2}', {$param3}, {$param4}, \${$param5})"; } return $ret; @@ -279,19 +276,19 @@ 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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true); + $area = 'new \XoopsFormTextArea('; + $getVarTextArea = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true, '', ", 'e'"); if (false === $isParam) { - $ret = "{$t}\${$var} = {$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4} );\n"; + $ret = "{$t}\${$var} = {$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4});\n"; } else { - $ret = "{$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4} )"; + $ret = "{$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4})"; } return $ret; @@ -304,18 +301,18 @@ 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( '; + $picker = 'new \XoopsFormColorPicker('; if (false === $isParam) { - $ret = "{$t}\${$var} = {$picker}{$param1}, '{$param2}', {$param3} );\n"; + $ret = "{$t}\${$var} = {$picker}{$param1}, '{$param2}', {$param3});\n"; } else { - $ret = "{$picker}{$param1}, '{$param2}', {$param3} )"; + $ret = "{$picker}{$param1}, '{$param2}', {$param3})"; } return $ret; @@ -328,20 +325,20 @@ public function getClassXoopsFormColorPicker($var, $param1, $param2, $param3, $i * @param $param1 * @param $param2 * @param string $param3 - * @param $param4 - * @param bool $isParam + * @param $ccFieldName + * @param bool $isParam * @param string $t * * @return string */ - public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $param4, $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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); + $user = 'new \XoopsFormSelectUser('; + //$getVarSelectUser = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); if (false === $isParam) { - $ret = "{$t}\${$var} = {$user}{$param1}, '{$param2}', {$param3}, {$getVarSelectUser} );\n"; + $ret = "{$t}\${$var} = {$user}{$param1}, '{$param2}', {$param3}, {$ccFieldName});\n"; } else { - $ret = "{$user}{$param1}, '{$param2}', {$param3}, {$getVarSelectUser} )"; + $ret = "{$user}{$param1}, '{$param2}', {$param3}, {$ccFieldName})"; } return $ret; @@ -355,19 +352,19 @@ public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $pa * @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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); + $tdate = 'new \XoopsFormTextDateSelect('; + $getVarTextDateSelect = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); if (false === $isParam) { - $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect} );\n"; + $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect});\n"; } else { - $ret = "{$tdate}{$param1}, '{$param2}', '', \${$param4} )"; + $ret = "{$tdate}{$param1}, '{$param2}', '', \${$param4})"; } return $ret; @@ -381,19 +378,19 @@ 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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); + $tdate = 'new \XoopsFormDateTime('; + $getVarTextDateSelect = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); if (false === $isParam) { - $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect} );\n"; + $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect});\n"; } else { - $ret = "{$tdate}{$param1}, '{$param2}', '', \${$param4} )"; + $ret = "{$tdate}{$param1}, '{$param2}', '', \${$param4})"; } return $ret; @@ -406,14 +403,14 @@ 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( '; + $editor = 'new \XoopsFormEditor('; if (false === $isParam) { $ret = "{$t}\${$var} = {$editor}{$param1}, '{$param2}', \${$param3});\n"; } else { @@ -430,14 +427,14 @@ 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( '; + $checkBox = 'new \XoopsFormCheckBox('; if (false === $isParam) { $ret = "{$t}\${$var} = {$checkBox}{$param1}, '{$param2}', {$param3});\n"; } else { @@ -454,14 +451,14 @@ 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( '; + $radioYN = 'new \XoopsFormRadioYN('; if (false === $isParam) { $ret = "{$t}\${$var} = {$radioYN}{$param1}, '{$param2}', \${$param3});\n"; } else { @@ -478,14 +475,14 @@ 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( '; + $radioYN = 'new \XoopsFormRadio('; if (false === $isParam) { $ret = "{$t}\${$var} = {$radioYN}{$param1}, '{$param2}', \${$param3});\n"; } else { @@ -504,15 +501,15 @@ 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( '; + $select = 'new \XoopsFormSelect('; if (false === $isParam) { $ret = "{$t}\${$var} = {$select}{$param1}, '{$param2}', \${$param3}{$otherParam});\n"; } else { @@ -530,19 +527,19 @@ 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( '; + $tag = 'new \XoopsFormTag('; if (false === $isParam) { - $ret = "{$t}\${$var} = {$tag}'{$param1}', {$param2}, {$param3}, \${$param4}, {$param5} );\n"; + $ret = "{$t}\${$var} = {$tag}'{$param1}', {$param2}, {$param3}, \${$param4}, {$param5});\n"; } else { - $ret = "{$tag}'{$param1}', {$param2}, {$param3}, \${$param4}, {$param5} )"; + $ret = "{$tag}'{$param1}', {$param2}, {$param3}, \${$param4}, {$param5})"; } return $ret; @@ -556,14 +553,14 @@ 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( '; + $button = 'new \XoopsFormButton('; if (false === $isParam) { $ret = "{$t}\${$var} = {$button}'{$param1}', '{$param2}', {$param3}, '{$param4}');\n"; } else { @@ -576,24 +573,24 @@ 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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); + $tpassword = 'new \XoopsFormPassword('; + $getVarPassword = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true); if (false === $isParam) { - $ret = "{$t}\${$var} = {$tpassword}{$param1}, '{$param2}', '', {$getVarPassword} );\n"; + $ret = "{$t}\${$var} = {$tpassword}{$param1}, '{$param2}', '', {$getVarPassword});\n"; } else { - $ret = "{$tpassword}{$param1}, '{$param2}', {$param3}, {$param4} )"; + $ret = "{$tpassword}{$param1}, '{$param2}', {$param3}, {$param4})"; } return $ret; @@ -608,15 +605,15 @@ 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( '; + $select = 'new \XoopsFormSelectCountry('; if (false === $isParam) { $ret = "{$t}\${$var} = {$select}{$param1}, '{$param2}', \${$param3}{$otherParam});\n"; } else { @@ -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 = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); - $ret = "{$t}\${$var} = \${$anchor}->makeSelBox( '{$param1}', '{$param2}', '{$param3}', {$getVar}, true );\n"; - - return $ret; + $getVar = Modulebuilder\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true); + 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/Classes/index.php b/class/Files/Classes/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Classes/index.php @@ -0,0 +1,2 @@ +xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** @@ -56,11 +66,11 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param $tables + * @param $module + * @param $tables * @param string $filename */ - public function write($module, $tables, $filename) + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setTables($tables); @@ -73,73 +83,73 @@ public function write($module, $tables, $filename) */ private function getConfigCode() { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $tables = $this->getTables(); - $ret = $this->getSimpleString(''); - $ret .= $xc->getXcEqualsOperator('$moduleDirName ', 'basename(dirname(__DIR__))'); - $ret .= $xc->getXcEqualsOperator('$moduleDirNameUpper ', 'mb_strtoupper($moduleDirName)'); + $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) { + $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 . '/{$tableName}',", "\t\t"); } - $ret .= $this->getSimpleString("XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/images',", "\t\t"); - foreach (array_keys($tables) as $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 . '/images/{$tableName}',", "\t\t"); } - $ret .= $this->getSimpleString("XOOPS_UPLOAD_PATH . '/' . \$moduleDirName . '/files',", "\t\t"); - foreach (array_keys($tables) as $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 . '/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"); - foreach (array_keys($tables) as $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("\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; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -148,7 +158,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/Config/index.php b/class/Files/Config/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Config/index.php @@ -0,0 +1,2 @@ +module = $module; } } @@ -85,9 +82,9 @@ public function getModule() * * @param mixed $table */ - public function setTable($table) + public function setTable($table): void { - if (is_object($table) && ($table instanceof Tdmcreate\Tables)) { + if (($table instanceof Modulebuilder\Tables)) { $this->table = $table; } } @@ -107,9 +104,9 @@ public function getTable() * * @param mixed $tables */ - public function setTables($tables) + public function setTables($tables): void { - if (is_array($tables)) { + if (\is_array($tables)) { $this->tables = $tables; } } @@ -129,9 +126,9 @@ public function getTables() * * @param mixed $fields */ - public function setFields($fields) + public function setFields($fields): void { - if (is_object($fields) && ($fields instanceof Tdmcreate\Fields)) { + if (($fields instanceof Modulebuilder\Fields)) { $this->fields = $fields; } } diff --git a/class/Files/CreateArchitecture.php b/class/Files/CreateArchitecture.php index ae9014b1..0facd6c5 100644 --- a/class/Files/CreateArchitecture.php +++ b/class/Files/CreateArchitecture.php @@ -1,8 +1,8 @@ -helper = Modulebuilder\Helper::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); $this->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH); } /** * @static function getInstance * - * @param null - * - * @return Tdmcreate\Files\CreateArchitecture + * @return Modulebuilder\Files\CreateArchitecture */ public static function getInstance() { @@ -65,39 +80,37 @@ public static function getInstance() * * @param $module */ - public function setBaseFoldersFiles($module) + public function setBaseFoldersFiles($module): void { - $helper = Tdmcreate\Helper::getInstance(); - $tf = Tdmcreate\Files\CreateFile::getInstance(); // Module $modId = $module->getVar('mod_id'); // Id of tables - $tables = $tf->getTableTables($modId); + $tables = $this->cf->getTableTables($modId); $table = null; - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $tableId = $tables[$t]->getVar('table_id'); $tableName = $tables[$t]->getVar('table_name'); - $table = $helper->getHandler('Tables')->get($tableId); + $table = $this->helper->getHandler('Tables')->get($tableId); } - $indexFile = XOOPS_UPLOAD_PATH . '/index.html'; - $stlModuleAuthor = str_replace(' ', '', mb_strtolower($module->getVar('mod_author'))); + $indexFile = TDMC_PATH . '/index.php'; + $stlModuleAuthor = \str_replace(' ', '', \mb_strtolower($module->getVar('mod_author'))); $this->setModuleName($module->getVar('mod_dirname')); $uploadPath = $this->getUploadPath(); // Creation of "module" folder in the Directory repository $this->makeDir($uploadPath . '/' . $this->getModuleName()); if (1 != $module->getVar('mod_user')) { - // Copied of index.html file in "root module" folder - $this->copyFile('', $indexFile, 'index.html'); + // Copied of index.php file in "root module" folder + $this->copyFile('', $indexFile, 'index.php'); } if (1 == $module->getVar('mod_admin')) { - // Creation of "admin" folder and index.html file - $this->makeDirAndCopyFile('admin', $indexFile, 'index.html'); + // Creation of "admin" folder and index.php file + $this->makeDirInModule('admin'); } if (1 == $module->getVar('mod_blocks')) { - // Creation of "blocks" folder and index.html file - $this->makeDirAndCopyFile('blocks', $indexFile, 'index.html'); + // Creation of "blocks" folder and index.php file + $this->makeDirAndCopyFile('blocks', $indexFile, 'index.php'); } $language = ('english' !== $GLOBALS['xoopsConfig']['language']) ? $GLOBALS['xoopsConfig']['language'] : 'english'; $copyFiles = [ @@ -119,11 +132,11 @@ public function setBaseFoldersFiles($module) 'preloads' => $indexFile, ]; foreach ($copyFiles as $k => $v) { - // Creation of folders and index.html file - $this->makeDirAndCopyFile($k, $v, 'index.html'); + // Creation of folders and index.php file + $this->makeDirAndCopyFile($k, $v, 'index.php'); } //Copy the logo of the module - $modImage = str_replace(' ', '', mb_strtolower($module->getVar('mod_image'))); + $modImage = \str_replace(' ', '', $module->getVar('mod_image')); $targetImage = 'logoModule.png'; $this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH . '/' . $modImage, $targetImage); @@ -131,23 +144,25 @@ public function setBaseFoldersFiles($module) $targetImage = 'blank.gif'; $this->copyFile('assets/images', TDMC_IMAGE_PATH . '/' . $targetImage, $targetImage); $targetImage = 'blank.png'; - $this->copyFile('assets/images', TDMC_IMAGE_PATH . '/' . $targetImage , $targetImage); + $this->copyFile('assets/images', TDMC_IMAGE_PATH . '/' . $targetImage, $targetImage); // Copy of 'module_author_logo.png' file in uploads dir $logoPng = $stlModuleAuthor . '_logo.png'; $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH . '/' . $logoPng; // If file exists - if (!file_exists($logoGifFrom)) { + 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)) { + $logoPng = 'tdmxoops_logo.png'; + $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); @@ -164,22 +179,22 @@ public function setBaseFoldersFiles($module) } if (!empty($tableName)) { if (1 == $module->getVar('mod_admin') || 1 == $module->getVar('mod_user')) { - // Creation of "templates" folder and index.html file - $this->makeDirAndCopyFile('templates', $indexFile, 'index.html'); + // Creation of "templates" folder and index.php file + $this->makeDirAndCopyFile('templates', $indexFile, 'index.php'); } if (1 == $module->getVar('mod_admin')) { - // Creation of "templates/admin" folder and index.html file - $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html'); + // Creation of "templates/admin" folder and index.php file + $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.php'); } if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) { - // Creation of "templates/blocks" folder and index.html file - $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html'); + // Creation of "templates/blocks" folder and index.php file + $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.php'); } - // Creation of "sql" folder and index.html file - $this->makeDirAndCopyFile('sql', $indexFile, 'index.html'); + // Creation of "sql" folder and index.php file + $this->makeDirAndCopyFile('sql', $indexFile, 'index.php'); if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) { - // Creation of "language/local_language/mail_template" folder and index.html file - $this->makeDirAndCopyFile('language/' . $language . '/mail_template', $indexFile, 'index.html'); + // Creation of "language/local_language/mail_template" folder and index.php file + $this->makeDirAndCopyFile('language/' . $language . '/mail_template', $indexFile, 'index.php'); } } } @@ -187,26 +202,33 @@ public function setBaseFoldersFiles($module) /** * @public function setFilesToBuilding * - * @param string $module + * @param $module * * @return array */ public function setFilesToBuilding($module) { - $helper = Tdmcreate\Helper::getInstance(); - $tf = Tdmcreate\Files\CreateFile::getInstance(); // Module $modId = $module->getVar('mod_id'); $moduleDirname = $module->getVar('mod_dirname'); $icon32 = 'assets/icons/32'; - $tables = $tf->getTableTables($modId); - $files = $tf->getTableMoreFiles($modId); + $tables = $this->cf->getTableTables($modId); + $files = $this->cf->getTableMorefiles($modId); $ret = []; + $templateType = 'defstyle'; // currently no other template style is implemented + + $patterns = [ + \mb_strtolower('modulebuilder') => \mb_strtolower($moduleDirname), + \mb_strtoupper('modulebuilder') => \mb_strtoupper($moduleDirname), + \ucfirst(\mb_strtolower('modulebuilder')) => \ucfirst(\mb_strtolower($moduleDirname)), + ]; + $this->patKeys = \array_keys($patterns); + $this->patValues = \array_values($patterns); - $table = null; - $tableCategory = []; + $table = null; + //$tableCategory = []; //$tableName = []; - $tableAdmin = []; + //$tableAdmin = []; $tableUser = []; $tableBlocks = []; $tableSearch = []; @@ -219,16 +241,17 @@ public function setFilesToBuilding($module) $tablePrint = []; $tableRate = []; $tableRss = []; - $tableSingle = []; - $tableSubmit = []; - $tableVisit = []; + //$tableSingle = []; + //$tableSubmit = []; + //$tableVisit = []; $tableTag = []; - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $tableId = $tables[$t]->getVar('table_id'); $tableName = $tables[$t]->getVar('table_name'); - $tableCategory[] = $tables[$t]->getVar('table_category'); + $tableSoleName = $tables[$t]->getVar('table_solename'); + //$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'); @@ -241,154 +264,227 @@ 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 - $table = $helper->getHandler('Tables')->get($tableId); + $table = $this->helper->getHandler('Tables')->get($tableId); // Copy of tables images file - if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH . '/' . $tableImage)) { + if (\file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH . '/' . $tableImage)) { $this->copyFile($icon32, $uploadTableImage, $tableImage); - } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH . '/' . $tableImage)) { + } elseif (\file_exists($uploadTableImage = \XOOPS_ICONS32_PATH . '/' . $tableImage)) { $this->copyFile($icon32, $uploadTableImage, $tableImage); } // 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')) { + // Default block // 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 - $templatesBlocks = Tdmcreate\Files\Templates\Blocks\TemplatesBlocks::getInstance(); +/* if ($templateType == 'bootstrap') { + $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Bootstrap\TemplatesBlocks::getInstance(); + } else {*/ + $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Defstyle\TemplatesBlocks::getInstance(); + /*}*/ $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')) { // Class Files - $classFiles = Tdmcreate\Files\Classes\ClassFiles::getInstance(); - $classFiles->write($module, $table, $tables, ucfirst($tableName) . '.php'); + $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->write($module, $table, $tables, ucfirst($tableName) . 'handler.php'); + $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 - $userTemplatesPages = Tdmcreate\Files\Templates\User\Pages::getInstance(); +/* if ($templateType == 'bootstrap') { + $userTemplatesPages = Modulebuilder\Files\Templates\User\Bootstrap\Pages::getInstance(); + } else {*/ + $userTemplatesPages = Modulebuilder\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 = Modulebuilder\Files\Templates\User\Bootstrap\PagesList::getInstance(); + } 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') { + $userTemplatesPagesItem = Modulebuilder\Files\Templates\User\Bootstrap\PagesItem::getInstance(); + } 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')) { // User List Templates File - $userTemplatesCategories = Templates\User\Categories::getInstance(); + $userTemplatesCategories = Templates\User\Defstyle\Categories::getInstance(); $userTemplatesCategories->write($module, $table, $moduleDirname . '_' . $tableName . '_cat.tpl'); $ret[] = $userTemplatesCategories->render(); // User List Templates File - $userTemplatesCategoriesList = Templates\User\CategoriesList::getInstance(); + $userTemplatesCategoriesList = Templates\User\Defstyle\CategoriesList::getInstance(); $userTemplatesCategoriesList->write($module, $table, $moduleDirname . '_' . $tableName . '_cat_list' . '.tpl'); $ret[] = $userTemplatesCategoriesList->render(); } + // Creation of notifications files + if (1 === (int)$tables[$t]->getVar('table_notifications')) { + $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance(); + // Language Mail Template Modify File + $languageMailTpl->write($module, $table, $tableSoleName . '_modify_notify.tpl'); + $ret[] = $languageMailTpl->render(); + // Language Mail Template Delete File + $languageMailTpl->write($module, $table, $tableSoleName . '_delete_notify.tpl'); + $ret[] = $languageMailTpl->render(); + // Language Mail Template Approve File + $languageMailTpl->write($module, $table, $tableSoleName . '_approve_notify.tpl'); + $ret[] = $languageMailTpl->render(); + if (1 === (int)$tables[$t]->getVar('table_broken')) { + // Language Mail Template Category File + $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance(); + $languageMailTpl->write($module, $table, $tableSoleName . '_broken_notify.tpl'); + $ret[] = $languageMailTpl->render(); + } + // Creation of notifications files + if (1 === (int)$tables[$t]->getVar('table_comments')) { + // Language Mail Template Category File + $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance(); + $languageMailTpl->write($module, $table, $tableSoleName . '_comment_notify.tpl'); + $ret[] = $languageMailTpl->render(); + } + } } } // Creation of constants - $classSpecialFiles = Tdmcreate\Files\Classes\ClassSpecialFiles::getInstance(); - $classSpecialFiles->write($module, '', $tables, ucfirst('constants') . '.php'); + $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance(); + $classSpecialFiles->write($module, '', $tables, \ucfirst('constants') . '.php'); $classSpecialFiles->className = 'Constants'; - $ret[] = $classSpecialFiles->renderConstants(); + $ret[] = $classSpecialFiles->renderConstantsInterface(); // Creation of permissions - if (in_array(1, $tablePermissions)) { + if (\in_array(1, $tablePermissions)) { // Creation of classes - $classSpecialFiles = Tdmcreate\Files\Classes\ClassSpecialFiles::getInstance(); - $classSpecialFiles->write($module, '', null, ucfirst('permissions') . '.php'); + $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance(); + $classSpecialFiles->write($module, '', null, \ucfirst('permissions') . '.php'); $classSpecialFiles->className = 'Permissions'; - $ret[] = $classSpecialFiles->renderClass(); + $ret[] = $classSpecialFiles->renderClass(); // Creation of classhandlers - $classSpecialFiles = Tdmcreate\Files\Classes\ClassSpecialFiles::getInstance(); - $classSpecialFiles->write($module, '', $permTables, ucfirst('permissionshandler') . '.php'); - $classSpecialFiles->className = 'Permissionshandler'; - $ret[] = $classSpecialFiles->renderPermissionsHandler(); - + $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance(); + $classSpecialFiles->write($module, '', $permTables, \ucfirst('PermissionsHandler') . '.php'); + $classSpecialFiles->className = 'PermissionsHandler'; + $ret[] = $classSpecialFiles->renderPermissionsHandler(); } - foreach (array_keys($files) as $t) { - $fileName = $files[$t]->getVar('file_name'); - $fileExtension = $files[$t]->getVar('file_extension'); - $fileInfolder = $files[$t]->getVar('file_infolder'); - // More File - $moreFiles = Tdmcreate\MoreFiles::getInstance(); - $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension); - $ret[] = $moreFiles->render(); + foreach (\array_keys($files) as $t) { + $fileInfolder = $files[$t]->getVar('file_infolder'); + if (Modulebuilder\Constants::MORE_FILES_TYPE_COPY == $files[$t]->getVar('file_type')) { + $src_file = TDMC_UPLOAD_FILES_PATH . '/' . $files[$t]->getVar('file_upload'); + $dst_file = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleDirname) . '/'; + if ('' !== $fileInfolder) { + if ('/' !== \mb_substr($fileInfolder, -1)) { + $fileInfolder .= '/'; + } + $dst_file .= $fileInfolder; + } + $dst_file .= $files[$t]->getVar('file_upload'); + Modulebuilder\Files\CreateClone::cloneFile($src_file, $dst_file, true, $this->patKeys, $this->patValues); + } else { + $fileName = $files[$t]->getVar('file_name'); + $fileExtension = $files[$t]->getVar('file_extension'); + // More File + $moreFiles = Modulebuilder\Files\CreateMoreFiles::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(); } @@ -396,7 +492,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(); @@ -404,249 +500,285 @@ public function setFilesToBuilding($module) // Include Uninstall File ==> setCommonFiles // Include Update File ==> setCommonFiles - if (in_array(1, $tableBlocks)) { + 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 = Modulebuilder\Files\Admin\AdminBroken::getInstance(); + $adminPermissions->write($module, $tables, 'broken.php'); + $ret[] = $adminPermissions->render(); + // Templates Admin broken File + $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)) { + 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)) { + if (\in_array(1, $tableNotifications)) { // Include Notifications File - $includeNotifications = Tdmcreate\Files\Includes\IncludeNotifications::getInstance(); - $includeNotifications->write($module, $tables, 'notifications.inc.php'); - $ret[] = $includeNotifications->render(); + $includeNotifications = Modulebuilder\Files\Includes\IncludeNotifications::getInstance(); + $includeNotifications->write($module, $tables, 'notification.inc.php'); + $ret[] = $includeNotifications->render(); + $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance(); // Language Mail Template Category File - $languageMailTpl = Tdmcreate\Files\Language\LanguageMailTpl::getInstance(); - $languageMailTpl->write($module, 'category_new_notify.tpl'); + //$languageMailTpl->write($module, $table, 'category_new_notify.tpl'); + //$ret[] = $languageMailTpl->render(); + // Language Mail Template New File + $languageMailTpl->write($module, $table, 'global_new_notify.tpl'); + $ret[] = $languageMailTpl->render(); + // Language Mail Template Modify File + $languageMailTpl->write($module, $table, 'global_modify_notify.tpl'); + $ret[] = $languageMailTpl->render(); + // Language Mail Template Delete File + $languageMailTpl->write($module, $table, 'global_delete_notify.tpl'); $ret[] = $languageMailTpl->render(); + // Language Mail Template Approve File + $languageMailTpl->write($module, $table, 'global_approve_notify.tpl'); + $ret[] = $languageMailTpl->render(); + if (\in_array(1, $tableBroken)) { + // Language Mail Template Broken File + $languageMailTpl->write($module, $table, 'global_broken_notify.tpl'); + $ret[] = $languageMailTpl->render(); + } + if (\in_array(1, $tableComments)) { + // Language Mail Template Broken File + $languageMailTpl->write($module, $table, 'global_comment_notify.tpl'); + $ret[] = $languageMailTpl->render(); + } } // Creation of sql file - if (null != $table->getVar('table_name')) { + if (\count($tables) > 0) { // Sql File - $sqlFile = Tdmcreate\Files\Sql\SqlFile::getInstance(); + $sqlFile = Modulebuilder\Files\Sql\SqlFile::getInstance(); $sqlFile->write($module, 'mysql.sql'); $ret[] = $sqlFile->render(); } // Creation of search file - if (in_array(1, $tableSearch)) { + if (\in_array(1, $tableSearch)) { // 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(); } // Creation of comments files - if (in_array(1, $tableComments)) { - /* - * TODO: are this comment files required? + if (\in_array(1, $tableComments)) { // Include Comments File - $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance(); + $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 - $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->write($module, $table); - $ret[] = $includeComments->renderCommentsNew($module, 'comment_new'); - */ - + //$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(); } - if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) { + 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 = Modulebuilder\Files\Templates\User\Bootstrap\Index::getInstance(); + } else {*/ + $userTemplatesIndex = Modulebuilder\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 = Modulebuilder\Files\Templates\User\Bootstrap\Footer::getInstance(); + } else {*/ + $userTemplatesFooter = Modulebuilder\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 = Modulebuilder\Files\Templates\User\Bootstrap\Header::getInstance(); + } else {*/ + $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(); + if ((1 == $module->getVar('mod_notifications')) && \in_array(1, $tableNotifications)) { + $userNotificationUpdate = Modulebuilder\Files\User\UserNotificationUpdate::getInstance(); $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 - $userTemplatesBroken = Templates\User\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(); - $userPdf->write($module, $table, 'pdf.php'); - $ret[] = $userPdf->render(); - // User Templates Pdf File - $userTemplatesPdf = Tdmcreate\Files\Templates\User\Pdf::getInstance(); - $userTemplatesPdf->write($module, $moduleDirname . '_pdf.tpl'); - $ret[] = $userTemplatesPdf->render(); + if (\in_array(1, $tablePdf)) { + foreach ($tables as $table) { + if ($table->getVar('table_pdf')) { + $tableName = $table->getVar('table_name'); + $userPdf = Modulebuilder\Files\User\UserPdf::getInstance(); + $userPdf->write($module, $table, $tableName . '_pdf.php'); + $ret[] = $userPdf->render(); + // User Templates Pdf File + /*if ($templateType == 'bootstrap') { + $userTemplatesPdf = Modulebuilder\Files\Templates\User\Bootstrap\Pdf::getInstance(); + } else {*/ + $userTemplatesPdf = Modulebuilder\Files\Templates\User\Defstyle\Pdf::getInstance(); + /*}*/ + $userTemplatesPdf->write($module, $table, $moduleDirname . '_' . $tableName . '_pdf.tpl'); + $ret[] = $userTemplatesPdf->render(); + } + } } // User Print File - if (in_array(1, $tablePrint)) { - $userPrint = Tdmcreate\Files\User\UserPrint::getInstance(); - $userPrint->write($module, $table, 'print.php'); - $ret[] = $userPrint->render(); - // User Templates Print File - $userTemplatesPrint = Tdmcreate\Files\Templates\User\UserPrint::getInstance(); - $userTemplatesPrint->write($module, $table, $moduleDirname . '_print.tpl'); - $ret[] = $userTemplatesPrint->render(); + if (\in_array(1, $tablePrint)) { + foreach ($tables as $table) { + if ($table->getVar('table_print')) { + $tableName = $table->getVar('table_name'); + $userPrint = Modulebuilder\Files\User\UserPrint::getInstance(); + $userPrint->write($module, $table, $tableName . '_print.php'); + $ret[] = $userPrint->render(); + // User Templates Print File + /*if ($templateType == 'bootstrap') { + $userTemplatesPrint = Modulebuilder\Files\Templates\User\Bootstrap\UserPrint::getInstance(); + } else {*/ + $userTemplatesPrint = Modulebuilder\Files\Templates\User\Defstyle\UserPrint::getInstance(); + /*}*/ + $userTemplatesPrint->write($module, $table, $moduleDirname . '_' . $tableName . '_print.tpl'); + $ret[] = $userTemplatesPrint->render(); + } + } } - // User Rate File + //TODO: UserSearch has to be adapted - if (in_array(1, $tableRate)) { - $userRate = Tdmcreate\Files\User\UserRate::getInstance(); - $userRate->write($module, $table, 'rate.php'); + + // User Rate File + if (\in_array(1, $tableRate)) { + $userRate = Modulebuilder\Files\User\UserRate::getInstance(); + $userRate->write($module, $tables, 'rate.php'); $ret[] = $userRate->render(); - // User Templates Rate File - $userTemplatesRate = Tdmcreate\Files\Templates\User\Rate::getInstance(); - $userTemplatesRate->write($module, $table, $moduleDirname . '_rate.tpl'); - $ret[] = $userTemplatesRate->render(); + + $this->CopyRatingFiles($moduleDirname); + $ret[] = \_AM_MODULEBUILDER_BUILDING_RATING; } // User Rss File - if (in_array(1, $tableRss)) { - $userRss = Tdmcreate\Files\User\UserRss::getInstance(); + if (\in_array(1, $tableRss)) { + $userRss = Modulebuilder\Files\User\UserRss::getInstance(); $userRss->write($module, $table, 'rss.php'); $ret[] = $userRss->render(); // User Templates Rss File - $userTemplatesRss = Tdmcreate\Files\Templates\User\Rss::getInstance(); + /*if ($templateType == 'bootstrap') { + $userTemplatesRss = Modulebuilder\Files\Templates\User\Bootstrap\Rss::getInstance(); + } else {*/ + $userTemplatesRss = Modulebuilder\Files\Templates\User\Defstyle\Rss::getInstance(); + /*}*/ $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 - $userTemplatesSingle = Tdmcreate\Files\Templates\User\Single::getInstance(); - $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 - $userTemplatesSubmit = Tdmcreate\Files\Templates\User\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(); - $userVisit->write($module, $table, 'visit.php'); - $ret[] = $userVisit->render(); - } // User Tag Files - if (in_array(1, $tableTag)) { - $userListTag = Tdmcreate\Files\User\UserListTag::getInstance(); + if (\in_array(1, $tableTag)) { + $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 - $userTemplatesUserBreadcrumbs = Templates\User\Breadcrumbs::getInstance(); + // User Templates Breadcrumbs File + /*if ($templateType == 'bootstrap') { + $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Bootstrap\Breadcrumbs::getInstance(); + } else {*/ + $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(); @@ -659,31 +791,20 @@ public function setFilesToBuilding($module) * * @param $module */ - public function setCommonFiles($module) + public function setCommonFiles($module): void { - $moduleName = $module->getVar('mod_dirname'); - //$src_path = XOOPS_ROOT_PATH . '/modules/tdmcreate/files'; - //$tmp_path = XOOPS_UPLOAD_PATH . '/tdmcreate/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)), - ]; - - $patKeys = array_keys($patterns); - $patValues = array_values($patterns); + $upl_path = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleName); /* clone complete missing folders */ + $cloneFolders = []; $cloneFolders[] = [ - 'src' => TDMC_PATH . '/commonfiles', + 'src' => TDMC_PATH . '/files/commonfiles', 'dst' => $upl_path, - 'rcode' => true + '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'], $this->patKeys, $this->patValues); } unset($cloneFolders); @@ -694,24 +815,24 @@ public function setCommonFiles($module) $createFolders[] = $upl_path . '/language/english'; } foreach ($createFolders as $folder) { - @mkdir($folder); + @\mkdir($folder); } unset($createFolders); if ('english' !== $GLOBALS['xoopsConfig']['language']) { $cloneFolders[] = [ - 'src' => TDMC_PATH . '/commonfiles/language/english', + 'src' => TDMC_PATH . '/files/commonfiles/language/english', 'dst' => $upl_path . '/language/' . $GLOBALS['xoopsConfig']['language'], - 'rcode' => true + 'rcode' => true, ]; //copy back all language files to english language folder $cloneFolders[] = [ 'src' => $upl_path . '/language/' . $GLOBALS['xoopsConfig']['language'], 'dst' => $upl_path . '/language/english', - 'rcode' => false + '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'], $this->patKeys, $this->patValues); } unset($cloneFolders); } @@ -721,23 +842,44 @@ public function setCommonFiles($module) 'src' => TDMC_PATH . '/config/', 'dst' => $upl_path . '/config/', 'file' => 'admin.yml', - 'rcode' => true + 'rcode' => true, ]; $cloneFiles[] = [ 'src' => TDMC_PATH . '/config/', 'dst' => $upl_path . '/config/', 'file' => 'icons.php', - 'rcode' => true + 'rcode' => true, ]; $cloneFiles[] = [ 'src' => TDMC_PATH . '/config/', 'dst' => $upl_path . '/config/', 'file' => 'paths.php', - 'rcode' => true + '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'], $this->patKeys, $this->patValues); } unset($cloneFiles); } + + /** + * @private function CopyRatingFiles + * + * @param $moduleName + */ + private function CopyRatingFiles($moduleName): void + { + $upl_path = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleName); + + /* clone complete missing folders */ + $cloneFolders[] = [ + 'src' => TDMC_PATH . '/files/ratingfiles', + 'dst' => $upl_path, + 'rcode' => true, + ]; + foreach ($cloneFolders as $folder) { + Modulebuilder\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $this->patKeys, $this->patValues); + } + unset($cloneFolders); + } } diff --git a/class/Files/CreateClone.php b/class/Files/CreateClone.php index 776c1245..2bfb541f 100644 --- a/class/Files/CreateClone.php +++ b/class/Files/CreateClone.php @@ -1,7 +1,6 @@ -$path) { - self::deleteFileFolder($path); - } - return @rmdir($path); - } - }*/ + * + * public static function deleteFileFolder($path) { + * + * if (is_file($path)) { + * return @\unlink($path); + * } + * elseif (\is_dir($path)) { + * $scan = glob(r\trim($path,'/').'/*'); + * foreach($scan as $index=>$path) { + * self::deleteFileFolder($path); + * } + * return @\rmdir($path); + * } + * }*/ // recursive cloning script + /** - * @param $src_path - * @param $dst_path + * @param $src_path + * @param $dst_path * @param bool $replace_code * @param array $patKeys * @param array $patValues */ - public static function cloneFileFolder($src_path, $dst_path, $replace_code = false, $patKeys = [], $patValues =[]) + 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); + $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 != '..' )) { - 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 self::cloneFileFolder($src_path . '/' . $file, $dst_path . '/' . $file, $replace_code, $patKeys, $patValues); } else { @@ -52,31 +58,45 @@ public static function cloneFileFolder($src_path, $dst_path, $replace_code = fal } } } - closedir($dir); + \closedir($dir); } /** - * @param $src_file - * @param $dst_file + * @param $src_file + * @param $dst_file * @param bool $replace_code * @param array $patKeys * @param array $patValues */ - public static function cloneFile($src_file, $dst_file, $replace_code = false, $patKeys = [], $patValues =[]) + 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']; - if (in_array(mb_strtolower(pathinfo($src_file, PATHINFO_EXTENSION)), $noChangeExtensions)) { + 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 - $content = file_get_contents($src_file); - $content = str_replace($patKeys, $patValues, $content); - file_put_contents($dst_file, $content); + // file, read it and replace text + $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); + 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/CreateCodeIndents.php b/class/Files/CreateCodeIndents.php index 3547ee6c..6f95e1cf 100644 --- a/class/Files/CreateCodeIndents.php +++ b/class/Files/CreateCodeIndents.php @@ -1,6 +1,6 @@ -setFileName($fileName); $this->created = $created; $this->notCreated = $notCreated; $this->setMode($mode); $this->setRepositoryPath($moduleDirname); - if (!empty($content) && is_string($content)) { + if (!empty($content) && \is_string($content)) { $this->setContent($content); } - if (isset($subdir) && is_string($subdir)) { + if (isset($subdir) && \is_string($subdir)) { $this->setSubDir($subdir); } } @@ -152,14 +146,14 @@ public function create($moduleDirname, $subdir = null, $fileName = null, $conten * @private function setRepositoryPath * @param string $moduleDirname */ - private function setRepositoryPath($moduleDirname) + private function setRepositoryPath(string $moduleDirname): void { $this->uploadPath = TDMC_UPLOAD_REPOSITORY_PATH . '/' . $moduleDirname; } /** * @private function getRepositoryPath - * @param null + * * @return string */ private function getRepositoryPath() @@ -171,14 +165,14 @@ private function getRepositoryPath() * @private function setSubDir * @param $subdir */ - private function setSubDir($subdir) + private function setSubDir($subdir): void { $this->subdir = $subdir; } /** * @private function getSubDir - * @param null + * * @return string */ private function getSubDir() @@ -191,14 +185,14 @@ private function getSubDir() * * @param $fileName */ - public function setFileName($fileName) + public function setFileName($fileName): void { $this->fileName = $fileName; } /** * @public function getFileName - * @param null + * * @return mixed */ public function getFileName() @@ -210,14 +204,15 @@ public function getFileName() * @private function setContent * @param $content */ - private function setContent($content) + private function setContent($content): void { - $this->content = $content; + //replace tabs by 4 spaces + $this->content = \preg_replace('/\t/', $this->tab, $content); } /** * @private function setContent - * @param null + * * @return string */ private function getContent() @@ -227,19 +222,19 @@ private function getContent() /** * @private function getFolderName - * @param null + * * @return string */ private function getFolderName() { $path = $this->getUploadPath(); - if (mb_strrpos($path, '\\')) { - $str = mb_strrpos($path, '\\'); + if (\mb_strrpos($path, '\\')) { + $str = \mb_strrpos($path, '\\'); if (false !== $str) { - return mb_substr($path, $str + 1, mb_strlen($path)); + return \mb_substr($path, $str + 1, mb_strlen($path)); } - return mb_substr($path, $str, mb_strlen($path)); + return \mb_substr($path, $str, mb_strlen($path)); } //return 'root module'; return false; @@ -247,7 +242,7 @@ private function getFolderName() /** * @public function getUploadPath - * @param null + * * @return string */ private function getUploadPath() @@ -263,7 +258,7 @@ private function getUploadPath() /** * @private function getCreated - * @param null + * * @return bool */ private function getCreated() @@ -273,7 +268,7 @@ private function getCreated() /** * @private function getNotCreated - * @param null + * * @return bool */ private function getNotCreated() @@ -285,14 +280,14 @@ private function getNotCreated() * @private function setMode * @param $mode */ - private function setMode($mode) + private function setMode($mode): void { $this->mode = $mode; } /** * @private function getMode - * @param null + * * @return string */ private function getMode() @@ -305,12 +300,16 @@ private function getMode() * @param string $moduleDirname * @param string $prefix * @param string $suffix - * + * @param bool $addFq //add function qualifier * @return string */ - public function getLanguage($moduleDirname, $prefix = '', $suffix = '') + public function getLanguage(string $moduleDirname, string $prefix = '', string $suffix = '', bool $addFq = true) { - $lang = '_' . $prefix . '_' . mb_strtoupper($moduleDirname); + $lang = ''; + if ($addFq) { + $lang = '\\'; + } + $lang .= '_' . $prefix . '_' . \mb_strtoupper($moduleDirname); $ret = $lang; if (!empty($suffix) || '_' !== $suffix) { $ret = $lang . '_' . $suffix; @@ -327,9 +326,13 @@ public function getLanguage($moduleDirname, $prefix = '', $suffix = '') * * @return string */ - public function getLeftString($string) + public function getLeftString(string $string) { - return mb_substr($string, 0, mb_strpos($string, '_')); + $ret = ''; + if ('' != $string) { + $ret .= \mb_substr($string, 0, (int)\mb_strpos($string, '_')); + } + return $ret; } /** @@ -340,12 +343,12 @@ 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)); - - return $ret; + if ('' != $string) { + if (\mb_strpos($string, '_')) { + $str = \mb_strpos($string, '_'); + if (false !== $str) { + return \mb_substr($string, $str + 1, \mb_strlen($string)); + } } } @@ -355,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); @@ -382,7 +385,11 @@ public function getCamelCase($string, $ucfirst = false, $lcfirst = false) */ public function getUcfirst($string) { - return ucfirst($string); + $ret = ''; + if ('' != $string) { + $ret .= \ucfirst($string); + } + return $ret; } /** @@ -393,7 +400,11 @@ public function getUcfirst($string) */ public function getLcfirst($string) { - return lcfirst($string); + $ret = ''; + if ('' != $string) { + $ret .= \lcfirst($string); + } + return $ret; } /** @@ -404,7 +415,11 @@ public function getLcfirst($string) */ public function getStrToUpper($string) { - return mb_strtoupper($string); + $ret = ''; + if ('' != $string) { + $ret .= \mb_strtoupper($string); + } + return $ret; } /** @@ -415,25 +430,29 @@ public function getStrToUpper($string) */ public function getStrToLower($string) { - return mb_strtolower($string); + $ret = ''; + if ('' != $string) { + $ret .= \mb_strtolower($string); + } + return $ret; } /** - * @public function getInclude - * @param $filename + * @public function getRequire + * @param string $filename * @return string */ - public function getInclude($filename = 'header') + public function getRequire(string $filename = 'header') { return "require __DIR__ . '/{$filename}.php';\n"; } /** - * @public function getIncludeOnce - * @param $filename + * @public function getRequireOnce + * @param string $filename * @return string */ - public function getIncludeOnce($filename = 'header') + public function getRequireOnce(string $filename = 'header') { return "require_once __DIR__ . '/{$filename}.php';\n"; } @@ -457,61 +476,68 @@ 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 = Tdmcreate\Files\CreatePhpCode::getInstance(); - $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'); - $author = $module->getVar('mod_author'); - $credits = $module->getVar('mod_credits'); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $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'); + $author = $module->getVar('mod_author'); + //$credits = $module->getVar('mod_credits'); $authorMail = $module->getVar('mod_author_mail'); $authorWebsiteUrl = $module->getVar('mod_author_website_url'); $license = $module->getVar('mod_license'); - $subversion = $module->getVar('mod_subversion'); - $date = date('D Y-m-d H:i:s'); + //$subversion = $module->getVar('mod_subversion'); + //$date = date('D Y-m-d H:i:s'); if (null === $noPhpFile) { - $ret = " 'module for xoops', '' => '', - '@copyright ' => ' 2020 XOOPS Project (https://xooops.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 ' => date('Y') . ' 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; @@ -519,7 +545,7 @@ public function getHeaderFilesComments($module, $noPhpFile = null, $namespace = /** * @public function renderFile - * @param null + * * @return string */ public function renderFile() @@ -537,20 +563,21 @@ public function renderFile() if ($this->xf->writable()) { // Integration of the content in the file if (!$this->xf->write($this->getContent(), $mode, true)) { - $ret .= sprintf($notCreated, $fileName, $folderName); + $ret .= \sprintf($notCreated, $fileName, $folderName); $GLOBALS['xoopsTpl']->assign('created', false); - exit(); + + return $ret; } // Created - $ret .= sprintf($created, $fileName, $folderName); + $ret .= \sprintf($created, $fileName, $folderName); $GLOBALS['xoopsTpl']->assign('created', true); $this->xf->close(); } else { - $ret .= sprintf($notCreated, $fileName, $folderName); + $ret .= \sprintf($notCreated, $fileName, $folderName); $GLOBALS['xoopsTpl']->assign('created', false); } } else { - $ret .= sprintf($notCreated, $fileName, $folderName); + $ret .= \sprintf($notCreated, $fileName, $folderName); $GLOBALS['xoopsTpl']->assign('created', false); } } diff --git a/class/Files/CreateHtmlCode.php b/class/Files/CreateHtmlCode.php index babeaa67..fb1a2b05 100644 --- a/class/Files/CreateHtmlCode.php +++ b/class/Files/CreateHtmlCode.php @@ -1,8 +1,8 @@ -{$n}"; } elseif ($noClosed) { - $ret = "{$t}<{$tag}{$attr} />{$n}"; - } elseif ($multiLine) { + if ('img' === $tag) { + $ret = "{$t}<{$tag}{$attr} >{$n}"; + } else { + $ret = "{$t}<{$tag}{$attr} />{$n}"; + } + } elseif ($multiLine) { $ret = "{$t}<{$tag}{$attr}>{$n}"; $ret .= "{$content}"; $ret .= "{$t}{$n}"; @@ -84,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) { @@ -103,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}"; } @@ -111,12 +113,13 @@ public function getHtmlEmpty($empty = '', $t = '', $n = '') /** * @public function getHtmlComment * @param string $htmlComment - * @param string $n + * @param string $t + * @param string $n * @return string */ - public function getHtmlComment($htmlComment = '', $n = '') + public function getHtmlComment(string $htmlComment = '', string $t = '', string $n = '') { - return "{$n}"; + return "{$t}{$n}"; } /** @@ -127,15 +130,10 @@ public function getHtmlComment($htmlComment = '', $n = '') * @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); } /** @@ -147,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}"; } /** @@ -164,16 +160,16 @@ public function getHtmlHNumb($content = '', $l = '1', $htmlHClass = '', $t = '', * @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}'" : ''; 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; @@ -187,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}"; @@ -203,12 +199,21 @@ public function getHtmlPre($content = '', $preClass = '', $t = '', $n = "\n") * @param string $spanClass * @param string $t * @param string $n + * @param bool $split * @return string */ - public function getHtmlSpan($content = '', $spanClass = '', $t = '', $n = "\n") + public function getHtmlSpan(string $content = '', string $spanClass = '', string $t = '', string $n = "\n", bool $split = false) { $rSpanClass = ('' != $spanClass) ? " class='{$spanClass}'" : ''; - $ret = "{$t}{$content}{$n}"; + $ret = "{$t}"; + if ($split) { + $ret .= "\n"; + } + $ret .= "{$content}"; + if ($split) { + $ret .= "\n{$t}"; + } + $ret .= "{$n}"; return $ret; } @@ -221,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}"; @@ -235,16 +240,16 @@ public function getHtmlParagraph($content = '', $pClass = '', $t = '', $n = "\n" * @public function getHtmlI * @param string $content * @param string $iClass + * @param string $iId * @param string $t * @param string $n * @return string */ - public function getHtmlI($content = '', $iClass = '', $t = '', $n = "\n") + public function getHtmlI(string $content = '', string $iClass = '', string $iId = '', string $t = '', string $n = "\n") { $rIClass = ('' != $iClass) ? " class='{$iClass}'" : ''; - $ret = "{$t}{$content}{$n}"; - - return $ret; + $rIId = ('' != $iId) ? " id='{$iId}'" : ''; + return "{$t}{$content}{$n}"; } /** @@ -255,7 +260,7 @@ public function getHtmlI($content = '', $iClass = '', $t = '', $n = "\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}"; @@ -273,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}"; @@ -292,15 +297,15 @@ public function getHtmlOl($content = '', $olClass = '', $t = '', $n = "\n") * @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) { - $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; @@ -314,14 +319,14 @@ public function getHtmlLi($content = '', $liClass = '', $t = '', $n = "\n", $sp * @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}'" : ''; return "{$t}{$content}{$n}"; } - /** + /** * @public function getHtmlAnchor * @param string $url * @param string $content @@ -333,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}'" : ''; @@ -348,13 +353,18 @@ 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 = '') + public function getHtmlImage(string $src = 'blank.gif', string $alt = 'blank.gif', string $imgClass = '', string $t = '', string $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; } @@ -367,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}"; @@ -385,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}"; @@ -404,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}"; @@ -424,15 +434,15 @@ public function getHtmlTableTbody($content = '', $tbodyClass = '', $t = '', $n = * @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) { - $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; @@ -446,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}"; @@ -466,17 +476,18 @@ public function getHtmlTableRow($content = '', $trClass = '', $t = '', $n = "\n" * @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}'" : ''; 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; } @@ -490,17 +501,18 @@ public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', $t * @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}'" : ''; 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 34c7bfa5..bfacaac2 100644 --- a/class/Files/CreateMoreFiles.php +++ b/class/Files/CreateMoreFiles.php @@ -1,8 +1,8 @@ -setModule($module); $this->extension = $extension; @@ -85,26 +83,26 @@ public function write($module, $filename, $folder, $extension) } /** - * @private function getMoreFilesPhp + * @private function getMorefilesPhp * * @param string $header * @return string */ - private function getMoreFilesPhp($header = '') + private function getMorefilesPhp(string $header = '') { $ret = "getInclude(); - $ret .= $this->getInclude('footer'); + $ret .= $this->getRequire(); + $ret .= $this->getRequire('footer'); return $ret; } /** - * @private function getMoreFilesTpl + * @private function getMorefilesTpl * @return string */ - private function getMoreFilesTpl() + private function getMorefilesTpl() { $ret = "
\n"; $ret .= "\tPlease! put your template code here\n"; @@ -114,10 +112,10 @@ private function getMoreFilesTpl() } /** - * @private function getMoreFilesHtml + * @private function getMorefilesHtml * @return string */ - private function getMoreFilesHtml() + private function getMorefilesHtml() { $ret = "
\n"; $ret .= "\tPlease! put your Html code here\n"; @@ -127,34 +125,32 @@ private function getMoreFilesHtml() } /** - * @private function getMoreFilesText - * @param null + * @private function getMorefilesText * * @return string */ - private function getMoreFilesText() + private function getMorefilesText() { return "# Please! put your text code here\n"; } /** - * @private function getMoreFilesSql - * @param null + * @private function getMorefilesSql * * @return string */ - private function getMoreFilesSql() + private function getMorefilesSql() { return "# Please! put your sql code here\n"; } /** - * @private function getMoreFilesCss - * @param $header + * @private function getMorefilesCss + * @param string $header * * @return string */ - private function getMoreFilesCss($header = '') + private function getMorefilesCss(string $header = '') { $ret = "@charset \"UTF-8\"\n"; $ret .= "{$header}\n\nPlease! put your css code here\n"; @@ -163,19 +159,18 @@ private function getMoreFilesCss($header = '') } /** - * @private function getMoreFilesDefault - * @param null + * @private function getMorefilesDefault * * @return string */ - private function getMoreFilesDefault() + private function getMorefilesDefault() { return "Default File\n"; } /** * @public function render - * @return bool|string + * @return string */ public function render() { @@ -185,29 +180,29 @@ public function render() $header = $this->getHeaderFilesComments($module, 0); switch ($this->extension) { case 'php': - $content = $this->getMoreFilesPhp($header); + $content = $this->getMorefilesPhp($header); break; case 'tpl': - $content = $this->getMoreFilesTpl(); + $content = $this->getMorefilesTpl(); break; case 'html': - $content = $this->getMoreFilesHtml(); + $content = $this->getMorefilesHtml(); break; case 'text': - $content = $this->getMoreFilesText(); + $content = $this->getMorefilesText(); break; case 'sql': - $content = $this->getMoreFilesSql(); + $content = $this->getMorefilesSql(); break; case 'css': - $content = $this->getMoreFilesCss($header); + $content = $this->getMorefilesCss($header); break; default: - $content = $this->getMoreFilesDefault(); + $content = $this->getMorefilesDefault(); break; } - $this->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..b57e2823 100644 --- a/class/Files/CreatePhpCode.php +++ b/class/Files/CreatePhpCode.php @@ -1,8 +1,8 @@ - $value) { if ('' === $string && '' === $value) { $ret .= "{$t} *\n"; } else { - $ret .= "{$t} * {$string} {$value}\n"; + if ('' === $value) { + $ret .= "{$t} * {$string}\n"; + } else { + $ret .= "{$t} * {$string} {$value}\n"; + } } } $ret .= "{$t} */\n"; @@ -86,45 +92,46 @@ public function getPhpCodeCommentMultiLine($multiLine = [], $t = '') /** * @public function getPhpCodeDefine - * @param $left - * @param $right + * @param $left + * @param $right * * @param string $t * @param bool $leftstr * @return string */ - public function getPhpCodeDefine($left, $right, $t = '', $leftstr = true) + public function getPhpCodeDefine($left, $right, string $t = '', bool $leftstr = true) { - $ret = "{$t}define("; + $ret = "{$t}\define("; if ($leftstr) { $ret .= "'{$left}'"; } else { $ret .= "{$left}"; } $ret .= ", {$right});\n"; + return $ret; } /** * @public function getPhpCodeDefine - * @param $left - * @param $right + * @param string $left + * @param string $right * * @return string */ - public function getPhpCodeDefined($left = 'XOOPS_ROOT_PATH', $right = 'Restricted access') + public function getPhpCodeDefined(string $left = 'XOOPS_ROOT_PATH', string $right = 'Restricted access') { - return "defined('{$left}') || die('{$right}');\n"; + return "\defined('{$left}') || die('{$right}');\n"; } /** * @public function getPhpCodeGlobals * @param $var - * @param $value + * @param string $value * * @return string */ - public function getPhpCodeGlobals($var, $value = '') + public function getPhpCodeGlobals($var, string $value = '') { if ('' != $value) { $ret = "\$GLOBALS['{$var}'] = \${$value};\n"; @@ -138,13 +145,13 @@ public function getPhpCodeGlobals($var, $value = '') /** * @public function getPhpCodeGlobalsVariables * @param $var - * @param $type + * @param string $type * * @return string */ - public function getPhpCodeGlobalsVariables($var = null, $type = 'REQUEST') + public function getPhpCodeGlobalsVariables($var = null, string $type = 'REQUEST') { - $type = mb_strtoupper($type); + $type = \mb_strtoupper($type); switch ($type) { case 'GET': $ret = "\$_GET['{$var}']"; @@ -177,12 +184,12 @@ public function getPhpCodeGlobalsVariables($var = null, $type = 'REQUEST') * @param $string * * @param string $n - * @param string $t + * @param string $r * @return string */ - public function getPhpCodeRemoveCarriageReturn($string, $n = "\n", $t = "\r") + public function getPhpCodeRemoveCarriageReturn($string, string $n = "\n", string $r = "\r") { - return str_replace([(string)$n, (string)$t], '', $string); + return \str_replace([(string)$n, (string)$r], '', $string); } /** @@ -193,24 +200,24 @@ public function getPhpCodeRemoveCarriageReturn($string, $n = "\n", $t = "\r") */ public function getPhpCodeFileExists($filename) { - return "file_exists({$filename})"; + return "\\file_exists({$filename})"; } /** * @public function getPhpCodeIncludeDir * @param $directory * @param $filename - * @param bool $once - * @param bool $isPath + * @param bool $once + * @param bool $isPath * * @param string $type * @param string $t * @return string */ - public function getPhpCodeIncludeDir($directory = null, $filename = null, $once = false, $isPath = false, $type = 'include', $t = '') + public function getPhpCodeIncludeDir($directory = null, $filename = null, bool $once = false, bool $isPath = false, string $type = 'require', string $t = '') { if ('' === $type) { - $type = 'include'; + $type = 'require'; } if (false === $once) { if (!$isPath) { @@ -235,29 +242,38 @@ public function getPhpCodeIncludeDir($directory = null, $filename = null, $once * @param $condition * @param $one * @param $two - * @param $t - Indentation + * @param string $t - Indentation * * @return string */ - public function getPhpCodeTernaryOperator($return, $condition, $one, $two, $t = '') + public function getPhpCodeTernaryOperator($return, $condition, $one, $two, string $t = '') { - return "{$t}\${$return} = {$condition} ? {$one} : {$two};\n"; + $ret = "{$t}\${$return} = {$condition} ?"; + if ('' != $one) { + //not shorthand/elvis + $ret .= " {$one} "; + } + $ret .= ": {$two};\n"; + + return $ret; } /** * @public function getPhpCodeClass - * @param $name - * @param $content - * @param $extends - * @param $type + * @param $name + * @param $content + * @param $extends + * @param $type * + * @param null $implements * @return string */ - public function getPhpCodeClass($name = null, $content = null, $extends = null, $type = null) + public function getPhpCodeClass($name = null, $content = null, $extends = null, $type = null, $implements = null) { $typ = (null != $type) ? "{$type} " : ''; $ext = (null != $extends) ? " extends {$extends}" : ''; - $ret = "{$typ}class {$name}{$ext}\n"; + $imp = (null != $implements) ? " implements {$implements}" : ''; + $ret = "{$typ}class {$name}{$ext}{$imp}\n"; $ret .= '{'; $ret .= $content; $ret .= "}\n"; @@ -267,14 +283,14 @@ public function getPhpCodeClass($name = null, $content = null, $extends = null, /** * @public function getPhpCodeClass - * @param $type + * @param string $type * @param $name - * @param $assign - * @param $t - Indentation + * @param string $assign + * @param string $t - Indentation * * @return string */ - public function getPhpCodeVariableClass($type = 'private', $name = null, $assign = 'null', $t = '') + public function getPhpCodeVariableClass(string $type = 'private', $name = null, string $assign = 'null', string $t = '') { return "{$t}{$type} \${$name} = {$assign};\n"; } @@ -306,11 +322,11 @@ public function getPhpCodeInterface($name = null, $content = null, $extends = nu * @param $params * @param $content * @param $method - * @param bool $isRef + * @param bool $isRef * @param string $t - Indentation * @return string */ - public function getPhpCodeFunction($name = null, $params = null, $content = null, $method = null, $isRef = false, $t = '') + public function getPhpCodeFunction($name = null, $params = null, $content = null, $method = null, bool $isRef = false, string $t = '') { $inClass = (null != $method) ? $method : ''; $ref = (false !== $isRef) ? '&' : ''; @@ -328,21 +344,25 @@ public function getPhpCodeFunction($name = null, $params = null, $content = null * @param string $operator * @param string $type * @param string $contentIf - * @param mixed $contentElse + * @param mixed $contentElse * @param string $t - Indentation * * @param string $conditionElse * @return string */ - public function getPhpCodeConditions($condition = null, $operator = null, $type = null, $contentIf = null, $contentElse = false, $t = '', $conditionElse = '') + public function getPhpCodeConditions(string $condition = '', string $operator = '', string $type = '', string $contentIf = '', $contentElse = false, string $t = '', string $conditionElse = '') { - if (false === $contentElse) { - $ret = "{$t}if ({$condition}{$operator}{$type}) {\n"; - $ret .= $contentIf; - $ret .= "{$t}}\n"; + if ('==' === \trim($operator) || '===' === \trim($operator) || '!=' === \trim($operator) || '!==' === \trim($operator)) { + //yoda conditions + $left = $type; + $right = $condition; } else { - $ret = "{$t}if ({$condition}{$operator}{$type}) {\n"; - $ret .= $contentIf; + $left = $condition; + $right = $type; + } + $ret = "{$t}if ({$left}{$operator}{$right}) {\n"; + $ret .= $contentIf; + if (false !== $contentElse) { if ('' !== $conditionElse) { $ret .= "{$t}} elseif ({$conditionElse}) {\n"; } else { @@ -350,24 +370,24 @@ public function getPhpCodeConditions($condition = null, $operator = null, $type } $ret .= $contentElse; - $ret .= "{$t}}\n"; } + $ret .= "{$t}}\n"; return $ret; } /** * @public function getPhpCodeForeach - * @param string $array + * @param string $array * @param bool|string $arrayKey * @param bool|string $key * @param bool|string $value - * @param string $content + * @param string|null $content * - * @param string $t + * @param string $t * @return string */ - public function getPhpCodeForeach($array, $arrayKey = false, $key = false, $value = false, $content = null, $t = '') + public function getPhpCodeForeach(string $array, $arrayKey = false, $key = false, $value = false, string $content = null, string $t = '') { $vars = ''; $value = '' !== $value ? $value : 'i'; @@ -376,10 +396,10 @@ public function getPhpCodeForeach($array, $arrayKey = false, $key = false, $valu } elseif ((false === $arrayKey) && (false !== $key)) { $vars = "\${$array} as \${$key} => \${$value}"; } elseif ((false !== $arrayKey) && (false === $key)) { - $vars = "array_keys(\${$array}) as \${$value}"; + $vars = "\array_keys(\${$array}) as \${$value}"; } - $ret = "{$t}foreach({$vars}) {\n"; + $ret = "{$t}foreach ({$vars}) {\n"; $ret .= "{$content}"; $ret .= "{$t}}\n"; @@ -397,9 +417,9 @@ public function getPhpCodeForeach($array, $arrayKey = false, $key = false, $valu * @param string $t * @return string */ - public function getPhpCodeFor($var = null, $content = null, $value = null, $initVal = null, $operator = null, $t = '') + public function getPhpCodeFor($var = null, $content = null, $value = null, $initVal = null, $operator = null, string $t = '') { - $ret = "{$t}for(\${$var} = {$initVal}; \${$var} {$operator} \${$value}; \${$var}++) {\n"; + $ret = "{$t}for (\${$var} = {$initVal}; \${$var} {$operator} \${$value}; \${$var}++) {\n"; $ret .= "{$content}"; $ret .= "{$t}}\n"; @@ -412,11 +432,11 @@ public function getPhpCodeFor($var = null, $content = null, $value = null, $init * @param $content * @param $value * @param $operator - * @param $t + * @param string $t * * @return string */ - public function getPhpCodeWhile($var = null, $content = null, $value = null, $operator = null, $t = '') + public function getPhpCodeWhile($var = null, $content = null, $value = null, $operator = null, string $t = '') { $ret = "{$t}while (\${$var} {$operator} {$value}) {\n"; $ret .= "{$t}{$content}"; @@ -428,17 +448,19 @@ public function getPhpCodeWhile($var = null, $content = null, $value = null, $op /** * @public function getPhpCodeSwitch * - * @param $op - * @param $content - * @param $t + * @param $op + * @param $content + * @param string $t * + * @param bool $isParam * @return string */ - public function getPhpCodeSwitch($op = null, $content = null, $t = '') + public function getPhpCodeSwitch($op = null, $content = null, string $t = '', bool $isParam = true) { - $ret = "{$t}switch(\${$op}) {\n"; - $ret .= $content; - $ret .= "{$t}}\n"; + $value = $isParam ? "\${$op}" : $op; + $ret = "{$t}switch ({$value}) {\n"; + $ret .= $content; + $ret .= "{$t}}\n"; return $ret; } @@ -446,37 +468,37 @@ public function getPhpCodeSwitch($op = null, $content = null, $t = '') /** * @public function getPhpCodeCaseSwitch * - * @param $cases - * @param $defaultAfterCase - * @param $default - * @param $t - * + * @param array $cases + * @param bool $defaultAfterCase + * @param string $t + * @param bool $isConst * @return string */ - public function getPhpCodeCaseSwitch($cases = [], $defaultAfterCase = false, $default = false, $t = '') + public function getPhpCodeCaseSwitch(array $cases = [], bool $defaultAfterCase = false, string $t = '', bool $isConst = false) { $ret = ''; $def = "{$t}default:\n"; foreach ($cases as $case => $value) { - $case = is_string($case) ? "'{$case}'" : $case; - if (!empty($case)) { + $case = $isConst || !\is_string($case) ? $case : "'{$case}'"; + if (empty($value)) { + $ret .= "{$t}case {$case}:\n"; + } elseif (!empty($case)) { $ret .= "{$t}case {$case}:\n"; if (false !== $defaultAfterCase) { $ret .= $def; } - if (is_array($value)) { + $lastContent = ''; + if (\is_array($value)) { foreach ($value as $content) { $ret .= "{$content}"; + $lastContent = $content; } } - $ret .= "{$t}break;\n"; + if (0 == strpos(strtolower($lastContent), "\treturn ")) { + $ret .= "{$t}\tbreak;\n"; + } + $defaultAfterCase = false; } - $defaultAfterCase = false; - } - if (false !== $default) { - $ret .= $def; - $ret .= "{$t}{$default}\n"; - $ret .= "{$t}break;\n"; } return $ret; @@ -492,13 +514,23 @@ public function getPhpCodeIsset($var) return "isset(\${$var})"; } + /** + * @public function getPhpCodeIsset + * @param $var + * @return string + */ + public function getPhpCodeIsobject($var) + { + return "\is_object(\${$var})"; + } + /** * @public function getPhpCodeUnset * @param string $var * @param string $t * @return string */ - public function getPhpCodeUnset($var = '', $t = '') + public function getPhpCodeUnset(string $var = '', string $t = '') { return "{$t}unset(\${$var});\n"; } @@ -510,7 +542,7 @@ public function getPhpCodeUnset($var = '', $t = '') */ public function getPhpCodeIsDir($var) { - return "is_dir({$var})"; + return "\is_dir({$var})"; } /** @@ -521,7 +553,7 @@ public function getPhpCodeIsDir($var) */ public function getPhpCodeImplode($left, $right) { - return "implode('{$left}', {$right})"; + return "\implode('{$left}', {$right})"; } /** @@ -532,7 +564,7 @@ public function getPhpCodeImplode($left, $right) */ public function getPhpCodeExplode($left, $right) { - return "explode('{$left}', {$right})"; + return "\\explode('{$left}', {$right})"; } /** @@ -542,7 +574,7 @@ public function getPhpCodeExplode($left, $right) * @param string $t * @return string */ - public function getPhpCodeChmod($var, $perm = '0777', $t = '') + public function getPhpCodeChmod($var, string $perm = '0777', string $t = '') { return "{$t}chmod(\${$var}, {$perm});\n"; } @@ -554,9 +586,9 @@ public function getPhpCodeChmod($var, $perm = '0777', $t = '') * @param string $t * @return string */ - public function getPhpCodeMkdir($var, $perm = '0777', $t = '') + public function getPhpCodeMkdir($var, string $perm = '0777', string $t = '') { - return "{$t}mkdir(\${$var}, {$perm});\n"; + return "{$t}\mkdir(\${$var}, {$perm});\n"; } /** @@ -566,24 +598,24 @@ public function getPhpCodeMkdir($var, $perm = '0777', $t = '') * @param string $t * @return string */ - public function getPhpCodeCopy($file, $newfile = '', $t = '') + public function getPhpCodeCopy($file, string $newfile = '', string $t = '') { - return "{$t}copy({$file}, {$newfile});\n"; + return "{$t}\copy({$file}, {$newfile});\n"; } /** * @public function getPhpCodeArray * @param $var * @param $array - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getPhpCodeArray($var, $array = null, $isParam = false, $t = "\t\t") + public function getPhpCodeArray($var, $array = null, bool $isParam = false, string $t = "\t\t") { $retArray = []; - if (is_array($array) && !empty($array)) { + if (\is_array($array) && !empty($array)) { foreach ($array as $k => $v) { if (is_numeric($k)) { $retArray[] = $v; @@ -591,7 +623,7 @@ public function getPhpCodeArray($var, $array = null, $isParam = false, $t = "\t\ $retArray[] = "{$k} => {$v}"; } } - $arrayContent = implode(', ', $retArray); + $arrayContent = \implode(', ', $retArray); } else { $arrayContent = ''; } @@ -612,18 +644,18 @@ public function getPhpCodeArray($var, $array = null, $isParam = false, $t = "\t\ * @param $type * @param $left * @param $right - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getPhpCodeArrayType($var, $type, $left, $right = null, $isParam = false, $t = "\t\t") + public function getPhpCodeArrayType($var, $type, $left, $right = null, bool $isParam = false, string $t = "\t\t") { $vars = (null != $right) ? "\${$left}, {$right}" : "\${$left}"; if (!$isParam) { - $ret = "{$t}\${$var}[] = array_{$type}({$vars});\n"; + $ret = "{$t}\${$var}[] = \array_{$type}({$vars});\n"; } else { - $ret = "array_{$type}({$vars})"; + $ret = "\array_{$type}({$vars})"; } return $ret; @@ -635,9 +667,9 @@ public function getPhpCodeArrayType($var, $type, $left, $right = null, $isParam * @param string $t * @return string */ - public function getPhpCodeArrayShift($var, $t = '') + public function getPhpCodeArrayShift($var, string $t = '') { - return "{$t}array_shift({$var});\n"; + return "{$t}\array_shift({$var});\n"; } /** @@ -648,7 +680,7 @@ public function getPhpCodeArrayShift($var, $t = '') */ public function getPhpCodeSprintf($left, $right) { - return "sprintf({$left}, {$right})"; + return "\sprintf({$left}, {$right})"; } /** @@ -688,14 +720,14 @@ public function getPhpCodeRawurlencode($var) * @param $str * @param $val * @param string $type - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getPhpCodePregFunzions($var, $exp, $str, $val, $type = 'match', $isParam = false, $t = "\t") + public function getPhpCodePregFunzions($var, $exp, $str, $val, string $type = 'match', bool $isParam = false, string $t = "\t") { - $pregFunz = "preg_{$type}('"; + $pregFunz = "\preg_{$type}('"; if (!$isParam) { $ret = "{$t}\${$var} = {$pregFunz}{$exp}', '{$str}', {$val});\n"; } else { @@ -712,14 +744,14 @@ public function getPhpCodePregFunzions($var, $exp, $str, $val, $type = 'match', * @param $str * @param $value * @param string $type - * @param bool $isParam + * @param bool $isParam * * @param string $t * @return string */ - public function getPhpCodeStrType($left, $var, $str, $value, $type = 'replace', $isParam = false, $t = "\t") + public function getPhpCodeStrType($left, $var, $str, $value, string $type = 'replace', bool $isParam = false, string $t = "\t") { - $strType = "str_{$type}('"; + $strType = "\str_{$type}('"; if (!$isParam) { $ret = "{$t}\${$left} = {$strType}{$var}', '{$str}', {$value});\n"; } else { @@ -733,17 +765,17 @@ public function getPhpCodeStrType($left, $var, $str, $value, $type = 'replace', * @public function getPhpCodeStripTags * @param $left * @param $value - * @param bool $isParam - * + * @param bool $isParam + * @param string $operator * @param string $t * @return string */ - public function getPhpCodeStripTags($left, $value, $isParam = false, $t = '') + public function getPhpCodeStripTags($left, $value, bool $isParam = false, string $t = '', string $operator = '=') { if (!$isParam) { - $ret = "{$t}\${$left} = strip_tags({$value});\n"; + $ret = "{$t}\${$left} " . $operator . " \strip_tags({$value});\n"; } else { - $ret = "strip_tags({$value})"; + $ret = "\strip_tags({$value})"; } return $ret; @@ -752,76 +784,73 @@ public function getPhpCodeStripTags($left, $value, $isParam = false, $t = '') /** * @public function getPhpCodeHtmlentities * @param $entitiesVar - * @param $entitiesQuote + * @param int|string|false $entitiesQuote * @return string */ - public function getPhpCodeHtmlentities($entitiesVar, $entitiesQuote = false) + public function getPhpCodeHtmlentities($entitiesVar, int|string|false $entitiesQuote = false) { $entitiesVar = (false !== $entitiesQuote) ? $entitiesVar . ', ' . $entitiesQuote : $entitiesVar; - $entities = "htmlentities({$entitiesVar})"; - - return $entities; + return "htmlentities({$entitiesVar})"; } /** * @public function getPhpCodeHtmlspecialchars * @param $specialVar - * @param $specialQuote + * @param int|string|false $specialQuote * @return string */ - public function getPhpCodeHtmlspecialchars($specialVar, $specialQuote = false) + public function getPhpCodeHtmlspecialchars($specialVar, int|string|false $specialQuote = false) { $specialVar = (false !== $specialQuote) ? $specialVar . ', ' . $specialQuote : $specialVar; - $specialchars = "htmlspecialchars({$specialVar})"; - - return $specialchars; + return "htmlspecialchars({$specialVar})"; } /** * @public function getPhpCodeNamespace - * @param $dimensions + * @param $dimensions * @param string $t * @param string $n * @return string */ - public function getPhpCodeNamespace($dimensions, $t = '', $n = "\n\n") + public function getPhpCodeNamespace($dimensions, string $t = '', string $n = "\n\n") { - $ret = "\n{$t}namespace "; + $ret = "\n{$t}namespace "; foreach ($dimensions as $key => $dim) { if ($key > 0) { - $ucfDim = ucfirst($dim); - $ret .= "\\{$ucfDim}"; + $ucfDim = \ucfirst($dim); + $ret .= "\\{$ucfDim}"; } else { $ret .= "{$dim}"; } } - $ret .= ";" . $n; + $ret .= ';' . $n; return $ret; } /** * @public function getPhpCodeUseNamespace - * @param $dimensions + * @param $dimensions * @param string $t * @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 "; + $ret = "\n{$t}use "; foreach ($dimensions as $key => $dim) { if ($key > 0) { - $ucfDim = ucfirst($dim); - $ret .= "\\{$ucfDim}"; + $ucfDim = \ucfirst($dim); + $ret .= "\\{$ucfDim}"; } else { $ret .= "{$dim}"; } } - $ret .= ";" . $n; + $ret .= ';' . $n; return $ret; } + /** * @public function getPhpCodeBlankLine * @@ -835,28 +864,27 @@ public function getPhpCodeBlankLine() /** * @public function getPhpCodeConstant * - * @param $const - * @param $value + * @param $const + * @param $value * @param string $t * @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"; + return "{$t}{$type} {$const} = {$value};\n"; } /** * @public function getPhpCodeTriggerError * - * @param $msg - * @param $type + * @param $msg + * @param $type * @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 e2798789..9fee1358 100644 --- a/class/Files/CreateSmartyCode.php +++ b/class/Files/CreateSmartyCode.php @@ -1,9 +1,9 @@ -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}}>"; } @@ -132,11 +129,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(string $language, $const, string $t = '', string $n = '') { - return "{$t}<{\$smarty.const.{$language}{$const}}>"; + return "{$t}<{\$smarty.const.{$language}{$const}}>{$n}"; } /** @@ -144,11 +142,22 @@ public function getSmartyConst($language, $const, $t = '') * @param string $var * @param string $t * @param string $n + * @param string $default + * @param string $escape * @return string */ - public function getSmartySingleVar($var, $t = '', $n = "") + public function getSmartySingleVar(string $var, string $t = '', string $n = '', string $default = 'false', string $escape = '') { - return "{$t}<{\${$var}}>{$n}"; + $ret = "{$t}<{\${$var}"; + if ('' !== $default) { + $ret .= '|default:' . $default; + } + if ('' !== $escape) { + $ret .= '|escape:' . $escape; + } + $ret .= "}>{$n}"; + + return $ret; } /** @@ -157,11 +166,18 @@ public function getSmartySingleVar($var, $t = '', $n = "") * @param string $rightVar * @param string $t * @param string $n + * @param string $default + * @param string $escape * @return string */ - public function getSmartyDoubleVar($leftVar, $rightVar, $t = '', $n = "") + public function getSmartyDoubleVar(string $leftVar, string $rightVar, string $t = '', string $n = '', string $default = 'false', string $escape = '') { - return "{$t}<{\${$leftVar}.{$rightVar}}>{$n}"; + $ret = "{$t}<{\${$leftVar}.{$rightVar}|default:{$default}"; + if ('' !== $escape) { + $ret .= '|escape:' . $escape; + } + $ret .= "}>{$n}"; + return $ret; } /** @@ -169,23 +185,17 @@ 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") + public function getSmartyIncludeFile($moduleDirname, string $fileName = 'header', bool $admin = false, string $t = '', string $n = "\n", string $attributes = '') { - $ret = ''; - if (!$admin && !$q) { - $ret = "{$t}<{include file='db:{$moduleDirname}_{$fileName}.tpl'}>{$n}"; - } elseif ($admin && !$q) { - $ret = "{$t}<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>{$n}"; - } elseif (!$admin && $q) { - $ret = "{$t}<{includeq file='db:{$moduleDirname}_{$fileName}.tpl'}>{$n}"; - } elseif ($admin && $q) { - $ret = "{$t}<{includeq file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>{$n}"; + if (!$admin) { + $ret = "{$t}<{include file='db:{$moduleDirname}_{$fileName}.tpl' {$attributes}}>{$n}"; + } else { + $ret = "{$t}<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl' {$attributes}}>{$n}"; } return $ret; @@ -193,28 +203,29 @@ public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admi /** * @public function getSmartyIncludeFileListSection - * @param $moduleDirname - * @param $fileName - * @param $tableFieldName + * @param $moduleDirname + * @param $fileName + * @param $itemName + * @param $arrayName * @param string $t * @param string $n * @return string */ - public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $tableFieldName, $t = '', $n = '') + public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $itemName, $arrayName, string $t = '', string $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}"; } /** * @public function getSmartyIncludeFileListForeach - * @param $moduleDirname - * @param $fileName - * @param $tableFieldName + * @param $moduleDirname + * @param $fileName + * @param $tableFieldName * @param string $t * @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}"; } @@ -225,38 +236,52 @@ 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 mixed $count + * @param mixed $noSimbol * @param string $t * @param string $n + * @param bool $split + * @param mixed $default * @return string */ - public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '', $n = "\n") + 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') { - 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}"; + $ns = ''; + $ts = ''; + if ($split) { + $ns = $n; + $ts = $t; + } + if (!$count) { + $ret = "{$t}<{if \${$condition}"; + if ('string' === $default) { + $ret .= "|default:''"; + } elseif ('bool' === $default) { + $ret .= '|default:false'; + } elseif ('int' === $default) { + $ret .= '|default:0'; } - $ret .= "{$contentIf}"; - $ret .= "{$t}<{/if}>{$n}"; - } 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 .= "{$operator}{$type}}>{$ns}"; + } elseif (!$noSimbol) { + $ret = "{$t}<{if {$condition}"; + if ('string' === $default) { + $ret .= "|default:''"; + } elseif ('bool' === $default) { + $ret .= '|default:false'; + } elseif ('int' === $default) { + $ret .= '|default:0'; } - $ret .= "{$contentIf}"; - $ret .= "{$t}<{else}>{$n}"; + $ret .= "{$operator}{$type}}>{$ns}"; + } else { + $ret = "{$t}<{if \${$condition}|count{$operator}{$type}}>{$ns}"; + } + $ret .= "{$contentIf}"; + if ($contentElse) { + $ret .= "{$ts}<{else}>{$ns}"; $ret .= "{$contentElse}"; - $ret .= "{$t}<{/if}>{$n}"; } + $ret .= "{$ts}<{/if}>{$n}"; return $ret; } @@ -272,7 +297,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}" : ''; @@ -295,7 +320,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}" : ''; @@ -317,7 +342,7 @@ public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = * @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 e76d75d0..f9a74872 100644 --- a/class/Files/CreateStructure.php +++ b/class/Files/CreateStructure.php @@ -1,8 +1,8 @@ -uploadPath = $path; } @@ -90,7 +82,7 @@ protected function setUploadPath($path) /** * @protected function getUploadPath * - * @return string $path + * @return string */ protected function getUploadPath() { @@ -101,7 +93,7 @@ protected function getUploadPath() * @protected function setModuleName * @param $moduleName */ - protected function setModuleName($moduleName) + protected function setModuleName($moduleName): void { $this->moduleName = $moduleName; } @@ -109,7 +101,7 @@ protected function setModuleName($moduleName) /** * @protected function getModuleName * - * @return string $moduleName + * @return string */ protected function getModuleName() { @@ -121,14 +113,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() { @@ -140,7 +132,7 @@ private function getFolderName() * * @param $fileName */ - private function setFileName($fileName) + private function setFileName($fileName): void { $this->fileName = $fileName; } @@ -148,7 +140,7 @@ private function setFileName($fileName) /** * @private function getFileName * - * @return string $fileName + * @return string */ private function getFileName() { @@ -156,20 +148,18 @@ private function getFileName() } /** - * @private function isDir + * @public function isDir * * @param $dname */ - private function isDir($dname) + public function isDir($dname): void { - if (!is_dir($dname)) { - if (!mkdir($dname, 0755) && !is_dir($dname)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dname)); + if (!\is_dir($dname)) { + 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); } /** @@ -177,43 +167,43 @@ private function isDir($dname) * * @param string $dir */ - protected function makeDir($dir) + protected function makeDir(string $dir): void { - $this->isDir(mb_strtolower(trim($dir))); + $this->isDir(\trim($dir)); } /** - * @protected function isDirEmpty + * function isDirEmpty * * @param string $dir * - * @return string + * @return bool */ - public function isDirEmpty($dir) + public function isDirEmpty(string $dir): bool { - $content = []; - $handle = opendir($dir); - while (false !== ($entry = readdir($handle))) { + $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; - } + \closedir($handle); - return false; + return true; } /** - * @public function addFolderPath + * @private 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): string { $this->setFolderName($folderName); if ($fileName) { @@ -231,7 +221,7 @@ private function addFolderPath($folderName, $fileName = false) * * @param string $dirName */ - public function makeDirInModule($dirName) + public function makeDirInModule(string $dirName): void { $fname = $this->addFolderPath($dirName); $this->makeDir($fname); @@ -244,7 +234,7 @@ public function makeDirInModule($dirName) * @param string $fromFile * @param string $toFile */ - public function makeDirAndCopyFile($folderName, $fromFile, $toFile) + public function makeDirAndCopyFile(string $folderName, string $fromFile, string $toFile): void { $dname = $this->addFolderPath($folderName); $this->makeDir($dname); @@ -258,7 +248,7 @@ public function makeDirAndCopyFile($folderName, $fromFile, $toFile) * @param string $fromFile * @param string $toFile */ - public function copyFile($folderName, $fromFile, $toFile) + public function copyFile(string $folderName, string $fromFile, string $toFile): void { $dname = $this->addFolderPath($folderName); $fname = $this->addFolderPath($folderName, $toFile); @@ -272,14 +262,15 @@ public function copyFile($folderName, $fromFile, $toFile) * @param string $fromFile * @param string $fname */ - public function setCopy($dname, $fromFile, $fname) + public function setCopy(string $dname, string $fromFile, string $fname): void { - if (is_dir($dname)) { + if (\is_dir($dname)) { chmod($dname, 0777); - copy($fromFile, $fname); } 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/CreateTableFields.php b/class/Files/CreateTableFields.php index fa25d71c..ad545c9f 100644 --- a/class/Files/CreateTableFields.php +++ b/class/Files/CreateTableFields.php @@ -1,9 +1,9 @@ -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; @@ -82,32 +82,32 @@ 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_id ASC, field_name', $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 $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; } /** - * @public function getTableFieldElements + * @public function getTableFieldelements * * @param $mId * @param $tId * * @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) { @@ -120,28 +120,28 @@ 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; } /** - * @public function getTableMoreFiles + * @public function getTableMorefiles * * @param $mId * * @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 $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 fe25117a..45820900 100644 --- a/class/Files/CreateXoopsCode.php +++ b/class/Files/CreateXoopsCode.php @@ -1,8 +1,8 @@ -getPhpCodeCaseSwitch($cases, $defaultAfterCase, $default, $t . "\t"); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, $defaultAfterCase, $t . "\t", $isConst); - return $pc->getPhpCodeSwitch($op, $contentSwitch, $t); + return $pc->getPhpCodeSwitch($op, $contentSwitch, $t, $isString); } /** @@ -71,11 +68,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 = ''): string { return "{$t}{$var} {$interlock}= {$value};\n"; } @@ -85,11 +82,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): string { $semicolon = false !== $close ? ';' : ''; @@ -101,30 +98,31 @@ 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 = ''): string { return "{$t}\${$tableName}Obj->setVar('{$fieldName}', {$var});\n"; } /** * @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 = '') + 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}');\n"; + $ret = "{$t}\${$varLeft} = \${$handle}->getVar('{$var}'{$format});\n"; } else { - $ret = "\${$handle}->getVar('{$var}')"; + $ret = "\${$handle}->getVar('{$var}'{$format})"; } return $ret; @@ -132,14 +130,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 = ''): string { return "{$t}\${$varLeft}->addItem({$paramLeft}, {$paramRight});\n"; } @@ -154,7 +152,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 = ''): string { return "{$t}\${$var} = \${$anchor}->getGroupIds({$param1}, {$param2}, {$param3});\n"; } @@ -169,7 +167,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 = ''): string { return "{$t}\${$var} = \${$anchor}->getItemIds({$param1}, {$param2}, {$param3});\n"; } @@ -179,17 +177,26 @@ public function getXcGetItemIds($var = '', $anchor = '', $param1 = null, $param2 * @param $tableName * @param $tableSoleName * @param $fieldName + * @param string $language * @param string $t + * * @return string */ - public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t = '') + public function getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, string $language, string $t = ''): string { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $rightField = $tf->getRightString($fieldName); - $ucfRightField = ucfirst($rightField); - $value = "date_create_from_format(_SHORTDATESTRING, Request::getString('{$fieldName}'))"; - $ret = $this->getXcEqualsOperator("\${$tableSoleName}{$ucfRightField}", $value, null, $t); - $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\${$tableSoleName}{$ucfRightField}->getTimestamp()", $t); + $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; } @@ -200,18 +207,32 @@ 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 = ''): string { - $tf = Tdmcreate\Files\CreateFile::getInstance(); + $tf = Modulebuilder\Files\CreateFile::getInstance(); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); $rightField = $tf->getRightString($fieldName); - $ucfRightField = ucfirst($rightField); + $ucfRightField = \ucfirst($rightField); $request = "Request::getArray('{$fieldName}')"; $var = "\${$tableSoleName}{$ucfRightField}"; $varArr = "\${$tableSoleName}{$ucfRightField}Arr"; $ret = $this->getXcEqualsOperator($varArr, $request, null, $t); - $value = "strtotime({$varArr}['date']) + (int){$varArr}['time']"; + + $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); $ret .= $this->getXcSetVarObj($tableName, $fieldName, $var, $t); @@ -222,24 +243,24 @@ 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 = ''): string { - return $this->getXcSetVarObj($tableName, $fieldName, "Request::getInt('{$fieldName}', 0)", $t); + return $this->getXcSetVarObj($tableName, $fieldName, "Request::getInt('{$fieldName}')", $t); } /** * @public function getXcMediaUploader - * @param $var - * @param $dirPath - * @param $mimetype - * @param $maxsize + * @param $var + * @param $dirPath + * @param $mimetype + * @param $maxsize * @param string $t * @return string */ - public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, $t = '') + public function getXcMediaUploader($var, $dirPath, $mimetype, $maxsize, string $t = ''): string { $mimetypes_file = $this->getXcGetConfig($mimetype); $maxsize_file = $this->getXcGetConfig($maxsize); @@ -251,13 +272,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 = ''): string { return "{$t}\${$var} = {$instance}::getInstance();\n"; } @@ -267,7 +288,7 @@ public function getXcGetInstance($var = '', $instance = '', $t = '') * @param $name * @return string */ - public function getXcGetConfig($name) + public function getXcGetConfig($name): string { return "\$helper->getConfig('{$name}')"; } @@ -275,10 +296,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 = ''): string { return "{$t}\${$lpFieldName}['id'] = \$i;\n"; } @@ -289,10 +310,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 = ''): string { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}All[\$i]->getVar('{$fieldName}');\n"; } @@ -304,9 +325,9 @@ public function getXcGetVarAll($lpFieldName, $rpFieldName, $tableName, $fieldNam * @param string $t * @return string */ - public function getXcHelperGetInstance($moduleDirname, $t = '') + public function getXcHelperGetInstance($moduleDirname, string $t = ''): string { - $ucfModuleDirname = ucfirst($moduleDirname); + $ucfModuleDirname = \ucfirst($moduleDirname); $ret = "{$t}// Get instance of module\n"; $ret .= "{$t}\$helper = \XoopsModules\\{$ucfModuleDirname}\Helper::getInstance();\n"; @@ -321,9 +342,9 @@ 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 = ''): string { - return "{$t}\${$left} = formatTimeStamp({$value}, '{$format}');\n"; + return "{$t}\${$left} = \\formatTimestamp({$value}, '{$format}');\n"; } /** @@ -337,11 +358,11 @@ 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 = ''): string { - $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, ''); + $fieldParent = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldNameParent, true); $ret .= $this->getXcHandlerGet($rpFieldName, $fieldParent, '', $tableNameTopic . 'Handler', false, $t); $ret .= $this->getXcGetVar("\${$lpFieldName}['{$rpFieldName}']", "\${$rpFieldName}", $fieldNameTopic, false, $t); @@ -359,14 +380,14 @@ 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 = ''): string { - $pc = Tdmcreate\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); + $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; } @@ -381,11 +402,11 @@ 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 = ''): string { - $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, ''); + $getVarFromID = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true); $rightGet = $this->getXcAnchorFunction($anchor . 'Handler', 'get' . $var . 'FromId', $getVarFromID); $ret .= $this->getXcEqualsOperator($left, $rightGet, null, $t); @@ -401,15 +422,17 @@ public function getXcGetVarFromID($left, $anchor, $var, $tableName, $fieldName, * @param string $t * @return string */ + /* 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); return $ret; } + */ /** * @public function getXcGetVarUrlFile @@ -419,7 +442,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); } @@ -433,10 +456,10 @@ 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 = ''): string { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $getVar = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true, ''); + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $getVar = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldName, true); return $t . $pc->getPhpCodeStripTags("{$lpFieldName}['{$rpFieldName}']", $getVar, false, $t); } @@ -450,7 +473,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 = ''): string { return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \XoopsUser::getUnameFromId(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; } @@ -464,9 +487,9 @@ 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 = ''): string { - return "{$t}\${$lpFieldName}['{$rpFieldName}'] = formatTimeStamp(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; + return "{$t}\${$lpFieldName}['{$rpFieldName}'] = \\formatTimestamp(\${$tableName}All[\$i]->getVar('{$fieldName}'), 's');\n"; } /** @@ -476,7 +499,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 = ''): string { return "{$t}\$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl';\n"; } @@ -487,30 +510,30 @@ public function getXcXoopsOptionTemplateMain($moduleDirname, $tableName, $t = '' * @param $tableName * @return string */ - public function getXcUserHeader($moduleDirname, $tableName) + public function getXcUserHeader($moduleDirname, $tableName): string { - $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); + $ret .= $pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'header', true); return $ret; } /** * @public function getXcPermissionsHeader - * @param null + * * @return string */ - public function getXcPermissionsHeader() + public function getXcPermissionsHeader(): string { - $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 .= $pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); $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); + $elseGroups = $this->getXcEqualsOperator('$groups', '\XOOPS_GROUP_ANONYMOUS'); + $ret .= $pc->getPhpCodeConditions('\is_object($xoopsUser)', '', '', $groups, $elseGroups); return $ret; } @@ -522,10 +545,10 @@ public function getXcPermissionsHeader() * * @return string */ - public function getXcGetFieldId($fields) + public function getXcGetFieldId($fields): string { $fieldId = 'id'; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { $fieldId = $fieldName; @@ -542,10 +565,10 @@ public function getXcGetFieldId($fields) * * @return string */ - public function getXcGetFieldName($fields) + public function getXcGetFieldName($fields): string { $fieldName = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); } @@ -559,10 +582,10 @@ public function getXcGetFieldName($fields) * * @return string */ - public function getXcGetFieldParentId($fields) + public function getXcGetFieldParentId($fields): string { $fieldPid = 'pid'; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (1 == $fields[$f]->getVar('field_parent')) { $fieldPid = $fieldName; @@ -581,13 +604,14 @@ public function getXcGetFieldParentId($fields) * @param $fields * @return string */ - public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName, $fields) + public function getXcUserSaveElements($moduleDirname, $tableName, $tableSoleName, $fields): string { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); - $ret = ''; - $fieldMain = ''; - $countUploader = 0; - foreach (array_keys($fields) as $f) { + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); + $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'); if (1 == $fields[$f]->getVar('field_main')) { @@ -599,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); + $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language); } else { $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']"); } @@ -617,20 +641,20 @@ 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($left = '', $var1 = '', $var2 = '', $type = 'String', $method = false, $t = '') + public function getXcXoopsRequest(string $left = '', string $var1 = '', string $var2 = '', string $type = 'String', string $t = ''): string { - $ret = ''; - $intVars = ('' != $var2) ? "'{$var1}', {$var2}" : "'{$var1}'"; + $ret = ''; + $intVars = ('' != $var2) ? "'{$var1}', {$var2}" : "'{$var1}'"; + $stringVars = ('' != $var2) ? "'{$var1}', {$var2}" : "'{$var1}'"; if ('String' === $type) { - $ret .= "{$t}\${$left} = Request::getString('{$var1}', '{$var2}');\n"; + $ret .= "{$t}\${$left} = Request::getString({$stringVars});\n"; } elseif ('Int' === $type) { $ret .= "{$t}\${$left} = Request::getInt({$intVars});\n"; - } elseif ('Int' === $type && false !== $method) { - $ret .= "{$t}\${$left} = Request::getInt({$intVars}, '{$method}');\n"; + } else { + $ret .= "{$t}\${$left} = Request::get{$type}('{$var1}', '{$var2}');\n"; } return $ret; @@ -644,12 +668,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 = ''): string { if (!$isParam) { $ret = "{$t}\${$anchor}->addRight('{$permString}', {$var}, {$groups}, {$mid});\n"; @@ -668,12 +692,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 = ''): string { if (!$isParam) { $ret = "{$t}{$anchor}->checkRight('{$permString}', {$var}, {$groups}, {$mid});\n"; @@ -696,25 +720,28 @@ public function getXcCheckRight($anchor, $permString = '', $var = '', $groups = * @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 = ''): string { if (!$isParam) { $ret = "{$t}\${$anchor}->deleteByModule({$mid}, '{$permString}', {$var});\n"; } 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 = '') + public function getXcHandlerLine($tableName, string $t = ''): string { - return "{$t}\${$tableName}Handler = \$helper->getHandler('{$tableName}');\n"; + $ucfTableName = \ucfirst($tableName); + + return "{$t}\${$tableName}Handler = \$helper->getHandler('{$ucfTableName}');\n"; } /** @@ -725,11 +752,24 @@ public function getXcHandlerLine($tableName, $t = '') * @param string $t * @return string */ - public function getXcHandlerCreateObj($tableName, $t = '') + public function getXcHandlerCreateObj($tableName, string $t = ''): string { return "{$t}\${$tableName}Obj = \${$tableName}Handler->create();\n"; } + /** + * @public function getXcHandlerGetObj + * + * @param $tableName + * @param $ccFieldId + * @param string $t + * @return string + */ + public function getXcHandlerGetObj($tableName, $ccFieldId, string $t = ''): string + { + return "{$t}\${$tableName}Obj = \${$tableName}Handler->get(\${$ccFieldId});\n"; + } + /** * @public function getXcHandlerCountObj * @@ -738,28 +778,24 @@ public function getXcHandlerCreateObj($tableName, $t = '') * @param string $t * @return string */ - public function getXcHandlerCountObj($tableName, $t = '') + public function getXcHandlerCountObj($tableName, string $t = ''): string { - $ucfTableName = ucfirst($tableName); - $ret = "{$t}\${$tableName}Count = \${$tableName}Handler->getCount{$ucfTableName}();\n"; - - return $ret; + $ucfTableName = \ucfirst($tableName); + 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 = ''): string { - $ret = "{$t}\${$left} = \${$anchor}Handler->getCount({$params});\n"; - - return $ret; + return "{$t}\${$left} = \${$anchor}Handler->getCount({$params});\n"; } /** @@ -773,14 +809,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 = ''): string { - $ucfTableName = ucfirst($tableName); + $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"; } /** @@ -791,11 +825,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 = ''): string { - $ret = "{$t}\${$left} = \${$anchor}Handler->getAll({$params});\n"; - - return $ret; + return "{$t}\${$left} = \${$anchor}Handler->getAll({$params});\n"; } /** @@ -805,12 +837,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 = ''): string { if ($isParam) { $ret = "\${$left}{$handler}->get(\${$var})"; @@ -826,15 +858,14 @@ 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'): string { return "\${$left}{$handler}->insert(\${$var}{$obj})"; - } /** @@ -846,7 +877,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'): string { return "\${$left}{$handler}->delete(\${$var}{$obj})"; } @@ -858,18 +889,19 @@ 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 = '') + public function getXcGetValues($tableName, $tableSoleName, string $index = 'i', bool $noArray = false, string $t = '', string $obj = ''): string { $index = '' !== $index ? $index : 'i'; - $ucfTableName = ucfirst($tableName); + $ucfTableName = \ucfirst($tableName); if (!$noArray) { $ret = "{$t}\${$tableSoleName} = \${$tableName}All[\${$index}]->getValues{$ucfTableName}();\n"; } else { - $ret = "{$t}\${$tableSoleName} = \${$tableName}->getValues{$ucfTableName}();\n"; + $ret = "{$t}\${$tableSoleName} = \${$tableName}{$obj}->getValues{$ucfTableName}();\n"; } return $ret; @@ -884,13 +916,14 @@ public function getXcGetValues($tableName, $tableSoleName, $index = 'i', $noArra * @param $fields * @return string */ - public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $fields) + public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, $fields): string { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); $ret = ''; $fieldMain = ''; $countUploader = 0; - foreach (array_keys($fields) as $f) { + $language = '\_MA_' . \strtoupper($moduleDirname) . '_'; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); if (1 == $fields[$f]->getVar('field_main')) { @@ -915,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); + $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language); break; default: $ret .= $this->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']"); @@ -939,13 +972,13 @@ public function getXcSetVarsObjects($moduleDirname, $tableName, $tableSoleName, * @param string $t * @return string */ - public function getXcSecurity($tableName, $t = '') + public function getXcSecurity($tableName, string $t = ''): string { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $securityError = $this->getXcXoopsSecurityErrors(); - $implode = $pc->getPhpCodeImplode(',', $securityError); - $content = "{$t}\t" . $this->getXcRedirectHeader($tableName, '', 3, $implode, $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); } @@ -957,9 +990,9 @@ public function getXcSecurity($tableName, $t = '') * @param string $t * @return string */ - public function getXcInsertData($tableName, $language, $t = '') + public function getXcInsertData($tableName, $language, string $t = ''): string { - $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'); @@ -972,17 +1005,16 @@ 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 = ''): string { if (!$isString) { - $ret = "{$t}redirect_header({$directory}, {$numb}, {$var});\n"; + $ret = "{$t}\\redirect_header({$directory}, {$numb}, {$var});\n"; } else { - $ret = "{$t}redirect_header('{$directory}.php{$options}', {$numb}, {$var});\n"; + $ret = "{$t}\\redirect_header('{$directory}.php{$options}', {$numb}, {$var});\n"; } return $ret; @@ -990,7 +1022,6 @@ public function getXcRedirectHeader($directory, $options, $numb, $var, $isString /** * @public function getXcXoopsConfirm - * @param $tableName * @param $language * @param $fieldId * @param $fieldMain @@ -999,16 +1030,25 @@ 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($language, $fieldId, $fieldMain, string $options = 'delete', string $t = ''): string { - $stuOptions = mb_strtoupper($options); - $ccFieldId = Tdmcreate\Files\CreateFile::getInstance()->getCamelCase($fieldId, false, true); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $array = "array('ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'op' => '{$options}')"; - $server = $pc->getPhpCodeGlobalsVariables('REQUEST_URI', 'SERVER'); - $getVar = $this->getXcGetVar('', $tableName . 'Obj', $fieldMain, true, ''); - $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, $getVar); - $ret = "{$t}xoops_confirm({$array}, {$server}, {$sprintf});\n"; + $stuOptions = \mb_strtoupper($options); + $ccFieldId = Modulebuilder\Files\CreateFile::getInstance()->getCamelCase($fieldId, false, true); + $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'); + $sprintf = $pc->getPhpCodeSprintf($language . 'FORM_SURE_' . $stuOptions, "\${$ccFieldMain}"); + $confirm = 'new Common\Confirm(' . "\n"; + $confirm .= $t . "\t" . $array . ",\n"; + $confirm .= $t . "\t" . $server . ",\n"; + $confirm .= $t . "\t" . $sprintf . ')'; + $ret = $xc->getXcEqualsOperator('$customConfirm', $confirm, '', $t); + $ret .= $xc->getXcEqualsOperator('$form', '$customConfirm->getFormConfirm()', '', $t); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); return $ret; } @@ -1017,13 +1057,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 = ''): string { if ($isParam) { $ret = "\${$tableName}{$obj}->getHtmlErrors()"; @@ -1044,9 +1084,9 @@ 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 = ''): string { - $ucfTableName = ucfirst($tableName); + $ucfTableName = \ucfirst($tableName); return "{$t}\${$left} = \${$tableName}{$obj}->getForm{$ucfTableName}();\n"; } @@ -1062,10 +1102,10 @@ 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 = ''): string { - $ret = Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Get Var', $fieldNameParent, $t); - $paramGet = $this->getXcGetVar('', "\${$tableName}All[\$i]", $fieldNameParent, true, ''); + $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); @@ -1081,9 +1121,10 @@ public function getTopicGetVar($lpFieldName, $rpFieldName, $tableName, $tableNam * @param string $t * @return string */ + /* 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); @@ -1091,18 +1132,19 @@ public function getUploadImageGetVar($lpFieldName, $rpFieldName, $tableName, $fi return $ret; } + */ /** - * @public function getXcSaveFieldId + * @public function getXcTableFieldId * * @param $fields * * @return string */ - public function getXcSaveFieldId($fields) + public function getXcTableFieldId($fields): string { $fieldId = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { if (0 == $f) { $fieldId = $fields[$f]->getVar('field_name'); } @@ -1112,16 +1154,16 @@ public function getXcSaveFieldId($fields) } /** - * @public function getXcSaveFieldMain + * @public function getXcTableFieldMain * * @param $fields * * @return string */ - public function getXcSaveFieldMain($fields) + public function getXcTableFieldMain($fields): string { $fieldMain = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_main')) { $fieldMain = $fields[$f]->getVar('field_name'); } @@ -1141,14 +1183,16 @@ 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 = ''): string { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); + $axc = Modulebuilder\Files\Admin\AdminXoopsCode::getInstance(); + $xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); $ret = ''; $fieldMain = ''; $countUploader = 0; - foreach (array_keys($fields) as $f) { - + $fieldLines = ''; + $language = '\_MA_' . \strtoupper($moduleDirname) . '_'; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldType = $fields[$f]->getVar('field_type'); $fieldElement = $fields[$f]->getVar('field_element'); @@ -1159,44 +1203,45 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f switch ($fieldElement) { case 5: case 6: - $ret .= $this->getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, $t); + $fieldLines .= $this->getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, $t); break; case 10: - $ret .= $axc->getAxcSetVarImageList($tableName, $fieldName, $t, $countUploader); + $fieldLines .= $axc->getAxcSetVarImageList($tableName, $fieldName, $t, $countUploader); $countUploader++; break; + case 14: case 11: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $t, $countUploader, $fieldMain); + $fieldLines .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $t, $countUploader, $fieldMain); $countUploader++; break; case 12: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, true, $t, $countUploader, $fieldMain); + $fieldLines .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, true, $t, $countUploader, $fieldMain); $countUploader++; break; case 13: - $ret .= $axc->getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, $t, $countUploader); - $countUploader++; - break; - case 14: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $t, $countUploader, $fieldMain); + $fieldLines .= $axc->getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, $t, $countUploader); $countUploader++; break; case 15: - $ret .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t); + $fieldLines .= $this->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language, $t); break; case 17: - $ret .= $axc->getAxcSetVarPassword($tableName, $fieldName, $t); + $fieldLines .= $axc->getAxcSetVarPassword($tableName, $fieldName, $t); $countUploader++; break; case 21: - $ret .= $this->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t); + $fieldLines .= $this->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t, $language); break; default: - $ret .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t); + $fieldLines .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t); break; } } } + if ($countUploader > 0) { + $ret .= $xc->getXcEqualsOperator('$uploaderErrors', "''", null, $t); + } + $ret .= $fieldLines; return $ret; } @@ -1206,16 +1251,20 @@ public function getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $f * @param $tableName * * @param string $t + * @param string $paramStart + * @param string $paramOp + * @param string $pageNavTplName * @return string */ - public function getXcPageNav($tableName, $t = '') + public function getXcPageNav($tableName, string $t = '', string $paramStart = 'start', string $paramOp = "'op=list&limit=' . \$limit", string $pageNavTplName = ''): string { - $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', 'start', "'op=list&limit=' . \$limit", false, $t . "\t"); - $condition .= $this->getXcXoopsTplAssign('pagenav', '$pagenav->renderNav(4)', true, $t . "\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"); + if ('' === $pageNavTplName) { $pageNavTplName = 'pagenav';} + $condition .= $this->getXcXoopsTplAssign($pageNavTplName, '$pagenav->renderNav()', true, $t . "\t"); $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '$limit', $condition, false, $t); return $ret; @@ -1227,9 +1276,9 @@ public function getXcPageNav($tableName, $t = '') * @param string $t * @return string */ - public function getXcGetGlobal($globals, $t = '') + public function getXcGetGlobal($globals, string $t = ''): string { - $ret = $t . "global "; + $ret = $t . 'global '; $detail = ''; foreach ($globals as $global) { if ($detail !== '') { @@ -1237,7 +1286,7 @@ public function getXcGetGlobal($globals, $t = '') } $detail .= '$' . $global; } - $ret .= $detail . ";\n"; + $ret .= $detail . ";\n"; return $ret; } @@ -1250,7 +1299,7 @@ public function getXcGetGlobal($globals, $t = '') * * @return string */ - public function getXcCriteriaCompo($var, $t = '') + public function getXcCriteriaCompo($var, string $t = ''): string { return "{$t}\${$var} = new \CriteriaCompo();\n"; } @@ -1262,20 +1311,20 @@ 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 = ''): string { $params = ('' != $param2) ? ', ' . $param2 : ''; $params .= ('' != $param3) ? ', ' . $param3 : ''; if (false === $isParam) { - $ret = "{$t}\${$var} = new \Criteria( {$param1}{$params} );\n"; + $ret = "{$t}\${$var} = new \Criteria({$param1}{$params});\n"; } else { - $ret = "new \Criteria( {$param1}{$params} )"; + $ret = "new \Criteria({$param1}{$params})"; } return $ret; @@ -1291,12 +1340,13 @@ 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 = ''): string { if ('' !== $condition) { $condition = ", {$condition}"; } - return "{$t}\${$var}->add( {$param}{$condition} );{$n}"; + + return "{$t}\${$var}->add({$param}{$condition});{$n}"; } /** @@ -1309,9 +1359,9 @@ 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"): string { - return "{$t}\${$var}->setStart( {$start} );{$n}"; + return "{$t}\${$var}->setStart({$start});{$n}"; } /** @@ -1324,9 +1374,9 @@ 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"): string { - return "{$t}\${$var}->setLimit( {$limit} );{$n}"; + return "{$t}\${$var}->setLimit({$limit});{$n}"; } /** @@ -1339,9 +1389,9 @@ 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"): string { - return "{$t}\${$var}->setSort( {$sort} );{$n}"; + return "{$t}\${$var}->setSort({$sort});{$n}"; } /** @@ -1354,9 +1404,9 @@ 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"): string { - return "{$t}\${$var}->setOrder( {$order} );{$n}"; + return "{$t}\${$var}->setOrder({$order});{$n}"; } /*************************************************************/ @@ -1365,37 +1415,36 @@ 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 = ''): string { return "{$t}\${$varLeft} = new \XoopsGroupPermForm({$formTitle}, {$moduleId}, {$permName}, {$permDesc}, {$filename});\n"; } - /** * @public function getXoopsFormSelectExtraOptions * @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 = ''): string { $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) { @@ -1406,6 +1455,19 @@ public function getXoopsFormSelectExtraOptions($varSelect = '', $caption = '', $ } + /*************************************************************/ + /** special components */ + /*************************************************************/ + /** + * @public function getXcGetConstants + * @param mixed $const + * @return string + */ + public function getXcGetConstants($const): string + { + return "Constants::{$const}"; + } + /*************************************************************/ /** other Xoops components */ /*************************************************************/ @@ -1413,20 +1475,20 @@ public function getXoopsFormSelectExtraOptions($varSelect = '', $caption = '', $ /** * @public function getXcXoopsCPHeader - * @param null + * * @return string */ - public function getXcXoopsCPHeader() + public function getXcXoopsCPHeader(): string { return "xoops_cp_header();\n"; } /** * @public function getXcXoopsCPFooter - * @param null + * * @return string */ - public function getXcXoopsCPFooter() + public function getXcXoopsCPFooter(): string { return "xoops_cp_footer();\n"; } @@ -1434,39 +1496,39 @@ 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 = ''): string { - return "{$t}xoops_load('{$var}');\n"; + return "{$t}\xoops_load('{$var}');\n"; } /** * @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 = ''): string { if ('' === $domain) { - return "{$t}xoops_loadLanguage('{$lang}');\n"; + return "{$t}\xoops_loadLanguage('{$lang}');\n"; } - return "{$t}xoops_loadLanguage('{$lang}', '{$domain}');\n"; + return "{$t}\xoops_loadLanguage('{$lang}', '{$domain}');\n"; } /** * @public function getXcXoopsCaptcha - * @param $t + * @param string $t * @return string */ - public function getXcXoopsCaptcha($t = '') + public function getXcXoopsCaptcha(string $t = ''): string { return "{$t}\$xoopsCaptcha = \XoopsCaptcha::getInstance();\n"; } @@ -1475,35 +1537,35 @@ 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 = ''): string { return "{$t}\${$return} = \XoopsLists::getImgListAsArray( {$var} );\n"; } /** * @public function getXcXoopsListLangList - * @param $return + * @param $return * @param string $t * * @return string */ - public function getXcXoopsListLangList($return, $t = '') + public function getXcXoopsListLangList($return, string $t = ''): string { return "{$t}\${$return} = \XoopsLists::getLangList();\n"; } /** * @public function getXcXoopsListCountryList - * @param $return + * @param $return * @param string $t * * @return string */ - public function getXcXoopsListCountryList($return, $t = '') + public function getXcXoopsListCountryList($return, string $t = ''): string { return "{$t}\${$return} = \XoopsLists::getCountryList();\n"; } @@ -1516,7 +1578,7 @@ public function getXcXoopsListCountryList($return, $t = '') * * @return string */ - public function getXcXoopsUserUnameFromId($left, $value, $t = '') + public function getXcXoopsUserUnameFromId($left, $value, string $t = ''): string { return "{$t}\${$left} = \XoopsUser::getUnameFromId({$value});\n"; } @@ -1526,14 +1588,18 @@ 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 = '') + public function getXcXoopsTplAssign($tplString, $phpRender, bool $leftIsString = true, string $t = '', string $tpl = ''): string { $assign = "{$t}\$GLOBALS['xoopsTpl']->assign("; + if ('' !== $tpl) { + $assign = "{$t}\${$tpl}->assign("; + } + if (false === $leftIsString) { $ret = $assign . "{$tplString}, {$phpRender});\n"; } else { @@ -1552,7 +1618,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 = ''): string { return "{$t}\$GLOBALS['xoopsTpl']->append('{$tplString}', {$phpRender});\n"; } @@ -1566,7 +1632,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 = ''): string { return "{$t}\$GLOBALS['xoopsTpl']->appendByRef('{$tplString}', {$phpRender});\n"; } @@ -1576,10 +1642,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): string { if ($usedoublequotes) { return "{$t}\$GLOBALS['xoopsTpl']->display(\"db:{$displayTpl}\");\n"; @@ -1593,12 +1659,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 = ''): string { if (!$isParam) { $ret = "{$t}\$GLOBALS['xoops']->path({$directory}.'/{$filename}.php');\n"; @@ -1614,12 +1680,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 = ''): string { if (!$isParam) { $ret = "{$t}\${$left} = \$GLOBALS['xoopsModule']->getInfo('{$string}');\n"; @@ -1630,35 +1696,41 @@ public function getXcXoopsModuleGetInfo($left, $string, $isParam = false, $t = ' return $ret; } - /** * @public function getXcXoThemeAddStylesheet * @param string $style * * @param string $t + * @param bool $isString * @return string */ - public function getXcXoThemeAddStylesheet($style = 'style', $t = '') + public function getXcXoThemeAddStylesheet(string $style = 'style', string $t = '', bool $isString = true): string { - return "{$t}\$GLOBALS['xoTheme']->addStylesheet( \${$style}, null );\n"; + $ret = "{$t}\$GLOBALS['xoTheme']->addStylesheet("; + if ($isString) { + $ret .= '$'; + } + $ret .= "{$style}, null);\n"; + + return $ret; } /** * @public function getXcXoopsSecurityCheck - * @param $denial - * @return bool + * @param string $denial + * @return string */ - public function getXcXoopsSecurityCheck($denial = '') + public function getXcXoopsSecurityCheck(string $denial = ''): string { return "{$denial}\$GLOBALS['xoopsSecurity']->check()"; } /** * @public function getXcXoopsSecurityErrors - * @param null + * * @return string */ - public function getXcXoopsSecurityErrors() + public function getXcXoopsSecurityErrors(): string { return "\$GLOBALS['xoopsSecurity']->getErrors()"; } @@ -1670,8 +1742,136 @@ public function getXcXoopsSecurityErrors() * @param string $n * @return string */ - public function getXcXoopsHandler($left, $t = '', $n = "\n") + public function getXcXoopsHandler($left, string $t = '', string $n = "\n"): string { - return "{$t}\${$left}Handler = xoops_getHandler('{$left}');{$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 + * @param string $language + * @return string + */ + public function getXcCommonPagesEdit($tableName, $ccFieldId, string $t = '', string $language = ''): string + { + $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); + $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + + return $ret; + } + + /** + * @public function getXcCommonPagesNew + * @param $tableName + * @param string $t + * @return string + */ + public function getXcCommonPagesNew($tableName, string $t = ''): string + { + $pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $xc = Modulebuilder\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 getXcCommonPagesClone + * @param $tableName + * @param $ccFieldId + * @param string $t + * @param string $language + * @return string + */ + public function getXcCommonPagesClone($tableName, $ccFieldId, string $t = '', string $language = ''): string + { + $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); + + return $ret; + } + + /** + * @public function getXcCommonPagesDelete + * @param $language + * @param $tableName + * @param $tableSoleName + * @param $fieldId + * @param $fieldMain + * @param $tableNotifications + * @param string $t + * @param bool $admin + * @return string + */ + 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(); + $cf = Modulebuilder\Files\CreateFile::getInstance(); + + $ccFieldId = $cf->getCamelCase($fieldId, false, true); + $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); + $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'); + $condition = $pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectHeaderErrors, false, $t . "\t"); + $contInsert = ''; + if (!$admin && 1 == $tableNotifications) { + $contInsert .= $pc->getPhpCodeCommentLine('Event delete notification', null, $t . "\t\t"); + $contInsert .= $pc->getPhpCodeArray('tags', [], false, $t . "\t\t"); + $contInsert .= $xc->getXcEqualsOperator("\$tags['ITEM_NAME']", "\${$ccFieldMain}", '', $t . "\t\t"); + $contInsert .= $xc->getXcXoopsHandler('notification', $t . "\t\t"); + $contInsert .= $cf->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_delete', \$tags);", $t . "\t\t"); + $contInsert .= $cf->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \${$ccFieldId}, '{$tableSoleName}_delete', \$tags);", $t . "\t\t"); + } + $contInsert .= $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, '', '', $contInsert, $internalElse, $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/Docs/DocsChangelog.php b/class/Files/Docs/DocsChangelog.php index 7199a0cf..458bfe55 100644 --- a/class/Files/Docs/DocsChangelog.php +++ b/class/Files/Docs/DocsChangelog.php @@ -1,9 +1,9 @@ -setModule($module); $this->setFileName($filename); @@ -68,23 +67,22 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { $module = $this->getModule(); $filename = $this->getFileName(); - $moduleName = $module->getVar('mod_name'); $moduleDirname = $module->getVar('mod_dirname'); $date = date('Y/m/d G:i:s'); $content = <<getVar('mod_version')} -============================================================== - - Original release {$moduleDirname} ({$module->getVar('mod_author')}) -EOT; - $this->create($moduleDirname, 'docs', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + ============================================================== + {$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 c0277b96..82121ec0 100644 --- a/class/Files/Docs/DocsFiles.php +++ b/class/Files/Docs/DocsFiles.php @@ -1,9 +1,9 @@ -setModule($module); $this->setFileName($filename); @@ -91,14 +82,12 @@ public function write($module, $filename) public function getChangeLogFile($moduleDirname, $mod_version, $mod_author) { $date = date('Y/m/d G:i:s'); - $ret = <<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/Docs/index.php b/class/Files/Docs/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Docs/index.php @@ -0,0 +1,2 @@ +xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return IncludeCommentFunctions */ public static function getInstance() @@ -57,11 +67,11 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param mixed $table * @param $filename */ - public function write($module, $table, $filename) + public function write($module, $table, $filename): void { $this->setModule($module); $this->setTable($table); @@ -70,42 +80,82 @@ public function write($module, $table, $filename) /** * @public function getCommentBody - * @param string $module - * @param mixed $table + * @param $module + * @param $table * @return string */ public function getCommentBody($module, $table) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $ucfModuleDirname = ucfirst($moduleDirname); - $ucfTableName = ucfirst($tableName); - - $ret = $pc->getPhpCodeCommentMultiLine(['CommentsUpdate' => '', '' => '', '@param mixed $itemId' => '', '@param mixed $itemNumb' => '', '@return' => 'bool']); - $func1 = $xc->getXcEqualsOperator('$itemId', '(int)$itemId', '', "\t"); - $func1 .= $xc->getXcEqualsOperator('$itemNumb', '(int)$itemNumb', '', "\t"); - $func1 .= $xc->getXcEqualsOperator('$article', "new {$ucfModuleDirname}{$ucfTableName}(\$itemId)", '', "\t"); - $contIf = $this->getSimpleString('return false;',"\t\t"); - $func1 .= $pc->getPhpCodeConditions('!$article->updateComments($itemNumb)','','',$contIf, false,"\t"); - $func1 .= $this->getSimpleString('return true;',"\t"); - $ret .= $pc->getPhpCodeFunction($moduleDirname . 'CommentsUpdate', '$itemId, $itemNumb', $func1); - $ret .= $pc->getPhpCodeCommentMultiLine(['CommentsApprove' => '', '' => '', '@param mixed' => '$comment', '@return' => 'bool']); - $func2 = $pc->getPhpCodeCommentLine('notification mail here','',"\t"); - $func2 .= $pc->getPhpCodeBlankLine(); - $func2 .= $this->getSimpleString('return false;',"\t"); - $func2 .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeFunction($moduleDirname . 'CommentsApprove', '&$comment', $func2); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tableFieldName = $table->getVar('table_fieldname'); + $language = '\_MA_' . strtoupper($moduleDirname) . '_'; + + $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) { + $fieldId = $fieldName; + $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); + } + } + + $t = "\t"; + $ret = $this->pc->getPhpCodeCommentMultiLine(['CommentsUpdate' => '', '' => '', '@param mixed $itemId' => '', '@param mixed $itemNumb' => '', '@return' => 'bool']); + $func1 = $this->xc->getXcHelperGetInstance($moduleDirname, $t); + $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"); + $func1 .= $this->pc->getPhpCodeConditions($insert, '', '', $contIf, 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->xc->getXcHelperGetInstance($moduleDirname, $t); + $func2 .= $this->xc->getXcHandlerLine($tableName, $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); + $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->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeFunction($moduleDirname . 'CommentsApprove', '$comment', $func2); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -113,11 +163,11 @@ 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_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..c0e39a4f 100644 --- a/class/Files/Includes/IncludeComments.php +++ b/class/Files/Includes/IncludeComments.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return IncludeComments */ public static function getInstance() @@ -57,10 +67,10 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param mixed $table + * @param $module + * @param mixed $table */ - public function write($module, $table) + public function write($module, $table): void { $this->setModule($module); $this->setTable($table); @@ -68,98 +78,55 @@ public function write($module, $table) /** * @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) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $moduleDirname = $module->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); + $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, 'include', $filename . '.php', $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, '', $filename . '.php', $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } /** * @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) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $table = $this->getTable(); - $moduleDirname = mb_strtolower($module->getVar('mod_dirname')); + $moduleDirname = \mb_strtolower($module->getVar('mod_dirname')); $tableName = $table->getVar('table_name'); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $fieldMain = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { if (1 == $fields[$f]->getVar('field_main')) { $fieldMain = $fields[$f]->getVar('field_name'); } } $content = $this->getHeaderFilesComments($module); - $content .= $pc->getPhpCodeUseNamespace(['Xmf', 'Request']); - $content .= $pc->getPhpCodeIncludeDir("__DIR__ . '/../../../mainfile.php'",'',true, true); - $content .= $pc->getPhpCodeIncludeDir("XOOPS_ROOT_PATH.'/modules/{$moduleDirname}/class/{$tableName}.php'",'',true, true); - $content .= $xc->getXcXoopsRequest('com_itemid', 'com_itemid', '0', 'Int'); - $contIf = $xc->getXcEqualsOperator("\${$tableName}Handler", "xoops_getModuleHandler('{$tableName}', '{$moduleDirname}')",'',"\t"); - $contIf .= $xc->getXcHandlerGet("{$tableName}", 'com_itemid','Obj', "{$tableName}Handler", false, "\t"); - $contIf .= $xc->getXcGetVar('com_replytitle', "{$tableName}Obj", $fieldMain,false, "\t"); - $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); + $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->xc->getXcXoopsRequest('com_itemid', 'com_itemid', '', '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); + + $this->create($moduleDirname, 'include', $filename . '.php', $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); return $this->renderFile(); } - - /** - * @public function render - * @param null - */ - /*public function render() { - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - - $content = $this->getHeaderFilesComments($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); - 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); - 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); - 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); - 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); - return $this->render(); - break; - } - }*/ } diff --git a/class/Files/Includes/IncludeCommon.php b/class/Files/Includes/IncludeCommon.php index 105d0956..85a59b21 100644 --- a/class/Files/Includes/IncludeCommon.php +++ b/class/Files/Includes/IncludeCommon.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return IncludeCommon */ public static function getInstance() @@ -57,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) + public function write($module, object $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -76,9 +91,9 @@ public function write($module, $table, $filename) */ private function getCommonDefines($modDirname, $const, $desc) { - $stuModDirname = mb_strtoupper($modDirname); + $stuModDirname = \mb_strtoupper($modDirname); - return "define('{$stuModDirname}_{$const}', {$desc});\n"; + return "\define('{$stuModDirname}_{$const}', {$desc});\n"; } /** @@ -86,63 +101,61 @@ private function getCommonDefines($modDirname, $const, $desc) * @param \XoopsObject $module * @return string */ - private function getCommonCode($module) + private function getCommonCode(\XoopsObject $module) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $table = $this->getTable(); $moduleDirname = $module->getVar('mod_dirname'); - $stuModuleDirname = mb_strtoupper($moduleDirname); + $stuModuleDirname = \mb_strtoupper($moduleDirname); $moduleAuthor = $module->getVar('mod_author'); $moduleAuthorWebsiteName = $module->getVar('mod_author_website_name'); $moduleAuthorWebsiteUrl = $module->getVar('mod_author_website_url'); - $moduleAuthorImage = str_replace(' ', '', mb_strtolower($moduleAuthor)); - - $contIf = $pc->getPhpCodeDefine('XOOPS_ICONS32_PATH', "XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'", "\t"); - $ret = $pc->getPhpCodeConditions("!defined('XOOPS_ICONS32_PATH')", '','', $contIf, false); - $contIf = $pc->getPhpCodeDefine('XOOPS_ICONS32_URL', "XOOPS_URL . '/Frameworks/moduleclasses/icons/32'", "\t"); - $ret .= $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"); - $ret .= $this->getCommonDefines($moduleDirname, 'ICONS_PATH', "{$stuModuleDirname}_PATH.'/assets/icons'"); - $ret .= $this->getCommonDefines($moduleDirname, 'ICONS_URL', "{$stuModuleDirname}_URL.'/assets/icons'"); - $ret .= $this->getCommonDefines($moduleDirname, 'IMAGE_PATH', "{$stuModuleDirname}_PATH.'/assets/images'"); - $ret .= $this->getCommonDefines($moduleDirname, 'IMAGE_URL', "{$stuModuleDirname}_URL.'/assets/images'"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_PATH', "XOOPS_UPLOAD_PATH.'/'.{$stuModuleDirname}_DIRNAME"); - $ret .= $this->getCommonDefines($moduleDirname, 'UPLOAD_URL', "XOOPS_UPLOAD_URL.'/'.{$stuModuleDirname}_DIRNAME"); - - $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 .= $xc->getXcEqualsOperator('$localLogo', "{$stuModuleDirname}_IMAGE_URL . '/{$moduleAuthorImage}_logo.png'"); - $ret .= $pc->getPhpCodeCommentLine('Module Information'); - - $img = $hc->getHtmlImage('".$localLogo."', $moduleAuthorWebsiteName); - $anchor = $hc->getHtmlAnchor($moduleAuthorWebsiteUrl, $img, $moduleAuthorWebsiteName, '_blank', '', '', '', "\n"); - $replace = $xc->getXcEqualsOperator('$copyright', '"' . $anchor . '"'); - $ret .= str_replace("\n", '', $replace) . PHP_EOL; - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsrequest', true); - $ret .= $pc->getPhpCodeIncludeDir("{$stuModuleDirname}_PATH", 'class/helper', true); - $ret .= $pc->getPhpCodeIncludeDir("{$stuModuleDirname}_PATH", 'include/functions', true); + $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); + $contIf = $this->pc->getPhpCodeDefine('XOOPS_ICONS32_URL', "\XOOPS_URL . '/Frameworks/moduleclasses/icons/32'", "\t"); + $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'"); + $ret .= $this->getCommonDefines($moduleDirname, 'ICONS_URL', "\\{$stuModuleDirname}_URL . '/assets/icons'"); + $ret .= $this->getCommonDefines($moduleDirname, 'IMAGE_PATH', "\\{$stuModuleDirname}_PATH . '/assets/images'"); + $ret .= $this->getCommonDefines($moduleDirname, 'IMAGE_URL', "\\{$stuModuleDirname}_URL . '/assets/images'"); + $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'"); + $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"); + $replace = $this->xc->getXcEqualsOperator('$copyright', '"' . $anchor . '"'); + $ret .= \str_replace("\n", '', $replace) . PHP_EOL; + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/xoopsrequest', true); + $ret .= $this->pc->getPhpCodeIncludeDir("\\{$stuModuleDirname}_PATH", 'include/functions', true); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -151,7 +164,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..5dc303f7 100644 --- a/class/Files/Includes/IncludeFunctions.php +++ b/class/Files/Includes/IncludeFunctions.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return IncludeFunctions */ public static function getInstance() @@ -61,7 +71,7 @@ public static function getInstance() * @param $module * @param $filename */ - public function write($module, $filename) + public function write($module, $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -73,22 +83,19 @@ public function write($module, $filename) * * @return string */ - private function getFunctionBlock($moduleDirname) + private function getFunctionBlock(string $moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $t = "\t"; - $ret = $pc->getPhpCodeCommentMultiLine(['function' => 'add selected cats to block', '' => '', '@param $cats' => '', '@return' => 'string']); - $func = $xc->getXcEqualsOperator('$cat_sql', "'('", '', $t); - $contIf = $xc->getXcEqualsOperator('$cat_sql', "current(\$cats)", '.',$t. "\t"); - $contIf .= $this->getSimpleString("array_shift(\$cats);", $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"); $contFe = $this->getSimpleString("\$cat_sql .= ',' . \$cat;", $t . "\t\t"); - $contIf .= $pc->getPhpCodeForeach('cats', false,false,'cat', $contFe, $t. "\t"); - $func .= $pc->getPhpCodeConditions('is_array($cats)','','', $contIf, false, $t); - $func .= $xc->getXcEqualsOperator('$cat_sql', "')'", '.', $t); - $func .= $this->getSimpleString('return $cat_sql;', $t); - $ret .= $pc->getPhpCodeFunction("{$moduleDirname}_block_addCatSelect", '$cats', $func); + $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); return $ret; } @@ -99,24 +106,25 @@ private function getFunctionBlock($moduleDirname) * * @return string */ - private function getFunctionGetMyItemIds($moduleDirname) + private function getFunctionGetMyItemIds(string $moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $t = "\t"; - $ret = $pc->getPhpCodeCommentMultiLine(['Get the permissions ids' => '', '' => '', '@param $permtype' => '', '@param $dirname' => '', '@return' => 'mixed $itemIds']); - $func = $xc->getXcGetGlobal(['xoopsUser'], $t); - $func .= $xc->getXcEqualsOperator('static $permissions', "[]", '', $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); $contIf = $this->getSimpleString('return $permissions[$permtype];', $t . "\t"); - $func .= $pc->getPhpCodeConditions('is_array($permissions) && array_key_exists($permtype, $permissions)','','', $contIf, false, $t); - $func .= $xc->getXcXoopsHandler('module', $t); - $func .= $xc->getXcEqualsOperator("\${$moduleDirname}Module", '$moduleHandler->getByDirname($dirname)', '', $t); - $func .= $pc->getPhpCodeTernaryOperator('groups', 'is_object($xoopsUser)', '$xoopsUser->getGroups()', 'XOOPS_GROUP_ANONYMOUS', $t); - $func .= $xc->getXcXoopsHandler('groupperm', $t); - $func .= $xc->getXcEqualsOperator('$itemIds', "\$grouppermHandler->getItemIds(\$permtype, \$groups, \${$moduleDirname}Module->getVar('mid'))", '', $t); - $func .= $this->getSimpleString('return $itemIds;', $t); - $ret .= $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); + $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); + $func .= $this->getSimpleString('return $itemIds;', $t); + $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}GetMyItemIds", '$permtype, $dirname', $func); return $ret; } @@ -131,45 +139,44 @@ 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); - foreach (array_keys($fields) as $f) { + $fields = $this->getTableFields($tableMid, $tableId); + $fieldId = ''; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { $fieldId = $fieldName; // fieldMain = fields parameters main field } } - $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++; + return <<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 $ret; + return \$count; + }\n + EOT; } /** @@ -179,28 +186,26 @@ function {$moduleDirname}NumbersOfEntries(\$mytree, \${$tableName}, \$entries, \ * * @return string */ - private function getFunctionMetaKeywords($moduleDirname) + private function getFunctionMetaKeywords(string $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; - - return $ret; + return <<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; } /** @@ -210,182 +215,168 @@ private function getFunctionMetaKeywords($moduleDirname) * * @return string */ - private function getFunctionMetaDescription($moduleDirname) + private function getFunctionMetaDescription(string $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; - - return $ret; + return <<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; } /** * @private function getRewriteUrl - * * @param string $moduleDirname - * @param string $tableName * * @return string */ - private function getRewriteUrl($moduleDirname, $tableName) + private function getRewriteUrl(string $moduleDirname) { - $ucfModuleDirname = ucfirst($moduleDirname); - $ret = <<getHandler('{$tableName}'); - \$lenght_id = \$helper->getConfig('lenght_id'); - \$rewrite_url = \$helper->getConfig('rewrite_url'); - - if (\$lenght_id != 0) { - \$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 (\$type === 'content/') { - \$type = ''; - } - if (\$type === 'comment-edit/' || \$type === 'comment-reply/' || \$type === 'comment-delete/') { - return XOOPS_URL . \$rewrite_base . \$module_name . \$type . \$id . '/'; - } + $ucfModuleDirname = \ucfirst($moduleDirname); + return <<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 (\$type === 'content/') { - \$type = ''; - } - if (\$type === 'comment-edit/' || \$type === 'comment-reply/' || \$type === 'comment-delete/') { - 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; - - return $ret; + EOT; } /** * @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(array(\$regular_expression, "`[-]+`"), '-', \$url); - \$url = (\$url == '') ? \$type : strtolower(trim(\$url, '-')); - return \$url; -} -EOT; - - return $ret; + $ucfModuleDirname = \ucfirst($moduleDirname); + return <<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; } /** * @public function render * - * @param null - * - * @return bool|string + * @return string */ public function render() { @@ -394,10 +385,10 @@ public function render() $tableId = null; $tableMid = null; $tableName = null; - $tableBlocks = null; - $tablePermissions = null; - $tableCategory = null; - foreach (array_keys($tables) as $i) { + $tableBlocks = []; + $tablePermissions = []; + $tableCategory = []; + foreach (\array_keys($tables) as $i) { $tableId = $tables[$i]->getVar('table_id'); $tableMid = $tables[$i]->getVar('table_mid'); $tableName = $tables[$i]->getVar('table_name'); @@ -408,21 +399,21 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); - if (in_array(1, $tableBlocks)) { + if (\in_array(1, $tableBlocks)) { $content .= $this->getFunctionBlock($moduleDirname); } - if (in_array(1, $tablePermissions)) { + if (\in_array(1, $tablePermissions)) { $content .= $this->getFunctionGetMyItemIds($moduleDirname); } - if (in_array(1, $tableCategory)) { + if (\in_array(1, $tableCategory)) { $content .= $this->getFunctionNumbersOfEntries($moduleDirname, $tableMid, $tableId, $tableName); } $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_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..cd8d8a55 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(); } /** * @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) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,8 +73,8 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -84,14 +83,14 @@ 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; - $this->tdmcfile->create($moduleDirname, 'assets/js', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $(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 36c8981f..5eff8d98 100644 --- a/class/Files/Includes/IncludeNotifications.php +++ b/class/Files/Includes/IncludeNotifications.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return IncludeNotifications */ public static function getInstance() @@ -57,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) + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setTables($tables); @@ -74,37 +84,36 @@ public function write($module, $tables, $filename) * * @return string */ - public function getNotificationsFunction($moduleDirname) + public function getNotificationsFunction(string $moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); + $stuModuleDirname = \mb_strtoupper($moduleDirname); $tables = $this->getTables(); - $t = "\t"; - $ret = $pc->getPhpCodeCommentMultiLine(['comment' => 'callback functions','' => '', '@param $category' => '', '@param $item_id' => '', '@return' => 'array item|null']); - $func = $xc->getXcGetGlobal(['xoopsDB'], $t); - $func .= $pc->getPhpCodeBlankLine(); - $contIf = $pc->getPhpCodeDefine($stuModuleDirname . '_URL',"XOOPS_URL . '/modules/{$moduleDirname}'", $t . "\t"); - $func .= $pc->getPhpCodeConditions("!defined('{$stuModuleDirname}_URL')", '','',$contIf, false, $t); - $func .= $pc->getPhpCodeBlankLine(); - - $case[] = $xc->getXcEqualsOperator("\$item['name']", "''",'',$t . "\t\t"); - $case[] = $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(); + + $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"); + $cases = [ 'global' => $case, ]; - $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, false, false, $t . "\t"); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, false, $t . "\t"); unset($case); - foreach (array_keys($tables) as $i) { + foreach (\array_keys($tables) as $i) { if (1 === (int)$tables[$i]->getVar('table_notifications')) { $tableName = $tables[$i]->getVar('table_name'); $fieldParent = false; $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); $fieldId = ''; $fieldMain = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if ((0 == $f) && (1 == $tables[$i]->getVar('table_autoincrement'))) { $fieldId = $fieldName; @@ -121,36 +130,39 @@ public function getNotificationsFunction($moduleDirname) } else { $tableSingle = $tableName; } - $case[] = $xc->getXcEqualsOperator('$sql ', "'SELECT {$fieldMain} FROM ' . \$xoopsDB->prefix('{$moduleDirname}_{$tableName}') . ' WHERE {$fieldId} = '. \$item_id",'',$t . "\t\t"); - $case[] = $xc->getXcEqualsOperator('$result ', '$xoopsDB->query($sql)','',$t . "\t\t"); - $case[] = $xc->getXcEqualsOperator('$result_array', '$xoopsDB->fetchArray($result)','',$t . "\t\t"); - $case[] = $xc->getXcEqualsOperator("\$item['name']", "\$result_array['{$fieldMain}']",'',$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[] = $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[] = $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"); - $cases = [ + $case[] = $this->getSimpleString('return $item;', $t . "\t\t"); + $cases = [ $tableName => $case, ]; - $contentSwitch .= $pc->getPhpCodeCaseSwitch($cases, false, false, $t . "\t"); + $contentSwitch .= $this->pc->getPhpCodeCaseSwitch($cases, false, $t . "\t"); unset($case); } } - $func .= $pc->getPhpCodeSwitch('category', $contentSwitch, $t); - $func .= $this->getSimpleString('return null;', $t ); - $ret .= $pc->getPhpCodeFunction("{$moduleDirname}_notify_iteminfo", '$category, $item_id', $func); + $func .= $this->pc->getPhpCodeSwitch('category', $contentSwitch, $t); + $func .= $this->getSimpleString('return null;', $t); + $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}_notify_iteminfo", '$category, $item_id', $func); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -160,7 +172,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..c9e6fbcc 100644 --- a/class/Files/Includes/IncludeSearch.php +++ b/class/Files/Includes/IncludeSearch.php @@ -1,9 +1,9 @@ -tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return IncludeSearch */ public static function getInstance() @@ -63,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): void { $this->setModule($module); $this->setFileName($filename); @@ -82,38 +91,40 @@ public function write($module, $tables, $filename) */ public function getSearchFunction($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ucfModuleDirname = ucfirst($moduleDirname); + $ucfModuleDirname = \ucfirst($moduleDirname); $tables = $this->getTables(); - $t = "\t"; - $ret = $pc->getPhpCodeCommentMultiLine(['search callback functions' => '', '' => '', '@param $queryarray' => '', '@param $andor' => '', '@param $limit' => '', '@param $offset' => '', '@param $userid' => '', '@return' => 'mixed $itemIds']); - $func = $xc->getXcEqualsOperator('$ret', "[]", '', $t); - $func .= $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')) { + $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')) { $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 .= $pc->getPhpCodeCommentLine('search in table', $tableName, $t); - $func .= $pc->getPhpCodeCommentLine('search keywords', '', $t); - $func .= $xc->getXcEqualsOperator('$elementCount', '0', '', $t); - $func .= $xc->getXcHandlerLine($tableName, $t); - $contIf = $xc->getXcEqualsOperator('$elementCount', 'count($queryarray)', '', $t . "\t"); - $func .= $pc->getPhpCodeConditions('is_array($queryarray)', '', '', $contIf, false, $t); - $contIf = $xc->getXcCriteriaCompo('crKeywords', $t . "\t"); - $for = $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'); + $fieldUser = ''; + foreach (\array_keys($fields) as $f) { + $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; } @@ -124,42 +135,46 @@ public function getSearchFunction($moduleDirname) $fieldDate = $fieldName; } if (1 === (int)$fields[$f]->getVar('field_search')) { - $crit = $xc->getXcCriteria('', "'{$fieldName}'", "'%' . \$queryarray[\$i] . '%'", "'LIKE'", true, $t . "\t"); - $for .= $xc->getXcCriteriaAdd('crKeyword', $crit, $t . "\t\t", "\n", "'OR'"); + $crit = $this->xc->getXcCriteria('', "'{$fieldName}'", "'%' . \$queryarray[\$i] . '%'", "'LIKE'", true, $t . "\t"); + $for .= $this->xc->getXcCriteriaAdd('crKeyword', $crit, $t . "\t\t", "\n", "'OR'"); $countField++; } } if ($countField > 0) { - $for .= $xc->getXcCriteriaAdd('crKeywords', '$crKeyword', $t . "\t\t", "\n", '$andor'); + $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"); + $func .= $this->pc->getPhpCodeConditions('$elementCount', ' > ', '0', $contIf, false, $t); + 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'); } - $for .= $pc->getPhpCodeUnset('crKeyword', $t . "\t\t"); - $contIf .= $pc->getPhpCodeFor( 'i', $for, 'elementCount', '0', ' < ', $t . "\t"); - $func .= $pc->getPhpCodeConditions('$elementCount', ' > ', '0', $contIf, false, $t); - $func .= $pc->getPhpCodeCommentLine('search user(s)', '', $t); - $contIf = $xc->getXcEqualsOperator('$userid', "array_map('intval', \$userid)", '', $t . "\t"); - $contIf .= $xc->getXcCriteriaCompo('crUser', $t . "\t"); - $crit = $xc->getXcCriteria('', "'{$tableFieldname}_submitter'", "'(' . implode(',', \$userid) . ')'", "'IN'", true, $t . "\t"); - $contIf .= $xc->getXcCriteriaAdd('crUser', $crit, $t . "\t", "\n", "'OR'"); - $contElse = $xc->getXcCriteriaCompo('crUser', $t . "\t"); - $crit = $xc->getXcCriteria('', "'{$tableFieldname}_submitter'", '$userid', '', true, $t . "\t"); - $contElse .= $xc->getXcCriteriaAdd('crUser', $crit, $t . "\t", "\n", "'OR'"); - $func .= $pc->getPhpCodeConditions('$userid && is_array($userid)', '', '', $contIf, $contElse, $t, 'is_numeric($userid) && $userid > 0'); - $func .= $xc->getXcCriteriaCompo('crSearch', $t); - $contIf = $xc->getXcCriteriaAdd('crSearch', '$crKeywords', $t . "\t", "\n", "'AND'"); - $cond = $pc->getPhpCodeIsset('crKeywords'); - $func .= $pc->getPhpCodeConditions($cond, '', '', $contIf, false, $t); - $contIf = $xc->getXcCriteriaAdd('crSearch', '$crUser', $t . "\t", "\n", "'AND'"); - $cond = $pc->getPhpCodeIsset('crUser'); - $func .= $pc->getPhpCodeConditions($cond, '', '', $contIf, false, $t); - $func .= $xc->getXcCriteriaSetStart( 'crSearch', '$offset', $t); - $func .= $xc->getXcCriteriaSetLimit( 'crSearch', '$limit', $t); + $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); + 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) { - $func .= $xc->getXcCriteriaSetSort( 'crSearch', "'{$fieldDate}'", $t); + $func .= $this->xc->getXcCriteriaSetSort('crSearch', "'{$fieldDate}'", $t); } else { - $func .= $xc->getXcCriteriaSetSort( 'crSearch', "'{$fieldId}_date'", $t); + $func .= $this->xc->getXcCriteriaSetSort('crSearch', "'{$fieldId}_date'", $t); } - $func .= $xc->getXcCriteriaSetOrder( 'crSearch', "'DESC'", $t); - $func .= $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"; @@ -168,39 +183,38 @@ public function getSearchFunction($moduleDirname) $contentForeach .= $t . "\t\t'time' => \${$tableName}All[\$i]->getVar('{$fieldDate}')\n"; } $contentForeach .= $t . "\t];\n"; - $func .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, "\t"); - $func .= $pc->getPhpCodeUnset('crKeywords', $t); - $func .= $pc->getPhpCodeUnset('crKeyword', $t); - $func .= $pc->getPhpCodeUnset('crUser', $t); - $func .= $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 .= $pc->getPhpCodeBlankLine(); + $func .= $this->pc->getPhpCodeBlankLine(); } } $func .= $this->getSimpleString('return $ret;', $t); - $func .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeFunction("{$moduleDirname}_search", '$queryarray, $andor, $limit, $offset, $userid', $func); + $func .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeFunction("{$moduleDirname}_search", '$queryarray, $andor, $limit, $offset, $userid', $func); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname]); $content .= $this->getSearchFunction($moduleDirname); - $this->tdmcfile->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->cf->create($moduleDirname, 'include', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); + return $this->cf->renderFile(); } } diff --git a/class/Files/Includes/index.html b/class/Files/Includes/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/Files/Includes/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/Files/Includes/index.php b/class/Files/Includes/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Includes/index.php @@ -0,0 +1,2 @@ +defines = LanguageDefines::getInstance(); + $this->ld = LanguageDefines::getInstance(); + $this->pc = Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return LanguageAdmin */ public static function getInstance() @@ -64,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) + public function write($module, $table, $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -80,24 +86,32 @@ public function write($module, $table, $tables, $filename) /** * @public function getLanguageAdminIndex * @param string $language - * @param string $tables + * @param array $tables * @return string */ - public function getLanguageAdminIndex($language, $tables) + public function getLanguageAdminIndex(string $language, array $tables) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $ret = $this->defines->getBlankLine(); - $ret .= $pc->getPhpCodeIncludeDir("'common.php'",'', true, true, 'include'); - $ret .= $this->defines->getBlankLine(); - $ret .= $this->defines->getAboveHeadDefines('Admin Index'); - $ret .= $this->defines->getDefine($language, 'STATISTICS', 'Statistics'); - $ret .= $this->defines->getAboveDefines('There are'); - foreach (array_keys($tables) as $t) { + $thereare = ''; + $tableUser = 0; + foreach (\array_keys($tables) as $t) { + if (1 == (int)$tables[$t]->getVar('table_user')) { + $tableUser = 1; + } $tableName = $tables[$t]->getVar('table_name'); - $stuTableName = mb_strtoupper($tableName); - $stlTableName = mb_strtolower($tableName); - $ret .= $this->defines->getDefine($language, "THEREARE_{$stuTableName}", "There are %s {$stlTableName} in the database", true); + $stuTableName = \mb_strtoupper($tableName); + $stlTableName = \mb_strtolower($tableName); + $thereare .= $this->ld->getDefine($language, "THEREARE_{$stuTableName}", "There are %s {$stlTableName} in the database", true); } + $ret = $this->ld->getBlankLine(); + $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'common', true); + if ($tableUser) { + $ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'main', true); + } + $ret .= $this->ld->getBlankLine(); + $ret .= $this->ld->getAboveHeadDefines('Admin Index'); + $ret .= $this->ld->getDefine($language, 'STATISTICS', 'Statistics'); + $ret .= $this->ld->getAboveDefines('There are'); + $ret .= $thereare; return $ret; } @@ -105,39 +119,39 @@ public function getLanguageAdminIndex($language, $tables) /** * @public function getLanguageAdminPages * @param string $language - * @param string $tables + * @param array $tables * @return string */ - public function getLanguageAdminPages($language, $tables) + public function getLanguageAdminPages(string $language, array $tables) { - $ret = $this->defines->getAboveHeadDefines('Admin Files'); - $ret .= $this->defines->getAboveDefines('There aren\'t'); - foreach (array_keys($tables) as $t) { + $ret = $this->ld->getAboveHeadDefines('Admin Files'); + $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->defines->getDefine($language, "THEREARENT_{$stuTableName}", "There aren't {$stlTableName}", true); + $stuTableName = \mb_strtoupper($tableName); + $stlTableName = \mb_strtolower($tableName); + $ret .= $this->ld->getDefine($language, "THEREARENO_{$stuTableName}", "There are no {$stlTableName}", true); } - $ret .= $this->defines->getAboveDefines('Save/Delete'); - $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->getAboveDefines('Buttons'); - - foreach (array_keys($tables) as $t) { + $ret .= $this->ld->getAboveDefines('Save/Delete'); + $ret .= $this->ld->getDefine($language, 'FORM_OK', 'Successfully saved'); + $ret .= $this->ld->getDefine($language, 'FORM_DELETE_OK', 'Successfully deleted'); + $ret .= $this->ld->getDefine($language, 'FORM_SURE_DELETE', "Are you sure to delete: %s ", true); + $ret .= $this->ld->getDefine($language, 'FORM_SURE_RENEW', "Are you sure to update: %s ", true); + $ret .= $this->ld->getAboveDefines('Buttons'); + + foreach (\array_keys($tables) as $t) { $tableSoleName = $tables[$t]->getVar('table_solename'); - $stuTableSoleName = mb_strtoupper($tableSoleName); - $ucfTableSoleName = ucfirst($tableSoleName); - $ret .= $this->defines->getDefine($language, "ADD_{$stuTableSoleName}", "Add New {$ucfTableSoleName}"); + $stuTableSoleName = \mb_strtoupper($tableSoleName); + $ucfTableSoleName = \ucfirst($tableSoleName); + $ret .= $this->ld->getDefine($language, "ADD_{$stuTableSoleName}", "Add New {$ucfTableSoleName}"); } - $ret .= $this->defines->getAboveDefines('Lists'); + $ret .= $this->ld->getAboveDefines('Lists'); - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); - $stuTableName = mb_strtoupper($tableName); - $ucfTableName = ucfirst($tableName); - $ret .= $this->defines->getDefine($language, "{$stuTableName}_LIST", "List of {$ucfTableName}"); + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $ret .= $this->ld->getDefine($language, "LIST_{$stuTableName}", "List of {$ucfTableName}"); } return $ret; @@ -146,105 +160,132 @@ public function getLanguageAdminPages($language, $tables) /** * @public function getLanguageAdminClass * @param string $language - * @param string $tables + * @param array $tables * @return string */ - public function getLanguageAdminClass($language, $tables) + public function getLanguageAdminClass(string $language, array $tables) { - $ret = $this->defines->getAboveHeadDefines('Admin Classes'); - - foreach (array_keys($tables) as $t) { + $ret = $this->ld->getAboveHeadDefines('Admin Classes'); + $fieldStatus = 0; + $fieldSampleListValue = 0; + $tableBroken = 0; + foreach (\array_keys($tables) as $t) { $tableId = $tables[$t]->getVar('table_id'); $tableMid = $tables[$t]->getVar('table_mid'); $tableSoleName = $tables[$t]->getVar('table_solename'); - $ucfTableSoleName = ucfirst($tableSoleName); + $tableBroken = $tables[$t]->getVar('table_broken'); + $ucfTableSoleName = \ucfirst($tableSoleName); $fields = $this->getTableFields($tableMid, $tableId); $fieldInForm = 0; - - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { if ($fieldInForm < $fields[$f]->getVar('field_inform')) { $fieldInForm = $fields[$f]->getVar('field_inform'); } } if (1 == $fieldInForm) { - $ret .= $this->defines->getAboveDefines("{$ucfTableSoleName} add/edit"); - $ret .= $this->defines->getDefine($language, "{$tableSoleName}_ADD", "Add {$ucfTableSoleName}"); - $ret .= $this->defines->getDefine($language, "{$tableSoleName}_EDIT", "Edit {$ucfTableSoleName}"); + $ret .= $this->ld->getAboveDefines("{$ucfTableSoleName} add/edit"); + $ret .= $this->ld->getDefine($language, "{$tableSoleName}_ADD", "Add {$ucfTableSoleName}"); + $ret .= $this->ld->getDefine($language, "{$tableSoleName}_EDIT", "Edit {$ucfTableSoleName}"); } - $ret .= $this->defines->getAboveDefines("Elements of {$ucfTableSoleName}"); + $ret .= $this->ld->getAboveDefines("Elements of {$ucfTableSoleName}"); - $fieldStatus = 0; - $fieldSampleListValue = 0; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); - - $rpFieldName = $this->getRightString($fieldName); - if ($fieldElement > 16) { - $fieldElements = Tdmcreate\Helper::getInstance()->getHandler('fieldelements')->get($fieldElement); + $rpFieldName = $this->getRightString($fieldName); + if ($fieldElement >= Constants::FIRST_FIELDELEMENT_TABLE) { + $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); + $fieldNameDesc = mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); + $fieldNameDesc = \str_replace(': ', '', $fieldNameDesc); } else { - $fieldNameDesc = false !== mb_strpos($rpFieldName, '_') ? str_replace('_', ' ', ucfirst($rpFieldName)) : ucfirst($rpFieldName); + $fieldNameDesc = false !== mb_strpos($rpFieldName, '_') ? \str_replace('_', ' ', \ucfirst($rpFieldName)) : \ucfirst($rpFieldName); } - - $ret .= $this->defines->getDefine($language, $tableSoleName . '_' . $rpFieldName, $fieldNameDesc); + $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName, $fieldNameDesc); switch ($fieldElement) { - case 10: - $ret .= $this->defines->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in frameworks images: %s"); + case Constants::FIELD_ELE_IMAGELIST: + $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in frameworks images: %s"); break; - case 12: - $ret .= $this->defines->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in uploads"); + case Constants::FIELD_ELE_URLFILE: + $ret .= $this->ld->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in uploads"); break; - case 11: - case 13: - case 14: - $ret .= $this->defines->getDefine($language, $tableSoleName . '_' . $rpFieldName . '_UPLOADS', "{$fieldNameDesc} in %s :"); + 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++; } - if (20 === (int)$fieldElement || 20 === (int)$fieldElement) { + if (20 === (int)$fieldElement || 22 === (int)$fieldElement) { $fieldSampleListValue++; } } } - $ret .= $this->defines->getAboveDefines('General'); - $ret .= $this->defines->getDefine($language, 'FORM_UPLOAD', 'Upload file'); - $ret .= $this->defines->getDefine($language, 'FORM_UPLOAD_NEW', 'Upload new file: '); - $ret .= $this->defines->getDefine($language, 'FORM_UPLOAD_SIZE', 'Max file size: '); - $ret .= $this->defines->getDefine($language, 'FORM_UPLOAD_SIZE_MB', 'MB'); - $ret .= $this->defines->getDefine($language, 'FORM_UPLOAD_IMG_WIDTH', 'Max image width: '); - $ret .= $this->defines->getDefine($language, 'FORM_UPLOAD_IMG_HEIGHT', 'Max image height: '); - $ret .= $this->defines->getDefine($language, 'FORM_IMAGE_PATH', 'Files in %s :'); - $ret .= $this->defines->getDefine($language, 'FORM_ACTION', 'Action'); - $ret .= $this->defines->getDefine($language, 'FORM_EDIT', 'Modification'); - $ret .= $this->defines->getDefine($language, 'FORM_DELETE', 'Clear'); + $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: '); + $ret .= $this->ld->getDefine($language, 'FORM_UPLOAD_SIZE', 'Max file size: '); + $ret .= $this->ld->getDefine($language, 'FORM_UPLOAD_SIZE_MB', 'MB'); + $ret .= $this->ld->getDefine($language, 'FORM_UPLOAD_IMG_WIDTH', 'Max image width: '); + $ret .= $this->ld->getDefine($language, 'FORM_UPLOAD_IMG_HEIGHT', 'Max image height: '); + $ret .= $this->ld->getDefine($language, 'FORM_IMAGE_PATH', 'Files in %s :'); + $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->defines->getAboveDefines('Status'); - $ret .= $this->defines->getDefine($language, 'STATUS_NONE', 'No status'); - $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->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'); + } + if ($tableBroken > 0) { + $ret .= $this->ld->getAboveDefines('Broken'); + $ret .= $this->ld->getDefine($language, 'BROKEN_RESULT', 'Broken items in table %s'); + $ret .= $this->ld->getDefine($language, 'BROKEN_NODATA', 'No broken items in table %s'); + $ret .= $this->ld->getDefine($language, 'BROKEN_TABLE', 'Table'); + $ret .= $this->ld->getDefine($language, 'BROKEN_KEY', 'Key field'); + $ret .= $this->ld->getDefine($language, 'BROKEN_KEYVAL', 'Key value'); + $ret .= $this->ld->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'); - $ret .= $this->defines->getDefine($language, 'LIST_2', 'Sample List Value 2'); - $ret .= $this->defines->getDefine($language, 'LIST_3', 'Sample List Value 3'); + $ret .= $this->ld->getAboveDefines('Sample List Values'); + $ret .= $this->ld->getDefine($language, 'LIST_1', 'Sample List Value 1'); + $ret .= $this->ld->getDefine($language, 'LIST_2', 'Sample List Value 2'); + $ret .= $this->ld->getDefine($language, 'LIST_3', 'Sample List Value 3'); } + $ret .= $this->ld->getAboveDefines('Clone feature'); + $ret .= $this->ld->getDefine($language, 'CLONE', 'Clone'); + $ret .= $this->ld->getDefine($language, 'CLONE_DSC', 'Cloning a module has never been this easy! Just type in the name you want for it and hit submit button!'); + $ret .= $this->ld->getDefine($language, 'CLONE_TITLE', 'Clone %s'); + $ret .= $this->ld->getDefine($language, 'CLONE_NAME', 'Choose a name for the new module'); + $ret .= $this->ld->getDefine($language, 'CLONE_NAME_DSC', 'Do not use special characters!
Do not choose an existing module dirname or database table name!'); + $ret .= $this->ld->getDefine($language, 'CLONE_INVALIDNAME', 'ERROR: Invalid module name, please try another one!'); + $ret .= $this->ld->getDefine($language, 'CLONE_EXISTS', 'ERROR: Module name already taken, please try another one!'); + $ret .= $this->ld->getDefine($language, 'CLONE_CONGRAT', 'Congratulations! %s was sucessfully created!
You may want to make changes in language files.'); + $ret .= $this->ld->getDefine($language, 'CLONE_IMAGEFAIL', 'Attention, we failed creating the new module logo. Please consider modifying assets/images/logo_module.png manually!'); + $ret .= $this->ld->getDefine($language, 'CLONE_FAIL', 'Sorry, we failed in creating the new clone. Maybe you need to temporally set write permissions (CHMOD 777) to modules folder and try again.'); return $ret; } @@ -254,22 +295,22 @@ public function getLanguageAdminClass($language, $tables) * @param string $language * @return string */ - public function getLanguageAdminPermissions($language) + public function getLanguageAdminPermissions(string $language) { - $ret = $this->defines->getAboveHeadDefines('Admin Permissions'); - $ret .= $this->defines->getAboveDefines('Permissions'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_GLOBAL', 'Permissions global'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_GLOBAL_16', 'Permissions global to view'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_APPROVE', 'Permissions to approve'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_SUBMIT', 'Permissions to submit'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_VIEW', 'Permissions to view'); - $ret .= $this->defines->getDefine($language, 'PERMISSIONS_VIEW_DESC', 'Permissions to view'); - $ret .= $this->defines->getDefine($language, 'NO_PERMISSIONS_SET', 'No permission set'); + $ret = $this->ld->getAboveHeadDefines('Admin Permissions'); + $ret .= $this->ld->getAboveDefines('Permissions'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_GLOBAL', 'Permissions global'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_GLOBAL_16', 'Permissions global to view'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_APPROVE', 'Permissions to approve'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_SUBMIT', 'Permissions to submit'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_VIEW', 'Permissions to view'); + $ret .= $this->ld->getDefine($language, 'PERMISSIONS_VIEW_DESC', 'Permissions to view'); + $ret .= $this->ld->getDefine($language, 'NO_PERMISSIONS_SET', 'No permission set'); return $ret; } @@ -279,45 +320,48 @@ public function getLanguageAdminPermissions($language) * @param string $language * @return string */ - public function getLanguageAdminFoot($language) + public function getLanguageAdminFoot(string $language) { - $ret = $this->defines->getAboveHeadDefines('Admin Others'); - $ret .= $this->defines->getDefine($language, 'MAINTAINEDBY', ' is maintained by '); - $ret .= $this->defines->getBelowDefines('End'); - $ret .= $this->defines->getBlankLine(); + $ret = $this->ld->getAboveHeadDefines('Admin Others'); + $ret .= $this->ld->getDefine($language, 'ABOUT_MAKE_DONATION', 'Submit'); + $ret .= $this->ld->getDefine($language, 'SUPPORT_FORUM', 'Support Forum'); + $ret .= $this->ld->getDefine($language, 'DONATION_AMOUNT', 'Donation Amount'); + $ret .= $this->ld->getDefine($language, 'MAINTAINEDBY', ' is maintained by '); + $ret .= $this->ld->getBelowDefines('End'); + $ret .= $this->ld->getBlankLine(); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $module = $this->getModule(); - $tables = $this->getTableTables($module->getVar('mod_id')); + $module = $this->getModule(); + $tables = $this->getTableTables($module->getVar('mod_id')); $tablePermissions = []; - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $tablePermissions[] = $tables[$t]->getVar('table_permissions'); } $tables = $this->getTables(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'AM'); + $language = $this->getLanguage($moduleDirname, 'AM', '', false); $content = $this->getHeaderFilesComments($module); - if (is_array($tables)) { + if (\is_array($tables)) { $content .= $this->getLanguageAdminIndex($language, $tables); $content .= $this->getLanguageAdminPages($language, $tables); $content .= $this->getLanguageAdminClass($language, $tables); } - if (in_array(1, $tablePermissions)) { + if (\in_array(1, $tablePermissions)) { $content .= $this->getLanguageAdminPermissions($language); } $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..5873e2ab 100644 --- a/class/Files/Language/LanguageBlocks.php +++ b/class/Files/Language/LanguageBlocks.php @@ -1,9 +1,9 @@ -defines = LanguageDefines::getInstance(); + $this->ld = LanguageDefines::getInstance(); } /** * @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) + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -80,32 +79,37 @@ public function write($module, $tables, $filename) * * @return string */ - private function getLanguageBlock($language) + private function getLanguageBlock(string $language) { $tables = $this->getTables(); - $ret = $this->defines->getAboveDefines('Admin Edit'); - $ret .= $this->defines->getDefine($language, 'DISPLAY', 'How Many Tables to Display'); - $ret .= $this->defines->getDefine($language, 'TITLE_LENGTH', 'Title Length'); - $ret .= $this->defines->getDefine($language, 'CATTODISPLAY', 'Categories to Display'); - $ret .= $this->defines->getDefine($language, 'ALLCAT', 'All Categories'); - foreach (array_keys($tables) as $t) { + $ret = $this->ld->getAboveDefines('Admin Edit'); + $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'); + foreach (\array_keys($tables) as $t) { if (1 === (int)$tables[$t]->getVar('table_blocks')) { - $tableName = $tables[$t]->getVar('table_name'); - $ucfTableName = ucfirst($tableName); - $ret .= $this->defines->getAboveDefines($ucfTableName); - $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); - $stuTableName = mb_strtoupper($tableName); - $ret .= $this->defines->getDefine($language, $stuTableName . '_TO_DISPLAY', $ucfTableName . ' to Display'); - $ret .= $this->defines->getDefine($language, 'ALL_' . $stuTableName, 'All ' . $ucfTableName); - foreach (array_keys($fields) as $f) { + $tableName = $tables[$t]->getVar('table_name'); + $tableSoleName = $tables[$t]->getVar('table_solename'); + $ucfTableName = \ucfirst($tableName); + $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); + 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); - $fieldNameDesc = ucfirst($rpFieldName); - $ret .= $this->defines->getDefine($language, $stuFieldName, $fieldNameDesc); + $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, $stuTableSoleName . '_GOTO', 'Goto ' . $ucfTableSoleName); } } @@ -114,33 +118,33 @@ private function getLanguageBlock($language) /** * @private function getFooter - * @param null + * * @return string */ private function getLanguageFooter() { - $ret = $this->defines->getBelowDefines('End'); - $ret .= $this->defines->getBlankLine(); + $ret = $this->ld->getBelowDefines('End'); + $ret .= $this->ld->getBlankLine(); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MB'); + $language = $this->getLanguage($moduleDirname, 'MB', '', false); $content = $this->getHeaderFilesComments($module); $content .= $this->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..ed15270f 100644 --- a/class/Files/Language/LanguageDefines.php +++ b/class/Files/Language/LanguageDefines.php @@ -1,8 +1,8 @@ -getPhpCodeDefine("{$language}{$defined}", "\"{$description}\""); @@ -103,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 a7eb8bf5..be96ba22 100644 --- a/class/Files/Language/LanguageHelp.php +++ b/class/Files/Language/LanguageHelp.php @@ -1,9 +1,9 @@ -defines = LanguageDefines::getInstance(); } /** * @static function getInstance - * @param null + * * @return LanguageHelp */ public static function getInstance() @@ -63,10 +57,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param Modulebuilder\Modules $module * @param string $filename */ - public function write($module, $filename) + public function write(Modulebuilder\Modules $module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,10 +68,10 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ - public function render() + public function render(): string { $module = $this->getModule(); $filename = $this->getFileName(); @@ -85,38 +79,41 @@ 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 TDMCreate 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_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $this->create($moduleDirname, 'language/' . $language . '/help', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + if (!$this->renderFile()) { + throw new \RuntimeException("The {$filename} file in 'language/" . $language . "/help' could not be created."); + } } - $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/help', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_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/Language/LanguageMailTpl.php b/class/Files/Language/LanguageMailTpl.php index e467b1cc..5bc18e34 100644 --- a/class/Files/Language/LanguageMailTpl.php +++ b/class/Files/Language/LanguageMailTpl.php @@ -1,9 +1,9 @@ -setModule($module); + $this->setTable($table); $this->setFileName($filename); } /** - * @public function renderFile - * @return bool|string + * @public function getTemplateDummy + * @param $tableSoleName + * @param $line + * @return string */ - public function render() + public function getTemplateDummy($tableSoleName, $line) { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $content = <<<'EOT' -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('A new ' . $tableSoleName . ' "{ITEM_NAME}" has been added at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a new ' . $tableSoleName . ' is added to our site.'); + $ret .= $this->getSimpleString(''); + + return $ret; + } + + /** + * @public function getTemplateTableModify + * @param $tableSoleName + * @param $line + * @return string + */ + public function getTemplateTableModify($tableSoleName, $line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The ' . $tableSoleName . ' "{ITEM_NAME}" has been modified at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is modified on our site.'); -A new story "{STORY_NAME}" has been added at {X_SITENAME}. + return $ret; + } -You can view this story here: -{STORY_URL} + /** + * @public function getTemplateTableDelete + * @param $tableSoleName + * @param $line + * @return string + */ + public function getTemplateTableDelete($tableSoleName, $line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The ' . $tableSoleName . ' "{ITEM_NAME}" has been deleted from {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is deleted from our site.'); ------------ + return $ret; + } -You are receiving this message because you selected to be notified when new stories are added to our site. + /** + * @public function getTemplateTableApprove + * @param $tableSoleName + * @param $line + * @return string + */ + public function getTemplateTableApprove($tableSoleName, $line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('A new ' . $tableSoleName . ' "{ITEM_NAME}" is waiting for approval at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is waitung for approval on our site.'); -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} + return $ret; + } -Please do not reply to this message. + /** + * @public function getTemplateTableApprove + * @param $tableSoleName + * @param $line + * @return string + */ + public function getTemplateTableBroken($tableSoleName, $line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The ' . $tableSoleName . ' "{ITEM_NAME}" has been notified as broken at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is notified as broken on our site.'); + + return $ret; + } + + /** + * @public function getTemplateTableComment + * @param $tableSoleName + * @param $line + * @return string + */ + public function getTemplateTableComment($tableSoleName, $line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('A comment was published for ' . $tableSoleName . ' "{ITEM_NAME}" at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this comment here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is modified on our site.'); + + return $ret; + } + + /** + * @public function getTemplateGlobalNew + * @param $line + * @return string + */ + public function getTemplateGlobalNew($line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('A new item "{ITEM_NAME}" has been added at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this item here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a new item is added to our site.'); + + return $ret; + } + + /** + * @public function getTemplateGlobalModify + * @param $line + * @return string + */ + public function getTemplateGlobalModify($line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The item "{ITEM_NAME}" has been modified at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this item here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is modified on our site.'); ------------ + return $ret; + } + + /** + * @public function getTemplateGlobalDelete + * @param $line + * @return string + */ + public function getTemplateGlobalDelete($line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The item "{ITEM_NAME}" has been deleted from {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is deleted from our site.'); + + return $ret; + } + + /** + * @public function getTemplateGlobalApprove + * @param $line + * @return string + */ + public function getTemplateGlobalApprove($line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The item "{ITEM_NAME}" is waiting for approval at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this item here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is waitung for approval on our site.'); + + return $ret; + } + + /** + * @public function getTemplateGlobalBroken + * @param $line + * @return string + */ + public function getTemplateGlobalBroken($line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('The item "{ITEM_NAME}" has been notified as broken at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this item here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is notified as broken on our site.'); + + return $ret; + } + + /** + * @public function getTemplateGlobalNew + * @param $line + * @return string + */ + public function getTemplateGlobalComment($line) + { + $ret = $this->getSimpleString('Hello {X_UNAME},'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('A new comment has been added to "{ITEM_NAME}" at {X_SITENAME}.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You can view this comment here:'); + $ret .= $this->getSimpleString('{ITEM_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a new comment is added to an item of our site.'); + + return $ret; + } + + /** + * @public function getTemplateTableApprove + * @param $line + * @return string + */ + public function getTemplateTableFooter($line) + { + $ret = $this->getSimpleString(''); + $ret .= $this->getSimpleString('If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below:'); + $ret .= $this->getSimpleString('{X_UNSUBSCRIBE_URL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('Please do not reply to this message.'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString('{X_SITENAME} ({X_SITEURL})'); + $ret .= $this->getSimpleString('webmaster'); + $ret .= $this->getSimpleString('{X_ADMINMAIL}'); + $ret .= $this->getSimpleString(''); + $ret .= $this->getSimpleString($line); + + return $ret; + } + + /** + * @public function renderFile + * @return string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $table = $this->getTable(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableSoleName = $table->getVar('table_solename'); + + $line = '------------------------------------------------------------------'; + $content = ''; + switch ($filename) { + case 'category_new_notify.tpl': + //$content .= $this->getTemplateCategoryNew('categories', 'CATEGORY', 'CATEGORY', $line); + //break; + case 'default': + default: + $content .= $this->getTemplateDummy($tableSoleName, $line); + break; + case 'global_new_notify.tpl': + $content .= $this->getTemplateGlobalNew($line); + break; + case 'global_modify_notify.tpl': + $content .= $this->getTemplateGlobalModify($line); + break; + case 'global_delete_notify.tpl': + $content .= $this->getTemplateGlobalDelete($line); + break; + case 'global_approve_notify.tpl': + $content .= $this->getTemplateGlobalApprove($line); + break; + case 'global_broken_notify.tpl': + $content .= $this->getTemplateGlobalBroken($line); + break; + case 'global_comment_notify.tpl': + $content .= $this->getTemplateGlobalComment($line); + break; + case $tableSoleName . '_modify_notify.tpl': + $content .= $this->getTemplateTableModify($tableSoleName, $line); + break; + case $tableSoleName . '_delete_notify.tpl': + $content .= $this->getTemplateTableDelete($tableSoleName, $line); + break; + case $tableSoleName . '_approve_notify.tpl': + $content .= $this->getTemplateTableApprove($tableSoleName, $line); + break; + case $tableSoleName . '_broken_notify.tpl': + $content .= $this->getTemplateTableBroken($tableSoleName, $line); + break; + case $tableSoleName . '_comment_notify.tpl': + $content .= $this->getTemplateTableComment($tableSoleName, $line); + break; + } + $content .= $this->getTemplateTableFooter($line); -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} -EOT; - $this->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 14470505..5bfae901 100644 --- a/class/Files/Language/LanguageMain.php +++ b/class/Files/Language/LanguageMain.php @@ -1,9 +1,9 @@ -defines = LanguageDefines::getInstance(); + $this->ld = LanguageDefines::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return LanguageMain */ public static function getInstance() @@ -63,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) + public function write($module, $tables, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -76,75 +80,130 @@ public function write($module, $tables, $filename) /** * @private function getLanguageMain - * @param string $module + * @param $module * @param string $language * * @return string */ - private function getLanguageMain($module, $language) + private function getLanguageMain($module, string $language) { - /** @var \XoopsModules\Tdmcreate\Utility $utility */ - $utility = new \XoopsModules\Tdmcreate\Utility(); + $utility = new \XoopsModules\Modulebuilder\Utility(); - $moduleName = $module->getVar('mod_name'); $tables = $this->getTables(); - $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')); - $ret .= $this->defines->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); - $ret .= $this->defines->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 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.", - true - ); - $ret .= $this->defines->getDefine($language, 'NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); - $ret .= $this->defines->getDefine($language, 'NO', 'No'); - $ret .= $this->defines->getAboveHeadDefines('Contents'); + $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, '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'); + $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 = ''; - $tableSoleName = ''; - foreach (array_keys($tables) as $i) { - $tableName = $tables[$i]->getVar('table_name'); - $tableSoleName = $tables[$i]->getVar('table_solename'); - $stuTableName = mb_strtoupper($tableName); - $stuTableSoleName = mb_strtoupper($tableSoleName); - $ucfTableName = $utility::UcFirstAndToLower($tableName); - $ucfTableSoleName = $utility::UcFirstAndToLower($tableSoleName); - $ret .= $this->defines->getAboveDefines($ucfTableSoleName); - $ret .= $this->defines->getDefine($language, $stuTableSoleName, $ucfTableSoleName); - $ret .= $this->defines->getDefine($language, $stuTableName, $ucfTableName); - $ret .= $this->defines->getDefine($language, "{$stuTableName}_TITLE", "{$ucfTableName} title"); - $ret .= $this->defines->getDefine($language, "{$stuTableName}_DESC", "{$ucfTableName} description"); - $ret .= $this->defines->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); - $fieldNameDesc = ucfirst($rpFieldName); - $ret .= $this->defines->getDefine($language, $stuTableSoleName . '_' . $rpFieldName, $fieldNameDesc); + $tableSubmit = 0; + $tableBroken = 0; + $tableRate = 0; + $tablePrint = 0; + foreach (\array_keys($tables) as $i) { + if (1 == $tables[$i]->getVar('table_user')) { + $tableName = $tables[$i]->getVar('table_name'); + $tableSoleName = $tables[$i]->getVar('table_solename'); + if (1 === (int)$tables[$i]->getVar('table_submit')) { + $tableSubmit = 1; + } + if (1 === (int)$tables[$i]->getVar('table_broken')) { + $tableBroken = 1; + } + if (1 === (int)$tables[$i]->getVar('table_rate')) { + $tableRate = 1; + } + if (1 === (int)$tables[$i]->getVar('table_print')) { + $tablePrint = 1; + } + $stuTableName = \mb_strtoupper($tableName); + $stuTableSoleName = \mb_strtoupper($tableSoleName); + $ucfTableName = $utility::UcFirstAndToLower($tableName); + $ucfTableSoleName = $utility::UcFirstAndToLower($tableSoleName); + $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}"); + $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"); + $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) { + $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, 'INDEX_THEREARE', "There are %s {$ucfTableName}"); + $ret .= $this->ld->getDefine($language, 'INDEX_LATEST_LIST', "Last {$module->getVar('mod_name')}"); + 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'); + $ret .= $this->ld->getDefine($language, 'FORM_SURE_DELETE', "Are you sure to delete: %s ", true); + $ret .= $this->ld->getDefine($language, 'FORM_SURE_RENEW', "Are you sure to update: %s ", true); + if (1 === $tableBroken) { + $ret .= $this->ld->getDefine($language, 'FORM_SURE_BROKEN', "Are you sure to notify as broken: %s ", true); } } - $ret .= $this->defines->getDefine($language, 'INDEX_THEREARE', "There are %s {$ucfTableName}"); - $ret .= $this->defines->getDefine($language, 'INDEX_LATEST_LIST', "Last {$module->getVar('mod_name')}"); - $ret .= $this->defines->getAboveDefines('Submit'); - $ret .= $this->defines->getDefine($language, 'SUBMIT', 'Submit'); - $ret .= $this->defines->getDefine($language, "SUBMIT_{$stuTableSoleName}", "Submit {$ucfTableSoleName}"); - $ret .= $this->defines->getDefine($language, 'SUBMIT_ALLPENDING', "All {$tableSoleName}/script information are posted pending verification."); - $ret .= $this->defines->getDefine($language, 'SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); - $ret .= $this->defines->getDefine($language, 'SUBMIT_ISAPPROVED', "Your {$tableSoleName} has been approved"); - $ret .= $this->defines->getDefine($language, 'SUBMIT_PROPOSER', "Submit a {$tableSoleName}"); - $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 === $tableRate) { + $ret .= $this->ld->getAboveHeadDefines('Ratings'); + $ret .= $this->ld->getDefine($language, 'RATING_CURRENT_1', 'Rating: %c / %m (%t rating totally)'); + $ret .= $this->ld->getDefine($language, 'RATING_CURRENT_X', 'Rating: %c / %m (%t ratings totally)'); + $ret .= $this->ld->getDefine($language, 'RATING_CURRENT_SHORT_1', '%c (%t rating)'); + $ret .= $this->ld->getDefine($language, 'RATING_CURRENT_SHORT_X', '%c (%t ratings)'); + $ret .= $this->ld->getDefine($language, 'RATING1', '1 of 5'); + $ret .= $this->ld->getDefine($language, 'RATING2', '2 of 5'); + $ret .= $this->ld->getDefine($language, 'RATING3', '3 of 5'); + $ret .= $this->ld->getDefine($language, 'RATING4', '4 of 5'); + $ret .= $this->ld->getDefine($language, 'RATING5', '5 of 5'); + $ret .= $this->ld->getDefine($language, 'RATING_10_1', '1 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_2', '2 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_3', '3 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_4', '4 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_5', '5 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_6', '6 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_7', '7 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_8', '8 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_9', '9 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_10_10', '10 of 10'); + $ret .= $this->ld->getDefine($language, 'RATING_VOTE_BAD', 'Invalid vote'); + $ret .= $this->ld->getDefine($language, 'RATING_VOTE_ALREADY', 'You have already voted'); + $ret .= $this->ld->getDefine($language, 'RATING_VOTE_THANKS', 'Thank you for rating'); + $ret .= $this->ld->getDefine($language, 'RATING_NOPERM', "Sorry, you don't have permission to rate items", true); + $ret .= $this->ld->getDefine($language, 'RATING_LIKE', 'Like'); + $ret .= $this->ld->getDefine($language, 'RATING_DISLIKE', 'Dislike'); + $ret .= $this->ld->getDefine($language, 'RATING_ERROR1', 'Error: update base table failed!'); + } + if (1 === $tablePrint) { + $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; } @@ -154,32 +213,32 @@ private function getLanguageMain($module, $language) * * @return string */ - private function getLanguageMainFooter($language) + private function getLanguageMainFooter(string $language) { - $ret = $this->defines->getAboveDefines('Admin link'); - $ret .= $this->defines->getDefine($language, 'ADMIN', 'Admin'); - $ret .= $this->defines->getBelowDefines('End'); - $ret .= $this->defines->getBlankLine(); + $ret = $this->ld->getAboveDefines('Admin link'); + $ret .= $this->ld->getDefine($language, 'ADMIN', 'Admin'); + $ret .= $this->ld->getBelowDefines('End'); + $ret .= $this->ld->getBlankLine(); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MA'); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); $content = $this->getHeaderFilesComments($module); $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 f03725de..2ba32095 100644 --- a/class/Files/Language/LanguageModinfo.php +++ b/class/Files/Language/LanguageModinfo.php @@ -1,9 +1,9 @@ -ld = LanguageDefines::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return LanguageModinfo */ public static function getInstance() @@ -83,14 +93,12 @@ public function write($module, $table, $filename) */ private function getLanguageMain($language, $module) { - $df = LanguageDefines::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $ret = $df->getBlankLine(); - $ret .= $pc->getPhpCodeIncludeDir("'common.php'",'', true, true, 'include'); - $ret .= $df->getBlankLine(); - $ret .= $df->getAboveHeadDefines('Admin Main'); - $ret .= $df->getDefine($language, 'NAME', (string)$module->getVar('mod_name')); - $ret .= $df->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); + $ret = $this->ld->getBlankLine(); + $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')); + $ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); return $ret; } @@ -105,25 +113,32 @@ private function getLanguageMain($language, $module) */ private function getLanguageMenu($module, $language) { - $df = Tdmcreate\Files\Language\LanguageDefines::getInstance(); $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); $menu = 1; - $ret = $df->getAboveHeadDefines('Admin Menu'); - $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Dashboard'); + $ret = $this->ld->getAboveHeadDefines('Admin Menu'); + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Dashboard'); $tablePermissions = []; - foreach (array_keys($tables) as $i) { + $tableBroken = []; + foreach (\array_keys($tables) as $i) { ++$menu; $tablePermissions[] = $tables[$i]->getVar('table_permissions'); - $ucfTableName = ucfirst($tables[$i]->getVar('table_name')); - $ret .= $df->getDefine($language, "ADMENU{$menu}", $ucfTableName); + $tableBroken[] = $tables[$i]->getVar('table_broken'); + $ucfTableName = \ucfirst($tables[$i]->getVar('table_name')); + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", $ucfTableName); } - if (in_array(1, $tablePermissions)) { + if (\in_array(1, $tableBroken)) { ++$menu; - $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Permissions'); + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Broken items'); + } + if (\in_array(1, $tablePermissions)) { + ++$menu; + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Permissions'); } ++$menu; - $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Feedback'); - $ret .= $df->getDefine($language, 'ABOUT', 'About'); + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Clone'); + ++$menu; + $ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Feedback'); + $ret .= $this->ld->getDefine($language, 'ABOUT', 'About'); unset($menu, $tablePermissions); return $ret; @@ -137,10 +152,9 @@ private function getLanguageMenu($module, $language) */ private function getLanguageAdmin($language) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveHeadDefines('Admin Nav'); - $ret .= $df->getDefine($language, 'ADMIN_PAGER', 'Admin pager'); - $ret .= $df->getDefine($language, 'ADMIN_PAGER_DESC', 'Admin per page list'); + $ret = $this->ld->getAboveHeadDefines('Admin Nav'); + $ret .= $this->ld->getDefine($language, 'ADMIN_PAGER', 'Admin pager'); + $ret .= $this->ld->getDefine($language, 'ADMIN_PAGER_DESC', 'Admin per page list'); return $ret; } @@ -152,30 +166,29 @@ private function getLanguageAdmin($language) * * @return string */ - private function getLanguageSubmenu($language, $tables) + private function getLanguageSubmenu($language, array $tables) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('Submenu'); - $ret .= $df->getDefine($language, 'SMNAME1', 'Index page'); - $i = 1; + $ret = $this->ld->getAboveDefines('Submenu'); + $ret .= $this->ld->getDefine($language, 'SMNAME1', 'Index page'); + $i = 2; $tableSubmit = []; $tableSearch = []; - foreach (array_keys($tables) as $t) { + 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 .= $this->ld->getDefine($language, "SMNAME{$i}", $ucfTablename); } ++$i; + if (1 == $tables[$t]->getVar('table_submit')) { + $ret .= $this->ld->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'); + + if (\in_array(1, $tableSearch)) { + $ret .= $this->ld->getDefine($language, "SMNAME{$i}", 'Search'); } unset($i, $tableSubmit); @@ -189,36 +202,38 @@ private function getLanguageSubmenu($language, $tables) * * @return string */ - private function getLanguageBlocks($tables, $language) + private function getLanguageBlocks(array $tables, $language) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('Blocks'); - foreach (array_keys($tables) as $i) { - $tableName = $tables[$i]->getVar('table_name'); - $stuTableName = mb_strtoupper($tableName); - $tableSoleName = $tables[$i]->getVar('table_solename'); - $stuTableSoleName = mb_strtoupper($tableSoleName); - $ucfTableName = ucfirst($tableName); - $ucfTableSoleName = ucfirst($stuTableSoleName); - - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description"); - if (1 == $tables[$i]->getVar('table_category')) { - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); - } else { - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_LAST", "{$ucfTableName} block last"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_LAST_DESC", "{$ucfTableName} block last description"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_NEW", "{$ucfTableName} block new"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_NEW_DESC", "{$ucfTableName} block new description"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_HITS", "{$ucfTableName} block hits"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_HITS_DESC", "{$ucfTableName} block hits description"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_TOP", "{$ucfTableName} block top"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_TOP_DESC", "{$ucfTableName} block top description"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_RANDOM", "{$ucfTableName} block random"); - $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_RANDOM_DESC", "{$ucfTableName} block random description"); + $ret = $this->ld->getAboveDefines('Blocks'); + foreach (\array_keys($tables) as $i) { + if (1 == $tables[$i]->getVar('table_blocks')) { + $tableName = $tables[$i]->getVar('table_name'); + $stuTableName = \mb_strtoupper($tableName); + $tableSoleName = $tables[$i]->getVar('table_solename'); + $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"); + 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"); + } else { + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_LAST", "{$ucfTableName} block last"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_LAST_DESC", "{$ucfTableName} block last description"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_NEW", "{$ucfTableName} block new"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_NEW_DESC", "{$ucfTableName} block new description"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_HITS", "{$ucfTableName} block hits"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_HITS_DESC", "{$ucfTableName} block hits description"); + $ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_TOP", "{$ucfTableName} block top"); + $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"); + } } } @@ -233,10 +248,9 @@ private function getLanguageBlocks($tables, $language) */ private function getLanguageUser($language) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('User'); - $ret .= $df->getDefine($language, 'USER_PAGER', 'User pager'); - $ret .= $df->getDefine($language, 'USER_PAGER_DESC', 'User per page list'); + $ret = $this->ld->getAboveDefines('User'); + $ret .= $this->ld->getDefine($language, 'USER_PAGER', 'User pager'); + $ret .= $this->ld->getDefine($language, 'USER_PAGER_DESC', 'User per page list'); return $ret; } @@ -250,177 +264,193 @@ private function getLanguageUser($language) */ private function getLanguageConfig($language, $tables) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('Config'); - $fieldImage = false; - $fieldFile = false; - $useTag = false; + $ret = $this->ld->getAboveDefines('Config'); + $fieldImage = false; + $fieldFile = false; + $useTag = false; + $fieldEditor = false; // $usePermissions = false; - foreach (array_keys($tables) as $i) { + foreach (\array_keys($tables) as $i) { $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); - foreach (array_keys($fields) as $f) { + 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'); + $fieldEditor = true; + } + if (10 == $fieldElement) { + $fieldImage = true; } if (13 == $fieldElement) { $fieldImage = true; } - if (14 == $fieldElement) { + if (14 == $fieldElement) { $fieldFile = true; } } if (0 != $tables[$i]->getVar('table_tag')) { $useTag = true; } - // if (0 != $tables[$i]->getVar('table_permissions')) {$usePermissions = true;} } - $ret .= $df->getDefine($language, 'KEYWORDS', 'Keywords'); - $ret .= $df->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); - /*if (usePermissions) { - $ret .= $df->getDefine($language, "GROUPS", "Groups"); - $ret .= $df->getDefine($language, "GROUPS_DESC", "Groups to have permissions"); - $ret .= $df->getDefine($language, "ADMIN_GROUPS", "Admin Groups"); - $ret .= $df->getDefine($language, "ADMIN_GROUPS_DESC", "Admin Groups to have permissions access"); - }*/ + $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'); + $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 as short version'); + } if ($fieldImage || $fieldFile) { - $ret .= $df->getDefine($language, 'SIZE_MB', 'MB'); + $ret .= $this->ld->getDefine($language, 'SIZE_MB', 'MB'); } if ($fieldImage) { - $ret .= $df->getDefine($language, 'MAXSIZE_IMAGE', 'Max size image'); - $ret .= $df->getDefine($language, 'MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); - $ret .= $df->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image'); - $ret .= $df->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); - $ret .= $df->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image'); - $ret .= $df->getDefine($language, 'MAXWIDTH_IMAGE_DESC', 'Set the max width which is allowed for uploading images (in pixel)
0 means that images keep original size
If original image is smaller the image will be not enlarged'); - $ret .= $df->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image'); - $ret .= $df->getDefine($language, 'MAXHEIGHT_IMAGE_DESC', 'Set the max height which is allowed for uploading images (in pixel)
0 means that images keep original size
If original image is smaller the image will be not enlarged'); - //MB define + $ret .= $this->ld->getDefine($language, 'MAXSIZE_IMAGE', 'Max size image'); + $ret .= $this->ld->getDefine($language, 'MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); + $ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image'); + $ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); + $ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image'); + $ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE_DESC', 'Set the max width 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 width.'); + $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) { - $ret .= $df->getDefine($language, 'MAXSIZE_FILE', 'Max size file'); - $ret .= $df->getDefine($language, 'MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); - $ret .= $df->getDefine($language, 'MIMETYPES_FILE', 'Mime types file'); - $ret .= $df->getDefine($language, 'MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); + 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'); + $ret .= $this->ld->getDefine($language, 'MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); } if ($useTag) { - $ret .= $df->getDefine($language, 'USE_TAG', 'Use TAG'); - $ret .= $df->getDefine($language, 'USE_TAG_DESC', 'If you use tag module, check this option to yes'); + $ret .= $this->ld->getDefine($language, 'USE_TAG', 'Use TAG'); + $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 donactions.', - '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', - 'DISQUS_COMMENTS_DESC' => 'Allow Disqus comments 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', + //'DISQUS_COMMENTS_DESC' => 'Allow Disqus comments in the single page', ]; foreach ($getDefinesConf as $defc => $descc) { - $ret .= $df->getDefine($language, $defc, $descc); + $ret .= $this->ld->getDefine($language, $defc, $descc); + } + + return $ret; + } + + /** + * @private function getLanguageNotificationsGlobal + * @param $language + * @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', + //'CATEGORY_NOTIFY' => 'Category notification', + //'CATEGORY_NOTIFY_DESC' => 'Category notification desc', + //'CATEGORY_NOTIFY_CAPTION' => 'Category notification caption', + //'CATEGORY_NOTIFY_SUBJECT' => 'Category notification Subject', + //'CATEGORY_SUBMIT_NOTIFY' => 'Category submit notification', + //'CATEGORY_SUBMIT_NOTIFY_CAPTION' => 'Category submit notification caption', + //'CATEGORY_SUBMIT_NOTIFY_DESC' => 'Category submit notification desc', + //'CATEGORY_SUBMIT_NOTIFY_SUBJECT' => 'Category submit notification subject', + ]; + if ($tableBroken) { + $getDefinesNotif['NOTIFY_GLOBAL_BROKEN'] = 'Any broken item'; + $getDefinesNotif['NOTIFY_GLOBAL_BROKEN_CAPTION'] = 'Notify me about any broken item'; + $getDefinesNotif['NOTIFY_GLOBAL_BROKEN_SUBJECT'] = 'Notification about broken item'; + } + if ($tableComment) { + $getDefinesNotif['NOTIFY_GLOBAL_COMMENT'] = 'Any comments'; + $getDefinesNotif['NOTIFY_GLOBAL_COMMENT_CAPTION'] = 'Notify me about any comment'; + $getDefinesNotif['NOTIFY_GLOBAL_COMMENT_SUBJECT'] = 'Notification about any comment'; + } + foreach ($getDefinesNotif as $defn => $descn) { + $ret .= $this->ld->getDefine($language, $defn, $descn); } return $ret; } /** - * @private function getLanguageNotifications + * @private function getLanguageNotificationsTable * @param $language + * @param $tableName * @param mixed $tableSoleName * + * @param $tableBroken + * @param $tableComment * @return string */ - private function getLanguageNotifications($language, $tableSoleName) + private function getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('Notifications'); - $stuTableSoleName = mb_strtoupper($tableSoleName); - $ucfTableSoleName = ucfirst($tableSoleName); + $stuTableSoleName = \mb_strtoupper($tableSoleName); + $ucfTableSoleName = \ucfirst($tableSoleName); + $ret = $this->ld->getAboveDefines($ucfTableSoleName . ' notifications'); $getDefinesNotif = [ - 'GLOBAL_NOTIFY' => 'Global notify', - 'GLOBAL_NOTIFY_DESC' => 'Global notify desc', - 'GLOBAL_MODIFY_NOTIFY' => 'Global modify notify', - 'GLOBAL_MODIFY_NOTIFY_CAPTION' => 'Global modify notify caption', - 'GLOBAL_MODIFY_NOTIFY_DESC' => 'Global modify notify desc', - 'GLOBAL_MODIFY_NOTIFY_SUBJECT' => 'Global modify notify subject', - 'GLOBAL_BROKEN_NOTIFY' => 'Global broken notify', - 'GLOBAL_BROKEN_NOTIFY_CAPTION' => 'Global broken notify caption', - 'GLOBAL_BROKEN_NOTIFY_DESC' => 'Global broken notify desc', - 'GLOBAL_BROKEN_NOTIFY_SUBJECT' => 'Global broken notify subject', - 'GLOBAL_SUBMIT_NOTIFY' => 'Global submit notify', - 'GLOBAL_SUBMIT_NOTIFY_CAPTION' => 'Global submit notify caption', - 'GLOBAL_SUBMIT_NOTIFY_DESC' => 'Global submit notify desc', - 'GLOBAL_SUBMIT_NOTIFY_SUBJECT' => 'Global submit notify subject', - 'GLOBAL_NEW_NOTIFY' => 'Global new notify', - 'GLOBAL_NEW_NOTIFY_CAPTION' => 'Global new notify caption', - 'GLOBAL_NEW_NOTIFY_DESC' => 'Global new notify desc', - 'GLOBAL_NEW_NOTIFY_SUBJECT' => 'Global new notify subject', - 'CATEGORY_NOTIFY' => 'Category notify', - 'CATEGORY_NOTIFY_DESC' => 'Category notify desc', - 'CATEGORY_NOTIFY_CAPTION' => 'Category notify caption', - 'CATEGORY_NOTIFY_SUBJECT' => 'Category notify Subject', - 'CATEGORY_SUBMIT_NOTIFY' => 'Category submit notify', - 'CATEGORY_SUBMIT_NOTIFY_CAPTION' => 'Category submit notify caption', - 'CATEGORY_SUBMIT_NOTIFY_DESC' => 'Category submit notify desc', - 'CATEGORY_SUBMIT_NOTIFY_SUBJECT' => 'Category submit notify subject', - $stuTableSoleName . '_NOTIFY' => $ucfTableSoleName . ' notify', - $stuTableSoleName . '_NOTIFY_DESC' => $ucfTableSoleName . ' notify desc', - $stuTableSoleName . '_NOTIFY_CAPTION' => $ucfTableSoleName . ' notify caption', - $stuTableSoleName . '_NOTIFY_SUBJECT' => $ucfTableSoleName . ' notify subject', - 'GLOBAL_NEW_CATEGORY_NOTIFY' => 'Global newcategory notify', - 'GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION' => 'Global newcategory notify caption', - 'GLOBAL_NEW_CATEGORY_NOTIFY_DESC' => 'Global newcategory notify desc', - 'GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT' => 'Global newcategory notify subject', - 'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY' => 'Global ' . $tableSoleName . ' modify notify', - 'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY_CAPTION' => 'Global ' . $tableSoleName . ' modify notify caption', - 'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY_DESC' => 'Global ' . $tableSoleName . ' modify notify desc', - 'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY_SUBJECT' => 'Global ' . $tableSoleName . ' modify notify subject', - 'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY' => 'Global ' . $tableSoleName . ' broken notify', - 'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY_CAPTION' => 'Global ' . $tableSoleName . ' broken notify caption', - 'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY_DESC' => 'Global ' . $tableSoleName . ' broken notify desc', - 'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY_SUBJECT' => 'Global ' . $tableSoleName . ' broken notify subject', - 'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY' => 'Global ' . $tableSoleName . ' submit notify', - 'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY_CAPTION' => 'Global ' . $tableSoleName . ' submit notify caption', - 'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY_DESC' => 'Global ' . $tableSoleName . ' submit notify desc', - 'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY_SUBJECT' => 'Global ' . $tableSoleName . ' submit notify subject', - 'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY' => 'Global new ' . $tableSoleName . ' notify', - 'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY_CAPTION' => 'Global new ' . $tableSoleName . ' notify caption', - 'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY_DESC' => 'Global new ' . $tableSoleName . ' notify desc', - 'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY_SUBJECT' => 'Global new ' . $tableSoleName . ' notify subject', - 'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY' => 'Category ' . $tableSoleName . ' submit notify', - 'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY_CAPTION' => 'Category ' . $tableSoleName . ' submit notify caption', - 'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY_DESC' => 'Category ' . $tableSoleName . ' submit notify desc', - 'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY_SUBJECT' => 'Category ' . $tableSoleName . ' submit notify subject', - 'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY' => 'Category new ' . $tableSoleName . ' notify', - 'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY_CAPTION' => 'Category new ' . $tableSoleName . ' notify caption', - 'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY_DESC' => 'Category new ' . $tableSoleName . ' notify desc', - 'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY_SUBJECT' => 'Category new ' . $tableSoleName . ' notify subject', - 'APPROVE_NOTIFY' => $ucfTableSoleName . ' approve notify', - 'APPROVE_NOTIFY_CAPTION' => $ucfTableSoleName . ' approve notify caption', - 'APPROVE_NOTIFY_DESC' => $ucfTableSoleName . ' approve notify desc', - 'APPROVE_NOTIFY_SUBJECT' => $ucfTableSoleName . ' approve notify subject', + '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"; + $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN_CAPTION'] = "Notify me about broken {$tableSoleName}"; + $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN_SUBJECT'] = "Notification about broken {$tableSoleName}"; + } + if (1 == $tableComment) { + $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT'] = "{$ucfTableSoleName} comment"; + $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT_CAPTION'] = "Notify me about comments for {$tableSoleName}"; + $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT_SUBJECT'] = "Notification about comments for {$tableSoleName}"; + } foreach ($getDefinesNotif as $defn => $descn) { - $ret .= $df->getDefine($language, $defn, $descn); + $ret .= $this->ld->getDefine($language, $defn, $descn); } return $ret; @@ -434,85 +464,123 @@ private function getLanguageNotifications($language, $tableSoleName) */ private function getLanguagePermissionsGroups($language) { - $df = LanguageDefines::getInstance(); - $ret = $df->getAboveDefines('Permissions Groups'); - $ret .= $df->getDefine($language, 'GROUPS', 'Groups access'); - $ret .= $df->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.'); - $ret .= $df->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions'); - $ret .= $df->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); - $ret .= $df->getDefine($language, 'UPLOAD_GROUPS', 'Upload Group Permissions'); - $ret .= $df->getDefine($language, 'UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); + $ret = $this->ld->getAboveDefines('Permissions Groups'); + $ret .= $this->ld->getDefine($language, 'GROUPS', 'Groups access'); + $ret .= $this->ld->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.'); + $ret .= $this->ld->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions'); + $ret .= $this->ld->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); + $ret .= $this->ld->getDefine($language, 'UPLOAD_GROUPS', 'Upload Group Permissions'); + $ret .= $this->ld->getDefine($language, 'UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); + + return $ret; + } + + /** + * @private function getLanguagePermissionsGroups + * @param $language + * + * @return string + */ + private function getLanguageRatingbars($language) + { + $ret = $this->ld->getAboveDefines('Rating bars'); + $ret .= $this->ld->getDefine($language, 'RATINGBAR_GROUPS', 'Groups with rating rights'); + $ret .= $this->ld->getDefine($language, 'RATINGBAR_GROUPS_DESC', 'Select groups which should have the right to rate'); + $ret .= $this->ld->getDefine($language, 'RATINGBARS', 'Allow rating'); + $ret .= $this->ld->getDefine($language, 'RATINGBARS_DESC', 'Define whether rating should be possible and which kind of rating should be used'); + $ret .= $this->ld->getDefine($language, 'RATING_NONE', 'Do not use rating'); + $ret .= $this->ld->getDefine($language, 'RATING_5STARS', 'Rating with 5 stars'); + $ret .= $this->ld->getDefine($language, 'RATING_10STARS', 'Rating with 10 stars'); + $ret .= $this->ld->getDefine($language, 'RATING_LIKES', 'Rating with likes and dislikes'); + $ret .= $this->ld->getDefine($language, 'RATING_10NUM', 'Rating with 10 points'); return $ret; } /** * @private function getFooter - * @param null + * * @return string */ private function getLanguageFooter() { - $df = LanguageDefines::getInstance(); - $ret = $df->getBelowDefines('End'); - $ret .= $df->getBlankLine(); + $ret = $this->ld->getBelowDefines('End'); + $ret .= $this->ld->getBlankLine(); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { $module = $this->getModule(); $tables = $this->getTableTables($module->getVar('mod_id')); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MI', '', false); $tableAdmin = []; $tableUser = []; $tableSubmenu = []; $tableBlocks = []; $tableNotifications = []; $tablePermissions = []; - $tableSoleName = ''; - foreach (array_keys($tables) as $t) { + $notifTable = ''; + $tableBrokens = []; + $tableComments = []; + $tableRate = []; + foreach (\array_keys($tables) as $t) { + $tableName = $tables[$t]->getVar('table_name'); $tableSoleName = $tables[$t]->getVar('table_solename'); $tableAdmin[] = $tables[$t]->getVar('table_admin'); $tableUser[] = $tables[$t]->getVar('table_user'); $tableSubmenu[] = $tables[$t]->getVar('table_submenu'); $tableBlocks[] = $tables[$t]->getVar('table_blocks'); $tableNotifications[] = $tables[$t]->getVar('table_notifications'); + $tableBroken = $tables[$t]->getVar('table_broken'); + $tableBrokens[] = $tables[$t]->getVar('table_broken'); + $tableComment = $tables[$t]->getVar('table_comments'); + $tableComments[] = $tables[$t]->getVar('table_comments'); + $tableRate[] = $tables[$t]->getVar('table_rate'); $tablePermissions[] = $tables[$t]->getVar('table_permissions'); + if (1 === (int)$tables[$t]->getVar('table_notifications')) { + $notifTable .= $this->getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment); + } } - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'MI'); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getLanguageMain($language, $module); - $content .= $this->getLanguageMenu($module, $language); - if (in_array(1, $tableAdmin)) { + + $content = $this->getHeaderFilesComments($module); + $content .= $this->getLanguageMain($language, $module); + $content .= $this->getLanguageMenu($module, $language); + if (\in_array(1, $tableAdmin)) { $content .= $this->getLanguageAdmin($language); } - if (in_array(1, $tableUser)) { + if (\in_array(1, $tableUser)) { $content .= $this->getLanguageUser($language); } - if (in_array(1, $tableSubmenu)) { + if (\in_array(1, $tableSubmenu)) { $content .= $this->getLanguageSubmenu($language, $tables); } - //if (in_array(1, $tableBlocks)) { - $content .= $this->getLanguageBlocks($tables, $language); - //} + if (\in_array(1, $tableRate)) { + $content .= $this->getLanguageRatingbars($language); + } + + if (\in_array(1, $tableBlocks)) { + $content .= $this->getLanguageBlocks($tables, $language); + } $content .= $this->getLanguageConfig($language, $tables); - if (in_array(1, $tableNotifications)) { - $content .= $this->getLanguageNotifications($language, $tableSoleName); + if (\in_array(1, $tableNotifications)) { + $content .= $this->getLanguageNotificationsGlobal($language, \in_array(1, $tableBrokens, true), \in_array(1, $tableComments)); + $content .= $notifTable; } - if (in_array(1, $tablePermissions)) { + if (\in_array(1, $tablePermissions)) { $content .= $this->getLanguagePermissionsGroups($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/index.php b/class/Files/Language/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Language/index.php @@ -0,0 +1,2 @@ +setModule($module); $this->setFileName($filename); @@ -89,7 +86,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}", @@ -113,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 = [ @@ -138,16 +135,29 @@ private function getHeadDatabaseTable($moduleDirname, $tableName, $fieldsNumb) */ private function getDatabaseTables($module) { - $ret = null; - $moduleDirname = mb_strtolower($module->getVar('mod_dirname')); - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order ASC, table_id'); - foreach (array_keys($tables) as $t) { + $ret = null; + $moduleDirname = \mb_strtolower($module->getVar('mod_dirname')); + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order ASC, table_id'); + $tableMid = 0; + $tableId = 0; + $tableName = 0; + $tableAutoincrement = 0; + $fieldsNumb = 0; + $tableRate = 0; + foreach (\array_keys($tables) as $t) { $tableId = $tables[$t]->getVar('table_id'); $tableMid = $tables[$t]->getVar('table_mid'); $tableName = $tables[$t]->getVar('table_name'); $tableAutoincrement = $tables[$t]->getVar('table_autoincrement'); - $fieldsNumb = $tables[$t]->getVar('table_nbfields'); - $ret .= $this->getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableName, $tableAutoincrement, $fieldsNumb); + $fieldsNumb = (int)$tables[$t]->getVar('table_nbfields'); + if (1 === (int)$tables[$t]->getVar('table_rate')) { + $tableRate = 1; + } + $ret .= $this->getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableName, $tableAutoincrement, $fieldsNumb); + } + + if (1 === $tableRate) { + $ret .= $this->getTableRatings($moduleDirname); } return $ret; @@ -166,23 +176,29 @@ private function getDatabaseTables($module) */ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableName, $tableAutoincrement, $fieldsNumb) { - $helper = Tdmcreate\Helper::getInstance(); - $ret = null; - $j = 0; - $comma = []; - $row = []; - //$type = ''; + $helper = Modulebuilder\Helper::getInstance(); + $ret = null; + $j = 0; + $comma = []; + $row = []; + $lenMax = 0; $fieldTypeName = ''; - $fields = $this->getTableFields($tableMid, $tableId, 'field_id ASC, field_name'); - foreach (array_keys($fields) as $f) { + $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); $fieldName = $fields[$f]->getVar('field_name'); $fieldType = $fields[$f]->getVar('field_type'); - $fieldValue = $fields[$f]->getVar('field_value'); + $fieldValue = \str_replace(''', '', $fields[$f]->getVar('field_value')); //remove single quotes $fieldAttribute = $fields[$f]->getVar('field_attribute'); $fieldNull = $fields[$f]->getVar('field_null'); - $fieldDefault = $fields[$f]->getVar('field_default'); + $fieldDefault = \str_replace(''', '', $fields[$f]->getVar('field_default')); //remove single quotes $fieldKey = $fields[$f]->getVar('field_key'); if ($fieldType > 1) { $fType = $helper->getHandler('Fieldtype')->get($fieldType); @@ -220,14 +236,14 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa case 8: $type = $fieldTypeName . '(' . $fieldValue . ')'; if (empty($fieldDefault)) { - $default = "DEFAULT '0.00'"; // From MySQL 5.7 Manual + $default = "DEFAULT '0'"; // From MySQL 5.7 Manual } else { $default = "DEFAULT '{$fieldDefault}'"; } break; case 9: case 10: - $fValues = str_replace(',', "', '", str_replace(' ', '', $fieldValue)); + $fValues = \str_replace(',', "', '", \str_replace(' ', '', $fieldValue)); $type = $fieldTypeName . '(\'' . $fValues . '\')'; // Used with comma separator $default = "DEFAULT '{$fieldDefault}'"; break; @@ -242,16 +258,11 @@ 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}'"; } break; - case 13: - case 14: - $type = $fieldTypeName . '(' . $fieldValue . ')'; - $default = "DEFAULT '{$fieldDefault}'"; - break; case 15: case 16: case 17: @@ -259,13 +270,6 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa $type = $fieldTypeName; $default = null; break; - case 19: - case 20: - case 21: - case 22: - $type = $fieldTypeName . '(' . $fieldValue . ')'; - $default = "DEFAULT '{$fieldDefault}'"; - break; case 23: $type = $fieldTypeName; if (empty($fieldDefault)) { @@ -274,45 +278,48 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa $default = "DEFAULT '{$fieldDefault}'"; } break; + case 13: + case 14: + case 22: default: $type = $fieldTypeName . '(' . $fieldValue . ')'; $default = "DEFAULT '{$fieldDefault}'"; 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); } } } @@ -326,7 +333,7 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa } } // ================= COMMA CICLE ================= // - $ret .= implode("\n", $row); + $ret .= \implode("\n", $row); unset($j); $ret .= $this->getFootDatabaseTable(); @@ -334,9 +341,32 @@ private function getDatabaseFields($moduleDirname, $tableMid, $tableId, $tableNa } /** - * @private function getFootDatabaseTable + * @private function getDatabaseFields * - * @param null + * @param $moduleDirname + * @return null|string + */ + private function getTableRatings($moduleDirname) + { + $row = []; + $ret = $this->getHeadDatabaseTable($moduleDirname, 'ratings', 6); + $row[] = $this->getFieldRow('rate_id', 'INT(8)', 'UNSIGNED', 'NOT NULL', null, 'AUTO_INCREMENT'); + $row[] = $this->getFieldRow('rate_itemid', 'INT(8)', null, 'NOT NULL', "DEFAULT '0'"); + $row[] = $this->getFieldRow('rate_source', 'INT(8)', null, 'NOT NULL', "DEFAULT '0'"); + $row[] = $this->getFieldRow('rate_value', 'INT(1)', null, 'NOT NULL', "DEFAULT '0'"); + $row[] = $this->getFieldRow('rate_uid', 'INT(8)', null, 'NOT NULL', "DEFAULT '0'"); + $row[] = $this->getFieldRow('rate_ip', 'VARCHAR(60)', null, 'NOT NULL', "DEFAULT ''"); + $row[] = $this->getFieldRow('rate_date', 'INT(8)', null, 'NOT NULL', "DEFAULT '0'"); + $row[] = $this->getKey(2, 'rate_id'); + + $ret .= \implode("\n", $row); + $ret .= $this->getFootDatabaseTable(); + + return $ret; + } + + /** + * @private function getFootDatabaseTable * * @return string */ @@ -354,15 +384,24 @@ private function getFootDatabaseTable() * @param $fieldNull * @param $fieldDefault * @param $autoincrement + * @param int $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, int $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) { @@ -407,36 +446,21 @@ private function getKey($key, $fieldName) return $ret; } - /** - * @private function getComma - * - * @param $row - * @param $comma - * - * @return string - */ - private function getComma($row, $comma = null) - { - return " {$row}{$comma}"; - } - /** * @public function render * - * @param null - * - * @return bool|string + * @return string */ public function render() { $module = $this->getModule(); $filename = $this->getFileName(); - $moduleName = mb_strtolower($module->getVar('mod_name')); - $moduleDirname = mb_strtolower($module->getVar('mod_dirname')); + $moduleName = \mb_strtolower($module->getVar('mod_name')); + $moduleDirname = \mb_strtolower($module->getVar('mod_dirname')); $content = $this->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/Sql/index.php b/class/Files/Sql/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Sql/index.php @@ -0,0 +1,2 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** @@ -59,7 +69,7 @@ public static function getInstance() * @param $module * @param $filename */ - public function write($module, $filename) + public function write($module, $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -67,25 +77,23 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $hc->getHtmlComment('Header') . PHP_EOL; - $content .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, true) . PHP_EOL; - $content .= $hc->getHtmlComment('About Page') . PHP_EOL; - $single = $sc->getSmartySingleVar('about'); - $content .= $hc->getHtmlTag('div', ['class' => 'top'], $single) . PHP_EOL; - $content .= $hc->getHtmlComment('Footer') . PHP_EOL; - $content .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); + $content = $this->hc->getHtmlComment('Header', '', "\n"); + $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); - $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 new file mode 100644 index 00000000..404892d7 --- /dev/null +++ b/class/Files/Templates/Admin/TemplatesAdminBroken.php @@ -0,0 +1,233 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return TemplatesAdminBroken + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $tables + * @param $filename + */ + public function write($module, $tables, $filename): void + { + $this->setModule($module); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesAdminBrokenHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesAdminBrokenHeader(string $moduleDirname) + { + $ret = $this->hc->getHtmlComment('Header', '', "\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); + + return $ret; + } + + /** + * @private function getTemplatesAdminBrokenTableThead + * @param string $language + * @return string + */ + private function getTemplatesAdminBrokenTableThead(string $language) + { + $th = ''; + $lang = $this->sc->getSmartyConst($language, 'BROKEN_TABLE'); + $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\t"); + $lang = $this->sc->getSmartyConst($language, 'FORM_ACTION'); + $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 + * @return string + * @internal param string $language + */ + private function getTemplatesAdminBrokenTableTBody(string $tableName, $tableSoleName) + { + $td = ''; + $doubleKey = $this->sc->getSmartyDoubleVar($tableSoleName, 'key', '', '', "''", "'htmlattr'"); + $doubleVal = $this->sc->getSmartyDoubleVar($tableSoleName, 'keyval', '', '', "''", "'htmlattr'"); + + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'table', '', '', "''", "'html'"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t\t"); + $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'"); + $img = $this->hc->getHtmlImage($src, $tableName); + $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\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" . "\t"); + $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '', '', "\t\t" . "\t"); + return $this->hc->getHtmlTableTbody($foreach, '', "\t\t"); + } + + /** + * @private function getTemplatesAdminBrokenTable + * @param string $tableName + * @param $tableSoleName + * @param string $language + * @return string + */ + private function getTemplatesAdminBrokenTable(string $tableName, $tableSoleName, string $language) + { + $tbody = $this->getTemplatesAdminBrokenTableThead($language); + $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName); + return $this->hc->getHtmlTable($tbody, 'outer', "\t"); + } + + /** + * @private function getTemplatesAdminBrokenList + * @param $table + * @param string $language + * @param string $t + * @return string + */ + 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'); + $htmlTable = $this->getTemplatesAdminBrokenTable($tableName, $tableSoleName, $language); + $htmlTable .= $this->hc->getHtmlDiv(' ', 'clear', $t, "\n", false); + $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_' . $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"); + $div .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false); + $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); + + return $ret; + } + + /** + * @private function getTemplatesAdminBrokenFooter + * @param string $moduleDirname + * @return string + */ + private function getTemplatesAdminBrokenFooter(string $moduleDirname) + { + $single = $this->sc->getSmartySingleVar('error'); + $strong = $this->hc->getHtmlTag('strong', [], $single, false, '', ''); + $div = $this->hc->getHtmlDiv($strong, 'errorMsg', "\t"); + $ret = $this->sc->getSmartyConditions('error', '', '', $div); + $ret .= $this->hc->getHtmlEmpty('', '', "\n"); + $ret .= $this->hc->getHtmlComment('Footer', '', "\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); + + return $ret; + } + + /** + * @public function render + * + * @return string + */ + public function render() + { + $module = $this->getModule(); + $tables = $this->getTables(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'AM', '', false); + $content = $this->getTemplatesAdminBrokenHeader($moduleDirname); + foreach ($tables as $table) { + if (1 === (int)$table->getVar('table_broken')) { + $content .= $this->getTemplatesAdminBrokenList($table, $language, "\t"); + } + } + $content .= $this->getTemplatesAdminBrokenFooter($moduleDirname); + + $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..b8b99325 100644 --- a/class/Files/Templates/Admin/TemplatesAdminFooter.php +++ b/class/Files/Templates/Admin/TemplatesAdminFooter.php @@ -1,9 +1,9 @@ -hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** @@ -56,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -67,29 +77,27 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleName = $module->getVar('mod_name'); $moduleDirname = $module->getVar('mod_dirname'); $supportName = $module->getVar('mod_support_name'); - $language = $this->getLanguage($moduleDirname, 'AM'); - $singleNoVar = $sc->getSmartyNoSimbol('xoModuleIcons32 xoopsmicrobutton.gif'); - $img = $hc->getHtmlTag('img', ['src' => $singleNoVar, 'alt' => 'XOOPS'], '', true, '',''); - $anchor = $hc->getHtmlTag('a', ['href' => 'https://xoops.org/', 'title' => 'Visit XOOPS', 'target' => '_blank'], $img) ; - $content = $hc->getHtmlTag('div', ['class' => 'center'], "\n\t" . $anchor); - $tree = $hc->getHtmlTag('strong', [], $moduleName, false, '', ''); - $tree .= $sc->getSmartyConst($language, 'MAINTAINEDBY'); - $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); + $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', '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|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_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..c3894506 100644 --- a/class/Files/Templates/Admin/TemplatesAdminHeader.php +++ b/class/Files/Templates/Admin/TemplatesAdminHeader.php @@ -1,9 +1,9 @@ -hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** @@ -56,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -67,25 +77,23 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $navigation = $sc->getSmartySingleVar('navigation'); - $due = $hc->getHtmlSpan($navigation, 'left', "\t") ; - $buttons = $sc->getSmartySingleVar('buttons'); - $right = $hc->getHtmlSpan($buttons, 'left', "\t\t", "\n"); - $due .= $sc->getSmartyConditions('buttons', '', '', $right, '', '', '', "\t", "\n"); - $content = $hc->getHtmlDiv($due, 'top'); + $navigation = $this->sc->getSmartySingleVar('navigation'); + $due = $this->hc->getHtmlSpan($navigation, 'left', "\t"); + $buttons = $this->sc->getSmartySingleVar('buttons'); + $right = $this->hc->getHtmlSpan($buttons, 'left', "\t\t"); + $due .= $this->sc->getSmartyConditions('buttons', '', '', $right, '', '', '', "\t"); + $content = $this->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 ac557047..c90934e7 100644 --- a/class/Files/Templates/Admin/TemplatesAdminIndex.php +++ b/class/Files/Templates/Admin/TemplatesAdminIndex.php @@ -1,9 +1,9 @@ -hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** @@ -56,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -67,26 +77,24 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $module = $this->getModule(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $content = $hc->getHtmlComment('Header') . PHP_EOL; - $content .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, true) . PHP_EOL; - $content .= $hc->getHtmlComment('Index Page') . PHP_EOL; - $single = $sc->getSmartySingleVar('index'); - $content .= $hc->getHtmlTag('div', ['class' => 'top'], $single) . PHP_EOL; - $content .= $hc->getHtmlComment('Footer') . PHP_EOL; - $content .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true, true); + $content = $this->hc->getHtmlComment('Header', '', "\n"); + $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); - $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 b3a6904d..76328a6d 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPages.php +++ b/class/Files/Templates/Admin/TemplatesAdminPages.php @@ -1,9 +1,12 @@ -hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return TemplatesAdminPages */ public static function getInstance() @@ -57,11 +70,11 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $table - * @param $filename + * @param $module + * @param $table + * @param string $filename */ - public function write($module, $table, $filename) + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -73,12 +86,10 @@ public function write($module, $table, $filename) * @param string $moduleDirname * @return string */ - private function getTemplatesAdminPagesHeader($moduleDirname) + private function getTemplatesAdminPagesHeader(string $moduleDirname) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlComment('Header', "\n"); - $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); + $ret = $this->hc->getHtmlComment('Header', '',"\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); return $ret; } @@ -87,36 +98,32 @@ private function getTemplatesAdminPagesHeader($moduleDirname) * @private function getTemplatesAdminPagesTableThead * @param $tableSoleName * @param $tableAutoincrement - * @param string $fields + * @param array $fields * @param string $language * @return string */ - private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language) + private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, array $fields, string $language) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $th = ''; - $langHeadId = mb_strtoupper($tableSoleName) . '_ID'; + $langHeadId = \mb_strtoupper($tableSoleName) . '_ID'; if (1 == $tableAutoincrement) { - $lang = $sc->getSmartyConst($language, $langHeadId); - $th .= $hc->getHtmlTag('th', ['class' => 'center'], $lang, false, "\t\t\t\t"); + $lang = $this->sc->getSmartyConst($language, $langHeadId); + $th .= $this->hc->getHtmlTag('th', ['class' => 'center'], $lang, false, "\t\t\t\t"); } - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $rpFieldName = $this->getRightString($fieldName); - $langFieldName = mb_strtoupper($tableSoleName) . '_' . mb_strtoupper($rpFieldName); + $langFieldName = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); if (1 == $fields[$f]->getVar('field_inlist')) { - $lang = $sc->getSmartyConst($language, $langFieldName); - $th .= $hc->getHtmlTag('th', ['class' => 'center'], $lang, false, "\t\t\t\t"); + $lang = $this->sc->getSmartyConst($language, $langFieldName); + $th .= $this->hc->getHtmlTag('th', ['class' => 'center'], $lang, false, "\t\t\t\t"); } } - $lang = $sc->getSmartyConst($language, 'FORM_ACTION'); - $th .= $hc->getHtmlTag('th', ['class' => 'center width5'], $lang, false, "\t\t\t\t"); - $tr = $hc->getHtmlTableRow($th, 'head', "\t\t\t"); - $ret = $hc->getHtmlTableThead($tr, '', "\t\t"); - - return $ret; + $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"); + return $this->hc->getHtmlTableThead($tr, '', "\t\t"); } /** @@ -125,21 +132,19 @@ private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincr * @param string $tableName * @param $tableSoleName * @param $tableAutoincrement - * @param string $fields + * @param array $fields * @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) { - $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\t"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); + $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); } $fieldId = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); @@ -148,64 +153,83 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t } if (1 == $fields[$f]->getVar('field_inlist')) { switch ($fieldElement) { - case 5: - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $src = $sc->getSmartyNoSimbol('xoModuleIcons16') . $double . '.png'; - $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true,'',''); - $td .= $hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_short', '', '', "''", "'html'"); + $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"); 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 ... - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); $color = "    "; - $td .= $hc->getHtmlTableData($color, 'center', '',"\t\t\t\t"); + $td .= $this->hc->getHtmlTableData($color, 'center', '',"\t\t\t\t"); 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\t"); + case Constants::FIELD_ELE_IMAGELIST: + $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); + $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 13: - $single = $sc->getSmartySingleVar($moduleDirname . '_upload_url'); - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $img = $hc->getHtmlTag('img', ['src' => $single . "/images/{$tableName}/" . $double, 'alt' => $tableName, 'style' => 'max-width:100px'], '', true, '', ''); - $td .= $hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); + case Constants::FIELD_ELE_UPLOADIMAGE: + $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 16: - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $src = $sc->getSmartyNoSimbol('$modPathIcon16') . '/status' . $double . '.png'; - $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true,'',''); - $td .= $hc->getHtmlTableData($img, 'center', '',"\t\t\t\t"); + case Constants::FIELD_ELE_SELECTSTATUS: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'status', '', '', "''", "'html'"); + $src = $this->sc->getSmartyNoSimbol('$modPathIcon16') . 'status' . $double . '.png'; + $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; + case Constants::FIELD_ELE_RADIOYN: + case Constants::FIELD_ELE_SELECTUSER: + case Constants::FIELD_ELE_DATETIME: + case Constants::FIELD_ELE_RADIO_ONOFFLINE: + case Constants::FIELD_ELE_TEXTDATESELECT: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName . '_text', '', '', "''", "'html'"); + $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); break; default: if (0 != $f) { - $double = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $td .= $hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName, '', '', "''", "'html'"); + $td .= $this->hc->getHtmlTableData($double, 'center', '',"\t\t\t\t"); } break; } } } - $lang = $sc->getSmartyConst('', '_EDIT'); - $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); - $src = $sc->getSmartyNoSimbol('xoModuleIcons16 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\t"); - $lang = $sc->getSmartyConst('', '_DELETE'); - $double = $sc->getSmartyDoubleVar($tableSoleName, 'id'); - $src = $sc->getSmartyNoSimbol('xoModuleIcons16 delete.png'); - $img = $hc->getHtmlTag('img', ['src' => $src, 'alt' => $tableName], '', true, '', ''); - $anchor .= $hc->getHtmlTag('a', ['href' => $tableName . ".php?op=delete&{$fieldId}=" . $double, 'title' => $lang], $img, false, "\t\t\t\t\t"); - $td .= $hc->getHtmlTag('td', ['class' => 'center width5'], "\n" . $anchor . "\t\t\t\t", false, "\t\t\t\t"); - $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"); + $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,'', ''); + $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'"); + $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'"); + $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"); + $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"); - return $sc->getSmartyConditions($tableName . '_count', '', '', $tbody, '', false, false, "\t\t"); + return $this->sc->getSmartyConditions($tableName . '_count', '', '', $tbody, '', false, false, "\t\t"); } /** @@ -214,17 +238,16 @@ private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $t * @param string $tableName * @param $tableSoleName * @param $tableAutoincrement - * @param string $fields + * @param $fields * @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) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); $tbody = $this->getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language); $tbody .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields); - return $hc->getHtmlTable($tbody, 'table table-bordered', "\t"); + return $this->hc->getHtmlTable($tbody, 'outer', "\t"); } /** @@ -233,28 +256,26 @@ private function getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableS * @param string $tableName * @param $tableSoleName * @param $tableAutoincrement - * @param string $fields + * @param $fields * @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) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); $htmlTable = $this->getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language); - $htmlTable .= $hc->getHtmlTag('div', ['class' => 'clear'], ' ', false, "\t"); - $single = $sc->getSmartySingleVar('pagenav'); - $div = $hc->getHtmlTag('div', ['class' => 'xo-pagenav floatright'], $single, false, "\t\t"); - $div .= $hc->getHtmlTag('div', ['class' => 'clear spacer'], '', false, "\t\t", "\n"); - $htmlTable .= $sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', "\t" ); - $ifList = $sc->getSmartyConditions($tableName . '_list', '', '', $htmlTable); - $single = $sc->getSmartySingleVar('form', "\t", "\n"); - $ifList .= $sc->getSmartyConditions('form', '', '', $single); - $single = $sc->getSmartySingleVar('error'); - $strong = $hc->getHtmlTag('strong', [], $single, false, '', ''); - $div = $hc->getHtmlTag('div', ['class' => 'errorMsg'], $strong, false, "\t", "\n"); - $ifList .= $sc->getSmartyConditions('error', '', '', $div); - $ifList .= $hc->getHtmlEmpty('', '', "\n");; + $htmlTable .= $this->hc->getHtmlTag('div', ['class' => 'clear'], ' ', false, "\t"); + $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"); + $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); + $single = $this->sc->getSmartySingleVar('error'); + $strong = $this->hc->getHtmlTag('strong', [], $single, false, '', ''); + $div = $this->hc->getHtmlTag('div', ['class' => 'errorMsg'], $strong, false, "\t"); + $ifList .= $this->sc->getSmartyConditions('error', '', '', $div); + $ifList .= $this->hc->getHtmlEmpty('', '', "\n"); return $ifList; } @@ -264,20 +285,18 @@ private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleNa * @param string $moduleDirname * @return string */ - private function getTemplatesAdminPagesFooter($moduleDirname) + private function getTemplatesAdminPagesFooter(string $moduleDirname) { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $ret = $hc->getHtmlComment('Footer', "\n"); - $ret .= $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); + $ret = $this->hc->getHtmlComment('Footer', '', "\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); return $ret; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -285,13 +304,13 @@ public function render() $table = $this->getTable(); $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); - $language = $this->getLanguage($moduleDirname, 'AM'); + $language = $this->getLanguage($moduleDirname, 'AM', '', false); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order'); $content = $this->getTemplatesAdminPagesHeader($moduleDirname); $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..06ca2611 100644 --- a/class/Files/Templates/Admin/TemplatesAdminPermissions.php +++ b/class/Files/Templates/Admin/TemplatesAdminPermissions.php @@ -1,9 +1,9 @@ -hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return TemplatesAdminPermissions */ public static function getInstance() @@ -57,10 +67,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param $filename */ - public function write($module, $filename) + public function write($module, $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -72,25 +82,20 @@ public function write($module, $filename) * * @return string */ - private function getTemplatesAdminPermissionsHeader($moduleDirname) + private function getTemplatesAdminPermissionsHeader(string $moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - - return $sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n"); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', "\n\n"); } /** * @private function getTemplatesAdminPermissions - * @param null + * * @return string */ private function getTemplatesAdminPermissions() { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - $form = $sc->getSmartySingleVar('form'); - $ret = $hc->getHtmlTag('div', ['class' => 'spacer'], $form, '', '', "\n\n"); - return $ret; + $form = $this->sc->getSmartySingleVar('form'); + return $this->hc->getHtmlTag('div', ['class' => 'spacer'], $form, false, '', "\n\n"); } /** @@ -99,16 +104,15 @@ private function getTemplatesAdminPermissions() * * @return string */ - private function getTemplatesAdminPermissionsFooter($moduleDirname) + private function getTemplatesAdminPermissionsFooter(string $moduleDirname) { - $sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); - return $sc->getSmartyIncludeFile($moduleDirname, 'footer', true); + return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true); } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -119,7 +123,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/Admin/index.php b/class/Files/Templates/Admin/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Templates/Admin/index.php @@ -0,0 +1,2 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return TemplatesBlocks + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param string $filename + */ + public function write($module, $table, string $filename): void + { + $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, string $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"); + } + } + $th .= $this->hc->getHtmlTableHead(' ', '', '', "\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(string $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 Constants::FIELD_ELE_COLORPICKER: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $span = $this->hc->getHtmlTag('span', [], $double, false, '', ''); + $td .= $this->hc->getHtmlTableData($span, 'center', '', "\t\t\t"); + break; + case Constants::FIELD_ELE_IMAGELIST: + $src = $this->sc->getSmartyNoSimbol('xoModuleIcons32'); + $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', '', '', "''", "'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', '', '', "''", "'html'"); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + 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: + $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, '', '', "''", "'html'"); + $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|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"'); + $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', ' > ', '0', $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(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); + $tbody .= $this->getTemplatesBlocksTableTfoot(); + $single = $this->sc->getSmartySingleVar('table_type'); + + return $this->hc->getHtmlTable($tbody, 'table table-responsive table-' . $single); + } + + /** + * @public function render + * + * @return 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/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php new file mode 100644 index 00000000..36a2d94b --- /dev/null +++ b/class/Files/Templates/Blocks/Defstyle/TemplatesBlocksSpotlight.php @@ -0,0 +1,267 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return false|TemplatesBlocksSpotlight + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param string $filename + */ + public function write($module, $table, string $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, string $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"); + } + } + $th .= $this->hc->getHtmlTableHead(' ', '', '', "\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(string $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 Constants::FIELD_ELE_COLORPICKER: + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $span = $this->hc->getHtmlTag('span', [], $double, false, '', ''); + $td .= $this->hc->getHtmlTableData($span, 'center', '', "\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"); + 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], '', 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); + $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'); + $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"); + $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"); + } + + /** + * @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(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); + $tbody .= $this->getTemplatesBlocksTableTfoot(); + $single = $this->sc->getSmartySingleVar('table_type'); + + return $this->hc->getHtmlTable($tbody, 'table table-responsive table-' . $single); + } + + /** + * @public function render + * + * @return 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/Templates/Blocks/Defstyle/index.php b/class/Files/Templates/Blocks/Defstyle/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Templates/Blocks/Defstyle/index.php @@ -0,0 +1,2 @@ +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/index.php b/class/Files/Templates/Blocks/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Templates/Blocks/index.php @@ -0,0 +1,2 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); + } + + /** + * @static function getInstance + * @return bool|Breadcrumbs + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param string $filename + */ + public function write($module, string $filename): void + { + $this->setModule($module); + $this->setFileName($filename); + } + + /** + * @public function render + * + * @return string + */ + public function render(): string + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $stuModuleDirname = \strtoupper($moduleDirname); + + $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); + $into = $this->hc->getHtmlLi($anchor, 'breadcrumb-item', "\t"); + $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"); + + $content = $this->hc->getHtmlOl($into, 'breadcrumb'); + + $this->cf->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->cf->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..6dda46ff --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Categories.php @@ -0,0 +1,228 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * @return bool|Categories + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param string $filename + */ + public function write($module, $table, string $filename): void + { + $this->setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserCategoriesHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserCategoriesHeader(string $moduleDirname): string + { + return $this->sc->getSmartyIncludeFile($moduleDirname) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesTable + * @param string $language + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, string $language): string + { + $single = $this->sc->getSmartySingleVar('table_type'); + $table = $this->getTemplatesUserCategoriesThead($tableName, $language); + $table .= $this->getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName); + + return $this->hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesThead + * @param string $language + * @param $tableName + * @return string + */ + private function getTemplatesUserCategoriesThead($tableName, string $language): string + { + $stuTableName = \mb_strtoupper($tableName); + $lang = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE'); + $single = $this->sc->getSmartySingleVar('numb_col'); + $th = $this->hc->getHtmlTableHead($lang, '', $single) . PHP_EOL; + $tr = $this->hc->getHtmlTableRow($th, 'head') . PHP_EOL; + + return $this->hc->getHtmlTableThead($tr) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesTbody + * @param string $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + private function getTemplatesUserCategoriesTbody(string $moduleDirname, $tableName, $tableSoleName): string + { + $single = $this->sc->getSmartySingleVar('panel_type'); + $include = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName); + $div = $this->hc->getHtmlDiv($include, 'panel panel-' . $single); + $cont = $this->hc->getHtmlTableData($div) . PHP_EOL; + $html = $this->hc->getHtmlEmpty('') . PHP_EOL; + $cont .= $this->sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html, false, false, false, '', "\n", true, false) . PHP_EOL; + $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL; + $tr = $this->hc->getHtmlTableRow($foreach) . PHP_EOL; + + return $this->hc->getHtmlTableTbody($tr) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesTfoot + * @return string + */ + private function getTemplatesUserCategoriesTfoot(): string + { + $td = $this->hc->getHtmlTableData(' ') . PHP_EOL; + $tr = $this->hc->getHtmlTableRow($td) . PHP_EOL; + + return $this->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): string + { + $tab = $this->getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) . PHP_EOL; + $div = $this->hc->getHtmlDiv($tab, 'table-responsive') . PHP_EOL; + + return $this->sc->getSmartyConditions($tableName, ' gt ', '0', $div, false, true, false, '', "\n", true, 'int') . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesPanel + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserCategoriesPanel(string $moduleDirname, string $tableName, $tableSoleName, $language): string + { + $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'); + + return $this->hc->getHtmlDiv($div, 'panel panel-' . $panelType) . PHP_EOL; + } + + /** + * @private function getTemplatesUserCategoriesFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserCategoriesFooter(string $moduleDirname): string + { + return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); + } + + /** + * @public function render + * @return string + */ + public function render(): string + { + $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); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/user/CategoriesList.php b/class/Files/Templates/User/Defstyle/CategoriesList.php similarity index 61% rename from class/Files/Templates/user/CategoriesList.php rename to class/Files/Templates/User/Defstyle/CategoriesList.php index 88173928..6327fa9a 100644 --- a/class/Files/Templates/user/CategoriesList.php +++ b/class/Files/Templates/User/Defstyle/CategoriesList.php @@ -1,10 +1,9 @@ -hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** * @static function getInstance - * @param null - * @return User\CategoriesList + * @return bool|CategoriesList */ public static function getInstance() { @@ -58,11 +66,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): void { $this->setModule($module); $this->setTable($table); @@ -75,12 +83,10 @@ public function write($module, $table, $filename) */ private function getTemplatesUserCategoriesListStartTable() { - $ret = << - \n -EOT; - - return $ret; + return << +
\n + EOT; } /** @@ -91,25 +97,25 @@ 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) { + 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; + \n + EOT; } } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } @@ -117,19 +123,19 @@ 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; + + \n + EOT; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - foreach (array_keys($fields) as $f) { + 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')) { @@ -139,15 +145,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: @@ -155,67 +161,64 @@ 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; } /** * @private function getTemplatesUserCategoriesListTfoot - * @param string $table + * @param $table * @return string */ private function getTemplatesUserCategoriesListTfoot($table) { - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - $ret = << - \n -EOT; + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $ret = << + \n + EOT; - foreach (array_keys($fields) as $f) { + 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; + \n + EOT; } } } $ret .= << - \n -EOT; + + \n + EOT; return $ret; } /** * @private function getTemplatesUserCategoriesListEndTable - * @param null * * @return string */ private function getTemplatesUserCategoriesListEndTable() { - $ret = << -\n -EOT; - - return $ret; + return << + \n + EOT; } /** @@ -227,14 +230,12 @@ private function getTemplatesUserCategoriesListEndTable() * @param $tableSoleName * @return string */ - private function getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName) + private function getTemplatesUserCategoriesListPanel(string $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) { + 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')) { @@ -243,43 +244,43 @@ private function getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $ default: case 2: $rpFieldName = $this->getRightString($fieldName); - $doubleVar = $sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); - $retElem .= $hc->getHtmlSpan($doubleVar, 'col-sm-2') . PHP_EOL; + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $this->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; + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $this->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; + $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') . 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; + $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') . PHP_EOL; unset($img); break; } } } } - $ret .= $hc->getHtmlDiv($retElem, 'panel-body') . PHP_EOL; + $ret .= $this->hc->getHtmlDiv($retElem, 'panel-body') . PHP_EOL; return $ret; } /** * @public function render - * @return bool|string + * @return string */ public function render() { @@ -287,20 +288,19 @@ public function render() $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) { + $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); + if (\in_array(1, $tableCategory)) { + $content .= $this->getTemplatesUserCategoriesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName); } } - $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 new file mode 100644 index 00000000..d76847d0 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Footer.php @@ -0,0 +1,146 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return Footer + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param mixed $table + * @param string $filename + */ + public function write($module, $table, string $filename): void + { + $this->setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @public function getTemplateUserFooterFacebookLikeButton + * + * @return string + */ + public function getTemplateUserFooterFacebookLikeButton() + { + return "
  • "; + } + + /** + * @public function getTemplateUserFooterFacebookShareButton + * + * @return string + */ + public function getTemplateUserFooterFacebookShareButton() + { + return "
  • "; + } + + /** + * @public function render + * @param $language + * @return string + */ + private function getTemplateUserFooterContent($language) + { + $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); + $ret .= $this->sc->getSmartyConditions('xoops_isadmin', '', '', $contIf); + $ret .= $this->hc->getHtmlEmpty("\n"); + $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, "\t\t\t"); + $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"); + $ret .= $this->sc->getSmartyConditions('comment_mode', '', '', $contIf); + $ret .= $this->sc->getSmartyIncludeFile('system_notification', 'select'); + + return $ret; + } + + /** + * @public function render + * + * @return string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); + $content = $this->getTemplateUserFooterContent($language); + + $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/user/Header.php b/class/Files/Templates/User/Defstyle/Header.php similarity index 59% rename from class/Files/Templates/user/Header.php rename to class/Files/Templates/User/Defstyle/Header.php index 23f7b319..9249b6ff 100644 --- a/class/Files/Templates/user/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->cf = Modulebuilder\Files\CreateFile::getInstance(); + $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return Header */ public static function getInstance() @@ -64,10 +72,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -76,29 +84,28 @@ public function write($module, $filename) /** * @public function getTemplatesUserHeader * @param $moduleDirname - * @return bool|string + * @return 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); + $ret = ''; + $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) ; + $ret .= $this->sc->getSmartyConditions('ads', '', '', $div); return $ret; } /** * @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() { $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); + $this->cf->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); - return $this->tdmcfile->renderFile(); + return $this->cf->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..cd0fb890 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Index.php @@ -0,0 +1,207 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return Index + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param $tables + * @param $filename + */ + public function write($module, $table, $tables, $filename): void + { + $this->setModule($module); + $this->setTable($table); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @public function getTemplateUserIndexHeader + * @param $moduleDirname + * @return string + */ + public function getTemplateUserIndexHeader($moduleDirname) + { + return $this->sc->getSmartyIncludeFile($moduleDirname); + } + + /** + * @public function getTemplatesUserIndexBodyDefault + * @param $module + * @param $language + * @return string + */ + public function getTemplatesUserIndexIntro($module, $language) + { + $moduleDirname = $module->getVar('mod_dirname'); + $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"); + $contTable = $thead; + //Table body + $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'); + $stuTableNameLi = \mb_strtoupper($tableName); + $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"); + $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"); + $contTable .= $tfoot; + + $ret .= $this->hc->getHtmlTable($contTable); + $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 string $t + * @return string + */ + 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); + $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); + $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 . '_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"); + + $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; + } + + /** + * @public function getTemplateUserIndexFooter + * @param $moduleDirname + * @return string + */ + public function getTemplateUserIndexFooter($moduleDirname) + { + return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); + } + + /** + * @public function render + * + * @return string + */ + 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', '', false); + $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'); + if (1 == $tableIndex) { + $content .= $this->getTemplateUserIndexTable($moduleDirname, $tableName, $tableSoleName, $language); + } + } + $content .= $this->getTemplateUserIndexFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/user/MoreFiles.php b/class/Files/Templates/User/Defstyle/MoreFiles.php similarity index 68% rename from class/Files/Templates/user/MoreFiles.php rename to class/Files/Templates/User/Defstyle/MoreFiles.php index 93a16633..392ccf21 100644 --- a/class/Files/Templates/user/MoreFiles.php +++ b/class/Files/Templates/User/Defstyle/MoreFiles.php @@ -1,9 +1,9 @@ -setModule($module); $this->setFileName($filename); @@ -76,25 +74,22 @@ public function write($module, $folder, $filename, $extension) /** * @private function getTemplatesUserMoreFile - * @param null * * @return string */ private function getTemplatesUserMoreFile() { - $ret = <<<'EOT' -
    - Pleace! Enter here your template code here -
    -EOT; - - return $ret; + return <<<'EOT' +
    + Pleace! Enter here your template code here +
    + EOT; } /** * @public function render - * @param null - * @return bool|string + * + * @return string */ public function render() { @@ -103,7 +98,7 @@ public function render() $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); + $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 new file mode 100644 index 00000000..dd121013 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Pages.php @@ -0,0 +1,236 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return Pages + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param string $filename + */ + public function write($module, $table, string $filename): void + { + $this->setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPagesHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserPagesHeader(string $moduleDirname) + { + return $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false,'',"\n\n"); + } + + /** + * @private function getTemplatesUserPagesTable + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param string $language + * @return string + */ + private function getTemplatesUserPagesTable(string $moduleDirname, string $tableName, $tableSoleName, string $language) + { + $tbody = $this->getTemplatesUserPagesTableThead($tableName, $language); + $tbody .= $this->getTemplatesUserPagesTableTbody($moduleDirname, $tableName, $tableSoleName); + $tbody .= $this->getTemplatesUserPagesTableTfoot(); + $single = $this->sc->getSmartySingleVar('table_type'); + + return $this->hc->getHtmlTable($tbody, 'table table-' . $single, "\t"); + } + + /** + * @private function getTemplatesUserPagesThead + * @param string $language + * @param $tableName + * @return string + */ + private function getTemplatesUserPagesTableThead($tableName, string $language) + { + $stuTableName = \mb_strtoupper($tableName); + $single = $this->sc->getSmartySingleVar('divideby'); + $lang = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE'); + $th = $this->hc->getHtmlTableHead($lang, '', $single, "\t\t\t\t"); + $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t\t"); + + return $this->hc->getHtmlTableThead($tr, '', "\t\t"); + } + + /** + * @private function getTemplatesUserPagesTbody + * @param string $moduleDirname + * @param $tableName + * @param $tableSoleName + * @return string + */ + 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); + $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 . '_list', $cont, $tableSoleName,'',"\t\t\t\t"); + $tr = $this->hc->getHtmlTableRow($foreach,'',"\t\t\t"); + + return $this->hc->getHtmlTableTbody($tr,'',"\t\t"); + } + + /** + * @private function getTemplatesUserPagesTfoot + * + * @return string + */ + private function getTemplatesUserPagesTableTfoot() + { + $td = $this->hc->getHtmlTableData(' ', '', '', '', ''); + $tr = $this->hc->getHtmlTableRow($td, '', '', ''); + + return $this->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) + { + $table = $this->getTemplatesUserPagesTable($moduleDirname, $tableName, $tableSoleName, $language); + $div = $this->hc->getHtmlDiv($table, 'table-responsive'); + + return $this->sc->getSmartyConditions($tableName . 'Count', ' > ', '0', $div, false, false, true, '', "\n", true, 'int'); + } + + /** + * @private function getTemplatesUserPagesForm + * @return string + */ + private function getTemplatesUserPagesForm() + { + $var = $this->sc->getSmartySingleVar('form', "\t", "\n"); + + return $this->sc->getSmartyConditions('form', '', '', $var, false, false, true); + } + + /** + * @private function getTemplatesUserPagesError + * @return string + */ + private function getTemplatesUserPagesError() + { + $var = $this->sc->getSmartySingleVar('error', "\t", "\n"); + + return $this->sc->getSmartyConditions('error', '', '', $var, false, false, true); + } + + /** + * @private function getTemplatesUserPagesFooter + * @param string $moduleDirname + * + * @return string + */ + private function getTemplatesUserPagesFooter(string $moduleDirname) + { + $ret = $this->hc->getHtmlEmpty('', '', "\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); + + return $ret; + } + + /** + * @public function render + * + * @return 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', '', false); + $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_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/Defstyle/PagesItem.php b/class/Files/Templates/User/Defstyle/PagesItem.php new file mode 100644 index 00000000..208c1438 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/PagesItem.php @@ -0,0 +1,329 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return PagesItem + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param $tables + * @param string $filename + */ + public function write($module, $table, $tables, string $filename): void + { + $this->setModule($module); + $this->setTable($table); + $this->setTables($tables); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPagesItemPanel + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $tableRate + * @param $tableBroken + * @param $language + * @return string + */ + private function getTemplatesUserPagesItemPanel(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableRate, $tableBroken, $language) + { + $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'); + $ccFieldId = $this->getCamelCase($fieldId, false, true); + $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $this->getRightString($fieldId)); + } + $fieldElement = $fields[$f]->getVar('field_element'); + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_thead')) { + switch ($fieldElement) { + default: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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', '', '', "''", "'html'"); + $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', '', '', "''", "'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', '', '', "''", "'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); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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); + break; + } + } + } + } + $ret .= $this->hc->getHtmlI('', '', $ccFieldId . '_' . $keyDouble); + $ret .= $this->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: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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', '', '', "''", "'html'"); + $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', '', '', "''", "'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', '', '', "''", "'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); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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); + break; + } + } + } + } + $ret .= $this->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')) { + $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, '', '', "''", "'html'"); + $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', '', '', "''", "'html'"); + $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', '', '', "''", "'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', '', '', "''", "'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); + break; + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $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); + break; + } + } + } + } + + $anchors = ''; + $lang = $this->sc->getSmartyConst($language, \mb_strtoupper($tableName) . '_LIST'); + $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|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|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", "\n", true, 'bool'); + if (1 == $tableBroken) { + $lang = $this->sc->getSmartyConst($language, 'BROKEN'); + $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-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'); + } + + return $ret; + } + + /** + * @public function render + * + * @return string + */ + public function render() + { + $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'); + $tableSoleName = $table->getVar('table_solename'); + $tableRate = $table->getVar('table_rate'); + $tableBroken = $table->getVar('table_broken'); + $tableCategory[] = $table->getVar('table_category'); + if (\in_array(0, $tableCategory)) { + $content .= $this->getTemplatesUserPagesItemPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableRate, $tableBroken, $language); + } + + $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 new file mode 100644 index 00000000..db294997 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/PagesList.php @@ -0,0 +1,304 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return PagesList + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param $tables + * @param string $filename + */ + public function write($module, $table, $tables, string $filename): void + { + $this->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(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language): string + { + $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_ihead')) { + switch ($fieldElement) { + default: + $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'); + $retElem = ''; + $fieldId = ''; + $keyDouble = ''; + foreach (\array_keys($fields) as $f) { + if (0 == $f) { + $fieldId = $fields[$f]->getVar('field_name'); + $keyDouble = $this->sc->getSmartyDoubleVar($tableSoleName, $fieldId); + } + $fieldElement = $fields[$f]->getVar('field_element'); + if (1 == $fields[$f]->getVar('field_user')) { + if (1 == $fields[$f]->getVar('field_ibody')) { + switch ($fieldElement) { + default: + $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-9 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, 'col-sm-9 justify',"\t"); + unset($img); + break; + } + } + } + } + + $ret .= $this->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_ifoot')) { + $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; + } + } + } + } + + $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"); + $ret .= $this->hc->getHtmlDiv($retFoot, 'panel-foot'); + + return $ret; + } + + /** + * @public function render + * + * @return string + */ + public function render(): string + { + $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'); + $tableSoleName = $table->getVar('table_solename'); + $tableCategory[] = $table->getVar('table_category'); + if (\in_array(0, $tableCategory)) { + $content .= $this->getTemplatesUserPagesListPanel($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language); + } + + $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 new file mode 100644 index 00000000..5ef1b5ee --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Pdf.php @@ -0,0 +1,174 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * + * @return Pdf + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * + * @param $module + * @param $table + * @param $filename + */ + public function write($module, $table, $filename): void + { + $this->setModule($module); + $this->setFileName($filename); + $this->setTable($table); + } + + /** + * @private function getTemplatesUserPagesItemPanel + * @param string $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $language + * @return string + */ + private function getTemplatesUserPdfBody(string $moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language) + { + $fields = $this->getTableFields($tableMid, $tableId); + $ret = ''; + $content_header = $this->sc->getSmartySingleVar('content_header'); + $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')) { + if (1 == $fields[$f]->getVar('field_tbody')) { + $fieldName = $fields[$f]->getVar('field_name'); + $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); + switch ($fieldElement) { + default: + $doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $retElem .= $this->hc->getHtmlDiv($doubleVar, 'col-sm-8', "\t", "\n", false); + break; + 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 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); + $retElem .= $this->hc->getHtmlDiv($img, 'col-sm-9', "\t", "\n", false); + unset($img); + break; + } + } + } + } + $ret .= $this->hc->getHtmlDiv($retElem, 'panel-body'); + + return $ret; + } + + /** + * @public function render + * + * @return string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $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); + + $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/user/Rate.php b/class/Files/Templates/User/Defstyle/Rate.php similarity index 55% rename from class/Files/Templates/user/Rate.php rename to class/Files/Templates/User/Defstyle/Rate.php index d24e065c..5c2a716a 100644 --- a/class/Files/Templates/user/Rate.php +++ b/class/Files/Templates/User/Defstyle/Rate.php @@ -1,9 +1,12 @@ -setModule($module); $this->setTable($table); @@ -71,33 +72,33 @@ public function write($module, $table, $filename) /** * @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 = << -
    <{\$list.{$rpFieldName}}>
    {$tableName}{$tableName}<{\$list.{$rpFieldName}}>
    <{\$list.{$rpFieldName}}>
    - - \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) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); - $langStuFieldName = $language . mb_strtoupper($fieldName); + $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; } @@ -105,55 +106,54 @@ private function getTemplatesUserRateHeader($moduleDirname, $table, $language) /** * @private function getTemplatesUserRateBody * @param string $moduleDirname - * @param string $table - * @param string $language + * @param $table * * @return string */ - private function getTemplatesUserRateBody($moduleDirname, $table, $language) + private function getTemplatesUserRateBody(string $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) { + 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: + case Constants::FIELD_ELE_COLORPICKER: $ret .= <<\t\t\n -EOT; + \n + EOT; break; - case 10: + case Constants::FIELD_ELE_IMAGELIST: $ret .= <<{$tableName}\n -EOT; + \n + EOT; break; - case 13: + 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; } @@ -161,49 +161,48 @@ private function getTemplatesUserRateBody($moduleDirname, $table, $language) /** * @private function getTemplatesUserRateBodyFieldnameEmpty * @param string $moduleDirname - * @param string $table - * @param string $language + * @param $table * * @return string */ - private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, $language) + private function getTemplatesUserRateBodyFieldnameEmpty(string $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) { + 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: + case Constants::FIELD_ELE_COLORPICKER: $ret .= <<\n -EOT; + \n + EOT; break; - case 13: + 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; } @@ -214,19 +213,16 @@ private function getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, * * @return string */ - private function getTemplatesUserRateFooter($moduleDirname) + private function getTemplatesUserRateFooter(string $moduleDirname) { - $ret = << -EOT; - - return $ret; + return << + EOT; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -235,17 +231,17 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MA'); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); $content = $this->getTemplatesUserRateHeader($moduleDirname, $table, $language); // Verify if table_fieldname is not empty if (!empty($tableFieldname)) { - $content .= $this->getTemplatesUserRateBody($moduleDirname, $table, $language); + $content .= $this->getTemplatesUserRateBody($moduleDirname, $table); } else { - $content .= $this->getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table, $language); + $content .= $this->getTemplatesUserRateBodyFieldnameEmpty($moduleDirname, $table); } $content .= $this->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 new file mode 100644 index 00000000..a83de0bf --- /dev/null +++ b/class/Files/Templates/User/Defstyle/Rss.php @@ -0,0 +1,125 @@ +setModule($module); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserRssXml + * @return string + */ + private function getTemplatesUserRssXml() + { + return << + + + <{\$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|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|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; + } + + /** + * @public function render + * @return string + */ + public function render() + { + $module = $this->getModule(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $content = $this->getTemplatesUserRssXml(); + + $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/user/Search.php b/class/Files/Templates/User/Defstyle/Search.php similarity index 58% rename from class/Files/Templates/user/Search.php rename to class/Files/Templates/User/Defstyle/Search.php index 7d91377f..d7d78ae1 100644 --- a/class/Files/Templates/user/Search.php +++ b/class/Files/Templates/User/Defstyle/Search.php @@ -1,9 +1,9 @@ -setModule($module); $this->setTable($table); @@ -71,33 +69,33 @@ public function write($module, $table, $filename) /** * @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 = << - - - \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) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); - $langStuFieldName = $language . mb_strtoupper($fieldName); + $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; } @@ -105,21 +103,20 @@ private function getTemplatesUserSearchHeader($moduleDirname, $table, $language) /** * @private function getTemplatesUserSearchBody * @param string $moduleDirname - * @param string $table - * @param string $language + * @param $table * * @return string */ - private function getTemplatesUserSearchBody($moduleDirname, $table, $language) + private function getTemplatesUserSearchBody(string $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) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldElement = $fields[$f]->getVar('field_element'); $rpFieldName = $this->getRightString($fieldName); @@ -127,33 +124,33 @@ private function getTemplatesUserSearchBody($moduleDirname, $table, $language) 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; } @@ -161,49 +158,48 @@ private function getTemplatesUserSearchBody($moduleDirname, $table, $language) /** * @private function getTemplatesUserSearchBodyFieldnameEmpty * @param string $moduleDirname - * @param string $table - * @param string $language + * @param $table * * @return string */ - private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table, $language) + private function getTemplatesUserSearchBodyFieldnameEmpty(string $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) { + 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; + \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; } @@ -213,19 +209,16 @@ private function getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table * @param string $moduleDirname * @return string */ - private function getTemplatesUserSearchFooter($moduleDirname) + private function getTemplatesUserSearchFooter(string $moduleDirname) { - $ret = << -EOT; - - return $ret; + return << + EOT; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -234,17 +227,17 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $tableFieldname = $table->getVar('table_fieldname'); - $language = $this->getLanguage($moduleDirname, 'MA'); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); $content = $this->getTemplatesUserSearchHeader($moduleDirname, $table, $language); // Verify if table_fieldname is not empty if (!empty($tableFieldname)) { - $content .= $this->getTemplatesUserSearchBody($moduleDirname, $table, $language); + $content .= $this->getTemplatesUserSearchBody($moduleDirname, $table); } else { - $content .= $this->getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table, $language); + $content .= $this->getTemplatesUserSearchBodyFieldnameEmpty($moduleDirname, $table); } $content .= $this->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 new file mode 100644 index 00000000..17a08323 --- /dev/null +++ b/class/Files/Templates/User/Defstyle/UserPrint.php @@ -0,0 +1,275 @@ +hc = Modulebuilder\Files\CreateHtmlCode::getInstance(); + $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance(); + } + + /** + * @static function getInstance + * @return UserPrint + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function write + * @param $module + * @param $table + * @param string $filename + */ + public function write($module, $table, string $filename): void + { + $this->setModule($module); + $this->setTable($table); + $this->setFileName($filename); + } + + /** + * @private function getTemplatesUserPrintHeader + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserPrintHeader(string $moduleDirname) + { + $ret = $this->hc->getHtmlComment('Header', '', "\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', false, '', "\n\n"); + + return $ret; + } + + /** + * @private function getTemplatesUserPrintTableThead + * @param $tableSoleName + * @param $tableAutoincrement + * @param array $fields + * @param string $language + * @return string + */ + private function getTemplatesUserPrintTableThead($tableSoleName, $tableAutoincrement, array $fields, string $language) + { + $th = ''; + $langHeadId = \mb_strtoupper($tableSoleName) . '_ID'; + if (1 == $tableAutoincrement) { + $lang = $this->sc->getSmartyConst($language, $langHeadId); + $th .= $this->hc->getHtmlTag('th', ['class' => 'center'], $lang, false, "\t\t\t"); + } + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $rpFieldName = $this->getRightString($fieldName); + $langFieldName = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); + if (1 == $fields[$f]->getVar('field_user')) { + $lang = $this->sc->getSmartyConst($language, $langFieldName); + $th .= $this->hc->getHtmlTag('th', ['class' => 'center'], $lang, false, "\t\t\t"); + } + } + + $tr = $this->hc->getHtmlTableRow($th, 'head', "\t\t"); + return $this->hc->getHtmlTableThead($tr, '', "\t"); + } + + /** + * @private function getTemplatesUserPrintTableTBody + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param array $fields + * @return string + * @internal param string $language + */ + private function getTemplatesUserPrintTableTBody(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, array $fields) + { + $td = ''; + if (1 == $tableAutoincrement) { + $double = $this->sc->getSmartyDoubleVar($tableSoleName, 'id'); + $td .= $this->hc->getHtmlTableData($double, 'center', '', "\t\t\t"); + } + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + $fieldElement = $fields[$f]->getVar('field_element'); + $rpFieldName = $this->getRightString($fieldName); + if (1 == $fields[$f]->getVar('field_user')) { + switch ($fieldElement) { + 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 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 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 ... + $double = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName); + $color = "    "; + $td .= $this->hc->getHtmlTableData($color, 'center', '', "\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"); + 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"); + break; + 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'); + $img = $this->hc->getHtmlTag('img', ['src' => $src, 'alt' => $imgAlt, 'title' => $imgAlt], '', 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; + } + } + } + $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"); + return $this->hc->getHtmlTableTbody($foreach, '', "\t"); + } + + /** + * @private function getTemplatesUserPrintTable + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param $fields + * @param string $language + * @return string + */ + 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); + + return $this->hc->getHtmlTable($tbody, 'table table-bordered'); + } + + /** + * @private function getTemplatesUserPrint + * @param string $moduleDirname + * @param string $tableName + * @param $tableSoleName + * @param $tableAutoincrement + * @param $fields + * @param string $language + * @return string + */ + private function getTemplatesUserPrint(string $moduleDirname, string $tableName, $tableSoleName, $tableAutoincrement, $fields, string $language) + { + return $this->getTemplatesUserPrintTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language); + } + + /** + * @private function getTemplatesUserPrintFooter + * @param string $moduleDirname + * @return string + */ + private function getTemplatesUserPrintFooter(string $moduleDirname) + { + $ret = $this->hc->getHtmlComment('Footer', '', "\n"); + $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer'); + + return $ret; + } + + /** + * @public function render + * @return string + */ + public function render() + { + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA', '', false); + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order'); + $content = $this->getTemplatesUserPrintHeader($moduleDirname); + $content .= $this->getTemplatesUserPrint($moduleDirname, $table->getVar('table_name'), $table->getVar('table_solename'), $table->getVar('table_autoincrement'), $fields, $language); + $content .= $this->getTemplatesUserPrintFooter($moduleDirname); + + $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); + + return $this->renderFile(); + } +} diff --git a/class/Files/Templates/User/index.php b/class/Files/Templates/User/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/Templates/User/index.php @@ -0,0 +1,2 @@ +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/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/Index.php b/class/Files/Templates/user/Index.php deleted file mode 100644 index dd2b12ad..00000000 --- a/class/Files/Templates/user/Index.php +++ /dev/null @@ -1,345 +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') . PHP_EOL; - } - - /** - * @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) . PHP_EOL; - } - - /** - * @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) . PHP_EOL; - $tr = $hc->getHtmlTableRow($th, 'head') . PHP_EOL; - - return $hc->getHtmlTableThead($tr) . PHP_EOL; - } - - /** - * @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) . 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 getTemplatesUserIndexTfoot - * @return string - */ - private function getTemplatesUserIndexTableTfoot() - { - $hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); - $td = $hc->getHtmlTableData(' ') . PHP_EOL; - $tr = $hc->getHtmlTableRow($td) . PHP_EOL; - - return $hc->getHtmlTableTfoot($tr) . PHP_EOL; - } - - /** - * @public function getTemplatesUserIndexBodyDefault - * @param $module - * @param $table - * @param $language - * @return bool|string - */ - public function getTemplatesUserIndexBodyDefault($module, $table, $language) - { - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $ret = << - - - - - - - - - - - - - <{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/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/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/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/User/UserBroken.php b/class/Files/User/UserBroken.php deleted file mode 100644 index cd60752c..00000000 --- a/class/Files/User/UserBroken.php +++ /dev/null @@ -1,227 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @public function getUserBrokenHeader - * @param $moduleDirname - * @param $fields - * @return string - */ - public function getUserBrokenHeader($moduleDirname, $fields) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $fieldId = $xc->getXcSaveFieldId($fields); - $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - $ret .= $xc->getXcXoopsRequest('op', 'op', 'list'); - $ret .= $xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int'); - $ret .= $pc->getPhpCodeCommentLine('Template'); - $ret .= $uxc->getUserTplMain($moduleDirname, 'broken'); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); - $ret .= $xc->getXcXoThemeAddStylesheet(); - $ret .= $pc->getPhpCodeCommentLine('Redirection if not permissions'); - $condIf = $xc->getXcRedirectHeader('index', '', '2', '_NOPERM', true, "\t"); - $condIf .= $this->getSimpleString('exit();', "\t"); - $ret .= $pc->getPhpCodeConditions('$permSubmit', ' === ', 'false', $condIf); - - return $ret; - } - - /** - * @public function getAdminPagesList - * @param $tableName - * @param $language - * @param $t - * @return string - */ - public function getUserBrokenForm($tableName, $language, $t) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $pc->getPhpCodeCommentLine('Navigation','', $t); - $ret .= $xc->getXcEqualsOperator('$navigation', "{$language}SUBMIT_PROPOSER", null, $t); - $ret .= $xc->getXcXoopsTplAssign('navigation', '$navigation', true, $t); - $ret .= $pc->getPhpCodeCommentLine('Title of page', null, $t); - $ret .= $xc->getXcEqualsOperator('$title', "{$language}SUBMIT_PROPOSER . ' - '", null, $t); - $ret .= $xc->getXcEqualsOperator('$title', "\$GLOBALS['xoopsModule']->name()", '.', $t); - $ret .= $xc->getXcXoopsTplAssign('xoops_pagetitle', '$title', true, $t); - $ret .= $pc->getPhpCodeCommentLine('Description', null, $t); - $ret .= $uxc->getUserAddMeta('description', $language, 'SUBMIT_PROPOSER', $t); - $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 getUserBrokenSave - * @param $moduleDirname - * @param $fields - * @param $tableName - * @param $tableSoleName - * @param $language - * @param $t - * @return string - */ - public function getUserBrokenSave($moduleDirname, $fields, $tableName, $tableSoleName, $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 .= $xc->getXcHandlerCreateObj($tableName, $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); - - $ret .= $pc->getPhpCodeConditions('!$xoopsCaptcha->verify()', '', '', "\t\t\t\$errorMessage .= \$xoopsCaptcha->getMessage().'
    ';\n\t\t\t\$error = true;\n", false, $t); - - $ret .= $xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, $t); - - $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"); - $assigne = $xc->getXcXoopsTplAssign('error_message', '$errorMessage', true, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$error', ' === ', 'true', $assigne, $condElse, $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 getUserSubmitSwitch - * @param $moduleDirname - * @param $tableName - * @param $tableSoleName - * @param $language - * @return bool|string - */ - private function getUserBrokenSwitch($moduleDirname, $tableName, $tableSoleName, $language) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $table = $this->getTable(); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $fields = $this->getTableFields($tableMid, $tableId); - $cases = [ - 'form' => [$this->getUserBrokenForm($tableName, $language, "\t\t")], - 'save' => [$this->getUserBrokenSave($moduleDirname, $fields, $tableName, $tableSoleName, $language, "\t\t")], - ]; - - return $xc->getXcSwitch('op', $cases, true, false); - } - - /** - * @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'); - $fields = $this->getTableFields($tableMid, $tableId); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserBrokenHeader($moduleDirname, $fields); - $content .= $this->getUserBrokenSwitch($moduleDirname, $tableName, $tableSoleName, $language); - $content .= $this->getInclude('footer'); - - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/User/UserFooter.php b/class/Files/User/UserFooter.php index 17659e54..1532ebce 100644 --- a/class/Files/User/UserFooter.php +++ b/class/Files/User/UserFooter.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserFooter */ public static function getInstance() @@ -57,10 +71,10 @@ public static function getInstance() /** * @public function write - * @param string $module + * @param $module * @param string $filename */ - public function write($module, $filename) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -69,43 +83,51 @@ public function write($module, $filename) /** * @private function getUserFooter * @param $moduleDirname + * @param $language * * @return string */ - private function getUserFooter($moduleDirname) + private function getUserFooter($moduleDirname, $language) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $xoBreadcrumbs = $xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs', true, "\t"); - $ret = $pc->getPhpCodeConditions('count($xoBreadcrumbs)', ' > ', '1', $xoBreadcrumbs); - $ret .= $xc->getXcXoopsTplAssign('adv', "\$helper->getConfig('advertise')"); - $ret .= $pc->getPhpCodeCommentLine(); - $ret .= $xc->getXcXoopsTplAssign('bookmarks', "\$helper->getConfig('bookmarks')"); - $ret .= $xc->getXcXoopsTplAssign('fbcomments', "\$helper->getConfig('fbcomments')"); - $ret .= $pc->getPhpCodeCommentLine(); - $ret .= $xc->getXcXoopsTplAssign('admin', "{$stuModuleDirname}_ADMIN"); - $ret .= $xc->getXcXoopsTplAssign('copyright', '$copyright'); - $ret .= $pc->getPhpCodeCommentLine(); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'footer', true); + $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->getPhpCodeBlankLine(); + $ret .= $this->xc->getXcXoopsTplAssign('bookmarks', "\$helper->getConfig('bookmarks')"); + $ret .= $this->xc->getXcXoopsTplAssign('fbcomments', "\$helper->getConfig('fbcomments')"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->xc->getXcXoopsTplAssign('admin', "\\{$stuModuleDirname}_ADMIN"); + $ret .= $this->xc->getXcXoopsTplAssign('copyright', '$copyright'); + $ret .= $this->pc->getPhpCodeCommentLine('Meta description'); + $ret .= $this->uxc->getUserMetaDesc($moduleDirname); + $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; } /** * @public function render - * @param null - * @return bool|string + * @return string */ 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_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 8c48bf11..da25d5e1 100644 --- a/class/Files/User/UserHeader.php +++ b/class/Files/User/UserHeader.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserHeader */ public static function getInstance() @@ -57,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) + public function write($module, $table, array $tables, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -78,57 +87,55 @@ public function write($module, $table, $tables, $filename) */ private function getUserHeader($moduleDirname) { - $stuModuleDirname = mb_strtoupper($moduleDirname); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $pc->getPhpCodeIncludeDir('dirname(dirname(__DIR__))', 'mainfile'); - $ret .= $pc->getPhpCodeIncludeDir('__DIR__', 'include/common'); - $ret .= $xc->getXcEqualsOperator('$moduleDirName', 'basename(__DIR__)'); - $language = $this->getLanguage($moduleDirname, 'MA'); - $ret .= $uxc->getUserBreadcrumbsHeaderFile($moduleDirname, $language); - - $table = $this->getTable(); - $tables = $this->getTables(); - if (is_object($table) && '' != $table->getVar('table_name')) { - $ret .= $xc->getXcHelperGetInstance($moduleDirname); - } - if (is_array($tables)) { - foreach (array_keys($tables) as $i) { + $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); + $permissions = 0; + $ratings = 0; + if (\is_array($tables)) { + foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); - $ret .= $xc->getXcHandlerLine($tableName); + $ret .= $this->xc->getXcHandlerLine($tableName); + if (1 == $tables[$i]->getVar('table_permissions')) { + $permissions = 1; + } + if (1 == $tables[$i]->getVar('table_rate')) { + $ratings = 1; + } } } - $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); - $ret .= $pc->getPhpCodeCommentLine(); - $ret .= $xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); - $ret .= $pc->getPhpCodeCommentLine('Default Css Style'); - $ret .= $xc->getXcEqualsOperator('$style', "{$stuModuleDirname}_URL . '/assets/css/style.css'"); - $ret .= $pc->getPhpCodeConditions('!file_exists($style)', '', '', "\treturn false;\n"); - $ret .= $pc->getPhpCodeCommentLine('Smarty Default'); - $ret .= $xc->getXcXoopsModuleGetInfo('sysPathIcon16', 'sysicons16'); - $ret .= $xc->getXcXoopsModuleGetInfo('sysPathIcon32', 'sysicons32'); - $ret .= $xc->getXcXoopsModuleGetInfo('pathModuleAdmin', 'dirmoduleadmin'); - $ret .= $xc->getXcXoopsModuleGetInfo('modPathIcon16', 'modicons16'); - $ret .= $xc->getXcXoopsModuleGetInfo('modPathIcon32', 'modicons16'); - $ret .= $pc->getPhpCodeCommentLine('Load Languages'); - $ret .= $xc->getXcXoopsLoadLanguage('main'); - $ret .= $xc->getXcXoopsLoadLanguage('modinfo'); + if (1 == $permissions) { + $ret .= $this->xc->getXcHandlerLine('permissions'); + } + if (1 == $ratings) { + $ret .= $this->xc->getXcHandlerLine('ratings'); + } + $ret .= $this->pc->getPhpCodeCommentLine(); + $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->xc->getXcXoopsModuleGetInfo('sysPathIcon16', 'sysicons16'); + $ret .= $this->xc->getXcXoopsModuleGetInfo('sysPathIcon32', 'sysicons32'); + $ret .= $this->xc->getXcXoopsModuleGetInfo('pathModuleAdmin', 'dirmoduleadmin'); + $ret .= $this->xc->getXcXoopsModuleGetInfo('modPathIcon16', 'modicons16'); + $ret .= $this->xc->getXcXoopsModuleGetInfo('modPathIcon32', 'modicons16'); + $ret .= $this->pc->getPhpCodeCommentLine('Load Languages'); + $ret .= $this->xc->getXcXoopsLoadLanguage('main'); + $ret .= $this->xc->getXcXoopsLoadLanguage('modinfo'); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -138,7 +145,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..36e77fcc 100644 --- a/class/Files/User/UserIndex.php +++ b/class/Files/User/UserIndex.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserIndex */ public static function getInstance() @@ -57,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); @@ -69,22 +83,22 @@ public function write($module, $table, $filename) } /** - * @private function getTemplateHeaderFile + * @private function getUserIndexHeader + * @param $language * @param $moduleDirname * * @return string */ - private function getTemplateHeaderFile($moduleDirname) + private function getUserIndexHeader($language, $moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $this->getInclude(); - $ret .= $uxc->getUserTplMain($moduleDirname); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); - $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet'); - $ret .= $xc->getXcXoThemeAddStylesheet(); - $ret .= $pc->getPhpCodeArray('keywords', null, false, ''); + $ret = $this->getRequire(); + $ret .= $this->uxc->getUserTplMain($moduleDirname); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'header', true); + $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet'); + $ret .= $this->xc->getXcXoThemeAddStylesheet(); + $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); + $ret .= $this->pc->getPhpCodeArray('keywords', null, false, ''); + $ret .= $this->uxc->getUserBreadcrumbs($language); return $ret; } @@ -103,32 +117,30 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS // Fields $fields = $this->getTableFields($tableMid, $tableId); $fieldParentId = []; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldParentId[] = $fields[$f]->getVar('field_parent'); } $ret = ''; - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - if (in_array(1, $fieldParentId)) { - $ret .= $xc->getXcHandlerCountObj($tableName); - $ret .= $pc->getPhpCodeCommentLine('If there are ', $tableName); + if (\in_array(1, $fieldParentId)) { + $ret .= $this->xc->getXcHandlerCountObj($tableName); + $ret .= $this->pc->getPhpCodeCommentLine('If there are ', $tableName); $ret .= $this->getSimpleString('$count = 1;'); - $contentIf = $xc->getXcHandlerAllObj($tableName, '', 0, 0, "\t"); - $contentIf .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/tree', true, false, 'include', "\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 .= $pc->getPhpCodeArray($tableName, "\t"); - $foreach = $xc->getXcGetValues($tableName, $tableSoleName . 'Values', $tableFieldname, false, "\t\t"); - $foreach .= $pc->getPhpCodeArray('acount', ["'count'", '$count']); - $foreach .= $pc->getPhpCodeArrayType($tableName, 'merge', $tableSoleName . 'Values', '$acount'); + $contentIf .= $this->pc->getPhpCodeArray($tableName, "\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"); - $contentIf .= $pc->getPhpCodeForeach("{$tableName}All", true, false, $tableFieldname, $foreach, "\t"); - $contentIf .= $xc->getXcXoopsTplAssign($tableName, '$' . $tableName, true, "\t"); - $contentIf .= $pc->getPhpCodeUnset($tableName, "\t"); - $getConfig = $xc->getXcGetConfig('numb_col'); - $contentIf .= $xc->getXcXoopsTplAssign('numb_col', $getConfig, true, "\t"); - $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $contentIf, false); - $ret .= $pc->getPhpCodeUnset('count'); + $contentIf .= $this->pc->getPhpCodeForeach("{$tableName}All", true, false, $tableFieldname, $foreach, "\t"); + $contentIf .= $this->xc->getXcXoopsTplAssign($tableName, '$' . $tableName, true, "\t"); + $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); + $ret .= $this->pc->getPhpCodeUnset('count'); } unset($fieldParentId); @@ -137,61 +149,54 @@ private function getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableS /** * @private function getBodyPagesIndex - * @param $moduleDirname * @param $tableName - * @param $tableSoleName * @param $language + * @param $tableMid + * @param $tableId * @return string */ - private function getBodyPagesIndex($moduleDirname, $tableName, $tableSoleName, $language) + private function getBodyPagesIndex($tableName, $language, $tableMid, $tableId) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ucfTableName = ucfirst($tableName); - $ret = $pc->getPhpCodeCommentLine(); - $ret .= $xc->getXcXoopsTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL'); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_url", "{$stuModuleDirname}_URL"); - $ret .= $pc->getPhpCodeCommentLine(); - $ret .= $xc->getXcHandlerCountObj($tableName); - $ret .= $xc->getXcXoopsTplAssign($tableName . 'Count', "\${$tableName}Count"); - $ret .= $this->getSimpleString('$count = 1;'); - $condIf = $xc->getXcXoopsRequest('start', 'start', '0', 'Int', false, "\t"); - $userpager = $xc->getXcGetConfig('userpager'); - $condIf .= $xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int', false, "\t"); - $condIf .= $xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', "\t"); - $condIf .= $pc->getPhpCodeCommentLine('Get All', $ucfTableName, "\t"); - $condIf .= $pc->getPhpCodeArray($tableName, null, false, "\t"); - $foreach = $xc->getXcGetValues($tableName, $tableSoleName, 'i', false, "\t\t"); - $foreach .= $pc->getPhpCodeArray('acount', ["'count'", '$count']); - $foreach .= $pc->getPhpCodeArrayType($tableName, 'merge', $tableSoleName, '$acount'); - $table = $this->getTable(); + $ucfTableName = \ucfirst($tableName); + $fields = $this->getTableFields($tableMid, $tableId); + + $ret = $this->pc->getPhpCodeCommentLine('Tables'); + $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', "\t"); + $userpager = $this->xc->getXcGetConfig('userpager'); + $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"); + $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 - $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); $fieldMain = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (1 == $fields[$f]->getVar('field_main')) { $fieldMain = $fieldName; // fieldMain = fields parameters main field } } - $foreach .= $xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, "\t\t"); - $foreach .= $this->getSimpleString('++$count;', "\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"); - $thereare = $pc->getPhpCodeSprintf("{$language}INDEX_THEREARE", "\${$tableName}Count"); - $condIf .= $xc->getXcXoopsTplAssign('lang_thereare', $thereare, true, "\t"); - $divideby = $xc->getXcGetConfig('divideby'); - $condIf .= $xc->getXcXoopsTplAssign('divideby', $divideby, true, "\t"); - $numb_col = $xc->getXcGetConfig('numb_col'); - $condIf .= $xc->getXcXoopsTplAssign('numb_col', $numb_col, true, "\t"); - - $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf); - $ret .= $pc->getPhpCodeUnset('count'); - $tableType = $xc->getXcGetConfig('table_type'); - $ret .= $xc->getXcXoopsTplAssign('table_type', $tableType); + $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 . '_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"); + $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'); + $ret .= $this->xc->getXcXoopsTplAssign('table_type', $tableType); return $ret; } @@ -199,66 +204,55 @@ private function getBodyPagesIndex($moduleDirname, $tableName, $tableSoleName, $ /** * @private function getUserPagesFooter * @param $moduleDirname - * @param $language + * * @return string */ - private function getUserIndexFooter($moduleDirname, $language) + private function getUserIndexFooter($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $uxc->getUserBreadcrumbs($language); - $ret .= $pc->getPhpCodeCommentLine('Keywords'); - $ret .= $uxc->getUserMetaKeywords($moduleDirname); - $ret .= $pc->getPhpCodeUnset('keywords'); - $ret .= $pc->getPhpCodeCommentLine('Description'); - $ret .= $uxc->getUserMetaDesc($moduleDirname, $language); - $ret .= $xc->getXcXoopsTplAssign('xoops_mpageurl', "{$stuModuleDirname}_URL.'/index.php'"); - $ret .= $xc->getXcXoopsTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL'); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL"); - $ret .= $this->getInclude('footer'); + $ret = $this->pc->getPhpCodeCommentLine('Meta keywords'); + $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); + $ret .= $this->pc->getPhpCodeUnset('keywords'); + $ret .= $this->getRequire('footer'); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $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 .= $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $content .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $content .= $this->getTemplateHeaderFile($moduleDirname); - 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'); - $tableFieldname = $tables[$t]->getVar('table_fieldname'); - $tableIndex[] = $tables[$t]->getVar('table_index'); - if (in_array(1, $tableCategory, true) && in_array(1, $tableIndex)) { + + $content = $this->getHeaderFilesComments($module); + $content .= $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $content .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); + $content .= $this->getUserIndexHeader($language, $moduleDirname); + + 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'); + $tableFieldname = $tables[$t]->getVar('table_fieldname'); + $tableIndex = $tables[$t]->getVar('table_index'); + if (1 == $tableCategory && 1 == $tableIndex) { $content .= $this->getBodyCategoriesIndex($tableMid, $tableId, $tableName, $tableSoleName, $tableFieldname); } - if (in_array(0, $tableCategory, true) && in_array(1, $tableIndex)) { - $content .= $this->getBodyPagesIndex($moduleDirname, $tableName, $tableSoleName, $language); + if (0 == $tableCategory && 1 == $tableIndex) { + $content .= $this->getBodyPagesIndex($tableName, $language, $tableMid, $tableId); } } - $content .= $this->getUserIndexFooter($moduleDirname, $language); + $content .= $this->getUserIndexFooter($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/UserListTag.php b/class/Files/User/UserListTag.php index 34b2c732..d88699a3 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(); } /** * @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) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,21 +72,19 @@ public function write($module, $filename) /** * @public function getUserListTag - * @param null * @return string */ public function getUserListTag() { - $ret = $this->getInclude(); - $ret .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'modules/tag/list.tag'); + $ret = $this->getRequire(); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'modules/tag/list.tag'); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -98,7 +94,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..a494d813 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(); } /** * @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) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,8 +72,7 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -83,10 +80,10 @@ public function render() $filename = $this->getFileName(); $moduleDirname = $module->getVar('mod_dirname'); $content = $this->getHeaderFilesComments($module); - $content .= $this->pc->getPhpCodeIncludeDir('dirname(dirname(__DIR__))', 'mainfile'); - $content .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'include/notification_update'); + $content .= $this->pc->getPhpCodeIncludeDir('\dirname(__DIR__, 2)', '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 5525f51d..74b2b211 100644 --- a/class/Files/User/UserPages.php +++ b/class/Files/User/UserPages.php @@ -1,9 +1,12 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserPages */ public static function getInstance() @@ -73,81 +90,480 @@ public function write($module, $table, $filename) * @param $moduleDirname * @param $tableName * @param $fieldId + * @param $tablePermissions + * @param $language * @return string */ - private function getUserPagesHeader($moduleDirname, $tableName, $fieldId) + private function getUserPagesHeader($moduleDirname, $tableName, $fieldId, $tablePermissions, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - $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('start', 'start', '0', 'Int'); - $userpager = $xc->getXcGetConfig('userpager'); - $ret .= $xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int'); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet'); - $ret .= $xc->getXcXoThemeAddStylesheet(); + $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->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); + $ret .= $this->getRequire(); + $ret .= $this->uxc->getUserTplMain($moduleDirname, $tableName); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'header', true); + $ret .= $this->pc->getPhpCodeBlankLine(); + $leftLen = \strlen($ccFieldId); + $leftOp = 'op'; + $leftField = $ccFieldId; + $leftStart = 'start'; + $leftLimit = 'limit'; + if ($leftLen > 5) { + $leftOp .= \str_repeat(' ', $leftLen - 2); + $leftStart .= \str_repeat(' ', $leftLen - 5); + $leftLimit .= \str_repeat(' ', $leftLen - 5); + } else { + $leftOp .= \str_repeat(' ', 3); + if (\strlen($ccFieldId) < 5) { + $leftField .= \str_repeat(' ', 5 - $leftLen); + } + } + $ret .= $this->xc->getXcXoopsRequest($leftOp, 'op', 'list', 'Cmd'); + $ret .= $this->xc->getXcXoopsRequest($leftField, $fieldId, '', 'Int'); + $ret .= $this->xc->getXcXoopsRequest($leftStart, 'start', '', 'Int'); + $userpager = $this->xc->getXcGetConfig('userpager'); + $ret .= $this->xc->getXcXoopsRequest($leftLimit, 'limit', $userpager, '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(); + $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); + $ret .= $this->pc->getPhpCodeArray('keywords', null, false, ''); + $ret .= $this->uxc->getUserBreadcrumbs($language, 'index', '', 'index.php'); + $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('showItem', "\${$ccFieldId} > 0"); + $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; } /** - * @private function getUserPages + * @private function getUserPagesList * @param $moduleDirname * @param $tableName * @param $fieldId * @param $fieldMain + * @param $tableRate + * @param $fieldReads + * @param $language + * @param string $t * @return string */ - private function getUserPages($moduleDirname, $tableName, $fieldId, $fieldMain) + private function getUserPagesList($moduleDirname, $tableName, $fieldId, $fieldMain, $tableRate, $fieldReads, $language, string $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ucfTableName = ucfirst($tableName); + $ucfTableName = \ucfirst($tableName); + $stuTableName = \mb_strtoupper($tableName); $ccFieldId = $this->getCamelCase($fieldId, false, true); + $ccFieldMain = $this->getCamelCase($fieldMain, false, true); + $ccFieldReads = $this->getCamelCase($fieldReads, false, true); + $stuModuleDirname = \mb_strtoupper($moduleDirname); + + $ret = $this->uxc->getUserBreadcrumbs($language, $tableName, 'list', '', $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); + } + $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", 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); + $ret .= $this->xc->getXcHandlerAllClear($tableName . 'All', $tableName, '$' . $critName, $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 . '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) { + $itemId = $this->xc->getXcGetVar($ccFieldId, "{$tableName}All[\$i]", $fieldId, true); + $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"); + $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"); + $config = $this->xc->getXcGetConfig('panel_type'); + $condIf .= $this->xc->getXcXoopsTplAssign('panel_type', $config, true, $t . "\t"); + $divideby = $this->xc->getXcGetConfig('divideby'); + $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"); + + if ('' !== $fieldReads) { + $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"); + $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"); + } - $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); - $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); - $tableType = $xc->getXcGetConfig('table_type'); - $condIf .= $xc->getXcXoopsTplAssign('type', $tableType, true, $t); - $divideby = $xc->getXcGetConfig('divideby'); - $condIf .= $xc->getXcXoopsTplAssign('divideby', $divideby, true, $t); - $numbCol = $xc->getXcGetConfig('numb_col'); - $condIf .= $xc->getXcXoopsTplAssign('numb_col', $numbCol, true, $t); - - $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, false, $t); + + return $ret; + } + + /** + * @public function getUserSubmitSave + * @param string $moduleDirname + * @param $fields + * @param string $tableName + * @param $tableSoleName + * @param $tablePermissions + * @param $tableNotifications + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesSave(string $moduleDirname, $fields, string $tableName, $tableSoleName, $tablePermissions, $tableNotifications, $language, string $t = '') + { + $ucfTableName = \ucfirst($tableName); + $countUploader = 0; + $fieldId = ''; + $ccFieldId = ''; + $fieldMain = ''; + $fieldStatus = ''; + $ucfFieldId = ''; + $ccFieldMain = ''; + $ccFieldStatus = ''; + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $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); + } + if ($fields[$f]->getVar('field_element') == Constants::FIELD_ELE_SELECTSTATUS) { + $fieldStatus = $fieldName; + $ccFieldStatus = $this->getCamelCase($fieldStatus, false, true); + } + } + + $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); + + 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); + } + $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'); + + $contentInsert = ''; + if (1 == $tableNotifications || $countUploader > 0) { + $contentInsert .= $this->pc->getPhpCodeTernaryOperator("new{$ucfFieldId}", "\${$ccFieldId} > 0", "\${$ccFieldId}", "\${$tableName}Obj->getNewInsertedId{$ucfTableName}()", $t . "\t"); + } + + 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, '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"); + 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}=' . \$new{$ucfFieldId}"; + + + + $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"); + //$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; + } else { + $not1If = $this->pc->getPhpCodeCommentLine('Event approve notification', null, $t . "\t\t"); + $not1If .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_approve', \$tags);", $t . "\t\t"); + $not1If .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \$new{$ucfFieldId}, '{$tableSoleName}_approve', \$tags);", $t . "\t\t"); + $not2If = $this->pc->getPhpCodeCommentLine('Event modify notification', null, $t . "\t\t\t"); + $not2If .= $this->getSimpleString("\$notificationHandler->triggerEvent('global', 0, 'global_modify', \$tags);", $t . "\t\t\t"); + $not2If .= $this->getSimpleString("\$notificationHandler->triggerEvent('{$tableName}', \$new{$ucfFieldId}, '{$tableSoleName}_modify', \$tags);", $t . "\t\t\t"); + $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_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"); + $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"); + } + $contentInsert .= $confirmOk; + $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); + + $ret .= $this->pc->getPhpCodeCommentLine('Get Form Error', null, $t); + $ret .= $this->xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, $t); + $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $this->xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + + return $ret; + } + + /** + * @private function getPermissionsSave + * @param $moduleDirname + * @param $ucfFieldId + * @param string $perm + * + * @return string + */ + 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"); + $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}'])", '', '', $foreach, false, "\t\t\t"); + + return $ret; + } + + /** + * @public function getUserPagesNew + * @param $tableName + * @param $tableSoleName + * @param $tablePermissions + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesNew($tableName, $tableSoleName, $tablePermissions, $language, string $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"); + $ret .= $this->pc->getPhpCodeConditions('!$permissionsHandler->getPermGlobalSubmit()', '', '', $contIf, false, $t); + } + $ret .= $this->xc->getXcCommonPagesNew($tableName, $t); + + return $ret; + } + + /** + * @public function getUserPagesEdit + * @param $tableName + * @param $tableSoleName + * @param $tablePermissions + * @param $fieldId + * @param $language + * @param string $t + * @return string + */ + public function getUserPagesEdit($tableName, $tableSoleName, $tablePermissions, $fieldId, $language, string $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); + $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, $language); + + 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, string $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); + $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', $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; + } + + /** + * @private function getUserPagesDelete + * @param $tableName + * @param $tableSoleName + * @param $tablePermissions + * @param $language + * @param $fieldId + * @param $fieldMain + * @param $tableNotifications + * @param string $t + * @return string + */ + private function getUserPagesDelete($tableName, $tableSoleName, $tablePermissions, $language, $fieldId, $fieldMain, $tableNotifications, string $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); + $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); + + return $ret; + } + + /** + * @private function getUserPagesBroken + * @param $language + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $fieldId + * @param $fieldStatus + * @param $fieldMain + * @param $tableNotifications + * @param string $t + * @return string + */ + 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); + $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); + + $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); + $xoopsSecurityCheck = $this->xc->getXcXoopsSecurityCheck(); + $xoopsSecurityErrors = $this->xc->getXcXoopsSecurityErrors(); + $implode = $this->pc->getPhpCodeImplode(', ', $xoopsSecurityErrors); + $redirectHeaderErrors = $this->xc->getXcRedirectHeader($tableName, '', '3', $implode, true, $t . "\t\t"); + $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); + $condition = $this->pc->getPhpCodeConditions('!' . $xoopsSecurityCheck, '', '', $redirectHeaderErrors, false, $t . "\t"); + $constant = $this->xc->getXcGetConstants('STATUS_BROKEN'); + $condition .= $this->xc->getXcSetVarObj($tableName, $fieldStatus, $constant, $t . "\t"); + + $contInsert = ''; + if (1 == $tableNotifications) { + $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}"; + $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"); + $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"); + $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($language, $fieldId, $fieldMain, 'broken', $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions($isset, ' && ', "1 == \${$reqOk}", $condition, $mainElse, $t); return $ret; } @@ -155,67 +571,114 @@ private function getUserPages($moduleDirname, $tableName, $fieldId, $fieldMain) /** * @private function getUserPagesFooter * @param $moduleDirname - * @param $tableName - * @param $language + * @param $tableComments * * @return string */ - private function getUserPagesFooter($moduleDirname, $tableName, $language) + private function getUserPagesFooter($moduleDirname, $tableComments) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $stuTableName = mb_strtoupper($tableName); - $ret = $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $uxc->getUserBreadcrumbs($language, $stuTableName); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Keywords'); - $ret .= $uxc->getUserMetaKeywords($moduleDirname); - $ret .= $pc->getPhpCodeUnset('keywords'); - $ret .= $pc->getPhpCodeBlankLine(); - $ret .= $pc->getPhpCodeCommentLine('Description'); - $ret .= $uxc->getUserMetaDesc($moduleDirname, $language, $stuTableName); - $ret .= $xc->getXcXoopsTplAssign('xoops_mpageurl', "{$stuModuleDirname}_URL.'/{$tableName}.php'"); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL"); - $ret .= $this->getInclude('footer'); + $ret = $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Meta keywords'); + $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); + $ret .= $this->pc->getPhpCodeUnset('keywords'); + if (1 == $tableComments) { + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('View comments'); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'include/comment_view', true); + } + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->getRequire('footer'); return $ret; } + /** + * @private function getUserPagesSwitch + * @param $moduleDirname + * @param $tableId + * @param $tableMid + * @param $tableName + * @param $tableSoleName + * @param $tableSubmit + * @param $tablePermissions + * @param $tableBroken + * @param $fieldId + * @param $fieldMain + * @param $fieldStatus + * @param $tableNotifications + * @param $tableRate + * @param $fieldReads + * @param $language + * @return string + */ + 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")]; + 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")]; + } + if (1 == $tableBroken) { + $cases['broken'] = [$this->getUserPagesBroken($language, $moduleDirname, $tableName, $tableSoleName, $fieldId, $fieldStatus, $fieldMain, $tableNotifications, "\t\t")]; + } + + return $this->xc->getXcSwitch('op', $cases, true); + } + /** * @public function render - * @param null - * @return bool|string + * @return string */ 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'); + $tableNotifications = $table->getVar('table_notifications'); + $tableComments = $table->getVar('table_comments'); + $tableRate = $table->getVar('table_rate'); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $language = $this->getLanguage($moduleDirname, 'MA'); + // Fields - $fieldId = ''; - $fieldMain = ''; + $fieldId = ''; + $fieldMain = ''; + $fieldStatus = ''; + $fieldReads = ''; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - foreach (array_keys($fields) as $f) { + 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; // fieldMain = fields parameters main field + $fieldMain = $fieldName; // fields parameters main field + } + if (Constants::FIELD_ELE_SELECTSTATUS == $fields[$f]->getVar('field_element')) { + $fieldStatus = $fieldName; // fields for status + } + if (Constants::FIELD_ELE_TEXTREADS == $fields[$f]->getVar('field_element')) { + $fieldReads = $fieldName; // fields for count reads } } - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserPagesHeader($moduleDirname, $tableName, $fieldId); - $content .= $this->getUserPages($moduleDirname, $tableName, $fieldId, $fieldMain); - $content .= $this->getUserPagesFooter($moduleDirname, $tableName, $language); + $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); + $content .= $this->getUserPagesFooter($moduleDirname, $tableComments); - $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..b38f7b7d 100644 --- a/class/Files/User/UserPdf.php +++ b/class/Files/User/UserPdf.php @@ -1,9 +1,12 @@ -xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $this->uxc = UserXoopsCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->cf = Modulebuilder\Files\CreateFile::getInstance(); } /** * @static function getInstance - * @param null * @return UserPdf */ public static function getInstance() @@ -75,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) + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -96,20 +95,34 @@ public function write($module, $table, $filename) */ 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->getInclude(); - $fileExist = $this->pc->getPhpCodeFileExists("\$tcpdf = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php'"); - $requireOnce = $this->pc->getPhpCodeIncludeDir('$tcpdf', '', true, true, 'require', "\t"); - $ret .= $this->xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int'); - $redirectHeader = $this->xc->getXcRedirectHeader($tableName, '', $numb = '2', "{$language}NO_PDF_LIBRARY", true, "\t"); + $ret .= $this->getRequire(); + $ret .= $this->pc->getPhpCodeIncludeDir("\XOOPS_ROOT_PATH . '/header.php'", '', true, true); + $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, '', '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->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->getXcGetVar($tableName, 'this', $fieldId, false, ''); + $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('" . $moduleDirname . "_upload_url', \\" . strtoupper($moduleDirname) . '_UPLOAD_URL);'); $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; @@ -119,84 +132,129 @@ private function getUserPdfHeader($moduleDirname, $tableName, $fields, $language * @public function getAdminPagesList * @param $moduleDirname * @param $tableName + * @param $tableSolename * @param $fields + * @param $tablePermissions * @return string */ - public function getUserPdfTcpdf($moduleDirname, $tableName, $fields) + public function getUserPdfTcpdf($moduleDirname, $tableName, $tableSolename, $fields, $tablePermissions) { - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ret = ''; - foreach (array_keys($fields) as $f) { + $stuModuleDirname = \mb_strtoupper($moduleDirname); + + $fieldId = $this->xc->getXcTableFieldId($fields); + $ccFieldId = $this->getCamelCase($fieldId, false, true); + $fieldMain = $this->xc->getXcTableFieldMain($fields); + + $ret = ''; + 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 ', "''"); + $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 . 'Handler', $fieldName, true); + $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['title'] ", $getVar); + $ret .= $this->pc->getPhpCodeStripTags("pdfData['subject'] ", $getVar); + $titleFound = true; } break; - case 3: - case 4: - $ret .= $this->pc->getPhpCodeStripTags("pdfData['content']", $getVar); + case Constants::FIELD_ELE_TEXTAREA: + case Constants::FIELD_ELE_DHTMLTEXTAREA: + $ret .= $this->pc->getPhpCodeStripTags('content', $getVar, false, '', '.='); break; - case 8: - $ret .= $this->xc->getXcXoopsUserUnameFromId("pdfData['author'] ", $getVar); + case Constants::FIELD_ELE_SELECTUSER: + $ret .= $this->xc->getXcXoopsUserUnameFromId("pdfData['author'] ", $getVar); break; - case 15: - $ret .= $this->xc->getXcFormatTimeStamp("pdfData['date'] ", $getVar); + case Constants::FIELD_ELE_TEXTDATESELECT: + $ret .= $this->xc->getXcFormatTimeStamp("pdfData['date'] ", $getVar); break; } } + 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->pc->getPhpCodeBlankLine(); - $ret .= $this->pc->getPhpCodeCommentLine('Get Config'); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['creator'] ", "\$GLOBALS['xoopsConfig']['xoops_sitename']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['subject'] ", "\$GLOBALS['xoopsConfig']['slogan']"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['keywords'] ", "\$GLOBALS['xoopsConfig']['keywords']"); - $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->xc->getXcEqualsOperator('$myts', 'MyTextSanitizer::getInstance()'); - $ret .= $this->xc->getXcEqualsOperator('$content', "''"); - $ret .= $this->xc->getXcEqualsOperator('$content', "\$myts->undoHtmlSpecialChars(\$pdfData['content'])", '.'); - $ret .= $this->xc->getXcEqualsOperator('$content', '$myts->displayTarea($content)'); + $ret .= $this->pc->getPhpCodeCommentLine('Create pdf'); $ret .= $this->xc->getXcEqualsOperator('$pdf', 'new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, _CHARSET, false)'); - $ret .= $this->xc->getXcEqualsOperator('$title', "\$myts->undoHtmlSpecialChars(\$pdfData['title'])"); - $ret .= $this->xc->getXcEqualsOperator('$keywords', "\$myts->undoHtmlSpecialChars(\$pdfData['keywords'])"); - $ret .= $this->xc->getXcEqualsOperator("\$pdfData['fontsize']", '12'); - $ret .= $this->pc->getPhpCodeCommentLine('For schinese'); - $ifLang = $this->getSimpleString("\$pdf->SetFont('gbsn00lp', '', \$pdfData['fontsize']);", "\t"); - $elseLang = $this->getSimpleString("\$pdf->SetFont(\$pdfData['fontname'], '', \$pdfData['fontsize']);", "\t"); - $ret .= $this->pc->getPhpCodeConditions('_LANGCODE', ' == ', "'cn'", $ifLang, $elseLang); + $ret .= $this->pc->getPhpCodeCommentLine('Remove/add default header/footer'); + $ret .= $this->getSimpleString('$pdf->setPrintHeader(false);'); + $ret .= $this->getSimpleString('$pdf->setPrintFooter(true);'); $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->SetKeywords($keywords);'); + $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);"); + $ret .= $this->getSimpleString("\$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, {$stuModuleDirname}_HEADER_TITLE, {$stuModuleDirname}_HEADER_STRING);"); $ret .= $this->pc->getPhpCodeCommentLine('Set margins'); $ret .= $this->getSimpleString('$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT);'); $ret .= $this->pc->getPhpCodeCommentLine('Set auto page breaks'); $ret .= $this->getSimpleString('$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);'); - $ret .= $this->getSimpleString('$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);'); - $ret .= $this->getSimpleString('$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);'); + $ret .= $this->getSimpleString('$pdf->setHeaderMargin(PDF_MARGIN_HEADER);'); + $ret .= $this->getSimpleString('$pdf->setFooterMargin(PDF_MARGIN_FOOTER);'); $ret .= $this->getSimpleString('$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor'); - $ifLang = $this->getSimpleString("\$pdf->setHeaderFont(array('gbsn00lp', '', \$pdfData['fontsize']));", "\t"); - $ifLang .= $this->getSimpleString("\$pdf->setFooterFont(array('gbsn00lp', '', \$pdfData['fontsize']));", "\t"); - $elseLang = $this->getSimpleString("\$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));", "\t"); - $elseLang .= $this->getSimpleString("\$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));", "\t"); + $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"); + $elseLang .= $this->getSimpleString("\$pdf->SetFont(\$pdfData['fontname'], '', \$pdfData['fontsize']);", "\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; @@ -212,41 +270,40 @@ public function getUserPdfTcpdf($moduleDirname, $tableName, $fields) */ private function getUserPdfFooter($moduleDirname, $tableName) { - $ret = $this->pc->getPhpCodeCommentLine('Initialize document'); - $ret .= $this->getSimpleString('$pdf->AliasNbPages();'); - $ret .= $this->pc->getPhpCodeCommentLine('Add Page document'); + $ret = $this->pc->getPhpCodeCommentLine('Add Page document'); $ret .= $this->getSimpleString('$pdf->AddPage();'); - $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->pc->getPhpCodeCommentLine('Pdf Filename'); $ret .= $this->pc->getPhpCodeCommentLine('Output'); - $ret .= $this->xc->getXcXoopsTplAssign('pdfoutput', "\$pdf->Output('{$tableName}.pdf', 'I')"); - $ret .= $this->xc->getXcXoopsTplDisplay($moduleDirname . '_pdf.tpl', '', false); + $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');"); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return 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'); - $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, $fields); - $content .= $this->getUserPdfFooter($moduleDirname, $tableName); - - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $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); return $this->renderFile(); } diff --git a/class/Files/User/UserPrint.php b/class/Files/User/UserPrint.php index 8b960d70..75a30cc4 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->uxc = UserXoopsCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserPrint */ public static function getInstance() @@ -75,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) + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -93,18 +84,19 @@ public function write($module, $table, $filename) * * @return string */ - public function getUserPrint($moduleDirname, $language) + public function getUserPrint(string $moduleDirname, string $language, int $tablePermissions) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); + $stuModuleDirname = \mb_strtoupper($moduleDirname); $table = $this->getTable(); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldId = ''; $fieldMain = ''; + $fieldName = ''; $ucfFieldName = ''; - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if ((0 == $f) && (1 == $this->table->getVar('table_autoincrement'))) { $fieldId = $fieldName; @@ -113,19 +105,19 @@ public function getUserPrint($moduleDirname, $language) $fieldMain = $fieldName; // fieldMain = fields parameters main field } } - $ucfFieldName = ucfirst($fieldName); + $ucfFieldName = \ucfirst($fieldName); } $ccFieldId = $this->getCamelCase($fieldId, false, true); - $stuLpFieldName = mb_strtoupper($ccFieldId); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); + $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); $ret .= $this->xc->getXcXoopsRequest($ccFieldId, (string)$fieldId, '', 'Int'); $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet'); $ret .= $this->xc->getXcXoThemeAddStylesheet(); - $redirectHeader = $this->xc->getXcRedirectHeader("{$stuModuleDirname}_URL . '/index.php'", '', '2', "{$language}NO{$stuLpFieldName}", false, "\t"); - $ret .= $this->pc->getPhpCodeConditions("empty(\${$ccFieldId})", '', '', $redirectHeader); + $redirectHeader = $this->xc->getXcRedirectHeader("\\{$stuModuleDirname}_URL . '/index.php'", '', '2', "{$language}INVALID_PARAM", false, "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$ccFieldId}", ' == ', '0', $redirectHeader); $ret .= $this->pc->getPhpCodeCommentLine('Get Instance of Handler'); $ret .= $this->xc->getXcHandlerLine($tableName); @@ -134,56 +126,70 @@ public function getUserPrint($moduleDirname, $language) if (false !== mb_strpos($fieldName, 'published')) { $ret .= $this->pc->getPhpCodeCommentLine('Not yet', $fieldName); $redirectHeader .= $this->getSimpleString('exit();'); - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') == 0 || \${$tableName}Handler->getVar('{$fieldName}') > time()", '', '', $redirectHeader); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') == 0 || \${$tableName}Handler->getVar('{$fieldName}') > \time()", '', '', $redirectHeader); } if (false !== mb_strpos($fieldName, 'expired')) { $ret .= $this->pc->getPhpCodeCommentLine('Expired', $ucfFieldName); $redirectHeader .= $this->getSimpleString('exit();'); - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < time()", '', '', $redirectHeader); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < \time()", '', '', $redirectHeader); } if (false !== mb_strpos($fieldName, 'date')) { $ret .= $this->pc->getPhpCodeCommentLine('Date', $ucfFieldName); $redirectHeader .= $this->getSimpleString('exit();'); - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < time()", '', '', $redirectHeader); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < \time()", '', '', $redirectHeader); } if (false !== mb_strpos($fieldName, 'time')) { $ret .= $this->pc->getPhpCodeCommentLine('Time', $ucfFieldName); $redirectHeader .= $this->getSimpleString('exit();'); - $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < time()", '', '', $redirectHeader); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Handler->getVar('{$fieldName}') != 0 && \${$tableName}Handler->getVar('{$fieldName}') < \time()", '', '', $redirectHeader); + } + $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); + 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->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); - $contentForeach = $this->xc->getXcXoopsTplAppend('"{$k}"', '$v', "\t"); - $ret .= $this->pc->getPhpCodeForeach($tableSoleName, false, 'k', 'v', $contentForeach); + $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('', $tableSoleName, $fieldMain, true); - $stripTags = $this->pc->getPhpCodeStripTags('', $getVar . ' - ' . "{$language}PRINT" . ' - ' . "\$GLOBALS['xoopsModule']->name()", 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() { - $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); - - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); + $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); return $this->renderFile(); } diff --git a/class/Files/User/UserRate.php b/class/Files/User/UserRate.php index db1af079..85861d08 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->uxc = UserXoopsCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance * - * @param null * * @return UserRate */ @@ -79,14 +69,14 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param mixed $table + * @param $module + * @param $tables * @param string $filename */ - public function write($module, $table, $filename) + public function write($module, $tables, string $filename) { $this->setModule($module); - $this->setTable($table); + $this->setTables($tables); $this->setFileName($filename); } @@ -94,148 +84,227 @@ public function write($module, $table, $filename) * @private function getUserRateHeader * * @param $moduleDirname - * @param $tableName - * * @return string */ - public function getUserRateHeader($moduleDirname, $tableName) + public function getUserRateHeader($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'form'); - $ret .= $this->xc->getXcXoopsRequest('lid', 'lid', '', 'Int'); - $ret .= $this->uxc->getUserTplMain($moduleDirname, $tableName); - $ret .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); - $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet'); - $ret .= $this->xc->getXcXoThemeAddStylesheet(); + $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); + $ret .= $this->getRequire(); + $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'list', 'Cmd'); + $ret .= $this->xc->getXcXoopsRequest('source', 'source', '', 'Int'); return $ret; } /** * @private function getUserRateSwitch - * @param $moduleDirname - * @param $tableId - * @param $tableMid - * @param $tableName - * @param $tableSoleName - * @param $tableAutoincrement + * @param $tables * @param $language + * @param $moduleDirname * @return string */ - private function getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language) + private function getUserRateSwitch($tables, $language, $moduleDirname) { - $fields = $this->getTableFields($tableMid, $tableId); + $t = "\t\t"; $cases = [ - 'form' => [$this->getUserRateForm($tableName, $language)], - 'save' => [$this->getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableAutoincrement, $language)], + 'list' => [$this->getUserRateDefault( $t)], + 'save' => [$this->getUserRateSave($tables, $language, $t, $moduleDirname)], ]; - return $this->xc->getXcSwitch('op', $cases, true, false, "\t"); + return $this->xc->getXcSwitch('op', $cases, true); } /** * @public function getAdminPagesList - * @param $tableName - * @param $language - * + * @param string $t * @return string */ - public function getUserRateForm($tableName, $language) + public function getUserRateDefault(string $t = '') { - $ret = $this->pc->getPhpCodeCommentLine('Navigation'); - $ret .= $this->xc->getXcEqualsOperator('$navigation', "{$language}RATE", null, "\t\t"); - $ret .= $this->xc->getXcXoopsTplAssign('navigation', '$navigation', true, "\t\t"); - $ret .= $this->pc->getPhpCodeCommentLine('Title of page', null, "\t\t"); - $ret .= $this->xc->getXcEqualsOperator('$title', "{$language}RATE . ' - '", null, "\t\t"); - $ret .= $this->xc->getXcEqualsOperator('$title', "\$GLOBALS['xoopsModule']->name()", '.', "\t\t"); - $ret .= $this->xc->getXcXoopsTplAssign('xoops_pagetitle', '$title', true, "\t\t"); - $ret .= $this->pc->getPhpCodeCommentLine('Description', null, "\t\t"); - $ret .= $this->uxc->getUserAddMeta('description', $language, 'RATE', "\t\t"); - $ret .= $this->pc->getPhpCodeCommentLine('Form Create', null, "\t\t"); - $ret .= $this->xc->getXcHandlerCreateObj($tableName, "\t\t"); - $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', "\t\t"); - $ret .= $this->xc->getXcXoopsTplAssign('form', '$form->render()', true, "\t\t"); + $ret = $this->pc->getPhpCodeCommentLine('default should not happen','', $t); + $ret .= $this->xc->getXcRedirectHeader('index', '', '3', '\_NOPERM', true, $t); return $ret; } /** * @public function getUserRateSave - * @param $moduleDirname - * @param $fields - * @param $tableName - * @param $tableSoleName - * @param $tableAutoincrement + * @param $tables * @param $language + * @param $t + * @param $moduleDirname * @return string */ - public function getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableAutoincrement, $language) + public function getUserRateSave($tables, $language, $t, $moduleDirname) { - $ret = $this->pc->getPhpCodeCommentLine('Security Check'); + $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\t"); - $ret .= $this->pc->getPhpCodeConditions($xoopsSecurityCheck, '', '', $redirectError, false, "\t\t"); - $ret .= $this->xc->getXcHandlerCreateObj($tableName, "\t\t"); + $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', $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'); + $stuTableName = \mb_strtoupper($tableName); + if (1 == $table->getVar('table_rate')) { + $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldId = ''; + foreach (\array_keys($fields) as $f) { + if (0 == $f) { + $fieldId = $fields[$f]->getVar('field_name'); + } + } + $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); + } + } + $redirectError = $this->xc->getXcRedirectHeader('$redir', '', '3', "{$language}INVALID_PARAM", false, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('(int)$itemid', ' === ', '0', $redirectError, false, $t); - $ret .= $this->xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, "\t\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"); + $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"); + $ret .= $this->pc->getPhpCodeForeach('groups', false, false, 'group', $contFe, $t); + $contIf = $this->xc->getXcRedirectHeader('index', '', '3', $language . 'RATING_NOPERM', true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions('!$rate_allowed', '', '', $contIf, false, $t); - $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, "\t\t"); - $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj', true); - $confirmOk = $this->xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, "\t\t\t"); - $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $confirmOk, false, "\t\t"); + $ret .= $this->pc->getPhpCodeBlankLine(); + $ret .= $this->pc->getPhpCodeCommentLine('Check rating value', null, $t); + $cases = []; + $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]; + $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('!\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'); + $cases[$const] = ''; + $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, $t, false, true); - $ret .= $this->pc->getPhpCodeCommentLine('Get Form Error', null, "\t\t"); - $ret .= $this->xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, "\t\t"); - $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', "\t\t"); - $ret .= $this->xc->getXcXoopsTplAssign('form', '$form->display()', true, "\t\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->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"); + $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); + $ret .= $this->xc->getXcSetVarObj('ratings', 'rate_itemid', '$itemid', $t); + $ret .= $this->xc->getXcSetVarObj('ratings', 'rate_value', '$rating', $t); + $ret .= $this->xc->getXcSetVarObj('ratings', 'rate_uid', "\$itemrating['uid']", $t); + $ret .= $this->xc->getXcSetVarObj('ratings', 'rate_ip', "\$itemrating['ip']", $t); + $ret .= $this->xc->getXcSetVarObj('ratings', 'rate_date', '\time()', $t); + $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t); + $insert = $this->xc->getXcHandlerInsert('ratings', 'ratings', 'Obj'); + $contIf = $this->pc->getPhpCodeUnset('ratingsObj', $t . "\t"); + + $contIf .= $this->pc->getPhpCodeCommentLine('Calc average rating value', null, $t . "\t"); + foreach ($tables as $table) { + $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')); + $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"); + $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"); + } + } + + $contIf .= $this->pc->getPhpCodeBlankLine(); + $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); + $ret .= $this->getSimpleString("echo 'Error: ' . \$ratingsObj->getHtmlErrors();", $t); return $ret; } /** * @public function getUserRateFooter - * @param $moduleDirname - * @param $language * @return string */ - public function getUserRateFooter($moduleDirname, $language) + public function getUserRateFooter() { - $ret = $this->pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $this->uxc->getUserBreadcrumbs('RATE', $language); - $ret .= $this->getInclude('footer'); - - return $ret; + return $this->getRequire('footer'); } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { $module = $this->getModule(); - $table = $this->getTable(); + $tables = $this->getTables(); $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->getHeaderFilesComments($module); - //$content .= $this->getUserRateHeader($moduleDirname, $tableName); - //$content .= $this->getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language); - //$content .= $this->getUserRateFooter($moduleDirname, $language); + $content .= $this->getUserRateHeader($moduleDirname); + $content .= $this->getUserRateSwitch($tables, $language, $moduleDirname); + $content .= $this->getUserRateFooter(); - $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..14a32bad 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->uxc = UserXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserRss */ public static function getInstance() @@ -75,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) + public function write($module, $table, string $filename): void { $this->setModule($module); $this->setTable($table); @@ -91,13 +77,15 @@ public function write($module, $table, $filename) * @param string $moduleDirname * @return string */ - public function getUserRss($moduleDirname) + public function getUserRss(string $moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $table = $this->getTable(); $tableName = $table->getVar('table_name'); + $fppf = ''; + $fpmf = ''; + $fieldId = ''; $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldMain[] = $fields[$f]->getVar('field_main'); $fieldParent[] = $fields[$f]->getVar('field_parent'); @@ -105,115 +93,116 @@ public function getUserRss($moduleDirname) if (0 == $f) { $fieldId = $fieldName; } - if (in_array(1, $fieldMain)) { + if (\in_array(1, $fieldMain)) { $fpmf = $fieldName; } - if (in_array(1, $fieldParent)) { + if (\in_array(1, $fieldParent)) { $fppf = $fieldName; } else { $fppf = 'cid'; } } - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request']); - $ret .= $this->getInclude(); + $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request']); + $ret .= $this->getRequire(); $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 (\${$fppf} != 0){ - \$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 ( _LANGCODE == 'fr' ) { - \$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 (strpos(\$description,'[pagebreak]')==false){ - \$description_short = \$description; - } else { - \$description_short = substr(\$description,0,strpos(\$description,'[pagebreak]')); - } - \$tpl->append('items', array('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; + \${$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('name'), 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']); + \$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); + 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; return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ 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->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..913bd9d4 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->usercode = UserXoopsCode::getInstance(); + $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->uxc = UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserSearch */ public static function getInstance() @@ -70,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); @@ -92,12 +93,13 @@ public function write($module, $table, $filename) */ private function getUserSearchHeader($moduleDirname, $table, $fields) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - foreach (array_keys($fields) as $f) { + $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); + $ret .= $this->getRequire(); + $fieldId = 0; + $fieldPid = 0; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); if (0 == $f) { $fieldId = $fieldName; @@ -108,33 +110,28 @@ private function getUserSearchHeader($moduleDirname, $table, $fields) } if (1 == $table->getVar('table_category')) { $ccFieldPid = $this->getCamelCase($fieldPid, false, true); - $ret .= $this->xoopscode->getXcXoopsRequest($ccFieldPid, (string)$fieldPid, '0', 'Int'); + $ret .= $this->xc->getXcXoopsRequest($ccFieldPid, (string)$fieldPid, '', 'Int'); } $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret .= $this->xoopscode->getXcXoopsRequest($ccFieldId, (string)$fieldId, '0', 'Int'); - $ret .= $this->usercode->getUserTplMain($moduleDirname); - $ret .= $this->phpcode->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); + $ret .= $this->xc->getXcXoopsRequest($ccFieldId, (string)$fieldId, '', 'Int'); + $ret .= $this->uxc->getUserTplMain($moduleDirname); + $ret .= $this->phpcode->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'header', true); $ret .= $this->getDashComment('Define Stylesheet'); - $ret .= $this->xoopscode->getXcXoThemeAddStylesheet(); + $ret .= $this->xc->getXcXoThemeAddStylesheet(); return $ret; } /** * @public function getAdminPagesList - * @param $moduleDirname - * @param $tableName - * @param $language * @return string */ - public function getUserSearch($moduleDirname, $tableName, $language) + public function getUserSearch() { - $ret = <<<'EOT' + /*$ret = <<<'EOT' -EOT; - $ret .= $this->getSimpleString('$keywords = array();'); - - return $ret; +EOT;*/ + return $this->getSimpleString('$keywords = [];'); } /** @@ -148,27 +145,20 @@ public function getUserSearch($moduleDirname, $tableName, $language) */ private function getUserSearchFooter($moduleDirname, $tableName, $language) { - $stuModuleDirname = mb_strtoupper($moduleDirname); - $stuTableName = mb_strtoupper($tableName); + $stuTableName = \mb_strtoupper($tableName); $ret = $this->getDashComment('Breadcrumbs'); - $ret .= $this->usercode->getUserBreadcrumbs((string)$stuTableName, $language); + $ret .= $this->uxc->getUserBreadcrumbs((string)$stuTableName, $language); $ret .= $this->getDashComment('Keywords'); - $ret .= $this->usercode->getUserMetaKeywords($moduleDirname); + $ret .= $this->uxc->getUserMetaKeywords($moduleDirname); $ret .= $this->phpcode->getPhpCodeUnset('keywords'); - $ret .= $this->getDashComment('Description'); - $ret .= $this->usercode->getUserMetaDesc($moduleDirname, 'DESC', $language); - $ret .= $this->xoopscode->getXcXoopsTplAssign('xoops_mpageurl', "{$stuModuleDirname}_URL.'/index.php'"); - $ret .= $this->xoopscode->getXcXoopsTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL'); - $ret .= $this->xoopscode->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL"); - $ret .= $this->getInclude('footer'); + $ret .= $this->getRequire('footer'); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -183,10 +173,10 @@ public function render() $language = $this->getLanguage($moduleDirname, 'MA'); $content = $this->getHeaderFilesComments($module); $content .= $this->getUserSearchHeader($moduleDirname, $table, $fields); - $content .= $this->getUserSearch($moduleDirname, $tableName, $language); + $content .= $this->getUserSearch(); $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/UserSingle.php b/class/Files/User/UserSingle.php deleted file mode 100644 index 334965f1..00000000 --- a/class/Files/User/UserSingle.php +++ /dev/null @@ -1,182 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getUserSingleHeader - * @param $moduleDirname - * @param $table - * @param $fields - * @return string - */ - private function getUserSingleHeader($moduleDirname, $table, $fields) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - if (0 == $f) { - $fieldId = $fieldName; - } - if (1 == $fields[$f]->getVar('field_parent')) { - $fieldPid = $fieldName; - } - } - if (1 == $table->getVar('table_category')) { - $ccFieldPid = $this->getCamelCase($fieldPid, false, true); - $ret .= $xc->getXcXoopsRequest($ccFieldPid, (string)$fieldPid, '0', 'Int'); - } - $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret .= $xc->getXcXoopsRequest($ccFieldId, (string)$fieldId, '0', 'Int'); - $ret .= $uxc->getUserTplMain($moduleDirname, 'single'); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); - $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet'); - $ret .= $xc->getXcXoThemeAddStylesheet(); - - return $ret; - } - - /** - * @public function getUserSingleBody - * @param $moduleDirname - * @param $tableName - * @param $language - * - * @return string - */ - public function getUserSingleBody($moduleDirname, $tableName, $language) - { - $ret = <<<'EOT' - -EOT; - $ret .= $this->getSimpleString('$keywords = array();'); - - return $ret; - } - - /** - * @private function getUserSingleFooter - * @param $moduleDirname - * @param $tableName - * @param $language - * - * @return string - */ - private function getUserSingleFooter($moduleDirname, $tableName, $language) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $stuTableName = mb_strtoupper($tableName); - $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $uxc->getUserBreadcrumbs($language, $stuTableName); - $ret .= $pc->getPhpCodeCommentLine('Keywords'); - $ret .= $uxc->getUserMetaKeywords($moduleDirname); - $ret .= $pc->getPhpCodeUnset('keywords'); - $ret .= $pc->getPhpCodeCommentLine('Description'); - $ret .= $uxc->getUserMetaDesc($moduleDirname, $language, $stuTableName); - $ret .= $xc->getXcXoopsTplAssign('xoops_mpageurl', "{$stuModuleDirname}_URL.'/index.php'"); - $ret .= $xc->getXcXoopsTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL'); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL"); - $ret .= $this->getInclude('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'); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $tableName = $table->getVar('table_name'); - $fields = $this->getTableFields($tableMid, $tableId); - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getHeaderFilesComments($module); - $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); - - return $this->renderFile(); - } -} diff --git a/class/Files/User/UserSubmit.php b/class/Files/User/UserSubmit.php deleted file mode 100644 index db074d9d..00000000 --- a/class/Files/User/UserSubmit.php +++ /dev/null @@ -1,305 +0,0 @@ -setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @public function getUserSubmitHeader - * @param $moduleDirname - * - * @param $tablePermissions - * @return string - */ - public function getUserSubmitHeader($moduleDirname, $tablePermissions) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $t = "\t"; - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - $ret .= $xc->getXcXoopsLoadLanguage('admin', '', $moduleDirname); - $ret .= $pc->getPhpCodeCommentLine('It recovered the value of argument op in URL$'); - $ret .= $xc->getXcXoopsRequest('op', 'op', 'form'); - $ret .= $pc->getPhpCodeCommentLine('Template'); - $ret .= $uxc->getUserTplMain($moduleDirname, 'submit'); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true); - $ret .= $xc->getXcXoThemeAddStylesheet(); - if (1 == $tablePermissions) { - $ret .= $xc->getXcHandlerLine('permissions'); - $ret .= $xc->getXcEqualsOperator('$permSubmit', '$permissionsHandler->getPermGlobalSubmit()'); - $ret .= $pc->getPhpCodeCommentLine('Redirection if not permissions'); - $condIf = $xc->getXcRedirectHeader('index', '', '2', '_NOPERM', true, $t); - $condIf .= $this->getSimpleString('exit();', $t); - $ret .= $pc->getPhpCodeConditions('$permSubmit', ' === ', 'false', $condIf, false); - } - - return $ret; - } - - /** - * @public function getAdminPagesList - * @param $tableName - * @param $language - * @param string $t - * @return string - */ - public function getUserSubmitForm($tableName, $language, $t = '') - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $pc->getPhpCodeCommentLine('Navigation', '', $t); - $ret .= $xc->getXcEqualsOperator('$navigation', "{$language}SUBMIT_PROPOSER", '', $t); - $ret .= $xc->getXcXoopsTplAssign('navigation', '$navigation', true, $t); - $ret .= $pc->getPhpCodeCommentLine('Title of page', null, $t); - $ret .= $xc->getXcEqualsOperator('$title', "{$language}SUBMIT_PROPOSER . ' - '", '', $t ); - $ret .= $xc->getXcEqualsOperator('$title', "\$GLOBALS['xoopsModule']->name()", '.', $t); - $ret .= $xc->getXcXoopsTplAssign('xoops_pagetitle', '$title', true, $t); - $ret .= $pc->getPhpCodeCommentLine('Description', null, $t); - $ret .= $uxc->getUserAddMeta('description', $language, 'SUBMIT_PROPOSER', $t); - $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 getUserSubmitSave - * @param string $moduleDirname - * @param $fields - * @param string $tableName - * @param $tableSoleName - * @param $tableSubmit - * @param $tablePermissions - * @param $language - * @param string $t - * @return string - */ - public function getUserSubmitSave($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 .= $xc->getXcHandlerCreateObj($tableName, $t); - if (in_array(1, $tableSubmit)) { - $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; - } - - /** - * @public function getUserSubmitFooter - * @param $language - * @return string - */ - public function getUserSubmitFooter($language) - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $uxc->getUserBreadcrumbs($language, 'SUBMIT'); - $ret .= $this->getInclude('footer'); - - return $ret; - } - - /** - * @private function getUserSubmitSwitch - * @param $moduleDirname - * @param $tableId - * @param $tableMid - * @param $tableName - * @param $tableSoleName - * @param $tableSubmit - * @param $tablePermissions - * @param $language - * @param $t - * @return string - */ - private function getUserSubmitSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, $t) - { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $fields = $this->getTableFields($tableMid, $tableId); - $cases = [ - 'form' => [$this->getUserSubmitForm($tableName, $language, $t . "\t")], - 'save' => [$this->getUserSubmitSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableSubmit, $tablePermissions, $language, $t . "\t")], - ]; - - return $xc->getXcSwitch('op', $cases, true, false); - } - - /** - * @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; - } - - /** - * @public function render - * @param null - * @return bool|string - */ - public function render() - { - $module = $this->getModule(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tables = $this->getTableTables($module->getVar('mod_id')); - $tableSoleName = ''; - $tableSubmit = []; - $tablePermissions = []; - $tableId = ''; - $tableMid = ''; - $tableName = ''; - 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'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); - $tablePermissions = $tables[$t]->getVar('table_permissions'); - } - $language = $this->getLanguage($moduleDirname, 'MA'); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserSubmitHeader($moduleDirname, $tablePermissions); - $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); - - return $this->renderFile(); - } -} diff --git a/class/Files/User/UserViewTag.php b/class/Files/User/UserViewTag.php index 5c5365df..2a6fce3c 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(); } /** * @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) + public function write($module, string $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -74,21 +72,19 @@ public function write($module, $filename) /** * @public function getUserViewTag - * @param null * @return string */ public function getUserViewTag() { - $ret = $this->getInclude(); - $ret .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'modules/tag/view.tag'); + $ret = $this->getRequire(); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'modules/tag/view.tag'); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -98,7 +94,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/UserVisit.php b/class/Files/User/UserVisit.php deleted file mode 100644 index 14da010b..00000000 --- a/class/Files/User/UserVisit.php +++ /dev/null @@ -1,191 +0,0 @@ -xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $this->uxc = UserXoopsCode::getInstance(); - } - - /** - * @static function getInstance - * @param null - * @return UserVisit - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /** - * @public function write - * @param string $module - * @param mixed $table - * @param string $filename - */ - public function write($module, $table, $filename) - { - $this->setModule($module); - $this->setTable($table); - $this->setFileName($filename); - } - - /** - * @private function getUserVisitHeader - * - * @param $table - * - * @param $fields - * @return string - */ - private function getUserVisitHeader($table, $fields) - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $module = $this->getModule(); - $moduleDirname = $module->getVar('mod_dirname'); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - if (0 == $f) { - $fieldId = $fieldName; - } - if (1 == $fields[$f]->getVar('field_parent')) { - $fieldPid = $fieldName; - } - } - if (1 == $table->getVar('table_category')) { - $ccFieldPid = $this->getCamelCase($fieldPid, false, true); - $ret .= $this->xc->getXcXoopsRequest($ccFieldPid, (string)$fieldPid, '0', 'Int'); - } - $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret .= $this->xc->getXcXoopsRequest($ccFieldId, (string)$fieldId, '0', 'Int'); - - return $ret; - } - - /** - * @private function getUserVisitCheckPermissions - * - * @param null - * - * @return string - */ - private function getUserVisitCheckPermissions() - { - $ret = ''; - - return $ret; - } - - /** - * @private function getUserVisitCheckLimit - * - * @param null - * - * @return string - */ - private function getUserVisitCheckLimit() - { - $ret = ''; - - return $ret; - } - - /** - * @private function getUserVisitCheckHost - * - * @param null - * - * @return string - */ - private function getUserVisitCheckHost() - { - $ret = ''; - - 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'); - $tableId = $table->getVar('table_id'); - $tableMid = $table->getVar('table_mid'); - $fields = $this->getTableFields($tableMid, $tableId); - $content = $this->getHeaderFilesComments($module); - $content .= $this->getUserVisitHeader($table, $fields); - $content .= $this->getUserVisitCheckPermissions(); - $content .= $this->getUserVisitCheckLimit(); - $content .= $this->getUserVisitCheckHost(); - - $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); - - return $this->renderFile(); - } -} diff --git a/class/Files/User/UserXoopsCode.php b/class/Files/User/UserXoopsCode.php index 9627df29..00cfa5df 100644 --- a/class/Files/User/UserXoopsCode.php +++ b/class/Files/User/UserXoopsCode.php @@ -1,8 +1,8 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + } + /* * @static function getInstance * @param null @@ -56,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"; } @@ -71,13 +89,12 @@ 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 = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $stripTags = $pc->getPhpCodeStripTags('', $language . $stuTableName, true); + $stuTableName = \mb_strtoupper($tableName); + $stripTags = $this->pc->getPhpCodeStripTags('', $language . $stuTableName, true); - return "{$t}\$GLOBALS['xoTheme']->addMeta( 'meta', '{$type}', {$stripTags});\n"; + return "{$t}\$GLOBALS['xoTheme']->addMeta('meta', '{$type}', {$stripTags});\n"; } /** @@ -89,24 +106,21 @@ public function getUserAddMeta($type, $language, $tableName, $t = '') */ public function getUserMetaKeywords($moduleDirname) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $implode = $pc->getPhpCodeImplode(',', '$keywords'); + $implode = $this->pc->getPhpCodeImplode(',', '$keywords'); - return "{$moduleDirname}MetaKeywords(\$helper->getConfig('keywords').', '. {$implode});\n"; + return "{$moduleDirname}MetaKeywords(\$helper->getConfig('keywords') . ', ' . {$implode});\n"; } /** * @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({$language}{$file}_DESC);\n"; + return $moduleDirname. 'MetaDescription((string)$helper->' . "getConfig('metadescription'));\n"; } /** @@ -114,35 +128,30 @@ public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') * * @param $language * @param string $tableName + * @param string $op + * @param string $link * @param string $t * * @return string */ - public function getUserBreadcrumbs($language, $tableName = 'index', $t = '') + public function getUserBreadcrumbs($language, string $tableName = 'index', string $op = '', string $link = '', string $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $title = ["'title'" => "{$language}{$stuTableName}"]; - - return $pc->getPhpCodeArray('xoBreadcrumbs[]', $title, false, $t); - } - - /** - * @public function getUserBreadcrumbs - * - * @param $moduleDirname - * - * @param $language - * @return string - */ - public function getUserBreadcrumbsHeaderFile($moduleDirname, $language) - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); - $ret .= $pc->getPhpCodeArray('xoBreadcrumbs', null, false, ''); - $titleLink = ["'title'" => $language . 'TITLE', "'link'" => "{$stuModuleDirname}_URL . '/'"]; - $ret .= $pc->getPhpCodeArray('xoBreadcrumbs[]', $titleLink, false, ''); + $stuTableName = \mb_strtoupper($tableName); + $stuOp = ''; + $ret = $this->pc->getPhpCodeCommentLine('Breadcrumbs', '', $t); + if ('' !== $op) { + $stuOp = ''; + if ('' !== $tableName) { + $stuOp .= '_'; + } + $stuOp .= \mb_strtoupper($op); + } + if ('' === $link) { + $arrBCrumb = ["'title'" => "{$language}{$stuTableName}{$stuOp}"]; + } else { + $arrBCrumb = ["'title'" => "{$language}{$stuTableName}{$stuOp}", "'link'" => "'{$link}'"]; + } + $ret .= $this->pc->getPhpCodeArray('xoBreadcrumbs[]', $arrBCrumb, false, $t); return $ret; } @@ -154,40 +163,36 @@ public function getUserBreadcrumbsHeaderFile($moduleDirname, $language) */ public function getUserBreadcrumbsFooterFile() { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $cond = $xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs'); - $ret = $pc->getPhpCodeConditions('count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); - - return $ret; + $cond = $this->xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs'); + return $this->pc->getPhpCodeConditions('\count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); } /** * @public function getUserModVersionArray * - * @param int $eleArray - * @param $descriptions - * @param null $name - * @param null $index - * @param bool $num + * @param int $eleArray + * @param string|array $descriptions + * @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'; + $ret = $t . '$modversion'; $isArray = false; - $n = ''; - if (!is_array($descriptions)) { + $n = ''; + if (!\is_array($descriptions)) { $descs = [$descriptions]; } else { - $descs = $descriptions; + $descs = $descriptions; $isArray = true; - $n = "\n"; + $n = "\n"; } if (0 === $eleArray) { - $ret .= " = "; + $ret .= ' = '; } elseif (1 === $eleArray || 11 === $eleArray) { $ret .= "['{$name}'] = "; } elseif (2 === $eleArray) { @@ -196,35 +201,35 @@ 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}"; } - } elseif (12 === $eleArray) { $ret .= $t . "\t{$desc}{$n}"; } } $ret .= $t; if ($isArray) { - $ret .= "]"; + $ret .= ']'; } $ret .= ";\n"; + return $ret; } @@ -232,20 +237,20 @@ public function getUserModVersionArray($eleArray, $descriptions, $name = null, $ * @public function getUserModVersionText * * @param int $eleArray - * @param $text - * @param null $name - * @param null $index - * @param bool $num + * @param $text + * @param null $name + * @param null $index + * @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'; if (0 === $eleArray) { - $ret .= " = "; + $ret .= ' = '; } elseif (1 === $eleArray) { $ret .= "['{$name}'] = "; } elseif (2 === $eleArray) { @@ -255,6 +260,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 6afb2ffa..f590aa7d 100644 --- a/class/Files/User/UserXoopsVersion.php +++ b/class/Files/User/UserXoopsVersion.php @@ -1,9 +1,9 @@ -xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); + $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); + $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); } /** * @static function getInstance - * @param null * @return UserXoopsVersion */ public static function getInstance() @@ -67,13 +80,13 @@ public static function getInstance() * @param mixed $tables * @param $filename */ - public function write($module, $table, $tables, $filename) + public function write($module, $table, $tables, $filename): void { $this->setModule($module); $this->setTable($table); $this->setTables($tables); $this->setFileName($filename); - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); $this->setKeywords($tableName); } @@ -83,9 +96,9 @@ 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)) { + if (\is_array($keywords)) { $this->kw = $keywords; } else { $this->kw[] = $keywords; @@ -94,7 +107,6 @@ public function setKeywords($keywords) /** * @public function getKeywords - * @param null * @return array */ public function getKeywords() @@ -111,20 +123,22 @@ public function getKeywords() */ private function getXoopsVersionHeader($module, $language) { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); $date = date('Y/m/d'); $ret = $this->getSimpleString(''); - $ret .= Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine(); - $ret .= $xc->getXcEqualsOperator('$moduleDirName ', 'basename(__DIR__)'); - $ret .= $xc->getXcEqualsOperator('$moduleDirNameUpper', 'mb_strtoupper($moduleDirName)'); + $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; + + $ha = (1 == $module->getVar('mod_admin')) ? '1' : '0'; + $hm = (1 == $module->getVar('mod_user')) ? '1' : '0'; $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')}'", @@ -132,19 +146,19 @@ 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')}'", + 'release_file' => "\XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_release_file')}'", 'release_date' => "'{$date}'", 'manual' => "'{$module->getVar('mod_manual')}'", - 'manual_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_manual_file')}'", + 'manual_file' => "\XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_manual_file')}'", 'min_php' => "'{$module->getVar('mod_min_php')}'", 'min_xoops' => "'{$module->getVar('mod_min_xoops')}'", 'min_admin' => "'{$module->getVar('mod_min_admin')}'", - 'min_db' => "array('mysql' => '{$module->getVar('mod_min_mysql')}', 'mysqli' => '{$module->getVar('mod_min_mysql')}')", + 'min_db' => "['mysql' => '{$module->getVar('mod_min_mysql')}', 'mysqli' => '{$module->getVar('mod_min_mysql')}']", 'image' => "'assets/images/logoModule.png'", - 'dirname' => 'basename(__DIR__)', + 'dirname' => '\basename(__DIR__)', 'dirmoduleadmin' => "'Frameworks/moduleclasses/moduleadmin'", 'sysicons16' => "'../../Frameworks/moduleclasses/icons/16'", 'sysicons32' => "'../../Frameworks/moduleclasses/icons/32'", @@ -168,7 +182,7 @@ private function getXoopsVersionHeader($module, $language) 'onUpdate' => "'include/update.php'", ]; - $ret .= $uxc->getUserModVersionArray(0, $descriptions); + $ret .= $this->uxc->getUserModVersionArray(0, $descriptions); return $ret; } @@ -182,22 +196,29 @@ private function getXoopsVersionHeader($module, $language) */ private function getXoopsVersionMySQL($moduleDirname, $table, $tables) { - $uxc = UserXoopsCode::getInstance(); $tableName = $table->getVar('table_name'); $n = 1; $ret = ''; $items = []; + $tableRate = 0; if (!empty($tableName)) { $ret .= $this->getDashComment('Mysql'); $description = "'sql/mysql.sql'"; - $ret .= $uxc->getUserModVersionText(2, $description, 'sqlfile', "'mysql'"); - $ret .= Tdmcreate\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Tables'); + $ret .= $this->uxc->getUserModVersionText(2, $description, 'sqlfile', "'mysql'"); + $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Tables'); - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $items[] = "'{$moduleDirname}_{$tables[$t]->getVar('table_name')}'"; + if (1 === (int)$tables[$t]->getVar('table_rate')) { + $tableRate = 1; + } + ++$n; + } + if (1 === $tableRate) { + $items[] = "'{$moduleDirname}_ratings'"; ++$n; } - $ret .= $uxc->getUserModVersionArray(11, $items, 'tables', $n); + $ret .= $this->uxc->getUserModVersionArray(11, $items, 'tables', $n); unset($n); } @@ -212,11 +233,10 @@ private function getXoopsVersionMySQL($moduleDirname, $table, $tables) */ private function getXoopsVersionSearch($moduleDirname) { - $uxc = UserXoopsCode::getInstance(); $ret = $this->getDashComment('Search'); - $ret .= $uxc->getUserModVersionText(1, 1, 'hasSearch'); + $ret .= $this->uxc->getUserModVersionText(1, 1, 'hasSearch'); $items = ['file' => "'include/search.inc.php'", 'func' => "'{$moduleDirname}_search'"]; - $ret .= $uxc->getUserModVersionArray(1, $items, 'search'); + $ret .= $this->uxc->getUserModVersionArray(1, $items, 'search'); return $ret; } @@ -225,18 +245,33 @@ private function getXoopsVersionSearch($moduleDirname) * @private function getXoopsVersionComments * @param $moduleDirname * + * @param $tables * @return string */ - private function getXoopsVersionComments($moduleDirname) + private function getXoopsVersionComments($moduleDirname, $tables) { - $uxc = UserXoopsCode::getInstance(); + $tableName = ''; + $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')); + foreach (\array_keys($fields) as $f) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $fieldId = $fieldName; + } + } + } + } $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 .= $uxc->getUserModVersionText(2, "'include/comment_functions.php'", 'comments', "'callbackFile'"); + $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'); + $ret .= $this->uxc->getUserModVersionText(2, "'include/comment_functions.php'", 'comments', "'callbackFile'"); $descriptions = ['approve' => "'{$moduleDirname}CommentsApprove'", 'update' => "'{$moduleDirname}CommentsUpdate'"]; - $ret .= $uxc->getUserModVersionArray(2, $descriptions, 'comments', "'callback'"); + $ret .= $this->uxc->getUserModVersionArray(2, $descriptions, 'comments', "'callback'"); return $ret; } @@ -252,94 +287,106 @@ private function getXoopsVersionComments($moduleDirname) */ private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $admin, $user) { - $uxc = UserXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); $ret = $this->getDashComment('Templates'); $item = []; if ($admin) { - $item[] = $pc->getPhpCodeCommentLine('Admin templates'); + $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 = []; - foreach (array_keys($tables) as $t) { + $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, $tablePermissions)) { + if (\in_array(1, $tableBroken)) { + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'broken', '', true); + } + if (\in_array(1, $tablePermissions)) { $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'permissions', '', true); } + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'clone', '', true); $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', '', true); } if ($user) { - $item[] = $pc->getPhpCodeCommentLine('User templates'); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', ''); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', ''); - $tableBroken = []; + $item[] = $this->pc->getPhpCodeCommentLine('User templates'); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header'); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index'); + //$tableBroken = []; $tablePdf = []; $tablePrint = []; $tableRate = []; $tableRss = []; $tableSearch = []; $tableSingle = []; - $tableSubmit = []; - foreach (array_keys($tables) as $t) { - $tableName = $tables[$t]->getVar('table_name'); - $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'); - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, ''); - $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', ''); + //$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'); + $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'); + $tableRate[] = $tables[$t]->getVar('table_rate'); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'list'); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'item'); + } } - if (in_array(1, $tablePrint)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'print', ''); + $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'); + } + } } - if (in_array(1, $tableRate)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'rate', ''); + if (\in_array(1, $tablePrint)) { + foreach (\array_keys($tables) as $t) { + if ($tables[$t]->getVar('table_print')) { + $tableName = $tables[$t]->getVar('table_name'); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName . '_print'); + } + } } - if (in_array(1, $tableRss)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'rss', ''); + if (\in_array(1, $tableRate)) { + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'rate'); } - if (in_array(1, $tableSearch)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'search', ''); + if (\in_array(1, $tableRss)) { + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'rss'); } - if (in_array(1, $tableSingle)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'single', ''); + if (\in_array(1, $tableSearch)) { + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'search'); } - if (in_array(1, $tableSubmit)) { - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'submit', ''); + if (\in_array(1, $tableSingle)) { + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'single'); } - $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', ''); + $item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer'); } - $ret .= $uxc->getUserModVersionArray(11, $item, "templates"); + $ret .= $this->uxc->getUserModVersionArray(11, $item, 'templates'); return $ret; } /** * @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' => ''"; @@ -365,62 +412,59 @@ private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '' */ private function getXoopsVersionSubmenu($language, $tables) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $ret = $this->getDashComment('Menu'); - $xModule = $pc->getPhpCodeGlobals('xoopsModule'); - $cond = 'isset(' . $xModule . ') && is_object(' . $xModule . ')'; - $one = $pc->getPhpCodeGlobals('xoopsModule') . "->getVar('dirname')"; - $ret .= $pc->getPhpCodeTernaryOperator('currdirname ', $cond, $one, "'system'"); + $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); + $cond = 'isset(' . $xModule . ') && \is_object(' . $xModule . ')'; + $one = $this->pc->getPhpCodeGlobals('xoopsModule') . "->getVar('dirname')"; + $ret .= $this->pc->getPhpCodeTernaryOperator('currdirname ', $cond, $one, "'system'"); $i = 1; $descriptions = [ 'name' => "{$language}SMNAME{$i}", 'url' => "'index.php'", ]; - $contentIf = $uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + $contentIf = $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + ++$i; - $tableSubmit = []; - $tableSearch = []; - foreach (array_keys($tables) as $t) { + //$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'); + //$tableSearch[] = $tables[$t]->getVar('table_search'); if (1 == $tables[$t]->getVar('table_submenu')) { - $contentIf .= $pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); + $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); $descriptions = [ 'name' => "{$language}SMNAME{$i}", 'url' => "'{$tableName}.php'", ]; - $contentIf .= $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"); + $descriptions = [ + 'name' => "{$language}SMNAME{$i}", + 'url' => "'{$tableName}.php?op=new'", + ]; + $contentIf .= $this->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)) { + if (\in_array(1, $tableSearch)) { $contentIf .= $cpc->getPhpCodeCommentLine('Sub', 'Search', "\t"); $descriptions = [ 'name' => "{$language}SMNAME{$i}", 'url' => "'search.php'", ]; - $contentIf .= $uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); + $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); } */ unset($i); - $ret .= $pc->getPhpCodeConditions('$moduleDirName', ' == ', '$currdirname', $contentIf); + $ret .= $this->pc->getPhpCodeConditions('$moduleDirName', ' == ', '$currdirname', $contentIf); return $ret; } @@ -434,12 +478,10 @@ private function getXoopsVersionSubmenu($language, $tables) */ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) { - $ret = $this->getDashComment('Blocks'); - $tableCategory = []; - foreach (array_keys($tables) as $i) { + $ret = $this->getDashComment('Default Blocks'); + foreach (\array_keys($tables) as $i) { $tableName = $tables[$i]->getVar('table_name'); - $tableCategory[] = $tables[$i]->getVar('table_category'); - if (0 == $tables[$i]->getVar('table_category')) { + 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'); $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'HITS', $language, 'hits'); @@ -447,6 +489,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); + } + } return $ret; } @@ -462,11 +511,9 @@ private function getXoopsVersionBlocks($moduleDirname, $tables, $language) */ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $ucfTableName = ucfirst($tableName); - $ret = $pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); $blocks = [ 'file' => "'{$tableName}.php'", 'name' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}", @@ -476,7 +523,33 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable 'template' => "'{$moduleDirname}_block_{$tableName}.tpl'", 'options' => "'{$type}|5|25|0'", ]; - $ret .= $uxc->getUserModVersionArray(2, $blocks, 'blocks'); + $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); + + return $ret; + } + + /** + * @private function getXoopsVersionTypeBlocks + * @param $moduleDirname + * @param $tableName + * @param $language + * @return string + */ + private function getXoopsVersionSpotlightBlocks($moduleDirname, $tableName, $language) + { + $stuTableName = \mb_strtoupper($tableName); + $ucfTableName = \ucfirst($tableName); + $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' spotlight'); + $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' => "'spotlight|5|25|0'", + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); return $ret; } @@ -491,42 +564,25 @@ private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTable */ private function getXoopsVersionConfig($module, $tables, $language) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $ret = $this->getDashComment('Config'); + $table_editors = 0; $table_permissions = 0; $table_admin = 0; $table_user = 0; $table_tag = 0; $table_uploadimage = 0; $table_uploadfile = 0; + $table_rate = 0; foreach ($tables as $table) { $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - foreach (array_keys($fields) as $f) { + foreach (\array_keys($fields) as $f) { $fieldElement = (int)$fields[$f]->getVar('field_element'); switch ($fieldElement) { case 3: case 4: - $fieldName = $fields[$f]->getVar('field_name'); - $rpFieldName = $this->getRightString($fieldName); - $ucfFieldName = ucfirst($rpFieldName); - $stuFieldName = mb_strtoupper($rpFieldName); - $ret .= $pc->getPhpCodeCommentLine('Editor', $rpFieldName); - $ret .= $xc->getXcXoopsLoad('xoopseditorhandler'); - $ret .= $xc->getXcEqualsOperator('$editorHandler' . $ucfFieldName, 'XoopsEditorHandler::getInstance()'); - $editor = [ - 'name' => "'editor_{$rpFieldName}'", - 'title' => "'{$language}EDITOR_{$stuFieldName}'", - 'description' => "'{$language}EDITOR_{$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: @@ -554,16 +610,81 @@ private function getXoopsVersionConfig($module, $tables, $language) if (1 == $table->getVar('table_tag')) { $table_tag = 1; } + if (1 == $table->getVar('table_rate')) { + $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'); + $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); + $editor = [ + 'name' => "'editor_admin'", + 'title' => "'{$language}EDITOR_ADMIN'", + 'description' => "'{$language}EDITOR_ADMIN_DESC'", + 'formtype' => "'select'", + 'valuetype' => "'text'", + '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 = [ + 'name' => "'editor_user'", + 'title' => "'{$language}EDITOR_USER'", + 'description' => "'{$language}EDITOR_USER_DESC'", + 'formtype' => "'select'", + 'valuetype' => "'text'", + '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 = [ + 'name' => "'editor_maxchar'", + 'title' => "'{$language}EDITOR_MAXCHAR'", + 'description' => "'{$language}EDITOR_MAXCHAR_DESC'", + 'formtype' => "'textbox'", + 'valuetype' => "'int'", + 'default' => '50', + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); + } if (1 === $table_permissions) { - $ret .= $pc->getPhpCodeCommentLine('Get groups'); - $ret .= $xc->getXcXoopsHandler('member'); - $ret .= $xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); - $ret .= $xc->getXcEqualsOperator('$groups', '[]'); - $group = $xc->getXcEqualsOperator('$groups[$group] ', '$key', null, "\t"); - $ret .= $pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); - $ret .= $pc->getPhpCodeCommentLine('General access 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'", @@ -573,8 +694,8 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '$groups', 'options' => '$groups', ]; - $ret .= $uxc->getUserModVersionArray(2, $groups, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Upload groups'); + $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Upload groups'); $uplgroups = [ 'name' => "'upload_groups'", 'title' => "'{$language}UPLOAD_GROUPS'", @@ -584,17 +705,17 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '$groups', 'options' => '$groups', ]; - $ret .= $uxc->getUserModVersionArray(2, $uplgroups, 'config'); - - $ret .= $pc->getPhpCodeCommentLine('Get Admin groups'); - $ret .= $xc->getXcCriteriaCompo('crGroups'); - $crit = $xc->getXcCriteria('', "'group_type'", "'Admin'", '', true); - $ret .= $xc->getXcCriteriaAdd('crGroups', $crit, '', "\n"); - $ret .= $xc->getXcXoopsHandler('member'); - $ret .= $xc->getXcEqualsOperator('$adminXoopsGroups ', '$memberHandler->getGroupList($crGroups)'); - $ret .= $xc->getXcEqualsOperator('$adminGroups', '[]'); - $adminGroup = $xc->getXcEqualsOperator('$adminGroups[$adminGroup] ', '$key', null, "\t"); - $ret .= $pc->getPhpCodeForeach('adminXoopsGroups', false, 'key', 'adminGroup', $adminGroup); + $ret .= $this->uxc->getUserModVersionArray(2, $uplgroups, 'config'); + + $ret .= $this->pc->getPhpCodeCommentLine('Get Admin groups'); + $ret .= $this->xc->getXcCriteriaCompo('crGroups'); + $crit = $this->xc->getXcCriteria('', "'group_type'", "'Admin'", '', true); + $ret .= $this->xc->getXcCriteriaAdd('crGroups', $crit); + $ret .= $this->xc->getXcXoopsHandler('member'); + $ret .= $this->xc->getXcEqualsOperator('$adminXoopsGroups ', '$memberHandler->getGroupList($crGroups)'); + $ret .= $this->xc->getXcEqualsOperator('$adminGroups', '[]'); + $adminGroup = $this->xc->getXcEqualsOperator('$adminGroups[$adminGroup] ', '$key', null, "\t"); + $ret .= $this->pc->getPhpCodeForeach('adminXoopsGroups', false, 'key', 'adminGroup', $adminGroup); $adminGroups = [ 'name' => "'admin_groups'", 'title' => "'{$language}ADMIN_GROUPS'", @@ -604,27 +725,47 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '$adminGroups', 'options' => '$adminGroups', ]; - $ret .= $uxc->getUserModVersionArray(2, $adminGroups, 'config'); - $ret .= $pc->getPhpCodeUnset('crGroups'); + $ret .= $this->uxc->getUserModVersionArray(2, $adminGroups, 'config'); + $ret .= $this->pc->getPhpCodeUnset('crGroups'); + } + + if (1 === $table_rate) { + $ret .= $this->pc->getPhpCodeCommentLine('Get groups'); + $ret .= $this->xc->getXcXoopsHandler('member'); + $ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); + $ret .= $this->xc->getXcEqualsOperator('$ratingbar_groups', '[]'); + $group = $this->xc->getXcEqualsOperator('$ratingbar_groups[$group] ', '$key', null, "\t"); + $ret .= $this->pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); + $ret .= $this->pc->getPhpCodeCommentLine('Rating: Groups with rating permissions'); + $groups = [ + 'name' => "'ratingbar_groups'", + 'title' => "'{$language}RATINGBAR_GROUPS'", + 'description' => "'{$language}RATINGBAR_GROUPS_DESC'", + 'formtype' => "'select_multi'", + 'valuetype' => "'array'", + 'default' => '[1]', + 'options' => '$ratingbar_groups', + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); + + $ret .= $this->pc->getPhpCodeCommentLine('Rating : used ratingbar'); + $mimetypes_image = [ + 'name' => "'ratingbars'", + 'title' => "'{$language}RATINGBARS'", + 'description' => "'{$language}RATINGBARS_DESC'", + 'formtype' => "'select'", + 'valuetype' => "'int'", + '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'); } - $keyword = implode(', ', $this->getKeywords()); - $ret .= $pc->getPhpCodeCommentLine('Keywords'); - $arrayKeyword = [ - 'name' => "'keywords'", - 'title' => "'{$language}KEYWORDS'", - 'description' => "'{$language}KEYWORDS_DESC'", - 'formtype' => "'textbox'", - 'valuetype' => "'text'", - 'default' => "'{$moduleDirname}, {$keyword}'", - ]; - $ret .= $uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); - unset($this->keywords); if (1 === $table_uploadimage || 1 === $table_uploadfile) { $ret .= $this->getXoopsVersionSelectSizeMB($moduleDirname); } if (1 === $table_uploadimage) { - $ret .= $pc->getPhpCodeCommentLine('Uploads : maxsize of image'); + $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of image'); $maxsize_image = [ 'name' => "'maxsize_image'", 'title' => "'{$language}MAXSIZE_IMAGE'", @@ -634,8 +775,8 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '3145728', 'options' => '$optionMaxsize', ]; - $ret .= $uxc->getUserModVersionArray(2, $maxsize_image, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Uploads : mimetypes of 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'", @@ -645,28 +786,28 @@ 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 .= $uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); $maxwidth_image = [ 'name' => "'maxwidth_image'", 'title' => "'{$language}MAXWIDTH_IMAGE'", 'description' => "'{$language}MAXWIDTH_IMAGE_DESC'", 'formtype' => "'textbox'", 'valuetype' => "'int'", - 'default' => '8000', + 'default' => '800', ]; - $ret .= $uxc->getUserModVersionArray(2, $maxwidth_image, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maxwidth_image, 'config'); $maxheight_image = [ 'name' => "'maxheight_image'", 'title' => "'{$language}MAXHEIGHT_IMAGE'", 'description' => "'{$language}MAXHEIGHT_IMAGE_DESC'", 'formtype' => "'textbox'", 'valuetype' => "'int'", - 'default' => '8000', + 'default' => '800', ]; - $ret .= $uxc->getUserModVersionArray(2, $maxheight_image, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maxheight_image, 'config'); } if (1 === $table_uploadfile) { - $ret .= $pc->getPhpCodeCommentLine('Uploads : maxsize of file'); + $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of file'); $maxsize_file = [ 'name' => "'maxsize_file'", 'title' => "'{$language}MAXSIZE_FILE'", @@ -676,8 +817,8 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '3145728', 'options' => '$optionMaxsize', ]; - $ret .= $uxc->getUserModVersionArray(2, $maxsize_file, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Uploads : mimetypes of 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'", @@ -687,10 +828,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 .= $uxc->getUserModVersionArray(2, $mimetypes_file, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_file, 'config'); } if (1 === $table_admin) { - $ret .= $pc->getPhpCodeCommentLine('Admin pager'); + $ret .= $this->pc->getPhpCodeCommentLine('Admin pager'); $adminPager = [ 'name' => "'adminpager'", 'title' => "'{$language}ADMIN_PAGER'", @@ -699,10 +840,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '10', ]; - $ret .= $uxc->getUserModVersionArray(2, $adminPager, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $adminPager, 'config'); } if (1 === $table_user) { - $ret .= $pc->getPhpCodeCommentLine('User pager'); + $ret .= $this->pc->getPhpCodeCommentLine('User pager'); $userPager = [ 'name' => "'userpager'", 'title' => "'{$language}USER_PAGER'", @@ -711,10 +852,10 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '10', ]; - $ret .= $uxc->getUserModVersionArray(2, $userPager, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $userPager, 'config'); } if (1 === $table_tag) { - $ret .= $pc->getPhpCodeCommentLine('Use tag'); + $ret .= $this->pc->getPhpCodeCommentLine('Use tag'); $useTag = [ 'name' => "'usetag'", 'title' => "'{$language}USE_TAG'", @@ -723,9 +864,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '0', ]; - $ret .= $uxc->getUserModVersionArray(2, $useTag, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $useTag, 'config'); } - $ret .= $pc->getPhpCodeCommentLine('Number column'); + $ret .= $this->pc->getPhpCodeCommentLine('Number column'); $numbCol = [ 'name' => "'numb_col'", 'title' => "'{$language}NUMB_COL'", @@ -735,9 +876,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '1', 'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", ]; - $ret .= $uxc->getUserModVersionArray(2, $numbCol, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $numbCol, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Divide by'); + $ret .= $this->pc->getPhpCodeCommentLine('Divide by'); $divideby = [ 'name' => "'divideby'", 'title' => "'{$language}DIVIDEBY'", @@ -747,21 +888,21 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => '1', 'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", ]; - $ret .= $uxc->getUserModVersionArray(2, $divideby, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $divideby, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Table type'); + $ret .= $this->pc->getPhpCodeCommentLine('Table type'); $tableType = [ 'name' => "'table_type'", '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']", ]; - $ret .= $uxc->getUserModVersionArray(2, $tableType, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $tableType, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Panel by'); + $ret .= $this->pc->getPhpCodeCommentLine('Panel by'); $panelType = [ 'name' => "'panel_type'", 'title' => "'{$language}PANEL_TYPE'", @@ -771,9 +912,28 @@ private function getXoopsVersionConfig($module, $tables, $language) 'default' => "'default'", 'options' => "['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger']", ]; - $ret .= $uxc->getUserModVersionArray(2, $panelType, 'config'); - - $ret .= $pc->getPhpCodeCommentLine('Advertise'); + $ret .= $this->uxc->getUserModVersionArray(2, $panelType, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Paypal ID'); + $paypal = [ + 'name' => "'donations'", + 'title' => "'{$language}IDPAYPAL'", + 'description' => "'{$language}IDPAYPAL_DESC'", + 'formtype' => "'textbox'", + 'valuetype' => "'text'", + 'default' => "'XYZ123'", + ]; + $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'", + 'formtype' => "'yesno'", + 'valuetype' => "'int'", + 'default' => '1', + ]; + $ret .= $this->uxc->getUserModVersionArray(2, $breadcrumbs, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Advertise'); $advertise = [ 'name' => "'advertise'", 'title' => "'{$language}ADVERTISE'", @@ -782,9 +942,8 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'text'", 'default' => "''", ]; - $ret .= $uxc->getUserModVersionArray(2, $advertise, 'config'); - - $ret .= $pc->getPhpCodeCommentLine('Bookmarks'); + $ret .= $this->uxc->getUserModVersionArray(2, $advertise, 'config'); + $ret .= $this->pc->getPhpCodeCommentLine('Bookmarks'); $bookmarks = [ 'name' => "'bookmarks'", 'title' => "'{$language}BOOKMARKS'", @@ -793,12 +952,12 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '0', ]; - $ret .= $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 - * tdmcreate currently is also not creatings tpl files for this - $ret .= $pc->getPhpCodeCommentLine('Facebook Comments'); + * modulebuilder currently is also not creatings tpl files for this + $ret .= $this->pc->getPhpCodeCommentLine('Facebook Comments'); $facebookComments = [ 'name' => "'facebook_comments'", 'title' => "'{$language}FACEBOOK_COMMENTS'", @@ -807,9 +966,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '0', ]; - $ret .= $uxc->getUserModVersion(3, $facebookComments, 'config', '$c'); + $ret .= $this->uxc->getUserModVersion(3, $facebookComments, 'config', '$c'); $ret .= $this->getSimpleString('++$c;'); - $ret .= $pc->getPhpCodeCommentLine('Disqus Comments'); + $ret .= $this->pc->getPhpCodeCommentLine('Disqus Comments'); $disqusComments = [ 'name' => "'disqus_comments'", 'title' => "'{$language}DISQUS_COMMENTS'", @@ -818,11 +977,11 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '0', ]; - $ret .= $uxc->getUserModVersion(3, $disqusComments, 'config', '$c'); + $ret .= $this->uxc->getUserModVersion(3, $disqusComments, 'config', '$c'); $ret .= $this->getSimpleString('++$c;'); */ - $ret .= $pc->getPhpCodeCommentLine('Make Sample button visible?'); + $ret .= $this->pc->getPhpCodeCommentLine('Make Sample button visible?'); $maintainedby = [ 'name' => "'displaySampleButton'", 'title' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON'", @@ -831,9 +990,9 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'int'", 'default' => '1', ]; - $ret .= $uxc->getUserModVersionArray(2, $maintainedby, 'config'); + $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); - $ret .= $pc->getPhpCodeCommentLine('Maintained by'); + $ret .= $this->pc->getPhpCodeCommentLine('Maintained by'); $maintainedby = [ 'name' => "'maintainedby'", 'title' => "'{$language}MAINTAINEDBY'", @@ -842,59 +1001,7 @@ private function getXoopsVersionConfig($module, $tables, $language) 'valuetype' => "'text'", 'default' => "'{$module->getVar('mod_support_url')}'", ]; - $ret .= $uxc->getUserModVersionArray(2, $maintainedby, 'config'); - - return $ret; - } - - /** - * @private function getNotificationsType - * @param $language - * @param $type - * @param $tableName - * @param $notifyFile - * @param $item - * @param $typeOfNotify - * - * @return string - */ - private function getNotificationsType($language, $type, $tableName, $notifyFile, $item, $typeOfNotify) - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $stuTableName = mb_strtoupper($tableName); - $stuTypeOfNotify = mb_strtoupper($typeOfNotify); - $notifyFile = explode(', ', $notifyFile); - $notifyFile = implode(', ', $notifyFile); - $ret = ''; - switch ($type) { - case 'category': - $ret .= $pc->getPhpCodeCommentLine('Category Notify'); - $category = [ - 'name' => "'category'", - 'title' => "'{$language}{$stuTableName}_NOTIFY'", - 'description' => "'{$language}{$stuTableName}_NOTIFY_DESC'", - 'subscribe_from' => "['index.php',{$notifyFile}]", - 'item_name' => "'{$item}'", - "'allow_bookmark'" => '1', - ]; - $ret .= $uxc->getUserModVersionArray(2, $category, 'notification', "'{$type}'"); - break; - case 'event': - $ret .= $pc->getPhpCodeCommentLine('Event Notify'); - $event = [ - 'name' => "'{$typeOfNotify}'", - 'category' => "'{$tableName}'", - 'admin_only' => '1', - "'title'" => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY'", - 'caption' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_CAPTION'", - 'description' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_DESC'", - 'mail_template' => "'{$tableName}_{$typeOfNotify}_notify'", - 'mail_subject' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_SUBJECT'", - ]; - $ret .= $uxc->getUserModVersionArray(2, $event, 'notification', "'{$type}'"); - break; - } + $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); return $ret; } @@ -907,85 +1014,77 @@ private function getNotificationsType($language, $type, $tableName, $notifyFile, */ private function getXoopsVersionNotifications($module, $language) { - $uxc = UserXoopsCode::getInstance(); $moduleDirname = $module->getVar('mod_dirname'); $ret = $this->getDashComment('Notifications'); - $ret .= $uxc->getUserModVersionText(1, 1, 'hasNotification'); + $ret .= $this->uxc->getUserModVersionText(1, 1, 'hasNotification'); $notifications = ['lookup_file' => "'include/notification.inc.php'", 'lookup_func' => "'{$moduleDirname}_notify_iteminfo'"]; - $ret .= $uxc->getUserModVersionArray(1, $notifications, 'notification'); - - $notifyFiles = []; - $single = 'single'; - $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); - $tableCategory = []; - $tableBroken = []; - $tableSubmit = []; - $tableId = null; - $tableMid = null; - $tableSoleName = ''; - foreach (array_keys($tables) as $t) { + $ret .= $this->uxc->getUserModVersionArray(1, $notifications, 'notification'); + + $notifyFiles = []; + $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); + //$tableCategory = []; + $tableBroken = []; + $tableComments = []; + //$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, '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, 'global_broken', 'global', 1, 'global_broken', 'global_broken_notify'); + } + if (\in_array(1, $tableComments)) { + $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'global_comment', 'global', 0, 'global_comment', 'global_comment_notify'); + } + + 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'); - $tableBroken[] = $tables[$t]->getVar('table_broken'); - $tableSubmit[] = $tables[$t]->getVar('table_submit'); - if (1 == $tables[$t]->getVar('table_notifications')) { - //if ($t <= count($tableName)) { - $notifyFiles[] = $tableName; - //} - } - if (1 == $tables[$t]->getVar('table_single')) { - $single = $tableName; - } - } - $fields = $this->getTableFields($tableMid, $tableId); - $fieldId = null; - $fieldParent = null; - foreach (array_keys($fields) as $f) { - $fieldName = $fields[$f]->getVar('field_name'); - $fieldElement = $fields[$f]->getVar('field_element'); - if (0 == $f) { - $fieldId = $fieldName; + //$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) { + $fieldName = $fields[$f]->getVar('field_name'); + if (0 == $f) { + $fieldId = $fieldName; + } } - if ($fieldElement > 16) { - $fieldParent = $fieldName; + if (1 == $tables[$t]->getVar('table_notifications')) { + $notifyFiles[] = $tableName; + $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, $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, $tableSoleName . '_broken', $tableName, 0, $tableSoleName . '_broken', $tableSoleName . '_broken_notify'); + } + /*event will be added by xoops + if (1 == $tables[$t]->getVar('table_comments')) { + $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_comment', $tableName, 0, $tableSoleName . '_comment', $tableSoleName . '_comment_notify'); + }*/ } } + $ret .= $this->pc->getPhpCodeCommentLine('Categories of notification'); + $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', $notifyFiles); - $num = 1; - $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', 'global', $notifyFiles, $num); - ++$num; - $ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1', $num); - ++$num; - $ret .= $this->getXoopsVersionNotificationTableName($language, 'category', $tableSoleName, $tableSoleName, $single, $fieldId, 1, $num); - unset($num); - $num = 1; - if (in_array(1, $tableCategory)) { - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_category', 'global', 0, 'global_new_category', 'global_newcategory_notify', $num); - ++$num; - } - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'modify', 'global', 1, 'global_modify', 'global_' . 'modify_notify', $num); - if (in_array(1, $tableBroken)) { - ++$num; - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'broken', 'global', 1, 'global_broken', 'global_' . 'broken_notify', $num); - } - if (in_array(1, $tableSubmit)) { - ++$num; - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'submit', 'global', 1, 'global_submit', 'global_' . 'submit_notify', $num); - } - ++$num; - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_' . $tableSoleName, 'global', 0, 'global_new', 'global_new' . $tableSoleName . '_notify', $num); - if (in_array(1, $tableCategory)) { - ++$num; - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'submit', 'category', 1, 'category_submit', 'category_' . $tableSoleName . 'submit_notify', $num); - ++$num; - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_category', 'category', 0, 'category', 'category_new' . $tableSoleName . '_notify', $num); - } - ++$num; - $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'approve', $tableSoleName, 1, $tableSoleName, $tableSoleName . '_approve_notify', $num); - unset($num); + //$ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1'); + + $ret .= $notifyCategory . $notifyEventGlobal . $notifyEventTable; return $ret; } @@ -994,59 +1093,23 @@ private function getXoopsVersionNotifications($module, $language) * @private function getXoopsVersionNotificationGlobal * @param $language * @param $type - * @param $name * @param $title * @param $from * - * @param $num * @return string */ - private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from, $num) + private function getXoopsVersionNotificationGlobal($language, $type, $title, $from) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $title = mb_strtoupper($title); - $implodeFrom = implode(".php', '", $from); - $ret = $pc->getPhpCodeCommentLine('Global Notify'); + $title = \mb_strtoupper($title); + $implodeFrom = \implode(".php', '", $from); + $ret = $this->pc->getPhpCodeCommentLine('Global Notify'); $global = [ - 'name' => "'{$name}'", - 'title' => "{$language}{$title}_NOTIFY", - 'description' => "{$language}{$title}_NOTIFY_DESC", + 'name' => "'global'", + 'title' => "{$language}NOTIFY_{$title}", + 'description' => "''", 'subscribe_from' => "['index.php', '{$implodeFrom}.php']", ]; - $ret .= $uxc->getUserModVersionArray(3, $global, 'notification', "'{$type}'", $num); - - return $ret; - } - - /** - * @private function getXoopsVersionNotificationCategory - * @param $language - * @param $type - * @param $name - * @param $title - * @param $file - * @param $item - * @param $allow - * @param $num - * @return string - */ - private function getXoopsVersionNotificationCategory($language, $type, $name, $title, $file, $item, $allow, $num) - { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $title = mb_strtoupper($title); - $impFile = implode(".php', '", $file); - $ret = $pc->getPhpCodeCommentLine('Category Notify'); - $global = [ - 'name' => "'{$name}'", - 'title' => "{$language}{$title}_NOTIFY", - 'description' => "{$language}{$title}_NOTIFY_DESC", - 'subscribe_from' => "['{$impFile}.php']", - 'item_name' => "'{$item}'", - 'allow_bookmark' => (string)$allow, - ]; - $ret .= $uxc->getUserModVersionArray(3, $global, 'notification', "'{$type}'", $num); + $ret .= $this->uxc->getUserModVersionArray(3, $global, 'notification', "'{$type}'"); return $ret; } @@ -1054,32 +1117,28 @@ private function getXoopsVersionNotificationCategory($language, $type, $name, $t /** * @private function getXoopsVersionNotificationTableName * @param $language - * @param $type * @param $name * @param $title * @param $file * @param $item - * @param $allow * - * @param $num * @return string */ - private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $file, $item, $allow, $num) + private function getXoopsVersionNotificationTableName($language, $name, $title, $file, $item) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $stuTitle = mb_strtoupper($title); - $ucfTitle = ucfirst($title); - $ret = $pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); + $allow = 1; + $stuTitle = \mb_strtoupper($title); + $ucfTitle = \ucfirst($title); + $ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); $table = [ 'name' => "'{$name}'", - 'title' => "{$language}{$stuTitle}_NOTIFY", - 'description' => "{$language}{$stuTitle}_NOTIFY_DESC", + 'title' => "{$language}NOTIFY_{$stuTitle}", + 'description' => "''", 'subscribe_from' => "'{$file}.php'", 'item_name' => "'{$item}'", - 'allow_bookmark' => (string)$allow, + 'allow_bookmark' => (string)(1), ]; - $ret .= $uxc->getUserModVersionArray(3, $table, 'notification', "'{$type}'", $num); + $ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'category'"); return $ret; } @@ -1087,34 +1146,30 @@ private function getXoopsVersionNotificationTableName($language, $type, $name, $ /** * @private function getXoopsVersionNotifications * @param $language - * @param $type * @param $name * @param $category * @param $admin * @param $title * @param $mail * - * @param $num * @return string */ - private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin, $title, $mail, $num) + private function getXoopsVersionNotificationCodeComplete($language, $name, $category, $admin, $title, $mail) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $uxc = UserXoopsCode::getInstance(); - $title = mb_strtoupper($title); - $ucfTitle = ucfirst($title); - $ret = $pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); + $title = \mb_strtoupper($title); + $ucfTitle = \ucfirst($title); + $ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); $event = [ 'name' => "'{$name}'", 'category' => "'{$category}'", 'admin_only' => (string)$admin, - 'title' => "{$language}{$title}_NOTIFY", - 'caption' => "{$language}{$title}_NOTIFY_CAPTION", - 'description' => "{$language}{$title}_NOTIFY_DESC", + 'title' => "{$language}NOTIFY_{$title}", + 'caption' => "{$language}NOTIFY_{$title}_CAPTION", + 'description' => "''", 'mail_template' => "'{$mail}'", - 'mail_subject' => "{$language}{$title}_NOTIFY_SUBJECT", + 'mail_subject' => "{$language}NOTIFY_{$title}_SUBJECT", ]; - $ret .= $uxc->getUserModVersionArray(3, $event, 'notification', "'{$type}'", $num); + $ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'event'"); return $ret; } @@ -1122,51 +1177,47 @@ 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) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ucModuleDirname = mb_strtoupper($moduleDirname); - - $ret = $pc->getPhpCodeCommentLine('create increment steps for file size'); - $ret .= $pc->getPhpCodeIncludeDir("__DIR__ . '/include/xoops_version.inc.php'", '',true,true); - $ret .= $xc->getXcEqualsOperator('$iniPostMaxSize ', "{$moduleDirname}ReturnBytes(ini_get('post_max_size'))"); - $ret .= $xc->getXcEqualsOperator('$iniUploadMaxFileSize', "{$moduleDirname}ReturnBytes(ini_get('upload_max_filesize'))"); - $ret .= $xc->getXcEqualsOperator('$maxSize ', "min(\$iniPostMaxSize, \$iniUploadMaxFileSize)"); - $cond = $xc->getXcEqualsOperator('$increment', '500', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' > ', '10000 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '200', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '100', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '5000 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '50', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '2500 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '10', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '1000 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '5', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '500 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '2', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '100 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '1', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '50 * 1048576', $cond, false, $t); - $cond = $xc->getXcEqualsOperator('$increment', '0.5', null, $t . "\t"); - $ret .= $pc->getPhpCodeConditions('$maxSize', ' <= ', '25 * 1048576', $cond, false, $t); - $ret .= $xc->getXcEqualsOperator('$optionMaxsize', '[]'); - $ret .= $xc->getXcEqualsOperator('$i', '$increment'); - $while = $xc->getXcEqualsOperator("\$optionMaxsize[\$i . ' ' . _MI_{$ucModuleDirname}_SIZE_MB]", '$i * 1048576', null, $t . "\t"); - $while .= $xc->getXcEqualsOperator('$i', '$increment', '+',$t . "\t"); - $ret .= $pc->getPhpCodeWhile('i * 1048576', $while, '$maxSize', ' <= '); + $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"); + $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"); + $while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+', "\t"); + $ret .= $this->pc->getPhpCodeWhile('i * 1048576', $while, '$maxSize', '<='); return $ret; } /** * @public function render - * @param null - * @return bool|string + * @return string */ public function render() { @@ -1179,36 +1230,38 @@ public function render() $content = $this->getHeaderFilesComments($module); $content .= $this->getXoopsVersionHeader($module, $language); $content .= $this->getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $module->getVar('mod_admin'), $module->getVar('mod_user')); - $content .= $this->getXoopsVersionMySQL($moduleDirname, $table, $tables); + if (\count($tables) > 0) { + $content .= $this->getXoopsVersionMySQL($moduleDirname, $table, $tables); + } $tableSearch = []; $tableComments = []; $tableSubmenu = []; $tableBlocks = []; $tableNotifications = []; - foreach (array_keys($tables) as $t) { + foreach (\array_keys($tables) as $t) { $tableSearch[] = $tables[$t]->getVar('table_search'); $tableComments[] = $tables[$t]->getVar('table_comments'); $tableSubmenu[] = $tables[$t]->getVar('table_submenu'); $tableBlocks[] = $tables[$t]->getVar('table_blocks'); $tableNotifications[] = $tables[$t]->getVar('table_notifications'); } - if (in_array(1, $tableSearch)) { + if (\in_array(1, $tableSearch)) { $content .= $this->getXoopsVersionSearch($moduleDirname); } - if (in_array(1, $tableComments)) { - $content .= $this->getXoopsVersionComments($moduleDirname); + if (\in_array(1, $tableComments)) { + $content .= $this->getXoopsVersionComments($moduleDirname, $tables); } - if (in_array(1, $tableSubmenu)) { + if (\in_array(1, $tableSubmenu)) { $content .= $this->getXoopsVersionSubmenu($language, $tables); } - if (in_array(1, $tableBlocks)) { + if (\in_array(1, $tableBlocks)) { $content .= $this->getXoopsVersionBlocks($moduleDirname, $tables, $language); } $content .= $this->getXoopsVersionConfig($module, $tables, $language); - if (in_array(1, $tableNotifications)) { + 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/User/index.php b/class/Files/User/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/User/index.php @@ -0,0 +1,2 @@ +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(); } /** * @static function getInstance - * @param null + * @return AdminAbout */ public static function getInstance() @@ -69,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) { @@ -80,8 +79,8 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { @@ -90,14 +89,15 @@ public function render() $moduleDirname = $module->getVar('mod_dirname'); $moduleDonations = $module->getVar('mod_donations'); $content = $this->getHeaderFilesComments($module); - $content .= $this->getInclude(); + $content .= $this->getSimpleString(''); + $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->getInclude('footer'); + $content .= $this->getRequire('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..cb5f744d 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(); } /** @@ -67,10 +66,10 @@ public static function getInstance() /** * @public function write - * @param string $module - * @param string $filename + * @param $module + * @param $filename */ - public function write($module, $filename) + public function write($module, $filename): void { $this->setModule($module); $this->setFileName($filename); @@ -78,8 +77,8 @@ public function write($module, $filename) /** * @public function render - * @param null - * @return bool|string + + * @return string */ public function render() { @@ -87,13 +86,14 @@ 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"); - $content .= $this->pc->getPhpCodeConditions($isset, '', '', $display, false, '') . PHP_EOL; + $display .= "\t" . $this->xc->getXcXoopsTplDisplay(); + $content .= $this->pc->getPhpCodeConditions($isset, '', '', $display) . 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 afd9857b..2273b5eb 100644 --- a/class/Files/admin/AdminPages.php +++ b/class/Files/admin/AdminPages.php @@ -1,9 +1,11 @@ -xc = Files\CreateXoopsCode::getInstance(); + $this->pc = Files\CreatePhpCode::getInstance(); + $this->axc = Files\Admin\AdminXoopsCode::getInstance(); } /** * @static function getInstance - * @param null + * * @return AdminPages */ @@ -77,33 +94,51 @@ public function write($module, $table, $filename) */ private function getAdminPagesHeader($moduleDirname, $fieldId) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $ccFieldId = $this->getCamelCase($fieldId, false, true); - $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); - $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']); - $ret .= $this->getInclude(); - $ret .= $pc->getPhpCodeCommentLine('It recovered the value of argument op in URL$'); - $ret .= $xc->getXcXoopsRequest('op', 'op', 'list'); - $ret .= $pc->getPhpCodeCommentLine("Request {$fieldId}"); - $ret .= $xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int'); + $ret = $this->pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants'], '', ''); + $ret .= $this->pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']); + $ret .= $this->getRequire(); + $ret .= $this->pc->getPhpCodeCommentLine('Get all request values'); + $leftLen = \strlen($ccFieldId); + $leftOp = 'op'; + $leftField = $ccFieldId; + $leftStart = 'start'; + $leftLimit = 'limit'; + if ($leftLen > 5) { + $leftOp .= \str_repeat(' ', $leftLen - 2); + $leftStart .= \str_repeat(' ', $leftLen - 5); + $leftLimit .= \str_repeat(' ', $leftLen - 5); + } else { + $leftOp .= \str_repeat(' ', 3); + if (\strlen($ccFieldId) < 5) { + $leftField .= \str_repeat(' ', 5 - $leftLen); + } + } + $ret .= $this->xc->getXcXoopsRequest($leftOp, 'op', 'list', 'Cmd'); + $ret .= $this->xc->getXcXoopsRequest($leftField, $fieldId, '', 'Int'); + $ret .= $this->xc->getXcXoopsRequest($leftStart, 'start', '', 'Int'); + $config = $this->xc->getXcGetConfig('adminpager'); + $ret .= $this->xc->getXcXoopsRequest($leftLimit, 'limit', $config, 'Int'); + $ret .= $this->xc->getXcXoopsTplAssign('start', '$start'); + $ret .= $this->xc->getXcXoopsTplAssign('limit', '$limit'); + $ret .= $this->pc->getPhpCodeBlankLine(); return $ret; } /** * @private function getAdminPagesSwitch - * @param $cases + * @param array $cases * * @return string */ - private function getAdminPagesSwitch($cases = []) + private function getAdminPagesSwitch(array $cases = []) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $contentSwitch = $pc->getPhpCodeCaseSwitch($cases, true, false, "\t"); + $contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, "\t"); - return $pc->getPhpCodeSwitch('op', $contentSwitch); + return $this->pc->getPhpCodeSwitch('op', $contentSwitch); } /** @@ -115,46 +150,39 @@ 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 = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); - - $stuModuleDirname = mb_strtoupper($moduleDirname); + $stuModuleDirname = \mb_strtoupper($moduleDirname); $tableName = $table->getVar('table_name'); $tableSoleName = $table->getVar('table_solename'); - $stuTableName = mb_strtoupper($tableName); - $stuTableSoleName = mb_strtoupper($tableSoleName); - - $ret = $pc->getPhpCodeCommentLine('Define Stylesheet', '', $t); - $ret .= $xc->getXcXoThemeAddStylesheet('style', $t); - $ret .= $xc->getXcXoopsRequest('start', 'start', '0', 'Int', false, $t); - $adminpager = $xc->getXcGetConfig('adminpager'); - $ret .= $xc->getXcXoopsRequest('limit', 'limit', $adminpager, 'Int', false, $t); - $ret .= $axc->getAdminTemplateMain($moduleDirname, $tableName, $t); - $navigation = $axc->getAdminDisplayNavigation($tableName); - $ret .= $xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); - - if (in_array(1, $fieldInForm)) { - $ret .= $axc->getAdminItemButton($language, $tableName, $stuTableSoleName, '?op=new', 'add', $t); - $ret .= $xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); + $stuTableName = \mb_strtoupper($tableName); + $stuTableSoleName = \mb_strtoupper($tableSoleName); + + $ret = $this->pc->getPhpCodeCommentLine('Define Stylesheet', '', $t); + $ret .= $this->xc->getXcXoThemeAddStylesheet('style', $t); + $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, $stuTableSoleName, '?op=new', 'add', $t); + $ret .= $this->xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); } - $ret .= $xc->getXcHandlerCountObj($tableName, $t); - $ret .= $xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', $t); - $ret .= $xc->getXcXoopsTplAssign("{$tableName}_count", "\${$tableName}Count", true, $t); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_url", "{$stuModuleDirname}_URL", true, $t); - $ret .= $xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL", true, $t); - - $ret .= $pc->getPhpCodeCommentLine('Table view', $tableName, $t); - $contentForeach = $xc->getXcGetValues($tableName, $tableSoleName, 'i', false, $t . "\t\t"); - $contentForeach .= $xc->getXcXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}", $t . "\t\t"); - $contentForeach .= $pc->getPhpCodeUnset($tableSoleName, $t . "\t\t"); - $condIf = $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach, $t . "\t"); - $condIf .= $xc->getXcPageNav($tableName, $t . "\t"); - $condElse = $xc->getXcXoopsTplAssign('error', "{$language}THEREARENT_{$stuTableName}", true, $t . "\t"); - $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, $condElse, $t); + $ret .= $this->xc->getXcHandlerCountObj($tableName, $t); + $ret .= $this->xc->getXcHandlerAllObj($tableName, '', '$start', '$limit', $t); + $ret .= $this->xc->getXcXoopsTplAssign("{$tableName}_count", "\${$tableName}Count", true, $t); + $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_url", "\\{$stuModuleDirname}_URL", true, $t); + $ret .= $this->xc->getXcXoopsTplAssign("{$moduleDirname}_upload_url", "\\{$stuModuleDirname}_UPLOAD_URL", true, $t); + + $ret .= $this->pc->getPhpCodeCommentLine('Table view', $tableName, $t); + $contentForeach = $this->xc->getXcGetValues($tableName, $tableSoleName, 'i', false, $t . "\t\t"); + $contentForeach .= $this->xc->getXcXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}", $t . "\t\t"); + $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}THEREARENO_{$stuTableName}", true, $t . "\t"); + $ret .= $this->pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, $condElse, $t); return $ret; } @@ -168,25 +196,55 @@ 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 = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); - - $stuTableName = mb_strtoupper($tableName); - $ret = $axc->getAdminTemplateMain($moduleDirname, $tableName, $t); - $navigation = $axc->getAdminDisplayNavigation($tableName); - $ret .= $xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); - - if (in_array(1, $fieldInForm)) { - $ret .= $axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); - $ret .= $xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $t); + $stuTableName = \mb_strtoupper($tableName); + $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->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 .= $this->xc->getXcCommonPagesNew($tableName, $t); + + return $ret; + } + + /** + * @private function getAdminPagesClone + * @param $moduleDirname + * @param $tableName + * @param $tableSoleName + * @param $fieldInForm + * @param $fieldId + * @param $language + * @param string $t + * @return string + */ + private function getAdminPagesClone($moduleDirname, $tableName, $tableSoleName, $fieldInForm, $fieldId, $language, string $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', $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; } @@ -194,20 +252,17 @@ private function getAdminPagesNew($moduleDirname, $tableName, $fieldInForm, $lan /** * @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') { - $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"); + $ret = $this->pc->getPhpCodeCommentLine('Permission to', $perm, "\t\t\t"); + $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}'])", '', '', $foreach, false, "\t\t\t"); return $ret; } @@ -221,105 +276,102 @@ 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 = '') + private function getAdminPagesSave($moduleDirname, $tableName, $tableSoleName, $language, $fields, $fieldId, $fieldMain, $tablePerms, string $t = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); - + $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); $ccFieldId = $this->getCamelCase($fieldId, false, true); - $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); - - $isset = $pc->getPhpCodeIsset($ccFieldId); - $contentIf = $xc->getXcHandlerGet($tableName, $ccFieldId, 'Obj', $tableName . 'Handler', false, $t . "\t"); - $contentElse = $xc->getXcHandlerCreateObj($tableName, "\t\t\t"); - $ret .= $pc->getPhpCodeConditions($isset, '', '', $contentIf, $contentElse, $t); - $ret .= $pc->getPhpCodeCommentLine('Set Vars', null, "\t\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"); + $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; - foreach (array_keys($fields) as $f) { + $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'); - if (1 == $fields[$f]->getVar('field_main')) { - $fieldMain = $fieldName; - } if ($f > 0) { // If we want to hide field id switch ($fieldElement) { - case 5: - case 6: - $ret .= $xc->getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, $t); - break; - case 10: - $ret .= $axc->getAxcSetVarImageList($tableName, $fieldName, $t, $countUploader); - $countUploader++; + case Constants::FIELD_ELE_CHECKBOX: + case Constants::FIELD_ELE_RADIOYN: + $fieldLines .= $this->xc->getXcSetVarCheckBoxOrRadioYN($tableName, $fieldName, $t); break; - case 11: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $t, $countUploader, $fieldMain); + case Constants::FIELD_ELE_IMAGELIST: + $fieldLines .= $this->axc->getAxcSetVarImageList($tableName, $fieldName, $t, $countUploader); $countUploader++; break; - case 12: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, true, $t, $countUploader, $fieldMain); + case Constants::FIELD_ELE_UPLOADFILE: + case Constants::FIELD_ELE_SELECTFILE: + $fieldLines .= $this->axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $t, $countUploader, $fieldMain); $countUploader++; break; - case 13: - $ret .= $axc->getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, $t, $countUploader); + case Constants::FIELD_ELE_URLFILE: + $fieldLines .= $this->axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, true, $t, $countUploader, $fieldMain); $countUploader++; break; - case 14: - $ret .= $axc->getAxcSetVarUploadFile($moduleDirname, $tableName, $fieldName, false, $t, $countUploader, $fieldMain); + case Constants::FIELD_ELE_UPLOADIMAGE: + $fieldLines .= $this->axc->getAxcSetVarUploadImage($moduleDirname, $tableName, $fieldName, $fieldMain, $t, $countUploader); $countUploader++; break; - case 15: - $ret .= $xc->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $t); + case Constants::FIELD_ELE_TEXTDATESELECT: + $fieldLines .= $this->xc->getXcSetVarTextDateSelect($tableName, $tableSoleName, $fieldName, $language, $t); break; - case 17: - $ret .= $axc->getAxcSetVarPassword($tableName, $fieldName, $t); + case Constants::FIELD_ELE_PASSWORD: + $fieldLines .= $this->axc->getAxcSetVarPassword($tableName, $fieldName, $t); break; - case 21: - $ret .= $xc->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t); + case Constants::FIELD_ELE_DATETIME: + $fieldLines .= $this->xc->getXcSetVarDateTime($tableName, $tableSoleName, $fieldName, $t, $language); break; default: - $ret .= $axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t); + $fieldLines .= $this->axc->getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, $t); break; } } } - $ret .= $pc->getPhpCodeCommentLine('Insert Data', null, "\t\t"); - $insert = $xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); - $contentInsert = ''; - //if (1 == $tableCategory) { + if ($countUploader > 0) { + $ret .= $this->xc->getXcEqualsOperator('$uploaderErrors', "''", null, $t); + } + $ret .= $fieldLines; + $ret .= $this->pc->getPhpCodeCommentLine('Insert Data', null, $t); + $insert = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj'); + $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 = $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->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); $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"); - $contentInsert .= $pc->getPhpCodeConditions("''", ' !== ', '$uploaderErrors', $errIf, $errElse, $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 .= $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 .= $pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); - $ret .= $pc->getPhpCodeCommentLine('Get Form', null, "\t\t"); - $ret .= $xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, $t); - $ret .= $xc->getXcGetForm('form', $tableName, 'Obj', $t); - $ret .= $xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); + $ret .= $this->pc->getPhpCodeConditions($insert, '', '', $contentInsert, false, $t); + $ret .= $this->pc->getPhpCodeCommentLine('Get Form', null, $t); + $ret .= $this->xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, $t); + $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', $t); + $ret .= $this->xc->getXcXoopsTplAssign('form', '$form->render()', true, $t); return $ret; } @@ -334,75 +386,74 @@ 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 = '') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); - - $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 = $axc->getAdminTemplateMain($moduleDirname, $tableName, $t); - $navigation = $axc->getAdminDisplayNavigation($tableName); - $ret .= $xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); - - if (in_array(1, $fieldInForm)) { - $ret .= $axc->getAdminItemButton($language, $tableName, $stuTableSoleName, '?op=new', 'add', $t); - $ret .= $axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); - $ret .= $xc->getXcXoopsTplAssign('buttons', '$adminObject->displayButton(\'left\')', true, $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); + + $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, $stuTableSoleName, '?op=new', 'add', $t); + $ret .= $this->axc->getAdminItemButton($language, $tableName, $stuTableName, '', 'list', $t); + $ret .= $this->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 .= $this->xc->getXcCommonPagesEdit($tableName, $ccFieldId, $t, $language); return $ret; } /** * @private function getAdminPagesDelete + * @param $moduleDirname * @param $tableName + * @param $tableSoleName * @param $language * @param $fieldId * @param $fieldMain + * @param $tableNotifications * @param string $t * @return string */ - private function getAdminPagesDelete($tableName, $language, $fieldId, $fieldMain, $t = '') + private function getAdminPagesDelete($moduleDirname, $tableName, $tableSoleName, $language, $fieldId, $fieldMain, $tableNotifications, string $t = '') { - $axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance(); - - return $axc->getAdminCodeCaseDelete($language, $tableName, $fieldId, $fieldMain, $t); + $ret = $this->axc->getAdminTemplateMain($moduleDirname, $tableName, $t); + $navigation = $this->axc->getAdminDisplayNavigation($tableName); + $ret .= $this->xc->getXcXoopsTplAssign('navigation', $navigation, true, $t); + $ret .= $this->xc->getXcCommonPagesDelete($language, $tableName, $tableSoleName, $fieldId, $fieldMain, $tableNotifications, $t, true); + return $ret; } /** * @public function render - * @param null + * - * @return bool|string + * @return string */ public function render() { - $tf = Tdmcreate\Files\CreateFile::getInstance(); - $new = $save = $edit = ''; - - $module = $this->getModule(); - $table = $this->getTable(); - $filename = $this->getFileName(); - $moduleDirname = $module->getVar('mod_dirname'); - $tableName = $table->getVar('table_name'); - $tableSoleName = $table->getVar('table_solename'); - $tablePerms = $table->getVar('table_permissions'); - $language = $this->getLanguage($moduleDirname, 'AM'); - $fields = $tf->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); - $fieldInForm = null; - $fieldId = null; - $fieldMain = null; - foreach (array_keys($fields) as $f) { + $tf = Files\CreateFile::getInstance(); + $new = $clone = $save = $edit = ''; + + $module = $this->getModule(); + $table = $this->getTable(); + $filename = $this->getFileName(); + $moduleDirname = $module->getVar('mod_dirname'); + $tableName = $table->getVar('table_name'); + $tableSoleName = $table->getVar('table_solename'); + $tablePerms = $table->getVar('table_permissions'); + $tableNotifications = $table->getVar('table_notifications'); + $language = $this->getLanguage($moduleDirname, 'AM'); + $fields = $tf->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); + $fieldInForm = null; + $fieldId = null; + $fieldMain = null; + foreach (\array_keys($fields) as $f) { $fieldName = $fields[$f]->getVar('field_name'); $fieldInForm[] = $fields[$f]->getVar('field_inform'); if (0 == $f) { @@ -415,24 +466,26 @@ public function render() $content = $this->getHeaderFilesComments($module); $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"); + if (\in_array(1, $fieldInForm)) { + $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($tableName, $language, $fieldId, $fieldMain, "\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], ]; $content .= $this->getAdminPagesSwitch($cases); - $content .= $this->getInclude('footer'); + $content .= $this->getRequire('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 c270371d..1b94fe7f 100644 --- a/class/Files/admin/AdminXoopsCode.php +++ b/class/Files/admin/AdminXoopsCode.php @@ -1,8 +1,8 @@ -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() @@ -53,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"; } @@ -69,20 +92,20 @@ 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); + $stuType = \mb_strtoupper($type); $aM = $t . '$adminObject->addItemButton('; switch ($type) { - case 'add'; - $ret = $aM . "{$language}ADD_{$stuTableSoleName}, '{$tableName}.php{$op}', '{$type}');\n"; + 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': default: - $ret = $aM . "{$language}{$stuTableSoleName}_{$stuType}, '{$tableName}.php{$op}', '{$type}');\n"; + $ret = $aM . "{$language}{$stuType}_{$stuTableSoleName}, '{$tableName}.php{$op}', '{$type}');\n"; break; } @@ -96,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"; } @@ -109,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')"; } @@ -121,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"; } @@ -134,13 +157,13 @@ 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('; + $aMenu = $t . '$adminObject->addInfoBoxLine(\sprintf('; if ('' != $var) { - $ret = $aMenu . " '', {$var}));\n"; + $ret = $aMenu . " '', {$var}));\n"; } else { - $ret = $aMenu . " ''));\n"; + $ret = $aMenu . " ''));\n"; } return $ret; @@ -155,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) { @@ -175,25 +198,22 @@ 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) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $ret = $pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); - $xRootPath = "XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'"; - $ret .= $xc->getXcMediaUploader('uploader', $xRootPath, 'mimetypes_image', 'maxsize_image', $t); - $post = $pc->getPhpCodeGlobalsVariables('xoops_upload_file', 'POST') . '[' . $countUploader . ']'; + $ret = $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); + $ret .= $this->pc->getPhpCodeIncludeDir('\XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); + $xRootPath = "\XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'"; + $ret .= $this->xc->getXcMediaUploader('uploader', $xRootPath, 'mimetypes_image', 'maxsize_image', $t); + $post = $this->pc->getPhpCodeGlobalsVariables('xoops_upload_file', 'POST') . '[' . $countUploader . ']'; $fetchMedia = $this->getAxcFetchMedia('uploader', $post); $ifelse = $t . "\t//" . $this->getAxcSetPrefix('uploader', "{$fieldName}_") . ";\n"; $ifelse .= $t . "\t//{$fetchMedia};\n"; - $contElseInt = $xc->getXcSetVarObj($tableName, $fieldName, '$uploader->getSavedFileName()', $t . "\t\t"); - $contIf = $xc->getXcEqualsOperator('$errors', '$uploader->getErrors()', null, $t . "\t\t"); - $contIf .= $xc->getXcRedirectHeader('javascript:history.go(-1)', '', '3', '$errors', true, $t . "\t\t"); - $ifelse .= $pc->getPhpCodeConditions('!$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t"); - $contElseExt = $xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); + $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"); + $contElseExt = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - $ret .= $pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); + $ret .= $this->pc->getPhpCodeConditions($fetchMedia, '', '', $ifelse, $contElseExt, $t); return $ret; } @@ -205,54 +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) { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $stuModuleDirname = mb_strtoupper($moduleDirname); - $ucfModuleDirname = ucfirst($moduleDirname); - $ret = $pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); - $file = $pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; - $ret .= $xc->getXcEqualsOperator('$filename ', $file, null, $t); - $mimetype = $pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['type']"; - $ret .= $xc->getXcEqualsOperator('$imgMimetype ', $mimetype, null, $t); - $ret .= $xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t); - $ret .= $xc->getXcEqualsOperator('$uploaderErrors', "''", null, $t); - $xUploadImage = "{$stuModuleDirname}_UPLOAD_IMAGE_PATH"; - $ret .= $xc->getXcMediaUploader('uploader', $xUploadImage . " . '/{$tableName}/'", 'mimetypes_image', 'maxsize_image', $t); - $post = $pc->getPhpCodeGlobalsVariables('xoops_upload_file', 'POST') . '[' . $countUploader . ']'; + $stuModuleDirname = \mb_strtoupper($moduleDirname); + + $ret = $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $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); + $mimetype = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['type']"; + $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"; + $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 = $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"; - $contElseInt = $xc->getXcEqualsOperator('$savedFilename', '$uploader->getSavedFileName()', null, $t . "\t\t"); - $config = $xc->getXcGetConfig('maxwidth_image'); - $contElseInt .= $xc->getXcEqualsOperator('$maxwidth ', "(int){$config}", null, $t . "\t\t"); - $config = $xc->getXcGetConfig('maxheight_image'); - $contElseInt .= $xc->getXcEqualsOperator('$maxheight', "(int){$config}", null, $t . "\t\t"); - $resizer = $pc->getPhpCodeCommentLine('Resize image', '', $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$imgHandler ', "new {$ucfModuleDirname}\Common\Resizer()", null, $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$imgHandler->sourceFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$imgHandler->endFile ', $xUploadImage . " . '/{$tableName}/' . \$savedFilename", null, $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$imgHandler->imageMimetype', '$imgMimetype', null, $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$imgHandler->maxWidth ', '$maxwidth', null, $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$imgHandler->maxHeight ', '$maxheight', null, $t . "\t\t\t"); - $resizer .= $xc->getXcEqualsOperator('$result ', '$imgHandler->resizeImage()', null, $t . "\t\t\t"); - $contElseInt .= $pc->getPhpCodeConditions('$maxwidth > 0 && $maxheight > 0', '', '', $resizer, false, $t . "\t\t"); - $contElseInt .= $xc->getXcSetVarObj($tableName, $fieldName, '$savedFilename', $t . "\t\t"); - $contIf = $xc->getXcEqualsOperator('$uploaderErrors', '$uploader->getErrors()', null, $t . "\t\t"); - $ifelse .= $pc->getPhpCodeConditions('!$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t"); - $ifelseExt = $xc->getXcEqualsOperator('$uploaderErrors', '$uploader->getErrors()', null, $t . "\t\t"); - $contElseExt = $pc->getPhpCodeConditions("\$filename", ' > ', "''", $ifelseExt, false, $t . "\t"); - $contElseExt .= $xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - - $ret .= $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->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\t"); + $config = $this->xc->getXcGetConfig('maxheight_image'); + $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 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; } @@ -262,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; + $stuModuleDirname = \mb_strtoupper($moduleDirname); + return $this->getAxcSetVarImageFile('\\' . $stuModuleDirname . '_UPLOAD_FILES_PATH', $tableName, $fieldName, $formatUrl, $t, $countUploader, $fieldMain, 'mimetypes_file', 'maxsize_file'); } /** @@ -289,38 +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') { - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); $ret = ''; $files = ''; - $contIf = ''; + + $rpFieldName = '$' . $this->cf->getCamelCase($fieldName, false, true); if ($formatUrl) { - $ret .= $xc->getXcSetVarObj($tableName, $fieldName, "formatUrl(\$_REQUEST['{$fieldName}'])", $t); + $ret .= $this->xc->getXcEqualsOperator($rpFieldName, "formatURL((string)(\$_REQUEST['{$fieldName}'] ?? ''))", null, $t); } - $ret .= $pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); - $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/uploader', true, false, '', $t); - $file = $pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; - $ret .= $xc->getXcEqualsOperator('$filename ', $file, null, $t); - $ret .= $xc->getXcEqualsOperator('$imgNameDef ', "Request::getString('{$fieldMain}')", null, $t); - $ret .= $xc->getXcMediaUploader('uploader', $dirname . " . '/{$tableName}{$files}/'", $mimetype, $maxsize, $t); - $post = $pc->getPhpCodeGlobalsVariables('xoops_upload_file', 'POST') . '[' . $countUploader . ']'; + $ret .= $this->pc->getPhpCodeCommentLine('Set Var', $fieldName, $t); + $file = $this->pc->getPhpCodeGlobalsVariables($fieldName, 'FILES') . "['name']"; + $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 = $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"; - $contElseInt = $xc->getXcSetVarObj($tableName, $fieldName, '$uploader->getSavedFileName()', $t . "\t\t"); - $contIf .= $xc->getXcEqualsOperator('$errors', '$uploader->getErrors()', null, $t . "\t\t"); - $ifelse .= $pc->getPhpCodeConditions('!$uploader->upload()', '', '', $contIf, $contElseInt, $t . "\t"); - $ifelseExt = $xc->getXcEqualsOperator('$uploaderErrors', '$uploader->getErrors()', null, $t . "\t\t"); - $contElseExt = $pc->getPhpCodeConditions("\$filename", ' > ', "''", $ifelseExt, false, $t . "\t"); - $contElseExt .= $xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t . "\t"); - - $ret .= $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; } @@ -332,42 +354,39 @@ 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 = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); - $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); - $cf = Tdmcreate\Files\CreateFile::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"); - $ret .= $pc->getPhpCodeConditions("''", ' !== ', "\${$ccFieldId}",$contIf, false, $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 string $t * @return string */ - public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t = '') + public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $fieldElement, string $t = '') { - $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); switch ((int)$fieldType){ case 2: case 3: case 4: case 5: - $ret = $xc->getXcSetVarObj($tableName, $fieldName, "Request::getInt('{$fieldName}', 0)", $t); + $ret = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getInt('{$fieldName}')", $t); break; case 6: case 7: case 8: - $ret = $xc->getXcSetVarObj($tableName, $fieldName, "Request::getFloat('{$fieldName}', 0)", $t); + $ret = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getFloat('{$fieldName}')", $t); break; case 13: case 14: @@ -375,12 +394,16 @@ 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 = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getText('{$fieldName}')", $t); + } else { + $ret = $this->xc->getXcSetVarObj($tableName, $fieldName, "Request::getString('{$fieldName}')", $t); + } break; case 0: default: //TODO: should be finally - $ret = $xc->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']", $t); + $ret = $this->xc->getXcSetVarObj($tableName, $fieldName, "\$_POST['{$fieldName}']", $t); break; } @@ -396,7 +419,7 @@ public function getAxcSetVarMisc($tableName, $fieldName, $fieldType, $t = '') * @param string $t * @return string */ - public function getAxcFetchMedia($anchor, $var, $t = '') + public function getAxcFetchMedia($anchor, $var, string $t = '') { return "{$t}\${$anchor}->fetchMedia({$var})"; } @@ -410,42 +433,8 @@ 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})"; } - - /** - * @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/class/Files/index.php b/class/Files/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Files/index.php @@ -0,0 +1,2 @@ + - * */ class FormRadio extends \XoopsFormRadio { @@ -32,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() : ''; @@ -42,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)) { @@ -50,11 +55,11 @@ public function render() } $ret .= ''; } - $ret .= '' . "' . $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 d1d94574..35dfc1e1 100644 --- a/class/Form/FormRaw.php +++ b/class/Form/FormRaw.php @@ -1,6 +1,6 @@ - * @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.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.6.0 @@ -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 4cf65bb9..53369760 100644 --- a/class/Form/FormTab.php +++ b/class/Form/FormTab.php @@ -1,6 +1,6 @@ - * @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.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.0.0 @@ -26,7 +26,7 @@ \XoopsLoad::load('XoopsFormElementTray'); /** - * Class Tdmcreate\FormTab. + * Class Modulebuilder\FormTab. */ class FormTab extends \XoopsFormElementTray { @@ -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 7745fc98..fae47ebb 100644 --- a/class/Form/FormTabTray.php +++ b/class/Form/FormTabTray.php @@ -1,8 +1,8 @@ - * @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.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * * @link https://xoops.org * @since 2.0.0 @@ -28,7 +28,7 @@ \XoopsLoad::load('XoopsFormElementTray'); /** - * Class Tdmcreate\FormTabTray. + * Class Modulebuilder\FormTabTray. */ class FormTabTray extends \XoopsFormElementTray { @@ -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); @@ -65,13 +65,13 @@ public function render() { $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); - $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . $this->uiTheme . '/ui.all.css'); + $GLOBALS['xoTheme']->addStylesheet(\XOOPS_URL . '/modules/system/css/ui/' . $this->uiTheme . '/ui.all.css'); $GLOBALS['xoTheme']->addScript('', ['type' => 'text/javascript'], '$(function() { $("#tabs_' . $this->getName() . '").tabs(); });'); $ret = '
    ' . NWLINE; $ret .= '
      ' . NWLINE; foreach ($this->getElements() as $ele) { - if ($ele instanceof Tdmcreate\Form\FormTab) { + if ($ele instanceof Modulebuilder\Form\FormTab) { $ret .= '
    • ' . $ele->getCaption() . '
    • ' . NWLINE; } } @@ -81,10 +81,9 @@ public function render() $extras = []; foreach ($this->getElements() as $ele) { - /* @var \XoopsFormElement $ele */ if (!$ele->isHidden()) { - if (!$ele instanceof Tdmcreate\Form\FormRaw) { - if ($ele instanceof Tdmcreate\Form\FormTab) { + if (!$ele instanceof Modulebuilder\Form\FormRaw) { + if ($ele instanceof Modulebuilder\Form\FormTab) { $ret .= '
      ' . NWLINE; $ret .= '' . NWLINE; $ret .= $ele->render(); diff --git a/class/Form/SimpleForm.php b/class/Form/SimpleForm.php index 2b9f7bb7..6f48230a 100644 --- a/class/Form/SimpleForm.php +++ b/class/Form/SimpleForm.php @@ -1,6 +1,6 @@ - - * */ defined('XOOPS_ROOT_PATH') || die('Restricted access'); @@ -52,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; @@ -65,7 +64,7 @@ public function render() } } $ret .= NWLINE . ' ' . $hidden . NWLINE . ''; - $ret .= $this->renderValidationJS(true); + $ret .= $this->renderValidationJS(); return $ret; } diff --git a/class/Form/index.html b/class/Form/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/Form/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/Form/index.php b/class/Form/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Form/index.php @@ -0,0 +1,2 @@ +debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); parent::__construct($moduleDirName); } /** * @param bool $debug * - * @return \XoopsModules\Tdmcreate\Helper + * @return \XoopsModules\Modulebuilder\Helper */ - public static function getInstance($debug = false) + public static function getInstance(bool $debug = false) { static $instance; if (null === $instance) { @@ -70,18 +69,16 @@ public function getDirname() */ public function getHandler($name) { - - $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; - if (!class_exists($class)) { + $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; + if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); $helper = self::getInstance(); $ret = new $class($db, $helper); - $this->addLog("Getting handler '{$name}'"); + $this->addLog("Getting Handler '{$name}'"); return $ret; } } -//require __DIR__ . '/../../mainfile.php'; diff --git a/class/Html/FormLabel.php b/class/Html/FormLabel.php index 65b93eb5..af6ea50a 100644 --- a/class/Html/FormLabel.php +++ b/class/Html/FormLabel.php @@ -1,6 +1,6 @@ -setCaption($caption); } diff --git a/class/Html/index.html b/class/Html/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/Html/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/Html/index.php b/class/Html/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/Html/index.php @@ -0,0 +1,2 @@ +getHandler('Modules'); + $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); + $moduleId = $moduleObject[0]->getVar('mod_id'); + $tables = self::importTables($moduleId, $moduleName); + if (null === $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; + } + + /** + * @param $moduleId + * @param $moduleName + * @return array|null + */ + public static function importTables($moduleId, $moduleName): ?array + { + $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'); + + $tables = null; + + if (false !== $moduleTables && is_array($moduleTables)) { + $currentTableNumber = 0; + $tables = []; + 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(mb_strtolower($t['Type']), array_map('strtolower', $types), true); + } + $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(mb_strtolower($t['Signed']), array_map('strtolower', $attribs), true); + } + $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(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'])) { + // 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'); + } + } 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'); + } + } + + ++$currentFieldNumber; + + $fieldsHandler->insert($fieldsObj); + } + + $tables[] = \_AM_MODULEBUILDER_SUCCESS_IMPTABLES . $table; + + ++$currentTableNumber; + } + } + + return $tables; + } + + /** + * @param string $tableName + * + * @return array + */ + public static function importFields(string $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 (false !== ($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'] = $data['Label'] ?? ''; + + $h = mb_strpos($data['Type'], '('); + $i = mb_strpos($data['Type'], ')'); + if (false === $h) { + $t['Len'] = 0; + } else { + $t['Type'] = mb_substr($data['Type'], 0, $h); + if ('double' === $t['Type'] || 'float' === $t['Type'] || 'real' === $t['Type']) { + $t['Len'] = mb_substr($data['Type'], $h + 1, $i - 1 - $h); + } else { + $t['Len'] = (int)mb_substr($data['Type'], $h + 1, $i - 1 - $h); + } + 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 c74d77c5..64165fa5 100644 --- a/class/Logo.php +++ b/class/Logo.php @@ -1,6 +1,6 @@ - - - * + * @author Txmod Xoops - */ -// include __DIR__ . '/autoload.php'; /** * Class Logo. @@ -61,33 +59,33 @@ public static function getInstance() */ /*private static function createLogo($logoIcon, $moduleDirname) { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { return false; } else { - $requiredFunctions = array('imagecreatefrompng', 'imagefttext', 'imagecopy', 'imagepng', 'imagedestroy', 'imagecolorallocate'); + $requiredFunctions = ['imagecreatefrompng', 'imagefttext', 'imagecopy', 'imagepng', 'imagedestroy', 'imagecolorallocate']; foreach ($requiredFunctions as $func) { - if (!function_exists($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)) + 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); + $imageModule = \imagecreatefrompng($imageBase); + $imageIcon = \imagecreatefrompng($iconFile); // Write text $textColor = imagecolorallocate($imageModule, 0, 0, 0); - $spaceBorder = (92 - strlen($moduleDirname) * 7.5) / 2; - imagefttext($imageModule, 8.5, 0, $spaceBorder, 45, $textColor, $font, ucfirst($moduleDirname), array()); + $spaceBorder = (92 - \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 = '/'.$moduleDirname.'_logo.png'; - imagepng($imageModule, TDMC_UPLOAD_IMGMOD_PATH.$logoImg); - imagedestroy($imageModule); - imagedestroy($imageIcon); + \imagepng($imageModule, TDMC_UPLOAD_IMGMOD_PATH.$logoImg); + \imagedestroy($imageModule); + \imagedestroy($imageIcon); return TDMC_UPLOAD_IMGMOD_URL.$logoImg; }*/ @@ -100,48 +98,48 @@ public static function getInstance() */ public static function createLogo($logoIcon, $moduleDirname) { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { return false; } $requiredFunctions = ['imagecreatefrompng', 'imagefttext', 'imagecopy', 'imagepng', 'imagedestroy', 'imagecolorallocate']; foreach ($requiredFunctions as $func) { - if (!function_exists($func)) { + if (!\function_exists($func)) { return false; } } - $dirname = 'tdmcreate'; - $iconFileName = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32/' . basename($logoIcon); + $dirname = 'modulebuilder'; + $iconFileName = \XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32/' . \basename($logoIcon); //$dirFonts = TDMC_PATH . "/assets/fonts"; //$dirLogos = TDMC_PATH . "/assets/images/logos"; - $dirFonts = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/assets/fonts'; - $dirLogos = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/assets/images/logos'; + $dirFonts = \XOOPS_ROOT_PATH . '/modules/' . $dirname . '/assets/fonts'; + $dirLogos = \XOOPS_ROOT_PATH . '/modules/' . $dirname . '/assets/images/logos'; - if (!file_exists($imageBase = $dirLogos . '/empty.png') - || !file_exists($font = $dirFonts . '/VeraBd.ttf') - || !file_exists($iconFile = $iconFileName)) { + if (!\file_exists($imageBase = $dirLogos . '/empty.png') + || !\file_exists($font = $dirFonts . '/VeraBd.ttf') + || !\file_exists($iconFile = $iconFileName)) { return false; } - $imageModule = imagecreatefrompng($imageBase); - $imageIcon = imagecreatefrompng($iconFile); + $imageModule = \imagecreatefrompng($imageBase); + $imageIcon = \imagecreatefrompng($iconFile); // 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); //$targetImage = TDMC_UPLOAD_IMGMOD_URL . "/" . $moduleDirname . "_logo.png"; $targetImage = '/uploads/' . $dirname . '/images/modules/' . $moduleDirname . '_logo.png'; - imagepng($imageModule, XOOPS_ROOT_PATH . $targetImage); + \imagepng($imageModule, \XOOPS_ROOT_PATH . $targetImage); - imagedestroy($imageModule); - imagedestroy($imageIcon); + \imagedestroy($imageModule); + \imagedestroy($imageIcon); - return XOOPS_URL . $targetImage; + return \XOOPS_URL . $targetImage; } } diff --git a/class/LogoGenerator.php b/class/LogoGenerator.php index e3f03ee5..1269d914 100644 --- a/class/LogoGenerator.php +++ b/class/LogoGenerator.php @@ -1,6 +1,8 @@ - - - * + * @author Txmod Xoops - */ -// include __DIR__ . '/autoload.php'; /** * Class Modules. @@ -48,11 +46,10 @@ class Modules extends \XoopsObject /** * @public function constructor class - * @param null */ public function __construct() { - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); $setId = \Xmf\Request::getInt('set_id'); $settings = $helper->getHandler('Settings')->get($setId); @@ -99,20 +96,19 @@ 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): mixed { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } /** * @static function getInstance - * @param null * @return Modules */ public static function getInstance() @@ -133,12 +129,12 @@ public static function getInstance() */ public function getFormModules($action = false) { - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); if (false === $action) { $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } $set = []; - $settings = $helper->getHandler('Settings')->getAllSettings(0, 0, 'set_type'); + $settings = $helper->getHandler('Settings')->getActiveSetting(); foreach ($settings as $setting) { $set['name'] = $setting->getVar('set_name'); $set['dirname'] = $setting->getVar('set_dirname'); @@ -158,7 +154,7 @@ public function getFormModules($action = false) $set['comments'] = $setting->getVar('set_comments'); $set['notifications'] = $setting->getVar('set_notifications'); $set['permissions'] = $setting->getVar('set_permissions'); - //$set['inroot'] = $setting->getVar('set_inroot_copy'); + $set['inroot'] = $setting->getVar('set_inroot_copy'); $set['image'] = $setting->getVar('set_image'); $set['author_mail'] = $setting->getVar('set_author_mail'); $set['author_website_url'] = $setting->getVar('set_author_website_url'); @@ -181,40 +177,40 @@ public function getFormModules($action = false) } $isNew = $this->isNew(); - $title = $isNew ? sprintf(_AM_TDMCREATE_MODULE_NEW) : sprintf(_AM_TDMCREATE_MODULE_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_MODULE_NEW : \_AM_MODULEBUILDER_MODULE_EDIT; - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + require_once \XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $form = new \XoopsThemeForm($title, 'moduleform', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); - $modName = $isNew ? $set['name'] : $this->getVar('mod_name'); - $modName = new \XoopsFormText(_AM_TDMCREATE_MODULE_NAME, 'mod_name', 50, 255, $modName); - $modName->setDescription(_AM_TDMCREATE_MODULE_NAME_DESC); - $form->addElement($modName, true); + $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 = new \XoopsFormText(_AM_TDMCREATE_MODULE_DIRNAME, 'mod_dirname', 25, 255, $modDirname); - $modDirname->setDescription(_AM_TDMCREATE_MODULE_DIRNAME_DESC); - $form->addElement($modDirname, true); + $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); $modVersion = $isNew ? $set['version'] : $this->getVar('mod_version'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_VERSION, 'mod_version', 10, 25, $modVersion), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_VERSION, 'mod_version', 10, 25, $modVersion), true); $modSince = $isNew ? $set['since'] : $this->getVar('mod_since'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_SINCE, 'mod_since', 10, 25, $modSince), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_SINCE, 'mod_since', 10, 25, $modSince), true); $modMinPhp = $isNew ? $set['min_php'] : $this->getVar('mod_min_php'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_MIN_PHP, 'mod_min_php', 10, 25, $modMinPhp), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_MIN_PHP, 'mod_min_php', 10, 25, $modMinPhp), true); $modMinXoops = $isNew ? $set['min_xoops'] : $this->getVar('mod_min_xoops'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_MIN_XOOPS, 'mod_min_xoops', 10, 25, $modMinXoops), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_MIN_XOOPS, 'mod_min_xoops', 10, 25, $modMinXoops), true); $modMinAdmin = $isNew ? $set['min_admin'] : $this->getVar('mod_min_admin'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_MIN_ADMIN, 'mod_min_admin', 10, 25, $modMinAdmin), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_MIN_ADMIN, 'mod_min_admin', 10, 25, $modMinAdmin), true); $modMinMysql = $isNew ? $set['min_mysql'] : $this->getVar('mod_min_mysql'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_MIN_MYSQL, 'mod_min_mysql', 10, 25, $modMinMysql), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_MIN_MYSQL, 'mod_min_mysql', 10, 25, $modMinMysql), true); // Name description $editorConfigs = []; $editorConfigs['name'] = 'mod_description'; @@ -223,26 +219,26 @@ public function getFormModules($action = false) $editorConfigs['cols'] = 100; $editorConfigs['width'] = '50%'; $editorConfigs['height'] = '100px'; - $editorConfigs['editor'] = $helper->getConfig('tdmcreate_editor'); - $form->addElement(new \XoopsFormEditor(_AM_TDMCREATE_MODULE_DESCRIPTION, 'mod_description', $editorConfigs), true); + $editorConfigs['editor'] = $helper->getConfig('modulebuilder_editor'); + $form->addElement(new \XoopsFormEditor(\_AM_MODULEBUILDER_MODULE_DESCRIPTION, 'mod_description', $editorConfigs), true); // Author $modAuthor = $isNew ? $set['author'] : $this->getVar('mod_author'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_AUTHOR, 'mod_author', 50, 255, $modAuthor), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_AUTHOR, 'mod_author', 50, 255, $modAuthor), true); $modLicense = $isNew ? $set['license'] : $this->getVar('mod_license'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_LICENSE, 'mod_license', 50, 255, $modLicense), true); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_LICENSE, 'mod_license', 50, 255, $modLicense), true); $optionsTray = new \XoopsFormElementTray(_OPTIONS, '
      '); - $optionsTray->setDescription(_AM_TDMCREATE_OPTIONS_DESC); + $optionsTray->setDescription(\_AM_MODULEBUILDER_OPTIONS_DESC); // Check All Modules Options $checkAllOptions = new \XoopsFormCheckBox('', 'modulebox', 1); - $checkAllOptions->addOption('allbox', _AM_TDMCREATE_MODULE_ALL); + $checkAllOptions->addOption('allbox', \_AM_MODULEBUILDER_MODULE_ALL); $checkAllOptions->setExtra(' onclick="xoopsCheckAll(\'moduleform\', \'modulebox\');" '); $checkAllOptions->setClass('xo-checkall'); $optionsTray->addElement($checkAllOptions); // Options $checkbox = new \XoopsFormCheckbox(' ', 'module_option', $this->getOptionsModules(), '
      '); foreach ($this->options as $option) { - $checkbox->addOption($option, self::getDefinedLanguage('_AM_TDMCREATE_MODULE_' . mb_strtoupper($option))); + $checkbox->addOption($option, self::getDefinedLanguage('\_AM_MODULEBUILDER_MODULE_' . \mb_strtoupper($option))); } $optionsTray->addElement($checkbox); @@ -252,33 +248,33 @@ public function getFormModules($action = false) $modImage = $modImage ?: $set['image']; $uploadDirectory = 'uploads/' . $GLOBALS['xoopsModule']->dirname() . '/images/modules'; - $imgtray = new \XoopsFormElementTray(_AM_TDMCREATE_MODULE_IMAGE, '
      '); - $imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, './' . mb_strtolower($uploadDirectory) . '/'); + $imgtray = new \XoopsFormElementTray(\_AM_MODULEBUILDER_MODULE_IMAGE, '
      '); + $imgpath = \sprintf(\_AM_MODULEBUILDER_FORMIMAGE_PATH, './' . $uploadDirectory . '/'); $imageselect = new \XoopsFormSelect($imgpath, 'mod_image', $modImage); $modImageArray = \XoopsLists::getImgListAsArray(TDMC_UPLOAD_IMGMOD_PATH); foreach ($modImageArray as $image) { $imageselect->addOption($image, $image); } - $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"mod_image\", \"" . $uploadDirectory . '", "", "' . XOOPS_URL . "\")'"); + $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_TDMCREATE_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); + $fileseltray->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); $fileseltray->addElement(new \XoopsFormLabel('')); $imgtray->addElement($fileseltray); $form->addElement($imgtray); //---------- START LOGO GENERATOR ----------------- $tables_img = $this->getVar('table_image') ?: 'about.png'; $iconsdir = '/Frameworks/moduleclasses/icons/32'; - if (is_dir(XOOPS_ROOT_PATH . $iconsdir)) { + if (\is_dir(\XOOPS_ROOT_PATH . $iconsdir)) { $uploadDirectory = $iconsdir; - $imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, ".{$iconsdir}/"); + $imgpath = \sprintf(\_AM_MODULEBUILDER_FORMIMAGE_PATH, ".{$iconsdir}/"); } else { $uploadDirectory = '/uploads/' . $GLOBALS['xoopsModule']->dirname() . '/images/tables'; - $imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, './uploads/' . $GLOBALS['xoopsModule']->dirname() . '/images/tables'); + $imgpath = \sprintf(\_AM_MODULEBUILDER_FORMIMAGE_PATH, './uploads/' . $GLOBALS['xoopsModule']->dirname() . '/images/tables'); } - $createLogoTray = new \XoopsFormElementTray(_AM_TDMCREATE_MODULE_CREATENEWLOGO, '
      '); + $createLogoTray = new \XoopsFormElementTray(\_AM_MODULEBUILDER_MODULE_CREATENEWLOGO, '
      '); $iconSelect = new \XoopsFormSelect($imgpath, 'tables_img', $tables_img, 8); $tablesImagesArray = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadDirectory); foreach ($tablesImagesArray as $image) { @@ -286,9 +282,9 @@ 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_TDMCREATE_MODULE_CREATENEWLOGO, 'button'); + $buttonLogoGenerator4 = new \XoopsFormButton('', 'button4', \_AM_MODULEBUILDER_MODULE_CREATENEWLOGO, 'button'); $buttonLogoGenerator4->setExtra(" onclick='createNewModuleLogo(\"" . TDMC_URL . "\")' "); $createLogoTray->addElement($buttonLogoGenerator4); @@ -296,106 +292,67 @@ public function getFormModules($action = false) //------------ END LOGO GENERATOR -------------------- $modAuthorMail = $isNew ? $set['author_mail'] : $this->getVar('mod_author_mail'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_AUTHOR_MAIL, 'mod_author_mail', 50, 255, $modAuthorMail)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_AUTHOR_MAIL, 'mod_author_mail', 50, 255, $modAuthorMail)); $modAuthorWebsiteUrl = $isNew ? $set['author_website_url'] : $this->getVar('mod_author_website_url'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_AUTHOR_WEBSITE_URL, 'mod_author_website_url', 50, 255, $modAuthorWebsiteUrl)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_AUTHOR_WEBSITE_URL, 'mod_author_website_url', 50, 255, $modAuthorWebsiteUrl)); $modAuthorWebsiteName = $isNew ? $set['author_website_name'] : $this->getVar('mod_author_website_name'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_AUTHOR_WEBSITE_NAME, 'mod_author_website_name', 50, 255, $modAuthorWebsiteName)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_AUTHOR_WEBSITE_NAME, 'mod_author_website_name', 50, 255, $modAuthorWebsiteName)); $modCredits = $isNew ? $set['credits'] : $this->getVar('mod_credits'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_CREDITS, 'mod_credits', 50, 255, $modCredits)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_CREDITS, 'mod_credits', 50, 255, $modCredits)); $modReleaseInfo = $isNew ? $set['release_info'] : $this->getVar('mod_release_info'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_RELEASE_INFO, 'mod_release_info', 50, 255, $modReleaseInfo)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_RELEASE_INFO, 'mod_release_info', 50, 255, $modReleaseInfo)); $modReleaseFile = $isNew ? $set['release_file'] : $this->getVar('mod_release_file'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_RELEASE_FILE, 'mod_release_file', 50, 255, $modReleaseFile)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_RELEASE_FILE, 'mod_release_file', 50, 255, $modReleaseFile)); $modManual = $isNew ? $set['manual'] : $this->getVar('mod_manual'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_MANUAL, 'mod_manual', 50, 255, $modManual)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_MANUAL, 'mod_manual', 50, 255, $modManual)); $modManualFile = $isNew ? $set['manual_file'] : $this->getVar('mod_manual_file'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_MANUAL_FILE, 'mod_manual_file', 50, 255, $modManualFile)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_MANUAL_FILE, 'mod_manual_file', 50, 255, $modManualFile)); $modDemoSiteUrl = $isNew ? $set['demo_site_url'] : $this->getVar('mod_demo_site_url'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_DEMO_SITE_URL, 'mod_demo_site_url', 50, 255, $modDemoSiteUrl)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_DEMO_SITE_URL, 'mod_demo_site_url', 50, 255, $modDemoSiteUrl)); $modDemoSiteName = $isNew ? $set['demo_site_name'] : $this->getVar('mod_demo_site_name'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_DEMO_SITE_NAME, 'mod_demo_site_name', 50, 255, $modDemoSiteName)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_DEMO_SITE_NAME, 'mod_demo_site_name', 50, 255, $modDemoSiteName)); $modSupportUrl = $isNew ? $set['support_url'] : $this->getVar('mod_support_url'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_SUPPORT_URL, 'mod_support_url', 50, 255, $modSupportUrl)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_SUPPORT_URL, 'mod_support_url', 50, 255, $modSupportUrl)); $modSupportName = $isNew ? $set['support_name'] : $this->getVar('mod_support_name'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_SUPPORT_NAME, 'mod_support_name', 50, 255, $modSupportName)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_SUPPORT_NAME, 'mod_support_name', 50, 255, $modSupportName)); $modWebsiteUrl = $isNew ? $set['website_url'] : $this->getVar('mod_website_url'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_WEBSITE_URL, 'mod_website_url', 50, 255, $modWebsiteUrl)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_WEBSITE_URL, 'mod_website_url', 50, 255, $modWebsiteUrl)); $modWebsiteName = $isNew ? $set['website_name'] : $this->getVar('mod_website_name'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_WEBSITE_NAME, 'mod_website_name', 50, 255, $modWebsiteName)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_WEBSITE_NAME, 'mod_website_name', 50, 255, $modWebsiteName)); $modRelease = $isNew ? $set['release'] : $this->getVar('mod_release'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_RELEASE, 'mod_release', 50, 255, $modRelease)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_RELEASE, 'mod_release', 50, 255, $modRelease)); $modStatus = $isNew ? $set['status'] : $this->getVar('mod_status'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_STATUS, 'mod_status', 50, 255, $modStatus)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_STATUS, 'mod_status', 50, 255, $modStatus)); $modDonations = $isNew ? $set['donations'] : $this->getVar('mod_donations'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_PAYPAL_BUTTON, 'mod_donations', 50, 255, $modDonations)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_PAYPAL_BUTTON, 'mod_donations', 50, 255, $modDonations)); $modSubversion = $isNew ? $set['subversion'] : $this->getVar('mod_subversion'); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_MODULE_SUBVERSION, 'mod_subversion', 50, 255, $modSubversion)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_MODULE_SUBVERSION, 'mod_subversion', 50, 255, $modSubversion)); $buttonTray = new \XoopsFormElementTray(_REQUIRED . ' *', ''); $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); - $buttonTray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $buttonTray->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit')); $form->addElement($buttonTray); return $form; } - /** - * @private static function createLogo - * @param mixed $logoIcon - * @param string $moduleDirname - * - * @return bool|string - */ - private static function createLogo($logoIcon, $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. * @@ -452,8 +409,8 @@ private function getOptionsModules() */ private static function getDefinedLanguage($lang) { - if (defined($lang)) { - return constant($lang); + if (\defined($lang)) { + return \constant($lang); } return $lang; diff --git a/class/ModulesHandler.php b/class/ModulesHandler.php index da37ee97..955ed9be 100644 --- a/class/ModulesHandler.php +++ b/class/ModulesHandler.php @@ -1,6 +1,6 @@ - - - * + * @author Txmod Xoops - */ -// include __DIR__ . '/autoload.php'; /** * @Class ModulesHandler @@ -38,7 +36,7 @@ class ModulesHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_modules', Modules::class, 'mod_id', 'mod_name'); + parent::__construct($db, 'modulebuilder_modules', Modules::class, 'mod_id', 'mod_name'); } /** @@ -54,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 */ @@ -80,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 ASC, mod_name', $order = 'ASC') + 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); @@ -98,14 +95,14 @@ public function getCountModules($start = 0, $limit = 0, $sort = 'mod_id ASC, mod /** * 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 ASC, mod_name', $order = 'ASC') + 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 deleted file mode 100644 index 91c02002..00000000 --- a/class/MoreFiles.php +++ /dev/null @@ -1,160 +0,0 @@ - - - * - */ -//include __DIR__.'/autoload.php'; -/* -* @Class MoreFiles -* @extends \XoopsObject -*/ - -/** - * Class MoreFiles. - */ -class MoreFiles extends \XoopsObject -{ - /** - * Settings. - * - * @var mixed - */ - private $settings; - - /** - * @public function constructor class - * - * @param null - */ - public function __construct() - { - $this->initVar('file_id', XOBJ_DTYPE_INT); - $this->initVar('file_mid', XOBJ_DTYPE_INT); - $this->initVar('file_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('file_extension', XOBJ_DTYPE_TXTBOX); - $this->initVar('file_infolder', XOBJ_DTYPE_TXTBOX); - } - - /** - * @param string $method - * @param array $args - * - * @return mixed - */ - public function __call($method, $args) - { - $arg = isset($args[0]) ? $args[0] : null; - - return $this->getVar($method, $arg); - } - - /** - * @static function getInstance - * - * @param null - * - * @return MoreFiles - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - - return $instance; - } - - /** - * @public function getFormMoreFiles - * - * @param bool|mixed $action - * @return \XoopsThemeForm - */ - public function getFormMoreFiles($action = false) - { - $helper = Tdmcreate\Helper::getInstance(); - if (false === $action) { - $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); - } - - $isNew = $this->isNew(); - $title = $isNew ? sprintf(_AM_TDMCREATE_MORE_FILES_NEW) : sprintf(_AM_TDMCREATE_MORE_FILES_EDIT); - - xoops_load('XoopsFormLoader'); - - $form = new \XoopsThemeForm($title, 'morefilesform', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - - $modules = $helper->getHandler('Modules')->getObjects(null); - $modulesSelect = new \XoopsFormSelect(_AM_TDMCREATE_MORE_FILES_MODULES, 'file_mid', $this->getVar('file_mid')); - $modulesSelect->addOption('', _AM_TDMCREATE_MORE_FILES_MODULE_SELECT); - foreach ($modules as $mod) { - //$modulesSelect->addOptionArray(); - $modulesSelect->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); - } - $form->addElement($modulesSelect, true); - - $modName = new \XoopsFormText(_AM_TDMCREATE_MORE_FILES_NAME, 'file_name', 50, 255, $this->getVar('file_name')); - $modName->setDescription(_AM_TDMCREATE_MORE_FILES_NAME_DESC); - $form->addElement($modName, true); - - $fileEstension = new \XoopsFormText(_AM_TDMCREATE_MORE_FILES_EXTENSION, 'file_extension', 50, 255, $this->getVar('file_extension')); - $fileEstension->setDescription(_AM_TDMCREATE_MORE_FILES_EXTENSION_DESC); - $form->addElement($fileEstension, true); - - $fileInfolder = new \XoopsFormText(_AM_TDMCREATE_MORE_FILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); - $fileInfolder->setDescription(_AM_TDMCREATE_MORE_FILES_INFOLDER_DESC); - $form->addElement($fileInfolder, true); - - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButton(_REQUIRED . ' *', 'submit', _SUBMIT, 'submit')); - - return $form; - } - - /** - * Get Values. - * - * @param null $keys - * @param null $format - * @param null $maxDepth - * - * @return array - */ - public function getValuesMoreFiles($keys = null, $format = null, $maxDepth = null) - { - $helper = Tdmcreate\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - // Values - $ret['id'] = $this->getVar('file_id'); - $ret['mid'] = $helper->getHandler('Modules')->get($this->getVar('file_mid'))->getVar('mod_name'); - $ret['name'] = $this->getVar('file_name'); - $ret['extension'] = $this->getVar('file_extension'); - $ret['infolder'] = $this->getVar('file_infolder'); - - return $ret; - } -} diff --git a/class/MoreFilesHandler.php b/class/MoreFilesHandler.php deleted file mode 100644 index b1b05f89..00000000 --- a/class/MoreFilesHandler.php +++ /dev/null @@ -1,156 +0,0 @@ - - - * - */ -//include __DIR__.'/autoload.php'; - -/** - * @Class MoreFilesHandler - * @extends \XoopsPersistableObjectHandler - */ -class MoreFilesHandler extends \XoopsPersistableObjectHandler -{ - /** - * @public function constructor class - * - * @param null|\XoopsDatabase|\XoopsMySQLDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'tdmcreate_morefiles', MoreFiles::class, 'file_id', 'file_name'); - } - - /** - * @param bool $isNew - * - * @return \XoopsObject - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field. - * - * @param int $i field id - * @param null $fields - * - * @return mixed reference to the Fields object - * object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id. - * - * @param null - * - * @return int reference to the {@link Tables} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count MoreFiles. - * - * @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') - { - $crMoreFilesCount = new \CriteriaCompo(); - $crMoreFilesCount = $this->getMoreFilesCriteria($crMoreFilesCount, $start, $limit, $sort, $order); - - return $this->getCount($crMoreFilesCount); - } - - /** - * Get All MoreFiles. - * - * @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') - { - $crMoreFilesAdd = new \CriteriaCompo(); - $crMoreFilesAdd = $this->getMoreFilesCriteria($crMoreFilesAdd, $start, $limit, $sort, $order); - - return $this->getAll($crMoreFilesAdd); - } - - /** - * Get All MoreFiles By Module Id. - * - * @param $modId - * @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') - { - $crMoreFilesByModuleId = new \CriteriaCompo(); - $crMoreFilesByModuleId->add(new \Criteria('file_mid', $modId)); - $crMoreFilesByModuleId = $this->getMoreFilesCriteria($crMoreFilesByModuleId, $start, $limit, $sort, $order); - - return $this->getAll($crMoreFilesByModuleId); - } - - /** - * Get MoreFiles Criteria. - * - * @param $crMoreFiles - * @param $start - * @param $limit - * @param $sort - * @param $order - * - * @return mixed - */ - private function getMoreFilesCriteria($crMoreFiles, $start, $limit, $sort, $order) - { - $crMoreFiles->setStart($start); - $crMoreFiles->setLimit($limit); - $crMoreFiles->setSort($sort); - $crMoreFiles->setOrder($order); - - return $crMoreFiles; - } -} diff --git a/class/Morefiles.php b/class/Morefiles.php new file mode 100644 index 00000000..79d925b1 --- /dev/null +++ b/class/Morefiles.php @@ -0,0 +1,175 @@ + - + */ + +/* +* @Class Morefiles +* @extends \XoopsObject +*/ + +/** + * Class Morefiles. + */ +class Morefiles extends \XoopsObject +{ + + /** + * @public function constructor class + * + */ + public function __construct() + { + $this->initVar('file_id', XOBJ_DTYPE_INT); + $this->initVar('file_mid', XOBJ_DTYPE_INT); + $this->initVar('file_type', XOBJ_DTYPE_INT); + $this->initVar('file_name', XOBJ_DTYPE_TXTBOX); + $this->initVar('file_extension', XOBJ_DTYPE_TXTBOX); + $this->initVar('file_upload', XOBJ_DTYPE_TXTBOX); + $this->initVar('file_infolder', XOBJ_DTYPE_TXTBOX); + } + + /** + * @param string $method + * @param array $args + * + * @return mixed + */ + public function __call(string $method, array $args) + { + $arg = $args[0] ?? null; + + return $this->getVar($method, $arg); + } + + /** + * @static function getInstance + * + * + * @return Morefiles + */ + public static function getInstance() + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + + return $instance; + } + + /** + * @public function getFormMorefiles + * + * @param bool|mixed $action + * @return \XoopsThemeForm + */ + public function getFormMorefiles($action = false) + { + $helper = Modulebuilder\Helper::getInstance(); + if (false === $action) { + $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); + } + + $isNew = $this->isNew(); + $title = $isNew ? \_AM_MODULEBUILDER_MORE_FILES_NEW : \_AM_MODULEBUILDER_MORE_FILES_EDIT; + + \xoops_load('XoopsFormLoader'); + + $form = new \XoopsThemeForm($title, 'morefilesform', $action, 'post', true); + $form->setExtra('enctype="multipart/form-data"'); + + $modules = $helper->getHandler('Modules')->getObjects(); + $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_MORE_FILES_MODULES, 'file_mid', $this->getVar('file_mid')); + $modulesSelect->addOption('', \_AM_MODULEBUILDER_MORE_FILES_MODULE_SELECT); + foreach ($modules as $mod) { + //$modulesSelect->addOptionArray(); + $modulesSelect->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); + } + $form->addElement($modulesSelect, true); + + $typeSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_MORE_FILES_TYPE, 'file_type', $this->getVar('file_type')); + $typeSelect->addOption(0, ' '); + $typeSelect->addOption(Constants::MORE_FILES_TYPE_EMPTY, \_AM_MODULEBUILDER_MORE_FILES_TYPE_EMPTY); + $typeSelect->addOption(Constants::MORE_FILES_TYPE_COPY, \_AM_MODULEBUILDER_MORE_FILES_TYPE_COPY); + $form->addElement($typeSelect, true); + + $fileName = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_NAME, 'file_name', 50, 255, $this->getVar('file_name')); + $fileName->setDescription(\_AM_MODULEBUILDER_MORE_FILES_NAME_DESC); + $form->addElement($fileName); + + $fileExtension = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_EXTENSION, 'file_extension', 50, 255, $this->getVar('file_extension')); + $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, '
      '); + $fileDirectory = '/uploads/modulebuilder/files'; + $fileSelect = new \XoopsFormSelect(".{$fileDirectory}/", 'file_upload', $fileUpload, 5); + $filesArray = \XoopsLists::getFileListAsArray(TDMC_UPLOAD_FILES_PATH); + $fileSelect->addOption('', ' - '); + foreach ($filesArray as $file1) { + if ('index.html' !== $file1 && 'index.php' !== $file1) { + $fileSelect->addOption("{$file1}", $file1); + } + } + $fileTray->addElement($fileSelect); + $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); + + $form->addElement(new \XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormButton(_REQUIRED . ' *', 'submit', \_SUBMIT, 'submit')); + + return $form; + } + + /** + * Get Values. + * + * @param null $keys + * @param null $format + * @param null $maxDepth + * + * @return array + */ + public function getValuesMorefiles($keys = null, $format = null, $maxDepth = null) + { + $helper = Modulebuilder\Helper::getInstance(); + $ret = $this->getValues($keys, $format, $maxDepth); + // Values + $ret['id'] = $this->getVar('file_id'); + $ret['mid'] = $helper->getHandler('Modules')->get($this->getVar('file_mid'))->getVar('mod_name'); + $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['infolder'] = $this->getVar('file_infolder'); + + return $ret; + } +} diff --git a/class/MorefilesHandler.php b/class/MorefilesHandler.php new file mode 100644 index 00000000..9fffe629 --- /dev/null +++ b/class/MorefilesHandler.php @@ -0,0 +1,153 @@ + - + */ + +/** + * @Class MorefilesHandler + * @extends \XoopsPersistableObjectHandler + */ +class MorefilesHandler extends \XoopsPersistableObjectHandler +{ + /** + * @public function constructor class + * + * @param null|\XoopsDatabase|\XoopsMySQLDatabase $db + */ + public function __construct(\XoopsDatabase $db) + { + parent::__construct($db, 'modulebuilder_morefiles', Morefiles::class, 'file_id', 'file_name'); + } + + /** + * @param bool $isNew + * + * @return \XoopsObject + */ + public function create($isNew = true) + { + return parent::create($isNew); + } + + /** + * retrieve a field. + * + * @param int $id field id + * @param null $fields + * + * @return \XoopsObject|null reference to the Fields object + * object + */ + public function get($id = null, $fields = null) + { + return parent::get($id, $fields); + } + + /** + * get inserted id. + * + * + * @return int reference to the {@link Tables} object + */ + public function getInsertId() + { + return $this->db->getInsertId(); + } + + /** + * Get Count Morefiles. + * + * @param int $start + * @param int $limit + * @param string $sort + * @param string $order + * + * @return int + */ + 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); + + return $this->getCount($crMorefilesCount); + } + + /** + * Get All Morefiles. + * + * @param int $start + * @param int $limit + * @param string $sort + * @param string $order + * + * @return array + */ + 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); + + return $this->getAll($crMorefilesAdd); + } + + /** + * Get All Morefiles By Module Id. + * + * @param $modId + * @param int $start + * @param int $limit + * @param string $sort + * @param string $order + * + * @return array + */ + 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)); + $crMorefilesByModuleId = $this->getMorefilesCriteria($crMorefilesByModuleId, $start, $limit, $sort, $order); + + return $this->getAll($crMorefilesByModuleId); + } + + /** + * Get Morefiles Criteria. + * + * @param $crMorefiles + * @param $start + * @param $limit + * @param $sort + * @param $order + * + * @return mixed + */ + private function getMorefilesCriteria($crMorefiles, $start, $limit, $sort, $order) + { + $crMorefiles->setStart($start); + $crMorefiles->setLimit($limit); + $crMorefiles->setSort($sort); + $crMorefiles->setOrder($order); + + return $crMorefiles; + } +} diff --git a/class/Session.php b/class/Session.php index ff7c01b6..74e87881 100644 --- a/class/Session.php +++ b/class/Session.php @@ -1,8 +1,8 @@ - * @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(string $name, $value): void { $_SESSION[$name] = $value; } @@ -81,7 +80,7 @@ public function setSession($name, $value) * * @return mixed value of session variable */ - public function getSession($name) + public function getSession(string $name) { if (isset($_SESSION[$name])) { return $_SESSION[$name]; @@ -95,7 +94,7 @@ public function getSession($name) * * @param string $name name of variable */ - public function deleteSession($name) + public function deleteSession(string $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 4d885776..7386dbac 100644 --- a/class/Settings.php +++ b/class/Settings.php @@ -1,8 +1,8 @@ -initVar('set_id', XOBJ_DTYPE_INT); $this->initVar('set_name', XOBJ_DTYPE_TXTBOX, $helper->getConfig('name')); $this->initVar('set_dirname', XOBJ_DTYPE_TXTBOX, $helper->getConfig('dirname')); @@ -94,7 +92,7 @@ public function __construct() $this->initVar('set_comments', XOBJ_DTYPE_INT, $helper->getConfig('active_comments')); $this->initVar('set_notifications', XOBJ_DTYPE_INT, $helper->getConfig('active_notifications')); $this->initVar('set_permissions', XOBJ_DTYPE_INT, $helper->getConfig('active_permissions')); - //$this->initVar('set_inroot_copy', XOBJ_DTYPE_INT, $helper->getConfig('inroot_copy')); + $this->initVar('set_inroot_copy', XOBJ_DTYPE_INT, $helper->getConfig('inroot_copy')); $this->initVar('set_donations', XOBJ_DTYPE_TXTBOX, $helper->getConfig('donations')); $this->initVar('set_subversion', XOBJ_DTYPE_TXTBOX, $helper->getConfig('subversion')); $this->initVar('set_type', XOBJ_DTYPE_TXTBOX); @@ -102,13 +100,13 @@ 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 = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } @@ -116,7 +114,6 @@ public function __call($method, $args) /** * @static function getInstance * - * @param null * * @return Settings */ @@ -138,44 +135,44 @@ public static function getInstance() */ public function getFormSettings($action = false) { - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); if (false === $action) { $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } $isNew = $this->isNew(); - $title = $isNew ? sprintf(_AM_TDMCREATE_SETTING_NEW) : sprintf(_AM_TDMCREATE_SETTING_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_SETTING_NEW : \_AM_MODULEBUILDER_SETTING_EDIT; - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + require_once \XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $form = new \XoopsThemeForm($title, 'settingform', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new \XoopsFormHidden('set_id', $this->getVar('set_id'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_NAME, 'set_name', 50, 255, $this->getVar('set_name'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_DIRNAME, 'set_dirname', 25, 255, $this->getVar('set_dirname'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_VERSION, 'set_version', 10, 25, $this->getVar('set_version'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_SINCE, 'set_since', 10, 25, $this->getVar('set_since'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_MIN_PHP, 'set_min_php', 10, 25, $this->getVar('set_min_php'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_MIN_XOOPS, 'set_min_xoops', 10, 25, $this->getVar('set_min_xoops'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_MIN_ADMIN, 'set_min_admin', 10, 25, $this->getVar('set_min_admin'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_MIN_MYSQL, 'set_min_mysql', 10, 25, $this->getVar('set_min_mysql'))); - $form->addElement(new \XoopsFormTextArea(_AM_TDMCREATE_SETTING_DESCRIPTION, 'set_description', $this->getVar('set_description'), 4, 25)); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_AUTHOR, 'set_author', 50, 255, $this->getVar('set_author'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_LICENSE, 'set_license', 50, 255, $this->getVar('set_license'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_NAME, 'set_name', 50, 255, $this->getVar('set_name'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_DIRNAME, 'set_dirname', 25, 255, $this->getVar('set_dirname'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_VERSION, 'set_version', 10, 25, $this->getVar('set_version'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_SINCE, 'set_since', 10, 25, $this->getVar('set_since'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_MIN_PHP, 'set_min_php', 10, 25, $this->getVar('set_min_php'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_MIN_XOOPS, 'set_min_xoops', 10, 25, $this->getVar('set_min_xoops'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_MIN_ADMIN, 'set_min_admin', 10, 25, $this->getVar('set_min_admin'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_MIN_MYSQL, 'set_min_mysql', 10, 25, $this->getVar('set_min_mysql'))); + $form->addElement(new \XoopsFormTextArea(\_AM_MODULEBUILDER_SETTING_DESCRIPTION, 'set_description', $this->getVar('set_description'), 4, 25)); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_AUTHOR, 'set_author', 50, 255, $this->getVar('set_author'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_LICENSE, 'set_license', 50, 255, $this->getVar('set_license'))); // Check All Settings Options $optionsTray = new \XoopsFormElementTray(_OPTIONS, '
      '); $checkAllOptions = new \XoopsFormCheckBox('', 'settingbox', 1); - $checkAllOptions->addOption('allbox', _AM_TDMCREATE_SETTING_ALL); + $checkAllOptions->addOption('allbox', \_AM_MODULEBUILDER_SETTING_ALL); $checkAllOptions->setExtra(' onclick="xoopsCheckAll(\'settingform\', \'settingbox\');" '); $checkAllOptions->setClass('xo-checkall'); $optionsTray->addElement($checkAllOptions); // Options $settingOption = $this->getOptionsSettings(); $checkbox = new \XoopsFormCheckbox(' ', 'setting_option', $settingOption, '
      '); - $checkbox->setDescription(_AM_TDMCREATE_OPTIONS_DESC); + $checkbox->setDescription(\_AM_MODULEBUILDER_OPTIONS_DESC); foreach ($this->options as $option) { - $checkbox->addOption($option, self::getDefinedLanguage('_AM_TDMCREATE_SETTING_' . mb_strtoupper($option))); + $checkbox->addOption($option, self::getDefinedLanguage('\_AM_MODULEBUILDER_SETTING_' . \mb_strtoupper($option))); } $optionsTray->addElement($checkbox); @@ -185,47 +182,49 @@ public function getFormSettings($action = false) //$modImage = $modImage ?: $set['image']; $uploadDirectory = 'uploads/' . $GLOBALS['xoopsModule']->dirname() . '/images/modules'; - $imgtray = new \XoopsFormElementTray(_AM_TDMCREATE_SETTING_IMAGE, '
      '); - $imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, './' . mb_strtolower($uploadDirectory) . '/'); + $imgtray = new \XoopsFormElementTray(\_AM_MODULEBUILDER_SETTING_IMAGE, '
      '); + $imgpath = \sprintf(\_AM_MODULEBUILDER_FORMIMAGE_PATH, './' . $uploadDirectory . '/'); $imageSelect = new \XoopsFormSelect($imgpath, 'set_image', $modImage); $modImage_array = \XoopsLists::getImgListAsArray(TDMC_UPLOAD_IMGMOD_PATH); foreach ($modImage_array as $image) { $imageSelect->addOption($image, $image); } - $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"set_image\", \"" . $uploadDirectory . '", "", "' . XOOPS_URL . "\")'"); + $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_TDMCREATE_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); + $fileseltray->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); $fileseltray->addElement(new \XoopsFormLabel('')); $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'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_CREDITS, 'set_credits', 50, 255, $this->getVar('set_credits'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_RELEASE_INFO, 'set_release_info', 50, 255, $this->getVar('set_release_info'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_RELEASE_FILE, 'set_release_file', 50, 255, $this->getVar('set_release_file'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_MANUAL, 'set_manual', 50, 255, $this->getVar('set_manual'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_MANUAL_FILE, 'set_manual_file', 50, 255, $this->getVar('set_manual_file'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_DEMO_SITE_URL, 'set_demo_site_url', 50, 255, $this->getVar('set_demo_site_url'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_DEMO_SITE_NAME, 'set_demo_site_name', 50, 255, $this->getVar('set_demo_site_name'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_SUPPORT_URL, 'set_support_url', 50, 255, $this->getVar('set_support_url'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_SUPPORT_NAME, 'set_support_name', 50, 255, $this->getVar('set_support_name'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_WEBSITE_URL, 'set_website_url', 50, 255, $this->getVar('set_website_url'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_WEBSITE_NAME, 'set_website_name', 50, 255, $this->getVar('set_website_name'))); - // Form Text Date Select - $form->addElement(new \XoopsFormTextDateSelect(_AM_TDMCREATE_SETTING_RELEASE, 'set_release', '', $this->getVar('set_release'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_STATUS, 'set_status', 50, 255, $this->getVar('set_status'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_PAYPAL_BUTTON, 'set_donations', 50, 255, $this->getVar('set_donations'))); - $form->addElement(new \XoopsFormText(_AM_TDMCREATE_SETTING_SUBVERSION, 'set_subversion', 50, 255, $this->getVar('set_subversion'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_AUTHOR_MAIL, 'set_author_mail', 50, 255, $this->getVar('set_author_mail'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_AUTHOR_WEBSITE_URL, 'set_author_website_url', 50, 255, $this->getVar('set_author_website_url'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_AUTHOR_WEBSITE_NAME, 'set_author_website_name', 50, 255, $this->getVar('set_author_website_name'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_CREDITS, 'set_credits', 50, 255, $this->getVar('set_credits'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_RELEASE_INFO, 'set_release_info', 50, 255, $this->getVar('set_release_info'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_RELEASE_FILE, 'set_release_file', 50, 255, $this->getVar('set_release_file'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_MANUAL, 'set_manual', 50, 255, $this->getVar('set_manual'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_MANUAL_FILE, 'set_manual_file', 50, 255, $this->getVar('set_manual_file'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_DEMO_SITE_URL, 'set_demo_site_url', 50, 255, $this->getVar('set_demo_site_url'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_DEMO_SITE_NAME, 'set_demo_site_name', 50, 255, $this->getVar('set_demo_site_name'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_SUPPORT_URL, 'set_support_url', 50, 255, $this->getVar('set_support_url'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_SUPPORT_NAME, 'set_support_name', 50, 255, $this->getVar('set_support_name'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_WEBSITE_URL, 'set_website_url', 50, 255, $this->getVar('set_website_url'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_WEBSITE_NAME, 'set_website_name', 50, 255, $this->getVar('set_website_name'))); + $form->addElement(new \XoopsFormTextDateSelect(\_AM_MODULEBUILDER_SETTING_RELEASE, 'set_release', '', $this->getVar('set_release'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_STATUS, 'set_status', 50, 255, $this->getVar('set_status'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_PAYPAL_BUTTON, 'set_donations', 50, 255, $this->getVar('set_donations'))); + $form->addElement(new \XoopsFormText(\_AM_MODULEBUILDER_SETTING_SUBVERSION, 'set_subversion', 50, 255, $this->getVar('set_subversion'))); + $setTypeRadio = new \XoopsFormRadio(\_AM_MODULEBUILDER_SETTING_TYPE, 'set_type', $this->getVar('set_type')); + $setTypeRadio->addOption(0, \_AM_MODULEBUILDER_SETTING_TYPE_INACTIVE); + $setTypeRadio->addOption(1, \_AM_MODULEBUILDER_SETTING_TYPE_ACTIVE); + $form->addElement($setTypeRadio); $buttonTray = new \XoopsFormElementTray(_REQUIRED . ' *', ''); $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); - $buttonTray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $buttonTray->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit')); $form->addElement($buttonTray); return $form; @@ -280,8 +279,8 @@ private function getOptionsSettings() */ private static function getDefinedLanguage($lang) { - if (defined($lang)) { - return constant($lang); + if (\defined($lang)) { + return \constant($lang); } return $lang; diff --git a/class/SettingsHandler.php b/class/SettingsHandler.php index 5b9bb117..6589408c 100644 --- a/class/SettingsHandler.php +++ b/class/SettingsHandler.php @@ -1,6 +1,6 @@ -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 */ @@ -77,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); @@ -95,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); @@ -110,6 +107,19 @@ public function getAllSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_ return $this->getAll($crAllSettings); } + /** + * Get All Settings. + * + * @return array + */ + public function getActiveSetting() + { + $crActiveSetting = new \CriteriaCompo(); + $crActiveSetting->add(new \Criteria('set_type', '1')); + + return $this->getAll($crActiveSetting); + } + /** * Get Settings Criteria. * diff --git a/class/SplClassLoader.php b/class/SplClassLoader.php index e3b347ce..a308991a 100644 --- a/class/SplClassLoader.php +++ b/class/SplClassLoader.php @@ -1,6 +1,6 @@ -. + * . */ /** * 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 @@ -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) + public function setNamespaceSeparator(string $sep): void { $this->_namespaceSeparator = $sep; } @@ -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($includePath) + public function setIncludePath(?string $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|null */ public function getIncludePath() { @@ -101,7 +101,7 @@ public function getIncludePath() * * @param string $fileExtension */ - public function setFileExtension($fileExtension) + public function setFileExtension(string $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,17 +137,17 @@ public function unregister() * * @param string $className The name of the class to load */ - public function loadClass($className) + 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 = ''; $namespace = ''; - if (false !== ($lastNsPos = mb_strrpos($className, $this->_namespaceSeparator))) { + if (false !== ($lastNsPos = \mb_strrpos($className, $this->_namespaceSeparator))) { $namespace .= mb_substr($className, 0, $lastNsPos); $className = mb_substr($className, $lastNsPos + 1); - $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + $fileName = \str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; + $fileName .= \str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; require (null !== $this->_includePath ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; } diff --git a/class/Tables.php b/class/Tables.php index dd0f4bbb..a9cd9340 100644 --- a/class/Tables.php +++ b/class/Tables.php @@ -1,8 +1,8 @@ - - - * + * @author Txmod Xoops - */ -// include __DIR__ . '/autoload.php'; /** * Class Tables. @@ -53,13 +51,13 @@ class Tables extends \XoopsObject 'print', 'pdf', 'rss', - 'single', - 'visit', + 'reads', + //'single', + //'visit', ]; /** * @public function constructor class - * @param null */ public function __construct() { @@ -90,26 +88,26 @@ public function __construct() $this->initVar('table_print', XOBJ_DTYPE_INT); $this->initVar('table_pdf', XOBJ_DTYPE_INT); $this->initVar('table_rss', XOBJ_DTYPE_INT); + $this->initVar('table_reads', XOBJ_DTYPE_INT); $this->initVar('table_single', XOBJ_DTYPE_INT); $this->initVar('table_visit', XOBJ_DTYPE_INT); } /** * @param string $method - * @param array $args + * @param array $args * * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { - $arg = isset($args[0]) ? $args[0] : null; + $arg = $args[0] ?? null; return $this->getVar($method, $arg); } /** * @static function getInstance - * @param null * @return Tables */ public static function getInstance() @@ -133,102 +131,106 @@ public function getFormTables($action = false) if (false === $action) { $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); } - $helper = Tdmcreate\Helper::getInstance(); + $helper = Modulebuilder\Helper::getInstance(); $isNew = $this->isNew(); $tableName = $this->getVar('table_name'); $tableMid = $this->getVar('table_mid'); - $title = $isNew ? sprintf(_AM_TDMCREATE_TABLE_NEW) : sprintf(_AM_TDMCREATE_TABLE_EDIT); + $title = $isNew ? \_AM_MODULEBUILDER_TABLES_NEW : \_AM_MODULEBUILDER_TABLES_EDIT; - xoops_load('XoopsFormLoader'); + \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'tableform', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); - $modules = $helper->getHandler('Modules')->getObjects(null); - $modulesSelect = new \XoopsFormSelect(_AM_TDMCREATE_TABLE_MODULES, 'table_mid', $tableMid); - $modulesSelect->addOption('', _AM_TDMCREATE_TABLE_MODSELOPT); + $modules = $helper->getHandler('Modules')->getObjects(); + $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_TABLE_MODULES, 'table_mid', $tableMid); + $modulesSelect->addOption('', \_AM_MODULEBUILDER_TABLE_MODSELOPT); foreach ($modules as $mod) { $modulesSelect->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); } $form->addElement($modulesSelect, true); - $tableNameText = new \XoopsFormText(_AM_TDMCREATE_TABLE_NAME, 'table_name', 40, 150, $tableName); - $tableNameText->setDescription(_AM_TDMCREATE_TABLE_NAME_DESC); + /* + $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_TDMCREATE_TABLE_SOLENAME, 'table_solename', 40, 150, $this->getVar('table_solename')); - $tableSoleNameText->setDescription(_AM_TDMCREATE_TABLE_SOLENAME_DESC); + $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'); - $category = new \XoopsFormRadioYN(_AM_TDMCREATE_TABLE_CATEGORY, 'table_category', $radioCategory); - $category->setDescription(_AM_TDMCREATE_TABLE_CATEGORY_DESC); + $category = new \XoopsFormRadioYN(\_AM_MODULEBUILDER_TABLE_CATEGORY, 'table_category', $radioCategory); + $category->setDescription(\_AM_MODULEBUILDER_TABLE_CATEGORY_DESC); $form->addElement($category); - $tableFieldname = new \XoopsFormText(_AM_TDMCREATE_TABLE_FIELDNAME, 'table_fieldname', 30, 50, $this->getVar('table_fieldname')); - $tableFieldname->setDescription(_AM_TDMCREATE_TABLE_FIELDNAME_DESC); - $form->addElement($tableFieldname); + $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, true); - $tableNumbFileds = new \XoopsFormText(_AM_TDMCREATE_TABLE_NBFIELDS, 'table_nbfields', 10, 25, $this->getVar('table_nbfields')); - $tableNumbFileds->setDescription(_AM_TDMCREATE_TABLE_NBFIELDS_DESC); + $tableNumbFileds = new \XoopsFormText(\_AM_MODULEBUILDER_TABLE_NBFIELDS, 'table_nbfields', 10, 25, $this->getVar('table_nbfields')); + $tableNumbFileds->setDescription(\_AM_MODULEBUILDER_TABLE_NBFIELDS_DESC); $form->addElement($tableNumbFileds, true); if (!$isNew) { - $tableOrder = new \XoopsFormText(_AM_TDMCREATE_TABLE_ORDER, 'table_order', 5, 10, $this->getVar('table_order')); - $tableOrder->setDescription(_AM_TDMCREATE_TABLE_ORDER_DESC); + $tableOrder = new \XoopsFormText(\_AM_MODULEBUILDER_TABLE_ORDER, 'table_order', 5, 10, $this->getVar('table_order')); + $tableOrder->setDescription(\_AM_MODULEBUILDER_TABLE_ORDER_DESC); $form->addElement($tableOrder, true); } $getTableImage = $this->getVar('table_image'); $tableImage = $getTableImage ?: 'blank.gif'; $icons32Directory = '/Frameworks/moduleclasses/icons/32'; - $uploadsDirectory = '/uploads/tdmcreate/images/tables'; - $iconsDirectory = is_dir(XOOPS_ROOT_PATH . $icons32Directory) ? $icons32Directory : $uploadsDirectory; + $uploadsDirectory = '/uploads/modulebuilder/images/tables'; + $iconsDirectory = \is_dir(\XOOPS_ROOT_PATH . $icons32Directory) ? $icons32Directory : $uploadsDirectory; - $imgtray1 = new \XoopsFormElementTray(_AM_TDMCREATE_TABLE_IMAGE, '
      '); - $imgpath1 = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, ".{$iconsDirectory}/"); + $imgtray1 = new \XoopsFormElementTray(\_AM_MODULEBUILDER_TABLE_IMAGE, '
      '); + $imgpath1 = \sprintf(\_AM_MODULEBUILDER_FORMIMAGE_PATH, ".{$iconsDirectory}/"); $imageSelect1 = new \XoopsFormSelect($imgpath1, 'table_image', $tableImage, 10); - $imageArray1 = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $iconsDirectory); + $imageArray1 = \XoopsLists::getImgListAsArray(\XOOPS_ROOT_PATH . $iconsDirectory); foreach ($imageArray1 as $image1) { $imageSelect1->addOption($image1, $image1); } - $imageSelect1->setExtra("onchange='showImgSelected(\"image1\", \"table_image\", \"" . $iconsDirectory . '", "", "' . XOOPS_URL . "\")'"); - $imgtray1->addElement($imageSelect1, false); - $imgtray1->addElement(new \XoopsFormLabel('', "
      ")); + $imageSelect1->setExtra("onchange='showImgSelected(\"image1\", \"table_image\", \"" . $iconsDirectory . '", "", "' . \XOOPS_URL . "\")'"); + $imgtray1->addElement($imageSelect1); + $imgtray1->addElement(new \XoopsFormLabel('', "
      ")); $fileseltray1 = new \XoopsFormElementTray('', '
      '); - $fileseltray1->addElement(new \XoopsFormFile(_AM_TDMCREATE_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); + $fileseltray1->addElement(new \XoopsFormFile(\_AM_MODULEBUILDER_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxsize_image'))); $fileseltray1->addElement(new \XoopsFormLabel('')); $imgtray1->addElement($fileseltray1); - $imgtray1->setDescription(_AM_TDMCREATE_TABLE_IMAGE_DESC); + $imgtray1->setDescription(\_AM_MODULEBUILDER_TABLE_IMAGE_DESC); $form->addElement($imgtray1); $tableAutoincrement = $this->isNew() ? 1 : $this->getVar('table_autoincrement'); - $checkTableAutoincrement = new \XoopsFormRadioYN(_AM_TDMCREATE_TABLE_AUTO_INCREMENT, 'table_autoincrement', $tableAutoincrement); - $checkTableAutoincrement->setDescription(_AM_TDMCREATE_TABLE_AUTO_INCREMENT_DESC); + $checkTableAutoincrement = new \XoopsFormRadioYN(\_AM_MODULEBUILDER_TABLE_AUTO_INCREMENT, 'table_autoincrement', $tableAutoincrement); + $checkTableAutoincrement->setDescription(\_AM_MODULEBUILDER_TABLE_AUTO_INCREMENT_DESC); $form->addElement($checkTableAutoincrement); $optionsTray = new \XoopsFormElementTray(_OPTIONS, '
      '); $tableCheckAll = new \XoopsFormCheckBox('', 'tablebox', 1); - $tableCheckAll->addOption('allbox', _AM_TDMCREATE_TABLE_ALL); + $tableCheckAll->addOption('allbox', \_AM_MODULEBUILDER_TABLE_ALL); $tableCheckAll->setExtra(' onclick="xoopsCheckAll(\'tableform\', \'tablebox\');" '); $tableCheckAll->setClass('xo-checkall'); $optionsTray->addElement($tableCheckAll); // Options $checkbox = new \XoopsFormCheckbox(' ', 'table_option', $this->getOptionsTables(), '
      '); - $checkbox->setDescription(_AM_TDMCREATE_OPTIONS_DESC); + $checkbox->setDescription(\_AM_MODULEBUILDER_OPTIONS_DESC); foreach ($this->options as $option) { - $checkbox->addOption($option, self::getDefinedLanguage('_AM_TDMCREATE_TABLE_' . mb_strtoupper($option))); + $checkbox->addOption($option, self::getDefinedLanguage('\_AM_MODULEBUILDER_TABLE_' . \mb_strtoupper($option))); } $optionsTray->addElement($checkbox); - $optionsTray->setDescription(_AM_TDMCREATE_TABLE_OPTIONS_CHECKS_DESC); + $optionsTray->setDescription(\_AM_MODULEBUILDER_TABLE_OPTIONS_CHECKS_DESC); $form->addElement($optionsTray); $buttonTray = new \XoopsFormElementTray(_REQUIRED . ' *', ''); $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); $buttonTray->addElement(new \XoopsFormHidden('table_id', ($isNew ? 0 : $this->getVar('table_id')))); - $buttonTray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $buttonTray->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit')); $form->addElement($buttonTray); return $form; @@ -245,11 +247,17 @@ public function getFormTables($action = false) */ public function getValuesTables($keys = null, $format = null, $maxDepth = null) { + $helper = Modulebuilder\Helper::getInstance(); + $ret = $this->getValues($keys, $format, $maxDepth); // Values - $ret['id'] = $this->getVar('table_id'); - $ret['mid'] = $this->getVar('table_mid'); - $ret['name'] = ucfirst($this->getVar('table_name')); + $ret['id'] = $this->getVar('table_id'); + $ret['mid'] = $this->getVar('table_mid'); + $modulesObj = $helper->getHandler('Modules')->get($ret['mid']); + if (\is_object($modulesObj)) { + $ret['module'] = $modulesObj->getVar('mod_name'); + } + $ret['name'] = \ucfirst($this->getVar('table_name')); $ret['image'] = $this->getVar('table_image'); $ret['nbfields'] = $this->getVar('table_nbfields'); $ret['order'] = $this->getVar('table_order'); @@ -291,8 +299,8 @@ public function getOptionsTables() */ private static function getDefinedLanguage($lang) { - if (defined($lang)) { - return constant($lang); + if (\defined($lang)) { + return \constant($lang); } return $lang; diff --git a/class/TablesHandler.php b/class/TablesHandler.php index def5fbde..da9d9fb2 100644 --- a/class/TablesHandler.php +++ b/class/TablesHandler.php @@ -1,8 +1,8 @@ - - - * + * @author Txmod Xoops - */ -// include __DIR__ . '/autoload.php'; - /** * @Class TablesHandler * @extends \XoopsPersistableObjectHandler @@ -41,7 +38,7 @@ class TablesHandler extends \XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'tdmcreate_tables', Tables::class, 'table_id', 'table_name'); + parent::__construct($db, 'modulebuilder_tables', Tables::class, 'table_id', 'table_name'); } /** @@ -57,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 */ @@ -83,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); @@ -101,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_id ASC, table_name', $order = 'ASC') + 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); @@ -120,14 +116,14 @@ public function getAllTables($start = 0, $limit = 0, $sort = 'table_id ASC, tabl * 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 0bbfcd5a..7973c924 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -1,6 +1,6 @@ - + * @author ZySpec * @author Mamba - * @since + * @since */ -use XoopsModules\Tdmcreate; +use XoopsModules\Modulebuilder; /** * Class Utility */ -class Utility +class Utility extends Common\SysUtility { - use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits - - use Common\ServerStats; // getServerStats Trait - - use Common\FilesManagement; // Files Management Trait - - /** - * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags - * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags - * www.cakephp.org - * - * @param string $text String to truncate. - * @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 - * - * @return string Trimmed string. - */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) - { - if ($considerHtml) { - // if the plain text is shorter than the maximum length, return the whole text - 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); - $open_tags = []; - $truncate = ''; - foreach ($lines as $line_matchings) { - // if there is any html-tag in this line, handle it and add it (uncounted) to the output - if (!empty($line_matchings[1])) { - // if it's an "empty element" with or without xhtml-conform closing slash - if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { - // do nothing - // if tag is a closing tag - } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { - // delete tag from $open_tags list - $pos = array_search($tag_matchings[1], $open_tags, true); - if (false !== $pos) { - unset($open_tags[$pos]); - } - // if tag is an opening tag - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { - // add tag to the beginning of $open_tags list - array_unshift($open_tags, mb_strtolower($tag_matchings[1])); - } - // add html-tag to $truncate'd text - $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])); - 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)) { - // 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]); - } else { - // no more characters left - break; - } - } - } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); - // maximum lenght is reached, so get off the loop - break; - } - $truncate .= $line_matchings[2]; - $total_length += $content_length; - - // if the maximum length is reached, get off the loop - if ($total_length >= $length) { - break; - } - } - } else { - if (mb_strlen($text) <= $length) { - return $text; - } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); - } - // if the words shouldn't be cut in the middle... - if (!$exact) { - // ...search the last occurance of a space... - $spacepos = mb_strrpos($truncate, ' '); - if (isset($spacepos)) { - // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); - } - } - // add the defined ending to the text - $truncate .= $ending; - if ($considerHtml) { - // close all unclosed html-tags - foreach ($open_tags as $tag) { - $truncate .= ''; - } - } - - return $truncate; - } - - /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options - * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor - */ - public static function getEditor($helper = null, $options = null) - { - /** @var Tdmcreate\Helper $helper */ - if (null === $options) { - $options = []; - $options['name'] = 'Editor'; - $options['value'] = 'Editor'; - $options['rows'] = 10; - $options['cols'] = '100%'; - $options['width'] = '100%'; - $options['height'] = '400px'; - } - - $isAdmin = $helper->isUserAdmin(); - - if (class_exists('XoopsFormEditor')) { - if ($isAdmin) { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); - } else { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); - } - } else { - $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); - } - - // $form->addElement($descEditor); - - return $descEditor; - } - //--------------- Custom module methods ----------------------------- - /** * @param $about * @return string */ - public static function MakeDonationForm($about) + public static function makeDonationForm($about) { $donationform = [ - 0 => '
      ', + 0 => '', 1 => '
      ' - . _AM_TDMCREATE_ABOUT_MAKE_DONATION + . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
      ' - . _AM_TDMCREATE_DONATION_AMOUNT + . \_AM_MODULEBUILDER_DONATION_AMOUNT . '*
      ', - 2 => '', + 2 => '', 'D' => '', 3 => '', 4 => ' @@ -218,24 +71,22 @@ 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'), + \defined('XOOPS_LICENSE_KEY') ? \XOOPS_LICENSE_KEY : '', + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') + ); } } $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); - $aboutRes .= implode("\n", $donationform); + $aboutRes .= \implode("\n", $donationform); $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); return $aboutRes; @@ -248,6 +99,6 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; */ public static function UcFirstAndToLower($str) { - return ucfirst(mb_strtolower(trim($str))); + return \ucfirst(\mb_strtolower(\trim($str))); } } diff --git a/class/autoload.php b/class/autoload.php index 297f144a..e8086d34 100644 --- a/class/autoload.php +++ b/class/autoload.php @@ -1,6 +1,6 @@ -history.go(-1); diff --git a/class/files/assets/css/admin/index.html b/class/files/assets/css/admin/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/assets/css/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/assets/css/index.html b/class/files/assets/css/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/assets/css/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/assets/js/index.html b/class/files/assets/js/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/assets/js/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/blocks/index.html b/class/files/blocks/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/classes/index.html b/class/files/classes/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/classes/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/docs/index.html b/class/files/docs/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/index.html b/class/files/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/language/index.html b/class/files/language/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/language/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/sql/index.html b/class/files/sql/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/templates/admin/index.html b/class/files/templates/admin/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/templates/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/templates/blocks/index.html b/class/files/templates/blocks/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/templates/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/files/templates/index.html b/class/files/templates/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/templates/index.html +++ /dev/null @@ -1 +0,0 @@ - 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 @@ - diff --git a/class/files/user/index.html b/class/files/user/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/class/files/user/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/class/helper0.php b/class/helper0.php deleted file mode 100644 index 99b85a4b..00000000 --- a/class/helper0.php +++ /dev/null @@ -1,229 +0,0 @@ - - * - */ - -/** - * Class TDMCreateHelper. - */ -class TDMCreateHelper -{ - /** - * @var string - */ - private $dirname; - /** - * @var string - */ - private $module; - /** - * @var string - */ - private $handler; - /** - * @var string - */ - private $config; - /** - * @var string - */ - private $debug; - /* - * @protected function constructor class - * @param mixed $debug - */ - - /** - * @param $debug - */ - public function __construct($debug) - { - $this->debug = $debug; - $this->dirname = basename(dirname(__DIR__)); - } - - /* - * @static function getInstance - * @param mixed $debug - */ - - /** - * @param bool $debug - * - * @return bool|\TDMCreateHelper - */ - public static function getInstance($debug = false) - { - static $instance = false; - if (!$instance) { - $instance = new self($debug); - } - - return $instance; - } - - /* - * @static function getModule - * @param null - */ - - /** - * @return string - */ - public function &getModule() - { - if (null === $this->module) { - $this->initModule(); - } - - return $this->module; - } - - /* - * @static function getConfig - * @param string $name - */ - - /** - * @param null $name - * - * @return null|string - */ - public function getConfig($name = null) - { - if (null === $this->config) { - $this->initConfig(); - } - if (!$name) { - $this->addLog('Getting all config'); - - return $this->config; - } - if (!isset($this->config[$name])) { - $this->addLog("ERROR :: CONFIG '{$name}' does not exist"); - - return false; - } - $this->addLog("Getting config '{$name}' : " . $this->config[$name]); - - return $this->config[$name]; - } - - /* - * @static function setConfig - * @param string $name - * @param mixed $value - */ - - /** - * @param null $name - * @param null $value - * - * @return mixed - */ - public function setConfig($name = null, $value = null) - { - if (null === $this->config) { - $this->initConfig(); - } - $this->config[$name] = $value; - $this->addLog("Setting config '{$name}' : " . $this->config[$name]); - - return $this->config[$name]; - } - - /* - * @static function getHandler - * @param string $name - */ - - /** - * @param $name - * - * @return mixed - */ - public function &getHandler($name) - { - if (!isset($this->handler[$name . 'Handler'])) { - $this->initHandler($name); - } - $this->addLog("Getting handler '{$name}'"); - - return $this->handler[$name . 'Handler']; - } - - /* - * @static function initModule - * @param null - */ - public function initModule() - { - global $xoopsModule; - if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $this->dirname) { - $this->module = $xoopsModule; - } else { - $hModule = xoops_getHandler('module'); - $this->module = $hModule->getByDirname($this->dirname); - } - $this->addLog('INIT MODULE'); - } - - /* - * @static function initConfig - * @param null - */ - public function initConfig() - { - $this->addLog('INIT CONFIG'); - $hModConfig = xoops_getHandler('config'); - $this->config = $hModConfig->getConfigsByCat(0, $this->getModule()->getVar('mid')); - } - - /* - * @static function initHandler - * @param string $name - */ - - /** - * @param $name - */ - public function initHandler($name) - { - $this->addLog('INIT ' . $name . ' HANDLER'); - $this->handler[$name . 'Handler'] = xoops_getModuleHandler($name, $this->dirname); - } - - /* - * @static function addLog - * @param string $log - */ - - /** - * @param $log - */ - public function addLog($log) - { - if ($this->debug && is_object($GLOBALS['xoopsLogger'])) { - $GLOBALS['xoopsLogger']->addExtra($this->module->name(), $log); - } - } -} diff --git a/class/index.html b/class/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/class/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/index.php b/class/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/class/index.php @@ -0,0 +1,2 @@ + - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ - -use Xmf\Request; - -include __DIR__ . '/header.php'; - -$adminObject = \Xmf\Module\Admin::getInstance(); - -$feedback = new \XoopsModules\Tdmcreate\Common\ModuleFeedback(); - -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -$moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname'); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -xoops_loadLanguage('feedback', $moduleDirName); - -//xoops_cp_header(); - -switch ($op) { - case 'list': - default: - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); - $feedback->name = $GLOBALS['xoopsUser']->getVar('name'); - $feedback->email = $GLOBALS['xoopsUser']->getVar('email'); - $feedback->site = XOOPS_URL; - $form = $feedback->getFormFeedback(); - $form->display(); - break; - case 'send': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - - $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', ''); - $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'); - $body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
      '; - $body .= $fb_content; - $xoopsMailer = xoops_getMailer(); - $xoopsMailer->useMail(); - $xoopsMailer->setToEmails($GLOBALS['xoopsModule']->getInfo('author_mail')); - $xoopsMailer->setFromEmail($your_mail); - $xoopsMailer->setFromName($your_name); - $xoopsMailer->setSubject($title); - $xoopsMailer->multimailer->isHTML(true); - $xoopsMailer->setBody($body); - $ret = $xoopsMailer->send(); - if ($ret) { - redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); - } - - // show form with content again - $feedback->name = $your_name; - $feedback->email = $your_mail; - $feedback->site = $your_site; - $feedback->type = $fb_type; - $feedback->content = $fb_content; - echo '
      -

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

      -
      '; - $form = $feedback->getFormFeedback(); - $form->display(); - - break; -} -require __DIR__ . '/footer.php'; diff --git a/commonfiles/assets/icons/16/index.html b/commonfiles/assets/icons/16/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/assets/icons/16/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/assets/icons/32/index.html b/commonfiles/assets/icons/32/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/assets/icons/32/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/assets/icons/index.html b/commonfiles/assets/icons/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/assets/icons/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/class/Common/Breadcrumb.php b/commonfiles/class/Common/Breadcrumb.php deleted file mode 100644 index 29b08f7a..00000000 --- a/commonfiles/class/Common/Breadcrumb.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @package Tdmcreate - * - * Example: - * $breadcrumb = new Common\Breadcrumb(); - * $breadcrumb->addLink( 'bread 1', 'index1.php' ); - * $breadcrumb->addLink( 'bread 2', '' ); - * $breadcrumb->addLink( 'bread 3', 'index3.php' ); - * echo $breadcrumb->render(); - */ - -use XoopsModules\Tdmcreate; -use XoopsModules\Tdmcreate\Common; - -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); - -/** - * Class Breadcrumb - */ -class Breadcrumb -{ - public $dirname; - private $bread = []; - - public function __construct() - { - $this->dirname = basename(dirname(dirname(__DIR__))); - } - - /** - * Add link to breadcrumb - * - * @param string $title - * @param string $link - */ - public function addLink($title = '', $link = '') - { - $this->bread[] = [ - 'link' => $link, - 'title' => $title, - ]; - } - - /** - * Render BreadCrumb - */ - public function render() - { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { - require $GLOBALS['xoops']->path('class/theme.php'); - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); - } - - require $GLOBALS['xoops']->path('class/template.php'); - $breadcrumbTpl = new \XoopsTpl(); - $breadcrumbTpl->assign('breadcrumb', $this->bread); - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); - unset($breadcrumbTpl); - - return $html; - } -} diff --git a/commonfiles/class/Common/Configurator.php b/commonfiles/class/Common/Configurator.php deleted file mode 100644 index 2f06d4b5..00000000 --- a/commonfiles/class/Common/Configurator.php +++ /dev/null @@ -1,68 +0,0 @@ -name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; - $this->copyTestFolders = $config->copyTestFolders; - $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->renameTables = $config->renameTables; - $this->moduleStats = $config->moduleStats; - $this->modCopyright = $config->modCopyright; - } -} diff --git a/commonfiles/class/Common/FilesManagement.php b/commonfiles/class/Common/FilesManagement.php deleted file mode 100644 index 549ef697..00000000 --- a/commonfiles/class/Common/FilesManagement.php +++ /dev/null @@ -1,294 +0,0 @@ - - */ -trait FilesManagement -{ - /** - * Function responsible for checking if a directory exists, we can also write in and create an index.html file - * - * @param string $folder The full path of the directory to check - * - * @return void - * @throws \RuntimeException - */ - public static function createFolder($folder) - { - try { - if (!file_exists($folder)) { - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); - } - - file_put_contents($folder . '/index.html', ''); - } - } catch (\Exception $e) { - echo 'Caught exception: ', $e->getMessage(), '
      '; - } - } - - /** - * @param $file - * @param $folder - * @return bool - */ - public static function copyFile($file, $folder) - { - return copy($file, $folder); - } - - /** - * @param $src - * @param $dst - */ - public static function recurseCopy($src, $dst) - { - $dir = opendir($src); - // @mkdir($dst); - if (!@mkdir($dst) && !is_dir($dst)) { - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); - } - while (false !== ($file = readdir($dir))) { - if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); - } else { - copy($src . '/' . $file, $dst . '/' . $file); - } - } - } - closedir($dir); - } - - /** - * Copy a file, or recursively copy a folder and its contents - * @param string $source Source path - * @param string $dest Destination path - * @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/ - */ - public static function xcopy($source, $dest) - { - // Check for symlinks - if (is_link($source)) { - return symlink(readlink($source), $dest); - } - - // Simple copy for a file - if (is_file($source)) { - return copy($source, $dest); - } - - // Make destination directory - if (!is_dir($dest)) { - if (!mkdir($dest) && !is_dir($dest)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dest)); - } - } - - // Loop through the folder - $dir = dir($source); - if (@is_dir($dir)) { - while (false !== $entry = $dir->read()) { - // Skip pointers - if ('.' === $entry || '..' === $entry) { - continue; - } - // Deep copy directories - self::xcopy("$source/$entry", "$dest/$entry"); - } - // Clean up - $dir->close(); - } - - return true; - } - - /** - * Remove files and (sub)directories - * - * @param string $src source directory to delete - * - * @return bool true on success - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @uses \Xmf\Module\Helper::getHelper() - */ - public static function deleteDirectory($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - $success = true; - // remove old files - $dirInfo = new \SplFileInfo($src); - // validate is a directory - if ($dirInfo->isDir()) { - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); - foreach ($fileList as $k => $v) { - $fileInfo = new \SplFileInfo("{$src}/{$v}"); - if ($fileInfo->isDir()) { - // recursively handle subdirectories - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { - break; - } - } else { - // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { - break; - } - } - } - // now delete this (sub)directory if all the files are gone - if ($success) { - $success = rmdir($dirInfo->getRealPath()); - } - } else { - // input is not a valid directory - $success = false; - } - - return $success; - } - - /** - * Recursively remove directory - * - * @todo currently won't remove directories with hidden files, should it? - * - * @param string $src directory to remove (delete) - * - * @return bool true on success - */ - public static function rrmdir($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - $success = true; - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file - if (!unlink($filename)) { - return false; // couldn't delete the file - } - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rrmdir($fObj->getPathname()); - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively move files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - */ - public static function rmove($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - // rmdir($fObj->getPath()); // now delete the directory - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively copy directories and files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @uses \Xmf\Module\Helper::getHelper() - */ - public static function rcopy($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } - } - - return true; - } -} diff --git a/commonfiles/class/Common/Migrate.php b/commonfiles/class/Common/Migrate.php deleted file mode 100644 index 9d0f495a..00000000 --- a/commonfiles/class/Common/Migrate.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @link https://xoops.org - */ - -class Migrate extends \Xmf\Database\Migrate -{ - private $renameTables; - - /** - * Migrate constructor. - * @param Common\Configurator $configurator - * @throws \RuntimeException - * @throws \InvalidArgumentException - */ - public function __construct(Common\Configurator $configurator = null) - { - if (null !== $configurator) { - $this->renameTables = $configurator->renameTables; - - $moduleDirName = basename(dirname(dirname(__DIR__))); - parent::__construct($moduleDirName); - } - } - - /** - * change table prefix if needed - */ - private function changePrefix() - { - foreach ($this->renameTables as $oldName => $newName) { - if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { - $this->tableHandler->renameTable($oldName, $newName); - } - } - } - - /** - * Change integer IPv4 column to varchar IPv6 capable - * - * @param string $tableName table to convert - * @param string $columnName column with IP address - */ - private function convertIPAddresses($tableName, $columnName) - { - if ($this->tableHandler->useTable($tableName)) { - $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); - if (false !== mb_strpos($attributes, ' int(')) { - if (false === mb_strpos($attributes, 'unsigned')) { - $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); - $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); - } - $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45) NOT NULL DEFAULT '' "); - $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false); - } - } - } - - /** - * Move do* columns from newbb_posts to newbb_posts_text table - */ - private function moveDoColumns() - { - $tableName = 'newbb_posts_text'; - $srcTableName = 'newbb_posts'; - if ($this->tableHandler->useTable($tableName) - && $this->tableHandler->useTable($srcTableName)) { - $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml'); - if (false === $attributes) { - $this->synchronizeTable($tableName); - $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); - $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); - $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; - $this->tableHandler->addToQueue($sql); - } - } - } - - /** - * Perform any upfront actions before synchronizing the schema - * - * Some typical uses include - * table and column renames - * data conversions - */ - protected function preSyncActions() - { - /* - // change 'bb' table prefix to 'newbb' - $this->changePrefix(); - // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point - $this->moveDoColumns(); - // Convert IP address columns from int to readable varchar(45) for IPv6 - $this->convertIPAddresses('newbb_posts', 'poster_ip'); - $this->convertIPAddresses('newbb_report', 'reporter_ip'); - */ - } -} diff --git a/commonfiles/class/Common/ModuleFeedback.php b/commonfiles/class/Common/ModuleFeedback.php deleted file mode 100644 index 538c48c4..00000000 --- a/commonfiles/class/Common/ModuleFeedback.php +++ /dev/null @@ -1,115 +0,0 @@ - - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object ModuleFeedback - */ -class ModuleFeedback extends \XoopsObject -{ - public $name = ''; - public $email = ''; - public $site = ''; - public $type = ''; - public $content = ''; - - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * @public function getFormFeedback: - * provide form for sending a feedback to module author - * @return \XoopsThemeForm - */ - public function getFormFeedback() - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $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')); - $recipient->setExtra('disabled="disabled"'); - $form->addElement($recipient); - $your_name = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); - $your_name->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); - $form->addElement($your_name); - $your_site = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); - $your_site->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); - $form->addElement($your_site); - $your_mail = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); - $your_mail->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); - $form->addElement($your_mail); - - $fbtypeSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); - $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')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); - $form->addElement($fbtypeSelect, true); - - $editorConfigs = []; - $editorConfigs['name'] = 'fb_content'; - $editorConfigs['value'] = $this->content; - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname('system'); - $configHandler = xoops_getHandler('config'); - $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); - - $form->addElement(new \XoopsFormHidden('op', 'send')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - - return $form; - } -} diff --git a/commonfiles/class/Common/ModuleStats.php b/commonfiles/class/Common/ModuleStats.php deleted file mode 100644 index 4e9ccda1..00000000 --- a/commonfiles/class/Common/ModuleStats.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -trait ModuleStats -{ - /** - * @param \XoopsModules\Tdmcreate\Common\Configurator $configurator - * @param array $moduleStats - * @return array - */ - public static function getModuleStats($configurator, $moduleStats) - { - if (count($configurator->moduleStats) > 0) { - foreach (array_keys($configurator->moduleStats) as $i) { - $moduleStats[$i] = $configurator->moduleStats[$i]; - } - } - - return $moduleStats; - } -} diff --git a/commonfiles/class/Common/Resizer.php b/commonfiles/class/Common/Resizer.php deleted file mode 100644 index 6668f550..00000000 --- a/commonfiles/class/Common/Resizer.php +++ /dev/null @@ -1,296 +0,0 @@ - - Website: - * @version $Id: 1.0 Resizer.php 1 Mon 2019-02-09 10:04:49Z XOOPS Project (www.xoops.org) $ - */ -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 = ''; - - /** - * resize image if size exceed given width/height - * @return string|bool - */ - public function resizeImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $img = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $img = imagecreatefromjpeg($this->sourceFile); - if (!$img) { - $img = imagecreatefromstring(file_get_contents($this->sourceFile)); - } - break; - case 'image/gif': - $img = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - $width = imagesx($img); - $height = imagesy($img); - - if ($width > $this->maxWidth || $height > $this->maxHeight) { - // recalc image size based on this->maxWidth/this->maxHeight - $new_width = 0; - $new_height = 0; - if ($width > $height) { - if ($width < $this->maxWidth) { - $new_width = $width; - } else { - $new_width = $this->maxWidth; - $divisor = $width / $new_width; - $new_height = floor($height / $divisor); - } - } elseif ($height < $this->maxHeight) { - $new_height = $height; - } else { - $new_height = $this->maxHeight; - $divisor = $height / $new_height; - $new_width = floor($width / $divisor); - } - - // Create a new temporary image. - $tmpimg = imagecreatetruecolor($new_width, $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); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - imagepng($tmpimg, $this->endFile, 0); - break; - case 'image/jpeg': - imagejpeg($tmpimg, $this->endFile, 100); - break; - case 'image/gif': - imagegif($tmpimg, $this->endFile); - break; - } - - // release the memory - imagedestroy($tmpimg); - } else { - return 'copy'; - } - imagedestroy($img); - - return true; - } - - /** - * @return bool|string - */ - public function resizeAndCrop() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // GET ORIGINAL IMAGE DIMENSIONS - list($original_w, $original_h) = getimagesize($this->sourceFile); - - // RESIZE IMAGE AND PRESERVE PROPORTIONS - $max_width_resize = $this->maxWidth; - $max_height_resize = $this->maxHeight; - if ($original_w > $original_h) { - $max_height_ratio = $this->maxHeight / $original_h; - $max_width_resize = (int)round($original_w * $max_height_ratio); - } else { - $max_width_ratio = $this->maxWidth / $original_w; - $max_height_resize = (int)round($original_h * $max_width_ratio); - } - if ($max_width_resize < $this->maxWidth) { - $max_height_ratio = $this->maxWidth / $max_width_resize; - $max_height_resize = (int)round($this->maxHeight * $max_height_ratio); - $max_width_resize = $this->maxWidth; - } - - // CREATE THE PROPORTIONAL IMAGE RESOURCE - $thumb = imagecreatetruecolor($max_width_resize, $max_height_resize); - if (!imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { - return false; - } - // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS - $final = imagecreatetruecolor($this->maxWidth, $this->maxHeight); - - $max_width_offset = 0; - $max_height_offset = 0; - if ($this->maxWidth < $max_width_resize) { - $max_width_offset = (int)round(($max_width_resize - $this->maxWidth) / 2); - } else { - $max_height_offset = (int)round(($max_height_resize - $this->maxHeight) / 2); - } - - if (!imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { - return false; - } - // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile - if (!imagejpeg($final, $this->endFile, $this->jpgQuality)) { - return false; - } - - return true; - } - - public function mergeImage() - { - $dest = imagecreatefromjpeg($this->endFile); - $src = imagecreatefromjpeg($this->sourceFile); - if (4 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 2 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 2 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 3: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 4: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - if (6 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 3 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 3 + 1); - $posCol3 = $posCol2 + (int)round($this->maxWidth / 3 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center - break; - case 3: - imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 4: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 5: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center - break; - case 6: - imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - imagejpeg($dest, $this->endFile); - - imagedestroy($src); - imagedestroy($dest); - } - - /** - * @return bool|string - */ - public function rotateImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // Rotate - $tmpimg = imagerotate($original, $this->degrees, 0); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - if (!imagepng($tmpimg, $this->endFile, 0)) { - return false; - } - break; - case 'image/jpeg': - if (!imagejpeg($tmpimg, $this->endFile, $this->jpgQuality)) { - return false; - } - break; - case 'image/gif': - if (!imagegif($tmpimg, $this->endFile)) { - return false; - } - break; - } - - // release the memory - imagedestroy($tmpimg); - - return true; - } -} diff --git a/commonfiles/class/Common/ServerStats.php b/commonfiles/class/Common/ServerStats.php deleted file mode 100644 index d574d2d9..00000000 --- a/commonfiles/class/Common/ServerStats.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -trait ServerStats -{ - /** - * serverStats() - * - * @return string - */ - public static function getServerStats() - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - $html = ''; - // $sql = 'SELECT metavalue'; - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); - // $sql .= " WHERE metakey='version' LIMIT 1"; - // $query = $GLOBALS['xoopsDB']->query($sql); - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= '
      '; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; - $html .= "
      "; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; - // $html .= "
      "; - // $html .= "
      "; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; - $html .= '
        '; - - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; - } - } - - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - - // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; - $html .= '
      '; - $html .= '
        '; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; - $html .= '
      '; - $html .= '
      '; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; - $html .= '
      '; - $html .= '

      '; - - return $html; - } -} diff --git a/commonfiles/class/Common/VersionChecks.php b/commonfiles/class/Common/VersionChecks.php deleted file mode 100644 index 54d930d1..00000000 --- a/commonfiles/class/Common/VersionChecks.php +++ /dev/null @@ -1,144 +0,0 @@ - - */ -trait VersionChecks -{ - /** - * Verifies XOOPS version meets minimum requirements for this module - * @static - * - * @param null|string $requiredVer - * @return bool true if meets requirements, false if not - */ - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - - //check for minimum XOOPS version - $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 - } - $success = true; - - if (version_compare($currentVer, $requiredVer, '<')) { - $success = false; - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); - } - - return $success; - } - - /** - * Verifies PHP version meets minimum requirements for this module - * @static - * - * @return bool true if meets requirements, false if not - */ - public static function checkVerPhp(\XoopsModule $module = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - // check for minimum PHP version - $success = true; - - $verNum = PHP_VERSION; - $reqVer = &$module->getInfo('min_php'); - - if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); - $success = false; - } - } - - return $success; - } - - /** - * compares current module version with latest GitHub release - * @static - * @param \Xmf\Module\Helper $helper - * @param string|null $source - * @param string|null $default - * - * @return string|array info about the latest module version, if newer - */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; - // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; - $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"]); - $curlReturn = curl_exec($curlHandle); - if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); - } elseif (mb_strpos($curlReturn, 'Not Found')) { - 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); - $latestVersion = $file[0]->tag_name; - $prerelease = $file[0]->prerelease; - if ('master' !== $latestVersionLink) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; - } - //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); - if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); - } - $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); - //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); - // $moduleVersion = '1.0'; //for testing only - // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { - $ret = []; - $ret[] = $update; - $ret[] = $latestVersionLink; - } - } - curl_close($curlHandle); - } - } - - return $ret; - } -} diff --git a/commonfiles/class/Common/index.html b/commonfiles/class/Common/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/include/install.php b/commonfiles/include/install.php deleted file mode 100644 index 45d9bd7b..00000000 --- a/commonfiles/include/install.php +++ /dev/null @@ -1,95 +0,0 @@ - - Website: XOOPS Project (www.xoops.org) $ - */ - -use XoopsModules\Tdmcreate; -use XoopsModules\Tdmcreate\Common; - -/** - * @param \XoopsModule $module - * @return bool - */ -function xoops_module_pre_install_tdmcreate(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Tdmcreate\Utility $utility */ - $utility = new Tdmcreate\Utility(); - - //check for minimum XOOPS version - $xoopsSuccess = $utility::checkVerXoops($module); - - // check for minimum PHP version - $phpSuccess = $utility::checkVerPhp($module); - - if (false !== $xoopsSuccess && false !== $phpSuccess) { - $moduleTables = &$module->getInfo('tables'); - foreach ($moduleTables as $table) { - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); - } - } - - return $xoopsSuccess && $phpSuccess; -} - -/** - * @param \XoopsModule $module - * @return bool|string - */ -function xoops_module_install_tdmcreate(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - - /** @var Tdmcreate\Helper $helper */ - /** @var Tdmcreate\Utility $utility */ - /** @var Common\Configurator $configurator */ - $helper = Tdmcreate\Helper::getInstance(); - $utility = new Tdmcreate\Utility(); - $configurator = new Common\Configurator(); - - // Load language files - $helper->loadLanguage('admin'); - $helper->loadLanguage('modinfo'); - $helper->loadLanguage('common'); - - // --- CREATE FOLDERS --------------- - if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - foreach (array_keys($configurator->uploadFolders) as $i) { - $utility::createFolder($configurator->uploadFolders[$i]); - } - } - - // --- COPY blank.gif FILES --------------- - if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $file = dirname(__DIR__) . '/assets/images/blank.gif'; - foreach (array_keys($configurator->copyBlankFiles) as $i) { - $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; -} diff --git a/commonfiles/include/uninstall.php b/commonfiles/include/uninstall.php deleted file mode 100644 index d01c9722..00000000 --- a/commonfiles/include/uninstall.php +++ /dev/null @@ -1,78 +0,0 @@ -loadLanguage('admin'); - - //------------------------------------------------------------------ - // Remove uploads folder (and all subfolders) if they exist - //------------------------------------------------------------------ - - $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; - } - } - unset($dirInfo); - } - /* - //------------ START ---------------- - //------------------------------------------------------------------ - // Remove xsitemap.xml from XOOPS root folder if it exists - //------------------------------------------------------------------ - $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); - if (is_file($xmlfile)) { - if (false === ($delOk = unlink($xmlfile))) { - $module->setErrors(sprintf(_AM_TDMCREATE_ERROR_BAD_REMOVE, $xmlfile)); - } - } -// return $success && $delOk; // use this if you're using this routine -*/ - - return $success; - //------------ END ---------------- -} diff --git a/commonfiles/include/update.php b/commonfiles/include/update.php deleted file mode 100644 index cec36789..00000000 --- a/commonfiles/include/update.php +++ /dev/null @@ -1,154 +0,0 @@ - - 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 - */ - -/** - * @param $module - * @param null $prev_version - * - * @return bool|null - */ -function xoops_module_update_tdmcreate(&$module, $prev_version = null) -{ - $ret = null; - if ($prev_version < 10) { - $ret = update_tdmcreate_v10($module); - } - - $ret = tdmcreate_check_db($module); - - //check upload directory - include_once __DIR__ . '/install.php'; - $ret = xoops_module_install_tdmcreate($module); - - $errors = $module->getErrors(); - if (!empty($errors)) { - print_r($errors); - } - - return $ret; - -} - -// irmtfan bug fix: solve templates duplicate issue -/** - * @param $module - * - * @return bool - */ -function update_tdmcreate_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 (false !== (list($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 - * - * @return bool - */ -function tdmcreate_check_db($module) -{ - $ret = true; - //insert here code for database check - - /* - // Example: update table (add new field) - $table = $GLOBALS['xoopsDB']->prefix('tdmcreate_images'); - $field = 'img_exif'; - $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if (!$numRows) { - $sql = "ALTER TABLE `$table` ADD `$field` TEXT NULL AFTER `img_state`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); - $module->setErrors("Error when adding '$field' to table '$table'."); - $ret = false; - } - } - - // Example: create new table - $table = $GLOBALS['xoopsDB']->prefix('tdmcreate_categories'); - $check = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if (!$numRows) { - // create new table 'tdmcreate_categories' - $sql = "CREATE TABLE `$table` ( - `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `cat_text` VARCHAR(100) NOT NULL DEFAULT '', - `cat_date` INT(8) NOT NULL DEFAULT '0', - `cat_submitter` INT(8) NOT NULL DEFAULT '0', - PRIMARY KEY (`cat_id`) - ) ENGINE=InnoDB;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); - $module->setErrors("Error when creating table '$table'."); - $ret = false; - } - } - */ - return $ret; -} diff --git a/commonfiles/include/xoops_version.inc.php b/commonfiles/include/xoops_version.inc.php deleted file mode 100644 index 66bde274..00000000 --- a/commonfiles/include/xoops_version.inc.php +++ /dev/null @@ -1,40 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/commonfiles/language/english/feedback.php b/commonfiles/language/english/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/commonfiles/language/english/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/commonfiles/language/english/index.html b/commonfiles/language/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/language/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/language/index.html b/commonfiles/language/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/language/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/preloads/autoloader.php b/commonfiles/preloads/autoloader.php deleted file mode 100644 index e23c6e01..00000000 --- a/commonfiles/preloads/autoloader.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access.'); - -/** - * Class TdmcreateCorePreload - */ -class TdmcreateCorePreload extends \XoopsPreloadItem -{ - // to add PSR-4 autoloader - - /** - * @param $args - */ - public static function eventCoreIncludeCommonEnd($args) - { - include __DIR__ . '/autoloader.php'; - } -} diff --git a/commonfiles/preloads/index.html b/commonfiles/preloads/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/commonfiles/preloads/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/commonfiles/testdata/english/index.html b/commonfiles/testdata/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/testdata/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/testdata/images/index.html b/commonfiles/testdata/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/testdata/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/testdata/index.html b/commonfiles/testdata/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/commonfiles/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/commonfiles/testdata/index.php b/commonfiles/testdata/index.php deleted file mode 100644 index 8818dd91..00000000 --- a/commonfiles/testdata/index.php +++ /dev/null @@ -1,207 +0,0 @@ -loadLanguage('common'); - -switch ($op) { - case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('../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_cp_footer(); - } - break; - case 'save': - saveSampleData(); - break; -} - -// XMF TableLoad for SAMPLE data - -function loadSampleData() -{ - global $xoopsConfig; - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $utility = new Tdmcreate\Utility(); - $configurator = new Common\Configurator(); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { - $language = $xoopsConfig['language'] . '/'; - } - - // load module tables - foreach ($tables as $table) { - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - \Xmf\Database\TableLoad::truncateTable($table); - \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); - } - - // load permissions - $table = 'group_permission'; - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - $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 = __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')); -} - -function saveSampleData() -{ - global $xoopsConfig; - - $configurator = new Common\Configurator(); - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; - if (!file_exists($languageFolder . '/')) { - Utility::createFolder($languageFolder . '/'); - } - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; - Utility::createFolder($exportFolder); - - // save module tables - foreach ($tables as $table) { - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); - } - - // save permissions - $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('gperm_modid', \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); - $skipColumns[] = 'gperm_id'; - \Xmf\Database\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 . '_' . 'SAMPLEDATA_SUCCESS')); -} - -function exportSchema() -{ - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - try { - // TODO set exportSchema - // $migrate = new Tdmcreate\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')); - } - -} - -/** - * loadTableFromArrayWithReplace - * - * @param string $table value with should be used insead of original value of $search - * - * @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) -{ - /** @var \XoopsDatabase */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - - $prefixedTable = $db->prefix($table); - $count = 0; - - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); - - $result = $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 .= ', '; - } - - $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; - } - } - - return $count; -} diff --git a/config/config.php b/config/config.php index f24c53cf..02fb9274 100644 --- a/config/config.php +++ b/config/config.php @@ -1,4 +1,4 @@ - mb_strtoupper($moduleDirName) . ' ModuleConfigurator', + 'name' => \mb_strtoupper($moduleDirName) . ' ModuleConfigurator', 'paths' => [ 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + 'admin' => \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => \XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => \XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => \XOOPS_UPLOAD_URL . '/' . $moduleDirName, ], 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/modules', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/tables', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/repository', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/temp', - //XOOPS_UPLOAD_PATH . '/flags' + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/modules', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/tables', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/repository', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/temp', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/devtools', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/devtools/fq', ], 'copyBlankFiles' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/modules', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/tables', - //XOOPS_UPLOAD_PATH . '/flags' + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/modules', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/tables', + ], + 'copyEmptyFiles' => [ + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/modules', ], 'copyTestFolders' => [ [ - XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', + \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/images', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', ], // [ - // XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', - // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', + // \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', + // \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', // ], ], @@ -86,5 +89,5 @@ // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), ], 'modCopyright' => " - XOOPS Project", + XOOPS Project", ]; diff --git a/config/icons.php b/config/icons.php index 0eba0bc5..d89bb2f8 100644 --- a/config/icons.php +++ b/config/icons.php @@ -1,20 +1,20 @@ - mb_strtoupper($moduleDirName) . ' IconConfigurator', + 'name' => \mb_strtoupper($moduleDirName) . ' IconConfigurator', 'icons' => [ - 'edit' => " . _EDIT . ", - 'delete' => "" . _DELETE . "", - 'clone' => "" . _CLONE . "", - 'preview' => "" . _PREVIEW . "", - 'print' => "" . _CLONE . "", - 'pdf' => "" . _CLONE . "", - 'add' => "" . _ADD . "", + 'edit' => " . \_EDIT . ", + 'delete' => "" . \_DELETE . "", + 'clone' => "" . \_CLONE . "", + 'preview' => "" . \_PREVIEW . "", + 'print' => "" . \_CLONE . "", + 'pdf' => "" . \_CLONE . "", + 'add' => "" . \_ADD . "", '0' => "" . 0 . "", '1' => "" . 1 . "", ], diff --git a/config/index.html b/config/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/config/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/config/index.php b/config/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/config/index.php @@ -0,0 +1,2 @@ + mb_strtoupper($moduleDirName) . ' PathConfigurator', + 'name' => \mb_strtoupper($moduleDirName) . ' PathConfigurator', 'paths' => [ 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + 'admin' => \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => \XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => \XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => \XOOPS_UPLOAD_URL . '/' . $moduleDirName, ], 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + \XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //\XOOPS_UPLOAD_PATH . '/flags' ], ]; } diff --git a/docs/changelog.txt b/docs/changelog.txt index 61f2dff6..1d8bf712 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,44 +1,253 @@ -
      3.02 Alpha 1 [WORK IN PROGRESS - NOT RELEASED]
      Dev: XOOPS 2.5.11, PHP 7.4.2 +
      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) + - 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) + - 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) + - 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) + - 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) + - 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) + +
      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) +- template usage (goffy) +- add result handling (goffy) +- 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) +- added block spotlight (liomj/goffy) +- fixed bug in field size (liomj/goffy) +- fixed bug in permissionUpload (liomj/goffy) +- 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) +- table renaming in fieldelements (goffy) +- added new fieldelements integer/float (goffy) +- uninstall with bak-file creation (mamba/goffy) +- module update to php8 (mamba) +- fix bug in type cast (liomj/goffy) +- 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) + +
      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) + - changed font color (jjdai/goffy) + +
      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) + - implemented additional prebuilding check (goffy) + - cosmetics (mamba/goffy) + - added "declare(strict_types=1);" to php file creation (goffy) + - changed default size date/datetime field to 11 (mamba/goffy) + - changed default chmod of upload folders to 0777 (mamba/goffy) + - fixed lang bug in XoopsConfirm (mamba/goffy) + - increased default size for IP field (mamba/goffy) + - fixed lang in blocks (heyula/goffy) + - added link in blocks (heyula/goffy) + - fixed problem in XoopsConfirm (goffy) + - fixed missing default values in smarty in modulebuilder itself (mamba/goffy) + - fixed missing default values in smarty in created modules (mamba/goffy) + - added item title to page title (heyula/goffy) + - added counter for reads (heyula/goffy) + - added constants for field elements types (goffy) + - fixed bug in creation of block (heyula/goffy) + - improved breadcrumb handling (goffy) + - replaced index.html by index.php (goffy) + - added replacement of tabs by 4 spaces in devtools (goffy) + - fixed bug with unnecessary index.php files adex by index_scan (mjoel/goffy) + - fixed bug if no permissions are used (goffy) + - added default value for date/time form field (goffy) + - fixed bug in permissionHandler (goffy) + - fixed bug with ..._LIST (mjoel/goffy) + - 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) + - 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
      -- 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) +- moved to final (goffy) + +
      3.04 RC 1 [2020-07-09]
      Dev: XOOPS 2.5.11, PHP 7.4.5 +
      +- unqualified function references (mamba/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) +- deleted folder archive (goffy) +- added uuid and IP textbox field (mamba/goffy) +- fixed problem with missing empy.png (cesagonchu/goffy) +- fixed bug with mb_strtolower for dir creation (cesagonchu/goffy) +- fixed problems with missing tables and fields (cesagonchu/goffy) +- added developer tool function qualifier (goffy) +- added developer tool check language files (goffy) +- fixed problems with breadcrumb template (cesagonchu/goffy) +- added default type and value for table fieldelements (goffy) +- fixed bug in deleting table from fieldelements (goffy) +- added check for sql creation (goffy) +- delete fields if table is deleted (goffy) +- delete fields, tables, morefiles when deleting module (goffy) +- fixed bug in creation of user header.php (goffy) +- fixed bug in creation of user pages files (goffy) +- cosmetics for sorting (goffy) +- fixed bugs in pdf creation (goffy) +- allow pdf creation for multiple tables (goffy) +- changed pdf output template based (goffy) +- fixed bugs in print output (goffy) +- fixed problem for modules without user pages (goffy) + +
      3.04 Alpha 1 [2020-06-12]
      Dev: XOOPS 2.5.11, PHP 7.4.5 +
      +- fixed bugs in creation of more files (goffy) +- added possibility to add own files via more files (goffy) +- implementation new xoops_confirm (geekwright/goffy) +- fixed bug in creation of config files (goffy) +- implementation of experience from wgtransifex (mamba/goffy) +- fixed bug date in blocks (heyula/goffy) +- replaced strtotime by \DateTime::createFromFormat (goffy) +- creation of table components/links only if table is for user side (goffy) + +
      3.03 Alpha 5 [2020-06-09]
      Dev: XOOPS 2.5.11, PHP 7.4.5 +
      +- new alpha release (goffy) + +
      3.03 Alpha 4 [2020-05-11]
      Dev: XOOPS 2.5.11, PHP 7.4.5 +
      +- missing folder name (mamba) +- changed date integer to 11 (mamba) +- fix removed extra comma in generated FormUploadImage code (mamba) +- added schema (mamba) +- renamed "handler" to "Handler" in generated code (heyula/mamba) +- removed call to include Helper.php file (mamba) +- fix copying logo file (mamba) +- fix missing include of notification tpl (goffy) +- added first missing templates for notifications (goffy) +- added notification broken event (goffy) +- added possibility to store/restore testdata of created module (goffy) +- switched to single editor selector (mamba/goffy) +- changed constants class into interface (zyspec/goffy) +- added next steps notification event (goffy) +- added notification event new, modify, approve (goffy) +- added yoda condition (goffy) +- editor admin/user (mamba/goffy) +- added check quality/inconsistences of module data before building (goffy) +- fixed bugs in comments handling (goffy) +- added notification comments (goffy) +- added permission check approve (goffy) +- fixed bug for active settings (goffy) +- restructured admin language file/removed duuplicates (goffy) +- implementation new xoops_confirm - step 1 (goffy) +- transfered class::getInstance() to class _construct (mamba/goffy) +- code documentation cleaning (goffy) +- fixed bug with ENUM (mamba/goffy) +- fixed bug with changing field/table properties via image (mamba/goffy) +- implementation new xoops_confirm (geekwright/goffy) +- implemted rating system (stars, likes and numeric) (goffy) + +
      3.03 Alpha 3 [WORK IN PROGRESS - NOT RELEASED]
      Dev: XOOPS 2.5.11, PHP 7.4.5 +
      +- fix class names to case-sensitive (heyula/mamba) +- fix folder names to case-sensitive (mamba) +- add folder & file checkers (mamba) +- add SysUtility class (mamba) +- fix $pathIcon16 (mamba) +- add __NAMESPACE__ to Helper (mamba) +- splitted contend of index file and page file (goffy) +- removed old testdata (goffy) + +
      3.03 Alpha 2 [WORK IN PROGRESS - NOT RELEASED]
      Dev: XOOPS 2.5.11, PHP 7.4.5 +
      +- rename to ModuleBuilder (mamba) + + +
      3.02 Alpha 1 [WORK IN PROGRESS - NOT RELEASED]
      Dev: XOOPS 2.5.11, PHP 7.4.2 +
      +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 @@ -46,280 +255,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 ModuleBuilderHTMLCode, ModuleBuilderHTMLSmartyCode (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 modulebuilder\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) diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/index.php b/docs/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/docs/index.php @@ -0,0 +1,2 @@ + - Website: + * @version $Id: 1.0 images.php 1 Mon 2018-03-19 10:04:51Z XOOPS Project (www.xoops.org) $ + */ + +use Xmf\Request; + +require __DIR__ . '/header.php'; +// It recovered the value of argument op in URL$ +$op = Request::getString('op', 'list'); + +$templateMain = 'modulebuilder_admin_clone.tpl'; + +switch ($op) { + case 'list': + default: + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('clone.php')); + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + $form = new \XoopsThemeForm(\sprintf(\_AM_MODULEBUILDER_CLONE_TITLE, $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true); + $clone = new \XoopsFormText(\_AM_MODULEBUILDER_CLONE_NAME, 'clone', 20, 20, ''); + $clone->setDescription(\_AM_MODULEBUILDER_CLONE_NAME_DSC); + $form->addElement($clone, true); + $form->addElement(new \XoopsFormHidden('op', 'submit')); + $form->addElement(new \XoopsFormButton('', '', \_SUBMIT, 'submit')); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + + break; + case 'submit': + // Security Check + if (!$GLOBALS['xoopsSecurity']->check()) { + \redirect_header('clone.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + $clone = Request::getString('clone', '', 'POST'); + //check if name is valid + if (empty($clone) || \preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) { + \redirect_header('clone.php', 3, \sprintf(\_AM_MODULEBUILDER_CLONE_INVALIDNAME, $clone)); + } + + // Check wether the cloned module exists or not + $dirClone = $GLOBALS['xoops']->path('modules/' . $clone); + if ($clone && \is_dir($dirClone)) { + \redirect_header('clone.php', 3, \sprintf(\_AM_MODULEBUILDER_CLONE_EXISTS, $clone)); + } + + $patterns = [ + \mb_strtolower(\MODULEBUILDER_DIRNAME) => \mb_strtolower($clone), + \mb_strtoupper(\MODULEBUILDER_DIRNAME) => \mb_strtoupper($clone), + \ucfirst(\mb_strtolower(\MODULEBUILDER_DIRNAME)) => \ucfirst(\mb_strtolower($clone)), + ]; + + $patKeys = \array_keys($patterns); + $patValues = \array_values($patterns); + cloneFileFolder(\MODULEBUILDER_PATH); + $logocreated = createLogo(\mb_strtolower($clone)); + + //change module name in modinfo.php + // file, read it + $content = \file_get_contents($dirClone . '/language/english/modinfo.php'); + $content = \str_replace('Modulebuilder', \mb_strtolower($clone), $content); + file_put_contents($dirClone . '/language/english/modinfo.php', $content); + + $msg = ''; + if (\is_dir($GLOBALS['xoops']->path('modules/' . \mb_strtolower($clone)))) { + $msg .= \sprintf(\_AM_MODULEBUILDER_CLONE_CONGRAT, "" . \ucfirst(\mb_strtolower($clone)) . '') . "
      \n"; + if (!$logocreated) { + $msg .= \_AM_MODULEBUILDER_CLONE_IMAGEFAIL; + } + } else { + $msg .= \_AM_MODULEBUILDER_CLONE_FAIL; + } + $GLOBALS['xoopsTpl']->assign('result', $msg); + break; +} +require __DIR__ . '/footer.php'; + +// recursive cloning script +/** + * @param $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], \mb_substr($path, \mb_strlen(\XOOPS_ROOT_PATH))); + + if (\is_dir($path)) { + // create new dir + if (!\mkdir($newPath) && !\is_dir($newPath)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $newPath)); + } + + // check all files in dir, and process it + $handle = \opendir($path); + if ($handle) { + while (false !== ($file = \readdir($handle))) { + if (0 !== \mb_strpos($file, '.')) { + cloneFileFolder("{$path}/{$file}"); + } + } + \closedir($handle); + } + } else { + $noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf']; + if (\in_array(\mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions)) { + // image + \copy($path, $newPath); + } else { + // file, read it + $content = \file_get_contents($path); + $content = \str_replace($patKeys, $patValues, $content); + \file_put_contents($newPath, $content); + } + } +} + +/** + * @param $dirname + * + * @return bool + */ +function createLogo($dirname) +{ + if (!\extension_loaded('gd')) { + return false; + } + $requiredFunctions = [ + 'imagecreatefrompng', + 'imagecolorallocate', + 'imagefilledrectangle', + 'imagepng', + 'imagedestroy', + 'imagefttext', + 'imagealphablending', + 'imagesavealpha', + ]; + foreach ($requiredFunctions as $func) { + if (!\function_exists($func)) { + return false; + } + } + // unset($func); + + if (!\file_exists($imageBase = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logoModule.png')) + || !\file_exists($font = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/VeraBd.ttf'))) { + return false; + } + + $imageModule = \imagecreatefrompng($imageBase); + // save existing alpha channel + \imagealphablending($imageModule, false); + \imagesavealpha($imageModule, true); + + //Erase old text + $greyColor = \imagecolorallocate($imageModule, 237, 237, 237); + \imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor); + + // 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)); + + // Set transparency color + //$white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); + //imagefill($imageModule, 0, 0, $white); + //imagecolortransparent($imageModule, $white); + + \imagepng($imageModule, $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logoModule.png')); + \imagedestroy($imageModule); + + return true; +} diff --git a/testdata/mymodule3/admin/feedback.php b/files/commonfiles/admin/feedback.php similarity index 57% rename from testdata/mymodule3/admin/feedback.php rename to files/commonfiles/admin/feedback.php index 5f93ac24..01306dc2 100644 --- a/testdata/mymodule3/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) */ use Xmf\Request; -include __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; $adminObject = \Xmf\Module\Admin::getInstance(); -$feedback = new \XoopsModules\Mymodule3\Common\ModuleFeedback(); +$feedback = new \XoopsModules\Modulebuilder\Common\ModuleFeedback(); // It recovered the value of argument op in URL$ $op = Request::getString('op', 'list'); $moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname'); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -xoops_loadLanguage('feedback', $moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); +\xoops_loadLanguage('feedback', $moduleDirName); //xoops_cp_header(); @@ -41,31 +41,31 @@ $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); $feedback->name = $GLOBALS['xoopsUser']->getVar('name'); $feedback->email = $GLOBALS['xoopsUser']->getVar('email'); - $feedback->site = XOOPS_URL; + $feedback->site = \XOOPS_URL; $form = $feedback->getFormFeedback(); $form->display(); break; case 'send': // Security Check if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('index.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } $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', ''); - $fb_content = str_replace(["\r\n", "\n", "\r"], '
      ', $fb_content); //clean line break from dhtmltextarea + $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'); - $body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
      '; + $title = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname'); + $body = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
      '; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
      '; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
      '; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

      '; + $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
      '; $body .= $fb_content; $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); @@ -73,11 +73,11 @@ $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) { - redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); + \redirect_header('index.php', 3, \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); } // show form with content again @@ -87,7 +87,7 @@ $feedback->type = $fb_type; $feedback->content = $fb_content; echo '
      -

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

      +

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

      '; $form = $feedback->getFormFeedback(); $form->display(); diff --git a/commonfiles/assets/icons/16/status0.png b/files/commonfiles/assets/icons/16/status0.png similarity index 100% rename from commonfiles/assets/icons/16/status0.png rename to files/commonfiles/assets/icons/16/status0.png diff --git a/commonfiles/assets/icons/16/status1.png b/files/commonfiles/assets/icons/16/status1.png similarity index 100% rename from commonfiles/assets/icons/16/status1.png rename to files/commonfiles/assets/icons/16/status1.png diff --git a/commonfiles/assets/icons/16/status2.png b/files/commonfiles/assets/icons/16/status2.png similarity index 100% rename from commonfiles/assets/icons/16/status2.png rename to files/commonfiles/assets/icons/16/status2.png diff --git a/commonfiles/assets/icons/16/status3.png b/files/commonfiles/assets/icons/16/status3.png similarity index 100% rename from commonfiles/assets/icons/16/status3.png rename to files/commonfiles/assets/icons/16/status3.png diff --git a/files/commonfiles/assets/icons/16/status4.png b/files/commonfiles/assets/icons/16/status4.png new file mode 100644 index 00000000..c1f0f576 Binary files /dev/null and b/files/commonfiles/assets/icons/16/status4.png differ diff --git a/files/commonfiles/assets/icons/32/broken.png b/files/commonfiles/assets/icons/32/broken.png new file mode 100644 index 00000000..44987c06 Binary files /dev/null and b/files/commonfiles/assets/icons/32/broken.png differ diff --git a/testdata/mymodule3/class/Common/Breadcrumb.php b/files/commonfiles/class/Common/Breadcrumb.php similarity index 71% rename from testdata/mymodule3/class/Common/Breadcrumb.php rename to files/commonfiles/class/Common/Breadcrumb.php index 7f6ae218..c4cb3d3c 100644 --- a/testdata/mymodule3/class/Common/Breadcrumb.php +++ b/files/commonfiles/class/Common/Breadcrumb.php @@ -1,6 +1,6 @@ - - * @package Mymodule3 + * @package Modulebuilder * * Example: * $breadcrumb = new Common\Breadcrumb(); @@ -28,22 +28,22 @@ * echo $breadcrumb->render(); */ -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Common; +use XoopsModules\Modulebuilder; +use XoopsModules\Modulebuilder\Common; -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); +\defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); /** * Class Breadcrumb */ class Breadcrumb { - public $dirname; - private $bread = []; + public string $dirname; + private array $bread = []; public function __construct() { - $this->dirname = basename(dirname(dirname(__DIR__))); + $this->dirname = \basename(\dirname(__DIR__, 2)); } /** @@ -52,7 +52,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = '') + public function addLink(string $title = '', string $link = ''): void { $this->bread[] = [ 'link' => $link, @@ -65,7 +65,7 @@ public function addLink($title = '', $link = '') */ public function render() { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) { require $GLOBALS['xoops']->path('class/theme.php'); $GLOBALS['xoTheme'] = new \xos_opal_Theme(); } diff --git a/testdata/mymodule/class/Common/Configurator.php b/files/commonfiles/class/Common/Configurator.php similarity index 75% rename from testdata/mymodule/class/Common/Configurator.php rename to files/commonfiles/class/Common/Configurator.php index 9acd4dc4..5435ccd9 100644 --- a/testdata/mymodule/class/Common/Configurator.php +++ b/files/commonfiles/class/Common/Configurator.php @@ -1,6 +1,6 @@ -name = $config->name; $this->paths = $config->paths; diff --git a/files/commonfiles/class/Common/Confirm.php b/files/commonfiles/class/Common/Confirm.php new file mode 100644 index 00000000..b3d4a38c --- /dev/null +++ b/files/commonfiles/class/Common/Confirm.php @@ -0,0 +1,109 @@ + - Website: + * + * + * Example: + $customConfirm = new Common\Confirm( + ['ok' => 1, 'item_id' => $itemId, 'op' => 'delete'], + $_SERVER['REQUEST_URI'], + \sprintf(\_MA_MYMODULE_FORM_SURE_DELETE, + $itemsObj->getCaption())); + $form = $customConfirm->getFormConfirm(); + $GLOBALS['xoopsTpl']->assign('form', $form->render()); + */ + +\defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +/** + * Class Object Confirm + */ +class Confirm +{ + private array $hiddens = []; + private string $action = ''; + private string $title = ''; + private string $label = ''; + private string $object = ''; + + /** + * @public function constructor class + * @param array $hiddens + * @param string $action + * @param string $object + * @param string $title + * @param string $label + */ + public function __construct(array $hiddens, string $action, string $object, string $title = '', string $label = '') + { + $this->hiddens = $hiddens; + $this->action = $action; + $this->object = $object; + $this->title = $title; + $this->label = $label; + } + + /** + * @public function getFormConfirm + * @return \XoopsThemeForm + */ + public function getFormConfirm(): \XoopsThemeForm + { + $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')) { + \define('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM', 'Confirm delete'); + \define('CO_' . $moduleDirNameUpper . '_DELETE_LABEL', 'Do you really want to delete:'); + } + + // Get Theme Form + if ('' === $this->action) { + $this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); + } + if ('' === $this->title) { + $this->title = \constant('CO_' . $moduleDirNameUpper . '_DELETE_CONFIRM'); + } + if ('' === $this->label) { + $this->label = \constant('CO_' . $moduleDirNameUpper . '_DELETE_LABEL'); + } + + \xoops_load('XoopsFormLoader'); + $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 + foreach ($this->hiddens as $key => $value) { + $form->addElement(new \XoopsFormHidden($key, $value)); + } + $form->addElement(new \XoopsFormHidden('ok', 1)); + $buttonTray = new \XoopsFormElementTray(''); + $buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', \_YES, 'submit')); + $buttonBack = new \XoopsFormButton('', 'confirm_back', \_NO, 'button'); + $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 new file mode 100644 index 00000000..d8b7baae --- /dev/null +++ b/files/commonfiles/class/Common/DirectoryChecker.php @@ -0,0 +1,160 @@ +"; + $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE') . ') '; + $path_status .= "
      "; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
      '; + } elseif (@\is_writable($path)) { + $path_status = ""; + $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE') . ') '; + $currentMode = \mb_substr(\decoct(\fileperms($path)), 2); + if ($currentMode != \decoct($mode)) { + $path_status = ""; + $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode); + $path_status .= "
      "; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
      '; + } + } else { + $currentMode = \mb_substr(\decoct(\fileperms($path)), 2); + $path_status = ""; + $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode); + $path_status .= "
      "; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
      '; + } + + return $path_status; + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + 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)) + ); + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function setDirectoryPermissions($target, int $mode = 0777) + { + $target = \str_replace('..', '', $target); + + return @\chmod($target, (int)$mode); + } + + /** + * @param $dir_path + * + * @return bool + */ + public static function dirExists($dir_path) + { + return \is_dir($dir_path); + } +} + +$op = Request::getString('op', '', 'POST'); +switch ($op) { + case 'createdir': + 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') || !\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 new file mode 100644 index 00000000..8d0872d6 --- /dev/null +++ b/files/commonfiles/class/Common/FileChecker.php @@ -0,0 +1,159 @@ +"; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') '; + } else { + $path_status = ""; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') '; + } + } else { + if (self::compareFiles($file_path, $original_file_path)) { + $path_status = ""; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') '; + } else { + $path_status = ""; + $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') '; + $path_status .= "
      "; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= ""; + $path_status .= "'; + $path_status .= '
      '; + } + } + + return $path_status; + } + + /** + * @param $source_path + * @param $destination_path + * + * @return bool + */ + public static function copyFile($source_path, $destination_path) + { + $source_path = \str_replace('..', '', $source_path); + $destination_path = \str_replace('..', '', $destination_path); + + return @\copy($source_path, $destination_path); + } + + /** + * @param $file1_path + * @param $file2_path + * + * @return bool + */ + public static function compareFiles($file1_path, $file2_path) + { + if (!self::fileExists($file1_path) || !self::fileExists($file2_path)) { + return false; + } + if (\filetype($file1_path) !== \filetype($file2_path)) { + return false; + } + if (\filesize($file1_path) !== \filesize($file2_path)) { + return false; + } + $crc1 = \mb_strtoupper(\dechex(\crc32(\file_get_contents($file1_path)))); + $crc2 = \mb_strtoupper(\dechex(\crc32(\file_get_contents($file2_path)))); + + return !($crc1 !== $crc2); + } + + /** + * @param $file_path + * + * @return bool + */ + public static function fileExists($file_path) + { + return \is_file($file_path); + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function setFilePermissions($target, int $mode = 0777) + { + $target = \str_replace('..', '', $target); + + return @\chmod($target, (int)$mode); + } +} + +$op = Request::getString('op', '', 'POST'); +if ($op == 'copyfile') { + 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/testdata/mymodule/class/Common/FilesManagement.php b/files/commonfiles/class/Common/FilesManagement.php similarity index 74% rename from testdata/mymodule/class/Common/FilesManagement.php rename to files/commonfiles/class/Common/FilesManagement.php index 3e82ab10..e9ca0196 100644 --- a/testdata/mymodule/class/Common/FilesManagement.php +++ b/files/commonfiles/class/Common/FilesManagement.php @@ -1,6 +1,6 @@ - */ trait FilesManagement { /** - * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * Function responsible for checking if a directory exists, we can also write in and create an index.php file * * @param string $folder The full path of the directory to check * * @return void * @throws \RuntimeException */ - public static function createFolder($folder) + public static function createFolder($folder): void { try { - if (!file_exists($folder)) { - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); + if (!\file_exists($folder)) { + if (!\is_dir($folder) && !\mkdir($folder) && !\is_dir($folder)) { + throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); } - file_put_contents($folder . '/index.html', ''); + \file_put_contents($folder . '/index.php', "getMessage(), '
      '; @@ -43,36 +43,36 @@ 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); + return \copy($file, $folder); } /** * @param $src * @param $dst */ - public static function recurseCopy($src, $dst) + public static function recurseCopy($src, $dst): void { - $dir = opendir($src); - // @mkdir($dst); - if (!@mkdir($dst) && !is_dir($dst)) { + $dir = \opendir($src); + // @\mkdir($dst); + if (!@\mkdir($dst) && !\is_dir($dst)) { throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); } - while (false !== ($file = readdir($dir))) { + while (false !== ($file = \readdir($dir))) { if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { + if (\is_dir($src . '/' . $file)) { self::recurseCopy($src . '/' . $file, $dst . '/' . $file); } else { - copy($src . '/' . $file, $dst . '/' . $file); + \copy($src . '/' . $file, $dst . '/' . $file); } } } - closedir($dir); + \closedir($dir); } /** @@ -82,30 +82,30 @@ 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) { // Check for symlinks - if (is_link($source)) { - return symlink(readlink($source), $dest); + if (\is_link($source)) { + return \symlink(\readlink($source), $dest); } // Simple copy for a file - if (is_file($source)) { - return copy($source, $dest); + if (\is_file($source)) { + return \copy($source, $dest); } // Make destination directory - if (!is_dir($dest)) { - if (!mkdir($dest) && !is_dir($dest)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dest)); + if (!\is_dir($dest)) { + if (!\mkdir($dest) && !\is_dir($dest)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dest)); } } // Loop through the folder - $dir = dir($source); - if (@is_dir($dir)) { + $dir = \dir($source); + if (@\is_dir($dir)) { while (false !== $entry = $dir->read()) { // Skip pointers if ('.' === $entry || '..' === $entry) { @@ -143,7 +143,7 @@ public static function deleteDirectory($src) $dirInfo = new \SplFileInfo($src); // validate is a directory if ($dirInfo->isDir()) { - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); + $fileList = \array_diff(\scandir($src, \SCANDIR_SORT_NONE), ['..', '.']); foreach ($fileList as $k => $v) { $fileInfo = new \SplFileInfo("{$src}/{$v}"); if ($fileInfo->isDir()) { @@ -153,14 +153,14 @@ public static function deleteDirectory($src) } } else { // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { + if (!($success = \unlink($fileInfo->getRealPath()))) { break; } } } // now delete this (sub)directory if all the files are gone if ($success) { - $success = rmdir($dirInfo->getRealPath()); + $success = \rmdir($dirInfo->getRealPath()); } } else { // input is not a valid directory @@ -187,7 +187,7 @@ public static function rrmdir($src) } // If source is not a directory stop processing - if (!is_dir($src)) { + if (!\is_dir($src)) { return false; } @@ -199,7 +199,7 @@ public static function rrmdir($src) if ($fObj->isFile()) { $filename = $fObj->getPathname(); $fObj = null; // clear this iterator object to close the file - if (!unlink($filename)) { + if (!\unlink($filename)) { return false; // couldn't delete the file } } elseif (!$fObj->isDot() && $fObj->isDir()) { @@ -208,7 +208,8 @@ public static function rrmdir($src) } } $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results + + return \rmdir($src); // remove the directory & return results } /** @@ -227,12 +228,12 @@ public static function rmove($src, $dest) } // If source is not a directory stop processing - if (!is_dir($src)) { + if (!\is_dir($src)) { return false; } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { + if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) { return false; } @@ -240,15 +241,16 @@ public static function rmove($src, $dest) $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } elseif (!$fObj->isDot() && $fObj->isDir()) { // Try recursively on directory self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - // rmdir($fObj->getPath()); // now delete the directory + // \rmdir($fObj->getPath()); // now delete the directory } } $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results + + return \rmdir($src); // remove the directory & return results } /** @@ -270,12 +272,12 @@ public static function rcopy($src, $dest) } // If source is not a directory stop processing - if (!is_dir($src)) { + if (!\is_dir($src)) { return false; } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { + if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) { return false; } @@ -283,7 +285,7 @@ public static function rcopy($src, $dest) $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } elseif (!$fObj->isDot() && $fObj->isDir()) { self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } diff --git a/testdata/mymodule/class/Common/Migrate.php b/files/commonfiles/class/Common/Migrate.php similarity index 84% rename from testdata/mymodule/class/Common/Migrate.php rename to files/commonfiles/class/Common/Migrate.php index c9925151..c570a58b 100644 --- a/testdata/mymodule/class/Common/Migrate.php +++ b/files/commonfiles/class/Common/Migrate.php @@ -1,6 +1,6 @@ - * @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.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ - class Migrate extends \Xmf\Database\Migrate { private $renameTables; /** - * Migrate constructor. - * @param Common\Configurator $configurator - * @throws \RuntimeException - * @throws \InvalidArgumentException + * @param \XoopsModules\Modulebuilder\Common\Configurator|null $configurator */ public function __construct(Common\Configurator $configurator = null) { if (null !== $configurator) { $this->renameTables = $configurator->renameTables; - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = \basename(\dirname(__DIR__, 2)); parent::__construct($moduleDirName); } } @@ -47,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)) { @@ -62,12 +58,12 @@ private function changePrefix() * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName) + protected function convertIPAddresses(string $tableName, string $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); - if (false !== mb_strpos($attributes, ' int(')) { - if (false === mb_strpos($attributes, 'unsigned')) { + if (false !== \mb_strpos($attributes, ' int(')) { + if (false === \mb_strpos($attributes, 'unsigned')) { $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); } @@ -80,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'; @@ -104,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 new file mode 100644 index 00000000..b756fa70 --- /dev/null +++ b/files/commonfiles/class/Common/ModuleFeedback.php @@ -0,0 +1,113 @@ + + * @author Wedega - Email: + * @author Fernando Santos (topet05) + */ +\defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +/** + * Class Object ModuleFeedback + */ +class ModuleFeedback extends \XoopsObject +{ + public $name = ''; + public $email = ''; + public $site = ''; + public $type = ''; + public $content = ''; + + /** + * Constructor + */ + public function __construct() + { + } + + /** + * @static function &getInstance + */ + public static function getInstance(): void + { + static $instance = false; + if (!$instance) { + $instance = new self(); + } + } + + /** + * @public function getFormFeedback: + * provide form for sending a feedback to module author + * @return \XoopsThemeForm + */ + public function getFormFeedback() + { + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + // Get Theme Form + \xoops_load('XoopsFormLoader'); + $form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true); + $form->setExtra('enctype="multipart/form-data"'); + + $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); + $your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); + $form->addElement($your_name); + $your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); + $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); + $form->addElement($your_site); + $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); + $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); + $form->addElement($your_mail); + + $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); + $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')); + $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); + $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); + $form->addElement($fbtypeSelect, true); + + $editorConfigs = []; + $editorConfigs['name'] = 'fb_content'; + $editorConfigs['value'] = $this->content; + $editorConfigs['rows'] = 5; + $editorConfigs['cols'] = 40; + $editorConfigs['width'] = '100%'; + $editorConfigs['height'] = '400px'; + $moduleHandler = \xoops_getHandler('module'); + $module = $moduleHandler->getByDirname('system'); + $configHandler = \xoops_getHandler('config'); + $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); + + $form->addElement(new \XoopsFormHidden('op', 'send')); + $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); + + return $form; + } +} diff --git a/testdata/mymodule2/class/Common/ModuleStats.php b/files/commonfiles/class/Common/ModuleStats.php similarity index 57% rename from testdata/mymodule2/class/Common/ModuleStats.php rename to files/commonfiles/class/Common/ModuleStats.php index 5291c650..674b69c0 100644 --- a/testdata/mymodule2/class/Common/ModuleStats.php +++ b/files/commonfiles/class/Common/ModuleStats.php @@ -1,6 +1,6 @@ - + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @author Michael Beck */ trait ModuleStats { /** - * @param \XoopsModules\Mymodule2\Common\Configurator $configurator - * @param array $moduleStats + * @param \XoopsModules\Modulebuilder\Common\Configurator $configurator + * @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) { + if (\count($configurator->moduleStats) > 0) { + foreach (\array_keys($configurator->moduleStats) as $i) { $moduleStats[$i] = $configurator->moduleStats[$i]; } } diff --git a/files/commonfiles/class/Common/Resizer.php b/files/commonfiles/class/Common/Resizer.php new file mode 100644 index 00000000..035193c5 --- /dev/null +++ b/files/commonfiles/class/Common/Resizer.php @@ -0,0 +1,332 @@ + - Website: + * @version $Id: 1.0 Resizer.php 1 Mon 2019-02-09 10:04:49Z XOOPS Project (www.xoops.org) $ + */ +class Resizer +{ + 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 + * @return string|bool + */ + public function resizeImage() + { + // check file extension + 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'; + } + + $width = \imagesx($img); + $height = \imagesy($img); + + if ($width > $this->maxWidth || $height > $this->maxHeight) { + // recalc image size based on this->maxWidth/this->maxHeight + $new_width = 0; + $new_height = 0; + if ($width > $height) { + if ($width < $this->maxWidth) { + $new_width = $width; + } else { + $new_width = $this->maxWidth; + $divisor = $width / $new_width; + $new_height = \floor($height / $divisor); + } + } elseif ($height < $this->maxHeight) { + $new_height = $height; + } else { + $new_height = $this->maxHeight; + $divisor = $height / $new_height; + $new_width = \floor($width / $divisor); + } + + // Create a new temporary image. + $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, (int)$new_width, (int)$new_height, (int)$width, (int)$height); + + \unlink($this->endFile); + //compressing the file + switch ($this->imageMimetype) { + case 'image/png': + \imagepng($tmpimg, $this->endFile, 0); + break; + case 'image/jpeg': + \imagejpeg($tmpimg, $this->endFile, 100); + break; + case 'image/gif': + \imagegif($tmpimg, $this->endFile); + break; + } + + // release the memory + \imagedestroy($tmpimg); + } else { + return 'copy'; + } + \imagedestroy($img); + + return true; + } + + /** + * @return bool|string + */ + public function resizeAndCrop() + { + // check file extension + switch ($this->imageMimetype) { + case 'image/png': + $original = \imagecreatefrompng($this->sourceFile); + break; + case 'image/jpeg': + $original = \imagecreatefromjpeg($this->sourceFile); + break; + case 'image/gif': + $original = \imagecreatefromgif($this->sourceFile); + break; + default: + return 'Unsupported format'; + } + + if (!$original) { + return false; + } + // GET ORIGINAL IMAGE DIMENSIONS + [$original_w, $original_h] = \getimagesize($this->sourceFile); + + // RESIZE IMAGE AND PRESERVE PROPORTIONS + $max_width_resize = $this->maxWidth; + $max_height_resize = $this->maxHeight; + if ($original_w > $original_h) { + $max_height_ratio = $this->maxHeight / $original_h; + $max_width_resize = (int)\round($original_w * $max_height_ratio); + } else { + $max_width_ratio = $this->maxWidth / $original_w; + $max_height_resize = (int)\round($original_h * $max_width_ratio); + } + if ($max_width_resize < $this->maxWidth) { + $max_height_ratio = $this->maxWidth / $max_width_resize; + $max_height_resize = (int)\round($this->maxHeight * $max_height_ratio); + $max_width_resize = $this->maxWidth; + } + + // CREATE THE PROPORTIONAL IMAGE RESOURCE + $thumb = \imagecreatetruecolor($max_width_resize, $max_height_resize); + if (!\imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { + return false; + } + // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS + $final = \imagecreatetruecolor($this->maxWidth, $this->maxHeight); + + $max_width_offset = 0; + $max_height_offset = 0; + if ($this->maxWidth < $max_width_resize) { + $max_width_offset = (int)\round(($max_width_resize - $this->maxWidth) / 2); + } else { + $max_height_offset = (int)\round(($max_height_resize - $this->maxHeight) / 2); + } + + if (!\imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { + return false; + } + // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile + if (!\imagejpeg($final, $this->endFile, $this->jpgQuality)) { + return false; + } + + return true; + } + + public function mergeImage(): void + { + 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: + return; + } + if (!$dest || !$src) { + return; + } + if (4 == $this->mergeType) { + $imgWidth = (int)\round($this->maxWidth / 2 - 1); + $imgHeight = (int)\round($this->maxHeight / 2 - 1); + $posCol2 = (int)\round($this->maxWidth / 2 + 1); + $posRow2 = (int)\round($this->maxHeight / 2 + 1); + switch ($this->mergePos) { + case 1: + \imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left + break; + case 2: + \imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right + break; + case 3: + \imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left + break; + case 4: + \imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right + break; + } + } + if (6 == $this->mergeType) { + $imgWidth = (int)\round($this->maxWidth / 3 - 1); + $imgHeight = (int)\round($this->maxHeight / 2 - 1); + $posCol2 = (int)\round($this->maxWidth / 3 + 1); + $posCol3 = $posCol2 + (int)\round($this->maxWidth / 3 + 1); + $posRow2 = (int)\round($this->maxHeight / 2 + 1); + + switch ($this->mergePos) { + case 1: + \imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left + break; + case 2: + \imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center + break; + case 3: + \imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right + break; + case 4: + \imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left + break; + case 5: + \imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center + break; + case 6: + \imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right + break; + } + } + // 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); + } + + /** + * @return bool|string + */ + public function rotateImage() + { + // check file extension + switch ($this->imageMimetype) { + case 'image/png': + $original = \imagecreatefrompng($this->sourceFile); + break; + case 'image/jpeg': + $original = \imagecreatefromjpeg($this->sourceFile); + break; + case 'image/gif': + $original = \imagecreatefromgif($this->sourceFile); + break; + default: + return 'Unsupported format'; + } + + if (!$original) { + return false; + } + // Rotate + $tmpimg = \imagerotate($original, $this->degrees, 0); + + \unlink($this->endFile); + //compressing the file + switch ($this->imageMimetype) { + case 'image/png': + if (!\imagepng($tmpimg, $this->endFile, 0)) { + return false; + } + break; + case 'image/jpeg': + if (!\imagejpeg($tmpimg, $this->endFile, $this->jpgQuality)) { + return false; + } + break; + case 'image/gif': + if (!\imagegif($tmpimg, $this->endFile)) { + return false; + } + break; + } + + // release the memory + \imagedestroy($tmpimg); + + return true; + } +} diff --git a/files/commonfiles/class/Common/ServerStats.php b/files/commonfiles/class/Common/ServerStats.php new file mode 100644 index 00000000..7227cb9b --- /dev/null +++ b/files/commonfiles/class/Common/ServerStats.php @@ -0,0 +1,78 @@ + + */ +trait ServerStats +{ + /** + * serverStats() + * + * @return string + */ + public static function getServerStats() + { + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + \xoops_loadLanguage('common', $moduleDirName); + $html = ''; + // $sql = 'SELECT metavalue'; + // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); + // $sql .= " WHERE metakey='version' LIMIT 1"; + // $query = $GLOBALS['xoopsDB']->query($sql); + // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); + $html .= '
      '; + $html .= "" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; + $html .= "
      "; + // $html .= '
      ' . \constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; + // $html .= "
      "; + // $html .= "
      "; + $html .= '
      ' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; + $html .= '
        '; + + $gdlib = \function_exists('gd_info') ? '' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + if (\function_exists('gd_info')) { + if (true === ($gdlib = gd_info())) { + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; + } + } + + // $safemode = \ini_get('safe_mode') ? \constant('CO_' . $moduleDirNameUpper . '_ON') . \constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : \constant('CO_' . $moduleDirNameUpper . '_OFF'); + // $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; + + // $registerglobals = (!\ini_get('register_globals')) ? "" . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . \constant('CO_' . $moduleDirNameUpper . '_ON') . ''; + // $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; + + $downloads = \ini_get('file_uploads') ? '' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; + + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . \ini_get('upload_max_filesize') . ''; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . \ini_get('post_max_size') . ''; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . \ini_get('memory_limit') . ''; + $html .= '
      '; + $html .= '
        '; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . \XOOPS_ROOT_PATH . ''; + $html .= '
      '; + $html .= '
      '; + $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; + $html .= '
      '; + $html .= '

      '; + + return $html; + } +} diff --git a/files/commonfiles/class/Common/SysUtility.php b/files/commonfiles/class/Common/SysUtility.php new file mode 100644 index 00000000..48840524 --- /dev/null +++ b/files/commonfiles/class/Common/SysUtility.php @@ -0,0 +1,215 @@ + + * @author Mamba + */ + +use XoopsModules\Modulebuilder\Helper; + +/** + * Class Utility + */ +class SysUtility +{ + use VersionChecks; + + //checkVerXoops, checkVerPhp Traits + + use ServerStats; + + // getServerStats Trait + + use FilesManagement; + + // Files Management Trait + + /** + * Access the only instance of this class + * + * @return object + */ + public static function getInstance() + { + static $instance; + if (null === $instance) { + $instance = new static(); + } + + return $instance; + } + + /** + * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags + * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags + * www.cakephp.org + * + * @param string $text String to truncate. + * @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 + * + * @return string Trimmed string. + */ + 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 + 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); + $open_tags = []; + $truncate = ''; + foreach ($lines as $line_matchings) { + // if there is any html-tag in this line, handle it and add it (uncounted) to the output + if (!empty($line_matchings[1])) { + // if it's an "empty element" with or without xhtml-conform closing slash + if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + // do nothing + // if tag is a closing tag + } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { + // delete tag from $open_tags list + $pos = \array_search($tag_matchings[1], $open_tags, true); + if (false !== $pos) { + unset($open_tags[$pos]); + } + // if tag is an opening tag + } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { + // add tag to the beginning of $open_tags list + \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); + } + // add html-tag to $truncate'd text + $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])); + 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)) { + // 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]); + } else { + // no more characters left + break; + } + } + } + $truncate .= \mb_substr($line_matchings[2], 0, $left + $entities_length); + // maximum lenght is reached, so get off the loop + break; + } + $truncate .= $line_matchings[2]; + $total_length += $content_length; + + // if the maximum length is reached, get off the loop + if ($total_length >= $length) { + break; + } + } + } else { + if (\mb_strlen($text) <= $length) { + return $text; + } + $truncate = \mb_substr($text, 0, $length - mb_strlen($ending)); + } + // if the words shouldn't be cut in the middle... + if (!$exact) { + // ...search the last occurance of a space... + $spacepos = \mb_strrpos($truncate, ' '); + if (isset($spacepos)) { + // ...and cut the text in this position + $truncate = \mb_substr($truncate, 0, $spacepos); + } + } + // add the defined ending to the text + $truncate .= $ending; + if ($considerHtml) { + // close all unclosed html-tags + foreach ($open_tags as $tag) { + $truncate .= ''; + } + } + + return $truncate; + } + + /** + * @param \Xmf\Module\Helper|null $helper + * @param array|null $options + * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor + */ + public static function getEditor(\Xmf\Module\Helper $helper = null, array $options = null) + { + /** @var Helper $helper */ + if (null === $options) { + $options = []; + $options['name'] = 'Editor'; + $options['value'] = 'Editor'; + $options['rows'] = 10; + $options['cols'] = '100%'; + $options['width'] = '100%'; + $options['height'] = '400px'; + } + + if (null === $helper) { + $helper = Helper::getInstance(); + } + + $isAdmin = $helper->isUserAdmin(); + + if (\class_exists('XoopsFormEditor')) { + if ($isAdmin) { + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); + } else { + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); + } + } else { + $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); + } + + // $form->addElement($descEditor); + + return $descEditor; + } + + /** + * @param $fieldname + * @param $table + * + * @return bool + */ + public function fieldExists($fieldname, $table) + { + global $xoopsDB; + $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + + return ($xoopsDB->getRowsNum($result) > 0); + } +} diff --git a/testdata/mymodule/class/Common/VersionChecks.php b/files/commonfiles/class/Common/VersionChecks.php similarity index 54% rename from testdata/mymodule/class/Common/VersionChecks.php rename to files/commonfiles/class/Common/VersionChecks.php index aeff0ad4..a18c6f28 100644 --- a/testdata/mymodule/class/Common/VersionChecks.php +++ b/files/commonfiles/class/Common/VersionChecks.php @@ -1,6 +1,6 @@ - */ trait VersionChecks @@ -23,29 +23,30 @@ trait VersionChecks * Verifies XOOPS version meets minimum requirements for this module * @static * + * @param \XoopsModule|null $module * @param null|string $requiredVer * @return bool true if meets requirements, false if not */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); + \xoops_loadLanguage('admin', $moduleDirName); + \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 } $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)); + $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } return $success; @@ -55,25 +56,26 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = * Verifies PHP version meets minimum requirements for this module * @static * + * @param \XoopsModule|null $module * @return bool true if meets requirements, false if not */ public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } - xoops_loadLanguage('admin', $moduleDirName); + \xoops_loadLanguage('admin', $moduleDirName); // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; + $verNum = \PHP_VERSION; $reqVer = &$module->getInfo('min_php'); if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); + if (\version_compare($verNum, $reqVer, '<')) { + $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); $success = false; } } @@ -82,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 @@ -90,52 +92,52 @@ 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(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $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())) { - 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 (\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"]); + $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); + \trigger_error(\curl_error($curlHandle)); } elseif (mb_strpos($curlReturn, 'Not Found')) { - trigger_error('Repository Not Found: ' . $infoReleasesUrl); + \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); + $file = \json_decode($curlReturn, false); + $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) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; + $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; } //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); + $latestVersion = \mb_strtolower($latestVersion); if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); + $latestVersion = \str_replace('_', '', \mb_strtolower($latestVersion)); + $latestVersion = \str_replace('final', '', \mb_strtolower($latestVersion)); } $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); + $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); // $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { + if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { $ret = []; $ret[] = $update; $ret[] = $latestVersionLink; } } - curl_close($curlHandle); + \curl_close($curlHandle); } } diff --git a/commonfiles/class/Helper.php b/files/commonfiles/class/Helper.php similarity index 73% rename from commonfiles/class/Helper.php rename to files/commonfiles/class/Helper.php index 38d00759..8e52ee58 100644 --- a/commonfiles/class/Helper.php +++ b/files/commonfiles/class/Helper.php @@ -1,6 +1,6 @@ -debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); parent::__construct($moduleDirName); } /** * @param bool $debug * - * @return \XoopsModules\Tdmcreate\Helper + * @return \XoopsModules\Modulebuilder\Helper */ - public static function getInstance($debug = false) + public static function getInstance(bool $debug = false) { static $instance; if (null === $instance) { @@ -70,8 +69,8 @@ public function getDirname() */ public function getHandler($name) { - $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; - if (!class_exists($class)) { + $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; + if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } /** @var \XoopsMySQLDatabase $db */ @@ -83,4 +82,3 @@ public function getHandler($name) return $ret; } } -//require __DIR__ . '/../../mainfile.php'; diff --git a/commonfiles/class/Utility.php b/files/commonfiles/class/Utility.php similarity index 64% rename from commonfiles/class/Utility.php rename to files/commonfiles/class/Utility.php index 0bbfcd5a..b9171734 100644 --- a/commonfiles/class/Utility.php +++ b/files/commonfiles/class/Utility.php @@ -1,6 +1,6 @@ - + * @author ZySpec * @author Mamba - * @since + * @since */ -use XoopsModules\Tdmcreate; +use XoopsModules\Modulebuilder; /** * Class Utility */ class Utility { - use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits + use Common\VersionChecks; - use Common\ServerStats; // getServerStats Trait + //checkVerXoops, checkVerPhp Traits - use Common\FilesManagement; // Files Management Trait + use Common\ServerStats; + + // getServerStats Trait + + use Common\FilesManagement; + + // Files Management Trait /** * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags @@ -45,54 +50,54 @@ 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 - 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) { // if there is any html-tag in this line, handle it and add it (uncounted) to the output if (!empty($line_matchings[1])) { // if it's an "empty element" with or without xhtml-conform closing slash - if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { // do nothing // if tag is a closing tag - } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { + } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { // delete tag from $open_tags list - $pos = array_search($tag_matchings[1], $open_tags, true); + $pos = \array_search($tag_matchings[1], $open_tags, true); if (false !== $pos) { unset($open_tags[$pos]); } // if tag is an opening tag - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { + } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { // add tag to the beginning of $open_tags list - array_unshift($open_tags, mb_strtolower($tag_matchings[1])); + \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); } // add html-tag to $truncate'd text $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) { @@ -104,7 +109,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,22 +122,24 @@ 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) { // ...search the last occurance of a space... - $spacepos = mb_strrpos($truncate, ' '); + $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 - $truncate .= $ending; + if ('' != $truncate) { + $truncate .= $ending; + } if ($considerHtml) { // close all unclosed html-tags foreach ($open_tags as $tag) { @@ -144,13 +151,16 @@ 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 Tdmcreate\Helper $helper */ + /** @var Modulebuilder\Helper $helper */ + if (null === $helper) { + $helper = Helper::getInstance(); + } if (null === $options) { $options = []; $options['name'] = 'Editor'; @@ -163,18 +173,16 @@ public static function getEditor($helper = null, $options = null) $isAdmin = $helper->isUserAdmin(); - if (class_exists('XoopsFormEditor')) { + 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, false, '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, false, 'textarea'); } } else { - $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); + $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); } - // $form->addElement($descEditor); - return $descEditor; } @@ -184,20 +192,20 @@ public static function getEditor($helper = null, $options = null) * @param $about * @return string */ - public static function MakeDonationForm($about) + public static function makeDonationForm($about) { $donationform = [ - 0 => '
      ', + 0 => '', 1 => '
      ' - . _AM_TDMCREATE_ABOUT_MAKE_DONATION + . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
      ' - . _AM_TDMCREATE_DONATION_AMOUNT + . \_AM_MODULEBUILDER_DONATION_AMOUNT . '*
      ', - 2 => '
      ', + 2 => '', 'D' => '', 3 => '', 4 => ' @@ -218,25 +226,23 @@ 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'), + \defined('XOOPS_LICENSE_KEY') ? \XOOPS_LICENSE_KEY : '', + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') + ); } } $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); - $aboutRes .= implode("\n", $donationform); - $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 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); return $aboutRes; } @@ -248,6 +254,6 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; */ public static function UcFirstAndToLower($str) { - return ucfirst(mb_strtolower(trim($str))); + return \ucfirst(\mb_strtolower(\trim($str))); } } diff --git a/files/commonfiles/include/install.php b/files/commonfiles/include/install.php new file mode 100644 index 00000000..22438b2e --- /dev/null +++ b/files/commonfiles/include/install.php @@ -0,0 +1,97 @@ + - Website: XOOPS Project (www.xoops.org) $ + */ + +use XoopsModules\Modulebuilder; +use XoopsModules\Modulebuilder\Common; + +/** + * @param \XoopsModule $module + * @return bool + */ +function xoops_module_pre_install_modulebuilder(\XoopsModule $module) +{ + require \dirname(__DIR__) . '/preloads/autoloader.php'; + + $utility = new Modulebuilder\Utility(); + + //check for minimum XOOPS version + $xoopsSuccess = $utility::checkVerXoops($module); + + // check for minimum PHP version + $phpSuccess = $utility::checkVerPhp($module); + + return $xoopsSuccess && $phpSuccess; +} + +/** + * @param \XoopsModule $module + * @return bool + */ +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(); + + // Load language files + $helper->loadLanguage('admin'); + $helper->loadLanguage('modinfo'); + $helper->loadLanguage('common'); + + // --- CREATE FOLDERS --------------- + $success = true; + 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); + if (!\is_dir($path)) { + $success = false; + continue; + } + } + if (!@\is_writable($path)) { + \chmod($path, 0775); + \clearstatcache(false, $path); + if (!@\is_writable($path)) { + $success = false; + } + } + } + } + + // --- COPY blank.gif FILES --------------- + if ($configurator->copyBlankFiles && \is_array($configurator->copyBlankFiles)) { + $file = \dirname(__DIR__) . '/assets/images/blank.gif'; + foreach (\array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.gif'; + if (!$utility::copyFile($file, $dest)) { + $success = false; + } + } + } + + return $success; +} diff --git a/testdata/mymodule/include/uninstall.php b/files/commonfiles/include/uninstall.php similarity index 52% rename from testdata/mymodule/include/uninstall.php rename to files/commonfiles/include/uninstall.php index 7770be03..9fa2a315 100644 --- a/testdata/mymodule/include/uninstall.php +++ b/files/commonfiles/include/uninstall.php @@ -1,14 +1,15 @@ -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 + $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; } - unset($dirInfo); } + unset($dirInfo); /* //------------ START ---------------- //------------------------------------------------------------------ @@ -66,8 +61,8 @@ function xoops_module_uninstall_mymodule(\XoopsModule $module) //------------------------------------------------------------------ $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); if (is_file($xmlfile)) { - if (false === ($delOk = unlink($xmlfile))) { - $module->setErrors(sprintf(_AM_MYMODULE_ERROR_BAD_REMOVE, $xmlfile)); + if (false === ($delOk = \unlink($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 new file mode 100644 index 00000000..e3139ca1 --- /dev/null +++ b/files/commonfiles/include/update.php @@ -0,0 +1,98 @@ + - 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 GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) + */ + +/** + * @param $module + * @param null $prev_version + * + * @return bool|null + */ +function xoops_module_update_modulebuilder($module, $prev_version = null) +{ + $ret = null; + /* + if ($prev_version < 10) { + //enter code or call your function + } + */ + $ret = modulebuilder_check_db($module); + + //check upload directory + require_once __DIR__ . '/install.php'; + $ret = xoops_module_install_modulebuilder($module); + + $errors = $module->getErrors(); + if (!empty($errors)) { + \print_r($errors); + } + + return $ret; +} + +/** + * @param $module + * + * @return bool + */ +function modulebuilder_check_db($module) +{ + //insert here code for database check + + /* + // Example: update table (add new field) + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_images'); + $field = 'img_exif'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` TEXT NULL AFTER `img_state`;"; + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when adding '$field' to table '$table'."); + $ret = false; + } + } + + // Example: create new table + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_categories'); + $check = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + // create new table 'modulebuilder_categories' + $sql = "CREATE TABLE `$table` ( + `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, + `cat_text` VARCHAR(100) NOT NULL DEFAULT '', + `cat_date` INT(8) NOT NULL DEFAULT '0', + `cat_submitter` INT(8) NOT NULL DEFAULT '0', + PRIMARY KEY (`cat_id`) + ) ENGINE=InnoDB;"; + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when creating table '$table'."); + $ret = false; + } + } + */ + return true; +} diff --git a/files/commonfiles/include/xoops_version.inc.php b/files/commonfiles/include/xoops_version.inc.php new file mode 100644 index 00000000..2055ea1a --- /dev/null +++ b/files/commonfiles/include/xoops_version.inc.php @@ -0,0 +1,51 @@ +Disabled (No thumbnails 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): '); +\define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); +\define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); +\define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); +\define('CO_' . $moduleDirNameUpper . '_ON', "ON"); +\define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); +\define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); +\define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); +\define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); + +\define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); +\define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); + +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); +\define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +\define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); + +// Error Msgs +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); + +//Help +\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'); + +//\define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); + +//help multi-page +\define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); +\define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); +\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 . '_' . '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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); + +//letter choice +\define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); +\define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); + +// block defines +\define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); +\define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); +\define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); +\define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); + +//myblocksadmin +\define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); + +//Template Admin +\define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); +\define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); + +//Menu +\define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); + +//Latest Version Check +\define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); + +//DirectoryChecker +\define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +\define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); + +//FileChecker +//\define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); + +//\define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); + +//image config +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); + +//Preferences +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); + +//Module Stats +\define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/files/commonfiles/language/english/feedback.php b/files/commonfiles/language/english/feedback.php new file mode 100644 index 00000000..b5b9d97a --- /dev/null +++ b/files/commonfiles/language/english/feedback.php @@ -0,0 +1,41 @@ + + */ +$moduleDirName = \basename(\dirname(__DIR__, 2)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); + +\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'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); +\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 while sending feedback!'); diff --git a/testdata/mymodule2/preloads/autoloader.php b/files/commonfiles/preloads/autoloader.php similarity index 51% rename from testdata/mymodule2/preloads/autoloader.php rename to files/commonfiles/preloads/autoloader.php index e23c6e01..65bd73cf 100644 --- a/testdata/mymodule2/preloads/autoloader.php +++ b/files/commonfiles/preloads/autoloader.php @@ -1,33 +1,33 @@ - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access.'); +\defined('XOOPS_ROOT_PATH') || die('Restricted access.'); /** - * Class Mymodule2CorePreload + * Class ModulebuilderCorePreload */ -class Mymodule2CorePreload extends \XoopsPreloadItem +class ModulebuilderCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader - /** * @param $args */ - public static function eventCoreIncludeCommonEnd($args) + public static function eventCoreIncludeCommonEnd($args): void { - include __DIR__ . '/autoloader.php'; + require __DIR__ . '/autoloader.php'; } } diff --git a/files/commonfiles/templates/admin/modulebuilder_admin_clone.tpl b/files/commonfiles/templates/admin/modulebuilder_admin_clone.tpl new file mode 100644 index 00000000..8ce6789d --- /dev/null +++ b/files/commonfiles/templates/admin/modulebuilder_admin_clone.tpl @@ -0,0 +1,15 @@ + +<{include file='db:modulebuilder_admin_header.tpl' }> + +<{if $form|default:''}> + <{$form|default:false}> +<{/if}> +<{if $result|default:''}> + <{$result|default:false}> +<{/if}> +<{if $error|default:''}> +
      <{$error|default:false}>
      +<{/if}> + + +<{include file='db:modulebuilder_admin_footer.tpl' }> diff --git a/commonfiles/testdata/images/blank.gif b/files/commonfiles/testdata/images/blank.gif similarity index 100% rename from commonfiles/testdata/images/blank.gif rename to files/commonfiles/testdata/images/blank.gif diff --git a/commonfiles/testdata/images/blank.png b/files/commonfiles/testdata/images/blank.png similarity index 100% rename from commonfiles/testdata/images/blank.png rename to files/commonfiles/testdata/images/blank.png diff --git a/files/commonfiles/testdata/index.php b/files/commonfiles/testdata/index.php new file mode 100644 index 00000000..62388943 --- /dev/null +++ b/files/commonfiles/testdata/index.php @@ -0,0 +1,202 @@ +loadLanguage('common'); + +switch ($op) { + case 'load': + if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { + if (!$GLOBALS['xoopsSecurity']->check()) { + \redirect_header('../admin/index.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + loadSampleData(); + } else { + xoops_cp_header(); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK'), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + xoops_cp_footer(); + } + break; + case 'save': + saveSampleData(); + break; +} + +// XMF TableLoad for SAMPLE data +function loadSampleData(): void +{ + global $xoopsConfig; + + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + + $utility = new Modulebuilder\Utility(); + $configurator = new Common\Configurator(); + + $tables = Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + + $language = 'english/'; + if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { + $language = $xoopsConfig['language'] . '/'; + } + + // load module tables + foreach ($tables as $table) { + $tabledata = Yaml::readWrapped($language . $table . '.yml'); + TableLoad::truncateTable($table); + TableLoad::loadTableFromArray($table, $tabledata); + } + + // load permissions + $table = 'group_permission'; + $tabledata = Yaml::readWrapped($language . $table . '.yml'); + $mid = 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) { + 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')); +} + +function saveSampleData(): void +{ + global $xoopsConfig; + + $configurator = new Common\Configurator(); + + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + + $tables = Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + + $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; + if (!\file_exists($languageFolder . '/')) { + Utility::createFolder($languageFolder . '/'); + } + $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; + Utility::createFolder($exportFolder); + + // save module tables + foreach ($tables as $table) { + TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); + } + + // save permissions + $skipColumns = []; + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('gperm_modid', Helper::getHelper($moduleDirName)->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(): void +{ + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + + try { + // TODO set exportSchema + // $migrate = new Modulebuilder\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')); + } +} + +/** + * loadTableFromArrayWithReplace + * + * @param string $table value with should be used insead of original value of $search + * + * @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(string $table, array $data, string $search, $replace) +{ + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $prefixedTable = $db->prefix($table); + $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 .= ', '; + } + $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; + } + } + + return $count; +} diff --git a/files/ratingfiles/assets/css/rating.css b/files/ratingfiles/assets/css/rating.css new file mode 100644 index 00000000..9fa2f66d --- /dev/null +++ b/files/ratingfiles/assets/css/rating.css @@ -0,0 +1,135 @@ +@charset "UTF-8"; +/* + 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. +*/ + +/** + * modulebuilder module for xoops + * + * @copyright module for xoops + * @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 + * @author Wedega - Email: - Website: + * @version $Id: 1.0 style.css 1 Mon 2018-03-19 10:04:56Z XOOPS Project (www.xoops.org) $ + */ + +.modulebuilder_ratingblock { + margin:20px 0; +} + +/* star rating */ +.modulebuilder_unit-rating { + width: 125px; + list-style: none; + height: 25px; + position: relative; + background: url(../images/starrating.png) top left repeat-x; + margin: 0; + padding: 0; +} +.modulebuilder_unit-rating-10 { + width: 250px; + list-style: none; + height: 25px; + position: relative; + background: url(../images/starrating.png) top left repeat-x; + margin: 0; + padding: 0; +} +.modulebuilder_unit-rating div, .modulebuilder_unit-rating-10 div { + text-indent: -90000px; + overflow: hidden; + margin: 0; + padding: 0; +} +.modulebuilder_unit-rating div a, .modulebuilder_unit-rating-10 div a { + outline: none; + display: block; + width: 25px; + height: 25px; + text-decoration: none; + text-indent: -9000px; + overflow: hidden; + z-index: 20; + position: absolute; + padding: 0; +} +.modulebuilder_unit-rating div a:hover, .modulebuilder_unit-rating-10 div a:hover { + background: url(../images/starrating.png) left bottom; + z-index: 2; + left: 0; +} +.modulebuilder_unit-rating div.modulebuilder_current-rating, .modulebuilder_unit-rating-10 div.modulebuilder_current-rating { + background: url(../images/starrating.png) left center; + position: absolute; + height: 25px; + display: block; + text-indent: -9000px; + z-index: 1; + overflow: hidden; +} +.modulebuilder_unit-rating a.modulebuilder_r1-unit {left: 0;} +.modulebuilder_unit-rating a.modulebuilder_r1-unit:hover {width: 25px;} +.modulebuilder_unit-rating a.modulebuilder_r2-unit {left: 25px;} +.modulebuilder_unit-rating a.modulebuilder_r2-unit:hover {width: 50px;} +.modulebuilder_unit-rating a.modulebuilder_r3-unit {left: 50px;} +.modulebuilder_unit-rating a.modulebuilder_r3-unit:hover {width: 75px;} +.modulebuilder_unit-rating a.modulebuilder_r4-unit {left: 75px;} +.modulebuilder_unit-rating a.modulebuilder_r4-unit:hover {width: 100px;} +.modulebuilder_unit-rating a.modulebuilder_r5-unit {left: 100px;} +.modulebuilder_unit-rating a.modulebuilder_r5-unit:hover {width: 125px;} + +.modulebuilder_unit-rating-10 a.modulebuilder_r1-unit {left: 0;} +.modulebuilder_unit-rating-10 a.modulebuilder_r1-unit:hover {width: 25px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r2-unit {left: 25px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r2-unit:hover {width: 50px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r3-unit {left: 50px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r3-unit:hover {width: 75px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r4-unit {left: 75px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r4-unit:hover {width: 100px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r5-unit {left: 100px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r5-unit:hover {width: 125px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r6-unit {left: 125px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r6-unit:hover {width: 150px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r7-unit {left: 150px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r7-unit:hover {width: 175px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r8-unit {left: 175px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r8-unit:hover {width: 200px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r9-unit {left: 200px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r9-unit:hover {width: 225px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r10-unit {left: 225px;} +.modulebuilder_unit-rating-10 a.modulebuilder_r10-unit:hover {width: 250px;} + +/* rating with likes */ +.modulebuilder-rate-dislike { + padding-left:20px; +} + +/* numeric rfating */ +.modulebuilder_unit-rating-10numeric { + margin:10px 0; + line-height:30px; +} +.modulebuilder-rater-numeric { + border:1px solid #ccc; + border-radius:5px; + padding:5px 7px; + margin:0px; + background-color:#ffffff; +} +.modulebuilder-rater-numeric:hover { + background-color:#337ab7; + color:#ffffff; +} +.modulebuilder-rater-numeric-active { + border:1px solid #d43f3a; + background-color:#eea236; +} diff --git a/files/ratingfiles/assets/icons/16/dislike.png b/files/ratingfiles/assets/icons/16/dislike.png new file mode 100644 index 00000000..e6ce3b62 Binary files /dev/null and b/files/ratingfiles/assets/icons/16/dislike.png differ diff --git a/files/ratingfiles/assets/icons/16/like.png b/files/ratingfiles/assets/icons/16/like.png new file mode 100644 index 00000000..14761be3 Binary files /dev/null and b/files/ratingfiles/assets/icons/16/like.png differ diff --git a/files/ratingfiles/assets/icons/16/rate.png b/files/ratingfiles/assets/icons/16/rate.png new file mode 100644 index 00000000..02a7501b Binary files /dev/null and b/files/ratingfiles/assets/icons/16/rate.png differ diff --git a/files/ratingfiles/assets/icons/16/votes.png b/files/ratingfiles/assets/icons/16/votes.png new file mode 100644 index 00000000..04f90ae5 Binary files /dev/null and b/files/ratingfiles/assets/icons/16/votes.png differ diff --git a/files/ratingfiles/assets/icons/32/dislike.png b/files/ratingfiles/assets/icons/32/dislike.png new file mode 100644 index 00000000..fac139b6 Binary files /dev/null and b/files/ratingfiles/assets/icons/32/dislike.png differ diff --git a/files/ratingfiles/assets/icons/32/like.png b/files/ratingfiles/assets/icons/32/like.png new file mode 100644 index 00000000..21a672a1 Binary files /dev/null and b/files/ratingfiles/assets/icons/32/like.png differ diff --git a/files/ratingfiles/assets/images/starrating.png b/files/ratingfiles/assets/images/starrating.png new file mode 100644 index 00000000..4227a780 Binary files /dev/null and b/files/ratingfiles/assets/images/starrating.png differ diff --git a/files/ratingfiles/class/Ratings.php b/files/ratingfiles/class/Ratings.php new file mode 100644 index 00000000..71cfe7e1 --- /dev/null +++ b/files/ratingfiles/class/Ratings.php @@ -0,0 +1,103 @@ +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); + } + + /** + * @static function &getInstance + * @return Ratings + */ + public static function getInstance(): self + { + static $instance = null; + if (null === $instance) { + $instance = new self(); + } + return $instance; + } + + /** + * The new inserted $Id + * @return int inserted id + */ + public function getNewInsertedIdRatings() + { + return $GLOBALS['xoopsDB']->getInsertId(); + } + + /** + * Get Values + * @param null $keys + * @param null $format + * @param null $maxDepth + * @return array + */ + public function getValuesRatings($keys = null, $format = null, $maxDepth = null) + { + $ret = $this->getValues($keys, $format, $maxDepth); + $ret['id'] = $this->getVar('rate_id'); + $ret['source'] = $this->getVar('rate_source'); + $ret['itemid'] = $this->getVar('rate_itemid'); + $ret['value'] = $this->getVar('rate_value'); + $ret['uid'] = \XoopsUser::getUnameFromId($this->getVar('rate_uid')); + $ret['ip'] = $this->getVar('rate_ip'); + $ret['date'] = \formatTimestamp($this->getVar('rate_date'), 's'); + + return $ret; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArrayRatings() + { + $ret = []; + $vars = $this->getVars(); + foreach (\array_keys($vars) as $var) { + $ret[$var] = $this->getVar($var); + } + + return $ret; + } +} diff --git a/files/ratingfiles/class/RatingsHandler.php b/files/ratingfiles/class/RatingsHandler.php new file mode 100644 index 00000000..182e6623 --- /dev/null +++ b/files/ratingfiles/class/RatingsHandler.php @@ -0,0 +1,200 @@ +db->getInsertId(); + } + + /** + * Get Rating per item in the database + * @param int $itemid + * @param int $source + * @return array + */ + public function getItemRating(int $itemid = 0, int $source = 0) + { + $helper = \XoopsModules\Modulebuilder\Helper::getInstance(); + + $ItemRating = []; + $ItemRating['nb_ratings'] = 0; + $uid = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; + $voted = false; + $ip = \getenv('REMOTE_ADDR'); + $current_rating = 0; + + if (Constants::RATING_5STARS === (int)$helper->getConfig('ratingbars') + || Constants::RATING_10STARS === (int)$helper->getConfig('ratingbars') + || Constants::RATING_10NUM === (int)$helper->getConfig('ratingbars')) { + $rating_unitwidth = 25; + if (Constants::RATING_5STARS === (int)$helper->getConfig('ratingbars')) { + $max_units = 5; + } else { + $max_units = 10; + } + + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('rate_itemid', $itemid)); + $criteria->add(new \Criteria('rate_source', $source)); + + $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); + $count = \count($ratingObjs); + $ItemRating['nb_ratings'] = $count; + + foreach ($ratingObjs as $ratingObj) { + $current_rating += $ratingObj->getVar('rate_value'); + if (($ratingObj->getVar('rate_ip') == $ip && 0 == $uid) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { + $voted = true; + $ItemRating['id'] = $ratingObj->getVar('rate_id'); + } + } + unset($ratingObj); + unset($criteria); + + $ItemRating['avg_rate_value'] = 0; + if ($count > 0) { + $ItemRating['avg_rate_value'] = \number_format($current_rating / $count, 2); + } + if (1 == $count) { + $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', (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', (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'; + $ItemRating['maxsize'] = ($max_units * $rating_unitwidth) . 'px'; + } else { + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('rate_itemid', $itemid)); + $criteria->add(new \Criteria('rate_source', $source)); + $criteria->add(new \Criteria('rate_value', 0, '<')); + + $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); + $count = \count($ratingObjs); + + foreach ($ratingObjs as $ratingObj) { + $current_rating += $ratingObj->getVar('rate_value'); + if (($ratingObj->getVar('rate_ip') == $ip && 0 == $uid) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { + $voted = true; + $ItemRating['id'] = $ratingObj->getVar('rate_id'); + } + } + unset($ratingObj); + unset($criteria); + $ItemRating['dislikes'] = $count; + + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('rate_itemid', $itemid)); + $criteria->add(new \Criteria('rate_source', $source)); + $criteria->add(new \Criteria('rate_value', 0, '>')); + + $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); + $count = \count($ratingObjs); + $current_rating = 0; + foreach ($ratingObjs as $ratingObj) { + $current_rating += $ratingObj->getVar('rate_value'); + if (($ratingObj->getVar('rate_ip') == $ip && 0 == $uid) || ($uid > 0 && $uid == $ratingObj->getVar('rate_uid'))) { + $voted = true; + $ItemRating['id'] = $ratingObj->getVar('rate_id'); + } + } + unset($ratingObj); + unset($criteria); + $ItemRating['likes'] = $count; + + $count = $ItemRating['likes'] + $ItemRating['dislikes']; + } + + $ItemRating['uid'] = $uid; + $ItemRating['nb_ratings'] = $count; + $ItemRating['voted'] = $voted; + $ItemRating['ip'] = $ip; + + return $ItemRating; + } + + /** + * delete ratings of given item + * @param mixed $itemid + * @param mixed $source + * @return bool + */ + public function deleteAllRatings($itemid, $source) + { + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('rate_itemid', $itemid)); + $criteria->add(new \Criteria('rate_source', $source)); + + return $this->deleteAll($criteria); + } +} diff --git a/files/ratingfiles/templates/modulebuilder_rate.tpl b/files/ratingfiles/templates/modulebuilder_rate.tpl new file mode 100644 index 00000000..ec208a0d --- /dev/null +++ b/files/ratingfiles/templates/modulebuilder_rate.tpl @@ -0,0 +1,101 @@ + + <{if $rating_5stars}> +
      +
      +
      +
      <{$item.rating.text}>
      +
      + 1 +
      +
      + 2 +
      +
      + 3 +
      +
      + 4 +
      +
      + 5 +
      +
      +
      + <{$item.rating.text}> +
      +
      +
      + <{/if}> + <{if $rating_10stars}> +
      +
      +
      +
      <{$item.rating.text}>
      +
      + 1 +
      +
      + 2 +
      +
      + 3 +
      +
      + 4 +
      +
      + 5 +
      +
      + 6 +
      +
      + 7 +
      +
      + 8 +
      +
      + 9 +
      +
      + 10 +
      +
      +
      + <{$item.rating.text}> +
      +
      +
      + <{/if}> +<{if $rating_10num}> +
      +
      +
      + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 +
      +
      + <{$item.rating.text}> +
      +
      +
      + <{/if}> + <{if $rating_likes}> + + <{/if}> +
      \ No newline at end of file diff --git a/include/common.php b/include/common.php index a14e63db..6298315c 100644 --- a/include/common.php +++ b/include/common.php @@ -1,4 +1,4 @@ -getVar('dirname'); // Root Frameworks icons 32x32 directory -if (!defined('XOOPS_ICONS32_PATH')) { - define('XOOPS_ICONS32_PATH', XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'); +if (!\defined('XOOPS_ICONS32_PATH')) { + \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'); +if (!\defined('XOOPS_ICONS32_URL')) { + \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_CLASS_PATH', TDMC_PATH . '/class'); -define('TDMC_CLASS_URL', TDMC_URL . '/class'); -define('TDMC_DOCS_PATH', TDMC_PATH . '/docs'); -define('TDMC_DOCS_URL', TDMC_URL . '/docs'); -define('TDMC_FONTS_PATH', TDMC_PATH . '/assets/fonts'); -define('TDMC_FONTS_URL', TDMC_URL . '/assets/fonts'); -define('TDMC_IMAGE_PATH', TDMC_PATH . '/assets/images'); -define('TDMC_IMAGE_URL', TDMC_URL . '/assets/images'); -define('TDMC_IMAGES_LOGOS_PATH', TDMC_PATH . '/assets/images/logos'); -define('TDMC_IMAGES_LOGOS_URL', TDMC_URL . '/assets/images/logos'); -define('TDMC_ICONS_PATH', TDMC_PATH . '/assets/icons'); -define('TDMC_ICONS_URL', TDMC_URL . '/assets/icons'); -define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', TDMC_URL . '/assets/images/logoModule.png'); +\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'); +\define('TDMC_DOCS_URL', TDMC_URL . '/docs'); +\define('TDMC_FONTS_PATH', TDMC_PATH . '/assets/fonts'); +\define('TDMC_FONTS_URL', TDMC_URL . '/assets/fonts'); +\define('TDMC_IMAGE_PATH', TDMC_PATH . '/assets/images'); +\define('TDMC_IMAGE_URL', TDMC_URL . '/assets/images'); +\define('TDMC_IMAGES_LOGOS_PATH', TDMC_PATH . '/assets/images/logos'); +\define('TDMC_IMAGES_LOGOS_URL', TDMC_URL . '/assets/images/logos'); +\define('TDMC_ICONS_PATH', TDMC_PATH . '/assets/icons'); +\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_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'); -define('TDMC_UPLOAD_IMGMOD_URL', TDMC_UPLOAD_URL . '/images/modules'); -define('TDMC_UPLOAD_IMGTAB_PATH', TDMC_UPLOAD_PATH . '/images/tables'); -define('TDMC_UPLOAD_IMGTAB_URL', TDMC_UPLOAD_URL . '/images/tables'); +\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'); +\define('TDMC_UPLOAD_IMGMOD_URL', TDMC_UPLOAD_URL . '/images/modules'); +\define('TDMC_UPLOAD_IMGTAB_PATH', TDMC_UPLOAD_PATH . '/images/tables'); +\define('TDMC_UPLOAD_IMGTAB_URL', TDMC_UPLOAD_URL . '/images/tables'); +\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'; -include_once TDMC_PATH . '/class/helper.php'; +require_once \XOOPS_ROOT_PATH . '/class/xoopsrequest.php'; diff --git a/include/functions.php b/include/functions.php index 8386d6c4..d4726331 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,4 +1,4 @@ - '
      ', + 0 => '', 1 => '
      ' - . _AM_TDMCREATE_ABOUT_MAKE_DONATION + . \_AM_MODULEBUILDER_ABOUT_MAKE_DONATION . '
      ' - . _AM_TDMCREATE_DONATION_AMOUNT + . \_AM_MODULEBUILDER_DONATION_AMOUNT . '*
      ', - 2 => '
      ', + 2 => '', 'D' => '', 3 => '', 4 => ' @@ -62,24 +62,22 @@ 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'), + \defined('XOOPS_LICENSE_KEY') ? \XOOPS_LICENSE_KEY : '', + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') + ); } } $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); - $aboutRes .= implode("\n", $donationform); + $aboutRes .= \implode("\n", $donationform); $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); return $aboutRes; @@ -92,5 +90,5 @@ function xoopsFormValidate_donation() { var myform = window.document.donation; */ function UcFirstAndToLower($str) { - return ucfirst(mb_strtolower(trim($str))); + return \ucfirst(\mb_strtolower(\trim($str))); } diff --git a/include/index.html b/include/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/include/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/include/index.php b/include/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/include/index.php @@ -0,0 +1,2 @@ + - Website: XOOPS Project (www.xoops.org) $ */ -use XoopsModules\Tdmcreate; -use XoopsModules\Tdmcreate\Common; +use XoopsModules\Modulebuilder; +use XoopsModules\Modulebuilder\Common; /** * @param \XoopsModule $module * @return bool */ -function xoops_module_pre_install_tdmcreate(\XoopsModule $module) +function xoops_module_pre_install_modulebuilder(\XoopsModule $module) { - require dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Tdmcreate\Utility $utility */ - $utility = new Tdmcreate\Utility(); + require \dirname(__DIR__) . '/preloads/autoloader.php'; + $utility = new Modulebuilder\Utility(); //check for minimum XOOPS version $xoopsSuccess = $utility::checkVerXoops($module); @@ -51,17 +49,16 @@ function xoops_module_pre_install_tdmcreate(\XoopsModule $module) /** * @param \XoopsModule $module - * @return bool|string + * @return true */ -function xoops_module_install_tdmcreate(\XoopsModule $module) +function xoops_module_install_modulebuilder(\XoopsModule $module) { - require dirname(__DIR__) . '/preloads/autoloader.php'; + require \dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Tdmcreate\Helper $helper */ - /** @var Tdmcreate\Utility $utility */ + /** @var Modulebuilder\Helper $helper */ /** @var Modulebuilder\Utility $utility */ /** @var Common\Configurator $configurator */ - $helper = Tdmcreate\Helper::getInstance(); - $utility = new Tdmcreate\Utility(); + $helper = Modulebuilder\Helper::getInstance(); + $utility = new Modulebuilder\Utility(); $configurator = new Common\Configurator(); // Load language files @@ -70,26 +67,42 @@ function xoops_module_install_tdmcreate(\XoopsModule $module) $helper->loadLanguage('common'); // --- CREATE FOLDERS --------------- - if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - foreach (array_keys($configurator->uploadFolders) as $i) { + if ($configurator->uploadFolders && \is_array($configurator->uploadFolders)) { + // foreach (\array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (\array_keys($configurator->uploadFolders) as $i) { $utility::createFolder($configurator->uploadFolders[$i]); } } // --- COPY blank.gif FILES --------------- - if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $file = dirname(__DIR__) . '/assets/images/blank.gif'; - foreach (array_keys($configurator->copyBlankFiles) as $i) { + if ($configurator->copyBlankFiles && \is_array($configurator->copyBlankFiles)) { + $file = \dirname(__DIR__) . '/assets/images/blank.gif'; + foreach (\array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.gif'; $utility::copyFile($file, $dest); } - $file = dirname(__DIR__) . '/assets/images/blank.png'; - foreach (array_keys($configurator->copyBlankFiles) as $i) { + $file = \dirname(__DIR__) . '/assets/images/blank.png'; + foreach (\array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); } } + // --- COPY empty.png FILES --------------- + if ($configurator->copyBlankFiles && \is_array($configurator->copyBlankFiles)) { + $file = \dirname(__DIR__) . '/assets/images/modules/empty.png'; + foreach (\array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/empty.png'; + $utility::copyFile($file, $dest); + } + } + + // --- 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/include/update.php b/include/update.php index 6dccdedd..68c02806 100644 --- a/include/update.php +++ b/include/update.php @@ -1,4 +1,4 @@ -getErrors()); } - tdmcreate_check_db($module); + if (!clean_index_files()) { + $ret = false; + print_r($module->getErrors()); + } //check upload directory - include_once __DIR__ . '/install.php'; - xoops_module_install_tdmcreate($module); + require_once __DIR__ . '/install.php'; + if (!xoops_module_install_modulebuilder($module)) { + $ret = false; + } $errors = $module->getErrors(); if (!empty($errors)) { @@ -50,7 +61,6 @@ function xoops_module_update_tdmcreate(&$module, $prev_version = null) } return $ret; - } // irmtfan bug fix: solve templates duplicate issue @@ -59,31 +69,31 @@ function xoops_module_update_tdmcreate(&$module, $prev_version = null) * * @return bool */ -function update_tdmcreate_v191(&$module) +function update_modulebuilder_v191($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 (list($tplid) = $xoopsDB->fetchRow($result)) { + while ([$tplid] = $xoopsDB->fetchRow($result)) { $tplids[] = $tplid; } - if (count($tplids) > 0) { - $tplfileHandler = xoops_getHandler('tplfile'); + if (\count($tplids) > 0) { + $tplfileHandler = \xoops_getHandler('tplfile'); $duplicate_files = $tplfileHandler->getObjects( - new \Criteria('tpl_id', '(' . implode(',', $tplids) . ')', 'IN') + new \Criteria('tpl_id', '(' . \implode(',', $tplids) . ')', 'IN') ); - if (count($duplicate_files) > 0) { - foreach (array_keys($duplicate_files) as $i) { + 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); + xoops_error($xoopsDB->error() . '
      ' . $sql); return false; } @@ -99,8 +109,8 @@ function update_tdmcreate_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)) { - xoops_error($xoopsDB->error() . '
      ' . $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." ); @@ -110,6 +120,7 @@ function update_tdmcreate_v191(&$module) return true; } + // irmtfan bug fix: solve templates duplicate issue /** @@ -118,42 +129,42 @@ function update_tdmcreate_v191(&$module) * * @return bool */ -function tdmcreate_check_db($module) +function modulebuilder_check_db($module) { $ret = true; //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; $fvalue = 'XoopsFormSelectStatus'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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); + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } // update table fields to new id of previous 16 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field Password @@ -161,31 +172,28 @@ function tdmcreate_check_db($module) $fid = 17; $fvalue = 'XoopsFormPassword'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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 + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // update table fields to new id of previous 17 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); - // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + 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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field SelectCountry @@ -193,31 +201,28 @@ function tdmcreate_check_db($module) $fid = 18; $fvalue = 'XoopsFormSelectCountry'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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 + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // update table fields to new id of previous 18 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); - // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + 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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field SelectLanguage @@ -225,31 +230,28 @@ function tdmcreate_check_db($module) $fid = 19; $fvalue = 'XoopsFormSelectLang'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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 + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // update table fields to new id of previous 19 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); - // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + 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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field Radio @@ -257,31 +259,28 @@ function tdmcreate_check_db($module) $fid = 20; $fvalue = 'XoopsFormRadio'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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 + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // update table fields to new id of previous 20 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); - // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + 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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field DateTime @@ -289,31 +288,28 @@ function tdmcreate_check_db($module) $fid = 21; $fvalue = 'XoopsFormDateTime'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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 + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // update table fields to new id of previous 21 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); - // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + 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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } // new form field DateTime @@ -321,84 +317,596 @@ function tdmcreate_check_db($module) $fid = 22; $fvalue = 'XoopsFormSelectCombo'; $result = $xoopsDB->query( - 'SELECT * FROM ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " as fe WHERE fe.fieldelement_name = '{$fname}'" + '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('tdmcreate_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) = $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('tdmcreate_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 + $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}')"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // update table fields to new id of previous 22 $newId = $xoopsDB->getInsertId(); - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('tdmcreate_fields') . "`.`field_element` = '{$fid}';"; - $result = $xoopsDB->query($sql); - // update 16 to new element - $sql = 'UPDATE `' . $xoopsDB->prefix('tdmcreate_fieldelements') . "` SET `fieldelement_mid` = '0', `fieldelement_tid` = '0', `fieldelement_name` = '{$fname}', `fieldelement_value` = '{$fvalue}' WHERE `fieldelement_id` = {$fid};"; - $result = $xoopsDB->query($sql); + $sql = 'UPDATE `' . $xoopsDB->prefix('modulebuilder_fields') . "` SET `field_element` = '{$newId}' WHERE `" . $xoopsDB->prefix('modulebuilder_fields') . "`.`field_element` = '{$fid}';"; + 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('tdmcreate_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; - $result = $xoopsDB->query($sql); + $sql = 'INSERT INTO `' . $xoopsDB->prefix('modulebuilder_fieldelements') . "` (`fieldelement_id`, `fieldelement_mid`, `fieldelement_tid`, `fieldelement_name`, `fieldelement_value`) VALUES (NULL, '0', '0', '{$fname}', '{$fvalue}')"; } + if (!$xoopsDB->query($sql)) { $ret = false; } } - // update table 'tdmcreate_fieldelements' - $table = $GLOBALS['xoopsDB']->prefix('tdmcreate_fieldelements'); + // update table 'modulebuilder_fieldelements' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); $field = 'fieldelement_sort'; $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); $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; } } - // update table 'tdmcreate_fieldelements' - $table = $GLOBALS['xoopsDB']->prefix('tdmcreate_fieldelements'); + // update table 'modulebuilder_fieldelements' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); $field = 'fieldelement_deftype'; $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); $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; } } - // update table 'tdmcreate_fieldelements' - $table = $GLOBALS['xoopsDB']->prefix('tdmcreate_fieldelements'); + // update table 'modulebuilder_fieldelements' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fieldelements'); $field = 'fieldelement_defvalue'; $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); $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; + } + } + + // update table 'modulebuilder_fields' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fields'); + $field = 'field_ifoot'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `field_user`;"; + if (!$GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when adding '$field' to table '$table'."); + $ret = false; + } + } + // update table 'modulebuilder_fields' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fields'); + $field = 'field_ibody'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `field_user`;"; + if (!$GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when adding '$field' to table '$table'."); + $ret = false; + } + } + // update table 'modulebuilder_fields' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_fields'); + $field = 'field_ihead'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `field_user`;"; + if (!$GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when adding '$field' to table '$table'."); + $ret = false; + } + } + + // update table 'modulebuilder_morefiles' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_morefiles'); + $field = 'file_type'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` INT(8) NOT NULL DEFAULT '0' AFTER `file_mid`;"; + if (!$GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when adding '$field' to table '$table'."); + $ret = false; + } + } + + // update table 'modulebuilder_morefiles' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_morefiles'); + $field = 'file_upload'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` varchar(255) NOT NULL DEFAULT '' AFTER `file_extension`;"; + if (!$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 UUID + $fname = 'TextUuid'; + $fid = 23; + $fvalue = 'XoopsFormTextUuid'; + $fsort = 22; + $fdeftype = 14; + $fdefvalue = 45; + $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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + [$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}')"; + 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}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // 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};"; + } 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + + // new form field text IP + $fname = 'TextIp'; + $fid = 24; + $fvalue = 'XoopsFormTextIp'; + $fsort = 23; + $fdeftype = 14; + $fdefvalue = 16; + $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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + [$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}')"; + 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}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // 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};"; + } 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + + // 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 (!$GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when changing '$field' in table '$table'."); + $ret = false; + } + + // new form field text comments + $fname = 'TextComments'; + $fid = 25; + $fvalue = 'XoopsFormTextComments'; + $fsort = 24; + $fdeftype = 2; + $fdefvalue = 10; + $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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + [$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}')"; + 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}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // 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};"; + } 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + // new form field text ratings + $fname = 'TextRatings'; + $fid = 26; + $fvalue = 'XoopsFormTextRatings'; + $fsort = 25; + $fdeftype = 7; + $fdefvalue = '10, 2'; + $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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + [$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}')"; + 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}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // 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};"; + } 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + // new form field text votes + $fname = 'TextVotes'; + $fid = 27; + $fvalue = 'XoopsFormTextVotes'; + $fsort = 26; + $fdeftype = 2; + $fdefvalue = 10; + $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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + [$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}')"; + 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}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // 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};"; + } 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + // new form field text votes + $fname = 'TextReads'; + $fid = 28; + $fvalue = 'XoopsFormTextReads'; + $fsort = 27; + $fdeftype = 2; + $fdefvalue = 10; + $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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + [$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}')"; + 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}';"; + if (!$xoopsDB->query($sql)) { $ret = false; } + // 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};"; + } 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + + // update table 'modulebuilder_tables' + $table = $GLOBALS['xoopsDB']->prefix('modulebuilder_tables'); + $field = 'table_reads'; + $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); + $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); + if (!$numRows) { + $sql = "ALTER TABLE `$table` ADD `$field` TINYINT(1) NOT NULL DEFAULT '0' AFTER `table_rss`;"; + if (!$GLOBALS['xoopsDB']->queryF($sql)) { xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); $module->setErrors("Error when adding '$field' to table '$table'."); $ret = false; } } - // set default values for form elements - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '255' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in(2, 10, 11, 12, 13, 14, 17)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 15, `fieldelement_defvalue` = '0' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in (3, 4)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 2, `fieldelement_defvalue` = '10' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in(5, 7, 8, 15, 20, 21, 22)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 2, `fieldelement_defvalue` = '1' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in(6, 16)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '7' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in(9)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '3' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in(18)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 14, `fieldelement_defvalue` = '100' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_id` in(19)"); - $result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('tdmcreate_fieldelements') . " SET `fieldelement_deftype` = 2, `fieldelement_defvalue` = '10' WHERE `xc_tdmcreate_fieldelements`.`fieldelement_mid` > 0"); + // update table 'modulebuilder_settings' + $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 (!$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_min_xoops'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(15) NOT NULL DEFAULT '1.0';"; + if (!$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_since'; + $sql = "ALTER TABLE `$table` CHANGE `$field` `$field` varchar(10) NOT NULL DEFAULT '1.0';"; + if (!$GLOBALS['xoopsDB']->queryF($sql)) { + xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); + $module->setErrors("Error when changing '$field' in table '$table'."); + $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 (!$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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + 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}')"; + 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}';"; + 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + // 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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + 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}')"; + 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}';"; + 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + + // 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(sprintf($sqlQueryFid, $fid)); + $num_rows = $GLOBALS['xoopsDB']->getRowsNum($result); + if ($num_rows > 0) { + 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}')"; + 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}';"; + 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}')"; + } + if (!$xoopsDB->query($sql)) { $ret = false; } + } + + // resorting elements + $sortElements = []; + $sortElements[] = 'Text'; + $sortElements[] = 'TextInteger'; + $sortElements[] = 'TextFloat'; + $sortElements[] = 'TextArea'; + $sortElements[] = 'DhtmlTextArea'; + $sortElements[] = 'CheckBox'; + $sortElements[] = 'RadioYN'; + $sortElements[] = 'RadioOnoffline'; + $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) { + 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; } + +/** + * function remove unnecessary index.php from files folder + * which could be added by index_scan module + * + * @return bool + */ +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'; + + foreach($files as $file) { + if (\file_exists($file)) { + \unlink($file); + } + } + + return true; +} diff --git a/index.html b/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/index.php b/index.php index 2c5cdd3f..e5ee0725 100644 --- a/index.php +++ b/index.php @@ -1 +1,2 @@ - +%s settings stored in the Database"); -define('_AM_TDMCREATE_THEREARE_NUMMODULES', "There are %s modules stored in the Database"); -define('_AM_TDMCREATE_THEREARE_NUMTABLES', "There are %s tables stored in the Database"); -define('_AM_TDMCREATE_THEREARE_NUMFIELDS', "There are %s fields stored in the Database"); -define('_AM_TDMCREATE_THEREARE_NUMFILES', "There are %s more files stored in the Database"); +\define('_AM_MODULEBUILDER_ADMIN_INDEX', 'Index'); +\define('_AM_MODULEBUILDER_ADMIN_MODULES', 'Add Module'); +\define('_AM_MODULEBUILDER_ADMIN_TABLES', 'Add Table'); +\define('_AM_MODULEBUILDER_ADMIN_CONST', 'Build Module'); +\define('_AM_MODULEBUILDER_ADMIN_ABOUT', 'About'); +\define('_AM_MODULEBUILDER_ADMIN_PREFERENCES', 'Preferences'); +\define('_AM_MODULEBUILDER_ADMIN_UPDATE', 'Update'); +\define('_AM_MODULEBUILDER_ADMIN_NUMMODULES', 'Statistics'); +\define('_AM_MODULEBUILDER_THEREARE_NUMSETTINGS', "There are %s settings stored in the Database"); +\define('_AM_MODULEBUILDER_THEREARE_NUMMODULES', "There are %s modules stored in the Database"); +\define('_AM_MODULEBUILDER_THEREARE_NUMTABLES', "There are %s tables stored in the Database"); +\define('_AM_MODULEBUILDER_THEREARE_NUMFIELDS', "There are %s fields stored in the Database"); +\define('_AM_MODULEBUILDER_THEREARE_NUMFILES', "There are %s more files stored in the Database"); +\define('_AM_MODULEBUILDER_THEREARENT_MODULES', "There aren't modules"); +\define('_AM_MODULEBUILDER_THEREARENT_TABLES', "There aren't tables"); +\define('_AM_MODULEBUILDER_THEREARENT_FIELDS', "There aren't fields"); +\define('_AM_MODULEBUILDER_THEREARENT_MORE_FILES', "There aren't more files"); +\define('_AM_MODULEBUILDER_THEREARENT_SETTINGS', 'There are NO Settings! Please create Settings'); +\define('_AM_MODULEBUILDER_THEREARENT_MODULES2', "There aren't modules, pleace create one first"); +\define('_AM_MODULEBUILDER_THEREARENT_TABLES2', "There aren't tables, pleace create one first"); +// // General -define('_AM_TDMCREATE_FORMOK', 'Successfully saved'); -define('_AM_TDMCREATE_FORMDELOK', 'Successfully deleted'); -define('_AM_TDMCREATE_FORMSUREDEL', "Are you sure to delete: %s "); -define('_AM_TDMCREATE_FORMSURERENEW', "Are you sure to update: %s "); -define('_AM_TDMCREATE_FORMUPLOAD', 'Upload file'); -define('_AM_TDMCREATE_FORMIMAGE_PATH', 'Files in %s '); -define('_AM_TDMCREATE_FORMACTION', 'Action'); -define('_AM_TDMCREATE_FORMEDIT', 'Modification'); -define('_AM_TDMCREATE_FORMDEL', 'Clear'); -define('_AM_TDMCREATE_FORMFIELDS', 'Edit fields'); -define('_AM_TDMCREATE_FORM_INFO_TABLE_OPTIONAL_FIELD', 'Optional fields'); -define('_AM_TDMCREATE_FORM_INFO_TABLE_STRUCTURES_FIELD', 'Structures fields'); -define('_AM_TDMCREATE_FORM_INFO_TABLE_ICON_FIELD', 'Icon fields'); - -define('_AM_TDMCREATE_ID', 'ID'); -define('_AM_TDMCREATE_NAME', 'Name'); -define('_AM_TDMCREATE_BLOCKS', 'Blocks'); -define('_AM_TDMCREATE_NB_FIELDS', 'Number of fields'); -define('_AM_TDMCREATE_IMAGE', 'Image'); -define('_AM_TDMCREATE_DISPLAY_ADMIN', 'Visible in Admin Panel'); -// 1.37 -define('_AM_TDMCREATE_DISPLAY_USER', 'Visible in User View'); -// Added in version 1.91 -define('_AM_TDMCREATE_ADD_SETTING', 'Add Settings'); -define('_AM_TDMCREATE_SETTINGS_LIST', 'Settings List'); -define('_AM_TDMCREATE_SETTING_NEW', 'New Settings'); -define('_AM_TDMCREATE_SETTING_EDIT', 'Edit Settings'); -define('_AM_TDMCREATE_SETTING_NAME', 'Set Name'); -define('_AM_TDMCREATE_SETTING_DIRNAME', 'Set Directory Name'); -define('_AM_TDMCREATE_SETTING_VERSION', 'Set Version'); -define('_AM_TDMCREATE_SETTING_SINCE', 'Set Since'); -define('_AM_TDMCREATE_SETTING_DESCRIPTION', 'Set Description'); -define('_AM_TDMCREATE_SETTING_CREATENEWLOGO', 'Set Create New Logo'); -define('_AM_TDMCREATE_SETTING_AUTHOR', 'Set Author'); -define('_AM_TDMCREATE_SETTING_AUTHOR_MAIL', 'Set Author Email'); -define('_AM_TDMCREATE_SETTING_AUTHOR_WEBSITE_URL', 'Set Author Site Url'); -define('_AM_TDMCREATE_SETTING_AUTHOR_WEBSITE_NAME', 'Set Author Site Name'); -define('_AM_TDMCREATE_SETTING_CREDITS', 'Set Credits'); -define('_AM_TDMCREATE_SETTING_LICENSE', 'Set License'); -define('_AM_TDMCREATE_SETTING_RELEASE_INFO', 'Set Release Info'); -define('_AM_TDMCREATE_SETTING_RELEASE_FILE', 'Set Release File'); -define('_AM_TDMCREATE_SETTING_MANUAL', 'Set Manual'); -define('_AM_TDMCREATE_SETTING_MANUAL_FILE', 'Set Manual File'); -define('_AM_TDMCREATE_SETTING_IMAGE', 'Set Image'); -define('_AM_TDMCREATE_SETTING_DEMO_SITE_URL', 'Set Demo Site Url'); -define('_AM_TDMCREATE_SETTING_DEMO_SITE_NAME', 'Set Demo Site Name'); -define('_AM_TDMCREATE_SETTING_SUPPORT_URL', 'Set Support URL'); -define('_AM_TDMCREATE_SETTING_SUPPORT_NAME', 'Set Support Name'); -define('_AM_TDMCREATE_SETTING_WEBSITE_URL', 'Set Module Website URL'); -define('_AM_TDMCREATE_SETTING_WEBSITE_NAME', 'Set Module Website Name'); -define('_AM_TDMCREATE_SETTING_RELEASE', 'Set Release'); -define('_AM_TDMCREATE_SETTING_STATUS', 'Set Status'); -define('_AM_TDMCREATE_SETTING_PAYPAL_BUTTON', 'Set Button for Donations'); -define('_AM_TDMCREATE_SETTING_SUBVERSION', 'Set Subversion module'); -define('_AM_TDMCREATE_SETTING_ADMIN', 'Set Visible Admin'); -define('_AM_TDMCREATE_SETTING_USER', 'Set Visible User'); -define('_AM_TDMCREATE_SETTING_MIN_PHP', 'Set Minimum PHP'); -define('_AM_TDMCREATE_SETTING_MIN_XOOPS', 'Set Minimum XOOPS'); -define('_AM_TDMCREATE_SETTING_MIN_ADMIN', 'Set Minimum Admin'); -define('_AM_TDMCREATE_SETTING_MIN_MYSQL', 'Set Minimum MySQL'); -define('_AM_TDMCREATE_SETTING_BLOCKS', 'Set Activate Blocks'); -define('_AM_TDMCREATE_SETTING_SEARCH', 'Set Activate Search'); -define('_AM_TDMCREATE_SETTING_COMMENTS', 'Set Activate Comments'); -define('_AM_TDMCREATE_SETTING_NOTIFICATIONS', 'Set Activate Notifications'); -define('_AM_TDMCREATE_SETTING_PERMISSIONS', 'Set Activate Permissions'); -//define('_AM_TDMCREATE_SETTING_INROOT_COPY', 'Set Create Copy of this module in root/modules'); -define('_AM_TDMCREATE_SETTING_ALL', 'Set Check All'); -define('_AM_TDMCREATE_SETTING_CHOISE', 'Set Choise Settings'); -//Modules.php +\define('_AM_MODULEBUILDER_FORMOK', 'Successfully saved'); +\define('_AM_MODULEBUILDER_FORMDELOK', 'Successfully deleted'); +\define('_AM_MODULEBUILDER_FORMSUREDEL', "Are you sure to delete: %s "); +\define('_AM_MODULEBUILDER_FORMSURERENEW', "Are you sure to update: %s "); +\define('_AM_MODULEBUILDER_FORMUPLOAD', 'Upload file'); +\define('_AM_MODULEBUILDER_FORMIMAGE_PATH', 'Files in %s '); +\define('_AM_MODULEBUILDER_FORMACTION', 'Action'); +\define('_AM_MODULEBUILDER_FORMEDIT', 'Modification'); +\define('_AM_MODULEBUILDER_FORMDEL', 'Clear'); +\define('_AM_MODULEBUILDER_FORMFIELDS', 'Edit fields'); +\define('_AM_MODULEBUILDER_FORM_INFO_TABLE_OPTIONAL_FIELD', 'Optional fields'); +\define('_AM_MODULEBUILDER_FORM_INFO_TABLE_STRUCTURES_FIELD', 'Structures fields'); +\define('_AM_MODULEBUILDER_FORM_INFO_TABLE_ICON_FIELD', 'Icon fields'); +\define('_AM_MODULEBUILDER_FORMON', 'Online'); +\define('_AM_MODULEBUILDER_FORMOFF', 'Offline'); +\define('_AM_MODULEBUILDER_FORMADD', 'Add'); +\define( + '_AM_MODULEBUILDER_OPTIONS_DESC', + 'Select one or all items to add specific addon in this new module' +); +// Common / List headers in templates +\define('_AM_MODULEBUILDER_ID', 'Id'); +\define('_AM_MODULEBUILDER_NAME', 'Name'); +\define('_AM_MODULEBUILDER_BLOCK', 'Block'); +\define('_AM_MODULEBUILDER_BLOCKS', 'Blocks'); +\define('_AM_MODULEBUILDER_FIELDS', 'Fields'); +\define('_AM_MODULEBUILDER_NBFIELDS', 'Number of fields'); +\define('_AM_MODULEBUILDER_IMAGE', 'Image'); +\define('_AM_MODULEBUILDER_DISPLAY_ADMIN', 'Visible in Admin Panel'); +\define('_AM_MODULEBUILDER_DISPLAY_USER', 'Visible in User View'); +\define('_AM_MODULEBUILDER_PARENT', 'Parent'); +\define('_AM_MODULEBUILDER_INLIST', 'Inlist'); +\define('_AM_MODULEBUILDER_INFORM', 'Inform'); +\define('_AM_MODULEBUILDER_ADMIN', 'Admin'); +\define('_AM_MODULEBUILDER_USER', 'User'); +\define('_AM_MODULEBUILDER_MAIN', 'Main'); +\define('_AM_MODULEBUILDER_SEARCH', 'Search'); +\define('_AM_MODULEBUILDER_REQUIRED', 'Required'); +\define('_AM_MODULEBUILDER_SUBMENU', 'Submenu'); +\define('_AM_MODULEBUILDER_COMMENTS', 'Comments'); +\define('_AM_MODULEBUILDER_NOTIFICATIONS', 'Notifications'); +\define('_AM_MODULEBUILDER_PERMISSIONS', 'Permissions'); +// +// ------------------- Settings --------------------------------- // +// buttons +\define('_AM_MODULEBUILDER_SETTINGS_ADD', 'Add Settings'); +\define('_AM_MODULEBUILDER_SETTINGS_LIST', 'Settings List'); +// form +\define('_AM_MODULEBUILDER_SETTING_NEW', 'New Settings'); +\define('_AM_MODULEBUILDER_SETTING_EDIT', 'Edit Settings'); +\define('_AM_MODULEBUILDER_SETTING_NAME', 'Set Name'); +\define('_AM_MODULEBUILDER_SETTING_DIRNAME', 'Set Directory Name'); +\define('_AM_MODULEBUILDER_SETTING_VERSION', 'Set Version'); +\define('_AM_MODULEBUILDER_SETTING_SINCE', 'Set Since'); +\define('_AM_MODULEBUILDER_SETTING_DESCRIPTION', 'Set Description'); +\define('_AM_MODULEBUILDER_SETTING_CREATENEWLOGO', 'Set Create New Logo'); +\define('_AM_MODULEBUILDER_SETTING_AUTHOR', 'Set Author'); +\define('_AM_MODULEBUILDER_SETTING_AUTHOR_MAIL', 'Set Author Email'); +\define('_AM_MODULEBUILDER_SETTING_AUTHOR_WEBSITE_URL', 'Set Author Site Url'); +\define('_AM_MODULEBUILDER_SETTING_AUTHOR_WEBSITE_NAME', 'Set Author Site Name'); +\define('_AM_MODULEBUILDER_SETTING_CREDITS', 'Set Credits'); +\define('_AM_MODULEBUILDER_SETTING_LICENSE', 'Set License'); +\define('_AM_MODULEBUILDER_SETTING_RELEASE_INFO', 'Set Release Info'); +\define('_AM_MODULEBUILDER_SETTING_RELEASE_FILE', 'Set Release File'); +\define('_AM_MODULEBUILDER_SETTING_MANUAL', 'Set Manual'); +\define('_AM_MODULEBUILDER_SETTING_MANUAL_FILE', 'Set Manual File'); +\define('_AM_MODULEBUILDER_SETTING_IMAGE', 'Set Image'); +\define('_AM_MODULEBUILDER_SETTING_DEMO_SITE_URL', 'Set Demo Site Url'); +\define('_AM_MODULEBUILDER_SETTING_DEMO_SITE_NAME', 'Set Demo Site Name'); +\define('_AM_MODULEBUILDER_SETTING_SUPPORT_URL', 'Set Support URL'); +\define('_AM_MODULEBUILDER_SETTING_SUPPORT_NAME', 'Set Support Name'); +\define('_AM_MODULEBUILDER_SETTING_WEBSITE_URL', 'Set Module Website URL'); +\define('_AM_MODULEBUILDER_SETTING_WEBSITE_NAME', 'Set Module Website Name'); +\define('_AM_MODULEBUILDER_SETTING_RELEASE', 'Set Release'); +\define('_AM_MODULEBUILDER_SETTING_STATUS', 'Set Status'); +\define('_AM_MODULEBUILDER_SETTING_PAYPAL_BUTTON', 'Set Button for Donations'); +\define('_AM_MODULEBUILDER_SETTING_SUBVERSION', 'Set Subversion module'); +\define('_AM_MODULEBUILDER_SETTING_ADMIN', 'Set Visible Admin'); +\define('_AM_MODULEBUILDER_SETTING_USER', 'Set Visible User'); +\define('_AM_MODULEBUILDER_SETTING_MIN_PHP', 'Set Minimum PHP'); +\define('_AM_MODULEBUILDER_SETTING_MIN_XOOPS', 'Set Minimum XOOPS'); +\define('_AM_MODULEBUILDER_SETTING_MIN_ADMIN', 'Set Minimum Admin'); +\define('_AM_MODULEBUILDER_SETTING_MIN_MYSQL', 'Set Minimum MySQL'); +\define('_AM_MODULEBUILDER_SETTING_BLOCKS', 'Set Activate Blocks'); +\define('_AM_MODULEBUILDER_SETTING_SEARCH', 'Set Activate Search'); +\define('_AM_MODULEBUILDER_SETTING_COMMENTS', 'Set Activate Comments'); +\define('_AM_MODULEBUILDER_SETTING_NOTIFICATIONS', 'Set Activate Notifications'); +\define('_AM_MODULEBUILDER_SETTING_PERMISSIONS', 'Set Activate Permissions'); +\define('_AM_MODULEBUILDER_SETTING_INROOT_COPY', 'Set Create Copy of this module in root/modules'); +\define('_AM_MODULEBUILDER_SETTING_ALL', 'Set Check All'); +\define('_AM_MODULEBUILDER_SETTING_TYPE', 'Set Type Active'); +\define('_AM_MODULEBUILDER_SETTING_TYPE_INACTIVE', 'Inactive'); +\define('_AM_MODULEBUILDER_SETTING_TYPE_ACTIVE', 'Active'); +// +// ------------------- Modules --------------------------------- // //Buttons -define('_AM_TDMCREATE_ADD_MODULE', 'Add new module'); +\define('_AM_MODULEBUILDER_MODULES_ADD', 'Add new module'); +\define('_AM_MODULEBUILDER_MODULES_LIST', 'Module List'); //Form -define('_AM_TDMCREATE_MODULE_NEW', 'New module'); -define('_AM_TDMCREATE_MODULE_EDIT', 'Edit module'); - -define('_AM_TDMCREATE_MODULE_IMPORTANT', "Required - Information"); -define('_AM_TDMCREATE_MODULE_NOTIMPORTANT', "Optional - Information"); -define('_AM_TDMCREATE_MODULE_ID', 'Id'); -define('_AM_TDMCREATE_MODULE_NAME', 'Name'); -define( - '_AM_TDMCREATE_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_NEW', 'New module'); +\define('_AM_MODULEBUILDER_MODULE_EDIT', 'Edit module'); +\define('_AM_MODULEBUILDER_MODULE_IMPORTANT', "Required - Information"); +\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_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." ); -// Added in version 1.91 -define('_AM_TDMCREATE_MODULE_DIRNAME', 'Directory Name'); -// --------------------- -define( - '_AM_TDMCREATE_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." -); -define('_AM_TDMCREATE_MODULE_VERSION', 'Version'); -define('_AM_TDMCREATE_MODULE_SINCE', 'Since'); -define('_AM_TDMCREATE_MODULE_DESCRIPTION', 'Description'); -define('_AM_TDMCREATE_MODULE_CREATENEWLOGO', 'Create New Logo'); -define('_AM_TDMCREATE_MODULE_AUTHOR', 'Author'); -define('_AM_TDMCREATE_MODULE_AUTHOR_MAIL', 'Author Email'); -define('_AM_TDMCREATE_MODULE_AUTHOR_WEBSITE_URL', 'Author Site Url'); -define('_AM_TDMCREATE_MODULE_AUTHOR_WEBSITE_NAME', 'Author Site Name'); -define('_AM_TDMCREATE_MODULE_CREDITS', 'Credits'); -define('_AM_TDMCREATE_MODULE_LICENSE', 'License'); -define('_AM_TDMCREATE_MODULE_RELEASE_INFO', 'Release Info'); -define('_AM_TDMCREATE_MODULE_RELEASE_FILE', 'Release File'); -define('_AM_TDMCREATE_MODULE_MANUAL', 'Manual'); -define('_AM_TDMCREATE_MODULE_MANUAL_FILE', 'Manual File'); -define('_AM_TDMCREATE_MODULE_IMAGE', 'Image'); -define('_AM_TDMCREATE_MODULE_DEMO_SITE_URL', 'Demo Site Url'); -define('_AM_TDMCREATE_MODULE_DEMO_SITE_NAME', 'Demo Site Name'); -define('_AM_TDMCREATE_MODULE_SUPPORT_URL', 'Support URL'); -define('_AM_TDMCREATE_MODULE_SUPPORT_NAME', 'Support Name'); -define('_AM_TDMCREATE_MODULE_WEBSITE_URL', 'Module Website URL'); -define('_AM_TDMCREATE_MODULE_WEBSITE_NAME', 'Module Website Name'); -define('_AM_TDMCREATE_MODULE_RELEASE', 'Release'); -define('_AM_TDMCREATE_MODULE_STATUS', 'Status'); -define('_AM_TDMCREATE_MODULE_PAYPAL_BUTTON', 'Button for Donations'); -define('_AM_TDMCREATE_MODULE_SUBVERSION', 'Subversion module'); -define('_AM_TDMCREATE_MODULE_ADMIN', 'Visible Admin'); -define('_AM_TDMCREATE_MODULE_USER', 'Visible User'); -// Added in version 1.91 -define('_AM_TDMCREATE_MODULE_BLOCKS', 'Activate Blocks'); -define('_AM_TDMCREATE_MODULE_ALL', 'Check All'); -define( - '_AM_TDMCREATE_OPTIONS_DESC', - "Select one or all items to add specific addon in this new module" -); -// --------------------- -define('_AM_TDMCREATE_MODULE_SEARCH', 'Activate Search'); -define('_AM_TDMCREATE_MODULE_COMMENTS', 'Activate Comments'); -define('_AM_TDMCREATE_MODULE_NOTIFICATIONS', 'Activate Notifications'); -define('_AM_TDMCREATE_MODULE_PERMISSIONS', 'Activate Permissions'); -define('_AM_TDMCREATE_MODULE_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!"); -// Added in version 1.39 -define('_AM_TDMCREATE_MODULE_NAME_LIST', 'Name'); -define('_AM_TDMCREATE_MODULE_IMAGE_LIST', 'Image'); -define('_AM_TDMCREATE_MODULE_NBFIELDS_LIST', 'Fields'); -define('_AM_TDMCREATE_MODULE_BLOCKS_LIST', 'Blocks'); -define('_AM_TDMCREATE_MODULE_ADMIN_LIST', 'Admin'); -define('_AM_TDMCREATE_MODULE_USER_LIST', 'User'); -define('_AM_TDMCREATE_MODULE_SUBMENU_LIST', 'Submenu'); -define('_AM_TDMCREATE_MODULE_SEARCH_LIST', 'Search'); -define('_AM_TDMCREATE_MODULE_COMMENTS_LIST', 'Comments'); -define('_AM_TDMCREATE_MODULE_NOTIFICATIONS_LIST', 'Notifications'); -define('_AM_TDMCREATE_MODULE_PERMISSIONS_LIST', 'Permissions'); -define('_AM_TDMCREATE_MODULE_MIN_PHP', 'Minimum PHP'); -define('_AM_TDMCREATE_MODULE_MIN_XOOPS', 'Minimum XOOPS'); -define('_AM_TDMCREATE_MODULE_MIN_ADMIN', 'Minimum Admin'); -define('_AM_TDMCREATE_MODULE_MIN_MYSQL', 'Minimum Database'); -// Added in version 1.91 -define('_AM_TDMCREATE_MODULE_FORM_CREATED_OK', "The module %s is successfully created"); -define('_AM_TDMCREATE_MODULE_FORM_UPDATED_OK', "The module %s is successfully updated"); -// ------------------- Tables --------------------------------- // -//Tables.php -// Buttons -define('_AM_TDMCREATE_ADD_TABLE', 'Add new table'); -//Form1 -define('_AM_TDMCREATE_TABLE_NEW', 'New Table'); -define('_AM_TDMCREATE_TABLE_EDIT', 'Edit Table'); -define('_AM_TDMCREATE_TABLE_MODULES', 'Choose a module'); -define('_AM_TDMCREATE_TABLE_NAME', 'Table Name'); -define('_AM_TDMCREATE_TABLE_NAME_DESC', "Unique Name: It's recommended to use plural word (i.e.: categoriess)"); -// Added in version 1.91 -define('_AM_TDMCREATE_TABLE_SOLENAME', 'Table Singular Name'); -define('_AM_TDMCREATE_TABLE_SOLENAME_DESC', "Singular Name: It's recommended to use singular word (i.e.: category for admin buttons)"); +\define('_AM_MODULEBUILDER_MODULE_VERSION', 'Version'); +\define('_AM_MODULEBUILDER_MODULE_SINCE', 'Since'); +\define('_AM_MODULEBUILDER_MODULE_DESCRIPTION', 'Description'); +\define('_AM_MODULEBUILDER_MODULE_CREATENEWLOGO', 'Create New Logo'); +\define('_AM_MODULEBUILDER_MODULE_AUTHOR', 'Author'); +\define('_AM_MODULEBUILDER_MODULE_AUTHOR_MAIL', 'Author Email'); +\define('_AM_MODULEBUILDER_MODULE_AUTHOR_WEBSITE_URL', 'Author Site Url'); +\define('_AM_MODULEBUILDER_MODULE_AUTHOR_WEBSITE_NAME', 'Author Site Name'); +\define('_AM_MODULEBUILDER_MODULE_CREDITS', 'Credits'); +\define('_AM_MODULEBUILDER_MODULE_LICENSE', 'License'); +\define('_AM_MODULEBUILDER_MODULE_RELEASE_INFO', 'Release Info'); +\define('_AM_MODULEBUILDER_MODULE_RELEASE_FILE', 'Release File'); +\define('_AM_MODULEBUILDER_MODULE_MANUAL', 'Manual'); +\define('_AM_MODULEBUILDER_MODULE_MANUAL_FILE', 'Manual File'); +\define('_AM_MODULEBUILDER_MODULE_IMAGE', 'Image'); +\define('_AM_MODULEBUILDER_MODULE_DEMO_SITE_URL', 'Demo Site Url'); +\define('_AM_MODULEBUILDER_MODULE_DEMO_SITE_NAME', 'Demo Site Name'); +\define('_AM_MODULEBUILDER_MODULE_SUPPORT_URL', 'Support URL'); +\define('_AM_MODULEBUILDER_MODULE_SUPPORT_NAME', 'Support Name'); +\define('_AM_MODULEBUILDER_MODULE_WEBSITE_URL', 'Module Website URL'); +\define('_AM_MODULEBUILDER_MODULE_WEBSITE_NAME', 'Module Website Name'); +\define('_AM_MODULEBUILDER_MODULE_RELEASE', 'Release'); +\define('_AM_MODULEBUILDER_MODULE_STATUS', 'Status'); +\define('_AM_MODULEBUILDER_MODULE_PAYPAL_BUTTON', 'Button for Donations'); +\define('_AM_MODULEBUILDER_MODULE_SUBVERSION', 'Subversion module'); +\define('_AM_MODULEBUILDER_MODULE_ADMIN', 'Visible Admin'); +\define('_AM_MODULEBUILDER_MODULE_USER', 'Visible User'); +\define('_AM_MODULEBUILDER_MODULE_BLOCKS', 'Activate Blocks'); +\define('_AM_MODULEBUILDER_MODULE_ALL', 'Check All'); +\define('_AM_MODULEBUILDER_MODULE_SEARCH', 'Activate Search'); +\define('_AM_MODULEBUILDER_MODULE_COMMENTS', 'Activate Comments'); +\define('_AM_MODULEBUILDER_MODULE_NOTIFICATIONS', 'Activate Notifications'); +\define('_AM_MODULEBUILDER_MODULE_PERMISSIONS', 'Activate Permissions'); +\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'); -define('_AM_TDMCREATE_TABLE_CATEGORY', 'This table is a category or topic?'); -define('_AM_TDMCREATE_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_TDMCREATE_TABLE_NBFIELDS', 'Number fields'); -define('_AM_TDMCREATE_TABLE_NBFIELDS_DESC', 'Number of fields for this table'); -define('_AM_TDMCREATE_TABLE_ORDER', 'Order tables'); -define('_AM_TDMCREATE_TABLE_ORDER_DESC', 'You should order the tables to view them in the right ordered on the menu and index page of your new module'); -define('_AM_TDMCREATE_TABLE_FIELDNAME', 'Prefix Field Name'); -define( - '_AM_TDMCREATE_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 singolar word" -); -define( - '_AM_TDMCREATE_TABLE_OPTIONS_CHECKS_DESC', - 'For each table created, a file is created on behalf of this.
      -Selecting one or more of these options, deciding whether to enter the name of the file to other files or you define a condition in these other files, need to be created or not.' +\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'); +\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 +\define('_AM_MODULEBUILDER_TABLES_ADD', 'Add new table'); +\define('_AM_MODULEBUILDER_TABLES_LIST', 'Tables List'); +\define('_AM_MODULEBUILDER_TABLES_NEW', 'New Table'); +\define('_AM_MODULEBUILDER_TABLES_EDIT', 'Edit Table'); +// form +\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: 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'); +\define('_AM_MODULEBUILDER_TABLE_NBFIELDS_DESC', 'Number of fields for this table'); +\define('_AM_MODULEBUILDER_TABLE_ORDER', 'Order tables'); +\define('_AM_MODULEBUILDER_TABLE_ORDER_DESC', 'You should order the tables to view them in the right ordered on the menu and index page of your new module'); +\define('_AM_MODULEBUILDER_TABLE_FIELDNAME', 'Prefix Field Name'); +\define( + '_AM_MODULEBUILDER_TABLE_FIELDNAME_DESC', + "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_TDMCREATE_TABLE_ALL', 'Check All'); -define('_AM_TDMCREATE_TABLE_IMAGE', 'Table Logo'); -//define('_AM_TDMCREATE_TABLE_IMAGE_DESC', "You can choose an image from the list, or upload a new one from your computer"); -// Added in version 1.91 -define('_AM_TDMCREATE_TABLE_AUTO_INCREMENT', ' Auto Increment'); -define('_AM_TDMCREATE_TABLE_AUTO_INCREMENT_OPTION', 'Default checked'); -define('_AM_TDMCREATE_TABLE_AUTO_INCREMENT_DESC', 'Check this option if table have the Auto Increment ID'); -// v1.59 -define('_AM_TDMCREATE_TABLE_EXIST', 'The name specified for this table is already in use'); -define('_AM_TDMCREATE_TABLE_BLOCKS', 'Add in Block Files'); -define('_AM_TDMCREATE_TABLE_BLOCKS_DESC', '(blocks: random, latest, today)'); -define('_AM_TDMCREATE_TABLE_ADMIN', 'Add in Admin Files'); -define('_AM_TDMCREATE_TABLE_USER', 'Add in User Files'); -define('_AM_TDMCREATE_TABLE_SUBMENU', 'Add in Submenu'); -define('_AM_TDMCREATE_TABLE_SEARCH', 'Add in Search Files'); -define('_AM_TDMCREATE_TABLE_COMMENTS', 'Add in Comments Files'); -// Added in version 1.39 -define('_AM_TDMCREATE_TABLE_NOTIFICATIONS', 'Add in Notifications file'); -define('_AM_TDMCREATE_TABLE_PERMISSIONS', 'Add in Permissions file'); -// Added in version 1.91 -define('_AM_TDMCREATE_TABLE_INSTALL', 'Add in Install file'); -define('_AM_TDMCREATE_TABLE_INDEX', 'Add in User Index file'); -define('_AM_TDMCREATE_TABLE_SUBMIT', 'Add in Submit file'); -define('_AM_TDMCREATE_TABLE_TAG', 'Add in Tag file'); -define('_AM_TDMCREATE_TABLE_BROKEN', 'Add in Broken file'); -define('_AM_TDMCREATE_TABLE_RATE', 'Add in Rate file'); -define('_AM_TDMCREATE_TABLE_PRINT', 'Add in Print file'); -define('_AM_TDMCREATE_TABLE_PDF', 'Add in Pdf file'); -define('_AM_TDMCREATE_TABLE_RSS', 'Add in Rss file'); -define('_AM_TDMCREATE_TABLE_SINGLE', 'Add in Single file'); -define('_AM_TDMCREATE_TABLE_VISIT', 'Add in Visit file'); -// v1.38 -define( - '_AM_TDMCREATE_TABLE_IMAGE_DESC', +\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"); +\define('_AM_MODULEBUILDER_TABLE_AUTO_INCREMENT', ' Auto Increment'); +\define('_AM_MODULEBUILDER_TABLE_AUTO_INCREMENT_OPTION', 'Default checked'); +\define('_AM_MODULEBUILDER_TABLE_AUTO_INCREMENT_DESC', 'Check this option if table have the Auto Increment ID'); +\define('_AM_MODULEBUILDER_TABLE_EXIST', 'The name specified for this table is already in use'); +\define('_AM_MODULEBUILDER_TABLE_BLOCKS', 'Add in Block Files'); +\define('_AM_MODULEBUILDER_TABLE_BLOCKS_DESC', '(blocks: random, latest, today)'); +\define('_AM_MODULEBUILDER_TABLE_ADMIN', 'Add in Admin Files'); +\define('_AM_MODULEBUILDER_TABLE_USER', 'Add in User Files'); +\define('_AM_MODULEBUILDER_TABLE_SUBMENU', 'Add in Submenu'); +\define('_AM_MODULEBUILDER_TABLE_SEARCH', 'Add Search Function'); +\define('_AM_MODULEBUILDER_TABLE_COMMENTS', 'Add Comments Function'); +\define('_AM_MODULEBUILDER_TABLE_NOTIFICATIONS', 'Add Notifications Function'); +\define('_AM_MODULEBUILDER_TABLE_PERMISSIONS', 'Add Permissions Function'); +\define('_AM_MODULEBUILDER_TABLE_INSTALL', 'Add in Install file'); +\define('_AM_MODULEBUILDER_TABLE_INDEX', 'Add in User Index file'); +\define('_AM_MODULEBUILDER_TABLE_SUBMIT', 'Add Submit Function'); +\define('_AM_MODULEBUILDER_TABLE_TAG', 'Add in Tag file'); +\define('_AM_MODULEBUILDER_TABLE_BROKEN', 'Add Broken Function'); +\define('_AM_MODULEBUILDER_TABLE_RATE', 'Add in Rate file'); +\define('_AM_MODULEBUILDER_TABLE_PRINT', 'Add in Print file'); +\define('_AM_MODULEBUILDER_TABLE_PDF', 'Add in Pdf file'); +\define('_AM_MODULEBUILDER_TABLE_RSS', 'Add in Rss file'); +\define('_AM_MODULEBUILDER_TABLE_READS', 'Add Counter Reads Function'); +\define('_AM_MODULEBUILDER_TABLE_SINGLE', 'Add in Single file'); +\define('_AM_MODULEBUILDER_TABLE_VISIT', 'Add in Visit file'); +\define( + '_AM_MODULEBUILDER_TABLE_IMAGE_DESC', "WARNING: If you want to choose a new image, is best to name it with the module name before and follow with the name of the image so as not to overwrite any images with the same name, in the Frameworks/moduleclasses/moduleadmin/icons/32/. Otherwise an other solution, would be to insert the images in the module, a new folder is created, with the creation of the same module - assets/icons/32." ); -define('_AM_TDMCREATE_TABLE_FORM_CREATED_OK', "The table %s is successfully created"); -define('_AM_TDMCREATE_TABLE_FORM_UPDATED_OK', "The table %s is successfully updated"); -// ------------------ Form Fields ------------------ -// Caption -define('_AM_TDMCREATE_FIELDS_NEW', 'New fields'); -define('_AM_TDMCREATE_FIELDS_EDIT', 'Edit fields'); -// Fields -define('_AM_TDMCREATE_FIELD_ID', 'N°'); -define('_AM_TDMCREATE_FIELD_NAME', 'Field Name'); -define('_AM_TDMCREATE_FIELD_TYPE', 'Type'); -define('_AM_TDMCREATE_FIELD_VALUE', 'Value'); -define('_AM_TDMCREATE_FIELD_ATTRIBUTE', 'Attribute'); -define('_AM_TDMCREATE_FIELD_NULL', 'Null'); -define('_AM_TDMCREATE_FIELD_DEFAULT', 'Default'); -define('_AM_TDMCREATE_FIELD_KEY', 'Key'); -// Fields Parameters -define('_AM_TDMCREATE_FIELD_PARAMETERS', 'Parameters'); -define('_AM_TDMCREATE_FIELD_ELEMENTS', 'Options Elements'); -define('_AM_TDMCREATE_FIELD_ELEMENT', 'Form Element'); -define('_AM_TDMCREATE_FIELD_ELEMENT_NAME', 'Form: Element'); -define('_AM_TDMCREATE_FIELD_ADMIN', 'Admin: In Files'); -define('_AM_TDMCREATE_FIELD_USER', 'User: In Files'); -define('_AM_TDMCREATE_FIELD_BLOCK', 'Block: In Files'); -define('_AM_TDMCREATE_FIELD_MAIN', 'Table: Main Field'); -define('_AM_TDMCREATE_FIELD_SEARCH', 'Search: Index'); -define('_AM_TDMCREATE_FIELD_REQUIRED', 'Field: Required'); -define('_AM_TDMCREATE_ADMIN_SUBMIT', 'Send'); -// Added in version 1.91 -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

      '); -// List in templates -define('_AM_TDMCREATE_ID_LIST', 'Id'); -define('_AM_TDMCREATE_NAME_LIST', 'Name'); -define('_AM_TDMCREATE_IMAGE_LIST', 'Image'); -define('_AM_TDMCREATE_NBFIELDS_LIST', 'Fields'); -define('_AM_TDMCREATE_PARENT_LIST', 'Parent'); -define('_AM_TDMCREATE_INLIST_LIST', 'Inlist'); -define('_AM_TDMCREATE_INFORM_LIST', 'Inform'); -define('_AM_TDMCREATE_ADMIN_LIST', 'Admin'); -define('_AM_TDMCREATE_USER_LIST', 'User'); -define('_AM_TDMCREATE_BLOCK_LIST', 'Block'); -define('_AM_TDMCREATE_MAIN_LIST', 'Main'); -define('_AM_TDMCREATE_SEARCH_LIST', 'Search'); -define('_AM_TDMCREATE_REQUIRED_LIST', 'Required'); - -// building.php -define('_AM_TDMCREATE_CONST_MODULES', 'Select the module you want to build'); -define('_AM_TDMCREATE_CONST_TABLES', 'Select the table you want to build'); - -//------------ new additions: Ver. 1.11 ----------------------- - -define('_AM_TDMCREATE_ADMIN_PERMISSIONS', 'Permissions'); -define('_AM_TDMCREATE_FORMON', 'Online'); -define('_AM_TDMCREATE_FORMOFF', 'Offline'); - -define('_AM_TDMCREATE_TRANSLATION_PERMISSIONS_ACCESS', 'Allowed to access'); -define('_AM_TDMCREATE_TRANSLATION_PERMISSIONS_SUBMIT', 'Allowed to post'); - -define('_AM_TDMCREATE_THEREARE_DATABASE1', "There are %s"); -define('_AM_TDMCREATE_THEREARE_DATABASE2', 'in the database'); -define('_AM_TDMCREATE_THEREARE_PENDING', "There are %s"); -define('_AM_TDMCREATE_THEREARE_PENDING2', 'waiting'); - -define('_AM_TDMCREATE_FORMADD', 'Add'); - -define('_AM_TDMCREATE_MIMETYPES', 'Mime types authorized for:'); -define('_AM_TDMCREATE_MIMESIZE', 'Allowable size:'); -define('_AM_TDMCREATE_EDITOR', 'Editor:'); - -//------------ new additions: Ver. 1.15 ----------------------- - -define('_AM_TDMCREATE_ABOUT_WEBSITE_FORUM', 'Forum Web Site'); - -//------------ new additions: Ver. 1.37 ----------------------- -define('_AM_TDMCREATE_MODULES_LIST', 'Module List'); -define('_AM_TDMCREATE_MODULES_NEW', 'New Module'); -define('_AM_TDMCREATE_TABLES_LIST', 'Tables List'); -define('_AM_TDMCREATE_TABLES_NEW', 'New Table'); -define('_AM_TDMCREATE_TABLES_NEW_CATEGORY', 'New Category'); -define('_AM_TDMCREATE_FIELDS_LIST', 'Fields List'); - -//1.38 -define('_AM_TDMCREATE_TABLES_STATUS', 'Show Table Status'); -define('_AM_TDMCREATE_TABLES_WAITING', 'Show Table Waiting'); - -//1.39 -define('_AM_TDMCREATE_MODULES_MIN_PHP', 'Minimum PHP'); -define('_AM_TDMCREATE_MODULES_MIN_XOOPS', 'Minimum XOOPS'); -define('_AM_TDMCREATE_MODULES_MIN_ADMIN', 'Minimum Admin'); -define('_AM_TDMCREATE_MODULES_MIN_MYSQL', 'Minimum Database'); -define('_AM_TDMCREATE_BUILDING_FILES', 'Files that have been compiled'); -define('_AM_TDMCREATE_BUILDING_SUCCESS', 'Success build'); -define('_AM_TDMCREATE_BUILDING_FAILED', 'Failed build'); -define('_AM_TDMCREATE_CONST_OK_ARCHITECTURE_ROOT', 'The structure of the module was created in root/modules (index.html, folders, ...)'); -define('_AM_TDMCREATE_CONST_NOTOK_ARCHITECTURE_ROOT', 'Problems: Creating the structure of the module in root/modules (index.html, icons ,...)'); - -// Added in version 1.59 -define('_AM_TDMCREATE_TABLE_ID', 'Id'); -define('_AM_TDMCREATE_TABLE_NAME_LIST', 'Name'); -define('_AM_TDMCREATE_TABLE_IMAGE_LIST', 'Table Icon'); -define('_AM_TDMCREATE_TABLE_NBFIELDS_LIST', 'Fields'); -define('_AM_TDMCREATE_TABLE_BLOCKS_LIST', 'Blocks'); -define('_AM_TDMCREATE_TABLE_ADMIN_LIST', 'Admin'); -define('_AM_TDMCREATE_TABLE_USER_LIST', 'User'); -define('_AM_TDMCREATE_TABLE_SUBMENU_LIST', 'Submenu'); -define('_AM_TDMCREATE_TABLE_SEARCH_LIST', 'Search'); -define('_AM_TDMCREATE_TABLE_COMMENTS_LIST', 'Comments'); -define('_AM_TDMCREATE_TABLE_NOTIFICATIONS_LIST', 'Notifications'); -define('_AM_TDMCREATE_TABLE_PERMISSIONS_LIST', 'Permissions'); -define('_AM_TDMCREATE_EDIT_TABLE', 'Edit Table'); -define('_AM_TDMCREATE_EDIT_FIELDS', 'Edit Fields'); -define('_AM_TDMCREATE_BUILD_INROOT', 'Do you want to install this module in the modules root of your site?'); -define( - '_AM_TDMCREATE_BUILD_INROOT_DESC', - "WARNING: If in the modules directory of your site is installed a module with the same name,
      as the one you are about to create now, this will be erased with the appropriate consequences.
      We recommend you to first check, in the root/modules of your site, if this module already exists." +\define('_AM_MODULEBUILDER_TABLE_FORM_CREATED_OK', "The table %s is successfully created"); +\define('_AM_MODULEBUILDER_TABLE_FORM_UPDATED_OK', "The table %s is successfully updated"); +\define('_AM_MODULEBUILDER_TABLE_IMAGE_LIST', 'Table Icon'); +\define('_AM_MODULEBUILDER_TABLES_STATUS', 'Show Table Status'); +\define('_AM_MODULEBUILDER_TABLES_WAITING', 'Show Table Waiting'); +\define('_AM_MODULEBUILDER_TABLE_MODSELOPT', 'Select a Module'); +\define('_AM_MODULEBUILDER_TABLE_ERROR_NAME_EXIST', "WARNING: The table %s exists for this module, create a new one with a different name"); +// +// ------------------- Fields --------------------------------- // +// buttons +\define('_AM_MODULEBUILDER_FIELDS_LIST', 'Fields List'); +\define('_AM_MODULEBUILDER_FIELDS_NEW', 'New fields'); +\define('_AM_MODULEBUILDER_FIELDS_EDIT', 'Edit fields'); +// form +\define('_AM_MODULEBUILDER_FIELD_ID', 'N°'); +\define('_AM_MODULEBUILDER_FIELD_NAME', 'Field Name'); +\define('_AM_MODULEBUILDER_FIELD_TYPE', 'Type'); +\define('_AM_MODULEBUILDER_FIELD_VALUE', 'Value'); +\define('_AM_MODULEBUILDER_FIELD_ATTRIBUTE', 'Attribute'); +\define('_AM_MODULEBUILDER_FIELD_NULL', 'Null'); +\define('_AM_MODULEBUILDER_FIELD_DEFAULT', 'Default'); +\define('_AM_MODULEBUILDER_FIELD_KEY', 'Key'); +\define('_AM_MODULEBUILDER_FIELD_PARAMETERS', 'Parameters'); +\define('_AM_MODULEBUILDER_FIELD_PARAMETERS_LIST', 'Parameters List'); +\define('_AM_MODULEBUILDER_FIELD_ELEMENTS', 'Options Elements'); +\define('_AM_MODULEBUILDER_FIELD_ELEMENT', 'Form Element'); +\define('_AM_MODULEBUILDER_FIELD_ELEMENT_NAME', 'Form: Element'); +\define('_AM_MODULEBUILDER_FIELD_ADMIN', 'Admin: In Files'); +\define('_AM_MODULEBUILDER_FIELD_USER', 'User: In Files'); +\define('_AM_MODULEBUILDER_FIELD_BLOCK', 'Block: In Files'); +\define('_AM_MODULEBUILDER_FIELD_MAIN', 'Table: Main Field'); +\define('_AM_MODULEBUILDER_FIELD_SEARCH', 'Search: Index'); +\define('_AM_MODULEBUILDER_FIELD_REQUIRED', 'Field: Required'); +\define('_AM_MODULEBUILDER_ADMIN_SUBMIT', 'Send'); +\define('_AM_MODULEBUILDER_FIELD_IHEAD', 'User index: in header'); +\define('_AM_MODULEBUILDER_FIELD_IBODY', 'User index: in body'); +\define('_AM_MODULEBUILDER_FIELD_IFOOT', 'User index: in footer'); +\define('_AM_MODULEBUILDER_FIELD_THEAD', 'User file: in header'); +\define('_AM_MODULEBUILDER_FIELD_TBODY', 'User file: in body'); +\define('_AM_MODULEBUILDER_FIELD_TFOOT', 'User file: in footer'); +\define( + '_AM_MODULEBUILDER_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

      " ); -//define('_AM_TDMCREATE_MODULE_PERMISSIONS', "Enable permissions"); -//define('_AM_TDMCREATE_MODULE_INSTALL', "Install this module directly in root/modules?"); - -// Added in version 1.91 -define('_AM_TDMCREATE_CHANGE_DISPLAY', 'Change Display'); -define('_AM_TDMCREATE_CHANGE_SETTINGS', 'Change Settings'); -define('_AM_TDMCREATE_TOGGLE_SUCCESS', 'Successfully Changed Display'); -define('_AM_TDMCREATE_TOGGLE_FAILED', 'Changing Display Failed'); -define('_AM_TDMCREATE_ERROR_TABLE_NAME_EXIST', "WARNING: The table %s exists for this module, create a new one with a different name"); -define('_AM_TDMCREATE_FIELD_PARENT', 'Field: Is parent'); -define('_AM_TDMCREATE_FIELD_INLIST', 'Admin: Visible in list'); -define('_AM_TDMCREATE_FIELD_INFORM', 'Admin: Visible in form'); -define('_AM_TDMCREATE_TABLE_MODSELOPT', 'Select a Module'); -define('_AM_TDMCREATE_BUILD_MODSELOPT', 'Select and build a Module'); -define('_AM_TDMCREATE_NOTMODULES', "There aren't modules, pleace create one first"); -define('_AM_TDMCREATE_NOTTABLES', "There aren't tables, pleace create one first"); -define('_AM_TDMCREATE_FIELDS_FORM_SAVED_OK', "Fields of table %s successfully saved"); -define('_AM_TDMCREATE_FIELDS_FORM_UPDATED_OK', "Fields of table %s successfully updated"); - -define('_AM_TDMCREATE_THEREARENT_MODULES', "There aren't modules"); -define('_AM_TDMCREATE_THEREARENT_TABLES', "There aren't tables"); -define('_AM_TDMCREATE_THEREARENT_FIELDS', "There aren't fields"); -define('_AM_TDMCREATE_THEREARENT_MORE_FILES', "There aren't more files"); -//Creation -define('_AM_TDMCREATE_MODULE_BUTTON_NEW_LOGO', 'Create new Logo'); -//OK -define('_AM_TDMCREATE_OK_ARCHITECTURE', "The structure of the module was created (index.html, folders, icons, docs files)"); -define('_AM_TDMCREATE_FILE_CREATED', "The file %s is created in the %s folder"); -//NOTOK -define('_AM_TDMCREATE_NOTOK_ARCHITECTURE', "Problems: Creating the structure of the module (index.html, folders, icons, docs files)"); -define('_AM_TDMCREATE_FILE_NOTCREATED', "Problems: Creating file %s in the %s folder"); - -define('_AM_TDMCREATE_BUILDING_DIRECTORY', "Files created in the directory uploads/tdmcreate/repository/ of the module %s"); -define('_AM_TDMCREATE_BUILDING_DIRECTORY_INROOT', "
      Created module was also copied to %s"); -define('_AM_TDMCREATE_FIELD_PARAMETERS_LIST', 'Parameters List'); -// Added in version v1.91 -define('_AM_TDMCREATE_ABOUT_MAKE_DONATION', 'Make a Donation to support this module'); -define('_AM_TDMCREATE_MAINTAINED', '%s is maintained by the '); -define('_AM_TDMCREATE_SUPPORT_FORUM', 'Support Forum'); -define('_AM_TDMCREATE_DONATION_AMOUNT', 'Donation Amount'); - -define('_AM_TDMCREATE_IMPORTANT', 'Main Settings'); -define('_AM_TDMCREATE_OPTIONS_CHECK', 'Options Settings'); -define('_AM_TDMCREATE_CREATE_IMAGE', 'Create Image Logo'); -define('_AM_TDMCREATE_NOT_IMPORTANT', 'Secondary Settings'); -define('_AM_TDMCREATE_BUILDING_DELETED_CACHE_FILES', 'Cache Files Are Deleted Succefully'); -// Admin More Files -define('_AM_TDMCREATE_ADD_MORE_FILE', 'Add More File'); -define('_AM_TDMCREATE_MORE_FILES_LIST', 'More Files List'); -define('_AM_TDMCREATE_FILE_FORM_CREATED_OK', "The file %s is successfully created"); -define('_AM_TDMCREATE_FILE_FORM_UPDATED_OK', "The file %s is successfully updated"); +\define('_AM_MODULEBUILDER_FIELD_PARENT', 'Field: Is parent'); +\define('_AM_MODULEBUILDER_FIELD_INLIST', 'Admin: Visible in list'); +\define('_AM_MODULEBUILDER_FIELD_INFORM', 'Admin: Visible in form'); +\define('_AM_MODULEBUILDER_FIELDS_FORM_SAVED_OK', "Fields of table %s successfully saved"); +\define('_AM_MODULEBUILDER_FIELDS_FORM_UPDATED_OK', "Fields of table %s successfully updated"); +// +// ------------------- Building --------------------------------- // +\define('_AM_MODULEBUILDER_CONST_MODULES', 'Select the module you want to build'); +\define('_AM_MODULEBUILDER_CONST_TABLES', 'Select the table you want to build'); +\define('_AM_MODULEBUILDER_BUILDING_FILES', 'Files that have been compiled'); +\define('_AM_MODULEBUILDER_BUILDING_SUCCESS', 'Success build'); +\define('_AM_MODULEBUILDER_BUILDING_FAILED', 'Failed build'); +\define('_AM_MODULEBUILDER_CONST_OK_ARCHITECTURE_ROOT', 'The structure of the module was created in root/modules (index.php, folders, ...)'); +\define('_AM_MODULEBUILDER_CONST_NOTOK_ARCHITECTURE_ROOT', 'Problems: Creating the structure of the module in root/modules (index.php, icons ,...)'); +\define('_AM_MODULEBUILDER_BUILD_MODSELOPT', 'Select and build a Module'); +// OK +\define('_AM_MODULEBUILDER_OK_ARCHITECTURE', "The structure of the module was created (index.php, folders, icons, docs files)"); +\define('_AM_MODULEBUILDER_FILE_CREATED', "The file %s is created in the %s folder"); +// NOTOK +\define('_AM_MODULEBUILDER_NOTOK_ARCHITECTURE', "Problems: Creating the structure of the module (index.php, folders, icons, docs files)"); +\define('_AM_MODULEBUILDER_FILE_NOTCREATED', "Problems: Creating file %s in the %s folder"); +// 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_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'); +\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'); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_RESULT', 'Result of checking data before building the module'); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_NOERRORS', 'Congratulations! No errors or warnings found'); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_ERROR', 'Error: '); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_ERROR_DESC', 'Errors must be solved'); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_WARNING', 'Warning: '); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_WARNING_DESC', 'Warnings should be solved in order to get proper functions'); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_FOUND', 'Following errors/warning have been found:'); +\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_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)"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS6', "The table '%t' should contains field in user file on user side, but no selection is made, which fields (field params 'User file:...')"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_FIELDS7', "The field '%f' in table '%t' should be used in user file on user side, but option 'Add in User Files' in table setting is deactivated)"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK1', "The table '%t' should use block, but no selection is made which fields should be shown in the block"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_BLOCK2', "The table '%t' should use block, but blocks use e.g. function 'new' or 'latest'. For these functions a date field is necessary, but the table doesn't contain any date field"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_COMMENTS1', "The use of comments is activated for tables '%t'. For proper function it is currently only possible to use comments for one table"); +\define('_AM_MODULEBUILDER_BUILDING_CHECK_COMMENTS2', "The table '%t' should use comment functionality, but the table do not have a field of type 'Comments Textbox', which is obligatory for this function"); +\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_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'"); +// +// ------------------- More Files --------------------------------- // +\define('_AM_MODULEBUILDER_MORE_FILES_ADD', 'Add More File'); +\define('_AM_MODULEBUILDER_MORE_FILES_LIST', 'More Files List'); +\define('_AM_MODULEBUILDER_FILE_FORM_CREATED_OK', "The file %s is successfully created"); +\define('_AM_MODULEBUILDER_FILE_FORM_UPDATED_OK', "The file %s is successfully updated"); // Class More Files -define('_AM_TDMCREATE_MORE_FILES_NEW', 'New More File'); -define('_AM_TDMCREATE_MORE_FILES_EDIT', 'Edit More File'); -define('_AM_TDMCREATE_MORE_FILES_MODULES', 'Choose a module'); -define('_AM_TDMCREATE_MORE_FILES_MODULE_SELECT', 'Select a Module'); -define('_AM_TDMCREATE_MORE_FILES_NAME', 'File Name'); -define('_AM_TDMCREATE_MORE_FILES_NAME_DESC', 'Create file name without extension'); -define('_AM_TDMCREATE_MORE_FILES_EXTENSION', 'Extension File'); -define('_AM_TDMCREATE_MORE_FILES_EXTENSION_DESC', 'Create extension of this file without dot'); -define('_AM_TDMCREATE_MORE_FILES_INFOLDER', 'File in the folder'); -define('_AM_TDMCREATE_MORE_FILES_INFOLDER_DESC', 'Insert this file in a folder (Type: admin, user, class, include, templates, ...)'); +\define('_AM_MODULEBUILDER_MORE_FILES_NEW', 'New More File'); +\define('_AM_MODULEBUILDER_MORE_FILES_EDIT', 'Edit More File'); +\define('_AM_MODULEBUILDER_MORE_FILES_MODULES', 'Choose a module'); +\define('_AM_MODULEBUILDER_MORE_FILES_MODULE_SELECT', 'Select a Module'); +\define('_AM_MODULEBUILDER_MORE_FILES_NAME', 'File Name'); +\define('_AM_MODULEBUILDER_MORE_FILES_NAME_DESC', 'Create file name without extension'); +\define('_AM_MODULEBUILDER_MORE_FILES_EXTENSION', 'Extension File'); +\define('_AM_MODULEBUILDER_MORE_FILES_EXTENSION_DESC', 'Create extension of this file without dot'); +\define('_AM_MODULEBUILDER_MORE_FILES_INFOLDER', 'File in the folder'); +\define('_AM_MODULEBUILDER_MORE_FILES_INFOLDER_DESC', 'Insert this file in a folder (Type: admin, user, class, include, templates, ...)'); +\define('_AM_MODULEBUILDER_MORE_FILES_TYPE', 'Type'); +\define('_AM_MODULEBUILDER_MORE_FILES_TYPE_EMPTY', 'Create empty file'); +\define('_AM_MODULEBUILDER_MORE_FILES_TYPE_COPY', 'Copy existing file'); +\define('_AM_MODULEBUILDER_MORE_FILES_UPLOAD', 'Existing file'); // Template More Files -define('_AM_TDMCREATE_FILE_ID', 'Id'); -define('_AM_TDMCREATE_FILE_NAME_LIST', 'File Name'); -define('_AM_TDMCREATE_FILE_MID_LIST', 'Module Name'); -define('_AM_TDMCREATE_FILE_EXTENSION_LIST', 'Extension Type'); -define('_AM_TDMCREATE_FILE_INFOLDER_LIST', 'In Folder'); -define('_AM_TDMCREATE_FORM_ACTION', 'Action'); +\define('_AM_MODULEBUILDER_FILE_ID', 'Id'); +\define('_AM_MODULEBUILDER_FILE_NAME_LIST', 'File Name'); +\define('_AM_MODULEBUILDER_FILE_MID_LIST', 'Module Name'); +\define('_AM_MODULEBUILDER_FILE_TYPE_LIST', 'Type'); +\define('_AM_MODULEBUILDER_FILE_EXTENSION_LIST', 'Extension Type'); +\define('_AM_MODULEBUILDER_FILE_INFOLDER_LIST', 'In Folder'); +\define('_AM_MODULEBUILDER_FILE_UPLOAD_LIST', 'Uploaded file to be copied'); +\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_RADIOONOFFLINE', 'Radio On-/Offline'); +// +// ------------------- 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 '); +\define('_AM_MODULEBUILDER_SUPPORT_FORUM', 'Support Forum'); +\define('_AM_MODULEBUILDER_DONATION_AMOUNT', 'Donation Amount'); +\define('_AM_MODULEBUILDER_OPTIONS_CHECK', 'Options Settings'); +\define('_AM_MODULEBUILDER_CREATE_IMAGE', 'Create Image Logo'); +// +// ------------------- 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'); +\define('_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS', 'Function qualifiers successfully added to copy of module'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL', 'Check language defines of your modules'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_MODULE', 'Select module to check'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_DESC', 'This tool takes all language defines in folder /language/englisch of your module and check, whether it is used somewhere or not'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_RESULTS', 'Result of checking usage of language defines of your modules'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_FILE', 'File with language defines:'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_LEGEND', 'Legend of results:'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS', 'Language define found'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_SUCCESS_DESCR', '(first match in brackets)'); +\define('_AM_MODULEBUILDER_DEVTOOLS_CL_RESULT_FAILED', 'Language define not found'); +\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 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_TDMCREATE_THEREARENT_SETTINGS', 'There are NO Settings! Please create Settings'); -// added Version 3.02 -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_CHECKBOX', "CheckBox"); -define('_AM_TDMCREATE_FIELD_ELE_RADIOYN', "Radio Yes/No"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTBOX', "Select Listbox"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTUSER', "Select User Field"); -define('_AM_TDMCREATE_FIELD_ELE_COLORPICKER', "Color Picker Field"); -define('_AM_TDMCREATE_FIELD_ELE_IMAGELIST', "Image List"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTFILE', "Select File Field"); -define('_AM_TDMCREATE_FIELD_ELE_URLFILE', "Url File Field"); -define('_AM_TDMCREATE_FIELD_ELE_UPLOADIMAGE', "Upload Image Field"); -define('_AM_TDMCREATE_FIELD_ELE_UPLOADFILE', "Upload File Field"); -define('_AM_TDMCREATE_FIELD_ELE_TEXTDATESELECT', "Date Select Field"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTSTATUS', "Select Status Field"); -define('_AM_TDMCREATE_FIELD_ELE_PASSWORD', "Password Field"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTCOUNTRY', "Select Country List"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTLANG', "Select Language List"); -define('_AM_TDMCREATE_FIELD_ELE_DATETIME', "Date/Time Select Field"); -define('_AM_TDMCREATE_FIELD_ELE_SELECTCOMBO', "Select Combobox"); -define('_AM_TDMCREATE_FIELD_ELE_RADIO', "Radio"); -define('_AM_TDMCREATE_FIELD_ELE_RADIO_1', "Radio Value 1"); -define('_AM_TDMCREATE_FIELD_ELE_RADIO_2', "Radio Value 2"); +\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: '); +\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'); diff --git a/language/english/common.php b/language/english/common.php index 214982f0..c9eede3f 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -1,4 +1,4 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); +$moduleDirName = \basename(dirname(__DIR__, 2)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); + +\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 . '_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): '); +\define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); +\define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); +\define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); +\define('CO_' . $moduleDirNameUpper . '_ON', "ON"); +\define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); +\define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); +\define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); +\define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); + +\define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); +\define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); + +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); +\define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +\define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); // Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); //Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); +\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'); -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); +//\define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); //help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); +\define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); +\define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); +\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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); +\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 imported successfully'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); +\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 . '_' . '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 -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); +\define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); // block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); +\define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); +\define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); +\define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); //myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); +\define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); //Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); +\define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); //Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); //Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); +\define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); //DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +\define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); //FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); //image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); //Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); //Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); +\define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/language/english/directorychecker.php b/language/english/directorychecker.php new file mode 100644 index 00000000..a88bdb01 --- /dev/null +++ b/language/english/directorychecker.php @@ -0,0 +1,23 @@ +Available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE', "Not available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE', " should have permission ( %d ), but it has ( %d )"); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_CREATETHEDIR', 'Create it'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM', 'Set the permission'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED', 'The directory has been created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED', 'The directory cannot be created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET', 'The permission has been set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET', 'The permission cannot be set'); diff --git a/language/english/feedback.php b/language/english/feedback.php index 8977d931..8739c191 100644 --- a/language/english/feedback.php +++ b/language/english/feedback.php @@ -1,4 +1,4 @@ - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirName = \basename(\dirname(__DIR__, 2)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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_FORM_TITLE', 'Send a feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); +\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!'); diff --git a/language/english/filechecker.php b/language/english/filechecker.php new file mode 100644 index 00000000..c483bd8b --- /dev/null +++ b/language/english/filechecker.php @@ -0,0 +1,24 @@ +Available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE', "Not available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_COPYTHEFILE', 'Copy it'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_CREATETHEFILE', 'Create it'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_SETMPERM', 'Set the permission'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED', 'The file has been copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED', 'The file cannot be copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_PERMSET', 'The permission has been set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FC_PERMNOTSET', 'The permission cannot be set'); diff --git a/language/english/help/help.html b/language/english/help/help.html index 02264a49..5db23b92 100644 --- a/language/english/help/help.html +++ b/language/english/help/help.html @@ -1,49 +1,49 @@

      Help: - TDMCreate Back to the Administration of TDMCreate + ModuleBuilder Back to the Administration of ModuleBuilder

      Description

      - The TDMCreate 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 TDMCreate 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 TDMCreate 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 TDMCreate/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 TDMCreate 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 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! + 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!

      Tutorial

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

      Translate

      - If you want to translate this module in your language, use this link to get it here + If you want to translate this module in your language, use this link to get it here

      diff --git a/language/english/help/index.html b/language/english/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/language/english/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/language/english/help/index.php b/language/english/help/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/language/english/help/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/language/english/index.php b/language/english/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/language/english/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/language/english/mail_template/index.php b/language/english/mail_template/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/language/english/mail_template/index.php @@ -0,0 +1,2 @@ +|'); -define('_MI_TDMCREATE_CONFIG_MAXSIZE_IMAGE', 'Maximum size of images'); -define('_MI_TDMCREATE_CONFIG_MAXSIZE_IMAGE_DESC', 'Set maximum size of images in Bytes'); +\define('_MI_MODULEBUILDER_CONFIG_ACTIVE_SEARCH', 'Allow Search'); +\define('_MI_MODULEBUILDER_CONFIG_ACTIVE_COMMENTS', 'Allow Comments'); +\define('_MI_MODULEBUILDER_CONFIG_ACTIVE_NOTIFICATIONS', 'Allow notifications'); +\define('_MI_MODULEBUILDER_CONFIG_ACTIVE_PERMISSIONS', 'Allow permissions'); +\define('_MI_MODULEBUILDER_CONFIG_INROOT_COPY', 'Copy this module also in root/modules?'); +\define('_MI_MODULEBUILDER_CONFIG_PAYPAL_BUTTON', 'Paypal Button'); +\define('_MI_MODULEBUILDER_CONFIG_SUBVERSION', 'Subversion'); +\define('_MI_MODULEBUILDER_CONFIG_DESCRIPTION', 'Module Description'); +\define('_MI_MODULEBUILDER_CONFIG_MIMETYPES_IMAGE', 'Mimetypes of images'); +\define('_MI_MODULEBUILDER_CONFIG_MIMETYPES_IMAGE_DESC', 'Set mimetypes of images and files separated by |'); +\define('_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE', 'Maximum size of images'); +\define('_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE_DESC', 'Set maximum size of images in Bytes'); //1.39 -define('_MI_TDMCREATE_CONFIG_BREAK_GENERAL', 'General preferences'); -define('_MI_TDMCREATE_CONFIG_BREAK_REQUIRED', 'Module required'); -define('_MI_TDMCREATE_CONFIG_BREAK_OPTIONAL', 'Module optional'); -define('_MI_TDMCREATE_CONFIG_MIN_PHP', 'Minimum Php'); -define('_MI_TDMCREATE_CONFIG_MIN_XOOPS', 'Minimum Xoops'); -define('_MI_TDMCREATE_CONFIG_MIN_ADMIN', 'Minimum Admin'); -define('_MI_TDMCREATE_CONFIG_MIN_MYSQL', 'Minimum MySQL'); -define('_MI_TDMCREATE_CONFIG_MODULES_ADMINPAGER', 'Modules AdminPager'); -define('_MI_TDMCREATE_CONFIG_MODULES_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Modules'); -define('_MI_TDMCREATE_CONFIG_TABLES_ADMINPAGER', 'Tables AdminPager'); -define('_MI_TDMCREATE_CONFIG_TABLES_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Tables'); -define('_MI_TDMCREATE_CONFIG_FIELDS_ADMINPAGER', 'Fields AdminPager'); -define('_MI_TDMCREATE_CONFIG_FIELDS_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Fields'); -define('_MI_TDMCREATE_CONFIG_MOREFILES_ADMINPAGER', 'More Files AdminPager'); -define('_MI_TDMCREATE_CONFIG_MOREFILES_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Files'); -define('_MI_TDMCREATE_CONFIG_SETTINGS_ADMINPAGER', 'Settings AdminPager'); -define('_MI_TDMCREATE_CONFIG_SETTINGS_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Settings'); +\define('_MI_MODULEBUILDER_CONFIG_BREAK_GENERAL', 'General preferences'); +\define('_MI_MODULEBUILDER_CONFIG_BREAK_REQUIRED', 'Module required'); +\define('_MI_MODULEBUILDER_CONFIG_BREAK_OPTIONAL', 'Module optional'); +\define('_MI_MODULEBUILDER_CONFIG_MIN_PHP', 'Minimum Php'); +\define('_MI_MODULEBUILDER_CONFIG_MIN_XOOPS', 'Minimum Xoops'); +\define('_MI_MODULEBUILDER_CONFIG_MIN_ADMIN', 'Minimum Admin'); +\define('_MI_MODULEBUILDER_CONFIG_MIN_MYSQL', 'Minimum MySQL'); +\define('_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER', 'Modules AdminPager'); +\define('_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Modules'); +\define('_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER', 'Tables AdminPager'); +\define('_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Tables'); +\define('_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER', 'Fields AdminPager'); +\define('_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Fields'); +\define('_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER', 'More Files AdminPager'); +\define('_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Files'); +\define('_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER', 'Settings AdminPager'); +\define('_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER_DESC', 'Set how many maximum pages you want to see in Settings'); -define('_AM_TDMCREATE_FIELD_ORDER_ERROR', 'Error in Field order'); -define('_AM_TDMCREATE_FORM_DELETED_OK', 'Form Deleted'); -define('_AM_TDMCREATE_NOT_MODULES', 'No modules'); -define('_AM_TDMCREATE_FORM_SURE_DELETE', 'Are you sure to delete it?'); -define('_AM_TDMCREATE_TABLE_ORDER_ERROR', 'Error in Table order'); +\define('_AM_MODULEBUILDER_FIELD_ORDER_ERROR', 'Error in Field order'); +\define('_AM_MODULEBUILDER_FORM_DELETED_OK', 'Form Deleted'); +\define('_AM_MODULEBUILDER_NOT_MODULES', 'No modules'); +\define('_AM_MODULEBUILDER_FORM_SURE_DELETE', 'Are you sure to delete it?'); +\define('_AM_MODULEBUILDER_TABLE_ORDER_ERROR', 'Error in Table order'); diff --git a/language/index.html b/language/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/language/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/language/index.php b/language/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/language/index.php @@ -0,0 +1,2 @@ +Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); +define("_AM_MODULEBUILDER_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); modinfo.php //Menu -define("_MI_TDMCREATE_ADMIN_INDEX","Index"); -define("_MI_TDMCREATE_ADMIN_MODULES","Add a module"); -define("_MI_TDMCREATE_ADMIN_TABLES","Add a table"); -define("_MI_TDMCREATE_ADMIN_CONST","Build the module"); -define("_MI_TDMCREATE_ADMIN_ABOUT","Short About"); -define("_MI_TDMCREATE_ADMIN_PREFERENCES","Preferences"); -define("_MI_TDMCREATE_ADMIN_UPDATE","Update"); +define("_MI_MODULEBUILDER_ADMIN_INDEX","Index"); +define("_MI_MODULEBUILDER_ADMIN_MODULES","Add a module"); +define("_MI_MODULEBUILDER_ADMIN_TABLES","Add a table"); +define("_MI_MODULEBUILDER_ADMIN_CONST","Build the module"); +define("_MI_MODULEBUILDER_ADMIN_ABOUT","Short About"); +define("_MI_MODULEBUILDER_ADMIN_PREFERENCES","Preferences"); +define("_MI_MODULEBUILDER_ADMIN_UPDATE","Update"); -define("_MI_TDMCREATE_DESC","Module create of module made by TDM"); \ No newline at end of file +define("_MI_MODULEBUILDER_DESC","Module create of module made by TDM"); diff --git a/language/update language 1.1 to 1.15.txt b/language/update language 1.1 to 1.15.txt index 5aab0f81..fbd8506c 100644 --- a/language/update language 1.1 to 1.15.txt +++ b/language/update language 1.1 to 1.15.txt @@ -1,40 +1,40 @@ admin.php -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_ELEMENTS","Form : Elements"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_ADMIN","Page : Display admin"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_USER","Page :Display user"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_BLOC","Block : Display"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_MAIN_FIELD","Table : Main Field"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_SEARCH","Search : Index"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_REQUIRED","Form : Required field"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_ELEMENTS","Form : Elements"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_DISPLAY_ADMIN","Page : Display admin"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_DISPLAY_USER","Page :Display user"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_BLOC","Block : Display"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_MAIN_FIELD","Table : Main Field"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_SEARCH","Search : Index"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_REQUIRED","Form : Required field"); -define("_AM_TDMCREATE_FORMEDIT","Edit"); -define("_AM_TDMCREATE_FORMDEL","Delete"); -define("_AM_TDMCREATE_FORMFIELDS","Edit fields"); -define("_AM_TDMCREATE_FORM_INFO_TABLE","Information on the table"); -define("_AM_TDMCREATE_FORM_INFO_TABLE_FIELD","There are 3 fields added automatically on each tables : table_submitter, table_date_created, table_online"); +define("_AM_MODULEBUILDER_FORMEDIT","Edit"); +define("_AM_MODULEBUILDER_FORMDEL","Delete"); +define("_AM_MODULEBUILDER_FORMFIELDS","Edit fields"); +define("_AM_MODULEBUILDER_FORM_INFO_TABLE","Information on the table"); +define("_AM_MODULEBUILDER_FORM_INFO_TABLE_FIELD","There are 3 fields added automatically on each tables : table_submitter, table_date_created, table_online"); // 1.15 -define("_AM_TDMCREATE_MODULES_AUTHOR_MAIL", "Author Email"); -define("_AM_TDMCREATE_MODULES_FORUM_SITE_URL","Category URL"); -define("_AM_TDMCREATE_MODULES_FORUM_SITE_NAME","Category URL title"); +define("_AM_MODULEBUILDER_MODULES_AUTHOR_MAIL", "Author Email"); +define("_AM_MODULEBUILDER_MODULES_FORUM_SITE_URL","Category URL"); +define("_AM_MODULEBUILDER_MODULES_FORUM_SITE_NAME","Category URL title"); -define("_AM_TDMCREATE_CONST_OK_COMMENTS","Creation files for the coms"); -define("_AM_TDMCREATE_CONST_NOTOK_COMMENTS","Problems : Creation files for the coms"); +define("_AM_MODULEBUILDER_CONST_OK_COMMENTS","Creation files for the coms"); +define("_AM_MODULEBUILDER_CONST_NOTOK_COMMENTS","Problems : Creation files for the coms"); // 1.15 -define("_AM_TDMCREATE_CONST_OK_MAIN_LANGUAGE", "Creation of main.php file into language folder"); -define("_AM_TDMCREATE_CONST_NOTOK_MAIN_LANGUAGE", "Problems: Creation of main.php file into language folder"); +define("_AM_MODULEBUILDER_CONST_OK_MAIN_LANGUAGE", "Creation of main.php file into language folder"); +define("_AM_MODULEBUILDER_CONST_NOTOK_MAIN_LANGUAGE", "Problems: Creation of main.php file into language folder"); -define("_AM_TDMCREATE_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); +define("_AM_MODULEBUILDER_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); modinfo.php //Menu -define("_MI_TDMCREATE_ADMIN_INDEX","Index"); -define("_MI_TDMCREATE_ADMIN_MODULES","Add a module"); -define("_MI_TDMCREATE_ADMIN_TABLES","Add a table"); -define("_MI_TDMCREATE_ADMIN_CONST","Build the module"); -define("_MI_TDMCREATE_ADMIN_ABOUT","Short About"); -define("_MI_TDMCREATE_ADMIN_PREFERENCES","Preferences"); -define("_MI_TDMCREATE_ADMIN_UPDATE","Update"); +define("_MI_MODULEBUILDER_ADMIN_INDEX","Index"); +define("_MI_MODULEBUILDER_ADMIN_MODULES","Add a module"); +define("_MI_MODULEBUILDER_ADMIN_TABLES","Add a table"); +define("_MI_MODULEBUILDER_ADMIN_CONST","Build the module"); +define("_MI_MODULEBUILDER_ADMIN_ABOUT","Short About"); +define("_MI_MODULEBUILDER_ADMIN_PREFERENCES","Preferences"); +define("_MI_MODULEBUILDER_ADMIN_UPDATE","Update"); -define("_MI_TDMCREATE_DESC","Module create of module made by TDM"); \ No newline at end of file +define("_MI_MODULEBUILDER_DESC","Module create of module made by TDM"); diff --git a/language/update language 1.1 to 1.37.txt b/language/update language 1.1 to 1.37.txt index 55f7a516..3fe7012f 100644 --- a/language/update language 1.1 to 1.37.txt +++ b/language/update language 1.1 to 1.37.txt @@ -1,51 +1,51 @@ admin.php -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_ELEMENTS","Form : Elements"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_ADMIN","Page : Display admin"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_USER","Page :Display user"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_BLOC","Block : Display"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_MAIN_FIELD","Table : Main Field"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_SEARCH","Search : Index"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_REQUIRED","Form : Required field"); - -define("_AM_TDMCREATE_FORMEDIT","Edit"); -define("_AM_TDMCREATE_FORMDEL","Delete"); -define("_AM_TDMCREATE_FORMFIELDS","Edit fields"); -define("_AM_TDMCREATE_FORM_INFO_TABLE","Information on the table"); -define("_AM_TDMCREATE_FORM_INFO_TABLE_FIELD","There are 3 fields added automatically on each tables : table_submitter, table_date_created, table_online"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_ELEMENTS","Form : Elements"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_DISPLAY_ADMIN","Page : Display admin"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_DISPLAY_USER","Page :Display user"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_BLOC","Block : Display"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_MAIN_FIELD","Table : Main Field"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_SEARCH","Search : Index"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_REQUIRED","Form : Required field"); + +define("_AM_MODULEBUILDER_FORMEDIT","Edit"); +define("_AM_MODULEBUILDER_FORMDEL","Delete"); +define("_AM_MODULEBUILDER_FORMFIELDS","Edit fields"); +define("_AM_MODULEBUILDER_FORM_INFO_TABLE","Information on the table"); +define("_AM_MODULEBUILDER_FORM_INFO_TABLE_FIELD","There are 3 fields added automatically on each tables : table_submitter, table_date_created, table_online"); // 1.15 -define("_AM_TDMCREATE_MODULES_AUTHOR_MAIL", "Author Email"); -define("_AM_TDMCREATE_MODULES_FORUM_SITE_URL","Category URL"); -define("_AM_TDMCREATE_MODULES_FORUM_SITE_NAME","Category URL title"); +define("_AM_MODULEBUILDER_MODULES_AUTHOR_MAIL", "Author Email"); +define("_AM_MODULEBUILDER_MODULES_FORUM_SITE_URL","Category URL"); +define("_AM_MODULEBUILDER_MODULES_FORUM_SITE_NAME","Category URL title"); -define("_AM_TDMCREATE_CONST_OK_COMMENTS","Creation files for the coms"); -define("_AM_TDMCREATE_CONST_NOTOK_COMMENTS","Problems : Creation files for the coms"); +define("_AM_MODULEBUILDER_CONST_OK_COMMENTS","Creation files for the coms"); +define("_AM_MODULEBUILDER_CONST_NOTOK_COMMENTS","Problems : Creation files for the coms"); // 1.15 -define("_AM_TDMCREATE_CONST_OK_MAIN_LANGUAGE", "Creation of main.php file into language folder"); -define("_AM_TDMCREATE_CONST_NOTOK_MAIN_LANGUAGE", "Problemes: Creation of main.php file into language folder"); +define("_AM_MODULEBUILDER_CONST_OK_MAIN_LANGUAGE", "Creation of main.php file into language folder"); +define("_AM_MODULEBUILDER_CONST_NOTOK_MAIN_LANGUAGE", "Problemes: Creation of main.php file into language folder"); -define("_AM_TDMCREATE_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); +define("_AM_MODULEBUILDER_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); // 1.37 -define("_AM_TDMCREATE_MODULES_LIST", "Modules List"); -define("_AM_TDMCREATE_MODULES_NEW", "New Module"); +define("_AM_MODULEBUILDER_MODULES_LIST", "Modules List"); +define("_AM_MODULEBUILDER_MODULE_NEW", "New Module"); -define("_AM_TDMCREATE_MODULES_ACTIVE_COMMENTS", "Enable comments"); +define("_AM_MODULEBUILDER_MODULES_ACTIVE_COMMENTS", "Enable comments"); modinfo.php //Menu -define("_MI_TDMCREATE_ADMIN_INDEX","Index"); -define("_MI_TDMCREATE_ADMIN_MODULES","Add a module"); -define("_MI_TDMCREATE_ADMIN_TABLES","Add a table"); -define("_MI_TDMCREATE_ADMIN_CONST","Build the module"); -define("_MI_TDMCREATE_ADMIN_ABOUT","Short About"); -define("_MI_TDMCREATE_ADMIN_PREFERENCES","Preferences"); -define("_MI_TDMCREATE_ADMIN_UPDATE","Update"); - -define("_MI_TDMCREATE_DESC","Module create of module made by TDM"); - -define("_MI_TDMCREATE_EDITOR", "Editor"); -define("_MI_TDMCREATE_EDITORDSC", "Select an editor to write"); -define("_MI_TDMCREATE_IDPAYPAL", "Paypal ID"); -define("_MI_TDMCREATE_IDPAYPAL_DESC", "ID Paypal for donations."); \ No newline at end of file +define("_MI_MODULEBUILDER_ADMIN_INDEX","Index"); +define("_MI_MODULEBUILDER_ADMIN_MODULES","Add a module"); +define("_MI_MODULEBUILDER_ADMIN_TABLES","Add a table"); +define("_MI_MODULEBUILDER_ADMIN_CONST","Build the module"); +define("_MI_MODULEBUILDER_ADMIN_ABOUT","Short About"); +define("_MI_MODULEBUILDER_ADMIN_PREFERENCES","Preferences"); +define("_MI_MODULEBUILDER_ADMIN_UPDATE","Update"); + +define("_MI_MODULEBUILDER_DESC","Module create of module made by TDM"); + +define("_MI_MODULEBUILDER_EDITOR", "Editor"); +define("_MI_MODULEBUILDER_EDITORDSC", "Select an editor to write"); +define("_MI_MODULEBUILDER_IDPAYPAL", "Paypal ID"); +define("_MI_MODULEBUILDER_IDPAYPAL_DESC", "ID Paypal for donations."); diff --git a/language/update language 1.15 to 1.37.txt b/language/update language 1.15 to 1.37.txt index a92f19b2..7b5e52e7 100644 --- a/language/update language 1.15 to 1.37.txt +++ b/language/update language 1.15 to 1.37.txt @@ -1,53 +1,53 @@ admin.php -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_ELEMENTS","Form : Elements"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_ADMIN","Page : Display admin"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_DISPLAY_USER","Page :Display user"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_BLOC","Block : Display"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_MAIN_FIELD","Table : Main Field"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_SEARCH","Search : Index"); -define("_AM_TDMCREATE_TABLES_FIELDS_MORE_REQUIRED","Form : Required field"); - -define("_AM_TDMCREATE_FORMEDIT","Edit"); -define("_AM_TDMCREATE_FORMDEL","Delete"); -define("_AM_TDMCREATE_FORMFIELDS","Edit fields"); -define("_AM_TDMCREATE_FORM_INFO_TABLE","Information on the table"); -define("_AM_TDMCREATE_FORM_INFO_TABLE_FIELD","There are 3 fields added automatically on each tables : table_submitter, table_date_created, table_online"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_ELEMENTS","Form : Elements"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_DISPLAY_ADMIN","Page : Display admin"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_DISPLAY_USER","Page :Display user"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_BLOC","Block : Display"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_MAIN_FIELD","Table : Main Field"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_SEARCH","Search : Index"); +define("_AM_MODULEBUILDER_TABLES_FIELDS_MORE_REQUIRED","Form : Required field"); + +define("_AM_MODULEBUILDER_FORMEDIT","Edit"); +define("_AM_MODULEBUILDER_FORMDEL","Delete"); +define("_AM_MODULEBUILDER_FORMFIELDS","Edit fields"); +define("_AM_MODULEBUILDER_FORM_INFO_TABLE","Information on the table"); +define("_AM_MODULEBUILDER_FORM_INFO_TABLE_FIELD","There are 3 fields added automatically on each tables : table_submitter, table_date_created, table_online"); // 1.15 -define("_AM_TDMCREATE_MODULES_AUTHOR_MAIL", "Author Email"); -define("_AM_TDMCREATE_MODULES_FORUM_SITE_URL","Category URL"); -define("_AM_TDMCREATE_MODULES_FORUM_SITE_NAME","Category URL title"); +define("_AM_MODULEBUILDER_MODULES_AUTHOR_MAIL", "Author Email"); +define("_AM_MODULEBUILDER_MODULES_FORUM_SITE_URL","Category URL"); +define("_AM_MODULEBUILDER_MODULES_FORUM_SITE_NAME","Category URL title"); -define("_AM_TDMCREATE_CONST_OK_COMMENTS","Creation files for the coms"); -define("_AM_TDMCREATE_CONST_NOTOK_COMMENTS","Problems : Creation files for the coms"); +define("_AM_MODULEBUILDER_CONST_OK_COMMENTS","Creation files for the coms"); +define("_AM_MODULEBUILDER_CONST_NOTOK_COMMENTS","Problems : Creation files for the coms"); // 1.15 -define("_AM_TDMCREATE_CONST_OK_MAIN_LANGUAGE", "Creation of main.php file into language folder"); -define("_AM_TDMCREATE_CONST_NOTOK_MAIN_LANGUAGE", "Problemes: Creation of main.php file into language folder"); +define("_AM_MODULEBUILDER_CONST_OK_MAIN_LANGUAGE", "Creation of main.php file into language folder"); +define("_AM_MODULEBUILDER_CONST_NOTOK_MAIN_LANGUAGE", "Problemes: Creation of main.php file into language folder"); -define("_AM_TDMCREATE_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); +define("_AM_MODULEBUILDER_TABLES_COMMENTS","Activer les commentaires pour cette table
      Le module peut gerer pour l'instant les coms que sur une table
      L'option commentaire sera desactivee si vous validez
      "); // 1.37 -define("_AM_TDMCREATE_MODULES_LIST", "Modules List"); -define("_AM_TDMCREATE_MODULES_NEW", "New Module"); +define("_AM_MODULEBUILDER_MODULES_LIST", "Modules List"); +define("_AM_MODULEBUILDER_MODULE_NEW", "New Module"); -define("_AM_TDMCREATE_TABLES_SUBMITTER", "Add submitter"); -define("_AM_TDMCREATE_TABLES_DATE_CREATED", "Add date created"); -define("_AM_TDMCREATE_TABLES_ONLINE", "Add online"); +define("_AM_MODULEBUILDER_TABLES_SUBMITTER", "Add submitter"); +define("_AM_MODULEBUILDER_TABLES_DATE_CREATED", "Add date created"); +define("_AM_MODULEBUILDER_TABLES_ONLINE", "Add online"); modinfo.php //Menu -define("_MI_TDMCREATE_ADMIN_INDEX","Index"); -define("_MI_TDMCREATE_ADMIN_MODULES","Add a module"); -define("_MI_TDMCREATE_ADMIN_TABLES","Add a table"); -define("_MI_TDMCREATE_ADMIN_CONST","Build the module"); -define("_MI_TDMCREATE_ADMIN_ABOUT","Short About"); -define("_MI_TDMCREATE_ADMIN_PREFERENCES","Preferences"); -define("_MI_TDMCREATE_ADMIN_UPDATE","Update"); - -define("_MI_TDMCREATE_DESC","Module create of module made by TDM"); - -define("_MI_TDMCREATE_EDITOR", "Editor"); -define("_MI_TDMCREATE_EDITORDSC", "Select an editor to write"); -define("_MI_TDMCREATE_IDPAYPAL", "Paypal ID"); -define("_MI_TDMCREATE_IDPAYPAL_DESC", "ID Paypal for donations."); \ No newline at end of file +define("_MI_MODULEBUILDER_ADMIN_INDEX","Index"); +define("_MI_MODULEBUILDER_ADMIN_MODULES","Add a module"); +define("_MI_MODULEBUILDER_ADMIN_TABLES","Add a table"); +define("_MI_MODULEBUILDER_ADMIN_CONST","Build the module"); +define("_MI_MODULEBUILDER_ADMIN_ABOUT","Short About"); +define("_MI_MODULEBUILDER_ADMIN_PREFERENCES","Preferences"); +define("_MI_MODULEBUILDER_ADMIN_UPDATE","Update"); + +define("_MI_MODULEBUILDER_DESC","Module create of module made by TDM"); + +define("_MI_MODULEBUILDER_EDITOR", "Editor"); +define("_MI_MODULEBUILDER_EDITORDSC", "Select an editor to write"); +define("_MI_MODULEBUILDER_IDPAYPAL", "Paypal ID"); +define("_MI_MODULEBUILDER_IDPAYPAL_DESC", "ID Paypal for donations."); diff --git a/language/update language 1.37 to 1.38.txt b/language/update language 1.37 to 1.38.txt index ebdb81ea..f48581ba 100644 --- a/language/update language 1.37 to 1.38.txt +++ b/language/update language 1.37 to 1.38.txt @@ -1,143 +1,143 @@ // 1.37 admin.php -define("_AM_TDMCREATE_MODULES_LIST", "Modules List"); -define("_AM_TDMCREATE_MODULES_NEW", "New Module"); +define("_AM_MODULEBUILDER_MODULES_LIST", "Modules List"); +define("_AM_MODULEBUILDER_MODULE_NEW", "New Module"); -define("_AM_TDMCREATE_TABLES_SUBMITTER", "Add submitter"); -define("_AM_TDMCREATE_TABLES_DATE_CREATED", "Add date created"); -define("_AM_TDMCREATE_TABLES_ONLINE", "Add online"); +define("_AM_MODULEBUILDER_TABLES_SUBMITTER", "Add submitter"); +define("_AM_MODULEBUILDER_TABLES_DATE_CREATED", "Add date created"); +define("_AM_MODULEBUILDER_TABLES_ONLINE", "Add online"); modinfo.php //Menu changed -define("_MI_TDMCREATE_ADMIN_INDEX","Index"); -define("_MI_TDMCREATE_ADMIN_MODULES","Add a module"); -define("_MI_TDMCREATE_ADMIN_TABLES","Add a table"); -define("_MI_TDMCREATE_ADMIN_CONST","Build the module"); -define("_MI_TDMCREATE_ADMIN_ABOUT","Short About"); -define("_MI_TDMCREATE_ADMIN_PREFERENCES","Preferences"); -define("_MI_TDMCREATE_ADMIN_UPDATE","Update"); +define("_MI_MODULEBUILDER_ADMIN_INDEX","Index"); +define("_MI_MODULEBUILDER_ADMIN_MODULES","Add a module"); +define("_MI_MODULEBUILDER_ADMIN_TABLES","Add a table"); +define("_MI_MODULEBUILDER_ADMIN_CONST","Build the module"); +define("_MI_MODULEBUILDER_ADMIN_ABOUT","Short About"); +define("_MI_MODULEBUILDER_ADMIN_PREFERENCES","Preferences"); +define("_MI_MODULEBUILDER_ADMIN_UPDATE","Update"); -define("_MI_TDMCREATE_DESC","Module create of module made by TDM"); +define("_MI_MODULEBUILDER_DESC","Module create of module made by TDM"); -define("_MI_TDMCREATE_EDITOR", "Editor"); -define("_MI_TDMCREATE_EDITORDSC", "Select an editor to write"); -define("_MI_TDMCREATE_IDPAYPAL", "Paypal ID"); -define("_MI_TDMCREATE_IDPAYPAL_DESC", "ID Paypal for donations."); +define("_MI_MODULEBUILDER_EDITOR", "Editor"); +define("_MI_MODULEBUILDER_EDITORDSC", "Select an editor to write"); +define("_MI_MODULEBUILDER_IDPAYPAL", "Paypal ID"); +define("_MI_MODULEBUILDER_IDPAYPAL_DESC", "ID Paypal for donations."); // 1.38 admin.php //Buttons -define("_AM_TDMCREATE_TABLES_NEW","Add Table"); -define("_AM_TDMCREATE_TABLES_LIST","List Tables"); +define("_AM_MODULEBUILDER_TABLES_NEW","Add Table"); +define("_AM_MODULEBUILDER_TABLES_LIST","List Tables"); -define("_AM_TDMCREATE_TABLES_CATEGORIES","Add New Categories"); +define("_AM_MODULEBUILDER_TABLES_CATEGORIES","Add New Categories"); -define("_AM_TDMCREATE_NEW","Add Define Language"); -define("_AM_TDMCREATE_LIST","List Defines Languages"); +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_TDMCREATE_MAINTAINEDBY", "is maintained by the"); +define("_AM_MODULEBUILDER_MAINTAINEDBY", "is maintained by the"); -define("_AM_TDMCREATE_VERSION", "Version"); -define("_AM_TDMCREATE_RELEASE", "Date created"); -define("_AM_TDMCREATE_STATUS", "Status"); -define("_AM_TDMCREATE_SEARCH", "Search"); +define("_AM_MODULEBUILDER_VERSION", "Version"); +define("_AM_MODULEBUILDER_RELEASE", "Date created"); +define("_AM_MODULEBUILDER_STATUS", "Status"); +define("_AM_MODULEBUILDER_SEARCH", "Search"); //deleted -define("_AM_TDMCREATE_TABLES_CATEGORIES", "Add Category"); +define("_AM_MODULEBUILDER_TABLES_CATEGORIES", "Add Category"); // New Module -define("_AM_TDMCREATE_MODULES_ACTIVE_SUBMENU", "Visible Submenu"); -define("_AM_TDMCREATE_MODULES_ACTIVE_NOTIFY", "Active Notifications"); -define("_AM_TDMCREATE_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"); +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_TDMCREATE_TABLES_DISPLAY_SUMENU", "Use view TAB Submenu"); -define("_AM_TDMCREATE_TABLES_IMAGE_DESC", ""); -define("_AM_TDMCREATE_TABLES_BLOCKS_DESC", "(blocks: random, latest, today)"); +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_TDMCREATE_FILEMANAGER_NAV_MANAGER','File Manager'); -define('_AM_TDMCREATE_FILEMANAGER_NAV_MAIN','File Manager'); +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_MANAGER','File Manager'); +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_MAIN','File Manager'); //Tips -define('_AM_TDMCREATE_FILEMANAGER_NAV_TIPS',' +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_TIPS','
      • Change file permission, content or just delete an unused file from your XOOPS site.
      '); // Main -define('_AM_TDMCREATE_FILEMANAGER_DIRECTORY','Directory'); -define('_AM_TDMCREATE_FILEMANAGER_FILES','Files'); -define('_AM_TDMCREATE_FILEMANAGER_GENERATE','Force generation'); -define('_AM_TDMCREATE_FILEMANAGER_SELECT_THEME','Select theme'); -define('_AM_TDMCREATE_FILEMANAGER_FORCE_GENERATED','Force generated'); -define('_AM_TDMCREATE_FILEMANAGER_NAV_FILE_GENERATED','Files generated'); -define('_AM_TDMCREATE_FILEMANAGER_NOT_CREATED','No files created'); -define('_AM_TDMCREATE_FILEMANAGER_HOME','Home'); -define('_AM_TDMCREATE_FILEMANAGER_SAVE','Save'); -define('_AM_TDMCREATE_FILEMANAGER_CANCEL','Cancel'); -define('_AM_TDMCREATE_FILEMANAGER_RESTORE','Restore'); -define('_AM_TDMCREATE_FILEMANAGER_REFRESH','Refresh'); -define('_AM_TDMCREATE_FILEMANAGER_UPLOAD','Upload file'); -define('_AM_TDMCREATE_FILEMANAGER_UPLOAD_CHOOSE','Select file to upload'); -define('_AM_TDMCREATE_FILEMANAGER_ADDDIR','Add Directory'); -define('_AM_TDMCREATE_FILEMANAGER_ADDDIR_NAME','Choose name of directory'); -define('_AM_TDMCREATE_FILEMANAGER_ADDFILE','Add New File'); -define('_AM_TDMCREATE_FILEMANAGER_DELDIR','Delete Directory'); - -define('_AM_TDMCREATE_FILEMANAGER_RESTORE_ERROR_FILE_EXISTS','Error: File not exist'); -define('_AM_TDMCREATE_FILEMANAGER_RESTORE_ERROR_FILE_DELETE','Error: File not delete'); -define('_AM_TDMCREATE_FILEMANAGER_RESTORE_ERROR_FILE_RENAME','Error: File not rename'); -define('_AM_TDMCREATE_FILEMANAGER_BACK','Back'); -define('_AM_TDMCREATE_FILEMANAGER_DELETE','Delete'); -define('_AM_TDMCREATE_FILEMANAGER_ERROR','Error'); -define('_AM_TDMCREATE_FILEMANAGER_EDIT','Edit of:'); -define('_AM_TDMCREATE_FILEMANAGER_EMPTY_FILE','File empty'); -define('_AM_TDMCREATE_FILEMANAGER_DELDIR_NOTOK','Error: delete this directory'); -define('_AM_TDMCREATE_FILEMANAGER_DELDIR_OK','Directory successfully deleted'); +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_TDMCREATE_FILEMANAGER_UPLOAD_FILE','Files successfully uploaded'); -define('_AM_TDMCREATE_FILEMANAGER_EXTRACT_FILE','Files successfully extracted'); -define('_AM_TDMCREATE_FILEMANAGER_EXTRACT_ERROR','Files could not be extracted'); -define('_AM_TDMCREATE_FILEMANAGER_DELETE_FILE','Files successfully deleted'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_SUCCESS','Directory successfully created'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_ERROR','Directory could not be created'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_RYSDEL','Are you sure to delete this folder?'); -define('_AM_TDMCREATE_FILEMANAGER_FILE_SUCCESS','File successfully created'); -define('_AM_TDMCREATE_FILEMANAGER_SUREDEL', 'Are you sure to delete this file %s?'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_SUREDEL', 'Are you sure you want to delete this directory %s?
      Warning: all subdirectories and files file will be deleted'); +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_TDMCREATE_NAME", "TDMCreate"); -define("_MI_TDMCREATE_DESC", "This module does to create others modules."); +define("_MI_MODULEBUILDER_NAME", "ModuleBuilder"); +define("_MI_MODULEBUILDER_DESC", "This module does to create others modules."); // Admin -define("_MI_TDMCREATE_ADMIN_NAME","TDMCreate"); -define("_MI_TDMCREATE_ADMIN_DESC","This module does to create others modules: "); +define("_MI_MODULEBUILDER_ADMIN_NAME","ModuleBuilder"); +define("_MI_MODULEBUILDER_ADMIN_DESC","This module does to create others modules: "); //Menu -define("_MI_TDMCREATE_ADMENU1","Home"); -define("_MI_TDMCREATE_ADMENU2","Modules"); -define("_MI_TDMCREATE_ADMENU3","Tables"); -define("_MI_TDMCREATE_ADMENU4","Languages"); -define("_MI_TDMCREATE_ADMENU5","Build"); -define("_MI_TDMCREATE_ADMENU6","File Manager"); -define("_MI_TDMCREATE_ADMENU7","About"); +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_TDMCREATE_EDITOR","Editor"); -define("_MI_TDMCREATE_EDITOR_DESC","Choose an editor from the list"); -define("_MI_TDMCREATE_PERPAGEADMIN","Admin per page"); -define("_MI_TDMCREATE_PERPAGEADMIN_DESC","Select to view admin per page tables or modules"); -define("_MI_TDMCREATE_IDPAYPAL", "Paypal ID"); -define("_MI_TDMCREATE_IDPAYPAL_DESC", "Insert here your id paypal for donactions."); \ No newline at end of file +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."); diff --git a/language/update language 1.38 to 1.39.txt b/language/update language 1.38 to 1.39.txt index 4d03ec59..bdd097db 100644 --- a/language/update language 1.38 to 1.39.txt +++ b/language/update language 1.38 to 1.39.txt @@ -2,133 +2,133 @@ admin.php //Buttons -define("_AM_TDMCREATE_TABLES_NEW","Add Table"); -define("_AM_TDMCREATE_TABLES_LIST","List Tables"); +define("_AM_MODULEBUILDER_TABLES_NEW","Add Table"); +define("_AM_MODULEBUILDER_TABLES_LIST","List Tables"); -define("_AM_TDMCREATE_TABLES_CATEGORIES","Add New Categories"); +define("_AM_MODULEBUILDER_TABLES_CATEGORIES","Add New Categories"); -define("_AM_TDMCREATE_NEW","Add Define Language"); -define("_AM_TDMCREATE_LIST","List Defines Languages"); +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_TDMCREATE_MAINTAINEDBY", "is maintained by the"); +define("_AM_MODULEBUILDER_MAINTAINEDBY", "is maintained by the"); -define("_AM_TDMCREATE_VERSION", "Version"); -define("_AM_TDMCREATE_RELEASE", "Date created"); -define("_AM_TDMCREATE_STATUS", "Status"); -define("_AM_TDMCREATE_SEARCH", "Search"); +define("_AM_MODULEBUILDER_VERSION", "Version"); +define("_AM_MODULEBUILDER_RELEASE", "Date created"); +define("_AM_MODULEBUILDER_STATUS", "Status"); +define("_AM_MODULEBUILDER_SEARCH", "Search"); //deleted -define("_AM_TDMCREATE_TABLES_CATEGORIES", "Add Category"); +define("_AM_MODULEBUILDER_TABLES_CATEGORIES", "Add Category"); // New Module -define("_AM_TDMCREATE_MODULES_ACTIVE_SUBMENU", "Visible Submenu"); -define("_AM_TDMCREATE_MODULES_ACTIVE_NOTIFY", "Active Notifications"); -define("_AM_TDMCREATE_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"); +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_TDMCREATE_TABLES_DISPLAY_SUMENU", "Use view TAB Submenu"); -define("_AM_TDMCREATE_TABLES_IMAGE_DESC", ""); -define("_AM_TDMCREATE_TABLES_BLOCKS_DESC", "(blocks: random, latest, today)"); +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_TDMCREATE_FILEMANAGER_NAV_MANAGER','File Manager'); -define('_AM_TDMCREATE_FILEMANAGER_NAV_MAIN','File Manager'); +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_MANAGER','File Manager'); +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_MAIN','File Manager'); //Tips -define('_AM_TDMCREATE_FILEMANAGER_NAV_TIPS',' +define('_AM_MODULEBUILDER_FILEMANAGER_NAV_TIPS','
      • Change file permission, content or just delete an unused file from your XOOPS site.
      '); // Main -define('_AM_TDMCREATE_FILEMANAGER_DIRECTORY','Directory'); -define('_AM_TDMCREATE_FILEMANAGER_FILES','Files'); -define('_AM_TDMCREATE_FILEMANAGER_GENERATE','Force generation'); -define('_AM_TDMCREATE_FILEMANAGER_SELECT_THEME','Select theme'); -define('_AM_TDMCREATE_FILEMANAGER_FORCE_GENERATED','Force generated'); -define('_AM_TDMCREATE_FILEMANAGER_NAV_FILE_GENERATED','Files generated'); -define('_AM_TDMCREATE_FILEMANAGER_NOT_CREATED','No files created'); -define('_AM_TDMCREATE_FILEMANAGER_HOME','Home'); -define('_AM_TDMCREATE_FILEMANAGER_SAVE','Save'); -define('_AM_TDMCREATE_FILEMANAGER_CANCEL','Cancel'); -define('_AM_TDMCREATE_FILEMANAGER_RESTORE','Restore'); -define('_AM_TDMCREATE_FILEMANAGER_REFRESH','Refresh'); -define('_AM_TDMCREATE_FILEMANAGER_UPLOAD','Upload file'); -define('_AM_TDMCREATE_FILEMANAGER_UPLOAD_CHOOSE','Select file to upload'); -define('_AM_TDMCREATE_FILEMANAGER_ADDDIR','Add Directory'); -define('_AM_TDMCREATE_FILEMANAGER_ADDDIR_NAME','Choose name of directory'); -define('_AM_TDMCREATE_FILEMANAGER_ADDFILE','Add New File'); -define('_AM_TDMCREATE_FILEMANAGER_DELDIR','Delete Directory'); - -define('_AM_TDMCREATE_FILEMANAGER_RESTORE_ERROR_FILE_EXISTS','Error: File not exist'); -define('_AM_TDMCREATE_FILEMANAGER_RESTORE_ERROR_FILE_DELETE','Error: File not delete'); -define('_AM_TDMCREATE_FILEMANAGER_RESTORE_ERROR_FILE_RENAME','Error: File not rename'); -define('_AM_TDMCREATE_FILEMANAGER_BACK','Back'); -define('_AM_TDMCREATE_FILEMANAGER_DELETE','Delete'); -define('_AM_TDMCREATE_FILEMANAGER_ERROR','Error'); -define('_AM_TDMCREATE_FILEMANAGER_EDIT','Edit of:'); -define('_AM_TDMCREATE_FILEMANAGER_EMPTY_FILE','File empty'); -define('_AM_TDMCREATE_FILEMANAGER_DELDIR_NOTOK','Error: delete this directory'); -define('_AM_TDMCREATE_FILEMANAGER_DELDIR_OK','Directory successfully deleted'); +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_TDMCREATE_FILEMANAGER_UPLOAD_FILE','Files successfully uploaded'); -define('_AM_TDMCREATE_FILEMANAGER_EXTRACT_FILE','Files successfully extracted'); -define('_AM_TDMCREATE_FILEMANAGER_EXTRACT_ERROR','Files could not be extracted'); -define('_AM_TDMCREATE_FILEMANAGER_DELETE_FILE','Files successfully deleted'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_SUCCESS','Directory successfully created'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_ERROR','Directory could not be created'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_RYSDEL','Are you sure to delete this folder?'); -define('_AM_TDMCREATE_FILEMANAGER_FILE_SUCCESS','File successfully created'); -define('_AM_TDMCREATE_FILEMANAGER_SUREDEL', 'Are you sure to delete this file %s?'); -define('_AM_TDMCREATE_FILEMANAGER_DIR_SUREDEL', 'Are you sure you want to delete this directory %s?
      Warning: all subdirectories and files file will be deleted'); +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_TDMCREATE_NAME", "TDMCreate"); -define("_MI_TDMCREATE_DESC", "This module does to create others modules."); +define("_MI_MODULEBUILDER_NAME", "ModuleBuilder"); +define("_MI_MODULEBUILDER_DESC", "This module does to create others modules."); // Admin -define("_MI_TDMCREATE_ADMIN_NAME","TDMCreate"); -define("_MI_TDMCREATE_ADMIN_DESC","This module does to create others modules: "); +define("_MI_MODULEBUILDER_ADMIN_NAME","ModuleBuilder"); +define("_MI_MODULEBUILDER_ADMIN_DESC","This module does to create others modules: "); //Menu -define("_MI_TDMCREATE_ADMENU1","Home"); -define("_MI_TDMCREATE_ADMENU2","Modules"); -define("_MI_TDMCREATE_ADMENU3","Tables"); -define("_MI_TDMCREATE_ADMENU4","Languages"); -define("_MI_TDMCREATE_ADMENU5","Build"); -define("_MI_TDMCREATE_ADMENU6","File Manager"); -define("_MI_TDMCREATE_ADMENU7","About"); +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_TDMCREATE_EDITOR","Editor"); -define("_MI_TDMCREATE_EDITOR_DESC","Choose an editor from the list"); -define("_MI_TDMCREATE_PERPAGEADMIN","Admin per page"); -define("_MI_TDMCREATE_PERPAGEADMIN_DESC","Select to view admin per page tables or modules"); -define("_MI_TDMCREATE_IDPAYPAL", "Paypal ID"); -define("_MI_TDMCREATE_IDPAYPAL_DESC", "Insert here your id paypal for donactions."); +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_TDMCREATE_MODULES_MIN_PHP', "Minimum Php"); -define('_AM_TDMCREATE_MODULES_MIN_XOOPS', "Minimum Xoops"); -define('_AM_TDMCREATE_MODULES_MIN_ADMIN', "Minimum Admin"); -define('_AM_TDMCREATE_MODULES_MIN_MYSQL', "Minimum Database"); +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_TDMCREATE_BREAK_GENERAL', "General preferences"); -define('_MI_TDMCREATE_BREAK_REQUIRED', "Module required"); -define('_MI_TDMCREATE_BREAK_OPTIONAL', "Module optional"); -define('_MI_TDMCREATE_MODULE_MIN_PHP', "Minimum Php"); -define('_MI_TDMCREATE_MODULE_MIN_XOOPS', "Minimum Xoops"); -define('_MI_TDMCREATE_MODULE_MIN_ADMIN', "Minimum Admin"); -define('_MI_TDMCREATE_MODULE_MIN_MYSQL', "Minimum Database"); -define('_MI_TDMCREATE_MODULES_ADMINPAGER', "Modules adminpager"); -define('_MI_TDMCREATE_TABLES_ADMINPAGER', "Tables adminpager"); \ No newline at end of file +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"); 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: '); diff --git a/preloads/autoloader.php b/preloads/autoloader.php index e23c6e01..fb11b698 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -1,15 +1,15 @@ - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access.'); +\defined('XOOPS_ROOT_PATH') || die('Restricted access.'); /** - * Class TdmcreateCorePreload + * Class ModulebuilderCorePreload */ -class TdmcreateCorePreload extends \XoopsPreloadItem +class ModulebuilderCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader - /** * @param $args */ - public static function eventCoreIncludeCommonEnd($args) + public static function eventCoreIncludeCommonEnd($args): void { - include __DIR__ . '/autoloader.php'; + require __DIR__ . '/autoloader.php'; } } diff --git a/preloads/index.html b/preloads/index.html index e8525b61..990cbd60 100644 --- a/preloads/index.html +++ b/preloads/index.html @@ -1,3 +1 @@ -' . _AM_CONTENT_CREATED . ' - -' . _AM_CONTENT_CREATED . ' + \ No newline at end of file diff --git a/sql/index.html b/sql/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/sql/index.php b/sql/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/sql/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/admin/index.php b/templates/admin/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/templates/admin/index.php @@ -0,0 +1,2 @@ + +<{include file="db:modulebuilder_header.tpl"}> + +
      <{$about}>
      + +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_building.tpl b/templates/admin/modulebuilder_building.tpl new file mode 100644 index 00000000..c59ad39b --- /dev/null +++ b/templates/admin/modulebuilder_building.tpl @@ -0,0 +1,67 @@ + +<{include file="db:modulebuilder_header.tpl"}> + +
      +<{if $building_directory|default:''}> + + + + + + + + + + + <{if $base_architecture}> + + + + <{else}> + + + + <{/if}> + + <{foreach item=build from=$builds}> + + <{if $created}> + + + + <{else}> + + + + <{/if}> + + <{/foreach}> + + + + +
      <{$smarty.const._AM_MODULEBUILDER_BUILDING_FILES}><{$smarty.const._AM_MODULEBUILDER_BUILDING_SUCCESS}><{$smarty.const._AM_MODULEBUILDER_BUILDING_FAILED}>
      <{$smarty.const._AM_MODULEBUILDER_OK_ARCHITECTURE}> <{$smarty.const._AM_MODULEBUILDER_NOTOK_ARCHITECTURE}> 
      <{$build.list}> <{$build.list}> 
      <{$building_directory}>
      +
      +<{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}>

      + <{/foreach}> +

      <{$smarty.const._AM_MODULEBUILDER_BUILDING_CHECK_SOLVE}>

      +



      ------------------------------------------------------------------------------------------------------------------ +
      <{$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}>

      + + <{/if}> + <{if $form|default:''}> + <{$form}> + <{/if}> +<{/if}> + +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_devtools.tpl b/templates/admin/modulebuilder_devtools.tpl new file mode 100644 index 00000000..a6ad8ea7 --- /dev/null +++ b/templates/admin/modulebuilder_devtools.tpl @@ -0,0 +1,84 @@ + + +<{include file="db:modulebuilder_header.tpl"}> + +<{if $devtools_list|default:''}> + + + + + + + + + + + + + + + + + + + + +
      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS}>
      +
      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_FQ}>
      +

      <{$fq_desc}>

      +
      <{$fq_form}>
      +
      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL}>
      +

      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_DESC}>

      +
      <{$cl_form}>
      +
      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_TAB}>
      +

      <{$tab_desc}>

      +
      <{$tab_form}>
      +
      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_RP}>
      +

      <{$rp_desc}>

      +
      <{$rp_form}>
      +<{/if}> +<{if $clresults|default:''}> +
      +
      +

      <{$smarty.const._AM_MODULEBUILDER_DEVTOOLS_CL_RESULTS}>

      +
      +

      <{$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_DESCR}> +

      +

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

      +
      + <{foreach item=clresultfile from=$clresults key=key}> +

      <{$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}>
      • + <{/foreach}> +
      + <{/foreach}> +
      + +
      +<{/if}> +<{if $error|default:''}> +
      + <{$error}> +
      +<{/if}> + + +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/tdmcreate_fields.tpl b/templates/admin/modulebuilder_fields.tpl similarity index 62% rename from templates/admin/tdmcreate_fields.tpl rename to templates/admin/modulebuilder_fields.tpl index 410f8013..b10b1bc6 100644 --- a/templates/admin/tdmcreate_fields.tpl +++ b/templates/admin/modulebuilder_fields.tpl @@ -1,24 +1,24 @@ -<{includeq file="db:tdmcreate_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> -<{if $tables_list}> +<{if $tables_list|default:''}> - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -26,58 +26,57 @@ <{if $table.id > 0}> - + <{$table.name}>(<{$table.module}>) + - - - - - - - - - + + + + + + + + + - + <{/if}> <{/foreach}>
      <{$smarty.const._AM_TDMCREATE_ID_LIST}><{$smarty.const._AM_TDMCREATE_NAME_LIST}><{$smarty.const._AM_TDMCREATE_IMAGE_LIST}><{$smarty.const._AM_TDMCREATE_NBFIELDS_LIST}><{$smarty.const._AM_TDMCREATE_PARENT_LIST}><{$smarty.const._AM_TDMCREATE_INLIST_LIST}><{$smarty.const._AM_TDMCREATE_INFORM_LIST}><{$smarty.const._AM_TDMCREATE_ADMIN_LIST}><{$smarty.const._AM_TDMCREATE_USER_LIST}><{$smarty.const._AM_TDMCREATE_BLOCK_LIST}><{$smarty.const._AM_TDMCREATE_MAIN_LIST}><{$smarty.const._AM_TDMCREATE_SEARCH_LIST}><{$smarty.const._AM_TDMCREATE_REQUIRED_LIST}><{$smarty.const._AM_TDMCREATE_FORMACTION}><{$smarty.const._AM_MODULEBUILDER_ID}><{$smarty.const._AM_MODULEBUILDER_NAME}><{$smarty.const._AM_MODULEBUILDER_IMAGE}><{$smarty.const._AM_MODULEBUILDER_NBFIELDS}><{$smarty.const._AM_MODULEBUILDER_PARENT}><{$smarty.const._AM_MODULEBUILDER_INLIST}><{$smarty.const._AM_MODULEBUILDER_INFORM}><{$smarty.const._AM_MODULEBUILDER_ADMIN}><{$smarty.const._AM_MODULEBUILDER_USER}><{$smarty.const._AM_MODULEBUILDER_BLOCK}><{$smarty.const._AM_MODULEBUILDER_MAIN}><{$smarty.const._AM_MODULEBUILDER_SEARCH}><{$smarty.const._AM_MODULEBUILDER_REQUIRED}><{$smarty.const._AM_MODULEBUILDER_FORMACTION}>
      (<{$table.lid}>) - Toggle + Toggle - <{$table.name}><{$table.name}> <{$table.name}> <{$table.nbfields}> - - <{$smarty.const._AM_TDMCREATE_EDIT_TABLE}> + + <{$smarty.const._AM_MODULEBUILDER_TABLES_EDIT}> - - <{$smarty.const._AM_TDMCREATE_EDIT_FIELDS}> + + <{$smarty.const._AM_MODULEBUILDER_FIELDS_EDIT}> - - <{$smarty.const._DELETE}> + + <{$smarty.const._DELETE}>
      <{includeq file="db:tdmcreate_fields_item.tpl" table=$table}><{include file="db:modulebuilder_fields_item.tpl" table=$table}>
      -
      -
      +
      +
       
      - <{if $pagenav}> + <{if $pagenav|default:''}>
      <{$pagenav}>
      <{/if}> <{/if}> -<{if $error}> +<{if $error|default:''}>
      <{$error}>
      <{/if}> -<{if $form}> +<{if $form|default:''}>
      <{$form}>
      <{/if}> -<{*<{includeq file="db:tdmcreate_footer.tpl"}>*}> +<{*<{include file="db:modulebuilder_footer.tpl"}>*}> diff --git a/templates/admin/tdmcreate_fields_item.tpl b/templates/admin/modulebuilder_fields_item.tpl similarity index 77% rename from templates/admin/tdmcreate_fields_item.tpl rename to templates/admin/modulebuilder_fields_item.tpl index 41d95c0a..bcfeb3d2 100644 --- a/templates/admin/tdmcreate_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_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$field.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$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_TDMCREATE_CHANGE_DISPLAY}> <{$field.name}> + alt="<{$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/tdmcreate_footer.tpl b/templates/admin/modulebuilder_footer.tpl similarity index 60% rename from templates/admin/tdmcreate_footer.tpl rename to templates/admin/modulebuilder_footer.tpl index bea8cba8..67541769 100644 --- a/templates/admin/tdmcreate_footer.tpl +++ b/templates/admin/modulebuilder_footer.tpl @@ -1,10 +1,9 @@ -
      +
      - Xoops Logo + Xoops Logo
      - <{$maintained}> - <{$smarty.const._AM_TDMCREATE_SUPPORT_FORUM}> + <{$smarty.const._AM_MODULEBUILDER_SUPPORT_FORUM}>
      diff --git a/templates/admin/modulebuilder_header.tpl b/templates/admin/modulebuilder_header.tpl new file mode 100644 index 00000000..b872c0fc --- /dev/null +++ b/templates/admin/modulebuilder_header.tpl @@ -0,0 +1,8 @@ +
      + <{$navigation|default:''}> + <{if $buttons|default:''}><{$buttons}> <{/if}> +
      + diff --git a/templates/admin/modulebuilder_index.tpl b/templates/admin/modulebuilder_index.tpl new file mode 100644 index 00000000..42048d22 --- /dev/null +++ b/templates/admin/modulebuilder_index.tpl @@ -0,0 +1,6 @@ + +<{include file="db:modulebuilder_header.tpl"}> + +
      <{$index|default:''}>
      + +<{*<{include file="db:modulebuilder_footer.tpl"}>*}> diff --git a/templates/admin/tdmcreate_modules.tpl b/templates/admin/modulebuilder_modules.tpl similarity index 66% rename from templates/admin/tdmcreate_modules.tpl rename to templates/admin/modulebuilder_modules.tpl index b64f0e9c..7f02ca9b 100644 --- a/templates/admin/tdmcreate_modules.tpl +++ b/templates/admin/modulebuilder_modules.tpl @@ -1,109 +1,115 @@ -<{includeq file="db:tdmcreate_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> -<{if $modules_list}> +<{if $modules_list|default:''}> - - - - - - - - - - - - - - + + + + + + + + + + + + + + <{foreach item=module from=$modules_list key=mod_id}> - + - - - - - - - <{/foreach}>
      <{$smarty.const._AM_TDMCREATE_MODULE_ID}><{$smarty.const._AM_TDMCREATE_MODULE_NAME}><{$smarty.const._AM_TDMCREATE_MODULE_VERSION}><{$smarty.const._AM_TDMCREATE_MODULE_IMAGE}><{$smarty.const._AM_TDMCREATE_MODULE_RELEASE}><{$smarty.const._AM_TDMCREATE_MODULE_STATUS}><{$smarty.const._AM_TDMCREATE_MODULE_ADMIN_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_USER_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_BLOCKS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_SEARCH_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_COMMENTS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_NOTIFICATIONS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_PERMISSIONS_LIST}><{$smarty.const._AM_TDMCREATE_FORMACTION}><{$smarty.const._AM_MODULEBUILDER_MODULE_ID}><{$smarty.const._AM_MODULEBUILDER_MODULE_NAME}><{$smarty.const._AM_MODULEBUILDER_MODULE_VERSION}><{$smarty.const._AM_MODULEBUILDER_MODULE_IMAGE}><{$smarty.const._AM_MODULEBUILDER_MODULE_RELEASE}><{$smarty.const._AM_MODULEBUILDER_MODULE_STATUS}><{$smarty.const._AM_MODULEBUILDER_ADMIN}><{$smarty.const._AM_MODULEBUILDER_USER}><{$smarty.const._AM_MODULEBUILDER_BLOCKS}><{$smarty.const._AM_MODULEBUILDER_SEARCH}><{$smarty.const._AM_MODULEBUILDER_COMMENTS}><{$smarty.const._AM_MODULEBUILDER_NOTIFICATIONS}><{$smarty.const._AM_MODULEBUILDER_PERMISSIONS}><{$smarty.const._AM_MODULEBUILDER_FORMACTION}>
      <{$module.id}> <{$module.name}> <{$module.version}> <{$module.release}> <{$module.status}><{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$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._AM_TDMCREATE_ADMIN_CONST}> + <{$smarty.const._DELETE}> + + <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}> + + <{$smarty.const._CLONE}>
      -
      -
      +
      +
       
      - <{if $pagenav}> + <{if $pagenav|default:''}>
      <{$pagenav}>
      <{/if}> <{else}> - <{if $form}> + <{if $form|default:''}>
      <{$form}>
      <{/if}> <{/if}> -<{if $error}> + +<{if $error|default:''}>
      <{$error}>
      <{/if}> + +<{if $tables_list|default:''}> + <{foreach item=table from=$tables_list}> +

      <{$table}>

      + <{/foreach}> +<{/if}> -<{includeq file="db:tdmcreate_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/tdmcreate_morefiles.tpl b/templates/admin/modulebuilder_morefiles.tpl similarity index 52% rename from templates/admin/tdmcreate_morefiles.tpl rename to templates/admin/modulebuilder_morefiles.tpl index b00d3ac3..2c10b3df 100644 --- a/templates/admin/tdmcreate_morefiles.tpl +++ b/templates/admin/modulebuilder_morefiles.tpl @@ -1,52 +1,56 @@ -<{includeq file="db:tdmcreate_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> -<{if $files_list}> +<{if $files_list|default:''}> - - - - - - + + + + + + + + <{foreach item=file from=$files_list key=file_id}> + + <{/foreach}>
      <{$smarty.const._AM_TDMCREATE_FILE_ID}><{$smarty.const._AM_TDMCREATE_FILE_MID_LIST}><{$smarty.const._AM_TDMCREATE_FILE_INFOLDER_LIST}><{$smarty.const._AM_TDMCREATE_FILE_NAME_LIST}><{$smarty.const._AM_TDMCREATE_FILE_EXTENSION_LIST}><{$smarty.const._AM_TDMCREATE_FORM_ACTION}><{$smarty.const._AM_MODULEBUILDER_FILE_ID}><{$smarty.const._AM_MODULEBUILDER_FILE_MID_LIST}><{$smarty.const._AM_MODULEBUILDER_FILE_TYPE_LIST}><{$smarty.const._AM_MODULEBUILDER_FILE_INFOLDER_LIST}><{$smarty.const._AM_MODULEBUILDER_FILE_NAME_LIST}><{$smarty.const._AM_MODULEBUILDER_FILE_EXTENSION_LIST}><{$smarty.const._AM_MODULEBUILDER_FILE_UPLOAD_LIST}><{$smarty.const._AM_MODULEBUILDER_FORM_ACTION}>
      <{$file.id}> <{$file.mid}><{$file.type}> <{$file.infolder}> <{$file.name}> <{$file.extension}><{$file.upload}> - <{$smarty.const._EDIT}> + <{$smarty.const._EDIT}> - <{$smarty.const._DELETE}> + <{$smarty.const._DELETE}>
      -
      -
      +
      +
       
      - <{if $pagenav}> + <{if $pagenav|default:''}>
      <{$pagenav}>
      <{/if}> <{else}> - <{if $form}> + <{if $form|default:''}>
      <{$form}>
      <{/if}> <{/if}> -<{if $error}> +<{if $error|default:''}>
      <{$error}>
      <{/if}> -<{includeq file="db:tdmcreate_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/modulebuilder_settings.tpl b/templates/admin/modulebuilder_settings.tpl new file mode 100644 index 00000000..e453b942 --- /dev/null +++ b/templates/admin/modulebuilder_settings.tpl @@ -0,0 +1,73 @@ + +<{include file="db:modulebuilder_header.tpl"}> + +<{if $settings_list|default:''}> +
      + + + + + + + + + + + + <{foreach item=set from=$settings_list key=set_id}> + + + + + + + + + + + <{/foreach}> +
      <{$smarty.const._AM_MODULEBUILDER_ID}><{$smarty.const._AM_MODULEBUILDER_SETTING_NAME}><{$smarty.const._AM_MODULEBUILDER_SETTING_VERSION}><{$smarty.const._AM_MODULEBUILDER_SETTING_IMAGE}><{$smarty.const._AM_MODULEBUILDER_SETTING_RELEASE}><{$smarty.const._AM_MODULEBUILDER_SETTING_STATUS}><{$smarty.const._AM_MODULEBUILDER_SETTING_TYPE}><{$smarty.const._AM_MODULEBUILDER_FORM_ACTION}>
      <{$set.id}><{$set.name}><{$set.version}><{$set.release}><{$set.status}> + <{if $set.type == 1}> + <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$set.name}> + <{else}> + + <{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$set.name}> + <{/if}> + + + + + <{$smarty.const._EDIT}> + + + <{$smarty.const._DELETE}> + +
      +
      +
      +
      + +
       
      + <{if $pagenav|default:''}> +
      <{$pagenav}>
      +
      + <{/if}> +<{else}> + + <{if $form|default:''}> +
      <{$form}>
      + <{/if}> +<{/if}> +<{if $error|default:''}> +
      + <{$error}> +
      +<{/if}> + +<{include file="db:modulebuilder_footer.tpl"}> diff --git a/templates/admin/tdmcreate_tables.tpl b/templates/admin/modulebuilder_tables.tpl similarity index 72% rename from templates/admin/tdmcreate_tables.tpl rename to templates/admin/modulebuilder_tables.tpl index 42af045a..603659d6 100644 --- a/templates/admin/tdmcreate_tables.tpl +++ b/templates/admin/modulebuilder_tables.tpl @@ -1,23 +1,23 @@ -<{includeq file="db:tdmcreate_header.tpl"}> +<{include file="db:modulebuilder_header.tpl"}> -<{if $modules_list}> +<{if $modules_list|default:''}> - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -25,99 +25,106 @@ <{if $module.id > 0}> - - - + + - - - - + - - - - + <{/if}> <{/foreach}>
      <{$smarty.const._AM_TDMCREATE_MODULE_ID}><{$smarty.const._AM_TDMCREATE_MODULE_NAME_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_IMAGE_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_NBFIELDS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_ADMIN_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_USER_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_BLOCKS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_SUBMENU_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_SEARCH_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_COMMENTS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_NOTIFICATIONS_LIST}><{$smarty.const._AM_TDMCREATE_MODULE_PERMISSIONS_LIST}><{$smarty.const._AM_TDMCREATE_FORMACTION}><{$smarty.const._AM_MODULEBUILDER_MODULE_ID}><{$smarty.const._AM_MODULEBUILDER_NAME}><{$smarty.const._AM_MODULEBUILDER_IMAGE}><{$smarty.const._AM_MODULEBUILDER_FIELDS}><{$smarty.const._AM_MODULEBUILDER_ADMIN}><{$smarty.const._AM_MODULEBUILDER_USER}><{$smarty.const._AM_MODULEBUILDER_BLOCKS}><{$smarty.const._AM_MODULEBUILDER_SUBMENU}><{$smarty.const._AM_MODULEBUILDER_SEARCH}><{$smarty.const._AM_MODULEBUILDER_COMMENTS}><{$smarty.const._AM_MODULEBUILDER_NOTIFICATIONS}><{$smarty.const._AM_MODULEBUILDER_PERMISSIONS}><{$smarty.const._AM_MODULEBUILDER_FORMACTION}>
      (<{$module.id}>) - Toggle + Toggle <{$module.name}>1616<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> SubmenuSubmenu<{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$module.name}>"> <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$module.name}> + alt="<{$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_TDMCREATE_ADMIN_CONST}> + <{$smarty.const._AM_MODULEBUILDER_ADMIN_CONST}>
      <{includeq file="db:tdmcreate_tables_item.tpl" module=$module}><{include file="db:modulebuilder_tables_item.tpl" module=$module}>
      -
      -
      +
      +
       
      - <{if $pagenav}> + <{if $pagenav|default:''}>
      <{$pagenav}>
      <{/if}> <{/if}> -<{if $error}> +<{if $error|default:''}>
      <{$error}>
      <{/if}> -<{if $form}> +<{if $form|default:''}>
      <{$form}>
      <{/if}> -<{includeq file="db:tdmcreate_footer.tpl"}> +<{include file="db:modulebuilder_footer.tpl"}> + + diff --git a/templates/admin/tdmcreate_tables_item.tpl b/templates/admin/modulebuilder_tables_item.tpl similarity index 77% rename from templates/admin/tdmcreate_tables_item.tpl rename to templates/admin/modulebuilder_tables_item.tpl index fcb55e3c..c585da22 100644 --- a/templates/admin/tdmcreate_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_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>" + title="<{$smarty.const._AM_MODULEBUILDER_CHANGE_DISPLAY}> <{$table.name}>"> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$table.name}> + alt="<{$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/admin/tdmcreate_about.tpl b/templates/admin/tdmcreate_about.tpl deleted file mode 100644 index 54defcc8..00000000 --- a/templates/admin/tdmcreate_about.tpl +++ /dev/null @@ -1,6 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -
      <{$about}>
      - -<{includeq file="db:tdmcreate_footer.tpl"}> \ No newline at end of file diff --git a/templates/admin/tdmcreate_addfiles.tpl b/templates/admin/tdmcreate_addfiles.tpl deleted file mode 100644 index e4c85852..00000000 --- a/templates/admin/tdmcreate_addfiles.tpl +++ /dev/null @@ -1,52 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -<{if $files_list}> - - - - - - - - - - <{foreach item=file from=$files_list key=file_id}> - - - - - - - - - <{/foreach}> -
      <{$smarty.const._AM_TDMCREATE_FILE_ID}><{$smarty.const._AM_TDMCREATE_FILE_MID_LIST}><{$smarty.const._AM_TDMCREATE_FILE_NAME_LIST}><{$smarty.const._AM_TDMCREATE_FILE_EXTENSION_LIST}><{$smarty.const._AM_TDMCREATE_FILE_INFOLDER_LIST}><{$smarty.const._AM_TDMCREATE_FORM_ACTION}>
      <{$file.id}><{$file.mid}><{$file.name}><{$file.extension}><{$file.infolder}> - - <{$smarty.const._EDIT}> - - - <{$smarty.const._DELETE}> - -
      -
      -
      - -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{else}> - - <{if $form}> -
      <{$form}>
      - <{/if}> -<{/if}> -<{if $error}> -
      - <{$error}> -
      -<{/if}> - -<{includeq file="db:tdmcreate_footer.tpl"}> diff --git a/templates/admin/tdmcreate_addmymodule.tpl b/templates/admin/tdmcreate_addmymodule.tpl deleted file mode 100644 index 863c5492..00000000 --- a/templates/admin/tdmcreate_addmymodule.tpl +++ /dev/null @@ -1,52 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -<{if $mymodule_list}> - - - - - - - - - - <{foreach item=file from=$mymodule_list key=file_id}> - - - - - - - - - <{/foreach}> -
      <{$smarty.const._AM_TDMCREATE_FILE_ID}><{$smarty.const._AM_TDMCREATE_FILE_MID_LIST}><{$smarty.const._AM_TDMCREATE_FILE_NAME_LIST}><{$smarty.const._AM_TDMCREATE_FILE_EXTENSION_LIST}><{$smarty.const._AM_TDMCREATE_FILE_INFOLDER_LIST}><{$smarty.const._AM_TDMCREATE_FORM_ACTION}>
      <{$file.id}><{$file.mid}><{$file.name}><{$file.extension}><{$file.infolder}> - - <{$smarty.const._EDIT}> - - - <{$smarty.const._DELETE}> - -
      -
      -
      - -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{else}> - - <{if $form}> -
      <{$form}>
      - <{/if}> -<{/if}> -<{if $error}> -
      - <{$error}> -
      -<{/if}> - -<{includeq file="db:tdmcreate_footer.tpl"}> diff --git a/templates/admin/tdmcreate_building.tpl b/templates/admin/tdmcreate_building.tpl deleted file mode 100644 index 8dd4d56b..00000000 --- a/templates/admin/tdmcreate_building.tpl +++ /dev/null @@ -1,51 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -
      -<{if $building_directory}> - - - - - - - - - - - <{if $base_architecture}> - - - - <{else}> - - - - <{/if}> - - <{foreach item=build from=$builds}> - - <{if $created}> - - - - <{else}> - - - - <{/if}> - - <{/foreach}> - - - - -
      <{$smarty.const._AM_TDMCREATE_BUILDING_FILES}><{$smarty.const._AM_TDMCREATE_BUILDING_SUCCESS}><{$smarty.const._AM_TDMCREATE_BUILDING_FAILED}>
      <{$smarty.const._AM_TDMCREATE_OK_ARCHITECTURE}> <{$smarty.const._AM_TDMCREATE_NOTOK_ARCHITECTURE}> 
      <{$build.list}> <{$build.list}> 
      <{$building_directory}>
      -
      -<{else}> - <{if $form}> - <{$form}> - <{/if}> -<{/if}> - -<{includeq file="db:tdmcreate_footer.tpl"}> diff --git a/templates/admin/tdmcreate_header.tpl b/templates/admin/tdmcreate_header.tpl deleted file mode 100644 index 398ca24d..00000000 --- a/templates/admin/tdmcreate_header.tpl +++ /dev/null @@ -1,8 +0,0 @@ -
      - <{$navigation}> - <{if $buttons}><{$buttons}> <{/if}> -
      - diff --git a/templates/admin/tdmcreate_index.tpl b/templates/admin/tdmcreate_index.tpl deleted file mode 100644 index c00ced9f..00000000 --- a/templates/admin/tdmcreate_index.tpl +++ /dev/null @@ -1,6 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -
      <{$index}>
      - -<{*<{includeq file="db:tdmcreate_footer.tpl"}>*}> diff --git a/templates/admin/tdmcreate_moremymodule.tpl b/templates/admin/tdmcreate_moremymodule.tpl deleted file mode 100644 index 76f06cb5..00000000 --- a/templates/admin/tdmcreate_moremymodule.tpl +++ /dev/null @@ -1,52 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -<{if $mymodule_list}> - - - - - - - - - - <{foreach item=file from=$mymodule_list key=file_id}> - - - - - - - - - <{/foreach}> -
      <{$smarty.const._AM_TDMCREATE_FILE_ID}><{$smarty.const._AM_TDMCREATE_FILE_MID_LIST}><{$smarty.const._AM_TDMCREATE_FILE_INFOLDER_LIST}><{$smarty.const._AM_TDMCREATE_FILE_NAME_LIST}><{$smarty.const._AM_TDMCREATE_FILE_EXTENSION_LIST}><{$smarty.const._AM_TDMCREATE_FORM_ACTION}>
      <{$file.id}><{$file.mid}><{$file.infolder}><{$file.name}><{$file.extension}> - - <{$smarty.const._EDIT}> - - - <{$smarty.const._DELETE}> - -
      -
      -
      - -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{else}> - - <{if $form}> -
      <{$form}>
      - <{/if}> -<{/if}> -<{if $error}> -
      - <{$error}> -
      -<{/if}> - -<{includeq file="db:tdmcreate_footer.tpl"}> diff --git a/templates/admin/tdmcreate_settings.tpl b/templates/admin/tdmcreate_settings.tpl deleted file mode 100644 index 62ee6448..00000000 --- a/templates/admin/tdmcreate_settings.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -<{includeq file="db:tdmcreate_header.tpl"}> - -<{if $settings_list}> -
      - - - - - - - - - - - - <{foreach item=set from=$settings_list key=set_id}> - - - - - - - - - - - <{/foreach}> -
      <{$smarty.const._AM_TDMCREATE_ID}><{$smarty.const._AM_TDMCREATE_SETTING_NAME}><{$smarty.const._AM_TDMCREATE_SETTING_VERSION}><{$smarty.const._AM_TDMCREATE_SETTING_IMAGE}><{$smarty.const._AM_TDMCREATE_SETTING_RELEASE}><{$smarty.const._AM_TDMCREATE_SETTING_STATUS}><{$smarty.const._AM_TDMCREATE_SETTING_CHOISE}><{$smarty.const._AM_TDMCREATE_FORM_ACTION}>
      <{$set.id}><{$set.name}><{$set.version}><{$set.release}><{$set.status}> - <{$smarty.const._AM_TDMCREATE_CHANGE_DISPLAY}> <{$set.name}> - - <{$smarty.const._EDIT}> - - - <{$smarty.const._DELETE}> - -
      -
      -
      -
      - -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{else}> - - <{if $form}> -
      <{$form}>
      - <{/if}> -<{/if}> -<{if $error}> -
      - <{$error}> -
      -<{/if}> - -<{includeq file="db:tdmcreate_footer.tpl"}> diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates/index.php b/templates/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/templates/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/testdata/english/index.php b/testdata/english/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/testdata/english/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ 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_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_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/index.html b/testdata/german/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/german/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/german/tdmcreate_fieldattributes.yml b/testdata/german/tdmcreate_fieldattributes.yml deleted file mode 100644 index aba8a4b2..00000000 --- a/testdata/german/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/tdmcreate_fieldelements.yml b/testdata/german/tdmcreate_fieldelements.yml deleted file mode 100644 index b20d20b9..00000000 --- a/testdata/german/tdmcreate_fieldelements.yml +++ /dev/null @@ -1,225 +0,0 @@ -- - fieldelement_id: '1' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: ... - fieldelement_value: '' - fieldelement_sort: '0' - fieldelement_deftype: '0' - fieldelement_defvalue: '0' -- - fieldelement_id: '2' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: Text - fieldelement_value: XoopsFormText - fieldelement_sort: '1' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '3' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: TextArea - fieldelement_value: XoopsFormTextArea - fieldelement_sort: '2' - fieldelement_deftype: '15' - fieldelement_defvalue: '0' -- - fieldelement_id: '4' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: DhtmlTextArea - fieldelement_value: XoopsFormDhtmlTextArea - fieldelement_sort: '3' - fieldelement_deftype: '15' - fieldelement_defvalue: '0' -- - fieldelement_id: '5' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: CheckBox - fieldelement_value: XoopsFormCheckBox - fieldelement_sort: '4' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '6' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: RadioYN - fieldelement_value: XoopsFormRadioYN - fieldelement_sort: '6' - fieldelement_deftype: '2' - fieldelement_defvalue: '1' -- - fieldelement_id: '7' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectBox - fieldelement_value: XoopsFormSelect - fieldelement_sort: '7' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '8' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectUser - fieldelement_value: XoopsFormSelectUser - fieldelement_sort: '9' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '9' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: ColorPicker - fieldelement_value: XoopsFormColorPicker - fieldelement_sort: '19' - fieldelement_deftype: '14' - fieldelement_defvalue: '7' -- - fieldelement_id: '10' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: ImageList - fieldelement_value: XoopsFormImageList - fieldelement_sort: '13' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '11' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectFile - fieldelement_value: XoopsFormSelectFile - fieldelement_sort: '10' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '12' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: UrlFile - fieldelement_value: XoopsFormUrlFile - fieldelement_sort: '16' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '13' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: UploadImage - fieldelement_value: XoopsFormUploadImage - fieldelement_sort: '14' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '14' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: UploadFile - fieldelement_value: XoopsFormUploadFile - fieldelement_sort: '15' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '15' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: TextDateSelect - fieldelement_value: XoopsFormTextDateSelect - fieldelement_sort: '17' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '16' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectStatus - fieldelement_value: XoopsFormSelectStatus - fieldelement_sort: '20' - fieldelement_deftype: '2' - fieldelement_defvalue: '1' -- - fieldelement_id: '17' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: Password - fieldelement_value: XoopsFormPassword - fieldelement_sort: '21' - fieldelement_deftype: '14' - fieldelement_defvalue: '255' -- - fieldelement_id: '18' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectCountry - fieldelement_value: XoopsFormSelectCountry - fieldelement_sort: '11' - fieldelement_deftype: '14' - fieldelement_defvalue: '3' -- - fieldelement_id: '19' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectLang - fieldelement_value: XoopsFormSelectLang - fieldelement_sort: '12' - fieldelement_deftype: '14' - fieldelement_defvalue: '100' -- - fieldelement_id: '20' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: Radio - fieldelement_value: XoopsFormRadio - fieldelement_sort: '5' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '21' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: DateTime - fieldelement_value: XoopsFormDateTime - fieldelement_sort: '18' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '22' - fieldelement_mid: '0' - fieldelement_tid: '0' - fieldelement_name: SelectCombo - fieldelement_value: XoopsFormSelectCombo - fieldelement_sort: '8' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '23' - fieldelement_mid: '1' - fieldelement_tid: '3' - fieldelement_name: 'Table : Testfields' - fieldelement_value: XoopsFormTables-Testfields - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '24' - fieldelement_mid: '1' - fieldelement_tid: '1' - fieldelement_name: 'Table : Categories' - fieldelement_value: XoopsFormTables-Categories - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' -- - fieldelement_id: '25' - fieldelement_mid: '1' - fieldelement_tid: '2' - fieldelement_name: 'Table : Articles' - fieldelement_value: XoopsFormTables-Articles - fieldelement_sort: '0' - fieldelement_deftype: '2' - fieldelement_defvalue: '10' diff --git a/testdata/german/tdmcreate_fieldkey.yml b/testdata/german/tdmcreate_fieldkey.yml deleted file mode 100644 index 1f967fae..00000000 --- a/testdata/german/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/tdmcreate_fieldnull.yml b/testdata/german/tdmcreate_fieldnull.yml deleted file mode 100644 index 2ca74967..00000000 --- a/testdata/german/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/tdmcreate_fields.yml b/testdata/german/tdmcreate_fields.yml deleted file mode 100644 index b9ada263..00000000 --- a/testdata/german/tdmcreate_fields.yml +++ /dev/null @@ -1,900 +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: '24' - 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: '255' - 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: '1' - field_required: '0' -- - field_id: '17' - field_mid: '1' - field_tid: '3' - field_order: '3' - field_name: tf_textarea - field_type: '15' - field_value: '0' - 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: '1' - field_required: '0' -- - field_id: '18' - field_mid: '1' - field_tid: '3' - field_order: '4' - field_name: tf_dhtml - field_type: '15' - field_value: '0' - 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: '1' - field_thead: '0' - field_tbody: '1' - 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: '1' - 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: '2' - field_value: '10' - 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: '1' - field_thead: '0' - field_tbody: '1' - 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: '1' - field_thead: '0' - field_tbody: '1' - 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: '7' - 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: '1' - field_thead: '0' - field_tbody: '1' - 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: '255' - 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: '1' - field_thead: '0' - field_tbody: '1' - 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: '255' - 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: '1' - field_thead: '0' - field_tbody: '1' - 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: '255' - 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: '255' - 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: '0' - field_tbody: '1' - 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: '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: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '29' - field_mid: '1' - field_tid: '3' - field_order: '15' - field_name: tf_selectfile - field_type: '14' - field_value: '255' - 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: '1' - field_thead: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '0' -- - field_id: '30' - field_mid: '1' - field_tid: '3' - field_order: '16' - field_name: tf_password - field_type: '14' - field_value: '255' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '17' - 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: '31' - field_mid: '1' - field_tid: '3' - field_order: '17' - field_name: tf_country_list - field_type: '14' - field_value: '3' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '18' - 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: '32' - field_mid: '1' - field_tid: '3' - field_order: '18' - field_name: tf_language - field_type: '14' - field_value: '100' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '19' - 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: '33' - field_mid: '1' - field_tid: '3' - field_order: '19' - field_name: tf_radio - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '20' - 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: '34' - field_mid: '1' - field_tid: '3' - field_order: '20' - field_name: tf_status - field_type: '2' - field_value: '1' - 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: '0' - field_tbody: '1' - field_tfoot: '0' - field_block: '0' - field_main: '0' - field_search: '0' - field_required: '1' -- - field_id: '35' - field_mid: '1' - field_tid: '3' - field_order: '21' - field_name: tf_datetime - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '21' - 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: '36' - field_mid: '1' - field_tid: '3' - field_order: '22' - field_name: tf_combobox - field_type: '2' - field_value: '10' - field_attribute: '1' - field_null: '2' - field_default: '' - field_key: '1' - field_element: '22' - 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' diff --git a/testdata/german/tdmcreate_fieldtype.yml b/testdata/german/tdmcreate_fieldtype.yml deleted file mode 100644 index d08e73c6..00000000 --- a/testdata/german/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/tdmcreate_languages.yml b/testdata/german/tdmcreate_languages.yml deleted file mode 100644 index f7bcb871..00000000 --- a/testdata/german/tdmcreate_languages.yml +++ /dev/null @@ -1 +0,0 @@ -{ } \ No newline at end of file diff --git a/testdata/german/tdmcreate_modules.yml b/testdata/german/tdmcreate_modules.yml deleted file mode 100644 index d5903e60..00000000 --- a/testdata/german/tdmcreate_modules.yml +++ /dev/null @@ -1,40 +0,0 @@ -- - mod_id: '1' - mod_name: 'My Module 3' - mod_dirname: mymodule3 - 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/tdmcreate_morefiles.yml b/testdata/german/tdmcreate_morefiles.yml deleted file mode 100644 index f7bcb871..00000000 --- a/testdata/german/tdmcreate_morefiles.yml +++ /dev/null @@ -1 +0,0 @@ -{ } \ No newline at end of file diff --git a/testdata/german/tdmcreate_settings.yml b/testdata/german/tdmcreate_settings.yml deleted file mode 100644 index e188e0f1..00000000 --- a/testdata/german/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/tdmcreate_tables.yml b/testdata/german/tdmcreate_tables.yml deleted file mode 100644 index 97b84f71..00000000 --- a/testdata/german/tdmcreate_tables.yml +++ /dev/null @@ -1,90 +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: '22' - 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' diff --git a/testdata/images/empty.png b/testdata/images/empty.png new file mode 100644 index 00000000..21052bd6 Binary files /dev/null and b/testdata/images/empty.png differ diff --git a/testdata/images/index.html b/testdata/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/images/index.php b/testdata/images/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/testdata/images/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/testdata/images/modules/index.php b/testdata/images/modules/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/testdata/images/modules/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/testdata/images/tables/index.php b/testdata/images/tables/index.php new file mode 100644 index 00000000..e5ee0725 --- /dev/null +++ b/testdata/images/tables/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/testdata/index.php b/testdata/index.php index 72fb343c..b1883375 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -1,4 +1,5 @@ -loadLanguage('common'); switch ($op) { case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok')) { 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', \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM'), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); xoops_cp_footer(); } break; case 'save': saveSampleData(); break; + case 'clear': + 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', constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + xoops_cp_footer(); + } + break; } // XMF TableLoad for SAMPLE data -function loadSampleData() +function loadSampleData(): void { global $xoopsConfig; + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $utility = new Tdmcreate\Utility(); - $configurator = new Common\Configurator(); + $utility = new Utility(); + $configurator = new Configurator(); $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { + if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { $language = $xoopsConfig['language'] . '/'; } + // load module tables 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); + $tabledata = Yaml::readWrapped($language . $table . '.yml'); + TableLoad::truncateTable($table); + TableLoad::loadTableFromArray($table, $tabledata); } -} + + // load permissions + $table = 'group_permission'; + $tabledata = Yaml::readWrapped($language . $table . '.yml'); + $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 = __DIR__ . '/../testdata/images/'; - foreach (array_keys($configurator->copyTestFolders) as $i) { + 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() +function saveSampleData(): void { global $xoopsConfig; - - $configurator = new Common\Configurator(); - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { - $language = $xoopsConfig['language'] . '/'; - } - - $languageFolder = __DIR__ . '/' . $language; - if (!file_exists($languageFolder . '/')) { - Utility::createFolder($languageFolder . '/'); + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); + $helper = Helper::getInstance(); + $tables = $helper->getModule()->getInfo('tables'); + + $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; + if (!\file_exists($languageFolder . '/')) { + Utility::createFolder($languageFolder . '/'); } $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; Utility::createFolder($exportFolder); + // save module tables foreach ($tables as $table) { - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); - } - - // --- 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); - } + TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); } - redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); + + // save permissions + $criteria = new \CriteriaCompo(); + $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); + + \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); + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); try { // TODO set exportSchema - // $migrate = new Tdmcreate\Migrate($moduleDirName); + // $migrate = new Migrate($moduleDirName); // $migrate->saveCurrentSchema(); // // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); - } - catch (\Exception $e) { + } catch (\Throwable $e) { exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); } +} + +/** + * loadTableFromArrayWithReplace + * + * @param string $table value with should be used insead of original value of $search + * + * @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(string $table, array $data, string $search, $replace) +{ + /** @var \XoopsMySQLDatabase $db */ + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + + $prefixedTable = $db->prefix($table); + $count = 0; + + $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); + + $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); + } + } + $sql = $insertInto . ') ' . $valueClause . ')'; + + $result = $db->queryF($sql); + if (false !== $result) { + ++$count; + } + } + } + + return $count; +} + +function clearSampleData(): void +{ + $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')); } diff --git a/testdata/mymodule/admin/about.php b/testdata/mymodule/admin/about.php deleted file mode 100644 index 3282ba28..00000000 --- a/testdata/mymodule/admin/about.php +++ /dev/null @@ -1,26 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -$templateMain = 'mymodule_admin_about.tpl'; -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('about.php')); -$GLOBALS['xoopsTpl']->assign('about', $adminObject->renderAbout('6KJ7RW5DR3VTJ', false)); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/admin/articles.php b/testdata/mymodule/admin/articles.php deleted file mode 100644 index c723e762..00000000 --- a/testdata/mymodule/admin/articles.php +++ /dev/null @@ -1,172 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request art_id -$artId = Request::getInt('art_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE_ADD_ARTICLE, 'articles.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $articlesCount = $articlesHandler->getCountArticles(); - $articlesAll = $articlesHandler->getAllArticles($start, $limit); - $GLOBALS['xoopsTpl']->assign('articles_count', $articlesCount); - $GLOBALS['xoopsTpl']->assign('mymodule_url', MYMODULE_URL); - $GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); - // Table view articles - if($articlesCount > 0) { - foreach(array_keys($articlesAll) as $i) { - $article = $articlesAll[$i]->getValuesArticles(); - $GLOBALS['xoopsTpl']->append('articles_list', $article); - unset($article); - } - // Display Navigation - if($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE_THEREARENT_ARTICLES); - } - - break; - case 'new': - $templateMain = 'mymodule_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE_ARTICLES_LIST, 'articles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $articlesObj = $articlesHandler->create(); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if(!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if(isset($artId)) { - $articlesObj = $articlesHandler->get($artId); - } else { - $articlesObj = $articlesHandler->create(); - } - // Set Vars - $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0)); - $articlesObj->setVar('art_title', Request::getString('art_title', '')); - $articlesObj->setVar('art_descr', Request::getString('art_descr', '')); - // Set Var art_img - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_IMAGE_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['attachedfile']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_img', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_img', Request::getString('art_img')); - } - $articlesObj->setVar('art_online', Request::getInt('art_online', 0)); - // Set Var art_file - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_FILES_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['art_file']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_file', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_file', Request::getString('art_file')); - } - $articleCreated = date_create_from_format(_SHORTDATESTRING, $_POST['art_created']); - $articlesObj->setVar('art_created', $articleCreated->getTimestamp()); - $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0)); - // Insert Data - if($articlesHandler->insert($articlesObj)) { - redirect_header('articles.php?op=list', 2, _AM_MYMODULE_FORM_OK); - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'edit': - $templateMain = 'mymodule_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE_ADD_ARTICLE, 'articles.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE_ARTICLES_LIST, 'articles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $articlesObj = $articlesHandler->get($artId); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'delete': - $articlesObj = $articlesHandler->get($artId); - if(isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if(!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if($articlesHandler->delete($articlesObj)) { - redirect_header('articles.php', 3, _AM_MYMODULE_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'art_id' => $artId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE_FORM_SURE_DELETE, $articlesObj->getVar('art_title'))); - } - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/admin/categories.php b/testdata/mymodule/admin/categories.php deleted file mode 100644 index 57135cc0..00000000 --- a/testdata/mymodule/admin/categories.php +++ /dev/null @@ -1,171 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request cat_id -$catId = Request::getInt('cat_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE_ADD_CATEGORY, 'categories.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $categoriesCount = $categoriesHandler->getCountCategories(); - $categoriesAll = $categoriesHandler->getAllCategories($start, $limit); - $GLOBALS['xoopsTpl']->assign('categories_count', $categoriesCount); - $GLOBALS['xoopsTpl']->assign('mymodule_url', MYMODULE_URL); - $GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); - // Table view categories - if($categoriesCount > 0) { - foreach(array_keys($categoriesAll) as $i) { - $category = $categoriesAll[$i]->getValuesCategories(); - $GLOBALS['xoopsTpl']->append('categories_list', $category); - unset($category); - } - // Display Navigation - if($categoriesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE_THEREARENT_CATEGORIES); - } - - break; - case 'new': - $templateMain = 'mymodule_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE_CATEGORIES_LIST, 'categories.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $categoriesObj = $categoriesHandler->create(); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if(!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('categories.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if(isset($catId)) { - $categoriesObj = $categoriesHandler->get($catId); - } else { - $categoriesObj = $categoriesHandler->create(); - } - // Set Vars - $categoriesObj->setVar('cat_name', Request::getString('cat_name', '')); - // Set Var cat_logo - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_IMAGE_PATH . '/categories/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['attachedfile']['name']); - $imgName = str_replace(' ', '', Request::getString('cat_name')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $categoriesObj->setVar('cat_logo', $uploader->getSavedFileName()); - } - } else { - $categoriesObj->setVar('cat_logo', Request::getString('cat_logo')); - } - $categoryCreated = date_create_from_format(_SHORTDATESTRING, $_POST['cat_created']); - $categoriesObj->setVar('cat_created', $categoryCreated->getTimestamp()); - $categoriesObj->setVar('cat_submitter', Request::getInt('cat_submitter', 0)); - // Insert Data - if($categoriesHandler->insert($categoriesObj)) { - $newCatId = $categoriesObj->getNewInsertedIdCategories(); - $permId = isset($_REQUEST['cat_id']) ? $catId : $newCatId; - $gpermHandler = xoops_getHandler('groupperm'); - // Permission to view - if(isset($_POST['groups_view'])) { - foreach($_POST['groups_view'] as $onegroupId) { - $gpermHandler->addRight('mymodule_view', $permId, $onegroupId, $GLOBALS['xoopsModule']->getVar('mid')); - } - } - // Permission to submit - if(isset($_POST['groups_submit'])) { - foreach($_POST['groups_submit'] as $onegroupId) { - $gpermHandler->addRight('mymodule_submit', $permId, $onegroupId, $GLOBALS['xoopsModule']->getVar('mid')); - } - } - // Permission to approve - if(isset($_POST['groups_approve'])) { - foreach($_POST['groups_approve'] as $onegroupId) { - $gpermHandler->addRight('mymodule_approve', $permId, $onegroupId, $GLOBALS['xoopsModule']->getVar('mid')); - } - } - redirect_header('categories.php?op=list', 2, _AM_MYMODULE_FORM_OK); - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors()); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'edit': - $templateMain = 'mymodule_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE_ADD_CATEGORY, 'categories.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE_CATEGORIES_LIST, 'categories.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $categoriesObj = $categoriesHandler->get($catId); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'delete': - $categoriesObj = $categoriesHandler->get($catId); - if(isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if(!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('categories.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if($categoriesHandler->delete($categoriesObj)) { - redirect_header('categories.php', 3, _AM_MYMODULE_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'cat_id' => $catId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE_FORM_SURE_DELETE, $categoriesObj->getVar('cat_name'))); - } - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/admin/feedback.php b/testdata/mymodule/admin/feedback.php deleted file mode 100644 index 0567503c..00000000 --- a/testdata/mymodule/admin/feedback.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ - -use Xmf\Request; - -include __DIR__ . '/header.php'; - -$adminObject = \Xmf\Module\Admin::getInstance(); - -$feedback = new \XoopsModules\Mymodule\Common\ModuleFeedback(); - -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -$moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname'); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -xoops_loadLanguage('feedback', $moduleDirName); - -//xoops_cp_header(); - -switch ($op) { - case 'list': - default: - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); - $feedback->name = $GLOBALS['xoopsUser']->getVar('name'); - $feedback->email = $GLOBALS['xoopsUser']->getVar('email'); - $feedback->site = XOOPS_URL; - $form = $feedback->getFormFeedback(); - $form->display(); - break; - case 'send': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - - $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', ''); - $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'); - $body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
      '; - $body .= $fb_content; - $xoopsMailer = xoops_getMailer(); - $xoopsMailer->useMail(); - $xoopsMailer->setToEmails($GLOBALS['xoopsModule']->getInfo('author_mail')); - $xoopsMailer->setFromEmail($your_mail); - $xoopsMailer->setFromName($your_name); - $xoopsMailer->setSubject($title); - $xoopsMailer->multimailer->isHTML(true); - $xoopsMailer->setBody($body); - $ret = $xoopsMailer->send(); - if ($ret) { - redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); - } - - // show form with content again - $feedback->name = $your_name; - $feedback->email = $your_mail; - $feedback->site = $your_site; - $feedback->type = $fb_type; - $feedback->content = $fb_content; - echo '
      -

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

      -
      '; - $form = $feedback->getFormFeedback(); - $form->display(); - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/admin/footer.php b/testdata/mymodule/admin/footer.php deleted file mode 100644 index 0737385d..00000000 --- a/testdata/mymodule/admin/footer.php +++ /dev/null @@ -1,27 +0,0 @@ - - Website: - */ -if(isset($templateMain)) { - $GLOBALS['xoopsTpl']->assign('maintainedby', $helper->getConfig('maintainedby')); - $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); -} - -xoops_cp_footer(); diff --git a/testdata/mymodule/admin/header.php b/testdata/mymodule/admin/header.php deleted file mode 100644 index 17172c47..00000000 --- a/testdata/mymodule/admin/header.php +++ /dev/null @@ -1,60 +0,0 @@ - - Website: - */ -include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; -include_once dirname(__DIR__) . '/include/common.php'; - -$sysPathIcon16 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons16'); -$sysPathIcon32 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -$modPathIcon16 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -$modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons32'); - -// Get instance of module -$helper = \XoopsModules\Mymodule\Helper::getInstance(); -$categoriesHandler = $helper->getHandler('categories'); -$articlesHandler = $helper->getHandler('articles'); -$myts = MyTextSanitizer::getInstance(); -// -if(!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once XOOPS_ROOT_PATH . '/class/template.php'; - $xoopsTpl = new \XoopsTpl(); -} -// System icons path -$GLOBALS['xoopsTpl']->assign('sysPathIcon16', $sysPathIcon16); -$GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); -$GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); -$GLOBALS['xoopsTpl']->assign('modPathIcon32', $modPathIcon32); - -// Load languages -xoops_loadLanguage('admin'); -xoops_loadLanguage('modinfo'); - -// Local admin menu class -if(file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) { - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); -} else { - redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); -} - -xoops_cp_header(); -$adminObject = \Xmf\Module\Admin::getInstance(); -$style = MYMODULE_URL . '/assets/css/admin/style.css'; diff --git a/testdata/mymodule/admin/index.html b/testdata/mymodule/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/admin/index.php b/testdata/mymodule/admin/index.php deleted file mode 100644 index 8f1f5f1c..00000000 --- a/testdata/mymodule/admin/index.php +++ /dev/null @@ -1,68 +0,0 @@ - - Website: - */ - - -use XoopsModules\Mymodule\Common; - -include_once dirname(__DIR__) . '/preloads/autoloader.php'; -require __DIR__ . '/header.php'; - -// Template Index -$templateMain = 'mymodule_admin_index.tpl'; - -// Count elements -$countCategories = $categoriesHandler->getCount(); -$countArticles = $articlesHandler->getCount(); - -// InfoBox Statistics -$adminObject->addInfoBox(_AM_MYMODULE_STATISTICS); -// Info elements -$adminObject->addInfoBoxLine(sprintf( '', $countCategories)); -$adminObject->addInfoBoxLine(sprintf( '', $countArticles)); - -// Upload Folders -$configurator = new Common\Configurator(); -if($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - foreach(array_keys($configurator->uploadFolders) as $i) { - $folder[] = $configurator->uploadFolders[$i]; - } -} -// Uploads Folders Created -foreach(array_keys($folder) as $i) { - $adminObject->addConfigBoxLine($folder[$i], 'folder'); - $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); -} - -// Render Index -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('index.php')); -// Test Data -if($helper->getConfig('displaySampleButton')) { - xoops_loadLanguage('admin/modulesadmin', 'system'); - include_once dirname(__DIR__) . '/testdata/index.php'; - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_ADD_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->displayButton('left'); -} -$GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex()); -// End Test Data -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/admin/menu.php b/testdata/mymodule/admin/menu.php deleted file mode 100644 index 9610f6cf..00000000 --- a/testdata/mymodule/admin/menu.php +++ /dev/null @@ -1,58 +0,0 @@ - - Website: - */ - -$dirname = basename(dirname(__DIR__)); -$moduleHandler = xoops_getHandler('module'); -$xoopsModule = XoopsModule::getByDirname($dirname); -$moduleInfo = $moduleHandler->get($xoopsModule->getVar('mid')); -$sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); - -$adminmenu[] = [ - 'title' => _MI_MYMODULE_ADMENU1, - 'link' => 'admin/index.php', - 'icon' => $sysPathIcon32.'/dashboard.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE_ADMENU2, - 'link' => 'admin/categories.php', - 'icon' => 'assets/icons/32/category.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE_ADMENU3, - 'link' => 'admin/articles.php', - 'icon' => 'assets/icons/32/penguin.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE_ADMENU4, - 'link' => 'admin/permissions.php', - 'icon' => $sysPathIcon32.'/permissions.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE_ADMENU5, - 'link' => 'admin/feedback.php', - 'icon' => $sysPathIcon32.'/mail_foward.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE_ABOUT, - 'link' => 'admin/about.php', - 'icon' => $sysPathIcon32.'/about.png', -]; diff --git a/testdata/mymodule/admin/permissions.php b/testdata/mymodule/admin/permissions.php deleted file mode 100644 index 622b1423..00000000 --- a/testdata/mymodule/admin/permissions.php +++ /dev/null @@ -1,95 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; - -// Template Index -$templateMain = 'mymodule_admin_permissions.tpl'; -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('permissions.php')); - -$op = Request::getString('op', 'global'); - -// Get handler -$categoriesHandler = $helper->getHandler('categories'); - -// Get Form -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -xoops_load('XoopsFormLoader'); -$permTableForm = new \XoopsSimpleForm('', 'fselperm', 'permissions.php', 'post'); -$formSelect = new \XoopsFormSelect('', 'op', $op); -$formSelect->setExtra('onchange="document.fselperm.submit()"'); -$formSelect->addOption('global', _AM_MYMODULE_PERMISSIONS_GLOBAL); -$formSelect->addOption('approve', _AM_MYMODULE_PERMISSIONS_APPROVE); -$formSelect->addOption('submit', _AM_MYMODULE_PERMISSIONS_SUBMIT); -$formSelect->addOption('view', _AM_MYMODULE_PERMISSIONS_VIEW); -$permTableForm->addElement($formSelect); -$permTableForm->display(); -switch($op) { - case 'global': - default: - $formTitle = _AM_MYMODULE_PERMISSIONS_GLOBAL; - $permName = 'mymodule_ac'; - $permDesc = _AM_MYMODULE_PERMISSIONS_GLOBAL_DESC; - $globalPerms = array( '4' => _AM_MYMODULE_PERMISSIONS_GLOBAL_4, '8' => _AM_MYMODULE_PERMISSIONS_GLOBAL_8, '16' => _AM_MYMODULE_PERMISSIONS_GLOBAL_16 ); - break; - case 'approve': - $formTitle = _AM_MYMODULE_PERMISSIONS_APPROVE; - $permName = 'mymodule_approve'; - $permDesc = _AM_MYMODULE_PERMISSIONS_APPROVE_DESC; - break; - case 'submit': - $formTitle = _AM_MYMODULE_PERMISSIONS_SUBMIT; - $permName = 'mymodule_submit'; - $permDesc = _AM_MYMODULE_PERMISSIONS_SUBMIT_DESC; - break; - case 'view': - $formTitle = _AM_MYMODULE_PERMISSIONS_VIEW; - $permName = 'mymodule_view'; - $permDesc = _AM_MYMODULE_PERMISSIONS_VIEW_DESC; - break; -} -$moduleId = $xoopsModule->getVar('mid'); -$permform = new \XoopsGroupPermForm($formTitle, $moduleId, $permName, $permDesc, 'admin/permissions.php'); -if($op === 'global') { - foreach($globalPerms as $gPermId => $gPermName) { - $permform->addItem($gPermId, $gPermName); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); -} else { - $categoriesCount = $categoriesHandler->getCountCategories(); - if($categoriesCount > 0) { - $categoriesAll = $categoriesHandler->getAllCategories(0, 'cat_name'); - foreach(array_keys($categoriesAll) as $i) { - $permform->addItem($categoriesAll[$i]->getVar('cat_id'), $categoriesAll[$i]->getVar('cat_name')); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - } else { - redirect_header('categories.php?op=new', 3, _AM_MYMODULE_NO_PERMISSIONS_SET); - exit(); - } -} -unset($permform); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/articles.php b/testdata/mymodule/articles.php deleted file mode 100644 index 786cafba..00000000 --- a/testdata/mymodule/articles.php +++ /dev/null @@ -1,75 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_articles.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; - -$start = Request::getInt('start', 0); -$limit = Request::getInt('limit', $helper->getConfig('userpager')); - -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule_url', MYMODULE_URL); - -$articlesCount = $articlesHandler->getCountArticles(); -$GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); -$articlesAll = $articlesHandler->getAllArticles($start, $limit); -$keywords = []; -if($articlesCount > 0) { - $articles = []; - // Get All Articles - foreach(array_keys($articlesAll) as $i) { - $articles[] = $articlesAll[$i]->getValuesArticles(); - $keywords[] = $articlesAll[$i]->getVar('art_title'); - } - $GLOBALS['xoopsTpl']->assign('articles', $articles); - unset($articles); - // Display Navigation - if($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} - -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE_ARTICLES]; - -// Keywords -mymoduleMetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); - -// Description -mymoduleMetaDescription(_MA_MYMODULE_ARTICLES_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE_URL.'/articles.php'); -$GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/assets/css/admin/index.html b/testdata/mymodule/assets/css/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/css/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/css/admin/style.css b/testdata/mymodule/assets/css/admin/style.css deleted file mode 100644 index 24c87667..00000000 --- a/testdata/mymodule/assets/css/admin/style.css +++ /dev/null @@ -1,24 +0,0 @@ -@charset "UTF-8"; -/* - 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. -*/ - -/** - * My Module module for xoops - * - * @copyright 2020 XOOPS Project (https://xooops.org) - * @license GPL 2.0 or later - * @package mymodule - * @since 1.0 - * @min_xoops 2.5.9 - * @author TDM XOOPS - Email: - Website: - */ -img { - max-width: 200px; -} \ No newline at end of file diff --git a/testdata/mymodule/assets/css/index.html b/testdata/mymodule/assets/css/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/css/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/css/style.css b/testdata/mymodule/assets/css/style.css deleted file mode 100644 index 5b391b3c..00000000 --- a/testdata/mymodule/assets/css/style.css +++ /dev/null @@ -1,42 +0,0 @@ -@charset "UTF-8"; -/* - 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. -*/ - -/** - * My Module module for xoops - * - * @copyright 2020 XOOPS Project (https://xooops.org) - * @license GPL 2.0 or later - * @package mymodule - * @since 1.0 - * @min_xoops 2.5.9 - * @author TDM XOOPS - Email: - Website: - */ -ul.menu { - list-style: none; - background-color: #f5f5f5; - border-radius: 4px; -} - -ul.menu > li { - display: inline-block; -} - -ul.menu > li + li:before { - content: "|\a0"; -} - -.printOnly { - display: none; -} - -img { - max-width: 300px; -} \ No newline at end of file diff --git a/testdata/mymodule/assets/icons/16/index.html b/testdata/mymodule/assets/icons/16/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/icons/16/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/icons/32/category.png b/testdata/mymodule/assets/icons/32/category.png deleted file mode 100644 index 42852b53..00000000 Binary files a/testdata/mymodule/assets/icons/32/category.png and /dev/null differ diff --git a/testdata/mymodule/assets/icons/32/index.html b/testdata/mymodule/assets/icons/32/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/icons/32/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/icons/32/penguin.png b/testdata/mymodule/assets/icons/32/penguin.png deleted file mode 100644 index 28f86e3a..00000000 Binary files a/testdata/mymodule/assets/icons/32/penguin.png and /dev/null differ diff --git a/testdata/mymodule/assets/icons/index.html b/testdata/mymodule/assets/icons/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/icons/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/images/blank.png b/testdata/mymodule/assets/images/blank.png deleted file mode 100644 index e1ee728a..00000000 Binary files a/testdata/mymodule/assets/images/blank.png and /dev/null differ diff --git a/testdata/mymodule/assets/images/index.html b/testdata/mymodule/assets/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/images/logoModule.png b/testdata/mymodule/assets/images/logoModule.png deleted file mode 100644 index 2df3e5ab..00000000 Binary files a/testdata/mymodule/assets/images/logoModule.png and /dev/null differ diff --git a/testdata/mymodule/assets/index.html b/testdata/mymodule/assets/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/assets/js/functions.js b/testdata/mymodule/assets/js/functions.js deleted file mode 100644 index dce2bb75..00000000 --- a/testdata/mymodule/assets/js/functions.js +++ /dev/null @@ -1,71 +0,0 @@ -$(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(); -}); - -// \ No newline at end of file diff --git a/testdata/mymodule/assets/js/index.html b/testdata/mymodule/assets/js/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/assets/js/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/blocks/articles.php b/testdata/mymodule/blocks/articles.php deleted file mode 100644 index 6ec4f98c..00000000 --- a/testdata/mymodule/blocks/articles.php +++ /dev/null @@ -1,122 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Helper; -use XoopsModules\Mymodule\Constants; - -include_once XOOPS_ROOT_PATH.'/modules/mymodule/include/common.php'; -// Function show block -function b_mymodule_articles_show($options) -{ - include_once XOOPS_ROOT_PATH.'/modules/mymodule/class/articles.php'; - $myts = MyTextSanitizer::getInstance(); - $GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); - $block = array(); - $typeBlock = $options[0]; - $limit = $options[1]; - $lenghtTitle = $options[2]; - $helper = Helper::getInstance(); - $articlesHandler = $helper->getHandler('articles'); - $criteria = new \CriteriaCompo(); - array_shift($options); - array_shift($options); - array_shift($options); - switch($typeBlock) - { - // For the block: articles last - case 'last': - //$criteria->add(new \Criteria('art_display', 1)); - $criteria->setSort('art_created'); - $criteria->setOrder('DESC'); - break; - // For the block: articles new - case 'new': - //$criteria->add(new \Criteria('art_display', 1)); - $criteria->add(new \Criteria('art_created', strtotime(date(_SHORTDATESTRING)), '>=')); - $criteria->add(new \Criteria('art_created', strtotime(date(_SHORTDATESTRING))+86400, '<=')); - $criteria->setSort('art_created'); - $criteria->setOrder('ASC'); - break; - // For the block: articles hits - case 'hits': - $criteria->setSort('art_hits'); - $criteria->setOrder('DESC'); - break; - // For the block: articles top - case 'top': - $criteria->setSort('art_top'); - $criteria->setOrder('ASC'); - break; - // For the block: articles random - case 'random': - //$criteria->add(new \Criteria('art_display', 1)); - $criteria->setSort('RAND()'); - break; - } - $criteria->setLimit($limit); - $articlesAll = $articlesHandler->getAll($criteria); - unset($criteria); - if (count($articlesAll) > 0) { - foreach(array_keys($articlesAll) as $i) - { - $block[$i]['cat'] = $articlesAll[$i]->getVar('art_cat'); - $block[$i]['title'] = $myts->htmlSpecialChars($articlesAll[$i]->getVar('art_title')); - $block[$i]['descr'] = strip_tags($articlesAll[$i]->getVar('art_descr')); - $block[$i]['img'] = $articlesAll[$i]->getVar('art_img'); - $block[$i]['file'] = $articlesAll[$i]->getVar('art_file'); - $block[$i]['created'] = formatTimeStamp($articlesAll[$i]->getVar('art_created')); - $block[$i]['submitter'] = \XoopsUser::getUnameFromId($articlesAll[$i]->getVar('art_submitter')); - } - } - return $block; -} - -// Function edit block -function b_mymodule_articles_edit($options) -{ - include_once XOOPS_ROOT_PATH.'/modules/mymodule/class/articles.php'; - $helper = Helper::getInstance(); - $articlesHandler = $helper->getHandler('articles'); - $GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); - $form = _MB_MYMODULE_DISPLAY; - $form .= ""; - $form .= " 
      "; - $form .= _MB_MYMODULE_TITLE_LENGTH." :

      "; - array_shift($options); - array_shift($options); - array_shift($options); - $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('art_id', 0, '!=')); - $criteria->setSort('art_id'); - $criteria->setOrder('ASC'); - $articlesAll = $articlesHandler->getAll($criteria); - unset($criteria); - $form .= _MB_MYMODULE_ARTICLES_TO_DISPLAY."
      '; - return $form; -} \ No newline at end of file diff --git a/testdata/mymodule/blocks/index.html b/testdata/mymodule/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/broken.php b/testdata/mymodule/broken.php deleted file mode 100644 index 0e3e26f0..00000000 --- a/testdata/mymodule/broken.php +++ /dev/null @@ -1,132 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$op = Request::getString('op', 'list'); -$artId = Request::getInt('art_id'); -// Template -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_broken.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -// Redirection if not permissions -if($permSubmit === false) { - redirect_header('index.php', 2, _NOPERM); - exit(); -} -switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE_SUBMIT_PROPOSER; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE_SUBMIT_PROPOSER . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE_SUBMIT_PROPOSER)); - // Form Create - $articlesObj = $articlesHandler->create(); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if($GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $articlesObj = $articlesHandler->create(); - $error = false; - $errorMessage = ''; - // Test first the validation - xoops_load('captcha'); - $xoopsCaptcha = \XoopsCaptcha::getInstance(); - if(!$xoopsCaptcha->verify()) { - $errorMessage .= $xoopsCaptcha->getMessage().'
      '; - $error = true; - } - $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0)); - $articlesObj->setVar('art_title', Request::getString('art_title', '')); - $articlesObj->setVar('art_descr', Request::getString('art_descr', '')); - // Set Var art_img - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_IMAGE_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['attachedfile']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_img', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_img', Request::getString('art_img')); - } - $articlesObj->setVar('art_online', Request::getInt('art_online', 0)); - // Set Var art_file - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_FILES_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['art_file']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_file', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_file', Request::getString('art_file')); - } - $articleCreated = date_create_from_format(_SHORTDATESTRING, $_POST['art_created']); - $articlesObj->setVar('art_created', $articleCreated->getTimestamp()); - $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0)); - if($error === true) { - $GLOBALS['xoopsTpl']->assign('error_message', $errorMessage); - } else { - // Insert Data - if($articles1->insert($articlesObj)) { - redirect_header('index.php', 2, _MA_MYMODULE_FORM_OK); - } - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/class/Articles.php b/testdata/mymodule/class/Articles.php deleted file mode 100644 index 7eb22a19..00000000 --- a/testdata/mymodule/class/Articles.php +++ /dev/null @@ -1,215 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Articles - */ -class Articles extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('art_id', XOBJ_DTYPE_INT); - $this->initVar('art_cat', XOBJ_DTYPE_INT); - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_descr', XOBJ_DTYPE_TXTAREA); - $this->initVar('art_img', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_online', XOBJ_DTYPE_INT); - $this->initVar('art_file', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_created', XOBJ_DTYPE_INT); - $this->initVar('art_submitter', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if(!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdArticles() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return XoopsThemeForm - */ - public function getFormArticles($action = false) - { - $helper = \XoopsModules\Mymodule\Helper::getInstance(); - if(false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Permissions for uploader - $gpermHandler = xoops_getHandler('groupperm'); - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; - if($GLOBALS['xoopsUser']) { - if(!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { - $permissionUpload = $gpermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } else { - $permissionUpload = true; - } - } else { - $permissionUpload = $gpermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE_ARTICLE_ADD) : sprintf(_AM_MYMODULE_ARTICLE_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Use tag module - $dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false; - if(($helper->getConfig('usetag') == 1) && $dirTag) { - $tagId = $this->isNew() ? 0 : $this->getVar('art_id'); - include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; - $form->addElement(new \XoopsFormTag( 'tag', 60, 255, $tagId, 0 ), true); - } - // Form Table categories - $categoriesHandler = $helper->getHandler('categories'); - $artCatSelect = new \XoopsFormSelect( _AM_MYMODULE_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); - $artCatSelect->addOptionArray($categoriesHandler->getList()); - $form->addElement($artCatSelect, true); - // Form Text ArtTitle - $form->addElement(new \XoopsFormText( _AM_MYMODULE_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title') ), true); - // Form editor ArtDescr - $editorConfigs = []; - $editorConfigs['name'] = 'art_descr'; - $editorConfigs['value'] = $this->getVar('art_descr', 'e'); - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $editorConfigs['editor'] = $helper->getConfig('editor_descr'); - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); - // Form Image ArtImg - // Form Image ArtImg: Select Uploaded Image - $getArtImg = $this->getVar('art_img'); - $artImg = $getArtImg ? $getArtImg : 'blank.gif'; - $imageDirectory = '/uploads/mymodule/images/articles'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE_FORM_UPLOAD, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE_FORM_IMAGE_PATH, ".{$imageDirectory}/"), 'art_img', $artImg, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"image1\", \"art_img\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form Image ArtImg: Upload Image - if($permissionUpload) { - $imageTray->addElement(new \XoopsFormFile( _AM_MYMODULE_FORM_UPLOAD_NEW, 'attachedfile', $helper->getConfig('maxsize') )); - } else { - $imageTray->addElement(new \XoopsFormHidden( 'art_img', $artImg )); - } - $form->addElement($imageTray); - // Form Radio Yes/No ArtOnline - $artOnline = $this->isNew() ? 0 : $this->getVar('art_online'); - $form->addElement(new \XoopsFormRadioYN( _AM_MYMODULE_ARTICLE_ONLINE, 'art_online', $artOnline), true); - // Form File ArtFile - $artFile = $this->isNew() ? '' : $this->getVar('art_file'); - if($permissionUpload) { - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE_FORM_UPLOAD, '
      ' ); - if(!$this->isNew()) { - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE_FORM_UPLOAD_FILE_ARTICLES, $artFile)); - } - $fileUploadTray->addElement(new \XoopsFormFile( '', 'art_file', $helper->getConfig('maxsize') )); - $form->addElement($fileUploadTray); - } else { - $form->addElement(new \XoopsFormHidden( 'art_file', $artFile )); - } - // Form Text Date Select ArtCreated - $artCreated = $this->isNew() ? 0 : $this->getVar('art_created'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE_ARTICLE_CREATED, 'art_created', '', $artCreated )); - // Form Select User ArtSubmitter - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter') )); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesArticles($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('art_id'); - $categories = $helper->getHandler('categories'); - $categoriesObj = $categories->get($this->getVar('art_cat')); - $ret['cat'] = $categoriesObj->getVar('cat_name'); - $ret['title'] = $this->getVar('art_title'); - $ret['descr'] = strip_tags($this->getVar('art_descr')); - $ret['img'] = $this->getVar('art_img'); - $ret['online'] = $this->getVar('art_online'); - $ret['file'] = $this->getVar('art_file'); - $ret['created'] = formatTimeStamp($this->getVar('art_created'), 's'); - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('art_submitter')); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayArticles() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule/class/Articleshandler.php b/testdata/mymodule/class/Articleshandler.php deleted file mode 100644 index 8271f875..00000000 --- a/testdata/mymodule/class/Articleshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule; - - -/** - * Class Object Handler Articles - */ -class ArticlesHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null|XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule_articles', Articles::class, 'art_id', 'art_title'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Articles in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountArticles($start = 0, $limit = 0, $sort = 'art_id ASC, art_title', $order = 'ASC') - { - $crCountArticles = new \CriteriaCompo(); - $crCountArticles = $this->getArticlesCriteria($crCountArticles, $start, $limit, $sort, $order); - return parent::getCount($crCountArticles); - } - - /** - * Get All Articles in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllArticles($start = 0, $limit = 0, $sort = 'art_id ASC, art_title', $order = 'ASC') - { - $crAllArticles = new \CriteriaCompo(); - $crAllArticles = $this->getArticlesCriteria($crAllArticles, $start, $limit, $sort, $order); - return parent::getAll($crAllArticles); - } - - /** - * Get Criteria Articles - * @param $crArticles - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getArticlesCriteria($crArticles, $start, $limit, $sort, $order) - { - $crArticles->setStart( $start ); - $crArticles->setLimit( $limit ); - $crArticles->setSort( $sort ); - $crArticles->setOrder( $order ); - return $crArticles; - } -} diff --git a/testdata/mymodule/class/Categories.php b/testdata/mymodule/class/Categories.php deleted file mode 100644 index 6e6d5f57..00000000 --- a/testdata/mymodule/class/Categories.php +++ /dev/null @@ -1,162 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Categories - */ -class Categories extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('cat_id', XOBJ_DTYPE_INT); - $this->initVar('cat_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_logo', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_created', XOBJ_DTYPE_INT); - $this->initVar('cat_submitter', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if(!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdCategories() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return XoopsThemeForm - */ - public function getFormCategories($action = false) - { - $helper = \XoopsModules\Mymodule\Helper::getInstance(); - if(false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE_CATEGORY_ADD) : sprintf(_AM_MYMODULE_CATEGORY_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Form Text CatName - $form->addElement(new \XoopsFormText( _AM_MYMODULE_CATEGORY_NAME, 'cat_name', 50, 255, $this->getVar('cat_name') ), true); - // Form Text Date Select CatCreated - $catCreated = $this->isNew() ? 0 : $this->getVar('cat_created'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE_CATEGORY_CREATED, 'cat_created', '', $catCreated ), true); - // Permissions - $memberHandler = xoops_getHandler('member'); - $groupList = $memberHandler->getGroupList(); - $gpermHandler = xoops_getHandler('groupperm'); - $fullList[] = array_keys($groupList); - if(!$this->isNew()) { - $groupsIdsApprove = $gpermHandler->getGroupIds('mymodule_approve', $this->getVar('cat_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsApprove[] = array_values($groupsIdsApprove); - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE_PERMISSIONS_APPROVE, 'groups_approve[]', $groupsIdsApprove); - $groupsIdsSubmit = $gpermHandler->getGroupIds('mymodule_submit', $this->getVar('cat_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsSubmit[] = array_values($groupsIdsSubmit); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE_PERMISSIONS_SUBMIT, 'groups_submit[]', $groupsIdsSubmit); - $groupsIdsView = $gpermHandler->getGroupIds('mymodule_view', $this->getVar('cat_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsView[] = array_values($groupsIdsView); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE_PERMISSIONS_VIEW, 'groups_view[]', $groupsIdsView); - } else { - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE_PERMISSIONS_APPROVE, 'groups_approve[]', $fullList); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE_PERMISSIONS_SUBMIT, 'groups_submit[]', $fullList); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE_PERMISSIONS_VIEW, 'groups_view[]', $fullList); - } - // To Approve - $groupsCanApproveCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanApproveCheckbox); - // To Submit - $groupsCanSubmitCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanSubmitCheckbox); - // To View - $groupsCanViewCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanViewCheckbox); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesCategories($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('cat_id'); - $ret['name'] = $this->getVar('cat_name'); - $ret['logo'] = $this->getVar('cat_logo'); - $ret['created'] = formatTimeStamp($this->getVar('cat_created'), 's'); - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('cat_submitter')); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayCategories() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule/class/Categorieshandler.php b/testdata/mymodule/class/Categorieshandler.php deleted file mode 100644 index f1fbbebe..00000000 --- a/testdata/mymodule/class/Categorieshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule; - - -/** - * Class Object Handler Categories - */ -class CategoriesHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null|XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule_categories', Categories::class, 'cat_id', 'cat_name'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Categories in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') - { - $crCountCategories = new \CriteriaCompo(); - $crCountCategories = $this->getCategoriesCriteria($crCountCategories, $start, $limit, $sort, $order); - return parent::getCount($crCountCategories); - } - - /** - * Get All Categories in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') - { - $crAllCategories = new \CriteriaCompo(); - $crAllCategories = $this->getCategoriesCriteria($crAllCategories, $start, $limit, $sort, $order); - return parent::getAll($crAllCategories); - } - - /** - * Get Criteria Categories - * @param $crCategories - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getCategoriesCriteria($crCategories, $start, $limit, $sort, $order) - { - $crCategories->setStart( $start ); - $crCategories->setLimit( $limit ); - $crCategories->setSort( $sort ); - $crCategories->setOrder( $order ); - return $crCategories; - } -} diff --git a/testdata/mymodule/class/Common/Breadcrumb.php b/testdata/mymodule/class/Common/Breadcrumb.php deleted file mode 100644 index 84c52b50..00000000 --- a/testdata/mymodule/class/Common/Breadcrumb.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @package Mymodule - * - * Example: - * $breadcrumb = new Common\Breadcrumb(); - * $breadcrumb->addLink( 'bread 1', 'index1.php' ); - * $breadcrumb->addLink( 'bread 2', '' ); - * $breadcrumb->addLink( 'bread 3', 'index3.php' ); - * echo $breadcrumb->render(); - */ - -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Common; - -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); - -/** - * Class Breadcrumb - */ -class Breadcrumb -{ - public $dirname; - private $bread = []; - - public function __construct() - { - $this->dirname = basename(dirname(dirname(__DIR__))); - } - - /** - * Add link to breadcrumb - * - * @param string $title - * @param string $link - */ - public function addLink($title = '', $link = '') - { - $this->bread[] = [ - 'link' => $link, - 'title' => $title, - ]; - } - - /** - * Render BreadCrumb - */ - public function render() - { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { - require $GLOBALS['xoops']->path('class/theme.php'); - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); - } - - require $GLOBALS['xoops']->path('class/template.php'); - $breadcrumbTpl = new \XoopsTpl(); - $breadcrumbTpl->assign('breadcrumb', $this->bread); - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); - unset($breadcrumbTpl); - - return $html; - } -} diff --git a/testdata/mymodule/class/Common/ModuleFeedback.php b/testdata/mymodule/class/Common/ModuleFeedback.php deleted file mode 100644 index 75a103da..00000000 --- a/testdata/mymodule/class/Common/ModuleFeedback.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object ModuleFeedback - */ -class ModuleFeedback extends \XoopsObject -{ - public $name = ''; - public $email = ''; - public $site = ''; - public $type = ''; - public $content = ''; - - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * @public function getFormFeedback: - * provide form for sending a feedback to module author - * @param bool $action - * @return \XoopsThemeForm - */ - public function getFormFeedback($action = false) - { - if (false === $action) { - $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); - } - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $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')); - $recipient->setExtra('disabled="disabled"'); - $form->addElement($recipient); - $your_name = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); - $your_name->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); - $form->addElement($your_name); - $your_site = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); - $your_site->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); - $form->addElement($your_site); - $your_mail = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); - $your_mail->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); - $form->addElement($your_mail); - - $fbtypeSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); - $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')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); - $form->addElement($fbtypeSelect, true); - - $editorConfigs = []; - $editorConfigs['name'] = 'fb_content'; - $editorConfigs['value'] = $this->content; - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname('system'); - $configHandler = xoops_getHandler('config'); - $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); - - $form->addElement(new \XoopsFormHidden('op', 'send')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - - return $form; - } -} diff --git a/testdata/mymodule/class/Common/ModuleStats.php b/testdata/mymodule/class/Common/ModuleStats.php deleted file mode 100644 index ede73bc6..00000000 --- a/testdata/mymodule/class/Common/ModuleStats.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -trait ModuleStats -{ - /** - * @param \XoopsModules\Mymodule\Common\Configurator $configurator - * @param array $moduleStats - * @return array - */ - public static function getModuleStats($configurator, $moduleStats) - { - if (count($configurator->moduleStats) > 0) { - foreach (array_keys($configurator->moduleStats) as $i) { - $moduleStats[$i] = $configurator->moduleStats[$i]; - } - } - - return $moduleStats; - } -} diff --git a/testdata/mymodule/class/Common/Resizer.php b/testdata/mymodule/class/Common/Resizer.php deleted file mode 100644 index 6e58239f..00000000 --- a/testdata/mymodule/class/Common/Resizer.php +++ /dev/null @@ -1,239 +0,0 @@ - - Website: - */ -class Resizer -{ - public $sourceFile = ''; - public $endFile = ''; - public $maxWidth = 0; - public $maxHeight = 0; - public $imageMimetype = ''; - public $jpgQuality = 90; - public $mergeType = 0; - public $mergePos = 0; - - /** - * resize image if size exceed given width/height - * @return string|bool - */ - public function resizeImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $img = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $img = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $img = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - $width = imagesx($img); - $height = imagesy($img); - - if ($width > $this->maxWidth || $height > $this->maxHeight) { - // recalc image size based on this->maxWidth/this->maxHeight - if ($width > $height) { - if ($width < $this->maxWidth) { - $new_width = $width; - } else { - $new_width = $this->maxWidth; - $divisor = $width / $new_width; - $new_height = floor($height / $divisor); - } - } elseif ($height < $this->maxHeight) { - $new_height = $height; - } else { - $new_height = $this->maxHeight; - $divisor = $height / $new_height; - $new_width = floor($width / $divisor); - } - - // Create a new temporary image. - $tmpimg = imagecreatetruecolor($new_width, $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); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - imagepng($tmpimg, $this->endFile, 0); - break; - case 'image/jpeg': - imagejpeg($tmpimg, $this->endFile, 100); - break; - case 'image/gif': - imagegif($tmpimg, $this->endFile); - break; - } - - // release the memory - imagedestroy($tmpimg); - } else { - return 'copy'; - } - imagedestroy($img); - - return true; - } - - // public function resizeAndCrop($this->sourceFile, $this->imageMimetype, $this->endFile, $this->maxWidth, $this->maxHeight, $this->jpgQuality=90) - - /** - * @return bool|string - */ - public function resizeAndCrop() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // GET ORIGINAL IMAGE DIMENSIONS - list($original_w, $original_h) = getimagesize($this->sourceFile); - - // RESIZE IMAGE AND PRESERVE PROPORTIONS - $max_width_resize = $this->maxWidth; - $max_height_resize = $this->maxHeight; - if ($original_w > $original_h) { - $max_height_ratio = $this->maxHeight / $original_h; - $max_width_resize = (int)round($original_w * $max_height_ratio); - } else { - $max_width_ratio = $this->maxWidth / $original_w; - $max_height_resize = (int)round($original_h * $max_width_ratio); - } - if ($max_width_resize < $this->maxWidth) { - $max_height_ratio = $this->maxWidth / $max_width_resize; - $max_height_resize = (int)round($this->maxHeight * $max_height_ratio); - $max_width_resize = $this->maxWidth; - } - - // CREATE THE PROPORTIONAL IMAGE RESOURCE - $thumb = imagecreatetruecolor($max_width_resize, $max_height_resize); - if (!imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { - return false; - } - // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS - $final = imagecreatetruecolor($this->maxWidth, $this->maxHeight); - - $max_width_offset = 0; - $max_height_offset = 0; - if ($this->maxWidth < $max_width_resize) { - $max_width_offset = (int)round(($max_width_resize - $this->maxWidth) / 2); - } else { - $max_height_offset = (int)round(($max_height_resize - $this->maxHeight) / 2); - } - - if (!imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { - return false; - } - // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile - if (!imagejpeg($final, $this->endFile, $this->jpgQuality)) { - return false; - } - - return true; - } - - // public function mergeImage($this->sourceFile, $this->endFile, $this->mergePos, $this->mergeType) - public function mergeImage() - { - $dest = imagecreatefromjpeg($this->endFile); - $src = imagecreatefromjpeg($this->sourceFile); - if (4 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 2 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 2 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 3: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 4: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - if (6 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 3 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 3 + 1); - $posCol3 = $posCol2 + (int)round($this->maxWidth / 3 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center - break; - case 3: - imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 4: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 5: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center - break; - case 6: - imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - imagejpeg($dest, $this->endFile); - - imagedestroy($src); - imagedestroy($dest); - } -} diff --git a/testdata/mymodule/class/Common/ServerStats.php b/testdata/mymodule/class/Common/ServerStats.php deleted file mode 100644 index b983a62a..00000000 --- a/testdata/mymodule/class/Common/ServerStats.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -trait ServerStats -{ - /** - * serverStats() - * - * @return string - */ - public static function getServerStats() - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - $html = ''; - // $sql = 'SELECT metavalue'; - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); - // $sql .= " WHERE metakey='version' LIMIT 1"; - // $query = $GLOBALS['xoopsDB']->query($sql); - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= '
      '; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; - $html .= "
      "; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; - // $html .= "
      "; - // $html .= "
      "; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; - $html .= '
        '; - - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; - } - } - - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - - // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; - $html .= '
      '; - $html .= '
        '; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; - $html .= '
      '; - $html .= '
      '; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; - $html .= '
      '; - $html .= '

      '; - - return $html; - } -} diff --git a/testdata/mymodule/class/Common/index.html b/testdata/mymodule/class/Common/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/class/Constants.php b/testdata/mymodule/class/Constants.php deleted file mode 100644 index 082d585d..00000000 --- a/testdata/mymodule/class/Constants.php +++ /dev/null @@ -1,39 +0,0 @@ - - Website: - */ - -//defined('XOOPS_ROOT_PATH') || die('Restricted access'; - -/** - * class Constants - */ -class Constants -{ - /**#@+ - * Constant definition - */ - - // define here all your module wide constants - -} diff --git a/testdata/mymodule/class/Helper.php b/testdata/mymodule/class/Helper.php deleted file mode 100644 index 6874a52d..00000000 --- a/testdata/mymodule/class/Helper.php +++ /dev/null @@ -1,88 +0,0 @@ -debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); - parent::__construct($moduleDirName); - } - - /** - * @param bool $debug - * - * @return \XoopsModules\Mymodule\Helper - */ - public static function getInstance($debug = false) - { - static $instance; - if (null === $instance) { - $instance = new static($debug); - } - - return $instance; - } - - /** - * @return string - */ - public function getDirname() - { - return $this->dirname; - } - - /** - * Get an Object Handler - * - * @param string $name name of handler to load - * - * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler - */ - public function getHandler($name) - { - $ret = false; - - $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; - if (!class_exists($class)) { - throw new \RuntimeException("Class '$class' not found"); - } - /** @var \XoopsMySQLDatabase $db */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - $helper = self::getInstance(); - $ret = new $class($db, $helper); - $this->addLog("Getting handler '{$name}'"); - - return $ret; - } -} -//require __DIR__ . '/../../mainfile.php'; diff --git a/testdata/mymodule/class/Utility.php b/testdata/mymodule/class/Utility.php deleted file mode 100644 index 20f4ef3d..00000000 --- a/testdata/mymodule/class/Utility.php +++ /dev/null @@ -1,253 +0,0 @@ - - * @author Mamba - * @since - */ - -use XoopsModules\Mymodule; - -/** - * Class Utility - */ -class Utility -{ - use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits - - use Common\ServerStats; // getServerStats Trait - - use Common\FilesManagement; // Files Management Trait - - /** - * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags - * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags - * www.cakephp.org - * - * @param string $text String to truncate. - * @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 - * - * @return string Trimmed string. - */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) - { - if ($considerHtml) { - // if the plain text is shorter than the maximum length, return the whole text - 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); - $open_tags = []; - $truncate = ''; - foreach ($lines as $line_matchings) { - // if there is any html-tag in this line, handle it and add it (uncounted) to the output - if (!empty($line_matchings[1])) { - // if it's an "empty element" with or without xhtml-conform closing slash - if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { - // do nothing - // if tag is a closing tag - } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { - // delete tag from $open_tags list - $pos = array_search($tag_matchings[1], $open_tags, true); - if (false !== $pos) { - unset($open_tags[$pos]); - } - // if tag is an opening tag - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { - // add tag to the beginning of $open_tags list - array_unshift($open_tags, mb_strtolower($tag_matchings[1])); - } - // add html-tag to $truncate'd text - $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])); - 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)) { - // 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]); - } else { - // no more characters left - break; - } - } - } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); - // maximum lenght is reached, so get off the loop - break; - } - $truncate .= $line_matchings[2]; - $total_length += $content_length; - - // if the maximum length is reached, get off the loop - if ($total_length >= $length) { - break; - } - } - } else { - if (mb_strlen($text) <= $length) { - return $text; - } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); - } - // if the words shouldn't be cut in the middle... - if (!$exact) { - // ...search the last occurance of a space... - $spacepos = mb_strrpos($truncate, ' '); - if (isset($spacepos)) { - // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); - } - } - // add the defined ending to the text - $truncate .= $ending; - if ($considerHtml) { - // close all unclosed html-tags - foreach ($open_tags as $tag) { - $truncate .= ''; - } - } - - return $truncate; - } - - /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options - * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor - */ - public static function getEditor($helper = null, $options = null) - { - /** @var Mymodule\Helper $helper */ - if (null === $options) { - $options = []; - $options['name'] = 'Editor'; - $options['value'] = 'Editor'; - $options['rows'] = 10; - $options['cols'] = '100%'; - $options['width'] = '100%'; - $options['height'] = '400px'; - } - - $isAdmin = $helper->isUserAdmin(); - - if (class_exists('XoopsFormEditor')) { - if ($isAdmin) { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); - } else { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); - } - } else { - $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); - } - - // $form->addElement($descEditor); - - return $descEditor; - } - - //--------------- Custom module methods ----------------------------- - - /** - * @param $about - * @return string - */ - public static function MakeDonationForm($about) - { - $donationform = [ - 0 => '
      ', - 1 => '
      ' - . _AM_MYMODULE_ABOUT_MAKE_DONATION - . '
      ' - . _AM_MYMODULE_DONATION_AMOUNT - . '*
      ', - 2 => '
      ', - 'D' => '', - 3 => '', - 4 => ' - -', - ]; - $paypalform = [ - 0 => '
      ', - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 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; - } - } - $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); - $aboutRes .= implode("\n", $donationform); - $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); - - return $aboutRes; - } - - /** - * @param $str - * - * @return string - */ - public static function UcFirstAndToLower($str) - { - return ucfirst(mb_strtolower(trim($str))); - } -} diff --git a/testdata/mymodule/class/index.html b/testdata/mymodule/class/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/class/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/config/admin.yml b/testdata/mymodule/config/admin.yml deleted file mode 100644 index 32d9dd3d..00000000 --- a/testdata/mymodule/config/admin.yml +++ /dev/null @@ -1 +0,0 @@ -displaySampleButton: 1 diff --git a/testdata/mymodule/config/config.php b/testdata/mymodule/config/config.php deleted file mode 100644 index aaad338b..00000000 --- a/testdata/mymodule/config/config.php +++ /dev/null @@ -1,68 +0,0 @@ - - Website: - */ - -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -return (object)[ - 'name' => mb_strtoupper($moduleDirName) . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/temp', - ], - 'copyBlankFiles' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/articles', - ], - 'copyTestFolders' => [ - XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - ], - 'templateFolders' => [ - '/templates/', - ], - 'oldFiles' => [ - ], - 'oldFolders' => [ - ], - 'renameTables' => [ - ], - 'moduleStats' => [ - ], - 'modCopyright' => "XOOPS Project", -]; diff --git a/testdata/mymodule/config/icons.php b/testdata/mymodule/config/icons.php deleted file mode 100644 index 0eba0bc5..00000000 --- a/testdata/mymodule/config/icons.php +++ /dev/null @@ -1,22 +0,0 @@ - mb_strtoupper($moduleDirName) . ' IconConfigurator', - 'icons' => [ - 'edit' => " . _EDIT . ", - 'delete' => "" . _DELETE . "", - 'clone' => "" . _CLONE . "", - 'preview' => "" . _PREVIEW . "", - 'print' => "" . _CLONE . "", - 'pdf' => "" . _CLONE . "", - 'add' => "" . _ADD . "", - '0' => "" . 0 . "", - '1' => "" . 1 . "", - ], - ]; -} diff --git a/testdata/mymodule/config/index.html b/testdata/mymodule/config/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/config/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/config/paths.php b/testdata/mymodule/config/paths.php deleted file mode 100644 index 2ff95a2c..00000000 --- a/testdata/mymodule/config/paths.php +++ /dev/null @@ -1,25 +0,0 @@ - mb_strtoupper($moduleDirName) . ' PathConfigurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - ]; -} diff --git a/testdata/mymodule/docs/changelog.txt b/testdata/mymodule/docs/changelog.txt deleted file mode 100644 index ab0b7744..00000000 --- a/testdata/mymodule/docs/changelog.txt +++ /dev/null @@ -1,4 +0,0 @@ -============================================================== -Change Log for My Module - 2020/04/07 18:14:42 Version 1.0 -============================================================== - - Original release mymodule (TDM XOOPS) \ No newline at end of file diff --git a/testdata/mymodule/docs/credits.txt b/testdata/mymodule/docs/credits.txt deleted file mode 100644 index bf06b0ab..00000000 --- a/testdata/mymodule/docs/credits.txt +++ /dev/null @@ -1,10 +0,0 @@ -Read Me First -============= - -Originally created by the TDM Team. - -Modified by Timgno (http://www.txmodxoops.org) - -Contributors: Mamba (https://xoops.org), Goffy (German Xoops) - -Included ideas for Logo Generator from Trabis (Publisher module) and Suin (Koins module) \ No newline at end of file diff --git a/testdata/mymodule/docs/index.html b/testdata/mymodule/docs/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/docs/install.txt b/testdata/mymodule/docs/install.txt deleted file mode 100644 index 469bfd3a..00000000 --- a/testdata/mymodule/docs/install.txt +++ /dev/null @@ -1,4 +0,0 @@ -Read Me First -============= - -Install just like another XOOPS module \ No newline at end of file diff --git a/testdata/mymodule/docs/lang.diff b/testdata/mymodule/docs/lang.diff deleted file mode 100644 index 233be6a5..00000000 --- a/testdata/mymodule/docs/lang.diff +++ /dev/null @@ -1,7 +0,0 @@ -Legend : -+ Added -- Removed -* Modified - -To see the differences of language files, see the language folder -+ file name update language 1:59 to 1.91 \ No newline at end of file diff --git a/testdata/mymodule/docs/license.txt b/testdata/mymodule/docs/license.txt deleted file mode 100644 index aac9317c..00000000 --- a/testdata/mymodule/docs/license.txt +++ /dev/null @@ -1,66 +0,0 @@ -End User License Agreement for Xoops Modules - -IMPORTANT NOTICE Read and understand this License -Agreement carefully before installing and using this Software. -It contains extremely important information. - -BY USING THIS SOFTWARE IN ANY WAY YOU ACKNOWLEDGE -THAT YOU HAVE READ, UNDERSTAND AND AGREE TO THE -TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO -THESE TERMS, DO NOT USE THIS SOFTWARE IN ANY WAY, -AND PROMPTLY RETURN IT OR DELETE ANY COPIES OF -THIS SOFTWARE IN YOUR POSSESSION. - -LICENSE GRANT the copyright holder grants you a non-exclusive -license to use this software, and any associated documentation -("The Software"), as indicated herein. - -You may install and use the Software on two computers for your use -only. - -RESTRICTIONS You MAY NOT: (a) sell or distribute this Software -package without prior written approval (b) cause or permit reverse -engineering, disassembly, decompilation or alteration of this -Software; (c) remove any product identification, copyright notices, -or other notices or proprietary restrictions from this Software; - -TERM: This License is effective until terminated. You may terminate -it at any time by destroying the Software, together with all copies -thereof. This License will also terminate if you fail to comply with any -term or condition of this Agreement. Upon such termination, you -agree to destroy the Software, together with all copies thereof. - -COPYRIGHT/OWNERSHIP This Software and its source -code are proprietary products of Pablo Software Solutions -and are protected by copyright, trade secret and other intellectual -property laws. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -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 -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 -spyware. The maker of this software does not support any -questionable forms of use where this software could be misused in -any way. - -http://www.txmodxoops.org -https://xoops.org diff --git a/testdata/mymodule/docs/readme.txt b/testdata/mymodule/docs/readme.txt deleted file mode 100644 index 62b1640e..00000000 --- a/testdata/mymodule/docs/readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -Read Me First -============= - -Please make sure that you download the XOOPS Icon Set, and upload it to uploads/images directory -Read the table in admin help for the accurate description of the functionality of this module - -Using the new class xoopsrequest.php - -Version of xoops ----------------- -TDMCreate is a module that create other basic modules for CMS Xoops. - -Tested with xoops 2.5.7, you can not use it with earlier versions, unless because you do not fit some core files in the background and after some tests. - -Now that is ahead xoops versions, and goes to 2.6.0, you should download xoops 2.5.7 and use with this latest version. - -Therefore recommended not to use TDMCreate 1.91, with previous versions, to xoops 2.5.7 \ No newline at end of file diff --git a/testdata/mymodule/footer.php b/testdata/mymodule/footer.php deleted file mode 100644 index 9055fd3d..00000000 --- a/testdata/mymodule/footer.php +++ /dev/null @@ -1,33 +0,0 @@ - - Website: - */ -if(count($xoBreadcrumbs) > 1) { - $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); -} -$GLOBALS['xoopsTpl']->assign('adv', $helper->getConfig('advertise')); -// -$GLOBALS['xoopsTpl']->assign('bookmarks', $helper->getConfig('bookmarks')); -$GLOBALS['xoopsTpl']->assign('fbcomments', $helper->getConfig('fbcomments')); -// -$GLOBALS['xoopsTpl']->assign('admin', MYMODULE_ADMIN); -$GLOBALS['xoopsTpl']->assign('copyright', $copyright); -// -include_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/testdata/mymodule/header.php b/testdata/mymodule/header.php deleted file mode 100644 index c917f50d..00000000 --- a/testdata/mymodule/header.php +++ /dev/null @@ -1,55 +0,0 @@ - - Website: - */ -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include __DIR__ . '/include/common.php'; -$moduleDirName = basename(__DIR__); -// Breadcrumbs -$xoBreadcrumbs = []; -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE_TITLE, 'link' => MYMODULE_URL . '/']; -// Get instance of module -$helper = \XoopsModules\Mymodule\Helper::getInstance(); -$categoriesHandler = $helper->getHandler('categories'); -$articlesHandler = $helper->getHandler('articles'); -// Permission -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -$gpermHandler = xoops_getHandler('groupperm'); -if(is_object($xoopsUser)) { - $groups = $xoopsUser->getGroups(); -} else { - $groups = XOOPS_GROUP_ANONYMOUS; -} -// -$myts = MyTextSanitizer::getInstance(); -// Default Css Style -$style = MYMODULE_URL . '/assets/css/style.css'; -if(!file_exists($style)) { - return false; -} -// Smarty Default -$sysPathIcon16 = $GLOBALS['xoopsModule']->getInfo('sysicons16'); -$sysPathIcon32 = $GLOBALS['xoopsModule']->getInfo('sysicons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -$modPathIcon16 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -$modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -// Load Languages -xoops_loadLanguage('main'); -xoops_loadLanguage('modinfo'); diff --git a/testdata/mymodule/include/comment_functions.php b/testdata/mymodule/include/comment_functions.php deleted file mode 100644 index e661410e..00000000 --- a/testdata/mymodule/include/comment_functions.php +++ /dev/null @@ -1,48 +0,0 @@ - - Website: - */ - -/** - * CommentsUpdate - * - * @param mixed $itemId - * @param mixed $itemNumb - * @return bool - */ -function mymoduleCommentsUpdate($itemId, $itemNumb) { - $itemId = (int)$itemId; - $itemNumb = (int)$itemNumb; - $article = new MymoduleArticles($itemId); - if (!$article->updateComments($itemNumb)) { - return false; - } - return true; -} - -/** - * CommentsApprove - * - * @param string $comment - * @return void - */ -function mymoduleCommentsApprove(&$comment){ - // notification mail here -} \ No newline at end of file diff --git a/testdata/mymodule/include/comment_new.php b/testdata/mymodule/include/comment_new.php deleted file mode 100644 index 1d1b48ec..00000000 --- a/testdata/mymodule/include/comment_new.php +++ /dev/null @@ -1,30 +0,0 @@ - - Website: - */ -include __DIR__ . '/../../../mainfile.php'; -include_once XOOPS_ROOT_PATH.'/modules/mymodule/class/articles.php'; -$com_itemid = isset($_REQUEST['com_itemid']) ? (int)$_REQUEST['com_itemid'] : 0; -if ($com_itemid > 0) { - $articlesHandler = xoops_getModuleHandler('articles', 'mymodule'); - $articles = $articleshandler->get($com_itemid); - $com_replytitle = $articles->getVar('art_title'); - include XOOPS_ROOT_PATH.'/include/comment_new.php'; -} \ No newline at end of file diff --git a/testdata/mymodule/include/common.php b/testdata/mymodule/include/common.php deleted file mode 100644 index 8c738614..00000000 --- a/testdata/mymodule/include/common.php +++ /dev/null @@ -1,49 +0,0 @@ - - Website: - */ -if (!defined('XOOPS_ICONS32_PATH')) { - 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('MYMODULE_DIRNAME', 'mymodule'); -define('MYMODULE_PATH', XOOPS_ROOT_PATH.'/modules/'.MYMODULE_DIRNAME); -define('MYMODULE_URL', XOOPS_URL.'/modules/'.MYMODULE_DIRNAME); -define('MYMODULE_ICONS_PATH', MYMODULE_PATH.'/assets/icons'); -define('MYMODULE_ICONS_URL', MYMODULE_URL.'/assets/icons'); -define('MYMODULE_IMAGE_PATH', MYMODULE_PATH.'/assets/images'); -define('MYMODULE_IMAGE_URL', MYMODULE_URL.'/assets/images'); -define('MYMODULE_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.MYMODULE_DIRNAME); -define('MYMODULE_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.MYMODULE_DIRNAME); -define('MYMODULE_UPLOAD_FILES_PATH', MYMODULE_UPLOAD_PATH.'/files'); -define('MYMODULE_UPLOAD_FILES_URL', MYMODULE_UPLOAD_URL.'/files'); -define('MYMODULE_UPLOAD_IMAGE_PATH', MYMODULE_UPLOAD_PATH.'/images'); -define('MYMODULE_UPLOAD_IMAGE_URL', MYMODULE_UPLOAD_URL.'/images'); -define('MYMODULE_UPLOAD_SHOTS_PATH', MYMODULE_UPLOAD_PATH.'/images/shots'); -define('MYMODULE_UPLOAD_SHOTS_URL', MYMODULE_UPLOAD_URL.'/images/shots'); -define('MYMODULE_ADMIN', MYMODULE_URL . '/admin/index.php'); -$localLogo = MYMODULE_IMAGE_URL . '/tdmxoops_logo.png'; -// Module Information -$copyright = "XOOPS Project"; -include_once XOOPS_ROOT_PATH . '/class/xoopsrequest.php'; -include_once MYMODULE_PATH . '/class/helper.php'; -include_once MYMODULE_PATH . '/include/functions.php'; diff --git a/testdata/mymodule/include/functions.php b/testdata/mymodule/include/functions.php deleted file mode 100644 index 68b52ee5..00000000 --- a/testdata/mymodule/include/functions.php +++ /dev/null @@ -1,239 +0,0 @@ - - Website: - */ - -/***************Blocks***************/ - -/** - * add selected cats - * @param $cats - * @return string - */ -function mymodule_block_addCatSelect($cats) { - if(is_array($cats)) - { - $cat_sql = '('.current($cats); - array_shift($cats); - foreach($cats as $cat) - { - $cat_sql .= ','.$cat; - } - $cat_sql .= ')'; - } - return $cat_sql; -} - -/** - * Get the permissions ids - * @param $permtype - * @param $dirname - * @return mixed $articles - */ -function mymoduleGetMyItemIds($permtype, $dirname) -{ - global $xoopsUser; - static $permissions = array(); - if(is_array($permissions) && array_key_exists($permtype, $permissions)) { - return $permissions[$permtype]; - } - $moduleHandler = xoops_getHandler('module'); - $mymoduleModule = $moduleHandler->getByDirname($dirname); - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $gpermHandler = xoops_getHandler('groupperm'); - $articles = $gpermHandler->getItemIds($permtype, $groups, $mymoduleModule->getVar('mid')); - return $articles; -} - -/** - * Get the number of articles from the sub categories of a category or sub topics of or topic - * @param $mytree - * @param $articles - * @param $entries - * @param $cid - * @return int - */ -function mymoduleNumbersOfEntries($mytree, $articles, $entries, $cid) -{ - $count = 0; - if(in_array($cid, $articles)) { - $child = $mytree->getAllChild($cid); - foreach (array_keys($entries) as $i) { - if ($entries[$i]->getVar('art_id') == $cid){ - $count++; - } - foreach (array_keys($child) as $j) { - if ($entries[$i]->getVar('art_id') == $j){ - $count++; - } - } - } - } - return $count; -} - -/** - * Add content as meta tag to template - * @param $content - * @return void - */ - -function mymoduleMetaKeywords($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)); - } -} - -/** - * Add content as meta description to template - * @param $content - * @return void - */ - -function mymoduleMetaDescription($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)); - } -} - -/** - * 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 mymodule_RewriteUrl($module, $array, $type = 'content') -{ - $comment = ''; - $helper = \XoopsModules\Mymodule\Helper::getInstance(); - $articles = $helper->getHandler('articles'); - $lenght_id = $helper->getConfig('lenght_id'); - $rewrite_url = $helper->getConfig('rewrite_url'); - - if ($lenght_id != 0) { - $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 = mymodule_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 ($type === 'content/') { - $type = ''; - } - if ($type === 'comment-edit/' || $type === 'comment-reply/' || $type === 'comment-delete/') { - 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 ($type === 'content/') { - $type = ''; - } - if ($type === 'comment-edit/' || $type === 'comment-reply/' || $type === 'comment-delete/') { - 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; -} -/** - * 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 mymodule_Filter($url, $type = '') { - - // Get regular expression from module setting. default setting is : `[^a-z0-9]`i - $helper = \XoopsModules\Mymodule\Helper::getInstance(); - $articles = $helper->getHandler('articles'); - $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(array($regular_expression, "`[-]+`"), '-', $url); - $url = ($url == '') ? $type : strtolower(trim($url, '-')); - return $url; -} \ No newline at end of file diff --git a/testdata/mymodule/include/index.html b/testdata/mymodule/include/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/include/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/include/install.php b/testdata/mymodule/include/install.php deleted file mode 100644 index 221029e1..00000000 --- a/testdata/mymodule/include/install.php +++ /dev/null @@ -1,95 +0,0 @@ - - Website: XOOPS Project (www.xoops.org) $ - */ - -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Common; - -/** - * @param \XoopsModule $module - * @return bool - */ -function xoops_module_pre_install_mymodule(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Mymodule\Utility $utility */ - $utility = new Mymodule\Utility(); - - //check for minimum XOOPS version - $xoopsSuccess = $utility::checkVerXoops($module); - - // check for minimum PHP version - $phpSuccess = $utility::checkVerPhp($module); - - if (false !== $xoopsSuccess && false !== $phpSuccess) { - $moduleTables = &$module->getInfo('tables'); - foreach ($moduleTables as $table) { - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); - } - } - - return $xoopsSuccess && $phpSuccess; -} - -/** - * @param \XoopsModule $module - * @return bool|string - */ -function xoops_module_install_mymodule(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - - /** @var Mymodule\Helper $helper */ - /** @var Mymodule\Utility $utility */ - /** @var Common\Configurator $configurator */ - $helper = Mymodule\Helper::getInstance(); - $utility = new Mymodule\Utility(); - $configurator = new Common\Configurator(); - - // Load language files - $helper->loadLanguage('admin'); - $helper->loadLanguage('modinfo'); - $helper->loadLanguage('common'); - - // --- CREATE FOLDERS --------------- - if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - foreach (array_keys($configurator->uploadFolders) as $i) { - $utility::createFolder($configurator->uploadFolders[$i]); - } - } - - // --- COPY blank.gif FILES --------------- - if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $file = dirname(__DIR__) . '/assets/images/blank.gif'; - foreach (array_keys($configurator->copyBlankFiles) as $i) { - $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; -} diff --git a/testdata/mymodule/include/notifications.inc.php b/testdata/mymodule/include/notifications.inc.php deleted file mode 100644 index a67ee74f..00000000 --- a/testdata/mymodule/include/notifications.inc.php +++ /dev/null @@ -1,71 +0,0 @@ - - Website: - */ - -/** - * comment callback functions - * - * @param $category - * @param $item_id - * @return array item|null - */ -function mymodule_notify_iteminfo($category, $item_id) -{ - global $xoopsModule, $xoopsModuleConfig, $xoopsDB; - // - if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'mymodule') - { - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname('mymodule'); - $configHandler = xoops_getHandler('config'); - $config =& $configHandler->getConfigsByCat(0, $module->getVar('mid')); - } else { - $module = $xoopsModule; - $config = $xoopsModuleConfig; - } - // - switch($category) { - case 'global': - $item['name'] = ''; - $item['url'] = ''; - return $item; - break; - case 'category': - // Assume we have a valid category id - $sql = 'SELECT art_title FROM ' . $xoopsDB->prefix('mymodule_articles') . ' WHERE art_id = '. $item_id; - $result = $xoopsDB->query($sql); // TODO: error check - $result_array = $xoopsDB->fetchArray($result); - $item['name'] = $result_array['art_title']; - $item['url'] = MYMODULE_URL . '/articles.php?art_id=' . $item_id; - return $item; - break; - case 'article': - // Assume we have a valid link id - $sql = 'SELECT art_id, art_title FROM '.$xoopsDB->prefix('mymodule_articles') . ' WHERE art_id = ' . $item_id; - $result = $xoopsDB->query($sql); // TODO: error check - $result_array = $xoopsDB->fetchArray($result); - $item['name'] = $result_array['art_title']; - $item['url'] = MYMODULE_URL . '/single.php?cid=' . $result_array['cid'] . '&art_id=' . $item_id; - return $item; - break; - } - return null; -} \ No newline at end of file diff --git a/testdata/mymodule/include/search.inc.php b/testdata/mymodule/include/search.inc.php deleted file mode 100644 index 98893dfa..00000000 --- a/testdata/mymodule/include/search.inc.php +++ /dev/null @@ -1,61 +0,0 @@ - - Website: - */ - - -/** - * search callback functions - * @param $queryarray - * @param $andor - * @param $limit - * @param $offset - * @param $userid - */ -function mymodule_search($queryarray, $andor, $limit, $offset, $userid) -{ - global $xoopsDB; - $sql = "SELECT 'art_id', 'art_title' FROM " . $xoopsDB->prefix('mymodule_articles') . ' WHERE art_id != 0'; - if ( $userid != 0 ) { - $sql .= ' AND art_submitter='.(int)$userid; - } - if ( is_array($queryarray) && $count = count($queryarray) ) - { - $sql .= " AND ((art_cat LIKE %$queryarray[0]% OR art_title LIKE %$queryarray[0]% OR art_descr LIKE %$queryarray[0]%)"; - for($i = 1; $i < $count; ++$i) - { - $sql .= " $andor "; - $sql .= "(art_cat LIKE %$queryarray[$i]% OR art_title LIKE %$queryarray[$i]% OR art_descr LIKE %$queryarray[0]%)"; - } - $sql .= ')'; - } - $sql .= " ORDER BY 'art_id' DESC"; - $result = $xoopsDB->query($sql,$limit,$offset); - $ret = array(); - $i = 0; - while($myrow = $xoopsDB->fetchArray($result)) - { - $ret[$i]['image'] = 'assets/icons/32/blank.gif'; - $ret[$i]['link'] = 'articles.php?art_id='.$myrow['art_id']; - $ret[$i]['title'] = $myrow['art_title']; - ++$i; - } - unset($i); -} \ No newline at end of file diff --git a/testdata/mymodule/include/update.php b/testdata/mymodule/include/update.php deleted file mode 100644 index deec3543..00000000 --- a/testdata/mymodule/include/update.php +++ /dev/null @@ -1,119 +0,0 @@ - - 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 - */ - -/** - * @param $module - * @param null $prev_version - * - * @return bool|null - */ -function xoops_module_update_mymodule(&$module, $prev_version = null) -{ - $ret = null; - if ($prev_version < 10) { - $ret = update_mymodule_v10($module); - } - - $ret = mymodule_check_db($module); - - //check upload directory - include_once __DIR__ . '/install.php'; - $ret = xoops_module_install_mymodule($module); - - $errors = $module->getErrors(); - if (!empty($errors)) { - print_r($errors); - } - - return $ret; - -} - -// irmtfan bug fix: solve templates duplicate issue -/** - * @param $module - * - * @return bool - */ -function update_mymodule_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 (false !== (list($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 - * - * @return bool - */ -function mymodule_check_db($module) -{ - $ret = true; - //insert here code for database check - - return $ret; -} diff --git a/testdata/mymodule/include/xoops_version.inc.php b/testdata/mymodule/include/xoops_version.inc.php deleted file mode 100644 index 2148041d..00000000 --- a/testdata/mymodule/include/xoops_version.inc.php +++ /dev/null @@ -1,40 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_index.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = []; -// -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule_url', MYMODULE_URL); -// -$articlesCount = $articlesHandler->getCountArticles(); -$GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); -$count = 1; -if($articlesCount > 0) { - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('userpager')); - $articlesAll = $articlesHandler->getAllArticles($start, $limit); - // Get All Articles - $articles = []; - foreach(array_keys($articlesAll) as $i) { - $article = $articlesAll[$i]->getValuesArticles(); - $acount = ['count', $count]; - $articles[] = array_merge($article, $acount); - $keywords[] = $articlesAll[$i]->getVar('art_title'); - ++$count; - } - $GLOBALS['xoopsTpl']->assign('articles', $articles); - unset($articles); - // Display Navigation - if($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE_INDEX_THEREARE, $articlesCount)); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} -unset($count); -$GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE_INDEX]; -// Keywords -mymoduleMetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// Description -mymoduleMetaDescription(_MA_MYMODULE_INDEX_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/language/english/admin.php b/testdata/mymodule/language/english/admin.php deleted file mode 100644 index 43ad2363..00000000 --- a/testdata/mymodule/language/english/admin.php +++ /dev/null @@ -1,91 +0,0 @@ - - Website: - */ -// ---------------- Admin Index ---------------- -define('_AM_MYMODULE_STATISTICS', 'Statistics'); -// There are -define('_AM_MYMODULE_THEREARE_CATEGORIES', "There are %s categories in the database"); -define('_AM_MYMODULE_THEREARE_ARTICLES', "There are %s articles in the database"); -// ---------------- Admin Files ---------------- -// There aren't -define('_AM_MYMODULE_THEREARENT_CATEGORIES', "There aren't categories"); -define('_AM_MYMODULE_THEREARENT_ARTICLES', "There aren't articles"); -// Save/Delete -define('_AM_MYMODULE_FORM_OK', 'Successfully saved'); -define('_AM_MYMODULE_FORM_DELETE_OK', 'Successfully deleted'); -define('_AM_MYMODULE_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_AM_MYMODULE_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Buttons -define('_AM_MYMODULE_ADD_CATEGORY', 'Add New Category'); -define('_AM_MYMODULE_ADD_ARTICLE', 'Add New Article'); -// Lists -define('_AM_MYMODULE_CATEGORIES_LIST', 'List of Categories'); -define('_AM_MYMODULE_ARTICLES_LIST', 'List of Articles'); -// ---------------- Admin Classes ---------------- -// Category add/edit -define('_AM_MYMODULE_CATEGORY_ADD', 'Add Category'); -define('_AM_MYMODULE_CATEGORY_EDIT', 'Edit Category'); -// Elements of Category -define('_AM_MYMODULE_CATEGORY_ID', 'Id'); -define('_AM_MYMODULE_CATEGORY_NAME', 'Name'); -define('_AM_MYMODULE_CATEGORY_LOGO', 'Logo'); -define('_AM_MYMODULE_FORM_UPLOAD_IMAGE_CATEGORIES', 'Logo in ./uploads/mymodule/images/categories/ :'); -define('_AM_MYMODULE_CATEGORY_CREATED', 'Created'); -define('_AM_MYMODULE_CATEGORY_SUBMITTER', 'Submitter'); -// Article add/edit -define('_AM_MYMODULE_ARTICLE_ADD', 'Add Article'); -define('_AM_MYMODULE_ARTICLE_EDIT', 'Edit Article'); -// Elements of Article -define('_AM_MYMODULE_ARTICLE_ID', 'Id'); -define('_AM_MYMODULE_ARTICLE_CAT', 'Categories'); -define('_AM_MYMODULE_ARTICLE_TITLE', 'Title'); -define('_AM_MYMODULE_ARTICLE_DESCR', 'Descr'); -define('_AM_MYMODULE_ARTICLE_IMG', 'Img'); -define('_AM_MYMODULE_FORM_UPLOAD_IMAGE_ARTICLES', 'Img in ./uploads/mymodule/images/articles/ :'); -define('_AM_MYMODULE_ARTICLE_ONLINE', 'Online'); -define('_AM_MYMODULE_ARTICLE_FILE', 'File'); -define('_AM_MYMODULE_FORM_UPLOAD_FILE_ARTICLES', 'File in ./uploads/mymodule/files/articles/ :'); -define('_AM_MYMODULE_ARTICLE_CREATED', 'Created'); -define('_AM_MYMODULE_ARTICLE_SUBMITTER', 'Submitter'); -// General -define('_AM_MYMODULE_FORM_UPLOAD', 'Upload file'); -define('_AM_MYMODULE_FORM_UPLOAD_NEW', 'Upload new file: '); -define('_AM_MYMODULE_FORM_IMAGE_PATH', 'Files in %s :'); -define('_AM_MYMODULE_FORM_ACTION', 'Action'); -define('_AM_MYMODULE_FORM_EDIT', 'Modification'); -define('_AM_MYMODULE_FORM_DELETE', 'Clear'); -// ---------------- Admin Permissions ---------------- -// Permissions -define('_AM_MYMODULE_PERMISSIONS_GLOBAL', 'Permissions global'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_16', 'Permissions global to view'); -define('_AM_MYMODULE_PERMISSIONS_APPROVE', 'Permissions to approve'); -define('_AM_MYMODULE_PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); -define('_AM_MYMODULE_PERMISSIONS_SUBMIT', 'Permissions to submit'); -define('_AM_MYMODULE_PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); -define('_AM_MYMODULE_PERMISSIONS_VIEW', 'Permissions to view'); -define('_AM_MYMODULE_PERMISSIONS_VIEW_DESC', 'Permissions to view'); -define('_AM_MYMODULE_NO_PERMISSIONS_SET', 'No permission set'); -// ---------------- Admin Others ---------------- -define('_AM_MYMODULE_MAINTAINEDBY', ' is maintained by '); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/english/blocks.php b/testdata/mymodule/language/english/blocks.php deleted file mode 100644 index 3fd89d6b..00000000 --- a/testdata/mymodule/language/english/blocks.php +++ /dev/null @@ -1,47 +0,0 @@ - - Website: - */ -// Admin Edit -define('_MB_MYMODULE_DISPLAY', 'How Many Tables to Display'); -define('_MB_MYMODULE_TITLE_LENGTH', 'Title Length'); -define('_MB_MYMODULE_CATTODISPLAY', 'Categories to Display'); -define('_MB_MYMODULE_ALLCAT', 'All Categories'); -// Categories -define('_MB_MYMODULE_CATEGORIES_TO_DISPLAY', 'Categories to Display'); -define('_MB_MYMODULE_ALL_CATEGORIES', 'All Categories'); -define('_MB_MYMODULE_CAT_ID', 'Id'); -define('_MB_MYMODULE_CAT_NAME', 'Name'); -define('_MB_MYMODULE_CAT_LOGO', 'Logo'); -define('_MB_MYMODULE_CAT_CREATED', 'Created'); -define('_MB_MYMODULE_CAT_SUBMITTER', 'Submitter'); -// Articles -define('_MB_MYMODULE_ARTICLES_TO_DISPLAY', 'Articles to Display'); -define('_MB_MYMODULE_ALL_ARTICLES', 'All Articles'); -define('_MB_MYMODULE_ART_ID', 'Id'); -define('_MB_MYMODULE_ART_CAT', 'Cat'); -define('_MB_MYMODULE_ART_TITLE', 'Title'); -define('_MB_MYMODULE_ART_DESCR', 'Descr'); -define('_MB_MYMODULE_ART_IMG', 'Img'); -define('_MB_MYMODULE_ART_ONLINE', 'Online'); -define('_MB_MYMODULE_ART_FILE', 'File'); -define('_MB_MYMODULE_ART_CREATED', 'Created'); -define('_MB_MYMODULE_ART_SUBMITTER', 'Submitter'); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/english/common.php b/testdata/mymodule/language/english/common.php deleted file mode 100644 index 214982f0..00000000 --- a/testdata/mymodule/language/english/common.php +++ /dev/null @@ -1,183 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/testdata/mymodule/language/english/feedback.php b/testdata/mymodule/language/english/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/testdata/mymodule/language/english/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/testdata/mymodule/language/english/help/help.html b/testdata/mymodule/language/english/help/help.html deleted file mode 100644 index eb02b585..00000000 --- a/testdata/mymodule/language/english/help/help.html +++ /dev/null @@ -1,27 +0,0 @@ -
      -

      Help: - My Module Back to the Administration of My Module -

      - -

      Description

      -

      - The My Module module can be used to modules in XOOPS

      -

      -

      Install/uninstall

      -

      -No special measures necessary, follow the standard installation process and extract the mymodule 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 TDMCreate 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 -

      - -
      \ No newline at end of file diff --git a/testdata/mymodule/language/english/help/index.html b/testdata/mymodule/language/english/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/english/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/language/english/index.html b/testdata/mymodule/language/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/language/english/mail_template/category_new_notify.tpl b/testdata/mymodule/language/english/mail_template/category_new_notify.tpl deleted file mode 100644 index 15071a28..00000000 --- a/testdata/mymodule/language/english/mail_template/category_new_notify.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, - -A new story "{STORY_NAME}" has been added at {X_SITENAME}. - -You can view this story here: -{STORY_URL} - ------------ - -You are receiving this message because you selected to be notified when new stories are added to our site. - -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} - -Please do not reply to this message. - ------------ - -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} \ No newline at end of file diff --git a/testdata/mymodule/language/english/mail_template/index.html b/testdata/mymodule/language/english/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/english/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/language/english/main.php b/testdata/mymodule/language/english/main.php deleted file mode 100644 index dad194dd..00000000 --- a/testdata/mymodule/language/english/main.php +++ /dev/null @@ -1,77 +0,0 @@ - - Website: - */ - -// ---------------- Main ---------------- -define('_MA_MYMODULE_INDEX', 'Home'); -define('_MA_MYMODULE_TITLE', 'My Module'); -define('_MA_MYMODULE_DESC', 'This module is for doing following...'); -define('_MA_MYMODULE_INDEX_DESC', "Welcome to the homepage of your new module My Module!
      -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."); -define('_MA_MYMODULE_NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); -define('_MA_MYMODULE_NO', 'No'); -// ---------------- Contents ---------------- -// Category -define('_MA_MYMODULE_CATEGORY', 'Category'); -define('_MA_MYMODULE_CATEGORIES', 'Categories'); -define('_MA_MYMODULE_CATEGORIES_TITLE', 'Categories title'); -define('_MA_MYMODULE_CATEGORIES_DESC', 'Categories description'); -// Caption of Category -define('_MA_MYMODULE_CATEGORY_ID', 'Id'); -define('_MA_MYMODULE_CATEGORY_NAME', 'Name'); -define('_MA_MYMODULE_CATEGORY_LOGO', 'Logo'); -define('_MA_MYMODULE_CATEGORY_CREATED', 'Created'); -define('_MA_MYMODULE_CATEGORY_SUBMITTER', 'Submitter'); -// Article -define('_MA_MYMODULE_ARTICLE', 'Article'); -define('_MA_MYMODULE_ARTICLES', 'Articles'); -define('_MA_MYMODULE_ARTICLES_TITLE', 'Articles title'); -define('_MA_MYMODULE_ARTICLES_DESC', 'Articles description'); -// Caption of Article -define('_MA_MYMODULE_ARTICLE_ID', 'Id'); -define('_MA_MYMODULE_ARTICLE_CAT', 'Cat'); -define('_MA_MYMODULE_ARTICLE_TITLE', 'Title'); -define('_MA_MYMODULE_ARTICLE_DESCR', 'Descr'); -define('_MA_MYMODULE_ARTICLE_IMG', 'Img'); -define('_MA_MYMODULE_ARTICLE_ONLINE', 'Online'); -define('_MA_MYMODULE_ARTICLE_FILE', 'File'); -define('_MA_MYMODULE_ARTICLE_CREATED', 'Created'); -define('_MA_MYMODULE_ARTICLE_SUBMITTER', 'Submitter'); -define('_MA_MYMODULE_INDEX_THEREARE', 'There are %s Articles'); -define('_MA_MYMODULE_INDEX_LATEST_LIST', 'Last My Module'); -// Submit -define('_MA_MYMODULE_SUBMIT', 'Submit'); -define('_MA_MYMODULE_SUBMIT_ARTICLE', 'Submit Article'); -define('_MA_MYMODULE_SUBMIT_ALLPENDING', 'All article/script information are posted pending verification.'); -define('_MA_MYMODULE_SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); -define('_MA_MYMODULE_SUBMIT_ISAPPROVED', 'Your article has been approved'); -define('_MA_MYMODULE_SUBMIT_PROPOSER', 'Submit a article'); -define('_MA_MYMODULE_SUBMIT_RECEIVED', 'We have received your article info. Thank you !'); -define('_MA_MYMODULE_SUBMIT_SUBMITONCE', 'Submit your article/script only once.'); -define('_MA_MYMODULE_SUBMIT_TAKEDAYS', 'This will take many days to see your article/script added successfully in our database.'); -// Form -define('_MA_MYMODULE_FORM_OK', 'Successfully saved'); -define('_MA_MYMODULE_FORM_DELETE_OK', 'Successfully deleted'); -define('_MA_MYMODULE_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_MA_MYMODULE_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Admin link -define('_MA_MYMODULE_ADMIN', 'Admin'); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/english/modinfo.php b/testdata/mymodule/language/english/modinfo.php deleted file mode 100644 index ea3ce177..00000000 --- a/testdata/mymodule/language/english/modinfo.php +++ /dev/null @@ -1,166 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Main ---------------- -define('_MI_MYMODULE_NAME', 'My Module'); -define('_MI_MYMODULE_DESC', 'This module is for doing following...'); -// ---------------- Admin Menu ---------------- -define('_MI_MYMODULE_ADMENU1', 'Dashboard'); -define('_MI_MYMODULE_ADMENU2', 'Categories'); -define('_MI_MYMODULE_ADMENU3', 'Articles'); -define('_MI_MYMODULE_ADMENU4', 'Permissions'); -define('_MI_MYMODULE_ADMENU5', 'Feedback'); -define('_MI_MYMODULE_ABOUT', 'About'); -// ---------------- Admin Nav ---------------- -define('_MI_MYMODULE_ADMIN_PAGER', 'Admin pager'); -define('_MI_MYMODULE_ADMIN_PAGER_DESC', 'Admin per page list'); -// User -define('_MI_MYMODULE_USER_PAGER', 'User pager'); -define('_MI_MYMODULE_USER_PAGER_DESC', 'User per page list'); -// Submenu -define('_MI_MYMODULE_SMNAME1', 'Index page'); -define('_MI_MYMODULE_SMNAME2', 'Articles'); -define('_MI_MYMODULE_SMNAME3', 'Submit'); -define('_MI_MYMODULE_SMNAME4', 'Search'); -// Blocks -define('_MI_MYMODULE_CATEGORIES_BLOCK', 'Categories block'); -define('_MI_MYMODULE_CATEGORIES_BLOCK_DESC', 'Categories block description'); -define('_MI_MYMODULE_CATEGORIES_BLOCK_CATEGORY', 'Categories block CATEGORY'); -define('_MI_MYMODULE_CATEGORIES_BLOCK_CATEGORY_DESC', 'Categories block CATEGORY description'); -define('_MI_MYMODULE_ARTICLES_BLOCK', 'Articles block'); -define('_MI_MYMODULE_ARTICLES_BLOCK_DESC', 'Articles block description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_ARTICLE', 'Articles block ARTICLE'); -define('_MI_MYMODULE_ARTICLES_BLOCK_ARTICLE_DESC', 'Articles block ARTICLE description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_LAST', 'Articles block last'); -define('_MI_MYMODULE_ARTICLES_BLOCK_LAST_DESC', 'Articles block last description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_NEW', 'Articles block new'); -define('_MI_MYMODULE_ARTICLES_BLOCK_NEW_DESC', 'Articles block new description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_HITS', 'Articles block hits'); -define('_MI_MYMODULE_ARTICLES_BLOCK_HITS_DESC', 'Articles block hits description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_TOP', 'Articles block top'); -define('_MI_MYMODULE_ARTICLES_BLOCK_TOP_DESC', 'Articles block top description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_RANDOM', 'Articles block random'); -define('_MI_MYMODULE_ARTICLES_BLOCK_RANDOM_DESC', 'Articles block random description'); -// Config -define('_MI_MYMODULE_EDITOR_DESCR', 'Editor'); -define('_MI_MYMODULE_EDITOR_DESCR_DESC', 'Select the Editor Descr to use'); -define('_MI_MYMODULE_KEYWORDS', 'Keywords'); -define('_MI_MYMODULE_KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); -define('_MI_MYMODULE_MAXSIZE', 'Max size'); -define('_MI_MYMODULE_MAXSIZE_DESC', 'Set a number of max size uploads files in byte'); -define('_MI_MYMODULE_MIMETYPES', 'Mime Types'); -define('_MI_MYMODULE_MIMETYPES_DESC', 'Set the mime types selected'); -define('_MI_MYMODULE_USE_TAG', 'Use TAG'); -define('_MI_MYMODULE_USE_TAG_DESC', 'If you use tag module, check this option to yes'); -define('_MI_MYMODULE_NUMB_COL', 'Number Columns'); -define('_MI_MYMODULE_NUMB_COL_DESC', 'Number Columns to View.'); -define('_MI_MYMODULE_DIVIDEBY', 'Divide By'); -define('_MI_MYMODULE_DIVIDEBY_DESC', 'Divide by columns number.'); -define('_MI_MYMODULE_TABLE_TYPE', 'Table Type'); -define('_MI_MYMODULE_TABLE_TYPE_DESC', 'Table Type is the bootstrap html table.'); -define('_MI_MYMODULE_PANEL_TYPE', 'Panel Type'); -define('_MI_MYMODULE_PANEL_TYPE_DESC', 'Panel Type is the bootstrap html div.'); -define('_MI_MYMODULE_IDPAYPAL', 'Paypal ID'); -define('_MI_MYMODULE_IDPAYPAL_DESC', 'Insert here your PayPal ID for donactions.'); -define('_MI_MYMODULE_ADVERTISE', 'Advertisement Code'); -define('_MI_MYMODULE_ADVERTISE_DESC', 'Insert here the advertisement code'); -define('_MI_MYMODULE_MAINTAINEDBY', 'Maintained By'); -define('_MI_MYMODULE_MAINTAINEDBY_DESC', 'Allow url of support site or community'); -define('_MI_MYMODULE_BOOKMARKS', 'Social Bookmarks'); -define('_MI_MYMODULE_BOOKMARKS_DESC', 'Show Social Bookmarks in the single page'); -define('_MI_MYMODULE_FACEBOOK_COMMENTS', 'Facebook comments'); -define('_MI_MYMODULE_FACEBOOK_COMMENTS_DESC', 'Allow Facebook comments in the single page'); -define('_MI_MYMODULE_DISQUS_COMMENTS', 'Disqus comments'); -define('_MI_MYMODULE_DISQUS_COMMENTS_DESC', 'Allow Disqus comments in the single page'); -// Notifications -define('_MI_MYMODULE_GLOBAL_NOTIFY', 'Global notify'); -define('_MI_MYMODULE_GLOBAL_NOTIFY_DESC', 'Global notify desc'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY', 'Global modify notify'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_CAPTION', 'Global modify notify caption'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_DESC', 'Global modify notify desc'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_SUBJECT', 'Global modify notify subject'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY', 'Global broken notify'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_CAPTION', 'Global broken notify caption'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_DESC', 'Global broken notify desc'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_SUBJECT', 'Global broken notify subject'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY', 'Global submit notify'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_CAPTION', 'Global submit notify caption'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_DESC', 'Global submit notify desc'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_SUBJECT', 'Global submit notify subject'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY', 'Global new notify'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY_CAPTION', 'Global new notify caption'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY_DESC', 'Global new notify desc'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY_SUBJECT', 'Global new notify subject'); -define('_MI_MYMODULE_CATEGORY_NOTIFY', 'Category notify'); -define('_MI_MYMODULE_CATEGORY_NOTIFY_DESC', 'Category notify desc'); -define('_MI_MYMODULE_CATEGORY_NOTIFY_CAPTION', 'Category notify caption'); -define('_MI_MYMODULE_CATEGORY_NOTIFY_SUBJECT', 'Category notify Subject'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY', 'Category submit notify'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_CAPTION', 'Category submit notify caption'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_DESC', 'Category submit notify desc'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_SUBJECT', 'Category submit notify subject'); -define('_MI_MYMODULE_ARTICLE_NOTIFY', 'Article notify'); -define('_MI_MYMODULE_ARTICLE_NOTIFY_DESC', 'Article notify desc'); -define('_MI_MYMODULE_ARTICLE_NOTIFY_CAPTION', 'Article notify caption'); -define('_MI_MYMODULE_ARTICLE_NOTIFY_SUBJECT', 'Article notify subject'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY', 'Global newcategory notify'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION', 'Global newcategory notify caption'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_DESC', 'Global newcategory notify desc'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT', 'Global newcategory notify subject'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY', 'Global article modify notify'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY_CAPTION', 'Global article modify notify caption'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY_DESC', 'Global article modify notify desc'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY_SUBJECT', 'Global article modify notify subject'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY', 'Global article broken notify'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY_CAPTION', 'Global article broken notify caption'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY_DESC', 'Global article broken notify desc'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY_SUBJECT', 'Global article broken notify subject'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY', 'Global article submit notify'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY_CAPTION', 'Global article submit notify caption'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY_DESC', 'Global article submit notify desc'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY_SUBJECT', 'Global article submit notify subject'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY', 'Global new article notify'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY_CAPTION', 'Global new article notify caption'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY_DESC', 'Global new article notify desc'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY_SUBJECT', 'Global new article notify subject'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY', 'Category article submit notify'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY_CAPTION', 'Category article submit notify caption'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY_DESC', 'Category article submit notify desc'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY_SUBJECT', 'Category article submit notify subject'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY', 'Category new article notify'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY_CAPTION', 'Category new article notify caption'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY_DESC', 'Category new article notify desc'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY_SUBJECT', 'Category new article notify subject'); -define('_MI_MYMODULE_APPROVE_NOTIFY', 'Article approve notify'); -define('_MI_MYMODULE_APPROVE_NOTIFY_CAPTION', 'Article approve notify caption'); -define('_MI_MYMODULE_APPROVE_NOTIFY_DESC', 'Article approve notify desc'); -define('_MI_MYMODULE_APPROVE_NOTIFY_SUBJECT', 'Article approve notify subject'); -// Permissions Groups -define('_MI_MYMODULE_GROUPS', 'Groups access'); -define('_MI_MYMODULE_GROUPS_DESC', 'Select general access permission for groups.'); -define('_MI_MYMODULE_ADMIN_GROUPS', 'Admin Group Permissions'); -define('_MI_MYMODULE_ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); -define('_MI_MYMODULE_UPLOAD_GROUPS', 'Upload Group Permissions'); -define('_MI_MYMODULE_UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/german/admin.php b/testdata/mymodule/language/german/admin.php deleted file mode 100644 index 43ad2363..00000000 --- a/testdata/mymodule/language/german/admin.php +++ /dev/null @@ -1,91 +0,0 @@ - - Website: - */ -// ---------------- Admin Index ---------------- -define('_AM_MYMODULE_STATISTICS', 'Statistics'); -// There are -define('_AM_MYMODULE_THEREARE_CATEGORIES', "There are %s categories in the database"); -define('_AM_MYMODULE_THEREARE_ARTICLES', "There are %s articles in the database"); -// ---------------- Admin Files ---------------- -// There aren't -define('_AM_MYMODULE_THEREARENT_CATEGORIES', "There aren't categories"); -define('_AM_MYMODULE_THEREARENT_ARTICLES', "There aren't articles"); -// Save/Delete -define('_AM_MYMODULE_FORM_OK', 'Successfully saved'); -define('_AM_MYMODULE_FORM_DELETE_OK', 'Successfully deleted'); -define('_AM_MYMODULE_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_AM_MYMODULE_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Buttons -define('_AM_MYMODULE_ADD_CATEGORY', 'Add New Category'); -define('_AM_MYMODULE_ADD_ARTICLE', 'Add New Article'); -// Lists -define('_AM_MYMODULE_CATEGORIES_LIST', 'List of Categories'); -define('_AM_MYMODULE_ARTICLES_LIST', 'List of Articles'); -// ---------------- Admin Classes ---------------- -// Category add/edit -define('_AM_MYMODULE_CATEGORY_ADD', 'Add Category'); -define('_AM_MYMODULE_CATEGORY_EDIT', 'Edit Category'); -// Elements of Category -define('_AM_MYMODULE_CATEGORY_ID', 'Id'); -define('_AM_MYMODULE_CATEGORY_NAME', 'Name'); -define('_AM_MYMODULE_CATEGORY_LOGO', 'Logo'); -define('_AM_MYMODULE_FORM_UPLOAD_IMAGE_CATEGORIES', 'Logo in ./uploads/mymodule/images/categories/ :'); -define('_AM_MYMODULE_CATEGORY_CREATED', 'Created'); -define('_AM_MYMODULE_CATEGORY_SUBMITTER', 'Submitter'); -// Article add/edit -define('_AM_MYMODULE_ARTICLE_ADD', 'Add Article'); -define('_AM_MYMODULE_ARTICLE_EDIT', 'Edit Article'); -// Elements of Article -define('_AM_MYMODULE_ARTICLE_ID', 'Id'); -define('_AM_MYMODULE_ARTICLE_CAT', 'Categories'); -define('_AM_MYMODULE_ARTICLE_TITLE', 'Title'); -define('_AM_MYMODULE_ARTICLE_DESCR', 'Descr'); -define('_AM_MYMODULE_ARTICLE_IMG', 'Img'); -define('_AM_MYMODULE_FORM_UPLOAD_IMAGE_ARTICLES', 'Img in ./uploads/mymodule/images/articles/ :'); -define('_AM_MYMODULE_ARTICLE_ONLINE', 'Online'); -define('_AM_MYMODULE_ARTICLE_FILE', 'File'); -define('_AM_MYMODULE_FORM_UPLOAD_FILE_ARTICLES', 'File in ./uploads/mymodule/files/articles/ :'); -define('_AM_MYMODULE_ARTICLE_CREATED', 'Created'); -define('_AM_MYMODULE_ARTICLE_SUBMITTER', 'Submitter'); -// General -define('_AM_MYMODULE_FORM_UPLOAD', 'Upload file'); -define('_AM_MYMODULE_FORM_UPLOAD_NEW', 'Upload new file: '); -define('_AM_MYMODULE_FORM_IMAGE_PATH', 'Files in %s :'); -define('_AM_MYMODULE_FORM_ACTION', 'Action'); -define('_AM_MYMODULE_FORM_EDIT', 'Modification'); -define('_AM_MYMODULE_FORM_DELETE', 'Clear'); -// ---------------- Admin Permissions ---------------- -// Permissions -define('_AM_MYMODULE_PERMISSIONS_GLOBAL', 'Permissions global'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); -define('_AM_MYMODULE_PERMISSIONS_GLOBAL_16', 'Permissions global to view'); -define('_AM_MYMODULE_PERMISSIONS_APPROVE', 'Permissions to approve'); -define('_AM_MYMODULE_PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); -define('_AM_MYMODULE_PERMISSIONS_SUBMIT', 'Permissions to submit'); -define('_AM_MYMODULE_PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); -define('_AM_MYMODULE_PERMISSIONS_VIEW', 'Permissions to view'); -define('_AM_MYMODULE_PERMISSIONS_VIEW_DESC', 'Permissions to view'); -define('_AM_MYMODULE_NO_PERMISSIONS_SET', 'No permission set'); -// ---------------- Admin Others ---------------- -define('_AM_MYMODULE_MAINTAINEDBY', ' is maintained by '); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/german/blocks.php b/testdata/mymodule/language/german/blocks.php deleted file mode 100644 index 3fd89d6b..00000000 --- a/testdata/mymodule/language/german/blocks.php +++ /dev/null @@ -1,47 +0,0 @@ - - Website: - */ -// Admin Edit -define('_MB_MYMODULE_DISPLAY', 'How Many Tables to Display'); -define('_MB_MYMODULE_TITLE_LENGTH', 'Title Length'); -define('_MB_MYMODULE_CATTODISPLAY', 'Categories to Display'); -define('_MB_MYMODULE_ALLCAT', 'All Categories'); -// Categories -define('_MB_MYMODULE_CATEGORIES_TO_DISPLAY', 'Categories to Display'); -define('_MB_MYMODULE_ALL_CATEGORIES', 'All Categories'); -define('_MB_MYMODULE_CAT_ID', 'Id'); -define('_MB_MYMODULE_CAT_NAME', 'Name'); -define('_MB_MYMODULE_CAT_LOGO', 'Logo'); -define('_MB_MYMODULE_CAT_CREATED', 'Created'); -define('_MB_MYMODULE_CAT_SUBMITTER', 'Submitter'); -// Articles -define('_MB_MYMODULE_ARTICLES_TO_DISPLAY', 'Articles to Display'); -define('_MB_MYMODULE_ALL_ARTICLES', 'All Articles'); -define('_MB_MYMODULE_ART_ID', 'Id'); -define('_MB_MYMODULE_ART_CAT', 'Cat'); -define('_MB_MYMODULE_ART_TITLE', 'Title'); -define('_MB_MYMODULE_ART_DESCR', 'Descr'); -define('_MB_MYMODULE_ART_IMG', 'Img'); -define('_MB_MYMODULE_ART_ONLINE', 'Online'); -define('_MB_MYMODULE_ART_FILE', 'File'); -define('_MB_MYMODULE_ART_CREATED', 'Created'); -define('_MB_MYMODULE_ART_SUBMITTER', 'Submitter'); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/german/common.php b/testdata/mymodule/language/german/common.php deleted file mode 100644 index 214982f0..00000000 --- a/testdata/mymodule/language/german/common.php +++ /dev/null @@ -1,183 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/testdata/mymodule/language/german/feedback.php b/testdata/mymodule/language/german/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/testdata/mymodule/language/german/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/testdata/mymodule/language/german/help/help.html b/testdata/mymodule/language/german/help/help.html deleted file mode 100644 index eb02b585..00000000 --- a/testdata/mymodule/language/german/help/help.html +++ /dev/null @@ -1,27 +0,0 @@ -
      -

      Help: - My Module Back to the Administration of My Module -

      - -

      Description

      -

      - The My Module module can be used to modules in XOOPS

      -

      -

      Install/uninstall

      -

      -No special measures necessary, follow the standard installation process and extract the mymodule 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 TDMCreate 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 -

      - -
      \ No newline at end of file diff --git a/testdata/mymodule/language/german/help/index.html b/testdata/mymodule/language/german/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/german/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/language/german/index.html b/testdata/mymodule/language/german/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/german/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/language/german/mail_template/category_new_notify.tpl b/testdata/mymodule/language/german/mail_template/category_new_notify.tpl deleted file mode 100644 index 15071a28..00000000 --- a/testdata/mymodule/language/german/mail_template/category_new_notify.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, - -A new story "{STORY_NAME}" has been added at {X_SITENAME}. - -You can view this story here: -{STORY_URL} - ------------ - -You are receiving this message because you selected to be notified when new stories are added to our site. - -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} - -Please do not reply to this message. - ------------ - -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} \ No newline at end of file diff --git a/testdata/mymodule/language/german/mail_template/index.html b/testdata/mymodule/language/german/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/german/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/language/german/main.php b/testdata/mymodule/language/german/main.php deleted file mode 100644 index dad194dd..00000000 --- a/testdata/mymodule/language/german/main.php +++ /dev/null @@ -1,77 +0,0 @@ - - Website: - */ - -// ---------------- Main ---------------- -define('_MA_MYMODULE_INDEX', 'Home'); -define('_MA_MYMODULE_TITLE', 'My Module'); -define('_MA_MYMODULE_DESC', 'This module is for doing following...'); -define('_MA_MYMODULE_INDEX_DESC', "Welcome to the homepage of your new module My Module!
      -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."); -define('_MA_MYMODULE_NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); -define('_MA_MYMODULE_NO', 'No'); -// ---------------- Contents ---------------- -// Category -define('_MA_MYMODULE_CATEGORY', 'Category'); -define('_MA_MYMODULE_CATEGORIES', 'Categories'); -define('_MA_MYMODULE_CATEGORIES_TITLE', 'Categories title'); -define('_MA_MYMODULE_CATEGORIES_DESC', 'Categories description'); -// Caption of Category -define('_MA_MYMODULE_CATEGORY_ID', 'Id'); -define('_MA_MYMODULE_CATEGORY_NAME', 'Name'); -define('_MA_MYMODULE_CATEGORY_LOGO', 'Logo'); -define('_MA_MYMODULE_CATEGORY_CREATED', 'Created'); -define('_MA_MYMODULE_CATEGORY_SUBMITTER', 'Submitter'); -// Article -define('_MA_MYMODULE_ARTICLE', 'Article'); -define('_MA_MYMODULE_ARTICLES', 'Articles'); -define('_MA_MYMODULE_ARTICLES_TITLE', 'Articles title'); -define('_MA_MYMODULE_ARTICLES_DESC', 'Articles description'); -// Caption of Article -define('_MA_MYMODULE_ARTICLE_ID', 'Id'); -define('_MA_MYMODULE_ARTICLE_CAT', 'Cat'); -define('_MA_MYMODULE_ARTICLE_TITLE', 'Title'); -define('_MA_MYMODULE_ARTICLE_DESCR', 'Descr'); -define('_MA_MYMODULE_ARTICLE_IMG', 'Img'); -define('_MA_MYMODULE_ARTICLE_ONLINE', 'Online'); -define('_MA_MYMODULE_ARTICLE_FILE', 'File'); -define('_MA_MYMODULE_ARTICLE_CREATED', 'Created'); -define('_MA_MYMODULE_ARTICLE_SUBMITTER', 'Submitter'); -define('_MA_MYMODULE_INDEX_THEREARE', 'There are %s Articles'); -define('_MA_MYMODULE_INDEX_LATEST_LIST', 'Last My Module'); -// Submit -define('_MA_MYMODULE_SUBMIT', 'Submit'); -define('_MA_MYMODULE_SUBMIT_ARTICLE', 'Submit Article'); -define('_MA_MYMODULE_SUBMIT_ALLPENDING', 'All article/script information are posted pending verification.'); -define('_MA_MYMODULE_SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); -define('_MA_MYMODULE_SUBMIT_ISAPPROVED', 'Your article has been approved'); -define('_MA_MYMODULE_SUBMIT_PROPOSER', 'Submit a article'); -define('_MA_MYMODULE_SUBMIT_RECEIVED', 'We have received your article info. Thank you !'); -define('_MA_MYMODULE_SUBMIT_SUBMITONCE', 'Submit your article/script only once.'); -define('_MA_MYMODULE_SUBMIT_TAKEDAYS', 'This will take many days to see your article/script added successfully in our database.'); -// Form -define('_MA_MYMODULE_FORM_OK', 'Successfully saved'); -define('_MA_MYMODULE_FORM_DELETE_OK', 'Successfully deleted'); -define('_MA_MYMODULE_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_MA_MYMODULE_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Admin link -define('_MA_MYMODULE_ADMIN', 'Admin'); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/german/modinfo.php b/testdata/mymodule/language/german/modinfo.php deleted file mode 100644 index ea3ce177..00000000 --- a/testdata/mymodule/language/german/modinfo.php +++ /dev/null @@ -1,166 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Main ---------------- -define('_MI_MYMODULE_NAME', 'My Module'); -define('_MI_MYMODULE_DESC', 'This module is for doing following...'); -// ---------------- Admin Menu ---------------- -define('_MI_MYMODULE_ADMENU1', 'Dashboard'); -define('_MI_MYMODULE_ADMENU2', 'Categories'); -define('_MI_MYMODULE_ADMENU3', 'Articles'); -define('_MI_MYMODULE_ADMENU4', 'Permissions'); -define('_MI_MYMODULE_ADMENU5', 'Feedback'); -define('_MI_MYMODULE_ABOUT', 'About'); -// ---------------- Admin Nav ---------------- -define('_MI_MYMODULE_ADMIN_PAGER', 'Admin pager'); -define('_MI_MYMODULE_ADMIN_PAGER_DESC', 'Admin per page list'); -// User -define('_MI_MYMODULE_USER_PAGER', 'User pager'); -define('_MI_MYMODULE_USER_PAGER_DESC', 'User per page list'); -// Submenu -define('_MI_MYMODULE_SMNAME1', 'Index page'); -define('_MI_MYMODULE_SMNAME2', 'Articles'); -define('_MI_MYMODULE_SMNAME3', 'Submit'); -define('_MI_MYMODULE_SMNAME4', 'Search'); -// Blocks -define('_MI_MYMODULE_CATEGORIES_BLOCK', 'Categories block'); -define('_MI_MYMODULE_CATEGORIES_BLOCK_DESC', 'Categories block description'); -define('_MI_MYMODULE_CATEGORIES_BLOCK_CATEGORY', 'Categories block CATEGORY'); -define('_MI_MYMODULE_CATEGORIES_BLOCK_CATEGORY_DESC', 'Categories block CATEGORY description'); -define('_MI_MYMODULE_ARTICLES_BLOCK', 'Articles block'); -define('_MI_MYMODULE_ARTICLES_BLOCK_DESC', 'Articles block description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_ARTICLE', 'Articles block ARTICLE'); -define('_MI_MYMODULE_ARTICLES_BLOCK_ARTICLE_DESC', 'Articles block ARTICLE description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_LAST', 'Articles block last'); -define('_MI_MYMODULE_ARTICLES_BLOCK_LAST_DESC', 'Articles block last description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_NEW', 'Articles block new'); -define('_MI_MYMODULE_ARTICLES_BLOCK_NEW_DESC', 'Articles block new description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_HITS', 'Articles block hits'); -define('_MI_MYMODULE_ARTICLES_BLOCK_HITS_DESC', 'Articles block hits description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_TOP', 'Articles block top'); -define('_MI_MYMODULE_ARTICLES_BLOCK_TOP_DESC', 'Articles block top description'); -define('_MI_MYMODULE_ARTICLES_BLOCK_RANDOM', 'Articles block random'); -define('_MI_MYMODULE_ARTICLES_BLOCK_RANDOM_DESC', 'Articles block random description'); -// Config -define('_MI_MYMODULE_EDITOR_DESCR', 'Editor'); -define('_MI_MYMODULE_EDITOR_DESCR_DESC', 'Select the Editor Descr to use'); -define('_MI_MYMODULE_KEYWORDS', 'Keywords'); -define('_MI_MYMODULE_KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); -define('_MI_MYMODULE_MAXSIZE', 'Max size'); -define('_MI_MYMODULE_MAXSIZE_DESC', 'Set a number of max size uploads files in byte'); -define('_MI_MYMODULE_MIMETYPES', 'Mime Types'); -define('_MI_MYMODULE_MIMETYPES_DESC', 'Set the mime types selected'); -define('_MI_MYMODULE_USE_TAG', 'Use TAG'); -define('_MI_MYMODULE_USE_TAG_DESC', 'If you use tag module, check this option to yes'); -define('_MI_MYMODULE_NUMB_COL', 'Number Columns'); -define('_MI_MYMODULE_NUMB_COL_DESC', 'Number Columns to View.'); -define('_MI_MYMODULE_DIVIDEBY', 'Divide By'); -define('_MI_MYMODULE_DIVIDEBY_DESC', 'Divide by columns number.'); -define('_MI_MYMODULE_TABLE_TYPE', 'Table Type'); -define('_MI_MYMODULE_TABLE_TYPE_DESC', 'Table Type is the bootstrap html table.'); -define('_MI_MYMODULE_PANEL_TYPE', 'Panel Type'); -define('_MI_MYMODULE_PANEL_TYPE_DESC', 'Panel Type is the bootstrap html div.'); -define('_MI_MYMODULE_IDPAYPAL', 'Paypal ID'); -define('_MI_MYMODULE_IDPAYPAL_DESC', 'Insert here your PayPal ID for donactions.'); -define('_MI_MYMODULE_ADVERTISE', 'Advertisement Code'); -define('_MI_MYMODULE_ADVERTISE_DESC', 'Insert here the advertisement code'); -define('_MI_MYMODULE_MAINTAINEDBY', 'Maintained By'); -define('_MI_MYMODULE_MAINTAINEDBY_DESC', 'Allow url of support site or community'); -define('_MI_MYMODULE_BOOKMARKS', 'Social Bookmarks'); -define('_MI_MYMODULE_BOOKMARKS_DESC', 'Show Social Bookmarks in the single page'); -define('_MI_MYMODULE_FACEBOOK_COMMENTS', 'Facebook comments'); -define('_MI_MYMODULE_FACEBOOK_COMMENTS_DESC', 'Allow Facebook comments in the single page'); -define('_MI_MYMODULE_DISQUS_COMMENTS', 'Disqus comments'); -define('_MI_MYMODULE_DISQUS_COMMENTS_DESC', 'Allow Disqus comments in the single page'); -// Notifications -define('_MI_MYMODULE_GLOBAL_NOTIFY', 'Global notify'); -define('_MI_MYMODULE_GLOBAL_NOTIFY_DESC', 'Global notify desc'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY', 'Global modify notify'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_CAPTION', 'Global modify notify caption'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_DESC', 'Global modify notify desc'); -define('_MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_SUBJECT', 'Global modify notify subject'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY', 'Global broken notify'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_CAPTION', 'Global broken notify caption'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_DESC', 'Global broken notify desc'); -define('_MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_SUBJECT', 'Global broken notify subject'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY', 'Global submit notify'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_CAPTION', 'Global submit notify caption'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_DESC', 'Global submit notify desc'); -define('_MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_SUBJECT', 'Global submit notify subject'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY', 'Global new notify'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY_CAPTION', 'Global new notify caption'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY_DESC', 'Global new notify desc'); -define('_MI_MYMODULE_GLOBAL_NEW_NOTIFY_SUBJECT', 'Global new notify subject'); -define('_MI_MYMODULE_CATEGORY_NOTIFY', 'Category notify'); -define('_MI_MYMODULE_CATEGORY_NOTIFY_DESC', 'Category notify desc'); -define('_MI_MYMODULE_CATEGORY_NOTIFY_CAPTION', 'Category notify caption'); -define('_MI_MYMODULE_CATEGORY_NOTIFY_SUBJECT', 'Category notify Subject'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY', 'Category submit notify'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_CAPTION', 'Category submit notify caption'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_DESC', 'Category submit notify desc'); -define('_MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_SUBJECT', 'Category submit notify subject'); -define('_MI_MYMODULE_ARTICLE_NOTIFY', 'Article notify'); -define('_MI_MYMODULE_ARTICLE_NOTIFY_DESC', 'Article notify desc'); -define('_MI_MYMODULE_ARTICLE_NOTIFY_CAPTION', 'Article notify caption'); -define('_MI_MYMODULE_ARTICLE_NOTIFY_SUBJECT', 'Article notify subject'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY', 'Global newcategory notify'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION', 'Global newcategory notify caption'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_DESC', 'Global newcategory notify desc'); -define('_MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT', 'Global newcategory notify subject'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY', 'Global article modify notify'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY_CAPTION', 'Global article modify notify caption'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY_DESC', 'Global article modify notify desc'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_MODIFY_NOTIFY_SUBJECT', 'Global article modify notify subject'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY', 'Global article broken notify'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY_CAPTION', 'Global article broken notify caption'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY_DESC', 'Global article broken notify desc'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_BROKEN_NOTIFY_SUBJECT', 'Global article broken notify subject'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY', 'Global article submit notify'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY_CAPTION', 'Global article submit notify caption'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY_DESC', 'Global article submit notify desc'); -define('_MI_MYMODULE_GLOBAL_ARTICLE_SUBMIT_NOTIFY_SUBJECT', 'Global article submit notify subject'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY', 'Global new article notify'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY_CAPTION', 'Global new article notify caption'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY_DESC', 'Global new article notify desc'); -define('_MI_MYMODULE_GLOBAL_NEW_ARTICLE_NOTIFY_SUBJECT', 'Global new article notify subject'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY', 'Category article submit notify'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY_CAPTION', 'Category article submit notify caption'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY_DESC', 'Category article submit notify desc'); -define('_MI_MYMODULE_CATEGORY_ARTICLE_SUBMIT_NOTIFY_SUBJECT', 'Category article submit notify subject'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY', 'Category new article notify'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY_CAPTION', 'Category new article notify caption'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY_DESC', 'Category new article notify desc'); -define('_MI_MYMODULE_CATEGORY_NEW_ARTICLE_NOTIFY_SUBJECT', 'Category new article notify subject'); -define('_MI_MYMODULE_APPROVE_NOTIFY', 'Article approve notify'); -define('_MI_MYMODULE_APPROVE_NOTIFY_CAPTION', 'Article approve notify caption'); -define('_MI_MYMODULE_APPROVE_NOTIFY_DESC', 'Article approve notify desc'); -define('_MI_MYMODULE_APPROVE_NOTIFY_SUBJECT', 'Article approve notify subject'); -// Permissions Groups -define('_MI_MYMODULE_GROUPS', 'Groups access'); -define('_MI_MYMODULE_GROUPS_DESC', 'Select general access permission for groups.'); -define('_MI_MYMODULE_ADMIN_GROUPS', 'Admin Group Permissions'); -define('_MI_MYMODULE_ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); -define('_MI_MYMODULE_UPLOAD_GROUPS', 'Upload Group Permissions'); -define('_MI_MYMODULE_UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); -// ---------------- End ---------------- diff --git a/testdata/mymodule/language/index.html b/testdata/mymodule/language/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/language/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/list.tag.php b/testdata/mymodule/list.tag.php deleted file mode 100644 index 01388ff3..00000000 --- a/testdata/mymodule/list.tag.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -include XOOPS_ROOT_PATH . '/modules/tag/list.tag.php'; diff --git a/testdata/mymodule/notification_update.php b/testdata/mymodule/notification_update.php deleted file mode 100644 index 0ae4d067..00000000 --- a/testdata/mymodule/notification_update.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include XOOPS_ROOT_PATH . '/include/notification_update.php'; diff --git a/testdata/mymodule/pdf.php b/testdata/mymodule/pdf.php deleted file mode 100644 index d965c5f3..00000000 --- a/testdata/mymodule/pdf.php +++ /dev/null @@ -1,102 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$artId = Request::getInt('art_id'); -if(file_exists($tcpdf = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php')) { - require_once $tcpdf; -} else { - redirect_header('articles.php', 2, _MA_MYMODULE_NO_PDF_LIBRARY); -} -// Get Instance of Handler -$articlesHandler = $helper->getHandler('articles'); -$articles = $this->getVar('art_id'); - -$pdfData['title'] = strip_tags($pdfContent->getVar('art_title')); -$pdfData['content'] = strip_tags($pdfContent->getVar('art_descr')); -$pdfData['date'] = formatTimeStamp($pdfContent->getVar('art_created'), 's'); -$pdfData['author'] = \XoopsUser::getUnameFromId($pdfContent->getVar('art_submitter')); - -// Get Config -$pdfData['creator'] = $GLOBALS['xoopsConfig']['xoops_sitename']; -$pdfData['subject'] = $GLOBALS['xoopsConfig']['slogan']; -$pdfData['keywords'] = $GLOBALS['xoopsConfig']['keywords']; -// Defines -define('MYMODULE_CREATOR', $pdfData['creator']); -define('MYMODULE_AUTHOR', $pdfData['author']); -define('MYMODULE_HEADER_TITLE', $pdfData['title']); -define('MYMODULE_HEADER_STRING', $pdfData['subject']); -define('MYMODULE_HEADER_LOGO', 'logo.gif'); -define('MYMODULE_IMAGES_PATH', XOOPS_ROOT_PATH.'/images/'); -$myts = MyTextSanitizer::getInstance(); -$content = ''; -$content .= $myts->undoHtmlSpecialChars($pdfData['content']); -$content = $myts->displayTarea($content); -$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, _CHARSET, false); -$title = $myts->undoHtmlSpecialChars($pdfData['title']); -$keywords = $myts->undoHtmlSpecialChars($pdfData['keywords']); -$pdfData['fontsize'] = 12; -// For schinese -if(_LANGCODE == 'cn') { - $pdf->SetFont('gbsn00lp', '', $pdfData['fontsize']); -} else { - $pdf->SetFont($pdfData['fontname'], '', $pdfData['fontsize']); -} -// Set document information -$pdf->SetCreator($pdfData['creator']); -$pdf->SetAuthor($pdfData['author']); -$pdf->SetTitle($title); -$pdf->SetKeywords($keywords); -// Set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, MYMODULE_HEADER_TITLE, MYMODULE_HEADER_STRING); -// Set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT); -// Set auto page breaks -$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor -if(_LANGCODE == 'cn') { - $pdf->setHeaderFont(array('gbsn00lp', '', $pdfData['fontsize'])); - $pdf->setFooterFont(array('gbsn00lp', '', $pdfData['fontsize'])); -} else { - $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); -} -// Set some language-dependent strings (optional) -if(@file_exists($lang = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php')) { - require_once $lang . '/.php'; - $pdf->setLanguageArray($l); -} -// Initialize document -$pdf->AliasNbPages(); -// Add Page document -$pdf->AddPage(); -$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $content, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); -// Pdf Filename -// Output -$GLOBALS['xoopsTpl']->assign('pdfoutput', $pdf->Output('articles.pdf', 'I')); -$GLOBALS['xoopsTpl']->display('db:mymodule_pdf.tpl'); diff --git a/testdata/mymodule/preloads/autoloader.php b/testdata/mymodule/preloads/autoloader.php deleted file mode 100644 index e23c6e01..00000000 --- a/testdata/mymodule/preloads/autoloader.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access.'); - -/** - * Class MymoduleCorePreload - */ -class MymoduleCorePreload extends \XoopsPreloadItem -{ - // to add PSR-4 autoloader - - /** - * @param $args - */ - public static function eventCoreIncludeCommonEnd($args) - { - include __DIR__ . '/autoloader.php'; - } -} diff --git a/testdata/mymodule/preloads/index.html b/testdata/mymodule/preloads/index.html deleted file mode 100644 index e8525b61..00000000 --- a/testdata/mymodule/preloads/index.html +++ /dev/null @@ -1,3 +0,0 @@ -' . _AM_CONTENT_CREATED . ' - -' . _AM_CONTENT_CREATED . ' diff --git a/testdata/mymodule/print.php b/testdata/mymodule/print.php deleted file mode 100644 index 3e6f6a95..00000000 --- a/testdata/mymodule/print.php +++ /dev/null @@ -1,49 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$artId = Request::getInt('art_id'); -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -if(empty($artId)) { - redirect_header(MYMODULE_URL . '/index.php', 2, _MA_MYMODULE_NOARTID); -} -// Get Instance of Handler -$articlesHandler = $helper->getHandler('articles'); -// Verify that the article is published -$articles = $articlesHandler->get($artId); -// Verify permissions -if(!$gpermHandler->checkRight('mymodule_view', $artId->getVar('art_id'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) { - redirect_header(MYMODULE_URL . '/index.php', 3, _NOPERM); - exit(); -} -$article = $articles->getValuesArticles(); -foreach($article as $k => $v) { - $GLOBALS['xoopsTpl']->append('"{$k}"', $v); -} -$GLOBALS['xoopsTpl']->assign('xoops_sitename', $GLOBALS['xoopsConfig']['sitename']); -$GLOBALS['xoopsTpl']->assign('xoops_pagetitle', strip_tags($article->getVar('art_title') - _MA_MYMODULE_PRINT - $GLOBALS['xoopsModule']->name())); -$GLOBALS['xoopsTpl']->display('db:articles_print.tpl'); diff --git a/testdata/mymodule/rate.php b/testdata/mymodule/rate.php deleted file mode 100644 index 0e75f236..00000000 --- a/testdata/mymodule/rate.php +++ /dev/null @@ -1,116 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$op = Request::getString('op', 'form'); -$lid = Request::getInt('lid'); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_articles.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE_RATE; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE_RATE . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE_RATE)); - // Form Create - $articlesObj = $articlesHandler->create(); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if($GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $articlesObj = $articlesHandler->create(); - $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0)); - $articlesObj->setVar('art_title', Request::getString('art_title', '')); - $articlesObj->setVar('art_descr', Request::getString('art_descr', '')); - // Set Var art_img - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_IMAGE_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['attachedfile']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_img', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_img', Request::getString('art_img')); - } - $articlesObj->setVar('art_online', Request::getInt('art_online', 0)); - // Set Var art_file - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_FILES_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['art_file']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_file', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_file', Request::getString('art_file')); - } - $articleCreated = date_create_from_format(_SHORTDATESTRING, $_POST['art_created']); - $articlesObj->setVar('art_created', $articleCreated->getTimestamp()); - $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0)); - // Insert Data - if($articles1->insert($articlesObj)) { - redirect_header('index.php', 2, _MA_MYMODULE_FORM_OK); - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - - break; -} -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => RATE_MA_MYMODULE_]; -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/rss.php b/testdata/mymodule/rss.php deleted file mode 100644 index e98c114e..00000000 --- a/testdata/mymodule/rss.php +++ /dev/null @@ -1,101 +0,0 @@ - - Website: - */ - -use Xmf\Request; - -require __DIR__ . '/header.php'; - -$cid = Request::getInt('cid', 0, 'GET'); -include_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 = mymoduleMyGetItemIds('mymodule_view', 'mymodule'); -$criteria = new \CriteriaCompo(); - -$criteria->add(new \Criteria('cat_status', 0, '!=')); -$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')','IN')); -if ($cid != 0){ - $criteria->add(new \Criteria('cid', $cid)); - $articles = $articlesHandler->get($cid); - $title = $xoopsConfig['sitename'] . ' - ' . $xoopsModule->getVar('name') . ' - ' . $articles->getVar('art_submitter'); -} else { - $title = $xoopsConfig['sitename'] . ' - ' . $xoopsModule->getVar('name'); -} -$criteria->setLimit($helper->getConfig('perpagerss')); -$criteria->setSort('date'); -$criteria->setOrder('DESC'); -$articlesArr = $articlesHandler->getAll($criteria); -unset($criteria); - -if (!$tpl->is_cached('db:mymodule_rss.tpl', $cid)) { - $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('art_submitter'), ENT_QUOTES)); - $tpl->assign('channel_language', _LANGCODE); - if ( _LANGCODE == 'fr' ) { - $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($articlesArr) as $i) { - $description = $articlesArr[$i]->getVar('description'); - //permet d'afficher uniquement la description courte - if (strpos($description,'[pagebreak]')==false){ - $description_short = $description; - } else { - $description_short = substr($description,0,strpos($description,'[pagebreak]')); - } - $tpl->append('items', array('title' => htmlspecialchars($articlesArr[$i]->getVar('art_submitter'), ENT_QUOTES), - 'link' => XOOPS_URL . '/modules/mymodule/single.php?cid=' . $articlesArr[$i]->getVar('cid') . '&art_id=' . $articlesArr[$i]->getVar('art_id'), - 'guid' => XOOPS_URL . '/modules/mymodule/single.php?cid=' . $articlesArr[$i]->getVar('cid') . '&art_id=' . $articlesArr[$i]->getVar('art_id'), - 'pubdate' => formatTimestamp($articlesArr[$i]->getVar('date'), 'rss'), - 'description' => htmlspecialchars($description_short, ENT_QUOTES))); - } -} -header('Content-Type:text/xml; charset=' . _CHARSET); -$tpl->display('db:mymodule_rss.tpl', $cid); \ No newline at end of file diff --git a/testdata/mymodule/search.php b/testdata/mymodule/search.php deleted file mode 100644 index e68c7613..00000000 --- a/testdata/mymodule/search.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$artId = Request::getInt('art_id', 0); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_index.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// ------------------- Define Stylesheet ------------------- // -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = array(); -// ------------------- Breadcrumbs ------------------- // -$xoBreadcrumbs[] = ['title' => ARTICLES_MA_MYMODULE_]; -// ------------------- Keywords ------------------- // -mymoduleMetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// ------------------- Description ------------------- // -mymoduleMetaDescription(DESC_MA_MYMODULE__DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/single.php b/testdata/mymodule/single.php deleted file mode 100644 index b1441978..00000000 --- a/testdata/mymodule/single.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -$artId = Request::getInt('art_id', 0); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_single.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = array(); -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE_ARTICLES]; -// Keywords -mymoduleMetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// Description -mymoduleMetaDescription(_MA_MYMODULE_ARTICLES_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule_upload_url', MYMODULE_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/sql/index.html b/testdata/mymodule/sql/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/sql/mysql.sql b/testdata/mymodule/sql/mysql.sql deleted file mode 100644 index 91051657..00000000 --- a/testdata/mymodule/sql/mysql.sql +++ /dev/null @@ -1,39 +0,0 @@ -# SQL Dump for my module module -# PhpMyAdmin Version: 4.0.4 -# http://www.phpmyadmin.net -# -# Host: localhost -# Generated on: Tue Apr 07, 2020 to 18:14:42 -# Server version: 5.5.5-10.4.10-MariaDB -# PHP Version: 7.3.12 - -# -# Structure table for `mymodule_categories` 5 -# - -CREATE TABLE `mymodule_categories` ( - `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `cat_name` VARCHAR(200) NOT NULL DEFAULT '', - `cat_logo` VARCHAR(200) NOT NULL DEFAULT '', - `cat_created` INT(10) NOT NULL DEFAULT '0', - `cat_submitter` INT(8) NOT NULL DEFAULT '0', - PRIMARY KEY (`cat_id`) -) ENGINE=InnoDB; - -# -# Structure table for `mymodule_articles` 9 -# - -CREATE TABLE `mymodule_articles` ( - `art_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `art_cat` INT(8) NOT NULL DEFAULT '0', - `art_title` VARCHAR(200) NOT NULL DEFAULT '', - `art_descr` MEDIUMTEXT NOT NULL , - `art_img` VARCHAR(200) NULL DEFAULT '''', - `art_online` TINYINT(1) NOT NULL DEFAULT '0', - `art_file` VARCHAR(200) NOT NULL DEFAULT '', - `art_created` INT(10) NOT NULL DEFAULT '0', - `art_submitter` INT(10) NOT NULL DEFAULT '0', - PRIMARY KEY (`art_id`) -) ENGINE=InnoDB; - diff --git a/testdata/mymodule/submit.php b/testdata/mymodule/submit.php deleted file mode 100644 index 9cafd794..00000000 --- a/testdata/mymodule/submit.php +++ /dev/null @@ -1,123 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule; -use XoopsModules\Mymodule\Constants; - -require __DIR__ . '/header.php'; -xoops_loadLanguage('admin', 'mymodule'); -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'form'); -// Template -$GLOBALS['xoopsOption']['template_main'] = 'mymodule_submit.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$permSubmit = $gpermHandler->checkRight('mymodule_ac', 4, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; -// Redirection if not permissions -if($permSubmit === false) { - redirect_header('index.php', 2, _NOPERM); - exit(); -} -switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE_SUBMIT_PROPOSER; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE_SUBMIT_PROPOSER . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE_SUBMIT_PROPOSER)); - // Form Create - $articlesObj = $articlesHandler->create(); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if(!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $articlesObj = $articlesHandler->create(); - $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0)); - $articlesObj->setVar('art_title', Request::getString('art_title', '')); - $articlesObj->setVar('art_descr', Request::getString('art_descr', '')); - // Set Var art_img - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_IMAGE_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['attachedfile']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_img', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_img', Request::getString('art_img')); - } - $articlesObj->setVar('art_online', Request::getInt('art_online', 0)); - // Set Var art_file - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(MYMODULE_UPLOAD_FILES_PATH . '/articles/', - $helper->getConfig('mimetypes'), - $helper->getConfig('maxsize'), null, null); - if($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $_FILES['art_file']['name']); - $imgName = str_replace(' ', '', Request::getString('art_title')) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if(!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $articlesObj->setVar('art_file', $uploader->getSavedFileName()); - } - } else { - $articlesObj->setVar('art_file', Request::getString('art_file')); - } - $articleCreated = date_create_from_format(_SHORTDATESTRING, $_POST['art_created']); - $articlesObj->setVar('art_created', $articleCreated->getTimestamp()); - $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0)); - // Insert Data - if($articlesHandler->insert($articlesObj)) { - redirect_header('index.php', 2, _MA_MYMODULE_FORM_OK); - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - - break; -} -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE_SUBMIT]; -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule/templates/admin/index.html b/testdata/mymodule/templates/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/templates/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/templates/admin/mymodule_admin_about.tpl b/testdata/mymodule/templates/admin/mymodule_admin_about.tpl deleted file mode 100644 index 5d7fdb71..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_about.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -<{includeq file='db:mymodule_admin_header.tpl'}> - - -
      <{$about}>
      - - -<{includeq file='db:mymodule_admin_footer.tpl'}> diff --git a/testdata/mymodule/templates/admin/mymodule_admin_articles.tpl b/testdata/mymodule/templates/admin/mymodule_admin_articles.tpl deleted file mode 100644 index 3e8d5e32..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_articles.tpl +++ /dev/null @@ -1,56 +0,0 @@ - -<{include file='db:mymodule_admin_header.tpl'}> - -<{if $articles_list}> - - - - - - - - - - - - - - - - <{if $articles_count}> - - <{foreach item=article from=$articles_list}> - '> - - - - - - - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE_ARTICLE_ID}><{$smarty.const._AM_MYMODULE_ARTICLE_CAT}><{$smarty.const._AM_MYMODULE_ARTICLE_TITLE}><{$smarty.const._AM_MYMODULE_ARTICLE_DESCR}><{$smarty.const._AM_MYMODULE_ARTICLE_IMG}><{$smarty.const._AM_MYMODULE_ARTICLE_ONLINE}><{$smarty.const._AM_MYMODULE_ARTICLE_FILE}><{$smarty.const._AM_MYMODULE_ARTICLE_CREATED}><{$smarty.const._AM_MYMODULE_ARTICLE_SUBMITTER}><{$smarty.const._AM_MYMODULE_FORM_ACTION}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articles<{$article.online}><{$article.file}><{$article.created}><{$article.submitter}> - articles - articles -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule_admin_footer.tpl'}> diff --git a/testdata/mymodule/templates/admin/mymodule_admin_categories.tpl b/testdata/mymodule/templates/admin/mymodule_admin_categories.tpl deleted file mode 100644 index d4d2cd1a..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_categories.tpl +++ /dev/null @@ -1,44 +0,0 @@ - -<{include file='db:mymodule_admin_header.tpl'}> - -<{if $categories_list}> - - - - - - - - - - <{if $categories_count}> - - <{foreach item=category from=$categories_list}> - '> - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE_CATEGORY_ID}><{$smarty.const._AM_MYMODULE_CATEGORY_NAME}><{$smarty.const._AM_MYMODULE_CATEGORY_CREATED}><{$smarty.const._AM_MYMODULE_FORM_ACTION}>
      <{$category.id}><{$category.name}><{$category.created}> - categories - categories -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule_admin_footer.tpl'}> diff --git a/testdata/mymodule/templates/admin/mymodule_admin_footer.tpl b/testdata/mymodule/templates/admin/mymodule_admin_footer.tpl deleted file mode 100644 index f1c4d56a..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_footer.tpl +++ /dev/null @@ -1,6 +0,0 @@ -
      - XOOPS -
      -
      - My Module<{$smarty.const._AM_MYMODULE_MAINTAINEDBY}>Support Forum -
      diff --git a/testdata/mymodule/templates/admin/mymodule_admin_header.tpl b/testdata/mymodule/templates/admin/mymodule_admin_header.tpl deleted file mode 100644 index 95b90868..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_header.tpl +++ /dev/null @@ -1,6 +0,0 @@ -
      - <{$navigation}> - <{if $buttons}> - <{$buttons}> - <{/if}> -
      diff --git a/testdata/mymodule/templates/admin/mymodule_admin_index.tpl b/testdata/mymodule/templates/admin/mymodule_admin_index.tpl deleted file mode 100644 index ef033e60..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_index.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -<{includeq file='db:mymodule_admin_header.tpl'}> - - -
      <{$index}>
      - - -<{includeq file='db:mymodule_admin_footer.tpl'}> diff --git a/testdata/mymodule/templates/admin/mymodule_admin_permissions.tpl b/testdata/mymodule/templates/admin/mymodule_admin_permissions.tpl deleted file mode 100644 index 243244be..00000000 --- a/testdata/mymodule/templates/admin/mymodule_admin_permissions.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<{include file='db:mymodule_admin_header.tpl'}> - -
      <{$form}>
      - -<{include file='db:mymodule_admin_footer.tpl'}> diff --git a/testdata/mymodule/templates/blocks/index.html b/testdata/mymodule/templates/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/templates/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/templates/blocks/mymodule_block_articles.tpl b/testdata/mymodule/templates/blocks/mymodule_block_articles.tpl deleted file mode 100644 index f175d749..00000000 --- a/testdata/mymodule/templates/blocks/mymodule_block_articles.tpl +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - <{if count($block)}> - - <{foreach item=article from=$block}> - "> - - - - - - - - - - - <{/foreach}> - - <{/if}> - -
      <{$smarty.const._MB_MYMODULE_ART_ID}><{$smarty.const._MB_MYMODULE_ART_CAT}><{$smarty.const._MB_MYMODULE_ART_TITLE}><{$smarty.const._MB_MYMODULE_ART_DESCR}><{$smarty.const._MB_MYMODULE_ART_IMG}><{$smarty.const._MB_MYMODULE_ART_ONLINE}><{$smarty.const._MB_MYMODULE_ART_FILE}><{$smarty.const._MB_MYMODULE_ART_CREATED}><{$smarty.const._MB_MYMODULE_ART_SUBMITTER}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articles<{$article.online}><{$article.file}><{$article.created}><{$article.submitter}> - articles - articles -
       
      diff --git a/testdata/mymodule/templates/index.html b/testdata/mymodule/templates/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/templates/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/templates/mymodule_articles.tpl b/testdata/mymodule/templates/mymodule_articles.tpl deleted file mode 100644 index 423f88b2..00000000 --- a/testdata/mymodule/templates/mymodule_articles.tpl +++ /dev/null @@ -1,30 +0,0 @@ -<{include file='db:mymodule_header.tpl'}> - -<{if $articlesCount > 0}> -
      - - - - - - - - - <{foreach item=article from=$articles}> - - <{if $article.count is div by $divideby}> - - <{/if}> - <{/foreach}> - - - -
      <{$smarty.const._MA_MYMODULE_ARTICLES_TITLE}>
      -
      - <{include file='db:mymodule_articles_list.tpl' article=$article}> -
      -
       
      -
      -<{/if}> - -<{include file='db:mymodule_footer.tpl'}> diff --git a/testdata/mymodule/templates/mymodule_articles_cat.tpl b/testdata/mymodule/templates/mymodule_articles_cat.tpl deleted file mode 100644 index 115942ad..00000000 --- a/testdata/mymodule/templates/mymodule_articles_cat.tpl +++ /dev/null @@ -1,20 +0,0 @@ -<{include file='db:mymodule_header.tpl'}> - -
      -
      -<{$smarty.const._MA_MYMODULE_ARTICLES_TITLE}>
      - -<{foreach item=article from=$articles}> -
      -<{include file='db:mymodule_articles_list.tpl' article=$article}> -<{if $article.count is div by $numb_col}> -
      -<{/if}> - -
      - -<{/foreach}> - -
      - -<{include file='db:mymodule_footer.tpl'}> diff --git a/testdata/mymodule/templates/mymodule_articles_cat_list.tpl b/testdata/mymodule/templates/mymodule_articles_cat_list.tpl deleted file mode 100644 index 9fc1a67c..00000000 --- a/testdata/mymodule/templates/mymodule_articles_cat_list.tpl +++ /dev/null @@ -1,20 +0,0 @@ -
      -
      - -
      -<{$article.cat}> - -<{$article.title}> - -<{$article.descr}> - -articles - -<{$article.file}> - -<{$article.created}> - -<{$article.submitter}> - -
      - diff --git a/testdata/mymodule/templates/mymodule_articles_list.tpl b/testdata/mymodule/templates/mymodule_articles_list.tpl deleted file mode 100644 index dff78ecd..00000000 --- a/testdata/mymodule/templates/mymodule_articles_list.tpl +++ /dev/null @@ -1,21 +0,0 @@ -
      -

      <{$article.submitter}>

      -
      -
      - <{$article.cat}> - <{$article.title}> - <{$article.descr}> - articles - <{$article.file}> - <{$article.created}> - <{$article.submitter}> -
      -
      - <{$smarty.const._MA_MYMODULE_ARTICLE_CAT}>: <{$article.cat}> - <{$smarty.const._MA_MYMODULE_ARTICLE_TITLE}>: <{$article.title}> - <{$smarty.const._MA_MYMODULE_ARTICLE_DESCR}>: <{$article.descr}> - <{$smarty.const._MA_MYMODULE_ARTICLE_IMG}>: <{$article.img}> - <{$smarty.const._MA_MYMODULE_ARTICLE_FILE}>: <{$article.file}> - <{$smarty.const._MA_MYMODULE_ARTICLE_CREATED}>: <{$article.created}> - <{$smarty.const._MA_MYMODULE_ARTICLE_SUBMITTER}>: <{$article.submitter}> -
      diff --git a/testdata/mymodule/templates/mymodule_breadcrumbs.tpl b/testdata/mymodule/templates/mymodule_breadcrumbs.tpl deleted file mode 100644 index 2290b814..00000000 --- a/testdata/mymodule/templates/mymodule_breadcrumbs.tpl +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/testdata/mymodule/templates/mymodule_broken.tpl b/testdata/mymodule/templates/mymodule_broken.tpl deleted file mode 100644 index 0fdf0fd7..00000000 --- a/testdata/mymodule/templates/mymodule_broken.tpl +++ /dev/null @@ -1,32 +0,0 @@ -<{include file='db:mymodule_header.tpl'}> - - - - - - - - - - - - - - - - <{foreach item=article from=$articles}> - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE_ART_ID}><{$smarty.const._MA_MYMODULE_ART_CAT}><{$smarty.const._MA_MYMODULE_ART_TITLE}><{$smarty.const._MA_MYMODULE_ART_DESCR}><{$smarty.const._MA_MYMODULE_ART_IMG}><{$smarty.const._MA_MYMODULE_ART_ONLINE}><{$smarty.const._MA_MYMODULE_ART_FILE}><{$smarty.const._MA_MYMODULE_ART_CREATED}><{$smarty.const._MA_MYMODULE_ART_SUBMITTER}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articles<{$article.online}><{$article.file}><{$article.created}><{$article.submitter}>
      -<{include file='db:mymodule_footer.tpl'}> diff --git a/testdata/mymodule/templates/mymodule_footer.tpl b/testdata/mymodule/templates/mymodule_footer.tpl deleted file mode 100644 index 78043a34..00000000 --- a/testdata/mymodule/templates/mymodule_footer.tpl +++ /dev/null @@ -1,27 +0,0 @@ -<{if $bookmarks != 0}> - <{include file="db:system_bookmarks.tpl"}> -<{/if}> - -<{if $fbcomments != 0}> - <{include file="db:system_fbcomments.tpl"}> -<{/if}> -
      <{$copyright}>
      -<{if $pagenav != ''}> -
      <{$pagenav}>
      -<{/if}> -
      -<{if $xoops_isadmin}> -
      -<{/if}> -
      - <{if $comment_mode == "flat"}> - <{include file="db:system_comments_flat.tpl"}> - <{elseif $comment_mode == "thread"}> - <{include file="db:system_comments_thread.tpl"}> - <{elseif $comment_mode == "nest"}> - <{include file="db:system_comments_nest.tpl"}> - <{/if}> -
      - -
      -<{include file='db:system_notification_select.tpl'}> \ No newline at end of file diff --git a/testdata/mymodule/templates/mymodule_header.tpl b/testdata/mymodule/templates/mymodule_header.tpl deleted file mode 100644 index 7c52f1b3..00000000 --- a/testdata/mymodule/templates/mymodule_header.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<{includeq file='db:mymodule_breadcrumbs.tpl'}> - -<{if $ads != ''}> -
      <{$ads}>
      -<{/if}> diff --git a/testdata/mymodule/templates/mymodule_index.tpl b/testdata/mymodule/templates/mymodule_index.tpl deleted file mode 100644 index 5ed665ae..00000000 --- a/testdata/mymodule/templates/mymodule_index.tpl +++ /dev/null @@ -1,79 +0,0 @@ -<{include file='db:mymodule_header.tpl'}> - -<{if $articlesCount == 0}> - - - - - - - - - - - - - <{if $adv != ''}> - - <{else}> - - <{/if}> - -
      <{$smarty.const._MA_MYMODULE_TITLE}> - <{$smarty.const._MA_MYMODULE_DESC}>
      - -
      <{$smarty.const._MA_MYMODULE_INDEX_DESC}>
      -
      <{$adv}>
       
      -<{/if}> -<{if $articlesCount > 0}> -
      - - - - - - - - - <{foreach item=article from=$articles}> - - <{if $article.count is div by $numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
      <{$smarty.const._MA_MYMODULE_ARTICLES}>
      - <{include file="db:mymodule_articles_list.tpl" article=$article}> -
      <{$lang_thereare}>
      -
      -<{/if}> - -<{if $articlesCount > 0}> - -
      <{$smarty.const._MA_MYMODULE_INDEX_LATEST_LIST}>
      - - - - <{section name=i loop=$articles}> - - <{if $articles[i].count is div by $divideby}> - - <{/if}> - <{/section}> - - -
      - <{include file="db:mymodule_articles_list.tpl" article=$articles[i]}> -
      - -<{/if}> -<{include file='db:mymodule_footer.tpl'}> diff --git a/testdata/mymodule/templates/mymodule_pdf.tpl b/testdata/mymodule/templates/mymodule_pdf.tpl deleted file mode 100644 index 524fd9d6..00000000 --- a/testdata/mymodule/templates/mymodule_pdf.tpl +++ /dev/null @@ -1 +0,0 @@ -
      <{$pdfoutput}>
      \ No newline at end of file diff --git a/testdata/mymodule/templates/mymodule_print.tpl b/testdata/mymodule/templates/mymodule_print.tpl deleted file mode 100644 index f55e8c7f..00000000 --- a/testdata/mymodule/templates/mymodule_print.tpl +++ /dev/null @@ -1,32 +0,0 @@ -<{include file="db:mymodule_header.tpl"}> - - - - - - - - - - - - - - - - <{foreach item=list from=$articles}> - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE_ART_ID}><{$smarty.const._MA_MYMODULE_ART_CAT}><{$smarty.const._MA_MYMODULE_ART_TITLE}><{$smarty.const._MA_MYMODULE_ART_DESCR}><{$smarty.const._MA_MYMODULE_ART_IMG}><{$smarty.const._MA_MYMODULE_ART_ONLINE}><{$smarty.const._MA_MYMODULE_ART_FILE}><{$smarty.const._MA_MYMODULE_ART_CREATED}><{$smarty.const._MA_MYMODULE_ART_SUBMITTER}>
      <{$list.id}><{$list.cat}><{$list.title}><{$list.descr}>articles<{$list.online}><{$list.file}><{$list.created}><{$list.submitter}>
      -<{include file="db:mymodule_footer.tpl"}> \ No newline at end of file diff --git a/testdata/mymodule/templates/mymodule_rate.tpl b/testdata/mymodule/templates/mymodule_rate.tpl deleted file mode 100644 index f55e8c7f..00000000 --- a/testdata/mymodule/templates/mymodule_rate.tpl +++ /dev/null @@ -1,32 +0,0 @@ -<{include file="db:mymodule_header.tpl"}> - - - - - - - - - - - - - - - - <{foreach item=list from=$articles}> - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE_ART_ID}><{$smarty.const._MA_MYMODULE_ART_CAT}><{$smarty.const._MA_MYMODULE_ART_TITLE}><{$smarty.const._MA_MYMODULE_ART_DESCR}><{$smarty.const._MA_MYMODULE_ART_IMG}><{$smarty.const._MA_MYMODULE_ART_ONLINE}><{$smarty.const._MA_MYMODULE_ART_FILE}><{$smarty.const._MA_MYMODULE_ART_CREATED}><{$smarty.const._MA_MYMODULE_ART_SUBMITTER}>
      <{$list.id}><{$list.cat}><{$list.title}><{$list.descr}>articles<{$list.online}><{$list.file}><{$list.created}><{$list.submitter}>
      -<{include file="db:mymodule_footer.tpl"}> \ No newline at end of file diff --git a/testdata/mymodule/templates/mymodule_rss.tpl b/testdata/mymodule/templates/mymodule_rss.tpl deleted file mode 100644 index 594ebe0e..00000000 --- a/testdata/mymodule/templates/mymodule_rss.tpl +++ /dev/null @@ -1,33 +0,0 @@ - - - - <{$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}> - - diff --git a/testdata/mymodule/templates/mymodule_single.tpl b/testdata/mymodule/templates/mymodule_single.tpl deleted file mode 100644 index 1f3726c7..00000000 --- a/testdata/mymodule/templates/mymodule_single.tpl +++ /dev/null @@ -1,11 +0,0 @@ -<{include file='db:mymodule_header.tpl'}> - -
      -
      -
      - -
      -
      -
      - -<{include file='db:mymodule_footer.tpl'}> diff --git a/testdata/mymodule/templates/mymodule_submit.tpl b/testdata/mymodule/templates/mymodule_submit.tpl deleted file mode 100644 index 85b9a9ce..00000000 --- a/testdata/mymodule/templates/mymodule_submit.tpl +++ /dev/null @@ -1,18 +0,0 @@ -<{include file='db:mymodule_header.tpl'}> - -
      -
        -
      • <{$smarty.const._MA_MYMODULE_SUBMIT_SUBMITONCE}>
      • -
      • <{$smarty.const._MA_MYMODULE_SUBMIT_ALLPENDING}>
      • -
      • <{$smarty.const._MA_MYMODULE_SUBMIT_DONTABUSE}>
      • -
      • <{$smarty.const._MA_MYMODULE_SUBMIT_TAKEDAYS}>
      • -
      -
      -<{if $message_error != ''}> -
      <{$message_error}>
      -<{/if}> -
      - <{$form}> -
      - -<{include file='db:mymodule_footer.tpl'}> diff --git a/testdata/mymodule/testdata/english/index.html b/testdata/mymodule/testdata/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/testdata/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/testdata/images/blank.gif b/testdata/mymodule/testdata/images/blank.gif deleted file mode 100644 index 3a469695..00000000 Binary files a/testdata/mymodule/testdata/images/blank.gif and /dev/null differ diff --git a/testdata/mymodule/testdata/images/blank.png b/testdata/mymodule/testdata/images/blank.png deleted file mode 100644 index e1ee728a..00000000 Binary files a/testdata/mymodule/testdata/images/blank.png and /dev/null differ diff --git a/testdata/mymodule/testdata/images/index.html b/testdata/mymodule/testdata/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/testdata/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/testdata/index.html b/testdata/mymodule/testdata/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule/testdata/index.php b/testdata/mymodule/testdata/index.php deleted file mode 100644 index 2379c0af..00000000 --- a/testdata/mymodule/testdata/index.php +++ /dev/null @@ -1,137 +0,0 @@ -loadLanguage('common'); - -switch ($op) { - case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('../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_cp_footer(); - } - break; - case 'save': - saveSampleData(); - break; -} - -// XMF TableLoad for SAMPLE data - -function loadSampleData() -{ - global $xoopsConfig; - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $utility = new Mymodule\Utility(); - $configurator = new Common\Configurator(); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { - $language = $xoopsConfig['language'] . '/'; - } - - foreach ($tables as $table) { - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - \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/'; - 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')); -} - -function saveSampleData() -{ - global $xoopsConfig; - - $configurator = new Common\Configurator(); - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; - if (!file_exists($languageFolder . '/')) { - Utility::createFolder($languageFolder . '/'); - } - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; - Utility::createFolder($exportFolder); - - foreach ($tables as $table) { - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); - } - - // --- 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 . '_' . 'SAMPLEDATA_SUCCESS')); -} - -function exportSchema() -{ - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - try { - // TODO set exportSchema - // $migrate = new Mymodule\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')); - } - -} diff --git a/testdata/mymodule/view.tag.php b/testdata/mymodule/view.tag.php deleted file mode 100644 index 1978fa38..00000000 --- a/testdata/mymodule/view.tag.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -include XOOPS_ROOT_PATH . '/modules/tag/view.tag.php'; diff --git a/testdata/mymodule/visit.php b/testdata/mymodule/visit.php deleted file mode 100644 index fc934942..00000000 --- a/testdata/mymodule/visit.php +++ /dev/null @@ -1,28 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\; -use XoopsModules\\Constants; - -require __DIR__ . '/header.php'; -$artId = Request::getInt('art_id', 0); diff --git a/testdata/mymodule/xoops_version.php b/testdata/mymodule/xoops_version.php deleted file mode 100644 index 0f1a866b..00000000 --- a/testdata/mymodule/xoops_version.php +++ /dev/null @@ -1,501 +0,0 @@ - - Website: - */ - -// -$moduleDirName = basename(__DIR__); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -// ------------------- Informations ------------------- // -$modversion = [ - 'name' => _MI_MYMODULE_NAME, - 'version' => 1.0, - 'description' => _MI_MYMODULE_DESC, - 'author' => 'TDM XOOPS', - 'author_mail' => 'info@email.com', - 'author_website_url' => 'http://xoops.org', - 'author_website_name' => 'XOOPS Project', - 'credits' => 'XOOPS Development Team', - 'license' => 'GPL 2.0 or later', - 'license_url' => 'http://www.gnu.org/licenses/gpl-3.0.en.html', - 'help' => 'page=help', - 'release_info' => 'release_info', - 'release_file' => XOOPS_URL . '/modules/mymodule/docs/release_info file', - 'release_date' => '2020/04/07', - 'manual' => 'link to manual file', - 'manual_file' => XOOPS_URL . '/modules/mymodule/docs/install.txt', - 'min_php' => '7.0', - 'min_xoops' => '2.5.9', - 'min_admin' => '1.2', - 'min_db' => array('mysql' => '5.6', 'mysqli' => '5.6'), - 'image' => 'assets/images/logoModule.png', - 'dirname' => basename(__DIR__), - 'dirmoduleadmin' => 'Frameworks/moduleclasses/moduleadmin', - 'sysicons16' => '../../Frameworks/moduleclasses/icons/16', - 'sysicons32' => '../../Frameworks/moduleclasses/icons/32', - 'modicons16' => 'assets/icons/16', - 'modicons32' => 'assets/icons/32', - 'demo_site_url' => 'https://xoops.org', - 'demo_site_name' => 'XOOPS Demo Site', - 'support_url' => 'https://xoops.org/modules/newbb', - 'support_name' => 'Support Forum', - 'module_website_url' => 'www.xoops.org', - 'module_website_name' => 'XOOPS Project', - 'release' => '2017-12-02', - 'module_status' => 'Beta 1', - 'system_menu' => 1, - 'hasAdmin' => 1, - 'hasMain' => 1, - 'adminindex' => 'admin/index.php', - 'adminmenu' => 'admin/menu.php', - 'onInstall' => 'include/install.php', - 'onUninstall' => 'include/uninstall.php', - 'onUpdate' => 'include/update.php', -]; -// ------------------- Templates ------------------- // -$modversion['templates'] = [ - // Admin templates - ['file' => 'mymodule_admin_about.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule_admin_header.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule_admin_index.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule_admin_categories.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule_admin_articles.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule_admin_permissions.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule_admin_footer.tpl', 'description' => '', 'type' => 'admin'], - // User templates - ['file' => 'mymodule_header.tpl', 'description' => ''], - ['file' => 'mymodule_index.tpl', 'description' => ''], - ['file' => 'mymodule_categories.tpl', 'description' => ''], - ['file' => 'mymodule_categories_list.tpl', 'description' => ''], - ['file' => 'mymodule_articles.tpl', 'description' => ''], - ['file' => 'mymodule_articles_list.tpl', 'description' => ''], - ['file' => 'mymodule_breadcrumbs.tpl', 'description' => ''], - ['file' => 'mymodule_broken.tpl', 'description' => ''], - ['file' => 'mymodule_pdf.tpl', 'description' => ''], - ['file' => 'mymodule_print.tpl', 'description' => ''], - ['file' => 'mymodule_rate.tpl', 'description' => ''], - ['file' => 'mymodule_rss.tpl', 'description' => ''], - ['file' => 'mymodule_search.tpl', 'description' => ''], - ['file' => 'mymodule_single.tpl', 'description' => ''], - ['file' => 'mymodule_submit.tpl', 'description' => ''], - ['file' => 'mymodule_footer.tpl', 'description' => ''], -]; -// ------------------- Mysql ------------------- // -$modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; -// Tables -$modversion['tables'] = [ - 'mymodule_categories', - 'mymodule_articles', -]; -// ------------------- Search ------------------- // -$modversion['hasSearch'] = 1; -$modversion['search'] = [ - 'file' => 'include/search.inc.php', - 'func' => 'mymodule_search', -]; -// ------------------- Comments ------------------- // -$modversion['comments']['pageName'] = 'comments.php'; -$modversion['comments']['itemName'] = 'com_id'; -// Comment callback functions -$modversion['comments']['callbackFile'] = 'include/comment_functions.php'; -$modversion['comments']['callback'] = [ - 'approve' => 'mymoduleCommentsApprove', - 'update' => 'mymoduleCommentsUpdate', -]; -// ------------------- Menu ------------------- // -$currdirname = isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system'; -if($moduleDirName == $currdirname) { - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE_SMNAME1, - 'url' => 'index.php', - ]; - // Sub articles - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE_SMNAME2, - 'url' => 'articles.php', - ]; - // Sub Submit - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE_SMNAME3, - 'url' => 'submit.php', - ]; - // Sub Search - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE_SMNAME4, - 'url' => 'search.php', - ]; -} -// ------------------- Blocks ------------------- // -// Articles last -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE_ARTICLES_BLOCK_LAST, - 'description' => _MI_MYMODULE_ARTICLES_BLOCK_LAST_DESC, - 'show_func' => 'b_mymodule_articles_show', - 'edit_func' => 'b_mymodule_articles_edit', - 'template' => 'mymodule_block_articles.tpl', - 'options' => 'last|5|25|0', -]; -// Articles new -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE_ARTICLES_BLOCK_NEW, - 'description' => _MI_MYMODULE_ARTICLES_BLOCK_NEW_DESC, - 'show_func' => 'b_mymodule_articles_show', - 'edit_func' => 'b_mymodule_articles_edit', - 'template' => 'mymodule_block_articles.tpl', - 'options' => 'new|5|25|0', -]; -// Articles hits -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE_ARTICLES_BLOCK_HITS, - 'description' => _MI_MYMODULE_ARTICLES_BLOCK_HITS_DESC, - 'show_func' => 'b_mymodule_articles_show', - 'edit_func' => 'b_mymodule_articles_edit', - 'template' => 'mymodule_block_articles.tpl', - 'options' => 'hits|5|25|0', -]; -// Articles top -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE_ARTICLES_BLOCK_TOP, - 'description' => _MI_MYMODULE_ARTICLES_BLOCK_TOP_DESC, - 'show_func' => 'b_mymodule_articles_show', - 'edit_func' => 'b_mymodule_articles_edit', - 'template' => 'mymodule_block_articles.tpl', - 'options' => 'top|5|25|0', -]; -// Articles random -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE_ARTICLES_BLOCK_RANDOM, - 'description' => _MI_MYMODULE_ARTICLES_BLOCK_RANDOM_DESC, - 'show_func' => 'b_mymodule_articles_show', - 'edit_func' => 'b_mymodule_articles_edit', - 'template' => 'mymodule_block_articles.tpl', - 'options' => 'random|5|25|0', -]; -// ------------------- Config ------------------- // -// Editor descr -xoops_load('xoopseditorhandler'); -$editorHandlerDescr = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_descr', - 'title' => '_MI_MYMODULE_EDITOR_DESCR', - 'description' => '_MI_MYMODULE_EDITOR_DESCR_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerDescr->getList()), -]; -// Get groups -$memberHandler = xoops_getHandler('member'); -$xoopsGroups = $memberHandler->getGroupList(); -foreach($xoopsGroups as $key => $group) { - $groups[$group] = $key; -} -// General access groups -$modversion['config'][] = [ - 'name' => 'groups', - 'title' => '_MI_MYMODULE_GROUPS', - 'description' => '_MI_MYMODULE_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $groups, - 'options' => $groups, -]; -// Upload groups -$modversion['config'][] = [ - 'name' => 'upload_groups', - 'title' => '_MI_MYMODULE_UPLOAD_GROUPS', - 'description' => '_MI_MYMODULE_UPLOAD_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $groups, - 'options' => $groups, -]; -// Get Admin groups -$criteria = new \CriteriaCompo(); -$criteria->add( new \Criteria( 'group_type', 'Admin' ) ); -$memberHandler = xoops_getHandler('member'); -$adminXoopsGroups = $memberHandler->getGroupList($criteria); -foreach($adminXoopsGroups as $key => $adminGroup) { - $adminGroups[$adminGroup] = $key; -} -$modversion['config'][] = [ - 'name' => 'admin_groups', - 'title' => '_MI_MYMODULE_ADMIN_GROUPS', - 'description' => '_MI_MYMODULE_ADMIN_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $adminGroups, - 'options' => $adminGroups, -]; -// Keywords -$modversion['config'][] = [ - 'name' => 'keywords', - 'title' => '_MI_MYMODULE_KEYWORDS', - 'description' => '_MI_MYMODULE_KEYWORDS_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'text', - 'default' => 'mymodule, categories, articles', -]; -// Uploads : maxsize of image -$modversion['config'][] = [ - 'name' => 'maxsize', - 'title' => '_MI_MYMODULE_MAXSIZE', - 'description' => '_MI_MYMODULE_MAXSIZE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 5000000, -]; -// Uploads : mimetypes of image -$modversion['config'][] = [ - 'name' => 'mimetypes', - 'title' => '_MI_MYMODULE_MIMETYPES', - 'description' => '_MI_MYMODULE_MIMETYPES_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => array('image/gif', 'image/jpeg', 'image/png'), - 'options' => array('bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png'), -]; -// Admin pager -$modversion['config'][] = [ - 'name' => 'adminpager', - 'title' => '_MI_MYMODULE_ADMIN_PAGER', - 'description' => '_MI_MYMODULE_ADMIN_PAGER_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 10, -]; -// User pager -$modversion['config'][] = [ - 'name' => 'userpager', - 'title' => '_MI_MYMODULE_USER_PAGER', - 'description' => '_MI_MYMODULE_USER_PAGER_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 10, -]; -// Use tag -$modversion['config'][] = [ - 'name' => 'usetag', - 'title' => '_MI_MYMODULE_USE_TAG', - 'description' => '_MI_MYMODULE_USE_TAG_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, -]; -// Number column -$modversion['config'][] = [ - 'name' => 'numb_col', - 'title' => '_MI_MYMODULE_NUMB_COL', - 'description' => '_MI_MYMODULE_NUMB_COL_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4'), -]; -// Divide by -$modversion['config'][] = [ - 'name' => 'divideby', - 'title' => '_MI_MYMODULE_DIVIDEBY', - 'description' => '_MI_MYMODULE_DIVIDEBY_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4'), -]; -// Table type -$modversion['config'][] = [ - 'name' => 'table_type', - 'title' => '_MI_MYMODULE_TABLE_TYPE', - 'description' => '_MI_MYMODULE_DIVIDEBY_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 'bordered', - 'options' => array('bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed'), -]; -// Panel by -$modversion['config'][] = [ - 'name' => 'panel_type', - 'title' => '_MI_MYMODULE_PANEL_TYPE', - 'description' => '_MI_MYMODULE_PANEL_TYPE_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'default', - 'options' => array('default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger'), -]; -// Advertise -$modversion['config'][] = [ - 'name' => 'advertise', - 'title' => '_MI_MYMODULE_ADVERTISE', - 'description' => '_MI_MYMODULE_ADVERTISE_DESC', - 'formtype' => 'textarea', - 'valuetype' => 'text', - 'default' => '', -]; -// Bookmarks -$modversion['config'][] = [ - 'name' => 'bookmarks', - 'title' => '_MI_MYMODULE_BOOKMARKS', - 'description' => '_MI_MYMODULE_BOOKMARKS_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, -]; -// Make Sample button visible? -$modversion['config'][] = [ - 'name' => 'displaySampleButton', - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 1, -]; -// Maintained by -$modversion['config'][] = [ - 'name' => 'maintainedby', - 'title' => '_MI_MYMODULE_MAINTAINEDBY', - 'description' => '_MI_MYMODULE_MAINTAINEDBY_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'text', - 'default' => 'https://xoops.org/modules/newbb', -]; -// ------------------- Notifications ------------------- // -$modversion['hasNotification'] = 1; -$modversion['notification'] = [ - 'lookup_file' => 'include/notification.inc.php', - 'lookup_func' => 'mymodule_notify_iteminfo', -]; -// Global Notify -$modversion['notification']['category'][1] = [ - 'name' => 'global', - 'title' => _MI_MYMODULE_GLOBAL_NOTIFY, - 'description' => _MI_MYMODULE_GLOBAL_NOTIFY_DESC, - 'subscribe_from' => array('index.php', 'articles.php'), -]; -// Category Notify -$modversion['notification']['category'][2] = [ - 'name' => 'category', - 'title' => _MI_MYMODULE_CATEGORY_NOTIFY, - 'description' => _MI_MYMODULE_CATEGORY_NOTIFY_DESC, - 'subscribe_from' => array('articles.php'), - 'item_name' => 'art_cat', - 'allow_bookmark' => 1, -]; -// Article Notify -$modversion['notification']['category'][3] = [ - 'name' => 'article', - 'title' => _MI_MYMODULE_ARTICLE_NOTIFY, - 'description' => _MI_MYMODULE_ARTICLE_NOTIFY_DESC, - 'subscribe_from' => 'articles.php', - 'item_name' => 'art_id', - 'allow_bookmark' => 1, -]; -// GLOBAL_NEW_CATEGORY Notify -$modversion['notification']['event'][1] = [ - 'name' => 'new_category', - 'category' => 'global', - 'admin_only' => 0, - 'title' => _MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY, - 'caption' => _MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_DESC, - 'mail_template' => 'global_newcategory_notify', - 'mail_subject' => _MI_MYMODULE_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT, -]; -// GLOBAL_MODIFY Notify -$modversion['notification']['event'][2] = [ - 'name' => 'modify', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE_GLOBAL_MODIFY_NOTIFY, - 'caption' => _MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_DESC, - 'mail_template' => 'global_modify_notify', - 'mail_subject' => _MI_MYMODULE_GLOBAL_MODIFY_NOTIFY_SUBJECT, -]; -// GLOBAL_BROKEN Notify -$modversion['notification']['event'][3] = [ - 'name' => 'broken', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE_GLOBAL_BROKEN_NOTIFY, - 'caption' => _MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_DESC, - 'mail_template' => 'global_broken_notify', - 'mail_subject' => _MI_MYMODULE_GLOBAL_BROKEN_NOTIFY_SUBJECT, -]; -// GLOBAL_SUBMIT Notify -$modversion['notification']['event'][4] = [ - 'name' => 'submit', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY, - 'caption' => _MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_DESC, - 'mail_template' => 'global_submit_notify', - 'mail_subject' => _MI_MYMODULE_GLOBAL_SUBMIT_NOTIFY_SUBJECT, -]; -// GLOBAL_NEW Notify -$modversion['notification']['event'][5] = [ - 'name' => 'new_article', - 'category' => 'global', - 'admin_only' => 0, - 'title' => _MI_MYMODULE_GLOBAL_NEW_NOTIFY, - 'caption' => _MI_MYMODULE_GLOBAL_NEW_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_GLOBAL_NEW_NOTIFY_DESC, - 'mail_template' => 'global_newarticle_notify', - 'mail_subject' => _MI_MYMODULE_GLOBAL_NEW_NOTIFY_SUBJECT, -]; -// CATEGORY_SUBMIT Notify -$modversion['notification']['event'][6] = [ - 'name' => 'submit', - 'category' => 'category', - 'admin_only' => 1, - 'title' => _MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY, - 'caption' => _MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_DESC, - 'mail_template' => 'category_articlesubmit_notify', - 'mail_subject' => _MI_MYMODULE_CATEGORY_SUBMIT_NOTIFY_SUBJECT, -]; -// CATEGORY Notify -$modversion['notification']['event'][7] = [ - 'name' => 'new_category', - 'category' => 'category', - 'admin_only' => 0, - 'title' => _MI_MYMODULE_CATEGORY_NOTIFY, - 'caption' => _MI_MYMODULE_CATEGORY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_CATEGORY_NOTIFY_DESC, - 'mail_template' => 'category_newarticle_notify', - 'mail_subject' => _MI_MYMODULE_CATEGORY_NOTIFY_SUBJECT, -]; -// ARTICLE Notify -$modversion['notification']['event'][8] = [ - 'name' => 'approve', - 'category' => 'article', - 'admin_only' => 1, - 'title' => _MI_MYMODULE_ARTICLE_NOTIFY, - 'caption' => _MI_MYMODULE_ARTICLE_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE_ARTICLE_NOTIFY_DESC, - 'mail_template' => 'article_approve_notify', - 'mail_subject' => _MI_MYMODULE_ARTICLE_NOTIFY_SUBJECT, -]; diff --git a/testdata/mymodule2/admin/about.php b/testdata/mymodule2/admin/about.php deleted file mode 100644 index f57f43bf..00000000 --- a/testdata/mymodule2/admin/about.php +++ /dev/null @@ -1,26 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -$templateMain = 'mymodule2_admin_about.tpl'; -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('about.php')); -$GLOBALS['xoopsTpl']->assign('about', $adminObject->renderAbout('6KJ7RW5DR3VTJ', false)); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/admin/articles.php b/testdata/mymodule2/admin/articles.php deleted file mode 100644 index 77453a51..00000000 --- a/testdata/mymodule2/admin/articles.php +++ /dev/null @@ -1,224 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request art_id -$artId = Request::getInt('art_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule2_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ADD_ARTICLE, 'articles.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $articlesCount = $articlesHandler->getCountArticles(); - $articlesAll = $articlesHandler->getAllArticles($start, $limit); - $GLOBALS['xoopsTpl']->assign('articles_count', $articlesCount); - $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - // Table view articles - if ($articlesCount > 0) { - foreach(array_keys($articlesAll) as $i) { - $article = $articlesAll[$i]->getValuesArticles(); - $GLOBALS['xoopsTpl']->append('articles_list', $article); - unset($article); - } - // Display Navigation - if ($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_ARTICLES); - } - - break; - case 'new': - $templateMain = 'mymodule2_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ARTICLES_LIST, 'articles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $articlesObj = $articlesHandler->create(); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($artId)) { - $articlesObj = $articlesHandler->get($artId); - } else { - $articlesObj = $articlesHandler->create(); - } - // Set Vars - $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0)); - $articlesObj->setVar('art_title', Request::getString('art_title', '')); - $articlesObj->setVar('art_descr', Request::getString('art_descr', '')); - // Set Var art_img - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['art_img']['name']; - $imgMimetype = $_FILES['art_img']['type']; - $imgNameDef = Request::getString('art_title'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule2\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename; - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $articlesObj->setVar('art_img', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $articlesObj->setVar('art_img', Request::getString('art_img')); - } - $articlesObj->setVar('art_status', Request::getInt('art_status', 0)); - // Set Var art_file - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['art_file']['name']; - $imgNameDef = Request::getString('art_title'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/articles/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $articlesObj->setVar('art_file', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $articlesObj->setVar('art_file', Request::getString('art_file')); - } - $articleCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('art_created')); - $articlesObj->setVar('art_created', $articleCreated->getTimestamp()); - $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0)); - // Insert Data - if ($articlesHandler->insert($articlesObj)) { - $newArtId = $articlesObj->getNewInsertedIdArticles(); - $permId = isset($_REQUEST['art_id']) ? $artId : $newArtId; - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $GLOBALS['xoopsModule']->getVar('mid'); - // Permission to view_articles - $grouppermHandler->deleteByModule($mid, 'mymodule2_view_articles', $permId); - if (isset($_POST['groups_view_articles'])) { - foreach($_POST['groups_view_articles'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_view_articles', $permId, $onegroupId, $mid); - } - } - // Permission to submit_articles - $grouppermHandler->deleteByModule($mid, 'mymodule2_submit_articles', $permId); - if (isset($_POST['groups_submit_articles'])) { - foreach($_POST['groups_submit_articles'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_submit_articles', $permId, $onegroupId, $mid); - } - } - // Permission to approve_articles - $grouppermHandler->deleteByModule($mid, 'mymodule2_approve_articles', $permId); - if (isset($_POST['groups_approve_articles'])) { - foreach($_POST['groups_approve_articles'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_approve_articles', $permId, $onegroupId, $mid); - } - } - if ('' !== $uploaderErrors) { - redirect_header('articles.php?op=edit&art_id=' . $artId, 5, $uploaderErrors); - } else { - redirect_header('articles.php?op=list', 2, _AM_MYMODULE2_FORM_OK); - } - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'edit': - $templateMain = 'mymodule2_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ADD_ARTICLE, 'articles.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE2_ARTICLES_LIST, 'articles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $articlesObj = $articlesHandler->get($artId); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'delete': - $articlesObj = $articlesHandler->get($artId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($articlesHandler->delete($articlesObj)) { - redirect_header('articles.php', 3, _AM_MYMODULE2_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'art_id' => $artId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $articlesObj->getVar('art_title'))); - } - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/admin/categories.php b/testdata/mymodule2/admin/categories.php deleted file mode 100644 index 776ee499..00000000 --- a/testdata/mymodule2/admin/categories.php +++ /dev/null @@ -1,173 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request cat_id -$catId = Request::getInt('cat_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule2_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ADD_CATEGORY, 'categories.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $categoriesCount = $categoriesHandler->getCountCategories(); - $categoriesAll = $categoriesHandler->getAllCategories($start, $limit); - $GLOBALS['xoopsTpl']->assign('categories_count', $categoriesCount); - $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - // Table view categories - if ($categoriesCount > 0) { - foreach(array_keys($categoriesAll) as $i) { - $category = $categoriesAll[$i]->getValuesCategories(); - $GLOBALS['xoopsTpl']->append('categories_list', $category); - unset($category); - } - // Display Navigation - if ($categoriesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_CATEGORIES); - } - - break; - case 'new': - $templateMain = 'mymodule2_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE2_CATEGORIES_LIST, 'categories.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $categoriesObj = $categoriesHandler->create(); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('categories.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($catId)) { - $categoriesObj = $categoriesHandler->get($catId); - } else { - $categoriesObj = $categoriesHandler->create(); - } - // Set Vars - $categoriesObj->setVar('cat_name', Request::getString('cat_name', '')); - // Set Var cat_logo - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['cat_logo']['name']; - $imgMimetype = $_FILES['cat_logo']['type']; - $imgNameDef = Request::getString('cat_name'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule2\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename; - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $categoriesObj->setVar('cat_logo', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $categoriesObj->setVar('cat_logo', Request::getString('cat_logo')); - } - $categoryCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('cat_created')); - $categoriesObj->setVar('cat_created', $categoryCreated->getTimestamp()); - $categoriesObj->setVar('cat_submitter', Request::getInt('cat_submitter', 0)); - // Insert Data - if ($categoriesHandler->insert($categoriesObj)) { - if ('' !== $uploaderErrors) { - redirect_header('categories.php?op=edit&cat_id=' . $catId, 5, $uploaderErrors); - } else { - redirect_header('categories.php?op=list', 2, _AM_MYMODULE2_FORM_OK); - } - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors()); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'edit': - $templateMain = 'mymodule2_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ADD_CATEGORY, 'categories.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE2_CATEGORIES_LIST, 'categories.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $categoriesObj = $categoriesHandler->get($catId); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'delete': - $categoriesObj = $categoriesHandler->get($catId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('categories.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($categoriesHandler->delete($categoriesObj)) { - redirect_header('categories.php', 3, _AM_MYMODULE2_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'cat_id' => $catId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $categoriesObj->getVar('cat_name'))); - } - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/admin/feedback.php b/testdata/mymodule2/admin/feedback.php deleted file mode 100644 index 08b4223a..00000000 --- a/testdata/mymodule2/admin/feedback.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ - -use Xmf\Request; - -include __DIR__ . '/header.php'; - -$adminObject = \Xmf\Module\Admin::getInstance(); - -$feedback = new \XoopsModules\Mymodule2\Common\ModuleFeedback(); - -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -$moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname'); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -xoops_loadLanguage('feedback', $moduleDirName); - -//xoops_cp_header(); - -switch ($op) { - case 'list': - default: - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('feedback.php')); - $feedback->name = $GLOBALS['xoopsUser']->getVar('name'); - $feedback->email = $GLOBALS['xoopsUser']->getVar('email'); - $feedback->site = XOOPS_URL; - $form = $feedback->getFormFeedback(); - $form->display(); - break; - case 'send': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - - $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', ''); - $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'); - $body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

      '; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
      '; - $body .= $fb_content; - $xoopsMailer = xoops_getMailer(); - $xoopsMailer->useMail(); - $xoopsMailer->setToEmails($GLOBALS['xoopsModule']->getInfo('author_mail')); - $xoopsMailer->setFromEmail($your_mail); - $xoopsMailer->setFromName($your_name); - $xoopsMailer->setSubject($title); - $xoopsMailer->multimailer->isHTML(true); - $xoopsMailer->setBody($body); - $ret = $xoopsMailer->send(); - if ($ret) { - redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); - } - - // show form with content again - $feedback->name = $your_name; - $feedback->email = $your_mail; - $feedback->site = $your_site; - $feedback->type = $fb_type; - $feedback->content = $fb_content; - echo '
      -

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

      -
      '; - $form = $feedback->getFormFeedback(); - $form->display(); - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/admin/footer.php b/testdata/mymodule2/admin/footer.php deleted file mode 100644 index 206b9534..00000000 --- a/testdata/mymodule2/admin/footer.php +++ /dev/null @@ -1,27 +0,0 @@ - - Website: - */ -if (isset($templateMain)) { - $GLOBALS['xoopsTpl']->assign('maintainedby', $helper->getConfig('maintainedby')); - $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); -} - -xoops_cp_footer(); diff --git a/testdata/mymodule2/admin/header.php b/testdata/mymodule2/admin/header.php deleted file mode 100644 index 54ee095f..00000000 --- a/testdata/mymodule2/admin/header.php +++ /dev/null @@ -1,63 +0,0 @@ - - Website: - */ -include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; -include_once dirname(__DIR__) . '/include/common.php'; - -$sysPathIcon16 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons16'); -$sysPathIcon32 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -$modPathIcon16 = MYMODULE2_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons16') . '/'; -$modPathIcon32 = MYMODULE2_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons32') . '/'; - -// Get instance of module -$helper = \XoopsModules\Mymodule2\Helper::getInstance(); -$categoriesHandler = $helper->getHandler('categories'); -$articlesHandler = $helper->getHandler('articles'); -$testfieldsHandler = $helper->getHandler('testfields'); -$myts = MyTextSanitizer::getInstance(); -// -if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once XOOPS_ROOT_PATH . '/class/template.php'; - $xoopsTpl = new \XoopsTpl(); -} - -// Load languages -xoops_loadLanguage('admin'); -xoops_loadLanguage('modinfo'); - -// Local admin menu class -if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) { - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); -} else { - redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); -} - -xoops_cp_header(); - -// System icons path -$GLOBALS['xoopsTpl']->assign('sysPathIcon16', $sysPathIcon16); -$GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); -$GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); -$GLOBALS['xoopsTpl']->assign('modPathIcon32', $modPathIcon32); - -$adminObject = \Xmf\Module\Admin::getInstance(); -$style = MYMODULE2_URL . '/assets/css/admin/style.css'; diff --git a/testdata/mymodule2/admin/index.html b/testdata/mymodule2/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/admin/index.php b/testdata/mymodule2/admin/index.php deleted file mode 100644 index ca8ae148..00000000 --- a/testdata/mymodule2/admin/index.php +++ /dev/null @@ -1,70 +0,0 @@ - - Website: - */ - - -use XoopsModules\Mymodule2\Common; - -include_once dirname(__DIR__) . '/preloads/autoloader.php'; -require __DIR__ . '/header.php'; - -// Template Index -$templateMain = 'mymodule2_admin_index.tpl'; - -// Count elements -$countCategories = $categoriesHandler->getCount(); -$countArticles = $articlesHandler->getCount(); -$countTestfields = $testfieldsHandler->getCount(); - -// InfoBox Statistics -$adminObject->addInfoBox(_AM_MYMODULE2_STATISTICS); -// Info elements -$adminObject->addInfoBoxLine(sprintf( '', $countCategories)); -$adminObject->addInfoBoxLine(sprintf( '', $countArticles)); -$adminObject->addInfoBoxLine(sprintf( '', $countTestfields)); - -// Upload Folders -$configurator = new Common\Configurator(); -if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - foreach(array_keys($configurator->uploadFolders) as $i) { - $folder[] = $configurator->uploadFolders[$i]; - } -} -// Uploads Folders Created -foreach(array_keys($folder) as $i) { - $adminObject->addConfigBoxLine($folder[$i], 'folder'); - $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); -} - -// Render Index -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('index.php')); -// Test Data -if ($helper->getConfig('displaySampleButton')) { - xoops_loadLanguage('admin/modulesadmin', 'system'); - include_once dirname(__DIR__) . '/testdata/index.php'; - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_ADD_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->displayButton('left'); -} -$GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex()); -// End Test Data -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/admin/menu.php b/testdata/mymodule2/admin/menu.php deleted file mode 100644 index 802aad06..00000000 --- a/testdata/mymodule2/admin/menu.php +++ /dev/null @@ -1,63 +0,0 @@ - - Website: - */ - -$dirname = basename(dirname(__DIR__)); -$moduleHandler = xoops_getHandler('module'); -$xoopsModule = XoopsModule::getByDirname($dirname); -$moduleInfo = $moduleHandler->get($xoopsModule->getVar('mid')); -$sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); - -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ADMENU1, - 'link' => 'admin/index.php', - 'icon' => $sysPathIcon32.'/dashboard.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ADMENU2, - 'link' => 'admin/categories.php', - 'icon' => 'assets/icons/32/category.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ADMENU3, - 'link' => 'admin/articles.php', - 'icon' => 'assets/icons/32/penguin.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ADMENU4, - 'link' => 'admin/testfields.php', - 'icon' => 'assets/icons/32/alert.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ADMENU5, - 'link' => 'admin/permissions.php', - 'icon' => $sysPathIcon32.'/permissions.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ADMENU6, - 'link' => 'admin/feedback.php', - 'icon' => $sysPathIcon32.'/mail_foward.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE2_ABOUT, - 'link' => 'admin/about.php', - 'icon' => $sysPathIcon32.'/about.png', -]; diff --git a/testdata/mymodule2/admin/permissions.php b/testdata/mymodule2/admin/permissions.php deleted file mode 100644 index bfeaed02..00000000 --- a/testdata/mymodule2/admin/permissions.php +++ /dev/null @@ -1,132 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; - -// Template Index -$templateMain = 'mymodule2_admin_permissions.tpl'; -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('permissions.php')); - -$op = Request::getString('op', 'global'); - -// Get Form -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -xoops_load('XoopsFormLoader'); -$permTableForm = new \XoopsSimpleForm('', 'fselperm', 'permissions.php', 'post'); -$formSelect = new \XoopsFormSelect('', 'op', $op); -$formSelect->setExtra('onchange="document.fselperm.submit()"'); -$formSelect->addOption('global', _AM_MYMODULE2_PERMISSIONS_GLOBAL); -$formSelect->addOption('approve_articles', _AM_MYMODULE2_PERMISSIONS_APPROVE . ' Articles'); -$formSelect->addOption('submit_articles', _AM_MYMODULE2_PERMISSIONS_SUBMIT . ' Articles'); -$formSelect->addOption('view_articles', _AM_MYMODULE2_PERMISSIONS_VIEW . ' Articles'); -$formSelect->addOption('approve_testfields', _AM_MYMODULE2_PERMISSIONS_APPROVE . ' Testfields'); -$formSelect->addOption('submit_testfields', _AM_MYMODULE2_PERMISSIONS_SUBMIT . ' Testfields'); -$formSelect->addOption('view_testfields', _AM_MYMODULE2_PERMISSIONS_VIEW . ' Testfields'); -$permTableForm->addElement($formSelect); -$permTableForm->display(); -switch($op) { - case 'global': - default: - $formTitle = _AM_MYMODULE2_PERMISSIONS_GLOBAL; - $permName = 'mymodule2_ac'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_GLOBAL_DESC; - $globalPerms = array( '4' => _AM_MYMODULE2_PERMISSIONS_GLOBAL_4, '8' => _AM_MYMODULE2_PERMISSIONS_GLOBAL_8, '16' => _AM_MYMODULE2_PERMISSIONS_GLOBAL_16 ); - break; - case 'approve_articles': - $formTitle = _AM_MYMODULE2_PERMISSIONS_APPROVE; - $permName = 'mymodule2_approve_articles'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_APPROVE_DESC . ' Articles'; - $handler = $helper->getHandler('articles'); - break; - case 'submit_articles': - $formTitle = _AM_MYMODULE2_PERMISSIONS_SUBMIT; - $permName = 'mymodule2_submit_articles'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_SUBMIT_DESC . ' Articles'; - $handler = $helper->getHandler('articles'); - break; - case 'view_articles': - $formTitle = _AM_MYMODULE2_PERMISSIONS_VIEW; - $permName = 'mymodule2_view_articles'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_VIEW_DESC . ' Articles'; - $handler = $helper->getHandler('articles'); - break; - case 'approve_testfields': - $formTitle = _AM_MYMODULE2_PERMISSIONS_APPROVE; - $permName = 'mymodule2_approve_testfields'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_APPROVE_DESC . ' Testfields'; - $handler = $helper->getHandler('testfields'); - break; - case 'submit_testfields': - $formTitle = _AM_MYMODULE2_PERMISSIONS_SUBMIT; - $permName = 'mymodule2_submit_testfields'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_SUBMIT_DESC . ' Testfields'; - $handler = $helper->getHandler('testfields'); - break; - case 'view_testfields': - $formTitle = _AM_MYMODULE2_PERMISSIONS_VIEW; - $permName = 'mymodule2_view_testfields'; - $permDesc = _AM_MYMODULE2_PERMISSIONS_VIEW_DESC . ' Testfields'; - $handler = $helper->getHandler('testfields'); - break; -} -$moduleId = $xoopsModule->getVar('mid'); -$permform = new \XoopsGroupPermForm($formTitle, $moduleId, $permName, $permDesc, 'admin/permissions.php'); -$permFound = false; -if ($op === 'global') { - foreach($globalPerms as $gPermId => $gPermName) { - $permform->addItem($gPermId, $gPermName); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - $permFound = true; -} -if ($op === 'approve_articles' || $op === 'submit_articles' || $op === 'view_articles') { - $articlesCount = $articlesHandler->getCountArticles(); - if ($articlesCount > 0) { - $articlesAll = $articlesHandler->getAllArticles(0, 'art_title'); - foreach(array_keys($articlesAll) as $i) { - $permform->addItem($articlesAll[$i]->getVar('art_id'), $articlesAll[$i]->getVar('art_title')); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - } - $permFound = true; -} -if ($op === 'approve_testfields' || $op === 'submit_testfields' || $op === 'view_testfields') { - $testfieldsCount = $testfieldsHandler->getCountTestfields(); - if ($testfieldsCount > 0) { - $testfieldsAll = $testfieldsHandler->getAllTestfields(0, 'tf_text'); - foreach(array_keys($testfieldsAll) as $i) { - $permform->addItem($testfieldsAll[$i]->getVar('tf_id'), $testfieldsAll[$i]->getVar('tf_text')); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - } - $permFound = true; -} -unset($permform); -if ($permFound !== true) { - redirect_header('permissions.php', 3, _AM_MYMODULE2_NO_PERMISSIONS_SET); - exit(); -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/admin/testfields.php b/testdata/mymodule2/admin/testfields.php deleted file mode 100644 index 96ca3cd0..00000000 --- a/testdata/mymodule2/admin/testfields.php +++ /dev/null @@ -1,292 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request tf_id -$tfId = Request::getInt('tf_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule2_admin_testfields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ADD_TESTFIELD, 'testfields.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $testfieldsCount = $testfieldsHandler->getCountTestfields(); - $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); - $GLOBALS['xoopsTpl']->assign('testfields_count', $testfieldsCount); - $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - // Table view testfields - if ($testfieldsCount > 0) { - foreach(array_keys($testfieldsAll) as $i) { - $testfield = $testfieldsAll[$i]->getValuesTestfields(); - $GLOBALS['xoopsTpl']->append('testfields_list', $testfield); - unset($testfield); - } - // Display Navigation - if ($testfieldsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_TESTFIELDS); - } - - break; - case 'new': - $templateMain = 'mymodule2_admin_testfields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php')); - $adminObject->addItemButton(_AM_MYMODULE2_TESTFIELDS_LIST, 'testfields.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($tfId)) { - $testfieldsObj = $testfieldsHandler->get($tfId); - } else { - $testfieldsObj = $testfieldsHandler->create(); - } - // Set Vars - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule2\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - // Insert Data - if ($testfieldsHandler->insert($testfieldsObj)) { - $newTfId = $testfieldsObj->getNewInsertedIdTestfields(); - $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId; - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $GLOBALS['xoopsModule']->getVar('mid'); - // Permission to view_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule2_view_testfields', $permId); - if (isset($_POST['groups_view_testfields'])) { - foreach($_POST['groups_view_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_view_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to submit_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule2_submit_testfields', $permId); - if (isset($_POST['groups_submit_testfields'])) { - foreach($_POST['groups_submit_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_submit_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to approve_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule2_approve_testfields', $permId); - if (isset($_POST['groups_approve_testfields'])) { - foreach($_POST['groups_approve_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_approve_testfields', $permId, $onegroupId, $mid); - } - } - if ('' !== $uploaderErrors) { - redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors); - } else { - redirect_header('testfields.php?op=list', 2, _AM_MYMODULE2_FORM_OK); - } - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'edit': - $templateMain = 'mymodule2_admin_testfields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php')); - $adminObject->addItemButton(_AM_MYMODULE2_ADD_TESTFIELD, 'testfields.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE2_TESTFIELDS_LIST, 'testfields.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $testfieldsObj = $testfieldsHandler->get($tfId); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'delete': - $testfieldsObj = $testfieldsHandler->get($tfId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($testfieldsHandler->delete($testfieldsObj)) { - redirect_header('testfields.php', 3, _AM_MYMODULE2_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'tf_id' => $tfId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $testfieldsObj->getVar('tf_text'))); - } - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/articles.php b/testdata/mymodule2/articles.php deleted file mode 100644 index 5b1033e7..00000000 --- a/testdata/mymodule2/articles.php +++ /dev/null @@ -1,75 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_articles.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; - -$start = Request::getInt('start', 0); -$limit = Request::getInt('limit', $helper->getConfig('userpager')); - -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); - -$articlesCount = $articlesHandler->getCountArticles(); -$GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); -$articlesAll = $articlesHandler->getAllArticles($start, $limit); -$keywords = []; -if ($articlesCount > 0) { - $articles = []; - // Get All Articles - foreach(array_keys($articlesAll) as $i) { - $articles[] = $articlesAll[$i]->getValuesArticles(); - $keywords[] = $articlesAll[$i]->getVar('art_title'); - } - $GLOBALS['xoopsTpl']->assign('articles', $articles); - unset($articles); - // Display Navigation - if ($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} - -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_ARTICLES]; - -// Keywords -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); - -// Description -mymodule2MetaDescription(_MA_MYMODULE2_ARTICLES_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/articles.php'); -$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/assets/css/admin/index.html b/testdata/mymodule2/assets/css/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/css/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/css/admin/style.css b/testdata/mymodule2/assets/css/admin/style.css deleted file mode 100644 index a5ce2c86..00000000 --- a/testdata/mymodule2/assets/css/admin/style.css +++ /dev/null @@ -1,24 +0,0 @@ -@charset "UTF-8"; -/* - 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. -*/ - -/** - * My Module 2 module for xoops - * - * @copyright 2020 XOOPS Project (https://xooops.org) - * @license GPL 2.0 or later - * @package mymodule2 - * @since 1.0 - * @min_xoops 2.5.9 - * @author TDM XOOPS - Email: - Website: - */ -img { - max-width: 200px; -} \ No newline at end of file diff --git a/testdata/mymodule2/assets/css/index.html b/testdata/mymodule2/assets/css/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/css/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/css/style.css b/testdata/mymodule2/assets/css/style.css deleted file mode 100644 index 6965730b..00000000 --- a/testdata/mymodule2/assets/css/style.css +++ /dev/null @@ -1,42 +0,0 @@ -@charset "UTF-8"; -/* - 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. -*/ - -/** - * My Module 2 module for xoops - * - * @copyright 2020 XOOPS Project (https://xooops.org) - * @license GPL 2.0 or later - * @package mymodule2 - * @since 1.0 - * @min_xoops 2.5.9 - * @author TDM XOOPS - Email: - Website: - */ -ul.menu { - list-style: none; - background-color: #f5f5f5; - border-radius: 4px; -} - -ul.menu > li { - display: inline-block; -} - -ul.menu > li + li:before { - content: "|\a0"; -} - -.printOnly { - display: none; -} - -img { - max-width: 300px; -} \ No newline at end of file diff --git a/testdata/mymodule2/assets/icons/16/index.html b/testdata/mymodule2/assets/icons/16/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/icons/16/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/icons/16/status0.png b/testdata/mymodule2/assets/icons/16/status0.png deleted file mode 100644 index 7ad3c3c7..00000000 Binary files a/testdata/mymodule2/assets/icons/16/status0.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/16/status1.png b/testdata/mymodule2/assets/icons/16/status1.png deleted file mode 100644 index a9a721e8..00000000 Binary files a/testdata/mymodule2/assets/icons/16/status1.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/16/status2.png b/testdata/mymodule2/assets/icons/16/status2.png deleted file mode 100644 index 26535e51..00000000 Binary files a/testdata/mymodule2/assets/icons/16/status2.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/16/status3.png b/testdata/mymodule2/assets/icons/16/status3.png deleted file mode 100644 index d5b94d94..00000000 Binary files a/testdata/mymodule2/assets/icons/16/status3.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/32/alert.png b/testdata/mymodule2/assets/icons/32/alert.png deleted file mode 100644 index 4bd83676..00000000 Binary files a/testdata/mymodule2/assets/icons/32/alert.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/32/category.png b/testdata/mymodule2/assets/icons/32/category.png deleted file mode 100644 index 42852b53..00000000 Binary files a/testdata/mymodule2/assets/icons/32/category.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/32/index.html b/testdata/mymodule2/assets/icons/32/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/icons/32/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/icons/32/penguin.png b/testdata/mymodule2/assets/icons/32/penguin.png deleted file mode 100644 index 28f86e3a..00000000 Binary files a/testdata/mymodule2/assets/icons/32/penguin.png and /dev/null differ diff --git a/testdata/mymodule2/assets/icons/index.html b/testdata/mymodule2/assets/icons/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/icons/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/images/blank.gif b/testdata/mymodule2/assets/images/blank.gif deleted file mode 100644 index 3a469695..00000000 Binary files a/testdata/mymodule2/assets/images/blank.gif and /dev/null differ diff --git a/testdata/mymodule2/assets/images/blank.png b/testdata/mymodule2/assets/images/blank.png deleted file mode 100644 index e1ee728a..00000000 Binary files a/testdata/mymodule2/assets/images/blank.png and /dev/null differ diff --git a/testdata/mymodule2/assets/images/index.html b/testdata/mymodule2/assets/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/images/logoModule.png b/testdata/mymodule2/assets/images/logoModule.png deleted file mode 100644 index 2df3e5ab..00000000 Binary files a/testdata/mymodule2/assets/images/logoModule.png and /dev/null differ diff --git a/testdata/mymodule2/assets/index.html b/testdata/mymodule2/assets/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/assets/js/functions.js b/testdata/mymodule2/assets/js/functions.js deleted file mode 100644 index dce2bb75..00000000 --- a/testdata/mymodule2/assets/js/functions.js +++ /dev/null @@ -1,71 +0,0 @@ -$(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(); -}); - -// \ No newline at end of file diff --git a/testdata/mymodule2/assets/js/index.html b/testdata/mymodule2/assets/js/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/assets/js/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/blocks/articles.php b/testdata/mymodule2/blocks/articles.php deleted file mode 100644 index 980465d2..00000000 --- a/testdata/mymodule2/blocks/articles.php +++ /dev/null @@ -1,122 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Helper; -use XoopsModules\Mymodule2\Constants; - -include_once XOOPS_ROOT_PATH.'/modules/mymodule2/include/common.php'; -// Function show block -function b_mymodule2_articles_show($options) -{ - include_once XOOPS_ROOT_PATH.'/modules/mymodule2/class/articles.php'; - $myts = MyTextSanitizer::getInstance(); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - $block = array(); - $typeBlock = $options[0]; - $limit = $options[1]; - $lenghtTitle = $options[2]; - $helper = Helper::getInstance(); - $articlesHandler = $helper->getHandler('articles'); - $criteria = new \CriteriaCompo(); - array_shift($options); - array_shift($options); - array_shift($options); - switch($typeBlock) - { - // For the block: articles last - case 'last': - //$criteria->add(new \Criteria('art_display', 1)); - $criteria->setSort('art_created'); - $criteria->setOrder('DESC'); - break; - // For the block: articles new - case 'new': - //$criteria->add(new \Criteria('art_display', 1)); - $criteria->add(new \Criteria('art_created', strtotime(date(_SHORTDATESTRING)), '>=')); - $criteria->add(new \Criteria('art_created', strtotime(date(_SHORTDATESTRING))+86400, '<=')); - $criteria->setSort('art_created'); - $criteria->setOrder('ASC'); - break; - // For the block: articles hits - case 'hits': - $criteria->setSort('art_hits'); - $criteria->setOrder('DESC'); - break; - // For the block: articles top - case 'top': - $criteria->setSort('art_top'); - $criteria->setOrder('ASC'); - break; - // For the block: articles random - case 'random': - //$criteria->add(new \Criteria('art_display', 1)); - $criteria->setSort('RAND()'); - break; - } - $criteria->setLimit($limit); - $articlesAll = $articlesHandler->getAll($criteria); - unset($criteria); - if (count($articlesAll) > 0) { - foreach(array_keys($articlesAll) as $i) - { - $block[$i]['cat'] = $articlesAll[$i]->getVar('art_cat'); - $block[$i]['title'] = $myts->htmlSpecialChars($articlesAll[$i]->getVar('art_title')); - $block[$i]['descr'] = strip_tags($articlesAll[$i]->getVar('art_descr')); - $block[$i]['img'] = $articlesAll[$i]->getVar('art_img'); - $block[$i]['file'] = $articlesAll[$i]->getVar('art_file'); - $block[$i]['created'] = formatTimeStamp($articlesAll[$i]->getVar('art_created')); - $block[$i]['submitter'] = \XoopsUser::getUnameFromId($articlesAll[$i]->getVar('art_submitter')); - } - } - return $block; -} - -// Function edit block -function b_mymodule2_articles_edit($options) -{ - include_once XOOPS_ROOT_PATH.'/modules/mymodule2/class/articles.php'; - $helper = Helper::getInstance(); - $articlesHandler = $helper->getHandler('articles'); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - $form = _MB_MYMODULE2_DISPLAY; - $form .= ""; - $form .= " 
      "; - $form .= _MB_MYMODULE2_TITLE_LENGTH." :

      "; - array_shift($options); - array_shift($options); - array_shift($options); - $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('art_id', 0, '!=')); - $criteria->setSort('art_id'); - $criteria->setOrder('ASC'); - $articlesAll = $articlesHandler->getAll($criteria); - unset($criteria); - $form .= _MB_MYMODULE2_ARTICLES_TO_DISPLAY."
      '; - return $form; -} \ No newline at end of file diff --git a/testdata/mymodule2/blocks/index.html b/testdata/mymodule2/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/blocks/testfields.php b/testdata/mymodule2/blocks/testfields.php deleted file mode 100644 index 4ba09e58..00000000 --- a/testdata/mymodule2/blocks/testfields.php +++ /dev/null @@ -1,115 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Helper; -use XoopsModules\Mymodule2\Constants; - -include_once XOOPS_ROOT_PATH.'/modules/mymodule2/include/common.php'; -// Function show block -function b_mymodule2_testfields_show($options) -{ - include_once XOOPS_ROOT_PATH.'/modules/mymodule2/class/testfields.php'; - $myts = MyTextSanitizer::getInstance(); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - $block = array(); - $typeBlock = $options[0]; - $limit = $options[1]; - $lenghtTitle = $options[2]; - $helper = Helper::getInstance(); - $testfieldsHandler = $helper->getHandler('testfields'); - $criteria = new \CriteriaCompo(); - array_shift($options); - array_shift($options); - array_shift($options); - switch($typeBlock) - { - // For the block: testfields last - case 'last': - //$criteria->add(new \Criteria('tf_display', 1)); - $criteria->setSort('tf_created'); - $criteria->setOrder('DESC'); - break; - // For the block: testfields new - case 'new': - //$criteria->add(new \Criteria('tf_display', 1)); - $criteria->add(new \Criteria('tf_created', strtotime(date(_SHORTDATESTRING)), '>=')); - $criteria->add(new \Criteria('tf_created', strtotime(date(_SHORTDATESTRING))+86400, '<=')); - $criteria->setSort('tf_created'); - $criteria->setOrder('ASC'); - break; - // For the block: testfields hits - case 'hits': - $criteria->setSort('tf_hits'); - $criteria->setOrder('DESC'); - break; - // For the block: testfields top - case 'top': - $criteria->setSort('tf_top'); - $criteria->setOrder('ASC'); - break; - // For the block: testfields random - case 'random': - //$criteria->add(new \Criteria('tf_display', 1)); - $criteria->setSort('RAND()'); - break; - } - $criteria->setLimit($limit); - $testfieldsAll = $testfieldsHandler->getAll($criteria); - unset($criteria); - if (count($testfieldsAll) > 0) { - foreach(array_keys($testfieldsAll) as $i) - { - } - } - return $block; -} - -// Function edit block -function b_mymodule2_testfields_edit($options) -{ - include_once XOOPS_ROOT_PATH.'/modules/mymodule2/class/testfields.php'; - $helper = Helper::getInstance(); - $testfieldsHandler = $helper->getHandler('testfields'); - $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); - $form = _MB_MYMODULE2_DISPLAY; - $form .= ""; - $form .= " 
      "; - $form .= _MB_MYMODULE2_TITLE_LENGTH." :

      "; - array_shift($options); - array_shift($options); - array_shift($options); - $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('tf_id', 0, '!=')); - $criteria->setSort('tf_id'); - $criteria->setOrder('ASC'); - $testfieldsAll = $testfieldsHandler->getAll($criteria); - unset($criteria); - $form .= _MB_MYMODULE2_TESTFIELDS_TO_DISPLAY."
      '; - return $form; -} \ No newline at end of file diff --git a/testdata/mymodule2/broken.php b/testdata/mymodule2/broken.php deleted file mode 100644 index 527fc2b2..00000000 --- a/testdata/mymodule2/broken.php +++ /dev/null @@ -1,223 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$op = Request::getString('op', 'list'); -$tfId = Request::getInt('tf_id'); -// Template -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_broken.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -// Redirection if not permissions -if ($permSubmit === false) { - redirect_header('index.php', 2, _NOPERM); - exit(); -} -switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE2_SUBMIT_PROPOSER; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE2_SUBMIT_PROPOSER . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_SUBMIT_PROPOSER)); - // Form Create - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if ($GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $testfieldsObj = $testfieldsHandler->create(); - $error = false; - $errorMessage = ''; - // Test first the validation - xoops_load('captcha'); - $xoopsCaptcha = \XoopsCaptcha::getInstance(); - if (!$xoopsCaptcha->verify()) { - $errorMessage .= $xoopsCaptcha->getMessage().'
      '; - $error = true; - } - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule2\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - if ($error === true) { - $GLOBALS['xoopsTpl']->assign('error_message', $errorMessage); - } else { - // Insert Data - if ($testfields1->insert($testfieldsObj)) { - redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); - } - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/class/Articles.php b/testdata/mymodule2/class/Articles.php deleted file mode 100644 index fe955a44..00000000 --- a/testdata/mymodule2/class/Articles.php +++ /dev/null @@ -1,255 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Articles - */ -class Articles extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('art_id', XOBJ_DTYPE_INT); - $this->initVar('art_cat', XOBJ_DTYPE_INT); - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_descr', XOBJ_DTYPE_TXTAREA); - $this->initVar('art_img', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_status', XOBJ_DTYPE_INT); - $this->initVar('art_file', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_created', XOBJ_DTYPE_INT); - $this->initVar('art_submitter', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdArticles() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return XoopsThemeForm - */ - public function getFormArticles($action = false) - { - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - if (false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Permissions for uploader - $grouppermHandler = xoops_getHandler('groupperm'); - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; - if ($GLOBALS['xoopsUser']) { - if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } else { - $permissionUpload = true; - } - } else { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE2_ARTICLE_ADD) : sprintf(_AM_MYMODULE2_ARTICLE_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Use tag module - $dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false; - if (($helper->getConfig('usetag') == 1) && $dirTag) { - $tagId = $this->isNew() ? 0 : $this->getVar('art_id'); - include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; - $form->addElement(new \XoopsFormTag( 'tag', 60, 255, $tagId, 0 ), true); - } - // Form Table categories - $categoriesHandler = $helper->getHandler('categories'); - $artCatSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); - $artCatSelect->addOptionArray($categoriesHandler->getList()); - $form->addElement($artCatSelect, true); - // Form Text ArtTitle - $form->addElement(new \XoopsFormText( _AM_MYMODULE2_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title') ), true); - // Form editor ArtDescr - $editorConfigs = []; - $editorConfigs['name'] = 'art_descr'; - $editorConfigs['value'] = $this->getVar('art_descr', 'e'); - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $editorConfigs['editor'] = $helper->getConfig('editor_descr'); - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE2_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); - // Form Image ArtImg - // Form Image ArtImg: Select Uploaded Image - $getArtImg = $this->getVar('art_img'); - $artImg = $getArtImg ? $getArtImg : 'blank.gif'; - $imageDirectory = '/uploads/mymodule2/images/articles'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_IMG, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_ARTICLE_IMG_UPLOADS, ".{$imageDirectory}/"), 'art_img', $artImg, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_art_img\", \"art_img\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form Image ArtImg: Upload new image - if ($permissionUpload) { - $maxsize = $helper->getConfig('maxsize_image'); - $imageTray->addElement(new \XoopsFormFile( '
      ' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'art_img', $maxsize )); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); - } else { - $imageTray->addElement(new \XoopsFormHidden( 'art_img', $artImg )); - } - $form->addElement($imageTray, ); - // Form Select Articles - $artStatusSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_STATUS, 'art_status', $this->getVar('art_status')); - $artStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE2_STATUS_NONE); - $artStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE2_STATUS_OFFLINE); - $artStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE2_STATUS_SUBMITTED); - $artStatusSelect->addOption(Constants::STATUS_APPROVED, _AM_MYMODULE2_STATUS_APPROVED); - $form->addElement($artStatusSelect, true); - // Form File ArtFile - $artFile = $this->isNew() ? '' : $this->getVar('art_file'); - if ($permissionUpload) { - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_FILE, '
      ' ); - $fileDirectory = '/uploads/mymodule2/files/articles'; - if (!$this->isNew()) { - $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE2_ARTICLE_FILE_UPLOADS, ".{$fileDirectory}/"), $artFile)); - } - $maxsize = $helper->getConfig('maxsize_file'); - $fileUploadTray->addElement(new \XoopsFormFile( '', 'art_file', $maxsize )); - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); - $form->addElement($fileUploadTray, ); - } else { - $form->addElement(new \XoopsFormHidden( 'art_file', $artFile )); - } - // Form Text Date Select ArtCreated - $artCreated = $this->isNew() ? 0 : $this->getVar('art_created'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_ARTICLE_CREATED, 'art_created', '', $artCreated )); - // Form Select User ArtSubmitter - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE2_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter') )); - // Permissions - $memberHandler = xoops_getHandler('member'); - $groupList = $memberHandler->getGroupList(); - $grouppermHandler = xoops_getHandler('groupperm'); - $fullList[] = array_keys($groupList); - if (!$this->isNew()) { - $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule2_approve_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsApprove[] = array_values($groupsIdsApprove); - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $groupsIdsApprove); - $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule2_submit_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsSubmit[] = array_values($groupsIdsSubmit); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $groupsIdsSubmit); - $groupsIdsView = $grouppermHandler->getGroupIds('mymodule2_view_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsView[] = array_values($groupsIdsView); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $groupsIdsView); - } else { - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $fullList); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $fullList); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $fullList); - } - // To Approve - $groupsCanApproveCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanApproveCheckbox); - // To Submit - $groupsCanSubmitCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanSubmitCheckbox); - // To View - $groupsCanViewCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanViewCheckbox); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesArticles($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('art_id'); - $categories = $helper->getHandler('categories'); - $categoriesObj = $categories->get($this->getVar('art_cat')); - $ret['cat'] = $categoriesObj->getVar('cat_name'); - $ret['title'] = $this->getVar('art_title'); - $ret['descr'] = strip_tags($this->getVar('art_descr')); - $ret['img'] = $this->getVar('art_img'); - $ret['status'] = $this->getVar('art_status'); - $ret['file'] = $this->getVar('art_file'); - $ret['created'] = formatTimeStamp($this->getVar('art_created'), 's'); - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('art_submitter')); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayArticles() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule2/class/Articleshandler.php b/testdata/mymodule2/class/Articleshandler.php deleted file mode 100644 index 80263e68..00000000 --- a/testdata/mymodule2/class/Articleshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - - -/** - * Class Object Handler Articles - */ -class ArticlesHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null|XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule2_articles', Articles::class, 'art_id', 'art_title'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Articles in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountArticles($start = 0, $limit = 0, $sort = 'art_id ASC, art_title', $order = 'ASC') - { - $crCountArticles = new \CriteriaCompo(); - $crCountArticles = $this->getArticlesCriteria($crCountArticles, $start, $limit, $sort, $order); - return parent::getCount($crCountArticles); - } - - /** - * Get All Articles in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllArticles($start = 0, $limit = 0, $sort = 'art_id ASC, art_title', $order = 'ASC') - { - $crAllArticles = new \CriteriaCompo(); - $crAllArticles = $this->getArticlesCriteria($crAllArticles, $start, $limit, $sort, $order); - return parent::getAll($crAllArticles); - } - - /** - * Get Criteria Articles - * @param $crArticles - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getArticlesCriteria($crArticles, $start, $limit, $sort, $order) - { - $crArticles->setStart( $start ); - $crArticles->setLimit( $limit ); - $crArticles->setSort( $sort ); - $crArticles->setOrder( $order ); - return $crArticles; - } -} diff --git a/testdata/mymodule2/class/Categories.php b/testdata/mymodule2/class/Categories.php deleted file mode 100644 index d2d31e6a..00000000 --- a/testdata/mymodule2/class/Categories.php +++ /dev/null @@ -1,133 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Categories - */ -class Categories extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('cat_id', XOBJ_DTYPE_INT); - $this->initVar('cat_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_logo', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_created', XOBJ_DTYPE_INT); - $this->initVar('cat_submitter', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdCategories() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return XoopsThemeForm - */ - public function getFormCategories($action = false) - { - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - if (false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE2_CATEGORY_ADD) : sprintf(_AM_MYMODULE2_CATEGORY_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Form Text CatName - $form->addElement(new \XoopsFormText( _AM_MYMODULE2_CATEGORY_NAME, 'cat_name', 50, 255, $this->getVar('cat_name') ), true); - // Form Text Date Select CatCreated - $catCreated = $this->isNew() ? 0 : $this->getVar('cat_created'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_CATEGORY_CREATED, 'cat_created', '', $catCreated ), true); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesCategories($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('cat_id'); - $ret['name'] = $this->getVar('cat_name'); - $ret['logo'] = $this->getVar('cat_logo'); - $ret['created'] = formatTimeStamp($this->getVar('cat_created'), 's'); - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('cat_submitter')); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayCategories() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule2/class/Categorieshandler.php b/testdata/mymodule2/class/Categorieshandler.php deleted file mode 100644 index d45f2b47..00000000 --- a/testdata/mymodule2/class/Categorieshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - - -/** - * Class Object Handler Categories - */ -class CategoriesHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null|XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule2_categories', Categories::class, 'cat_id', 'cat_name'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Categories in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') - { - $crCountCategories = new \CriteriaCompo(); - $crCountCategories = $this->getCategoriesCriteria($crCountCategories, $start, $limit, $sort, $order); - return parent::getCount($crCountCategories); - } - - /** - * Get All Categories in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') - { - $crAllCategories = new \CriteriaCompo(); - $crAllCategories = $this->getCategoriesCriteria($crAllCategories, $start, $limit, $sort, $order); - return parent::getAll($crAllCategories); - } - - /** - * Get Criteria Categories - * @param $crCategories - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getCategoriesCriteria($crCategories, $start, $limit, $sort, $order) - { - $crCategories->setStart( $start ); - $crCategories->setLimit( $limit ); - $crCategories->setSort( $sort ); - $crCategories->setOrder( $order ); - return $crCategories; - } -} diff --git a/testdata/mymodule2/class/Common/Breadcrumb.php b/testdata/mymodule2/class/Common/Breadcrumb.php deleted file mode 100644 index fde479db..00000000 --- a/testdata/mymodule2/class/Common/Breadcrumb.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @package Mymodule2 - * - * Example: - * $breadcrumb = new Common\Breadcrumb(); - * $breadcrumb->addLink( 'bread 1', 'index1.php' ); - * $breadcrumb->addLink( 'bread 2', '' ); - * $breadcrumb->addLink( 'bread 3', 'index3.php' ); - * echo $breadcrumb->render(); - */ - -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Common; - -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); - -/** - * Class Breadcrumb - */ -class Breadcrumb -{ - public $dirname; - private $bread = []; - - public function __construct() - { - $this->dirname = basename(dirname(dirname(__DIR__))); - } - - /** - * Add link to breadcrumb - * - * @param string $title - * @param string $link - */ - public function addLink($title = '', $link = '') - { - $this->bread[] = [ - 'link' => $link, - 'title' => $title, - ]; - } - - /** - * Render BreadCrumb - */ - public function render() - { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { - require $GLOBALS['xoops']->path('class/theme.php'); - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); - } - - require $GLOBALS['xoops']->path('class/template.php'); - $breadcrumbTpl = new \XoopsTpl(); - $breadcrumbTpl->assign('breadcrumb', $this->bread); - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); - unset($breadcrumbTpl); - - return $html; - } -} diff --git a/testdata/mymodule2/class/Common/Configurator.php b/testdata/mymodule2/class/Common/Configurator.php deleted file mode 100644 index dd3ed28b..00000000 --- a/testdata/mymodule2/class/Common/Configurator.php +++ /dev/null @@ -1,68 +0,0 @@ -name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; - $this->copyTestFolders = $config->copyTestFolders; - $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->renameTables = $config->renameTables; - $this->moduleStats = $config->moduleStats; - $this->modCopyright = $config->modCopyright; - } -} diff --git a/testdata/mymodule2/class/Common/FilesManagement.php b/testdata/mymodule2/class/Common/FilesManagement.php deleted file mode 100644 index 11a5ed70..00000000 --- a/testdata/mymodule2/class/Common/FilesManagement.php +++ /dev/null @@ -1,294 +0,0 @@ - - */ -trait FilesManagement -{ - /** - * Function responsible for checking if a directory exists, we can also write in and create an index.html file - * - * @param string $folder The full path of the directory to check - * - * @return void - * @throws \RuntimeException - */ - public static function createFolder($folder) - { - try { - if (!file_exists($folder)) { - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); - } - - file_put_contents($folder . '/index.html', ''); - } - } catch (\Exception $e) { - echo 'Caught exception: ', $e->getMessage(), '
      '; - } - } - - /** - * @param $file - * @param $folder - * @return bool - */ - public static function copyFile($file, $folder) - { - return copy($file, $folder); - } - - /** - * @param $src - * @param $dst - */ - public static function recurseCopy($src, $dst) - { - $dir = opendir($src); - // @mkdir($dst); - if (!@mkdir($dst) && !is_dir($dst)) { - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); - } - while (false !== ($file = readdir($dir))) { - if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); - } else { - copy($src . '/' . $file, $dst . '/' . $file); - } - } - } - closedir($dir); - } - - /** - * Copy a file, or recursively copy a folder and its contents - * @param string $source Source path - * @param string $dest Destination path - * @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/ - */ - public static function xcopy($source, $dest) - { - // Check for symlinks - if (is_link($source)) { - return symlink(readlink($source), $dest); - } - - // Simple copy for a file - if (is_file($source)) { - return copy($source, $dest); - } - - // Make destination directory - if (!is_dir($dest)) { - if (!mkdir($dest) && !is_dir($dest)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dest)); - } - } - - // Loop through the folder - $dir = dir($source); - if (@is_dir($dir)) { - while (false !== $entry = $dir->read()) { - // Skip pointers - if ('.' === $entry || '..' === $entry) { - continue; - } - // Deep copy directories - self::xcopy("$source/$entry", "$dest/$entry"); - } - // Clean up - $dir->close(); - } - - return true; - } - - /** - * Remove files and (sub)directories - * - * @param string $src source directory to delete - * - * @return bool true on success - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @uses \Xmf\Module\Helper::getHelper() - */ - public static function deleteDirectory($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - $success = true; - // remove old files - $dirInfo = new \SplFileInfo($src); - // validate is a directory - if ($dirInfo->isDir()) { - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); - foreach ($fileList as $k => $v) { - $fileInfo = new \SplFileInfo("{$src}/{$v}"); - if ($fileInfo->isDir()) { - // recursively handle subdirectories - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { - break; - } - } else { - // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { - break; - } - } - } - // now delete this (sub)directory if all the files are gone - if ($success) { - $success = rmdir($dirInfo->getRealPath()); - } - } else { - // input is not a valid directory - $success = false; - } - - return $success; - } - - /** - * Recursively remove directory - * - * @todo currently won't remove directories with hidden files, should it? - * - * @param string $src directory to remove (delete) - * - * @return bool true on success - */ - public static function rrmdir($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - $success = true; - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file - if (!unlink($filename)) { - return false; // couldn't delete the file - } - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rrmdir($fObj->getPathname()); - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively move files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - */ - public static function rmove($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - // rmdir($fObj->getPath()); // now delete the directory - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively copy directories and files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @uses \Xmf\Module\Helper::getHelper() - */ - public static function rcopy($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } - } - - return true; - } -} diff --git a/testdata/mymodule2/class/Common/Migrate.php b/testdata/mymodule2/class/Common/Migrate.php deleted file mode 100644 index 04a20a89..00000000 --- a/testdata/mymodule2/class/Common/Migrate.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @link https://xoops.org - */ - -class Migrate extends \Xmf\Database\Migrate -{ - private $renameTables; - - /** - * Migrate constructor. - * @param Common\Configurator $configurator - * @throws \RuntimeException - * @throws \InvalidArgumentException - */ - public function __construct(Common\Configurator $configurator = null) - { - if (null !== $configurator) { - $this->renameTables = $configurator->renameTables; - - $moduleDirName = basename(dirname(dirname(__DIR__))); - parent::__construct($moduleDirName); - } - } - - /** - * change table prefix if needed - */ - private function changePrefix() - { - foreach ($this->renameTables as $oldName => $newName) { - if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { - $this->tableHandler->renameTable($oldName, $newName); - } - } - } - - /** - * Change integer IPv4 column to varchar IPv6 capable - * - * @param string $tableName table to convert - * @param string $columnName column with IP address - */ - private function convertIPAddresses($tableName, $columnName) - { - if ($this->tableHandler->useTable($tableName)) { - $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); - if (false !== mb_strpos($attributes, ' int(')) { - if (false === mb_strpos($attributes, 'unsigned')) { - $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); - $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); - } - $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45) NOT NULL DEFAULT '' "); - $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false); - } - } - } - - /** - * Move do* columns from newbb_posts to newbb_posts_text table - */ - private function moveDoColumns() - { - $tableName = 'newbb_posts_text'; - $srcTableName = 'newbb_posts'; - if ($this->tableHandler->useTable($tableName) - && $this->tableHandler->useTable($srcTableName)) { - $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml'); - if (false === $attributes) { - $this->synchronizeTable($tableName); - $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); - $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); - $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; - $this->tableHandler->addToQueue($sql); - } - } - } - - /** - * Perform any upfront actions before synchronizing the schema - * - * Some typical uses include - * table and column renames - * data conversions - */ - protected function preSyncActions() - { - /* - // change 'bb' table prefix to 'newbb' - $this->changePrefix(); - // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point - $this->moveDoColumns(); - // Convert IP address columns from int to readable varchar(45) for IPv6 - $this->convertIPAddresses('newbb_posts', 'poster_ip'); - $this->convertIPAddresses('newbb_report', 'reporter_ip'); - */ - } -} diff --git a/testdata/mymodule2/class/Common/ModuleFeedback.php b/testdata/mymodule2/class/Common/ModuleFeedback.php deleted file mode 100644 index 40453a3e..00000000 --- a/testdata/mymodule2/class/Common/ModuleFeedback.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object ModuleFeedback - */ -class ModuleFeedback extends \XoopsObject -{ - public $name = ''; - public $email = ''; - public $site = ''; - public $type = ''; - public $content = ''; - - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * @public function getFormFeedback: - * provide form for sending a feedback to module author - * @param bool $action - * @return \XoopsThemeForm - */ - public function getFormFeedback($action = false) - { - if (false === $action) { - $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); - } - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $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')); - $recipient->setExtra('disabled="disabled"'); - $form->addElement($recipient); - $your_name = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); - $your_name->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); - $form->addElement($your_name); - $your_site = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); - $your_site->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); - $form->addElement($your_site); - $your_mail = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); - $your_mail->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); - $form->addElement($your_mail); - - $fbtypeSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); - $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')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); - $form->addElement($fbtypeSelect, true); - - $editorConfigs = []; - $editorConfigs['name'] = 'fb_content'; - $editorConfigs['value'] = $this->content; - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname('system'); - $configHandler = xoops_getHandler('config'); - $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); - - $form->addElement(new \XoopsFormHidden('op', 'send')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - - return $form; - } -} diff --git a/testdata/mymodule2/class/Common/Resizer.php b/testdata/mymodule2/class/Common/Resizer.php deleted file mode 100644 index aacae97e..00000000 --- a/testdata/mymodule2/class/Common/Resizer.php +++ /dev/null @@ -1,294 +0,0 @@ - - Website: - * @version $Id: 1.0 Resizer.php 1 Mon 2019-02-09 10:04:49Z XOOPS Project (www.xoops.org) $ - */ -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 = ''; - - /** - * resize image if size exceed given width/height - * @return string|bool - */ - public function resizeImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $img = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $img = imagecreatefromjpeg($this->sourceFile); - if (!$img) { - $img = imagecreatefromstring(file_get_contents($this->sourceFile)); - } - break; - case 'image/gif': - $img = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - $width = imagesx($img); - $height = imagesy($img); - - if ($width > $this->maxWidth || $height > $this->maxHeight) { - // recalc image size based on this->maxWidth/this->maxHeight - if ($width > $height) { - if ($width < $this->maxWidth) { - $new_width = $width; - } else { - $new_width = $this->maxWidth; - $divisor = $width / $new_width; - $new_height = floor($height / $divisor); - } - } elseif ($height < $this->maxHeight) { - $new_height = $height; - } else { - $new_height = $this->maxHeight; - $divisor = $height / $new_height; - $new_width = floor($width / $divisor); - } - - // Create a new temporary image. - $tmpimg = imagecreatetruecolor($new_width, $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); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - imagepng($tmpimg, $this->endFile, 0); - break; - case 'image/jpeg': - imagejpeg($tmpimg, $this->endFile, 100); - break; - case 'image/gif': - imagegif($tmpimg, $this->endFile); - break; - } - - // release the memory - imagedestroy($tmpimg); - } else { - return 'copy'; - } - imagedestroy($img); - - return true; - } - - /** - * @return bool|string - */ - public function resizeAndCrop() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // GET ORIGINAL IMAGE DIMENSIONS - list($original_w, $original_h) = getimagesize($this->sourceFile); - - // RESIZE IMAGE AND PRESERVE PROPORTIONS - $max_width_resize = $this->maxWidth; - $max_height_resize = $this->maxHeight; - if ($original_w > $original_h) { - $max_height_ratio = $this->maxHeight / $original_h; - $max_width_resize = (int)round($original_w * $max_height_ratio); - } else { - $max_width_ratio = $this->maxWidth / $original_w; - $max_height_resize = (int)round($original_h * $max_width_ratio); - } - if ($max_width_resize < $this->maxWidth) { - $max_height_ratio = $this->maxWidth / $max_width_resize; - $max_height_resize = (int)round($this->maxHeight * $max_height_ratio); - $max_width_resize = $this->maxWidth; - } - - // CREATE THE PROPORTIONAL IMAGE RESOURCE - $thumb = imagecreatetruecolor($max_width_resize, $max_height_resize); - if (!imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { - return false; - } - // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS - $final = imagecreatetruecolor($this->maxWidth, $this->maxHeight); - - $max_width_offset = 0; - $max_height_offset = 0; - if ($this->maxWidth < $max_width_resize) { - $max_width_offset = (int)round(($max_width_resize - $this->maxWidth) / 2); - } else { - $max_height_offset = (int)round(($max_height_resize - $this->maxHeight) / 2); - } - - if (!imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { - return false; - } - // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile - if (!imagejpeg($final, $this->endFile, $this->jpgQuality)) { - return false; - } - - return true; - } - - public function mergeImage() - { - $dest = imagecreatefromjpeg($this->endFile); - $src = imagecreatefromjpeg($this->sourceFile); - if (4 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 2 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 2 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 3: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 4: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - if (6 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 3 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 3 + 1); - $posCol3 = $posCol2 + (int)round($this->maxWidth / 3 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center - break; - case 3: - imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 4: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 5: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center - break; - case 6: - imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - imagejpeg($dest, $this->endFile); - - imagedestroy($src); - imagedestroy($dest); - } - - /** - * @return bool|string - */ - public function rotateImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // Rotate - $tmpimg = imagerotate($original, $this->degrees, 0); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - if (!imagepng($tmpimg, $this->endFile, 0)) { - return false; - } - break; - case 'image/jpeg': - if (!imagejpeg($tmpimg, $this->endFile, $this->jpgQuality)) { - return false; - } - break; - case 'image/gif': - if (!imagegif($tmpimg, $this->endFile)) { - return false; - } - break; - } - - // release the memory - imagedestroy($tmpimg); - - return true; - } -} diff --git a/testdata/mymodule2/class/Common/ServerStats.php b/testdata/mymodule2/class/Common/ServerStats.php deleted file mode 100644 index 0c06d84c..00000000 --- a/testdata/mymodule2/class/Common/ServerStats.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -trait ServerStats -{ - /** - * serverStats() - * - * @return string - */ - public static function getServerStats() - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - $html = ''; - // $sql = 'SELECT metavalue'; - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); - // $sql .= " WHERE metakey='version' LIMIT 1"; - // $query = $GLOBALS['xoopsDB']->query($sql); - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= '
      '; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; - $html .= "
      "; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; - // $html .= "
      "; - // $html .= "
      "; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; - $html .= '
        '; - - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; - } - } - - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - - // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; - $html .= '
      '; - $html .= '
        '; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; - $html .= '
      '; - $html .= '
      '; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; - $html .= '
      '; - $html .= '

      '; - - return $html; - } -} diff --git a/testdata/mymodule2/class/Common/VersionChecks.php b/testdata/mymodule2/class/Common/VersionChecks.php deleted file mode 100644 index ab175822..00000000 --- a/testdata/mymodule2/class/Common/VersionChecks.php +++ /dev/null @@ -1,144 +0,0 @@ - - */ -trait VersionChecks -{ - /** - * Verifies XOOPS version meets minimum requirements for this module - * @static - * - * @param null|string $requiredVer - * @return bool true if meets requirements, false if not - */ - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - - //check for minimum XOOPS version - $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 - } - $success = true; - - if (version_compare($currentVer, $requiredVer, '<')) { - $success = false; - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); - } - - return $success; - } - - /** - * Verifies PHP version meets minimum requirements for this module - * @static - * - * @return bool true if meets requirements, false if not - */ - public static function checkVerPhp(\XoopsModule $module = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - // check for minimum PHP version - $success = true; - - $verNum = PHP_VERSION; - $reqVer = &$module->getInfo('min_php'); - - if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); - $success = false; - } - } - - return $success; - } - - /** - * compares current module version with latest GitHub release - * @static - * @param \Xmf\Module\Helper $helper - * @param string|null $source - * @param string|null $default - * - * @return string|array info about the latest module version, if newer - */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; - // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; - $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"]); - $curlReturn = curl_exec($curlHandle); - if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); - } elseif (mb_strpos($curlReturn, 'Not Found')) { - 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); - $latestVersion = $file[0]->tag_name; - $prerelease = $file[0]->prerelease; - if ('master' !== $latestVersionLink) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; - } - //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); - if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); - } - $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); - //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); - // $moduleVersion = '1.0'; //for testing only - // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { - $ret = []; - $ret[] = $update; - $ret[] = $latestVersionLink; - } - } - curl_close($curlHandle); - } - } - - return $ret; - } -} diff --git a/testdata/mymodule2/class/Common/index.html b/testdata/mymodule2/class/Common/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/class/Constants.php b/testdata/mymodule2/class/Constants.php deleted file mode 100644 index 40f54536..00000000 --- a/testdata/mymodule2/class/Constants.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Constants - */ -class Constants -{ - // Constants for status - const STATUS_NONE = 0; - const STATUS_OFFLINE = 1; - const STATUS_SUBMITTED = 2; - const STATUS_APPROVED = 3; - - // Constants for permissions - const PERM_GLOBAL_NONE = 0; - const PERM_GLOBAL_VIEW = 1; - const PERM_GLOBAL_SUBMIT = 2; - const PERM_GLOBAL_APPROVE = 3; - -} diff --git a/testdata/mymodule2/class/Helper.php b/testdata/mymodule2/class/Helper.php deleted file mode 100644 index 86e3ce71..00000000 --- a/testdata/mymodule2/class/Helper.php +++ /dev/null @@ -1,88 +0,0 @@ -debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); - parent::__construct($moduleDirName); - } - - /** - * @param bool $debug - * - * @return \XoopsModules\Mymodule2\Helper - */ - public static function getInstance($debug = false) - { - static $instance; - if (null === $instance) { - $instance = new static($debug); - } - - return $instance; - } - - /** - * @return string - */ - public function getDirname() - { - return $this->dirname; - } - - /** - * Get an Object Handler - * - * @param string $name name of handler to load - * - * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler - */ - public function getHandler($name) - { - $ret = false; - - $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; - if (!class_exists($class)) { - throw new \RuntimeException("Class '$class' not found"); - } - /** @var \XoopsMySQLDatabase $db */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - $helper = self::getInstance(); - $ret = new $class($db, $helper); - $this->addLog("Getting handler '{$name}'"); - - return $ret; - } -} -//require __DIR__ . '/../../mainfile.php'; diff --git a/testdata/mymodule2/class/Permissions.php b/testdata/mymodule2/class/Permissions.php deleted file mode 100644 index 0b96a740..00000000 --- a/testdata/mymodule2/class/Permissions.php +++ /dev/null @@ -1,56 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Permissions - */ -class Permissions extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } -} diff --git a/testdata/mymodule2/class/Permissionshandler.php b/testdata/mymodule2/class/Permissionshandler.php deleted file mode 100644 index 4970729e..00000000 --- a/testdata/mymodule2/class/Permissionshandler.php +++ /dev/null @@ -1,145 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Permissionshandler - */ -class Permissionshandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @public function permGlobalApprove - * returns right for global approve - * - * @param null - * return bool - */ - public function getPermGlobalApprove() - { - global $xoopsUser, $xoopsModule; - $currentuid = 0; - if (isset($xoopsUser) && is_object($xoopsUser)) { - if ($xoopsUser->isAdmin($xoopsModule->mid())) { - return true; - } - $currentuid = $xoopsUser->uid(); - } - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $xoopsModule->mid(); - $memberHandler = xoops_getHandler('member'); - if (0 == $currentuid) { - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; - } else { - $my_group_ids = $memberHandler->getGroupsByUser($currentuid);; - } - if ($grouppermHandler->checkRight('mymodule2_ac', 4, $my_group_ids, $mid)) { - return true; - } - return false; - } - - /** - * @public function permGlobalSubmit - * returns right for global submit - * - * @param null - * return bool - */ - public function getPermGlobalSubmit() - { - global $xoopsUser, $xoopsModule; - $currentuid = 0; - if (isset($xoopsUser) && is_object($xoopsUser)) { - if ($xoopsUser->isAdmin($xoopsModule->mid())) { - return true; - } - $currentuid = $xoopsUser->uid(); - } - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $xoopsModule->mid(); - $memberHandler = xoops_getHandler('member'); - if (0 == $currentuid) { - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; - } else { - $my_group_ids = $memberHandler->getGroupsByUser($currentuid);; - } - if ($this->getGlobalApprove()) { - return true; - } - if ($grouppermHandler->checkRight('mymodule2_ac', 8, $my_group_ids, $mid)) { - return true; - } - return false; - } - - /** - * @public function permGlobalView - * returns right for global view - * - * @param null - * return bool - */ - public function getPermGlobalView() - { - global $xoopsUser, $xoopsModule; - $currentuid = 0; - if (isset($xoopsUser) && is_object($xoopsUser)) { - if ($xoopsUser->isAdmin($xoopsModule->mid())) { - return true; - } - $currentuid = $xoopsUser->uid(); - } - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $xoopsModule->mid(); - $memberHandler = xoops_getHandler('member'); - if (0 == $currentuid) { - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; - } else { - $my_group_ids = $memberHandler->getGroupsByUser($currentuid);; - } - if ($this->getGlobalApprove()) { - return true; - } - if ($this->getGlobalSubmit()) { - return true; - } - if ($grouppermHandler->checkRight('mymodule2_ac', 16, $my_group_ids, $mid)) { - return true; - } - return false; - } -} diff --git a/testdata/mymodule2/class/Testfields.php b/testdata/mymodule2/class/Testfields.php deleted file mode 100644 index 0e4c6756..00000000 --- a/testdata/mymodule2/class/Testfields.php +++ /dev/null @@ -1,322 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Testfields - */ -class Testfields extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('tf_id', XOBJ_DTYPE_INT); - $this->initVar('tf_text', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_textarea', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_dhtml', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_checkbox', XOBJ_DTYPE_INT); - $this->initVar('tf_yesno', XOBJ_DTYPE_INT); - $this->initVar('tf_selectbox', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_user', XOBJ_DTYPE_INT); - $this->initVar('tf_color', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_imagelist', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_urlfile', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_uplimage', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_uplfile', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_textdateselect', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_selectfile', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_status', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdTestfields() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return XoopsThemeForm - */ - public function getFormTestfields($action = false) - { - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - if (false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Permissions for uploader - $grouppermHandler = xoops_getHandler('groupperm'); - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; - if ($GLOBALS['xoopsUser']) { - if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } else { - $permissionUpload = true; - } - } else { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE2_TESTFIELD_ADD) : sprintf(_AM_MYMODULE2_TESTFIELD_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Form Text TfText - $form->addElement(new \XoopsFormText( _AM_MYMODULE2_TESTFIELD_TEXT, 'tf_text', 50, 255, $this->getVar('tf_text') )); - // Form Text Area TfTextarea - $form->addElement(new \XoopsFormTextArea( _AM_MYMODULE2_TESTFIELD_TEXTAREA, 'tf_textarea', $this->getVar('tf_textarea'), 4, 47 )); - // Form editor TfDhtml - $editorConfigs = []; - $editorConfigs['name'] = 'tf_dhtml'; - $editorConfigs['value'] = $this->getVar('tf_dhtml', 'e'); - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $editorConfigs['editor'] = $helper->getConfig('editor_dhtml'); - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE2_TESTFIELD_DHTML, 'tf_dhtml', $editorConfigs)); - // Form Check Box TfCheckbox - $tfCheckbox = $this->isNew() ? 0 : $this->getVar('tf_checkbox'); - $checkTfCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_TESTFIELD_CHECKBOX, 'tf_checkbox', $tfCheckbox); - $checkTfCheckbox->addOption(1, _AM_MYMODULE2_TESTFIELD_CHECKBOX); - $form->addElement($checkTfCheckbox); - // Form Radio Yes/No TfYesno - $tfYesno = $this->isNew() ? 0 : $this->getVar('tf_yesno'); - $form->addElement(new \XoopsFormRadioYN( _AM_MYMODULE2_TESTFIELD_YESNO, 'tf_yesno', $tfYesno)); - // Testfields handler - $testfieldsHandler = $helper->getHandler('testfields'); - // Form Select Testfields - $tfSelectboxSelect = new \XoopsFormSelect( _AM_MYMODULE2_TESTFIELD_SELECTBOX, 'tf_selectbox', $this->getVar('tf_selectbox')); - $tfSelectboxSelect->addOption('Empty'); - $tfSelectboxSelect->addOptionArray($testfieldsHandler->getList()); - $form->addElement($tfSelectboxSelect); - // Form Select User TfUser - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE2_TESTFIELD_USER, 'tf_user', false, $this->getVar('tf_user') )); - // Form Color Picker TfColor - $form->addElement(new \XoopsFormColorPicker( _AM_MYMODULE2_TESTFIELD_COLOR, 'tf_color', $this->getVar('tf_color') ), true); - // Form Frameworks Image Files TfImagelist - $getTfImagelist = $this->getVar('tf_imagelist'); - $tfImagelist = $getTfImagelist ? $getTfImagelist : 'blank.gif'; - $imageDirectory = '/Frameworks/moduleclasses/icons/32'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_IMAGELIST, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_TESTFIELD_IMAGELIST_UPLOADS, ".{$imageDirectory}/"), 'tf_imagelist', $tfImagelist, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_tf_imagelist\", \"tf_imagelist\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form File - $fileSelectTray = new \XoopsFormElementTray('', '
      ' ); - $fileSelectTray->addElement(new \XoopsFormFile( _AM_MYMODULE2_FORM_UPLOAD_NEW, 'tf_imagelist', $helper->getConfig('maxsize_image') )); - $fileSelectTray->addElement(new \XoopsFormLabel('')); - $imageTray->addElement($fileSelectTray); - $form->addElement($imageTray); - // Form Url Text File TfUrlfile - $formUrlFile = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_URLFILE, '

      ' ); - $formUrl = $this->isNew() ? '' : $this->getVar('tf_urlfile'); - $formText = new \XoopsFormText( _AM_MYMODULE2_TESTFIELD_URLFILE_UPLOADS, 'tf_urlfile', 75, 255, $formUrl ); - $formUrlFile->addElement($formText); - $formUrlFile->addElement(new \XoopsFormFile( _AM_MYMODULE2_FORM_UPLOAD, 'tf_urlfile', $helper->getConfig('maxsize_file') )); - $form->addElement($formUrlFile); - // Form Image TfUplimage - // Form Image TfUplimage: Select Uploaded Image - $getTfUplimage = $this->getVar('tf_uplimage'); - $tfUplimage = $getTfUplimage ? $getTfUplimage : 'blank.gif'; - $imageDirectory = '/uploads/mymodule2/images/testfields'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_UPLIMAGE, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_TESTFIELD_UPLIMAGE_UPLOADS, ".{$imageDirectory}/"), 'tf_uplimage', $tfUplimage, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_tf_uplimage\", \"tf_uplimage\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form Image TfUplimage: Upload new image - if ($permissionUpload) { - $maxsize = $helper->getConfig('maxsize_image'); - $imageTray->addElement(new \XoopsFormFile( '
      ' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'tf_uplimage', $maxsize )); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); - } else { - $imageTray->addElement(new \XoopsFormHidden( 'tf_uplimage', $tfUplimage )); - } - $form->addElement($imageTray, ); - // Form File TfUplfile - $tfUplfile = $this->isNew() ? '' : $this->getVar('tf_uplfile'); - if ($permissionUpload) { - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_UPLFILE, '
      ' ); - $fileDirectory = '/uploads/mymodule2/files/testfields'; - if (!$this->isNew()) { - $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE2_TESTFIELD_UPLFILE_UPLOADS, ".{$fileDirectory}/"), $tfUplfile)); - } - $maxsize = $helper->getConfig('maxsize_file'); - $fileUploadTray->addElement(new \XoopsFormFile( '', 'tf_uplfile', $maxsize )); - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); - $form->addElement($fileUploadTray, ); - } else { - $form->addElement(new \XoopsFormHidden( 'tf_uplfile', $tfUplfile )); - } - // Form Text Date Select TfTextdateselect - $tfTextdateselect = $this->isNew() ? 0 : $this->getVar('tf_textdateselect'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_TESTFIELD_TEXTDATESELECT, 'tf_textdateselect', '', $tfTextdateselect )); - // Form File TfSelectfile - // Form File TfSelectfile: Select Uploaded File - $getTfSelectfile = $this->getVar('tf_selectfile'); - $tfSelectfile = $getTfSelectfile ? $getTfSelectfile : 'blank.gif'; - $fileDirectory = '/uploads/mymodule2/files/testfields'; - $fileTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_SELECTFILE, '
      ' ); - $fileSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_TESTFIELD_SELECTFILE_UPLOADS, ".{$fileDirectory}/"), 'tf_selectfile', $tfSelectfile, 5); - $fileArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $fileDirectory ); - foreach($fileArray as $file1) { - $fileSelect->addOption("{$file1}", $file1); - } - $fileTray->addElement($fileSelect, false); - // Form File TfSelectfile: Upload new file - if ($permissionUpload) { - $maxsize = $helper->getConfig('maxsize_file'); - $fileTray->addElement(new \XoopsFormFile( '
      ' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'tf_selectfile', $maxsize )); - $fileTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); - } else { - $fileTray->addElement(new \XoopsFormHidden( 'tf_selectfile', $tfSelectfile )); - } - $form->addElement($fileTray, ); - // Form Select Testfields - $tfStatusSelect = new \XoopsFormSelect( _AM_MYMODULE2_TESTFIELD_STATUS, 'tf_status', $this->getVar('tf_status')); - $tfStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE2_STATUS_NONE); - $tfStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE2_STATUS_OFFLINE); - $tfStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE2_STATUS_SUBMITTED); - $tfStatusSelect->addOption(Constants::STATUS_APPROVED, _AM_MYMODULE2_STATUS_APPROVED); - $form->addElement($tfStatusSelect); - // Permissions - $memberHandler = xoops_getHandler('member'); - $groupList = $memberHandler->getGroupList(); - $grouppermHandler = xoops_getHandler('groupperm'); - $fullList[] = array_keys($groupList); - if (!$this->isNew()) { - $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule2_approve_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsApprove[] = array_values($groupsIdsApprove); - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_testfields[]', $groupsIdsApprove); - $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule2_submit_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsSubmit[] = array_values($groupsIdsSubmit); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_testfields[]', $groupsIdsSubmit); - $groupsIdsView = $grouppermHandler->getGroupIds('mymodule2_view_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsView[] = array_values($groupsIdsView); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_testfields[]', $groupsIdsView); - } else { - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_testfields[]', $fullList); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_testfields[]', $fullList); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_testfields[]', $fullList); - } - // To Approve - $groupsCanApproveCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanApproveCheckbox); - // To Submit - $groupsCanSubmitCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanSubmitCheckbox); - // To View - $groupsCanViewCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanViewCheckbox); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesTestfields($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('tf_id'); - $ret['text'] = $this->getVar('tf_text'); - $ret['textarea'] = strip_tags($this->getVar('tf_textarea')); - $ret['dhtml'] = strip_tags($this->getVar('tf_dhtml')); - $ret['checkbox'] = $this->getVar('tf_checkbox'); - $ret['yesno'] = $this->getVar('tf_yesno'); - $ret['yesno_text'] = (int)$this->getVar('tf_yesno') > 0 ? _YES : _NO; - $ret['selectbox'] = $this->getVar('tf_selectbox'); - $ret['user'] = \XoopsUser::getUnameFromId($this->getVar('tf_user')); - $ret['color'] = $this->getVar('tf_color'); - $ret['imagelist'] = $this->getVar('tf_imagelist'); - $ret['urlfile'] = $this->getVar('tf_urlfile'); - $ret['uplimage'] = $this->getVar('tf_uplimage'); - $ret['uplfile'] = $this->getVar('tf_uplfile'); - $ret['textdateselect'] = formatTimeStamp($this->getVar('tf_textdateselect'), 's'); - $ret['selectfile'] = $this->getVar('tf_selectfile'); - $ret['status'] = $this->getVar('tf_status'); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayTestfields() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule2/class/Testfieldshandler.php b/testdata/mymodule2/class/Testfieldshandler.php deleted file mode 100644 index 07b01e5b..00000000 --- a/testdata/mymodule2/class/Testfieldshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule2; - - -/** - * Class Object Handler Testfields - */ -class TestfieldsHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null|XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule2_testfields', Testfields::class, 'tf_id', 'tf_text'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Testfields in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') - { - $crCountTestfields = new \CriteriaCompo(); - $crCountTestfields = $this->getTestfieldsCriteria($crCountTestfields, $start, $limit, $sort, $order); - return parent::getCount($crCountTestfields); - } - - /** - * Get All Testfields in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') - { - $crAllTestfields = new \CriteriaCompo(); - $crAllTestfields = $this->getTestfieldsCriteria($crAllTestfields, $start, $limit, $sort, $order); - return parent::getAll($crAllTestfields); - } - - /** - * Get Criteria Testfields - * @param $crTestfields - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getTestfieldsCriteria($crTestfields, $start, $limit, $sort, $order) - { - $crTestfields->setStart( $start ); - $crTestfields->setLimit( $limit ); - $crTestfields->setSort( $sort ); - $crTestfields->setOrder( $order ); - return $crTestfields; - } -} diff --git a/testdata/mymodule2/class/Utility.php b/testdata/mymodule2/class/Utility.php deleted file mode 100644 index d715ee41..00000000 --- a/testdata/mymodule2/class/Utility.php +++ /dev/null @@ -1,253 +0,0 @@ - - * @author Mamba - * @since - */ - -use XoopsModules\Mymodule2; - -/** - * Class Utility - */ -class Utility -{ - use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits - - use Common\ServerStats; // getServerStats Trait - - use Common\FilesManagement; // Files Management Trait - - /** - * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags - * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags - * www.cakephp.org - * - * @param string $text String to truncate. - * @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 - * - * @return string Trimmed string. - */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) - { - if ($considerHtml) { - // if the plain text is shorter than the maximum length, return the whole text - 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); - $open_tags = []; - $truncate = ''; - foreach ($lines as $line_matchings) { - // if there is any html-tag in this line, handle it and add it (uncounted) to the output - if (!empty($line_matchings[1])) { - // if it's an "empty element" with or without xhtml-conform closing slash - if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { - // do nothing - // if tag is a closing tag - } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { - // delete tag from $open_tags list - $pos = array_search($tag_matchings[1], $open_tags, true); - if (false !== $pos) { - unset($open_tags[$pos]); - } - // if tag is an opening tag - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { - // add tag to the beginning of $open_tags list - array_unshift($open_tags, mb_strtolower($tag_matchings[1])); - } - // add html-tag to $truncate'd text - $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])); - 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)) { - // 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]); - } else { - // no more characters left - break; - } - } - } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); - // maximum lenght is reached, so get off the loop - break; - } - $truncate .= $line_matchings[2]; - $total_length += $content_length; - - // if the maximum length is reached, get off the loop - if ($total_length >= $length) { - break; - } - } - } else { - if (mb_strlen($text) <= $length) { - return $text; - } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); - } - // if the words shouldn't be cut in the middle... - if (!$exact) { - // ...search the last occurance of a space... - $spacepos = mb_strrpos($truncate, ' '); - if (isset($spacepos)) { - // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); - } - } - // add the defined ending to the text - $truncate .= $ending; - if ($considerHtml) { - // close all unclosed html-tags - foreach ($open_tags as $tag) { - $truncate .= ''; - } - } - - return $truncate; - } - - /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options - * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor - */ - public static function getEditor($helper = null, $options = null) - { - /** @var Mymodule2\Helper $helper */ - if (null === $options) { - $options = []; - $options['name'] = 'Editor'; - $options['value'] = 'Editor'; - $options['rows'] = 10; - $options['cols'] = '100%'; - $options['width'] = '100%'; - $options['height'] = '400px'; - } - - $isAdmin = $helper->isUserAdmin(); - - if (class_exists('XoopsFormEditor')) { - if ($isAdmin) { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); - } else { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); - } - } else { - $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); - } - - // $form->addElement($descEditor); - - return $descEditor; - } - - //--------------- Custom module methods ----------------------------- - - /** - * @param $about - * @return string - */ - public static function MakeDonationForm($about) - { - $donationform = [ - 0 => '
      ', - 1 => '
      ' - . _AM_MYMODULE2_ABOUT_MAKE_DONATION - . '
      ' - . _AM_MYMODULE2_DONATION_AMOUNT - . '*
      ', - 2 => '
      ', - 'D' => '', - 3 => '', - 4 => ' - -', - ]; - $paypalform = [ - 0 => '
      ', - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 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; - } - } - $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); - $aboutRes .= implode("\n", $donationform); - $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); - - return $aboutRes; - } - - /** - * @param $str - * - * @return string - */ - public static function UcFirstAndToLower($str) - { - return ucfirst(mb_strtolower(trim($str))); - } -} diff --git a/testdata/mymodule2/class/index.html b/testdata/mymodule2/class/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/class/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/config/admin.yml b/testdata/mymodule2/config/admin.yml deleted file mode 100644 index 32d9dd3d..00000000 --- a/testdata/mymodule2/config/admin.yml +++ /dev/null @@ -1 +0,0 @@ -displaySampleButton: 1 diff --git a/testdata/mymodule2/config/config.php b/testdata/mymodule2/config/config.php deleted file mode 100644 index cce30a7d..00000000 --- a/testdata/mymodule2/config/config.php +++ /dev/null @@ -1,72 +0,0 @@ - - Website: - */ - -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -return (object)[ - 'name' => mb_strtoupper($moduleDirName) . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/testfields', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/testfields', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/testfields', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/temp', - ], - 'copyBlankFiles' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/testfields', - ], - 'copyTestFolders' => [ - XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - ], - 'templateFolders' => [ - '/templates/', - ], - 'oldFiles' => [ - ], - 'oldFolders' => [ - ], - 'renameTables' => [ - ], - 'moduleStats' => [ - ], - 'modCopyright' => "XOOPS Project", -]; diff --git a/testdata/mymodule2/config/icons.php b/testdata/mymodule2/config/icons.php deleted file mode 100644 index 0eba0bc5..00000000 --- a/testdata/mymodule2/config/icons.php +++ /dev/null @@ -1,22 +0,0 @@ - mb_strtoupper($moduleDirName) . ' IconConfigurator', - 'icons' => [ - 'edit' => " . _EDIT . ", - 'delete' => "" . _DELETE . "", - 'clone' => "" . _CLONE . "", - 'preview' => "" . _PREVIEW . "", - 'print' => "" . _CLONE . "", - 'pdf' => "" . _CLONE . "", - 'add' => "" . _ADD . "", - '0' => "" . 0 . "", - '1' => "" . 1 . "", - ], - ]; -} diff --git a/testdata/mymodule2/config/index.html b/testdata/mymodule2/config/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/config/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/config/paths.php b/testdata/mymodule2/config/paths.php deleted file mode 100644 index 2ff95a2c..00000000 --- a/testdata/mymodule2/config/paths.php +++ /dev/null @@ -1,25 +0,0 @@ - mb_strtoupper($moduleDirName) . ' PathConfigurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - ]; -} diff --git a/testdata/mymodule2/docs/changelog.txt b/testdata/mymodule2/docs/changelog.txt deleted file mode 100644 index 8ed56037..00000000 --- a/testdata/mymodule2/docs/changelog.txt +++ /dev/null @@ -1,4 +0,0 @@ -============================================================== -Change Log for My Module 2 - 2020/04/16 20:35:36 Version 1.0 -============================================================== - - Original release mymodule2 (TDM XOOPS) \ No newline at end of file diff --git a/testdata/mymodule2/docs/credits.txt b/testdata/mymodule2/docs/credits.txt deleted file mode 100644 index bf06b0ab..00000000 --- a/testdata/mymodule2/docs/credits.txt +++ /dev/null @@ -1,10 +0,0 @@ -Read Me First -============= - -Originally created by the TDM Team. - -Modified by Timgno (http://www.txmodxoops.org) - -Contributors: Mamba (https://xoops.org), Goffy (German Xoops) - -Included ideas for Logo Generator from Trabis (Publisher module) and Suin (Koins module) \ No newline at end of file diff --git a/testdata/mymodule2/docs/index.html b/testdata/mymodule2/docs/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/docs/install.txt b/testdata/mymodule2/docs/install.txt deleted file mode 100644 index 469bfd3a..00000000 --- a/testdata/mymodule2/docs/install.txt +++ /dev/null @@ -1,4 +0,0 @@ -Read Me First -============= - -Install just like another XOOPS module \ No newline at end of file diff --git a/testdata/mymodule2/docs/lang.diff b/testdata/mymodule2/docs/lang.diff deleted file mode 100644 index 233be6a5..00000000 --- a/testdata/mymodule2/docs/lang.diff +++ /dev/null @@ -1,7 +0,0 @@ -Legend : -+ Added -- Removed -* Modified - -To see the differences of language files, see the language folder -+ file name update language 1:59 to 1.91 \ No newline at end of file diff --git a/testdata/mymodule2/docs/license.txt b/testdata/mymodule2/docs/license.txt deleted file mode 100644 index aac9317c..00000000 --- a/testdata/mymodule2/docs/license.txt +++ /dev/null @@ -1,66 +0,0 @@ -End User License Agreement for Xoops Modules - -IMPORTANT NOTICE Read and understand this License -Agreement carefully before installing and using this Software. -It contains extremely important information. - -BY USING THIS SOFTWARE IN ANY WAY YOU ACKNOWLEDGE -THAT YOU HAVE READ, UNDERSTAND AND AGREE TO THE -TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO -THESE TERMS, DO NOT USE THIS SOFTWARE IN ANY WAY, -AND PROMPTLY RETURN IT OR DELETE ANY COPIES OF -THIS SOFTWARE IN YOUR POSSESSION. - -LICENSE GRANT the copyright holder grants you a non-exclusive -license to use this software, and any associated documentation -("The Software"), as indicated herein. - -You may install and use the Software on two computers for your use -only. - -RESTRICTIONS You MAY NOT: (a) sell or distribute this Software -package without prior written approval (b) cause or permit reverse -engineering, disassembly, decompilation or alteration of this -Software; (c) remove any product identification, copyright notices, -or other notices or proprietary restrictions from this Software; - -TERM: This License is effective until terminated. You may terminate -it at any time by destroying the Software, together with all copies -thereof. This License will also terminate if you fail to comply with any -term or condition of this Agreement. Upon such termination, you -agree to destroy the Software, together with all copies thereof. - -COPYRIGHT/OWNERSHIP This Software and its source -code are proprietary products of Pablo Software Solutions -and are protected by copyright, trade secret and other intellectual -property laws. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -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 -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 -spyware. The maker of this software does not support any -questionable forms of use where this software could be misused in -any way. - -http://www.txmodxoops.org -https://xoops.org diff --git a/testdata/mymodule2/docs/readme.txt b/testdata/mymodule2/docs/readme.txt deleted file mode 100644 index 62b1640e..00000000 --- a/testdata/mymodule2/docs/readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -Read Me First -============= - -Please make sure that you download the XOOPS Icon Set, and upload it to uploads/images directory -Read the table in admin help for the accurate description of the functionality of this module - -Using the new class xoopsrequest.php - -Version of xoops ----------------- -TDMCreate is a module that create other basic modules for CMS Xoops. - -Tested with xoops 2.5.7, you can not use it with earlier versions, unless because you do not fit some core files in the background and after some tests. - -Now that is ahead xoops versions, and goes to 2.6.0, you should download xoops 2.5.7 and use with this latest version. - -Therefore recommended not to use TDMCreate 1.91, with previous versions, to xoops 2.5.7 \ No newline at end of file diff --git a/testdata/mymodule2/footer.php b/testdata/mymodule2/footer.php deleted file mode 100644 index 25e72135..00000000 --- a/testdata/mymodule2/footer.php +++ /dev/null @@ -1,33 +0,0 @@ - - Website: - */ -if (count($xoBreadcrumbs) > 1) { - $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); -} -$GLOBALS['xoopsTpl']->assign('adv', $helper->getConfig('advertise')); -// -$GLOBALS['xoopsTpl']->assign('bookmarks', $helper->getConfig('bookmarks')); -$GLOBALS['xoopsTpl']->assign('fbcomments', $helper->getConfig('fbcomments')); -// -$GLOBALS['xoopsTpl']->assign('admin', MYMODULE2_ADMIN); -$GLOBALS['xoopsTpl']->assign('copyright', $copyright); -// -include_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/testdata/mymodule2/header.php b/testdata/mymodule2/header.php deleted file mode 100644 index 2d2648ec..00000000 --- a/testdata/mymodule2/header.php +++ /dev/null @@ -1,56 +0,0 @@ - - Website: - */ -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include __DIR__ . '/include/common.php'; -$moduleDirName = basename(__DIR__); -// Breadcrumbs -$xoBreadcrumbs = []; -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_TITLE, 'link' => MYMODULE2_URL . '/']; -// Get instance of module -$helper = \XoopsModules\Mymodule2\Helper::getInstance(); -$categoriesHandler = $helper->getHandler('categories'); -$articlesHandler = $helper->getHandler('articles'); -$testfieldsHandler = $helper->getHandler('testfields'); -// Permission -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -$grouppermHandler = xoops_getHandler('groupperm'); -if (is_object($xoopsUser)) { - $groups = $xoopsUser->getGroups(); -} else { - $groups = XOOPS_GROUP_ANONYMOUS; -} -// -$myts = MyTextSanitizer::getInstance(); -// Default Css Style -$style = MYMODULE2_URL . '/assets/css/style.css'; -if (!file_exists($style)) { - return false; -} -// Smarty Default -$sysPathIcon16 = $GLOBALS['xoopsModule']->getInfo('sysicons16'); -$sysPathIcon32 = $GLOBALS['xoopsModule']->getInfo('sysicons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -$modPathIcon16 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -$modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -// Load Languages -xoops_loadLanguage('main'); -xoops_loadLanguage('modinfo'); diff --git a/testdata/mymodule2/include/comment_functions.php b/testdata/mymodule2/include/comment_functions.php deleted file mode 100644 index ed183622..00000000 --- a/testdata/mymodule2/include/comment_functions.php +++ /dev/null @@ -1,48 +0,0 @@ - - Website: - */ - -/** - * CommentsUpdate - * - * @param mixed $itemId - * @param mixed $itemNumb - * @return bool - */ -function mymodule2CommentsUpdate($itemId, $itemNumb) { - $itemId = (int)$itemId; - $itemNumb = (int)$itemNumb; - $article = new Mymodule2Testfields($itemId); - if (!$article->updateComments($itemNumb)) { - return false; - } - return true; -} - -/** - * CommentsApprove - * - * @param string $comment - * @return void - */ -function mymodule2CommentsApprove(&$comment){ - // notification mail here -} \ No newline at end of file diff --git a/testdata/mymodule2/include/comment_new.php b/testdata/mymodule2/include/comment_new.php deleted file mode 100644 index 1925eaea..00000000 --- a/testdata/mymodule2/include/comment_new.php +++ /dev/null @@ -1,30 +0,0 @@ - - Website: - */ -include __DIR__ . '/../../../mainfile.php'; -include_once XOOPS_ROOT_PATH.'/modules/mymodule2/class/testfields.php'; -$com_itemid = isset($_REQUEST['com_itemid']) ? (int)$_REQUEST['com_itemid'] : 0; -if ($com_itemid > 0) { - $testfieldsHandler = xoops_getModuleHandler('testfields', 'mymodule2'); - $testfields = $testfieldshandler->get($com_itemid); - $com_replytitle = $testfields->getVar('tf_text'); - include XOOPS_ROOT_PATH.'/include/comment_new.php'; -} \ No newline at end of file diff --git a/testdata/mymodule2/include/common.php b/testdata/mymodule2/include/common.php deleted file mode 100644 index 89995d15..00000000 --- a/testdata/mymodule2/include/common.php +++ /dev/null @@ -1,49 +0,0 @@ - - Website: - */ -if (!defined('XOOPS_ICONS32_PATH')) { - 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('MYMODULE2_DIRNAME', 'mymodule2'); -define('MYMODULE2_PATH', XOOPS_ROOT_PATH.'/modules/'.MYMODULE2_DIRNAME); -define('MYMODULE2_URL', XOOPS_URL.'/modules/'.MYMODULE2_DIRNAME); -define('MYMODULE2_ICONS_PATH', MYMODULE2_PATH.'/assets/icons'); -define('MYMODULE2_ICONS_URL', MYMODULE2_URL.'/assets/icons'); -define('MYMODULE2_IMAGE_PATH', MYMODULE2_PATH.'/assets/images'); -define('MYMODULE2_IMAGE_URL', MYMODULE2_URL.'/assets/images'); -define('MYMODULE2_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.MYMODULE2_DIRNAME); -define('MYMODULE2_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.MYMODULE2_DIRNAME); -define('MYMODULE2_UPLOAD_FILES_PATH', MYMODULE2_UPLOAD_PATH.'/files'); -define('MYMODULE2_UPLOAD_FILES_URL', MYMODULE2_UPLOAD_URL.'/files'); -define('MYMODULE2_UPLOAD_IMAGE_PATH', MYMODULE2_UPLOAD_PATH.'/images'); -define('MYMODULE2_UPLOAD_IMAGE_URL', MYMODULE2_UPLOAD_URL.'/images'); -define('MYMODULE2_UPLOAD_SHOTS_PATH', MYMODULE2_UPLOAD_PATH.'/images/shots'); -define('MYMODULE2_UPLOAD_SHOTS_URL', MYMODULE2_UPLOAD_URL.'/images/shots'); -define('MYMODULE2_ADMIN', MYMODULE2_URL . '/admin/index.php'); -$localLogo = MYMODULE2_IMAGE_URL . '/tdmxoops_logo.png'; -// Module Information -$copyright = "XOOPS Project"; -include_once XOOPS_ROOT_PATH . '/class/xoopsrequest.php'; -include_once MYMODULE2_PATH . '/class/helper.php'; -include_once MYMODULE2_PATH . '/include/functions.php'; diff --git a/testdata/mymodule2/include/functions.php b/testdata/mymodule2/include/functions.php deleted file mode 100644 index 6096cd25..00000000 --- a/testdata/mymodule2/include/functions.php +++ /dev/null @@ -1,239 +0,0 @@ - - Website: - */ - -/***************Blocks***************/ - -/** - * add selected cats - * @param $cats - * @return string - */ -function mymodule2_block_addCatSelect($cats) { - if(is_array($cats)) - { - $cat_sql = '('.current($cats); - array_shift($cats); - foreach($cats as $cat) - { - $cat_sql .= ','.$cat; - } - $cat_sql .= ')'; - } - return $cat_sql; -} - -/** - * Get the permissions ids - * @param $permtype - * @param $dirname - * @return mixed $testfields - */ -function mymodule2GetMyItemIds($permtype, $dirname) -{ - global $xoopsUser; - static $permissions = array(); - if(is_array($permissions) && array_key_exists($permtype, $permissions)) { - return $permissions[$permtype]; - } - $moduleHandler = xoops_getHandler('module'); - $mymodule2Module = $moduleHandler->getByDirname($dirname); - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $grouppermHandler = xoops_getHandler('groupperm'); - $testfields = $grouppermHandler->getItemIds($permtype, $groups, $mymodule2Module->getVar('mid')); - return $testfields; -} - -/** - * Get the number of testfields from the sub categories of a category or sub topics of or topic - * @param $mytree - * @param $testfields - * @param $entries - * @param $cid - * @return int - */ -function mymodule2NumbersOfEntries($mytree, $testfields, $entries, $cid) -{ - $count = 0; - if(in_array($cid, $testfields)) { - $child = $mytree->getAllChild($cid); - foreach (array_keys($entries) as $i) { - if ($entries[$i]->getVar('tf_id') == $cid){ - $count++; - } - foreach (array_keys($child) as $j) { - if ($entries[$i]->getVar('tf_id') == $j){ - $count++; - } - } - } - } - return $count; -} - -/** - * Add content as meta tag to template - * @param $content - * @return void - */ - -function mymodule2MetaKeywords($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)); - } -} - -/** - * Add content as meta description to template - * @param $content - * @return void - */ - -function mymodule2MetaDescription($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)); - } -} - -/** - * 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 mymodule2_RewriteUrl($module, $array, $type = 'content') -{ - $comment = ''; - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - $testfields = $helper->getHandler('testfields'); - $lenght_id = $helper->getConfig('lenght_id'); - $rewrite_url = $helper->getConfig('rewrite_url'); - - if ($lenght_id != 0) { - $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 = mymodule2_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 ($type === 'content/') { - $type = ''; - } - if ($type === 'comment-edit/' || $type === 'comment-reply/' || $type === 'comment-delete/') { - 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 ($type === 'content/') { - $type = ''; - } - if ($type === 'comment-edit/' || $type === 'comment-reply/' || $type === 'comment-delete/') { - 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; -} -/** - * 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 mymodule2_Filter($url, $type = '') { - - // Get regular expression from module setting. default setting is : `[^a-z0-9]`i - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); - $testfields = $helper->getHandler('testfields'); - $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(array($regular_expression, "`[-]+`"), '-', $url); - $url = ($url == '') ? $type : strtolower(trim($url, '-')); - return $url; -} \ No newline at end of file diff --git a/testdata/mymodule2/include/index.html b/testdata/mymodule2/include/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/include/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/include/install.php b/testdata/mymodule2/include/install.php deleted file mode 100644 index 326f7fd7..00000000 --- a/testdata/mymodule2/include/install.php +++ /dev/null @@ -1,95 +0,0 @@ - - Website: XOOPS Project (www.xoops.org) $ - */ - -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Common; - -/** - * @param \XoopsModule $module - * @return bool - */ -function xoops_module_pre_install_mymodule2(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Mymodule2\Utility $utility */ - $utility = new Mymodule2\Utility(); - - //check for minimum XOOPS version - $xoopsSuccess = $utility::checkVerXoops($module); - - // check for minimum PHP version - $phpSuccess = $utility::checkVerPhp($module); - - if (false !== $xoopsSuccess && false !== $phpSuccess) { - $moduleTables = &$module->getInfo('tables'); - foreach ($moduleTables as $table) { - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); - } - } - - return $xoopsSuccess && $phpSuccess; -} - -/** - * @param \XoopsModule $module - * @return bool|string - */ -function xoops_module_install_mymodule2(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - - /** @var Mymodule2\Helper $helper */ - /** @var Mymodule2\Utility $utility */ - /** @var Common\Configurator $configurator */ - $helper = Mymodule2\Helper::getInstance(); - $utility = new Mymodule2\Utility(); - $configurator = new Common\Configurator(); - - // Load language files - $helper->loadLanguage('admin'); - $helper->loadLanguage('modinfo'); - $helper->loadLanguage('common'); - - // --- CREATE FOLDERS --------------- - if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - foreach (array_keys($configurator->uploadFolders) as $i) { - $utility::createFolder($configurator->uploadFolders[$i]); - } - } - - // --- COPY blank.gif FILES --------------- - if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $file = dirname(__DIR__) . '/assets/images/blank.gif'; - foreach (array_keys($configurator->copyBlankFiles) as $i) { - $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; -} diff --git a/testdata/mymodule2/include/notifications.inc.php b/testdata/mymodule2/include/notifications.inc.php deleted file mode 100644 index 7d8efdfc..00000000 --- a/testdata/mymodule2/include/notifications.inc.php +++ /dev/null @@ -1,71 +0,0 @@ - - Website: - */ - -/** - * comment callback functions - * - * @param $category - * @param $item_id - * @return array item|null - */ -function mymodule2_notify_iteminfo($category, $item_id) -{ - global $xoopsModule, $xoopsModuleConfig, $xoopsDB; - // - if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'mymodule2') - { - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname('mymodule2'); - $configHandler = xoops_getHandler('config'); - $config =& $configHandler->getConfigsByCat(0, $module->getVar('mid')); - } else { - $module = $xoopsModule; - $config = $xoopsModuleConfig; - } - // - switch($category) { - case 'global': - $item['name'] = ''; - $item['url'] = ''; - return $item; - break; - case 'category': - // Assume we have a valid category id - $sql = 'SELECT tf_text FROM ' . $xoopsDB->prefix('mymodule2_testfields') . ' WHERE tf_id = '. $item_id; - $result = $xoopsDB->query($sql); // TODO: error check - $result_array = $xoopsDB->fetchArray($result); - $item['name'] = $result_array['tf_text']; - $item['url'] = MYMODULE2_URL . '/testfields.php?tf_id=' . $item_id; - return $item; - break; - case 'testfield': - // Assume we have a valid link id - $sql = 'SELECT tf_id, tf_text FROM '.$xoopsDB->prefix('mymodule2_testfields') . ' WHERE tf_id = ' . $item_id; - $result = $xoopsDB->query($sql); // TODO: error check - $result_array = $xoopsDB->fetchArray($result); - $item['name'] = $result_array['tf_text']; - $item['url'] = MYMODULE2_URL . '/single.php?cid=' . $result_array['cid'] . '&tf_id=' . $item_id; - return $item; - break; - } - return null; -} \ No newline at end of file diff --git a/testdata/mymodule2/include/search.inc.php b/testdata/mymodule2/include/search.inc.php deleted file mode 100644 index 0392055c..00000000 --- a/testdata/mymodule2/include/search.inc.php +++ /dev/null @@ -1,61 +0,0 @@ - - Website: - */ - - -/** - * search callback functions - * @param $queryarray - * @param $andor - * @param $limit - * @param $offset - * @param $userid - */ -function mymodule2_search($queryarray, $andor, $limit, $offset, $userid) -{ - global $xoopsDB; - $sql = "SELECT 'tf_id', 'tf_text' FROM " . $xoopsDB->prefix('mymodule2_testfields') . ' WHERE tf_id != 0'; - if ( $userid != 0 ) { - $sql .= ' AND tf_submitter='.(int)$userid; - } - if ( is_array($queryarray) && $count = count($queryarray) ) - { - $sql .= " AND (()"; - for($i = 1; $i < $count; ++$i) - { - $sql .= " $andor "; - $sql .= "()"; - } - $sql .= ')'; - } - $sql .= " ORDER BY 'tf_id' DESC"; - $result = $xoopsDB->query($sql,$limit,$offset); - $ret = array(); - $i = 0; - while($myrow = $xoopsDB->fetchArray($result)) - { - $ret[$i]['image'] = 'assets/icons/32/blank.gif'; - $ret[$i]['link'] = 'testfields.php?tf_id='.$myrow['tf_id']; - $ret[$i]['title'] = $myrow['tf_text']; - ++$i; - } - unset($i); -} \ No newline at end of file diff --git a/testdata/mymodule2/include/uninstall.php b/testdata/mymodule2/include/uninstall.php deleted file mode 100644 index 3db82965..00000000 --- a/testdata/mymodule2/include/uninstall.php +++ /dev/null @@ -1,78 +0,0 @@ -loadLanguage('admin'); - - //------------------------------------------------------------------ - // Remove uploads folder (and all subfolders) if they exist - //------------------------------------------------------------------ - - $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; - } - } - unset($dirInfo); - } - /* - //------------ START ---------------- - //------------------------------------------------------------------ - // Remove xsitemap.xml from XOOPS root folder if it exists - //------------------------------------------------------------------ - $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); - if (is_file($xmlfile)) { - if (false === ($delOk = unlink($xmlfile))) { - $module->setErrors(sprintf(_AM_MYMODULE2_ERROR_BAD_REMOVE, $xmlfile)); - } - } -// return $success && $delOk; // use this if you're using this routine -*/ - - return $success; - //------------ END ---------------- -} diff --git a/testdata/mymodule2/include/update.php b/testdata/mymodule2/include/update.php deleted file mode 100644 index f7eea8b6..00000000 --- a/testdata/mymodule2/include/update.php +++ /dev/null @@ -1,154 +0,0 @@ - - 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 - */ - -/** - * @param $module - * @param null $prev_version - * - * @return bool|null - */ -function xoops_module_update_mymodule2(&$module, $prev_version = null) -{ - $ret = null; - if ($prev_version < 10) { - $ret = update_mymodule2_v10($module); - } - - $ret = mymodule2_check_db($module); - - //check upload directory - include_once __DIR__ . '/install.php'; - $ret = xoops_module_install_mymodule2($module); - - $errors = $module->getErrors(); - if (!empty($errors)) { - print_r($errors); - } - - return $ret; - -} - -// irmtfan bug fix: solve templates duplicate issue -/** - * @param $module - * - * @return bool - */ -function update_mymodule2_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 (false !== (list($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 - * - * @return bool - */ -function mymodule2_check_db($module) -{ - $ret = true; - //insert here code for database check - - /* - // Example: update table (add new field) - $table = $GLOBALS['xoopsDB']->prefix('mymodule2_images'); - $field = 'img_exif'; - $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if (!$numRows) { - $sql = "ALTER TABLE `$table` ADD `$field` TEXT NULL AFTER `img_state`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); - $module->setErrors("Error when adding '$field' to table '$table'."); - $ret = false; - } - } - - // Example: create new table - $table = $GLOBALS['xoopsDB']->prefix('mymodule2_categories'); - $check = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if (!$numRows) { - // create new table 'mymodule2_categories' - $sql = "CREATE TABLE `$table` ( - `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `cat_text` VARCHAR(100) NOT NULL DEFAULT '', - `cat_date` INT(8) NOT NULL DEFAULT '0', - `cat_submitter` INT(8) NOT NULL DEFAULT '0', - PRIMARY KEY (`cat_id`) - ) ENGINE=InnoDB;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); - $module->setErrors("Error when creating table '$table'."); - $ret = false; - } - } - */ - return $ret; -} diff --git a/testdata/mymodule2/include/xoops_version.inc.php b/testdata/mymodule2/include/xoops_version.inc.php deleted file mode 100644 index d9c76190..00000000 --- a/testdata/mymodule2/include/xoops_version.inc.php +++ /dev/null @@ -1,40 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_index.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = []; -// -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); -// -$articlesCount = $articlesHandler->getCountArticles(); -$GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); -$count = 1; -if ($articlesCount > 0) { - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('userpager')); - $articlesAll = $articlesHandler->getAllArticles($start, $limit); - // Get All Articles - $articles = []; - foreach(array_keys($articlesAll) as $i) { - $article = $articlesAll[$i]->getValuesArticles(); - $acount = ['count', $count]; - $articles[] = array_merge($article, $acount); - $keywords[] = $articlesAll[$i]->getVar('tf_text'); - ++$count; - } - $GLOBALS['xoopsTpl']->assign('articles', $articles); - unset($articles); - // Display Navigation - if ($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $articlesCount)); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} -unset($count); -$GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); -// -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); -// -$testfieldsCount = $testfieldsHandler->getCountTestfields(); -$GLOBALS['xoopsTpl']->assign('testfieldsCount', $testfieldsCount); -$count = 1; -if ($testfieldsCount > 0) { - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('userpager')); - $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); - // Get All Testfields - $testfields = []; - foreach(array_keys($testfieldsAll) as $i) { - $testfield = $testfieldsAll[$i]->getValuesTestfields(); - $acount = ['count', $count]; - $testfields[] = array_merge($testfield, $acount); - $keywords[] = $testfieldsAll[$i]->getVar('tf_text'); - ++$count; - } - $GLOBALS['xoopsTpl']->assign('testfields', $testfields); - unset($testfields); - // Display Navigation - if ($testfieldsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $testfieldsCount)); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} -unset($count); -$GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_INDEX]; -// Keywords -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// Description -mymodule2MetaDescription(_MA_MYMODULE2_INDEX_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/language/english/admin.php b/testdata/mymodule2/language/english/admin.php deleted file mode 100644 index 35b082cb..00000000 --- a/testdata/mymodule2/language/english/admin.php +++ /dev/null @@ -1,132 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Index ---------------- -define('_AM_MYMODULE2_STATISTICS', 'Statistics'); -// There are -define('_AM_MYMODULE2_THEREARE_CATEGORIES', "There are %s categories in the database"); -define('_AM_MYMODULE2_THEREARE_ARTICLES', "There are %s articles in the database"); -define('_AM_MYMODULE2_THEREARE_TESTFIELDS', "There are %s testfields in the database"); -// ---------------- Admin Files ---------------- -// There aren't -define('_AM_MYMODULE2_THEREARENT_CATEGORIES', "There aren't categories"); -define('_AM_MYMODULE2_THEREARENT_ARTICLES', "There aren't articles"); -define('_AM_MYMODULE2_THEREARENT_TESTFIELDS', "There aren't testfields"); -// Save/Delete -define('_AM_MYMODULE2_FORM_OK', 'Successfully saved'); -define('_AM_MYMODULE2_FORM_DELETE_OK', 'Successfully deleted'); -define('_AM_MYMODULE2_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_AM_MYMODULE2_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Buttons -define('_AM_MYMODULE2_ADD_CATEGORY', 'Add New Category'); -define('_AM_MYMODULE2_ADD_ARTICLE', 'Add New Article'); -define('_AM_MYMODULE2_ADD_TESTFIELD', 'Add New Testfield'); -// Lists -define('_AM_MYMODULE2_CATEGORIES_LIST', 'List of Categories'); -define('_AM_MYMODULE2_ARTICLES_LIST', 'List of Articles'); -define('_AM_MYMODULE2_TESTFIELDS_LIST', 'List of Testfields'); -// ---------------- Admin Classes ---------------- -// Category add/edit -define('_AM_MYMODULE2_CATEGORY_ADD', 'Add Category'); -define('_AM_MYMODULE2_CATEGORY_EDIT', 'Edit Category'); -// Elements of Category -define('_AM_MYMODULE2_CATEGORY_ID', 'Id'); -define('_AM_MYMODULE2_CATEGORY_NAME', 'Name'); -define('_AM_MYMODULE2_CATEGORY_LOGO', 'Logo'); -define('_AM_MYMODULE2_CATEGORY_LOGO_UPLOADS', 'Logo in %s :'); -define('_AM_MYMODULE2_CATEGORY_CREATED', 'Created'); -define('_AM_MYMODULE2_CATEGORY_SUBMITTER', 'Submitter'); -// Article add/edit -define('_AM_MYMODULE2_ARTICLE_ADD', 'Add Article'); -define('_AM_MYMODULE2_ARTICLE_EDIT', 'Edit Article'); -// Elements of Article -define('_AM_MYMODULE2_ARTICLE_ID', 'Id'); -define('_AM_MYMODULE2_ARTICLE_CAT', 'Categories'); -define('_AM_MYMODULE2_ARTICLE_TITLE', 'Title'); -define('_AM_MYMODULE2_ARTICLE_DESCR', 'Descr'); -define('_AM_MYMODULE2_ARTICLE_IMG', 'Img'); -define('_AM_MYMODULE2_ARTICLE_IMG_UPLOADS', 'Img in %s :'); -define('_AM_MYMODULE2_ARTICLE_STATUS', 'Status'); -define('_AM_MYMODULE2_ARTICLE_FILE', 'File'); -define('_AM_MYMODULE2_ARTICLE_FILE_UPLOADS', 'File in %s :'); -define('_AM_MYMODULE2_ARTICLE_CREATED', 'Created'); -define('_AM_MYMODULE2_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield add/edit -define('_AM_MYMODULE2_TESTFIELD_ADD', 'Add Testfield'); -define('_AM_MYMODULE2_TESTFIELD_EDIT', 'Edit Testfield'); -// Elements of Testfield -define('_AM_MYMODULE2_TESTFIELD_ID', 'Id'); -define('_AM_MYMODULE2_TESTFIELD_TEXT', 'Text'); -define('_AM_MYMODULE2_TESTFIELD_TEXTAREA', 'Textarea'); -define('_AM_MYMODULE2_TESTFIELD_DHTML', 'Dhtml'); -define('_AM_MYMODULE2_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_AM_MYMODULE2_TESTFIELD_YESNO', 'Yesno'); -define('_AM_MYMODULE2_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_AM_MYMODULE2_TESTFIELD_USER', 'User'); -define('_AM_MYMODULE2_TESTFIELD_COLOR', 'Color'); -define('_AM_MYMODULE2_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_AM_MYMODULE2_TESTFIELD_IMAGELIST_UPLOADS', 'Imagelist in frameworks images: %s'); -define('_AM_MYMODULE2_TESTFIELD_URLFILE', 'Urlfile'); -define('_AM_MYMODULE2_TESTFIELD_URLFILE_UPLOADS', 'Urlfile in uploads'); -define('_AM_MYMODULE2_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_AM_MYMODULE2_TESTFIELD_UPLIMAGE_UPLOADS', 'Uplimage in %s :'); -define('_AM_MYMODULE2_TESTFIELD_UPLFILE', 'Uplfile'); -define('_AM_MYMODULE2_TESTFIELD_UPLFILE_UPLOADS', 'Uplfile in %s :'); -define('_AM_MYMODULE2_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_AM_MYMODULE2_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_AM_MYMODULE2_TESTFIELD_SELECTFILE_UPLOADS', 'Selectfile in %s :'); -define('_AM_MYMODULE2_TESTFIELD_STATUS', 'Status'); -// General -define('_AM_MYMODULE2_FORM_UPLOAD', 'Upload file'); -define('_AM_MYMODULE2_FORM_UPLOAD_NEW', 'Upload new file: '); -define('_AM_MYMODULE2_FORM_UPLOAD_SIZE', 'Max file size: '); -define('_AM_MYMODULE2_FORM_UPLOAD_SIZE_MB', 'MB'); -define('_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH', 'Max image width: '); -define('_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT', 'Max image height: '); -define('_AM_MYMODULE2_FORM_IMAGE_PATH', 'Files in %s :'); -define('_AM_MYMODULE2_FORM_ACTION', 'Action'); -define('_AM_MYMODULE2_FORM_EDIT', 'Modification'); -define('_AM_MYMODULE2_FORM_DELETE', 'Clear'); -// Status -define('_AM_MYMODULE2_STATUS_NONE', 'No status'); -define('_AM_MYMODULE2_STATUS_OFFLINE', 'Offline'); -define('_AM_MYMODULE2_STATUS_SUBMITTED', 'Submitted'); -define('_AM_MYMODULE2_STATUS_APPROVED', 'Approved'); -// ---------------- Admin Permissions ---------------- -// Permissions -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL', 'Permissions global'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_16', 'Permissions global to view'); -define('_AM_MYMODULE2_PERMISSIONS_APPROVE', 'Permissions to approve'); -define('_AM_MYMODULE2_PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); -define('_AM_MYMODULE2_PERMISSIONS_SUBMIT', 'Permissions to submit'); -define('_AM_MYMODULE2_PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); -define('_AM_MYMODULE2_PERMISSIONS_VIEW', 'Permissions to view'); -define('_AM_MYMODULE2_PERMISSIONS_VIEW_DESC', 'Permissions to view'); -define('_AM_MYMODULE2_NO_PERMISSIONS_SET', 'No permission set'); -// ---------------- Admin Others ---------------- -define('_AM_MYMODULE2_MAINTAINEDBY', ' is maintained by '); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/english/blocks.php b/testdata/mymodule2/language/english/blocks.php deleted file mode 100644 index 68984f32..00000000 --- a/testdata/mymodule2/language/english/blocks.php +++ /dev/null @@ -1,66 +0,0 @@ - - Website: - */ -// Admin Edit -define('_MB_MYMODULE2_DISPLAY', 'How Many Tables to Display'); -define('_MB_MYMODULE2_TITLE_LENGTH', 'Title Length'); -define('_MB_MYMODULE2_CATTODISPLAY', 'Categories to Display'); -define('_MB_MYMODULE2_ALLCAT', 'All Categories'); -// Categories -define('_MB_MYMODULE2_CATEGORIES_TO_DISPLAY', 'Categories to Display'); -define('_MB_MYMODULE2_ALL_CATEGORIES', 'All Categories'); -define('_MB_MYMODULE2_CAT_ID', 'Id'); -define('_MB_MYMODULE2_CAT_NAME', 'Name'); -define('_MB_MYMODULE2_CAT_LOGO', 'Logo'); -define('_MB_MYMODULE2_CAT_CREATED', 'Created'); -define('_MB_MYMODULE2_CAT_SUBMITTER', 'Submitter'); -// Articles -define('_MB_MYMODULE2_ARTICLES_TO_DISPLAY', 'Articles to Display'); -define('_MB_MYMODULE2_ALL_ARTICLES', 'All Articles'); -define('_MB_MYMODULE2_ART_ID', 'Id'); -define('_MB_MYMODULE2_ART_CAT', 'Cat'); -define('_MB_MYMODULE2_ART_TITLE', 'Title'); -define('_MB_MYMODULE2_ART_DESCR', 'Descr'); -define('_MB_MYMODULE2_ART_IMG', 'Img'); -define('_MB_MYMODULE2_ART_STATUS', 'Status'); -define('_MB_MYMODULE2_ART_FILE', 'File'); -define('_MB_MYMODULE2_ART_CREATED', 'Created'); -define('_MB_MYMODULE2_ART_SUBMITTER', 'Submitter'); -// Testfields -define('_MB_MYMODULE2_TESTFIELDS_TO_DISPLAY', 'Testfields to Display'); -define('_MB_MYMODULE2_ALL_TESTFIELDS', 'All Testfields'); -define('_MB_MYMODULE2_TF_ID', 'Id'); -define('_MB_MYMODULE2_TF_TEXT', 'Text'); -define('_MB_MYMODULE2_TF_TEXTAREA', 'Textarea'); -define('_MB_MYMODULE2_TF_DHTML', 'Dhtml'); -define('_MB_MYMODULE2_TF_CHECKBOX', 'Checkbox'); -define('_MB_MYMODULE2_TF_YESNO', 'Yesno'); -define('_MB_MYMODULE2_TF_SELECTBOX', 'Selectbox'); -define('_MB_MYMODULE2_TF_USER', 'User'); -define('_MB_MYMODULE2_TF_COLOR', 'Color'); -define('_MB_MYMODULE2_TF_IMAGELIST', 'Imagelist'); -define('_MB_MYMODULE2_TF_URLFILE', 'Urlfile'); -define('_MB_MYMODULE2_TF_UPLIMAGE', 'Uplimage'); -define('_MB_MYMODULE2_TF_UPLFILE', 'Uplfile'); -define('_MB_MYMODULE2_TF_TEXTDATESELECT', 'Textdateselect'); -define('_MB_MYMODULE2_TF_SELECTFILE', 'Selectfile'); -define('_MB_MYMODULE2_TF_STATUS', 'Status'); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/english/common.php b/testdata/mymodule2/language/english/common.php deleted file mode 100644 index 214982f0..00000000 --- a/testdata/mymodule2/language/english/common.php +++ /dev/null @@ -1,183 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/testdata/mymodule2/language/english/feedback.php b/testdata/mymodule2/language/english/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/testdata/mymodule2/language/english/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/testdata/mymodule2/language/english/help/help.html b/testdata/mymodule2/language/english/help/help.html deleted file mode 100644 index 40ca8c5d..00000000 --- a/testdata/mymodule2/language/english/help/help.html +++ /dev/null @@ -1,27 +0,0 @@ -
      -

      Help: - My Module 2 Back to the Administration of My Module 2 -

      - -

      Description

      -

      - The My Module 2 module can be used to modules in XOOPS

      -

      -

      Install/uninstall

      -

      -No special measures necessary, follow the standard installation process and extract the mymodule2 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 TDMCreate 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 -

      - -
      \ No newline at end of file diff --git a/testdata/mymodule2/language/english/help/index.html b/testdata/mymodule2/language/english/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/english/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/language/english/index.html b/testdata/mymodule2/language/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/language/english/mail_template/category_new_notify.tpl b/testdata/mymodule2/language/english/mail_template/category_new_notify.tpl deleted file mode 100644 index 15071a28..00000000 --- a/testdata/mymodule2/language/english/mail_template/category_new_notify.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, - -A new story "{STORY_NAME}" has been added at {X_SITENAME}. - -You can view this story here: -{STORY_URL} - ------------ - -You are receiving this message because you selected to be notified when new stories are added to our site. - -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} - -Please do not reply to this message. - ------------ - -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} \ No newline at end of file diff --git a/testdata/mymodule2/language/english/mail_template/index.html b/testdata/mymodule2/language/english/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/english/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/language/english/main.php b/testdata/mymodule2/language/english/main.php deleted file mode 100644 index be3faabc..00000000 --- a/testdata/mymodule2/language/english/main.php +++ /dev/null @@ -1,99 +0,0 @@ - - Website: - */ - -// ---------------- Main ---------------- -define('_MA_MYMODULE2_INDEX', 'Home'); -define('_MA_MYMODULE2_TITLE', 'My Module 2'); -define('_MA_MYMODULE2_DESC', 'This module is for doing following...'); -define('_MA_MYMODULE2_INDEX_DESC', "Welcome to the homepage of your new module My Module 2!
      -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."); -define('_MA_MYMODULE2_NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); -define('_MA_MYMODULE2_NO', 'No'); -// ---------------- Contents ---------------- -// Category -define('_MA_MYMODULE2_CATEGORY', 'Category'); -define('_MA_MYMODULE2_CATEGORIES', 'Categories'); -define('_MA_MYMODULE2_CATEGORIES_TITLE', 'Categories title'); -define('_MA_MYMODULE2_CATEGORIES_DESC', 'Categories description'); -// Caption of Category -define('_MA_MYMODULE2_CATEGORY_ID', 'Id'); -define('_MA_MYMODULE2_CATEGORY_NAME', 'Name'); -define('_MA_MYMODULE2_CATEGORY_LOGO', 'Logo'); -define('_MA_MYMODULE2_CATEGORY_CREATED', 'Created'); -define('_MA_MYMODULE2_CATEGORY_SUBMITTER', 'Submitter'); -// Article -define('_MA_MYMODULE2_ARTICLE', 'Article'); -define('_MA_MYMODULE2_ARTICLES', 'Articles'); -define('_MA_MYMODULE2_ARTICLES_TITLE', 'Articles title'); -define('_MA_MYMODULE2_ARTICLES_DESC', 'Articles description'); -// Caption of Article -define('_MA_MYMODULE2_ARTICLE_ID', 'Id'); -define('_MA_MYMODULE2_ARTICLE_CAT', 'Cat'); -define('_MA_MYMODULE2_ARTICLE_TITLE', 'Title'); -define('_MA_MYMODULE2_ARTICLE_DESCR', 'Descr'); -define('_MA_MYMODULE2_ARTICLE_IMG', 'Img'); -define('_MA_MYMODULE2_ARTICLE_STATUS', 'Status'); -define('_MA_MYMODULE2_ARTICLE_FILE', 'File'); -define('_MA_MYMODULE2_ARTICLE_CREATED', 'Created'); -define('_MA_MYMODULE2_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield -define('_MA_MYMODULE2_TESTFIELD', 'Testfield'); -define('_MA_MYMODULE2_TESTFIELDS', 'Testfields'); -define('_MA_MYMODULE2_TESTFIELDS_TITLE', 'Testfields title'); -define('_MA_MYMODULE2_TESTFIELDS_DESC', 'Testfields description'); -// Caption of Testfield -define('_MA_MYMODULE2_TESTFIELD_ID', 'Id'); -define('_MA_MYMODULE2_TESTFIELD_TEXT', 'Text'); -define('_MA_MYMODULE2_TESTFIELD_TEXTAREA', 'Textarea'); -define('_MA_MYMODULE2_TESTFIELD_DHTML', 'Dhtml'); -define('_MA_MYMODULE2_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_MA_MYMODULE2_TESTFIELD_YESNO', 'Yesno'); -define('_MA_MYMODULE2_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_MA_MYMODULE2_TESTFIELD_USER', 'User'); -define('_MA_MYMODULE2_TESTFIELD_COLOR', 'Color'); -define('_MA_MYMODULE2_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_MA_MYMODULE2_TESTFIELD_URLFILE', 'Urlfile'); -define('_MA_MYMODULE2_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_MA_MYMODULE2_TESTFIELD_UPLFILE', 'Uplfile'); -define('_MA_MYMODULE2_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_MA_MYMODULE2_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_MA_MYMODULE2_TESTFIELD_STATUS', 'Status'); -define('_MA_MYMODULE2_INDEX_THEREARE', 'There are %s Testfields'); -define('_MA_MYMODULE2_INDEX_LATEST_LIST', 'Last My Module 2'); -// Submit -define('_MA_MYMODULE2_SUBMIT', 'Submit'); -define('_MA_MYMODULE2_SUBMIT_TESTFIELD', 'Submit Testfield'); -define('_MA_MYMODULE2_SUBMIT_ALLPENDING', 'All testfield/script information are posted pending verification.'); -define('_MA_MYMODULE2_SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); -define('_MA_MYMODULE2_SUBMIT_ISAPPROVED', 'Your testfield has been approved'); -define('_MA_MYMODULE2_SUBMIT_PROPOSER', 'Submit a testfield'); -define('_MA_MYMODULE2_SUBMIT_RECEIVED', 'We have received your testfield info. Thank you !'); -define('_MA_MYMODULE2_SUBMIT_SUBMITONCE', 'Submit your testfield/script only once.'); -define('_MA_MYMODULE2_SUBMIT_TAKEDAYS', 'This will take many days to see your testfield/script added successfully in our database.'); -// Form -define('_MA_MYMODULE2_FORM_OK', 'Successfully saved'); -define('_MA_MYMODULE2_FORM_DELETE_OK', 'Successfully deleted'); -define('_MA_MYMODULE2_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_MA_MYMODULE2_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Admin link -define('_MA_MYMODULE2_ADMIN', 'Admin'); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/english/modinfo.php b/testdata/mymodule2/language/english/modinfo.php deleted file mode 100644 index 3eb020f3..00000000 --- a/testdata/mymodule2/language/english/modinfo.php +++ /dev/null @@ -1,193 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Main ---------------- -define('_MI_MYMODULE2_NAME', 'My Module 2'); -define('_MI_MYMODULE2_DESC', 'This module is for doing following...'); -// ---------------- Admin Menu ---------------- -define('_MI_MYMODULE2_ADMENU1', 'Dashboard'); -define('_MI_MYMODULE2_ADMENU2', 'Categories'); -define('_MI_MYMODULE2_ADMENU3', 'Articles'); -define('_MI_MYMODULE2_ADMENU4', 'Testfields'); -define('_MI_MYMODULE2_ADMENU5', 'Permissions'); -define('_MI_MYMODULE2_ADMENU6', 'Feedback'); -define('_MI_MYMODULE2_ABOUT', 'About'); -// ---------------- Admin Nav ---------------- -define('_MI_MYMODULE2_ADMIN_PAGER', 'Admin pager'); -define('_MI_MYMODULE2_ADMIN_PAGER_DESC', 'Admin per page list'); -// User -define('_MI_MYMODULE2_USER_PAGER', 'User pager'); -define('_MI_MYMODULE2_USER_PAGER_DESC', 'User per page list'); -// Submenu -define('_MI_MYMODULE2_SMNAME1', 'Index page'); -define('_MI_MYMODULE2_SMNAME2', 'Articles'); -define('_MI_MYMODULE2_SMNAME3', 'Testfields'); -define('_MI_MYMODULE2_SMNAME4', 'Submit'); -define('_MI_MYMODULE2_SMNAME5', 'Search'); -// Blocks -define('_MI_MYMODULE2_CATEGORIES_BLOCK', 'Categories block'); -define('_MI_MYMODULE2_CATEGORIES_BLOCK_DESC', 'Categories block description'); -define('_MI_MYMODULE2_CATEGORIES_BLOCK_CATEGORY', 'Categories block CATEGORY'); -define('_MI_MYMODULE2_CATEGORIES_BLOCK_CATEGORY_DESC', 'Categories block CATEGORY description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK', 'Articles block'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_DESC', 'Articles block description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_ARTICLE', 'Articles block ARTICLE'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_ARTICLE_DESC', 'Articles block ARTICLE description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_LAST', 'Articles block last'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_LAST_DESC', 'Articles block last description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_NEW', 'Articles block new'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_NEW_DESC', 'Articles block new description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_HITS', 'Articles block hits'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_HITS_DESC', 'Articles block hits description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_TOP', 'Articles block top'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_TOP_DESC', 'Articles block top description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_RANDOM', 'Articles block random'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_RANDOM_DESC', 'Articles block random description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK', 'Testfields block'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_DESC', 'Testfields block description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TESTFIELD', 'Testfields block TESTFIELD'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TESTFIELD_DESC', 'Testfields block TESTFIELD description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_LAST', 'Testfields block last'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_LAST_DESC', 'Testfields block last description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_NEW', 'Testfields block new'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_NEW_DESC', 'Testfields block new description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_HITS', 'Testfields block hits'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_HITS_DESC', 'Testfields block hits description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TOP', 'Testfields block top'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TOP_DESC', 'Testfields block top description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM', 'Testfields block random'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM_DESC', 'Testfields block random description'); -// Config -define('_MI_MYMODULE2_EDITOR_DESCR', 'Editor'); -define('_MI_MYMODULE2_EDITOR_DESCR_DESC', 'Select the Editor Descr to use'); -define('_MI_MYMODULE2_EDITOR_DHTML', 'Editor'); -define('_MI_MYMODULE2_EDITOR_DHTML_DESC', 'Select the Editor Dhtml to use'); -define('_MI_MYMODULE2_KEYWORDS', 'Keywords'); -define('_MI_MYMODULE2_KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); -define('_MI_MYMODULE2_SIZE_MB', 'MB'); -define('_MI_MYMODULE2_MAXSIZE_IMAGE', 'Max size image'); -define('_MI_MYMODULE2_MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); -define('_MI_MYMODULE2_MIMETYPES_IMAGE', 'Mime types image'); -define('_MI_MYMODULE2_MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); -define('_MI_MYMODULE2_MAXWIDTH_IMAGE', 'Max width image'); -define('_MI_MYMODULE2_MAXWIDTH_IMAGE_DESC', 'Set the max width which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE2_MAXHEIGHT_IMAGE', 'Max height image'); -define('_MI_MYMODULE2_MAXHEIGHT_IMAGE_DESC', 'Set the max height which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE2_MAXSIZE_FILE', 'Max size file'); -define('_MI_MYMODULE2_MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); -define('_MI_MYMODULE2_MIMETYPES_FILE', 'Mime types file'); -define('_MI_MYMODULE2_MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); -define('_MI_MYMODULE2_USE_TAG', 'Use TAG'); -define('_MI_MYMODULE2_USE_TAG_DESC', 'If you use tag module, check this option to yes'); -define('_MI_MYMODULE2_NUMB_COL', 'Number Columns'); -define('_MI_MYMODULE2_NUMB_COL_DESC', 'Number Columns to View.'); -define('_MI_MYMODULE2_DIVIDEBY', 'Divide By'); -define('_MI_MYMODULE2_DIVIDEBY_DESC', 'Divide by columns number.'); -define('_MI_MYMODULE2_TABLE_TYPE', 'Table Type'); -define('_MI_MYMODULE2_TABLE_TYPE_DESC', 'Table Type is the bootstrap html table.'); -define('_MI_MYMODULE2_PANEL_TYPE', 'Panel Type'); -define('_MI_MYMODULE2_PANEL_TYPE_DESC', 'Panel Type is the bootstrap html div.'); -define('_MI_MYMODULE2_IDPAYPAL', 'Paypal ID'); -define('_MI_MYMODULE2_IDPAYPAL_DESC', 'Insert here your PayPal ID for donactions.'); -define('_MI_MYMODULE2_ADVERTISE', 'Advertisement Code'); -define('_MI_MYMODULE2_ADVERTISE_DESC', 'Insert here the advertisement code'); -define('_MI_MYMODULE2_MAINTAINEDBY', 'Maintained By'); -define('_MI_MYMODULE2_MAINTAINEDBY_DESC', 'Allow url of support site or community'); -define('_MI_MYMODULE2_BOOKMARKS', 'Social Bookmarks'); -define('_MI_MYMODULE2_BOOKMARKS_DESC', 'Show Social Bookmarks in the single page'); -define('_MI_MYMODULE2_FACEBOOK_COMMENTS', 'Facebook comments'); -define('_MI_MYMODULE2_FACEBOOK_COMMENTS_DESC', 'Allow Facebook comments in the single page'); -define('_MI_MYMODULE2_DISQUS_COMMENTS', 'Disqus comments'); -define('_MI_MYMODULE2_DISQUS_COMMENTS_DESC', 'Allow Disqus comments in the single page'); -// Notifications -define('_MI_MYMODULE2_GLOBAL_NOTIFY', 'Global notify'); -define('_MI_MYMODULE2_GLOBAL_NOTIFY_DESC', 'Global notify desc'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY', 'Global modify notify'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_CAPTION', 'Global modify notify caption'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_DESC', 'Global modify notify desc'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_SUBJECT', 'Global modify notify subject'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY', 'Global broken notify'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_CAPTION', 'Global broken notify caption'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_DESC', 'Global broken notify desc'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_SUBJECT', 'Global broken notify subject'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY', 'Global submit notify'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_CAPTION', 'Global submit notify caption'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_DESC', 'Global submit notify desc'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_SUBJECT', 'Global submit notify subject'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY', 'Global new notify'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY_CAPTION', 'Global new notify caption'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY_DESC', 'Global new notify desc'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY_SUBJECT', 'Global new notify subject'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY', 'Category notify'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY_DESC', 'Category notify desc'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY_CAPTION', 'Category notify caption'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY_SUBJECT', 'Category notify Subject'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY', 'Category submit notify'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_CAPTION', 'Category submit notify caption'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_DESC', 'Category submit notify desc'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_SUBJECT', 'Category submit notify subject'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY', 'Testfield notify'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY_DESC', 'Testfield notify desc'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY_CAPTION', 'Testfield notify caption'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY_SUBJECT', 'Testfield notify subject'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY', 'Global newcategory notify'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION', 'Global newcategory notify caption'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_DESC', 'Global newcategory notify desc'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT', 'Global newcategory notify subject'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY', 'Global testfield modify notify'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY_CAPTION', 'Global testfield modify notify caption'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY_DESC', 'Global testfield modify notify desc'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY_SUBJECT', 'Global testfield modify notify subject'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY', 'Global testfield broken notify'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY_CAPTION', 'Global testfield broken notify caption'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY_DESC', 'Global testfield broken notify desc'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY_SUBJECT', 'Global testfield broken notify subject'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY', 'Global testfield submit notify'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Global testfield submit notify caption'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Global testfield submit notify desc'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Global testfield submit notify subject'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY', 'Global new testfield notify'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY_CAPTION', 'Global new testfield notify caption'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY_DESC', 'Global new testfield notify desc'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Global new testfield notify subject'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY', 'Category testfield submit notify'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Category testfield submit notify caption'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Category testfield submit notify desc'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Category testfield submit notify subject'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY', 'Category new testfield notify'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY_CAPTION', 'Category new testfield notify caption'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY_DESC', 'Category new testfield notify desc'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Category new testfield notify subject'); -define('_MI_MYMODULE2_APPROVE_NOTIFY', 'Testfield approve notify'); -define('_MI_MYMODULE2_APPROVE_NOTIFY_CAPTION', 'Testfield approve notify caption'); -define('_MI_MYMODULE2_APPROVE_NOTIFY_DESC', 'Testfield approve notify desc'); -define('_MI_MYMODULE2_APPROVE_NOTIFY_SUBJECT', 'Testfield approve notify subject'); -// Permissions Groups -define('_MI_MYMODULE2_GROUPS', 'Groups access'); -define('_MI_MYMODULE2_GROUPS_DESC', 'Select general access permission for groups.'); -define('_MI_MYMODULE2_ADMIN_GROUPS', 'Admin Group Permissions'); -define('_MI_MYMODULE2_ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); -define('_MI_MYMODULE2_UPLOAD_GROUPS', 'Upload Group Permissions'); -define('_MI_MYMODULE2_UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/german/admin.php b/testdata/mymodule2/language/german/admin.php deleted file mode 100644 index 35b082cb..00000000 --- a/testdata/mymodule2/language/german/admin.php +++ /dev/null @@ -1,132 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Index ---------------- -define('_AM_MYMODULE2_STATISTICS', 'Statistics'); -// There are -define('_AM_MYMODULE2_THEREARE_CATEGORIES', "There are %s categories in the database"); -define('_AM_MYMODULE2_THEREARE_ARTICLES', "There are %s articles in the database"); -define('_AM_MYMODULE2_THEREARE_TESTFIELDS', "There are %s testfields in the database"); -// ---------------- Admin Files ---------------- -// There aren't -define('_AM_MYMODULE2_THEREARENT_CATEGORIES', "There aren't categories"); -define('_AM_MYMODULE2_THEREARENT_ARTICLES', "There aren't articles"); -define('_AM_MYMODULE2_THEREARENT_TESTFIELDS', "There aren't testfields"); -// Save/Delete -define('_AM_MYMODULE2_FORM_OK', 'Successfully saved'); -define('_AM_MYMODULE2_FORM_DELETE_OK', 'Successfully deleted'); -define('_AM_MYMODULE2_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_AM_MYMODULE2_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Buttons -define('_AM_MYMODULE2_ADD_CATEGORY', 'Add New Category'); -define('_AM_MYMODULE2_ADD_ARTICLE', 'Add New Article'); -define('_AM_MYMODULE2_ADD_TESTFIELD', 'Add New Testfield'); -// Lists -define('_AM_MYMODULE2_CATEGORIES_LIST', 'List of Categories'); -define('_AM_MYMODULE2_ARTICLES_LIST', 'List of Articles'); -define('_AM_MYMODULE2_TESTFIELDS_LIST', 'List of Testfields'); -// ---------------- Admin Classes ---------------- -// Category add/edit -define('_AM_MYMODULE2_CATEGORY_ADD', 'Add Category'); -define('_AM_MYMODULE2_CATEGORY_EDIT', 'Edit Category'); -// Elements of Category -define('_AM_MYMODULE2_CATEGORY_ID', 'Id'); -define('_AM_MYMODULE2_CATEGORY_NAME', 'Name'); -define('_AM_MYMODULE2_CATEGORY_LOGO', 'Logo'); -define('_AM_MYMODULE2_CATEGORY_LOGO_UPLOADS', 'Logo in %s :'); -define('_AM_MYMODULE2_CATEGORY_CREATED', 'Created'); -define('_AM_MYMODULE2_CATEGORY_SUBMITTER', 'Submitter'); -// Article add/edit -define('_AM_MYMODULE2_ARTICLE_ADD', 'Add Article'); -define('_AM_MYMODULE2_ARTICLE_EDIT', 'Edit Article'); -// Elements of Article -define('_AM_MYMODULE2_ARTICLE_ID', 'Id'); -define('_AM_MYMODULE2_ARTICLE_CAT', 'Categories'); -define('_AM_MYMODULE2_ARTICLE_TITLE', 'Title'); -define('_AM_MYMODULE2_ARTICLE_DESCR', 'Descr'); -define('_AM_MYMODULE2_ARTICLE_IMG', 'Img'); -define('_AM_MYMODULE2_ARTICLE_IMG_UPLOADS', 'Img in %s :'); -define('_AM_MYMODULE2_ARTICLE_STATUS', 'Status'); -define('_AM_MYMODULE2_ARTICLE_FILE', 'File'); -define('_AM_MYMODULE2_ARTICLE_FILE_UPLOADS', 'File in %s :'); -define('_AM_MYMODULE2_ARTICLE_CREATED', 'Created'); -define('_AM_MYMODULE2_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield add/edit -define('_AM_MYMODULE2_TESTFIELD_ADD', 'Add Testfield'); -define('_AM_MYMODULE2_TESTFIELD_EDIT', 'Edit Testfield'); -// Elements of Testfield -define('_AM_MYMODULE2_TESTFIELD_ID', 'Id'); -define('_AM_MYMODULE2_TESTFIELD_TEXT', 'Text'); -define('_AM_MYMODULE2_TESTFIELD_TEXTAREA', 'Textarea'); -define('_AM_MYMODULE2_TESTFIELD_DHTML', 'Dhtml'); -define('_AM_MYMODULE2_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_AM_MYMODULE2_TESTFIELD_YESNO', 'Yesno'); -define('_AM_MYMODULE2_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_AM_MYMODULE2_TESTFIELD_USER', 'User'); -define('_AM_MYMODULE2_TESTFIELD_COLOR', 'Color'); -define('_AM_MYMODULE2_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_AM_MYMODULE2_TESTFIELD_IMAGELIST_UPLOADS', 'Imagelist in frameworks images: %s'); -define('_AM_MYMODULE2_TESTFIELD_URLFILE', 'Urlfile'); -define('_AM_MYMODULE2_TESTFIELD_URLFILE_UPLOADS', 'Urlfile in uploads'); -define('_AM_MYMODULE2_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_AM_MYMODULE2_TESTFIELD_UPLIMAGE_UPLOADS', 'Uplimage in %s :'); -define('_AM_MYMODULE2_TESTFIELD_UPLFILE', 'Uplfile'); -define('_AM_MYMODULE2_TESTFIELD_UPLFILE_UPLOADS', 'Uplfile in %s :'); -define('_AM_MYMODULE2_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_AM_MYMODULE2_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_AM_MYMODULE2_TESTFIELD_SELECTFILE_UPLOADS', 'Selectfile in %s :'); -define('_AM_MYMODULE2_TESTFIELD_STATUS', 'Status'); -// General -define('_AM_MYMODULE2_FORM_UPLOAD', 'Upload file'); -define('_AM_MYMODULE2_FORM_UPLOAD_NEW', 'Upload new file: '); -define('_AM_MYMODULE2_FORM_UPLOAD_SIZE', 'Max file size: '); -define('_AM_MYMODULE2_FORM_UPLOAD_SIZE_MB', 'MB'); -define('_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH', 'Max image width: '); -define('_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT', 'Max image height: '); -define('_AM_MYMODULE2_FORM_IMAGE_PATH', 'Files in %s :'); -define('_AM_MYMODULE2_FORM_ACTION', 'Action'); -define('_AM_MYMODULE2_FORM_EDIT', 'Modification'); -define('_AM_MYMODULE2_FORM_DELETE', 'Clear'); -// Status -define('_AM_MYMODULE2_STATUS_NONE', 'No status'); -define('_AM_MYMODULE2_STATUS_OFFLINE', 'Offline'); -define('_AM_MYMODULE2_STATUS_SUBMITTED', 'Submitted'); -define('_AM_MYMODULE2_STATUS_APPROVED', 'Approved'); -// ---------------- Admin Permissions ---------------- -// Permissions -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL', 'Permissions global'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); -define('_AM_MYMODULE2_PERMISSIONS_GLOBAL_16', 'Permissions global to view'); -define('_AM_MYMODULE2_PERMISSIONS_APPROVE', 'Permissions to approve'); -define('_AM_MYMODULE2_PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); -define('_AM_MYMODULE2_PERMISSIONS_SUBMIT', 'Permissions to submit'); -define('_AM_MYMODULE2_PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); -define('_AM_MYMODULE2_PERMISSIONS_VIEW', 'Permissions to view'); -define('_AM_MYMODULE2_PERMISSIONS_VIEW_DESC', 'Permissions to view'); -define('_AM_MYMODULE2_NO_PERMISSIONS_SET', 'No permission set'); -// ---------------- Admin Others ---------------- -define('_AM_MYMODULE2_MAINTAINEDBY', ' is maintained by '); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/german/blocks.php b/testdata/mymodule2/language/german/blocks.php deleted file mode 100644 index 68984f32..00000000 --- a/testdata/mymodule2/language/german/blocks.php +++ /dev/null @@ -1,66 +0,0 @@ - - Website: - */ -// Admin Edit -define('_MB_MYMODULE2_DISPLAY', 'How Many Tables to Display'); -define('_MB_MYMODULE2_TITLE_LENGTH', 'Title Length'); -define('_MB_MYMODULE2_CATTODISPLAY', 'Categories to Display'); -define('_MB_MYMODULE2_ALLCAT', 'All Categories'); -// Categories -define('_MB_MYMODULE2_CATEGORIES_TO_DISPLAY', 'Categories to Display'); -define('_MB_MYMODULE2_ALL_CATEGORIES', 'All Categories'); -define('_MB_MYMODULE2_CAT_ID', 'Id'); -define('_MB_MYMODULE2_CAT_NAME', 'Name'); -define('_MB_MYMODULE2_CAT_LOGO', 'Logo'); -define('_MB_MYMODULE2_CAT_CREATED', 'Created'); -define('_MB_MYMODULE2_CAT_SUBMITTER', 'Submitter'); -// Articles -define('_MB_MYMODULE2_ARTICLES_TO_DISPLAY', 'Articles to Display'); -define('_MB_MYMODULE2_ALL_ARTICLES', 'All Articles'); -define('_MB_MYMODULE2_ART_ID', 'Id'); -define('_MB_MYMODULE2_ART_CAT', 'Cat'); -define('_MB_MYMODULE2_ART_TITLE', 'Title'); -define('_MB_MYMODULE2_ART_DESCR', 'Descr'); -define('_MB_MYMODULE2_ART_IMG', 'Img'); -define('_MB_MYMODULE2_ART_STATUS', 'Status'); -define('_MB_MYMODULE2_ART_FILE', 'File'); -define('_MB_MYMODULE2_ART_CREATED', 'Created'); -define('_MB_MYMODULE2_ART_SUBMITTER', 'Submitter'); -// Testfields -define('_MB_MYMODULE2_TESTFIELDS_TO_DISPLAY', 'Testfields to Display'); -define('_MB_MYMODULE2_ALL_TESTFIELDS', 'All Testfields'); -define('_MB_MYMODULE2_TF_ID', 'Id'); -define('_MB_MYMODULE2_TF_TEXT', 'Text'); -define('_MB_MYMODULE2_TF_TEXTAREA', 'Textarea'); -define('_MB_MYMODULE2_TF_DHTML', 'Dhtml'); -define('_MB_MYMODULE2_TF_CHECKBOX', 'Checkbox'); -define('_MB_MYMODULE2_TF_YESNO', 'Yesno'); -define('_MB_MYMODULE2_TF_SELECTBOX', 'Selectbox'); -define('_MB_MYMODULE2_TF_USER', 'User'); -define('_MB_MYMODULE2_TF_COLOR', 'Color'); -define('_MB_MYMODULE2_TF_IMAGELIST', 'Imagelist'); -define('_MB_MYMODULE2_TF_URLFILE', 'Urlfile'); -define('_MB_MYMODULE2_TF_UPLIMAGE', 'Uplimage'); -define('_MB_MYMODULE2_TF_UPLFILE', 'Uplfile'); -define('_MB_MYMODULE2_TF_TEXTDATESELECT', 'Textdateselect'); -define('_MB_MYMODULE2_TF_SELECTFILE', 'Selectfile'); -define('_MB_MYMODULE2_TF_STATUS', 'Status'); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/german/common.php b/testdata/mymodule2/language/german/common.php deleted file mode 100644 index 214982f0..00000000 --- a/testdata/mymodule2/language/german/common.php +++ /dev/null @@ -1,183 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/testdata/mymodule2/language/german/feedback.php b/testdata/mymodule2/language/german/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/testdata/mymodule2/language/german/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/testdata/mymodule2/language/german/help/help.html b/testdata/mymodule2/language/german/help/help.html deleted file mode 100644 index 40ca8c5d..00000000 --- a/testdata/mymodule2/language/german/help/help.html +++ /dev/null @@ -1,27 +0,0 @@ -
      -

      Help: - My Module 2 Back to the Administration of My Module 2 -

      - -

      Description

      -

      - The My Module 2 module can be used to modules in XOOPS

      -

      -

      Install/uninstall

      -

      -No special measures necessary, follow the standard installation process and extract the mymodule2 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 TDMCreate 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 -

      - -
      \ No newline at end of file diff --git a/testdata/mymodule2/language/german/help/index.html b/testdata/mymodule2/language/german/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/german/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/language/german/index.html b/testdata/mymodule2/language/german/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/german/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/language/german/mail_template/category_new_notify.tpl b/testdata/mymodule2/language/german/mail_template/category_new_notify.tpl deleted file mode 100644 index 15071a28..00000000 --- a/testdata/mymodule2/language/german/mail_template/category_new_notify.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, - -A new story "{STORY_NAME}" has been added at {X_SITENAME}. - -You can view this story here: -{STORY_URL} - ------------ - -You are receiving this message because you selected to be notified when new stories are added to our site. - -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} - -Please do not reply to this message. - ------------ - -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} \ No newline at end of file diff --git a/testdata/mymodule2/language/german/mail_template/index.html b/testdata/mymodule2/language/german/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/german/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/language/german/main.php b/testdata/mymodule2/language/german/main.php deleted file mode 100644 index be3faabc..00000000 --- a/testdata/mymodule2/language/german/main.php +++ /dev/null @@ -1,99 +0,0 @@ - - Website: - */ - -// ---------------- Main ---------------- -define('_MA_MYMODULE2_INDEX', 'Home'); -define('_MA_MYMODULE2_TITLE', 'My Module 2'); -define('_MA_MYMODULE2_DESC', 'This module is for doing following...'); -define('_MA_MYMODULE2_INDEX_DESC', "Welcome to the homepage of your new module My Module 2!
      -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."); -define('_MA_MYMODULE2_NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); -define('_MA_MYMODULE2_NO', 'No'); -// ---------------- Contents ---------------- -// Category -define('_MA_MYMODULE2_CATEGORY', 'Category'); -define('_MA_MYMODULE2_CATEGORIES', 'Categories'); -define('_MA_MYMODULE2_CATEGORIES_TITLE', 'Categories title'); -define('_MA_MYMODULE2_CATEGORIES_DESC', 'Categories description'); -// Caption of Category -define('_MA_MYMODULE2_CATEGORY_ID', 'Id'); -define('_MA_MYMODULE2_CATEGORY_NAME', 'Name'); -define('_MA_MYMODULE2_CATEGORY_LOGO', 'Logo'); -define('_MA_MYMODULE2_CATEGORY_CREATED', 'Created'); -define('_MA_MYMODULE2_CATEGORY_SUBMITTER', 'Submitter'); -// Article -define('_MA_MYMODULE2_ARTICLE', 'Article'); -define('_MA_MYMODULE2_ARTICLES', 'Articles'); -define('_MA_MYMODULE2_ARTICLES_TITLE', 'Articles title'); -define('_MA_MYMODULE2_ARTICLES_DESC', 'Articles description'); -// Caption of Article -define('_MA_MYMODULE2_ARTICLE_ID', 'Id'); -define('_MA_MYMODULE2_ARTICLE_CAT', 'Cat'); -define('_MA_MYMODULE2_ARTICLE_TITLE', 'Title'); -define('_MA_MYMODULE2_ARTICLE_DESCR', 'Descr'); -define('_MA_MYMODULE2_ARTICLE_IMG', 'Img'); -define('_MA_MYMODULE2_ARTICLE_STATUS', 'Status'); -define('_MA_MYMODULE2_ARTICLE_FILE', 'File'); -define('_MA_MYMODULE2_ARTICLE_CREATED', 'Created'); -define('_MA_MYMODULE2_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield -define('_MA_MYMODULE2_TESTFIELD', 'Testfield'); -define('_MA_MYMODULE2_TESTFIELDS', 'Testfields'); -define('_MA_MYMODULE2_TESTFIELDS_TITLE', 'Testfields title'); -define('_MA_MYMODULE2_TESTFIELDS_DESC', 'Testfields description'); -// Caption of Testfield -define('_MA_MYMODULE2_TESTFIELD_ID', 'Id'); -define('_MA_MYMODULE2_TESTFIELD_TEXT', 'Text'); -define('_MA_MYMODULE2_TESTFIELD_TEXTAREA', 'Textarea'); -define('_MA_MYMODULE2_TESTFIELD_DHTML', 'Dhtml'); -define('_MA_MYMODULE2_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_MA_MYMODULE2_TESTFIELD_YESNO', 'Yesno'); -define('_MA_MYMODULE2_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_MA_MYMODULE2_TESTFIELD_USER', 'User'); -define('_MA_MYMODULE2_TESTFIELD_COLOR', 'Color'); -define('_MA_MYMODULE2_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_MA_MYMODULE2_TESTFIELD_URLFILE', 'Urlfile'); -define('_MA_MYMODULE2_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_MA_MYMODULE2_TESTFIELD_UPLFILE', 'Uplfile'); -define('_MA_MYMODULE2_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_MA_MYMODULE2_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_MA_MYMODULE2_TESTFIELD_STATUS', 'Status'); -define('_MA_MYMODULE2_INDEX_THEREARE', 'There are %s Testfields'); -define('_MA_MYMODULE2_INDEX_LATEST_LIST', 'Last My Module 2'); -// Submit -define('_MA_MYMODULE2_SUBMIT', 'Submit'); -define('_MA_MYMODULE2_SUBMIT_TESTFIELD', 'Submit Testfield'); -define('_MA_MYMODULE2_SUBMIT_ALLPENDING', 'All testfield/script information are posted pending verification.'); -define('_MA_MYMODULE2_SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); -define('_MA_MYMODULE2_SUBMIT_ISAPPROVED', 'Your testfield has been approved'); -define('_MA_MYMODULE2_SUBMIT_PROPOSER', 'Submit a testfield'); -define('_MA_MYMODULE2_SUBMIT_RECEIVED', 'We have received your testfield info. Thank you !'); -define('_MA_MYMODULE2_SUBMIT_SUBMITONCE', 'Submit your testfield/script only once.'); -define('_MA_MYMODULE2_SUBMIT_TAKEDAYS', 'This will take many days to see your testfield/script added successfully in our database.'); -// Form -define('_MA_MYMODULE2_FORM_OK', 'Successfully saved'); -define('_MA_MYMODULE2_FORM_DELETE_OK', 'Successfully deleted'); -define('_MA_MYMODULE2_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_MA_MYMODULE2_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Admin link -define('_MA_MYMODULE2_ADMIN', 'Admin'); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/german/modinfo.php b/testdata/mymodule2/language/german/modinfo.php deleted file mode 100644 index 3eb020f3..00000000 --- a/testdata/mymodule2/language/german/modinfo.php +++ /dev/null @@ -1,193 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Main ---------------- -define('_MI_MYMODULE2_NAME', 'My Module 2'); -define('_MI_MYMODULE2_DESC', 'This module is for doing following...'); -// ---------------- Admin Menu ---------------- -define('_MI_MYMODULE2_ADMENU1', 'Dashboard'); -define('_MI_MYMODULE2_ADMENU2', 'Categories'); -define('_MI_MYMODULE2_ADMENU3', 'Articles'); -define('_MI_MYMODULE2_ADMENU4', 'Testfields'); -define('_MI_MYMODULE2_ADMENU5', 'Permissions'); -define('_MI_MYMODULE2_ADMENU6', 'Feedback'); -define('_MI_MYMODULE2_ABOUT', 'About'); -// ---------------- Admin Nav ---------------- -define('_MI_MYMODULE2_ADMIN_PAGER', 'Admin pager'); -define('_MI_MYMODULE2_ADMIN_PAGER_DESC', 'Admin per page list'); -// User -define('_MI_MYMODULE2_USER_PAGER', 'User pager'); -define('_MI_MYMODULE2_USER_PAGER_DESC', 'User per page list'); -// Submenu -define('_MI_MYMODULE2_SMNAME1', 'Index page'); -define('_MI_MYMODULE2_SMNAME2', 'Articles'); -define('_MI_MYMODULE2_SMNAME3', 'Testfields'); -define('_MI_MYMODULE2_SMNAME4', 'Submit'); -define('_MI_MYMODULE2_SMNAME5', 'Search'); -// Blocks -define('_MI_MYMODULE2_CATEGORIES_BLOCK', 'Categories block'); -define('_MI_MYMODULE2_CATEGORIES_BLOCK_DESC', 'Categories block description'); -define('_MI_MYMODULE2_CATEGORIES_BLOCK_CATEGORY', 'Categories block CATEGORY'); -define('_MI_MYMODULE2_CATEGORIES_BLOCK_CATEGORY_DESC', 'Categories block CATEGORY description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK', 'Articles block'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_DESC', 'Articles block description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_ARTICLE', 'Articles block ARTICLE'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_ARTICLE_DESC', 'Articles block ARTICLE description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_LAST', 'Articles block last'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_LAST_DESC', 'Articles block last description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_NEW', 'Articles block new'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_NEW_DESC', 'Articles block new description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_HITS', 'Articles block hits'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_HITS_DESC', 'Articles block hits description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_TOP', 'Articles block top'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_TOP_DESC', 'Articles block top description'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_RANDOM', 'Articles block random'); -define('_MI_MYMODULE2_ARTICLES_BLOCK_RANDOM_DESC', 'Articles block random description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK', 'Testfields block'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_DESC', 'Testfields block description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TESTFIELD', 'Testfields block TESTFIELD'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TESTFIELD_DESC', 'Testfields block TESTFIELD description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_LAST', 'Testfields block last'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_LAST_DESC', 'Testfields block last description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_NEW', 'Testfields block new'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_NEW_DESC', 'Testfields block new description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_HITS', 'Testfields block hits'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_HITS_DESC', 'Testfields block hits description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TOP', 'Testfields block top'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_TOP_DESC', 'Testfields block top description'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM', 'Testfields block random'); -define('_MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM_DESC', 'Testfields block random description'); -// Config -define('_MI_MYMODULE2_EDITOR_DESCR', 'Editor'); -define('_MI_MYMODULE2_EDITOR_DESCR_DESC', 'Select the Editor Descr to use'); -define('_MI_MYMODULE2_EDITOR_DHTML', 'Editor'); -define('_MI_MYMODULE2_EDITOR_DHTML_DESC', 'Select the Editor Dhtml to use'); -define('_MI_MYMODULE2_KEYWORDS', 'Keywords'); -define('_MI_MYMODULE2_KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); -define('_MI_MYMODULE2_SIZE_MB', 'MB'); -define('_MI_MYMODULE2_MAXSIZE_IMAGE', 'Max size image'); -define('_MI_MYMODULE2_MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); -define('_MI_MYMODULE2_MIMETYPES_IMAGE', 'Mime types image'); -define('_MI_MYMODULE2_MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); -define('_MI_MYMODULE2_MAXWIDTH_IMAGE', 'Max width image'); -define('_MI_MYMODULE2_MAXWIDTH_IMAGE_DESC', 'Set the max width which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE2_MAXHEIGHT_IMAGE', 'Max height image'); -define('_MI_MYMODULE2_MAXHEIGHT_IMAGE_DESC', 'Set the max height which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE2_MAXSIZE_FILE', 'Max size file'); -define('_MI_MYMODULE2_MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); -define('_MI_MYMODULE2_MIMETYPES_FILE', 'Mime types file'); -define('_MI_MYMODULE2_MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); -define('_MI_MYMODULE2_USE_TAG', 'Use TAG'); -define('_MI_MYMODULE2_USE_TAG_DESC', 'If you use tag module, check this option to yes'); -define('_MI_MYMODULE2_NUMB_COL', 'Number Columns'); -define('_MI_MYMODULE2_NUMB_COL_DESC', 'Number Columns to View.'); -define('_MI_MYMODULE2_DIVIDEBY', 'Divide By'); -define('_MI_MYMODULE2_DIVIDEBY_DESC', 'Divide by columns number.'); -define('_MI_MYMODULE2_TABLE_TYPE', 'Table Type'); -define('_MI_MYMODULE2_TABLE_TYPE_DESC', 'Table Type is the bootstrap html table.'); -define('_MI_MYMODULE2_PANEL_TYPE', 'Panel Type'); -define('_MI_MYMODULE2_PANEL_TYPE_DESC', 'Panel Type is the bootstrap html div.'); -define('_MI_MYMODULE2_IDPAYPAL', 'Paypal ID'); -define('_MI_MYMODULE2_IDPAYPAL_DESC', 'Insert here your PayPal ID for donactions.'); -define('_MI_MYMODULE2_ADVERTISE', 'Advertisement Code'); -define('_MI_MYMODULE2_ADVERTISE_DESC', 'Insert here the advertisement code'); -define('_MI_MYMODULE2_MAINTAINEDBY', 'Maintained By'); -define('_MI_MYMODULE2_MAINTAINEDBY_DESC', 'Allow url of support site or community'); -define('_MI_MYMODULE2_BOOKMARKS', 'Social Bookmarks'); -define('_MI_MYMODULE2_BOOKMARKS_DESC', 'Show Social Bookmarks in the single page'); -define('_MI_MYMODULE2_FACEBOOK_COMMENTS', 'Facebook comments'); -define('_MI_MYMODULE2_FACEBOOK_COMMENTS_DESC', 'Allow Facebook comments in the single page'); -define('_MI_MYMODULE2_DISQUS_COMMENTS', 'Disqus comments'); -define('_MI_MYMODULE2_DISQUS_COMMENTS_DESC', 'Allow Disqus comments in the single page'); -// Notifications -define('_MI_MYMODULE2_GLOBAL_NOTIFY', 'Global notify'); -define('_MI_MYMODULE2_GLOBAL_NOTIFY_DESC', 'Global notify desc'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY', 'Global modify notify'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_CAPTION', 'Global modify notify caption'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_DESC', 'Global modify notify desc'); -define('_MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_SUBJECT', 'Global modify notify subject'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY', 'Global broken notify'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_CAPTION', 'Global broken notify caption'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_DESC', 'Global broken notify desc'); -define('_MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_SUBJECT', 'Global broken notify subject'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY', 'Global submit notify'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_CAPTION', 'Global submit notify caption'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_DESC', 'Global submit notify desc'); -define('_MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_SUBJECT', 'Global submit notify subject'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY', 'Global new notify'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY_CAPTION', 'Global new notify caption'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY_DESC', 'Global new notify desc'); -define('_MI_MYMODULE2_GLOBAL_NEW_NOTIFY_SUBJECT', 'Global new notify subject'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY', 'Category notify'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY_DESC', 'Category notify desc'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY_CAPTION', 'Category notify caption'); -define('_MI_MYMODULE2_CATEGORY_NOTIFY_SUBJECT', 'Category notify Subject'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY', 'Category submit notify'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_CAPTION', 'Category submit notify caption'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_DESC', 'Category submit notify desc'); -define('_MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_SUBJECT', 'Category submit notify subject'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY', 'Testfield notify'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY_DESC', 'Testfield notify desc'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY_CAPTION', 'Testfield notify caption'); -define('_MI_MYMODULE2_TESTFIELD_NOTIFY_SUBJECT', 'Testfield notify subject'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY', 'Global newcategory notify'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION', 'Global newcategory notify caption'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_DESC', 'Global newcategory notify desc'); -define('_MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT', 'Global newcategory notify subject'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY', 'Global testfield modify notify'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY_CAPTION', 'Global testfield modify notify caption'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY_DESC', 'Global testfield modify notify desc'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_MODIFY_NOTIFY_SUBJECT', 'Global testfield modify notify subject'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY', 'Global testfield broken notify'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY_CAPTION', 'Global testfield broken notify caption'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY_DESC', 'Global testfield broken notify desc'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_BROKEN_NOTIFY_SUBJECT', 'Global testfield broken notify subject'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY', 'Global testfield submit notify'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Global testfield submit notify caption'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Global testfield submit notify desc'); -define('_MI_MYMODULE2_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Global testfield submit notify subject'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY', 'Global new testfield notify'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY_CAPTION', 'Global new testfield notify caption'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY_DESC', 'Global new testfield notify desc'); -define('_MI_MYMODULE2_GLOBAL_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Global new testfield notify subject'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY', 'Category testfield submit notify'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Category testfield submit notify caption'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Category testfield submit notify desc'); -define('_MI_MYMODULE2_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Category testfield submit notify subject'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY', 'Category new testfield notify'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY_CAPTION', 'Category new testfield notify caption'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY_DESC', 'Category new testfield notify desc'); -define('_MI_MYMODULE2_CATEGORY_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Category new testfield notify subject'); -define('_MI_MYMODULE2_APPROVE_NOTIFY', 'Testfield approve notify'); -define('_MI_MYMODULE2_APPROVE_NOTIFY_CAPTION', 'Testfield approve notify caption'); -define('_MI_MYMODULE2_APPROVE_NOTIFY_DESC', 'Testfield approve notify desc'); -define('_MI_MYMODULE2_APPROVE_NOTIFY_SUBJECT', 'Testfield approve notify subject'); -// Permissions Groups -define('_MI_MYMODULE2_GROUPS', 'Groups access'); -define('_MI_MYMODULE2_GROUPS_DESC', 'Select general access permission for groups.'); -define('_MI_MYMODULE2_ADMIN_GROUPS', 'Admin Group Permissions'); -define('_MI_MYMODULE2_ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); -define('_MI_MYMODULE2_UPLOAD_GROUPS', 'Upload Group Permissions'); -define('_MI_MYMODULE2_UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); -// ---------------- End ---------------- diff --git a/testdata/mymodule2/language/index.html b/testdata/mymodule2/language/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/language/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/list.tag.php b/testdata/mymodule2/list.tag.php deleted file mode 100644 index 8c294bcb..00000000 --- a/testdata/mymodule2/list.tag.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -include XOOPS_ROOT_PATH . '/modules/tag/list.tag.php'; diff --git a/testdata/mymodule2/notification_update.php b/testdata/mymodule2/notification_update.php deleted file mode 100644 index 79853db9..00000000 --- a/testdata/mymodule2/notification_update.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include XOOPS_ROOT_PATH . '/include/notification_update.php'; diff --git a/testdata/mymodule2/pdf.php b/testdata/mymodule2/pdf.php deleted file mode 100644 index e732afb0..00000000 --- a/testdata/mymodule2/pdf.php +++ /dev/null @@ -1,102 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id'); -if (file_exists($tcpdf = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php')) { - require_once $tcpdf; -} else { - redirect_header('testfields.php', 2, _MA_MYMODULE2_NO_PDF_LIBRARY); -} -// Get Instance of Handler -$testfieldsHandler = $helper->getHandler('testfields'); -$testfields = $this->getVar('tf_id'); - -$pdfData['content'] = strip_tags($pdfContent->getVar('tf_textarea')); -$pdfData['content'] = strip_tags($pdfContent->getVar('tf_dhtml')); -$pdfData['author'] = \XoopsUser::getUnameFromId($pdfContent->getVar('tf_user')); -$pdfData['date'] = formatTimeStamp($pdfContent->getVar('tf_textdateselect'), 's'); - -// Get Config -$pdfData['creator'] = $GLOBALS['xoopsConfig']['xoops_sitename']; -$pdfData['subject'] = $GLOBALS['xoopsConfig']['slogan']; -$pdfData['keywords'] = $GLOBALS['xoopsConfig']['keywords']; -// Defines -define('MYMODULE2_CREATOR', $pdfData['creator']); -define('MYMODULE2_AUTHOR', $pdfData['author']); -define('MYMODULE2_HEADER_TITLE', $pdfData['title']); -define('MYMODULE2_HEADER_STRING', $pdfData['subject']); -define('MYMODULE2_HEADER_LOGO', 'logo.gif'); -define('MYMODULE2_IMAGES_PATH', XOOPS_ROOT_PATH.'/images/'); -$myts = MyTextSanitizer::getInstance(); -$content = ''; -$content .= $myts->undoHtmlSpecialChars($pdfData['content']); -$content = $myts->displayTarea($content); -$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, _CHARSET, false); -$title = $myts->undoHtmlSpecialChars($pdfData['title']); -$keywords = $myts->undoHtmlSpecialChars($pdfData['keywords']); -$pdfData['fontsize'] = 12; -// For schinese -if (_LANGCODE == 'cn') { - $pdf->SetFont('gbsn00lp', '', $pdfData['fontsize']); -} else { - $pdf->SetFont($pdfData['fontname'], '', $pdfData['fontsize']); -} -// Set document information -$pdf->SetCreator($pdfData['creator']); -$pdf->SetAuthor($pdfData['author']); -$pdf->SetTitle($title); -$pdf->SetKeywords($keywords); -// Set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, MYMODULE2_HEADER_TITLE, MYMODULE2_HEADER_STRING); -// Set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT); -// Set auto page breaks -$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor -if (_LANGCODE == 'cn') { - $pdf->setHeaderFont(array('gbsn00lp', '', $pdfData['fontsize'])); - $pdf->setFooterFont(array('gbsn00lp', '', $pdfData['fontsize'])); -} else { - $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); -} -// Set some language-dependent strings (optional) -if (@file_exists($lang = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php')) { - require_once $lang . '/.php'; - $pdf->setLanguageArray($l); -} -// Initialize document -$pdf->AliasNbPages(); -// Add Page document -$pdf->AddPage(); -$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $content, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); -// Pdf Filename -// Output -$GLOBALS['xoopsTpl']->assign('pdfoutput', $pdf->Output('testfields.pdf', 'I')); -$GLOBALS['xoopsTpl']->display('db:mymodule2_pdf.tpl'); diff --git a/testdata/mymodule2/preloads/index.html b/testdata/mymodule2/preloads/index.html deleted file mode 100644 index e8525b61..00000000 --- a/testdata/mymodule2/preloads/index.html +++ /dev/null @@ -1,3 +0,0 @@ -' . _AM_CONTENT_CREATED . ' - -' . _AM_CONTENT_CREATED . ' diff --git a/testdata/mymodule2/print.php b/testdata/mymodule2/print.php deleted file mode 100644 index a86b5b32..00000000 --- a/testdata/mymodule2/print.php +++ /dev/null @@ -1,49 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id'); -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -if (empty($tfId)) { - redirect_header(MYMODULE2_URL . '/index.php', 2, _MA_MYMODULE2_NOTFID); -} -// Get Instance of Handler -$testfieldsHandler = $helper->getHandler('testfields'); -// Verify that the article is published -$testfields = $testfieldsHandler->get($tfId); -// Verify permissions -if (!$grouppermHandler->checkRight('mymodule2_view', $tfId->getVar('tf_id'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) { - redirect_header(MYMODULE2_URL . '/index.php', 3, _NOPERM); - exit(); -} -$testfield = $testfields->getValuesTestfields(); -foreach($testfield as $k => $v) { - $GLOBALS['xoopsTpl']->append('"{$k}"', $v); -} -$GLOBALS['xoopsTpl']->assign('xoops_sitename', $GLOBALS['xoopsConfig']['sitename']); -$GLOBALS['xoopsTpl']->assign('xoops_pagetitle', strip_tags($testfield->getVar('tf_text') - _MA_MYMODULE2_PRINT - $GLOBALS['xoopsModule']->name())); -$GLOBALS['xoopsTpl']->display('db:testfields_print.tpl'); diff --git a/testdata/mymodule2/rate.php b/testdata/mymodule2/rate.php deleted file mode 100644 index bbf666a9..00000000 --- a/testdata/mymodule2/rate.php +++ /dev/null @@ -1,207 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$op = Request::getString('op', 'form'); -$lid = Request::getInt('lid'); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_testfields.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE2_RATE; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE2_RATE . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_RATE)); - // Form Create - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if ($GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $testfieldsObj = $testfieldsHandler->create(); - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule2\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - // Insert Data - if ($testfields1->insert($testfieldsObj)) { - redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - - break; -} -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => RATE_MA_MYMODULE2_]; -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/rss.php b/testdata/mymodule2/rss.php deleted file mode 100644 index 2f27c217..00000000 --- a/testdata/mymodule2/rss.php +++ /dev/null @@ -1,101 +0,0 @@ - - Website: - */ - -use Xmf\Request; - -require __DIR__ . '/header.php'; - -$cid = Request::getInt('cid', 0, 'GET'); -include_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 = mymodule2MyGetItemIds('mymodule2_view', 'mymodule2'); -$criteria = new \CriteriaCompo(); - -$criteria->add(new \Criteria('cat_status', 0, '!=')); -$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')','IN')); -if ($cid != 0){ - $criteria->add(new \Criteria('cid', $cid)); - $testfields = $testfieldsHandler->get($cid); - $title = $xoopsConfig['sitename'] . ' - ' . $xoopsModule->getVar('name') . ' - ' . $testfields->getVar('tf_status'); -} else { - $title = $xoopsConfig['sitename'] . ' - ' . $xoopsModule->getVar('name'); -} -$criteria->setLimit($helper->getConfig('perpagerss')); -$criteria->setSort('date'); -$criteria->setOrder('DESC'); -$testfieldsArr = $testfieldsHandler->getAll($criteria); -unset($criteria); - -if (!$tpl->is_cached('db:mymodule2_rss.tpl', $cid)) { - $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('tf_status'), ENT_QUOTES)); - $tpl->assign('channel_language', _LANGCODE); - if ( _LANGCODE == 'fr' ) { - $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($testfieldsArr) as $i) { - $description = $testfieldsArr[$i]->getVar('description'); - //permet d'afficher uniquement la description courte - if (strpos($description,'[pagebreak]')==false){ - $description_short = $description; - } else { - $description_short = substr($description,0,strpos($description,'[pagebreak]')); - } - $tpl->append('items', array('title' => htmlspecialchars($testfieldsArr[$i]->getVar('tf_status'), ENT_QUOTES), - 'link' => XOOPS_URL . '/modules/mymodule2/single.php?cid=' . $testfieldsArr[$i]->getVar('cid') . '&tf_id=' . $testfieldsArr[$i]->getVar('tf_id'), - 'guid' => XOOPS_URL . '/modules/mymodule2/single.php?cid=' . $testfieldsArr[$i]->getVar('cid') . '&tf_id=' . $testfieldsArr[$i]->getVar('tf_id'), - 'pubdate' => formatTimestamp($testfieldsArr[$i]->getVar('date'), 'rss'), - 'description' => htmlspecialchars($description_short, ENT_QUOTES))); - } -} -header('Content-Type:text/xml; charset=' . _CHARSET); -$tpl->display('db:mymodule2_rss.tpl', $cid); \ No newline at end of file diff --git a/testdata/mymodule2/search.php b/testdata/mymodule2/search.php deleted file mode 100644 index 7d630503..00000000 --- a/testdata/mymodule2/search.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id', 0); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_index.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// ------------------- Define Stylesheet ------------------- // -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = array(); -// ------------------- Breadcrumbs ------------------- // -$xoBreadcrumbs[] = ['title' => TESTFIELDS_MA_MYMODULE2_]; -// ------------------- Keywords ------------------- // -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// ------------------- Description ------------------- // -mymodule2MetaDescription(DESC_MA_MYMODULE2__DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/single.php b/testdata/mymodule2/single.php deleted file mode 100644 index fd481f44..00000000 --- a/testdata/mymodule2/single.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id', 0); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_single.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = array(); -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_TESTFIELDS]; -// Keywords -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// Description -mymodule2MetaDescription(_MA_MYMODULE2_TESTFIELDS_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/sql/index.html b/testdata/mymodule2/sql/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/sql/mysql.sql b/testdata/mymodule2/sql/mysql.sql deleted file mode 100644 index e7840cb8..00000000 --- a/testdata/mymodule2/sql/mysql.sql +++ /dev/null @@ -1,63 +0,0 @@ -# SQL Dump for my module 2 module -# PhpMyAdmin Version: 4.0.4 -# http://www.phpmyadmin.net -# -# Host: localhost -# Generated on: Thu Apr 16, 2020 to 20:35:36 -# Server version: 5.5.5-10.4.10-MariaDB -# PHP Version: 7.3.12 - -# -# Structure table for `mymodule2_categories` 5 -# - -CREATE TABLE `mymodule2_categories` ( - `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `cat_name` VARCHAR(200) NOT NULL DEFAULT '', - `cat_logo` VARCHAR(200) NOT NULL DEFAULT '', - `cat_created` INT(10) NOT NULL DEFAULT '0', - `cat_submitter` INT(8) NOT NULL DEFAULT '0', - PRIMARY KEY (`cat_id`) -) ENGINE=InnoDB; - -# -# Structure table for `mymodule2_articles` 9 -# - -CREATE TABLE `mymodule2_articles` ( - `art_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `art_cat` INT(8) NOT NULL DEFAULT '0', - `art_title` VARCHAR(200) NOT NULL DEFAULT '', - `art_descr` MEDIUMTEXT NOT NULL , - `art_img` VARCHAR(200) NULL DEFAULT '''', - `art_status` TINYINT(1) NOT NULL DEFAULT '0', - `art_file` VARCHAR(200) NOT NULL DEFAULT '', - `art_created` INT(10) NOT NULL DEFAULT '0', - `art_submitter` INT(10) NOT NULL DEFAULT '0', - PRIMARY KEY (`art_id`) -) ENGINE=InnoDB; - -# -# Structure table for `mymodule2_testfields` 16 -# - -CREATE TABLE `mymodule2_testfields` ( - `tf_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `tf_text` VARCHAR(100) NOT NULL DEFAULT '', - `tf_textarea` VARCHAR(100) NOT NULL DEFAULT '', - `tf_dhtml` VARCHAR(100) NOT NULL DEFAULT '', - `tf_checkbox` INT(10) NOT NULL DEFAULT '0', - `tf_yesno` INT(1) NOT NULL DEFAULT '0', - `tf_selectbox` VARCHAR(100) NOT NULL DEFAULT '', - `tf_user` INT(10) NOT NULL DEFAULT '0', - `tf_color` VARCHAR(100) NOT NULL DEFAULT '', - `tf_imagelist` VARCHAR(100) NOT NULL DEFAULT '', - `tf_urlfile` VARCHAR(100) NOT NULL DEFAULT '', - `tf_uplimage` VARCHAR(100) NOT NULL DEFAULT '', - `tf_uplfile` VARCHAR(100) NOT NULL DEFAULT '', - `tf_textdateselect` VARCHAR(100) NOT NULL DEFAULT '', - `tf_selectfile` VARCHAR(100) NOT NULL DEFAULT '', - `tf_status` INT(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`tf_id`) -) ENGINE=InnoDB; - diff --git a/testdata/mymodule2/submit.php b/testdata/mymodule2/submit.php deleted file mode 100644 index 2ed08e4a..00000000 --- a/testdata/mymodule2/submit.php +++ /dev/null @@ -1,244 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -xoops_loadLanguage('admin', 'mymodule2'); -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'form'); -// Template -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_submit.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$permissionsHandler = $helper->getHandler('permissions'); -$permSubmit = $permissionsHandler->getPermGlobalSubmit(); -// Redirection if not permissions -if ($permSubmit === false) { - redirect_header('index.php', 2, _NOPERM); - exit(); -} -switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE2_SUBMIT_PROPOSER; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE2_SUBMIT_PROPOSER . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_SUBMIT_PROPOSER)); - // Form Create - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $testfieldsObj = $testfieldsHandler->create(); - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule2\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - // Insert Data - if ($testfieldsHandler->insert($testfieldsObj)) { - $newTfId = $testfieldsObj->getNewInsertedIdTestfields(); - $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId; - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $GLOBALS['xoopsModule']->getVar('mid'); - // Permission to view_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule2_view_testfields', $permId); - if (isset($_POST['groups_view_testfields'])) { - foreach($_POST['groups_view_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_view_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to submit_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule2_submit_testfields', $permId); - if (isset($_POST['groups_submit_testfields'])) { - foreach($_POST['groups_submit_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_submit_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to approve_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule2_approve_testfields', $permId); - if (isset($_POST['groups_approve_testfields'])) { - foreach($_POST['groups_approve_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule2_approve_testfields', $permId, $onegroupId, $mid); - } - } - if ('' !== $uploaderErrors) { - redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors); - } else { - redirect_header('testfields.php?op=list', 2, _MA_MYMODULE2_FORM_OK); - } - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - - break; -} -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_SUBMIT]; -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/templates/admin/index.html b/testdata/mymodule2/templates/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/templates/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_about.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_about.tpl deleted file mode 100644 index 65c23737..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_about.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -<{includeq file='db:mymodule2_admin_header.tpl'}> - - -
      <{$about}>
      - - -<{includeq file='db:mymodule2_admin_footer.tpl'}> diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_articles.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_articles.tpl deleted file mode 100644 index 1bfaf5d6..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_articles.tpl +++ /dev/null @@ -1,56 +0,0 @@ - -<{include file='db:mymodule2_admin_header.tpl'}> - -<{if $articles_list}> - - - - - - - - - - - - - - - - <{if $articles_count}> - - <{foreach item=article from=$articles_list}> - '> - - - - - - - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE2_ARTICLE_ID}><{$smarty.const._AM_MYMODULE2_ARTICLE_CAT}><{$smarty.const._AM_MYMODULE2_ARTICLE_TITLE}><{$smarty.const._AM_MYMODULE2_ARTICLE_DESCR}><{$smarty.const._AM_MYMODULE2_ARTICLE_IMG}><{$smarty.const._AM_MYMODULE2_ARTICLE_STATUS}><{$smarty.const._AM_MYMODULE2_ARTICLE_FILE}><{$smarty.const._AM_MYMODULE2_ARTICLE_CREATED}><{$smarty.const._AM_MYMODULE2_ARTICLE_SUBMITTER}><{$smarty.const._AM_MYMODULE2_FORM_ACTION}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articlesarticles<{$article.file}><{$article.created}><{$article.submitter}> - articles - articles -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule2_admin_footer.tpl'}> diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_categories.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_categories.tpl deleted file mode 100644 index a0eb78d3..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_categories.tpl +++ /dev/null @@ -1,44 +0,0 @@ - -<{include file='db:mymodule2_admin_header.tpl'}> - -<{if $categories_list}> - - - - - - - - - - <{if $categories_count}> - - <{foreach item=category from=$categories_list}> - '> - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE2_CATEGORY_ID}><{$smarty.const._AM_MYMODULE2_CATEGORY_NAME}><{$smarty.const._AM_MYMODULE2_CATEGORY_CREATED}><{$smarty.const._AM_MYMODULE2_FORM_ACTION}>
      <{$category.id}><{$category.name}><{$category.created}> - categories - categories -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule2_admin_footer.tpl'}> diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_footer.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_footer.tpl deleted file mode 100644 index b6238ee2..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_footer.tpl +++ /dev/null @@ -1,6 +0,0 @@ -
      - XOOPS -
      -
      - My Module 2<{$smarty.const._AM_MYMODULE2_MAINTAINEDBY}>Support Forum -
      diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_header.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_header.tpl deleted file mode 100644 index 95b90868..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_header.tpl +++ /dev/null @@ -1,6 +0,0 @@ -
      - <{$navigation}> - <{if $buttons}> - <{$buttons}> - <{/if}> -
      diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_index.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_index.tpl deleted file mode 100644 index 448ae194..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_index.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -<{includeq file='db:mymodule2_admin_header.tpl'}> - - -
      <{$index}>
      - - -<{includeq file='db:mymodule2_admin_footer.tpl'}> diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_permissions.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_permissions.tpl deleted file mode 100644 index 8d5db5ed..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_permissions.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<{include file='db:mymodule2_admin_header.tpl'}> - -
      <{$form}>
      - -<{include file='db:mymodule2_admin_footer.tpl'}> diff --git a/testdata/mymodule2/templates/admin/mymodule2_admin_testfields.tpl b/testdata/mymodule2/templates/admin/mymodule2_admin_testfields.tpl deleted file mode 100644 index eb35fed4..00000000 --- a/testdata/mymodule2/templates/admin/mymodule2_admin_testfields.tpl +++ /dev/null @@ -1,70 +0,0 @@ - -<{include file='db:mymodule2_admin_header.tpl'}> - -<{if $testfields_list}> - - - - - - - - - - - - - - - - - - - - - - - <{if $testfields_count}> - - <{foreach item=testfield from=$testfields_list}> - '> - - - - - - - - - - - - - - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE2_TESTFIELD_ID}><{$smarty.const._AM_MYMODULE2_TESTFIELD_TEXT}><{$smarty.const._AM_MYMODULE2_TESTFIELD_TEXTAREA}><{$smarty.const._AM_MYMODULE2_TESTFIELD_DHTML}><{$smarty.const._AM_MYMODULE2_TESTFIELD_CHECKBOX}><{$smarty.const._AM_MYMODULE2_TESTFIELD_YESNO}><{$smarty.const._AM_MYMODULE2_TESTFIELD_SELECTBOX}><{$smarty.const._AM_MYMODULE2_TESTFIELD_USER}><{$smarty.const._AM_MYMODULE2_TESTFIELD_COLOR}><{$smarty.const._AM_MYMODULE2_TESTFIELD_IMAGELIST}><{$smarty.const._AM_MYMODULE2_TESTFIELD_URLFILE}><{$smarty.const._AM_MYMODULE2_TESTFIELD_UPLIMAGE}><{$smarty.const._AM_MYMODULE2_TESTFIELD_UPLFILE}><{$smarty.const._AM_MYMODULE2_TESTFIELD_TEXTDATESELECT}><{$smarty.const._AM_MYMODULE2_TESTFIELD_SELECTFILE}><{$smarty.const._AM_MYMODULE2_TESTFIELD_STATUS}><{$smarty.const._AM_MYMODULE2_FORM_ACTION}>
      <{$testfield.id}><{$testfield.text}><{$testfield.textarea}><{$testfield.dhtml}>testfields<{$testfield.yesno_text}><{$testfield.selectbox}><{$testfield.user}>    testfields<{$testfield.urlfile}>testfields<{$testfield.uplfile}><{$testfield.textdateselect}><{$testfield.selectfile}>testfields - testfields - testfields -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule2_admin_footer.tpl'}> diff --git a/testdata/mymodule2/templates/blocks/index.html b/testdata/mymodule2/templates/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/templates/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/templates/blocks/mymodule2_block_articles.tpl b/testdata/mymodule2/templates/blocks/mymodule2_block_articles.tpl deleted file mode 100644 index 8c19a01a..00000000 --- a/testdata/mymodule2/templates/blocks/mymodule2_block_articles.tpl +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - <{if count($block)}> - - <{foreach item=article from=$block}> - "> - - - - - - - - - - - <{/foreach}> - - <{/if}> - -
      <{$smarty.const._MB_MYMODULE2_ART_ID}><{$smarty.const._MB_MYMODULE2_ART_CAT}><{$smarty.const._MB_MYMODULE2_ART_TITLE}><{$smarty.const._MB_MYMODULE2_ART_DESCR}><{$smarty.const._MB_MYMODULE2_ART_IMG}><{$smarty.const._MB_MYMODULE2_ART_STATUS}><{$smarty.const._MB_MYMODULE2_ART_FILE}><{$smarty.const._MB_MYMODULE2_ART_CREATED}><{$smarty.const._MB_MYMODULE2_ART_SUBMITTER}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articles<{$article.status}><{$article.file}><{$article.created}><{$article.submitter}> - articles - articles -
       
      diff --git a/testdata/mymodule2/templates/blocks/mymodule2_block_testfields.tpl b/testdata/mymodule2/templates/blocks/mymodule2_block_testfields.tpl deleted file mode 100644 index 1d6bd923..00000000 --- a/testdata/mymodule2/templates/blocks/mymodule2_block_testfields.tpl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - <{if count($block)}> - - <{foreach item=testfield from=$block}> - "> - - - - - - - - - - - - - - - - - - <{/foreach}> - - <{/if}> - -
      <{$smarty.const._MB_MYMODULE2_TF_ID}><{$smarty.const._MB_MYMODULE2_TF_TEXT}><{$smarty.const._MB_MYMODULE2_TF_TEXTAREA}><{$smarty.const._MB_MYMODULE2_TF_DHTML}><{$smarty.const._MB_MYMODULE2_TF_CHECKBOX}><{$smarty.const._MB_MYMODULE2_TF_YESNO}><{$smarty.const._MB_MYMODULE2_TF_SELECTBOX}><{$smarty.const._MB_MYMODULE2_TF_USER}><{$smarty.const._MB_MYMODULE2_TF_COLOR}><{$smarty.const._MB_MYMODULE2_TF_IMAGELIST}><{$smarty.const._MB_MYMODULE2_TF_URLFILE}><{$smarty.const._MB_MYMODULE2_TF_UPLIMAGE}><{$smarty.const._MB_MYMODULE2_TF_UPLFILE}><{$smarty.const._MB_MYMODULE2_TF_TEXTDATESELECT}><{$smarty.const._MB_MYMODULE2_TF_SELECTFILE}><{$smarty.const._MB_MYMODULE2_TF_STATUS}>
      <{$testfield.id}><{$testfield.text}><{$testfield.textarea}><{$testfield.dhtml}><{$testfield.checkbox}><{$testfield.yesno}><{$testfield.selectbox}><{$testfield.user}><{$testfield.color}> -testfields<{$testfield.urlfile}>testfields<{$testfield.uplfile}><{$testfield.textdateselect}><{$testfield.selectfile}><{$testfield.status}> - testfields - testfields -
       
      diff --git a/testdata/mymodule2/templates/index.html b/testdata/mymodule2/templates/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/templates/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/templates/mymodule2_articles.tpl b/testdata/mymodule2/templates/mymodule2_articles.tpl deleted file mode 100644 index 3438d11e..00000000 --- a/testdata/mymodule2/templates/mymodule2_articles.tpl +++ /dev/null @@ -1,30 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -<{if $articlesCount > 0}> -
      - - - - - - - - - <{foreach item=article from=$articles}> - - <{if $article.count is div by $divideby}> - - <{/if}> - <{/foreach}> - - - -
      <{$smarty.const._MA_MYMODULE2_ARTICLES_TITLE}>
      -
      - <{include file='db:mymodule2_articles_list.tpl' article=$article}> -
      -
       
      -
      -<{/if}> - -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_articles_cat.tpl b/testdata/mymodule2/templates/mymodule2_articles_cat.tpl deleted file mode 100644 index 21f409fe..00000000 --- a/testdata/mymodule2/templates/mymodule2_articles_cat.tpl +++ /dev/null @@ -1,20 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -
      -
      -<{$smarty.const._MA_MYMODULE2_ARTICLES_TITLE}>
      - -<{foreach item=article from=$articles}> -
      -<{include file='db:mymodule2_articles_list.tpl' article=$article}> -<{if $article.count is div by $numb_col}> -
      -<{/if}> - -
      - -<{/foreach}> - -
      - -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_articles_cat_list.tpl b/testdata/mymodule2/templates/mymodule2_articles_cat_list.tpl deleted file mode 100644 index 5e7d4ca3..00000000 --- a/testdata/mymodule2/templates/mymodule2_articles_cat_list.tpl +++ /dev/null @@ -1,33 +0,0 @@ -
      -
      - -
      -<{$article.cat}> - -<{$article.title}> - -<{$article.descr}> - -articles - -<{$article.file}> - -<{$article.created}> - -<{$article.submitter}> - -
      - -
      -<{$testfield.text}> - -<{$testfield.textarea}> - -<{$testfield.dhtml}> - -testfields - -<{$testfield.status}> - -
      - diff --git a/testdata/mymodule2/templates/mymodule2_articles_list.tpl b/testdata/mymodule2/templates/mymodule2_articles_list.tpl deleted file mode 100644 index 38df557d..00000000 --- a/testdata/mymodule2/templates/mymodule2_articles_list.tpl +++ /dev/null @@ -1,21 +0,0 @@ -
      -

      <{$article.submitter}>

      -
      -
      - <{$article.cat}> - <{$article.title}> - <{$article.descr}> - articles - <{$article.file}> - <{$article.created}> - <{$article.submitter}> -
      -
      - <{$smarty.const._MA_MYMODULE2_ARTICLE_CAT}>: <{$article.cat}> - <{$smarty.const._MA_MYMODULE2_ARTICLE_TITLE}>: <{$article.title}> - <{$smarty.const._MA_MYMODULE2_ARTICLE_DESCR}>: <{$article.descr}> - <{$smarty.const._MA_MYMODULE2_ARTICLE_IMG}>: <{$article.img}> - <{$smarty.const._MA_MYMODULE2_ARTICLE_FILE}>: <{$article.file}> - <{$smarty.const._MA_MYMODULE2_ARTICLE_CREATED}>: <{$article.created}> - <{$smarty.const._MA_MYMODULE2_ARTICLE_SUBMITTER}>: <{$article.submitter}> -
      diff --git a/testdata/mymodule2/templates/mymodule2_breadcrumbs.tpl b/testdata/mymodule2/templates/mymodule2_breadcrumbs.tpl deleted file mode 100644 index 2290b814..00000000 --- a/testdata/mymodule2/templates/mymodule2_breadcrumbs.tpl +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/testdata/mymodule2/templates/mymodule2_broken.tpl b/testdata/mymodule2/templates/mymodule2_broken.tpl deleted file mode 100644 index 56c160a7..00000000 --- a/testdata/mymodule2/templates/mymodule2_broken.tpl +++ /dev/null @@ -1,47 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - - - - - - - - - - - - - - - - - - - - - - - <{foreach item=testfield from=$testfields}> - - - - - - - - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE2_TF_ID}><{$smarty.const._MA_MYMODULE2_TF_TEXT}><{$smarty.const._MA_MYMODULE2_TF_TEXTAREA}><{$smarty.const._MA_MYMODULE2_TF_DHTML}><{$smarty.const._MA_MYMODULE2_TF_CHECKBOX}><{$smarty.const._MA_MYMODULE2_TF_YESNO}><{$smarty.const._MA_MYMODULE2_TF_SELECTBOX}><{$smarty.const._MA_MYMODULE2_TF_USER}><{$smarty.const._MA_MYMODULE2_TF_COLOR}><{$smarty.const._MA_MYMODULE2_TF_IMAGELIST}><{$smarty.const._MA_MYMODULE2_TF_URLFILE}><{$smarty.const._MA_MYMODULE2_TF_UPLIMAGE}><{$smarty.const._MA_MYMODULE2_TF_UPLFILE}><{$smarty.const._MA_MYMODULE2_TF_TEXTDATESELECT}><{$smarty.const._MA_MYMODULE2_TF_SELECTFILE}><{$smarty.const._MA_MYMODULE2_TF_STATUS}>
      <{$testfield.id}><{$testfield.text}><{$testfield.textarea}><{$testfield.dhtml}><{$testfield.checkbox}><{$testfield.yesno}><{$testfield.selectbox}><{$testfield.user}><{$mymodule2_upload_url}>/images/testfields/<{$testfield.color}> -testfields<{$testfield.urlfile}>testfields<{$testfield.uplfile}><{$testfield.textdateselect}><{$testfield.selectfile}><{$testfield.status}>
      -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_footer.tpl b/testdata/mymodule2/templates/mymodule2_footer.tpl deleted file mode 100644 index 063bef31..00000000 --- a/testdata/mymodule2/templates/mymodule2_footer.tpl +++ /dev/null @@ -1,27 +0,0 @@ -<{if $bookmarks != 0}> - <{include file="db:system_bookmarks.tpl"}> -<{/if}> - -<{if $fbcomments != 0}> - <{include file="db:system_fbcomments.tpl"}> -<{/if}> -
      <{$copyright}>
      -<{if $pagenav != ''}> -
      <{$pagenav}>
      -<{/if}> -
      -<{if $xoops_isadmin}> -
      -<{/if}> -
      - <{if $comment_mode == "flat"}> - <{include file="db:system_comments_flat.tpl"}> - <{elseif $comment_mode == "thread"}> - <{include file="db:system_comments_thread.tpl"}> - <{elseif $comment_mode == "nest"}> - <{include file="db:system_comments_nest.tpl"}> - <{/if}> -
      - -
      -<{include file='db:system_notification_select.tpl'}> \ No newline at end of file diff --git a/testdata/mymodule2/templates/mymodule2_header.tpl b/testdata/mymodule2/templates/mymodule2_header.tpl deleted file mode 100644 index 357719ba..00000000 --- a/testdata/mymodule2/templates/mymodule2_header.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<{includeq file='db:mymodule2_breadcrumbs.tpl'}> - -<{if $ads != ''}> -
      <{$ads}>
      -<{/if}> diff --git a/testdata/mymodule2/templates/mymodule2_index.tpl b/testdata/mymodule2/templates/mymodule2_index.tpl deleted file mode 100644 index dc3dc50b..00000000 --- a/testdata/mymodule2/templates/mymodule2_index.tpl +++ /dev/null @@ -1,128 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -<{if $testfieldsCount == 0}> - - - - - - - - - - - - - <{if $adv != ''}> - - <{else}> - - <{/if}> - -
      <{$smarty.const._MA_MYMODULE2_TITLE}> - <{$smarty.const._MA_MYMODULE2_DESC}>
      - -
      <{$smarty.const._MA_MYMODULE2_INDEX_DESC}>
      -
      <{$adv}>
       
      -<{/if}> -<{if $articlesCount > 0}> -
      - - - - - - - - - <{foreach item=article from=$articles}> - - <{if $article.count is div by $numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
      <{$smarty.const._MA_MYMODULE2_ARTICLES}>
      - <{include file="db:mymodule2_articles_list.tpl" article=$article}> -
      <{$lang_thereare}>
      -
      -<{/if}> - -<{if $articlesCount > 0}> - -
      <{$smarty.const._MA_MYMODULE2_INDEX_LATEST_LIST}>
      - - - - <{section name=i loop=$articles}> - - <{if $articles[i].count is div by $divideby}> - - <{/if}> - <{/section}> - - -
      - <{include file="db:mymodule2_articles_list.tpl" article=$articles[i]}> -
      - -<{/if}> -<{if $testfieldsCount > 0}> -
      - - - - - - - - - <{foreach item=testfield from=$testfields}> - - <{if $testfield.count is div by $numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
      <{$smarty.const._MA_MYMODULE2_TESTFIELDS}>
      - <{include file="db:mymodule2_testfields_list.tpl" testfield=$testfield}> -
      <{$lang_thereare}>
      -
      -<{/if}> - -<{if $testfieldsCount > 0}> - -
      <{$smarty.const._MA_MYMODULE2_INDEX_LATEST_LIST}>
      - - - - <{section name=i loop=$testfields}> - - <{if $testfields[i].count is div by $divideby}> - - <{/if}> - <{/section}> - - -
      - <{include file="db:mymodule2_testfields_list.tpl" testfield=$testfields[i]}> -
      - -<{/if}> -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_pdf.tpl b/testdata/mymodule2/templates/mymodule2_pdf.tpl deleted file mode 100644 index 524fd9d6..00000000 --- a/testdata/mymodule2/templates/mymodule2_pdf.tpl +++ /dev/null @@ -1 +0,0 @@ -
      <{$pdfoutput}>
      \ No newline at end of file diff --git a/testdata/mymodule2/templates/mymodule2_print.tpl b/testdata/mymodule2/templates/mymodule2_print.tpl deleted file mode 100644 index 752cc340..00000000 --- a/testdata/mymodule2/templates/mymodule2_print.tpl +++ /dev/null @@ -1,46 +0,0 @@ -<{include file="db:mymodule2_header.tpl"}> - - - - - - - - - - - - - - - - - - - - - - - <{foreach item=list from=$testfields}> - - - - - - - - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE2_TF_ID}><{$smarty.const._MA_MYMODULE2_TF_TEXT}><{$smarty.const._MA_MYMODULE2_TF_TEXTAREA}><{$smarty.const._MA_MYMODULE2_TF_DHTML}><{$smarty.const._MA_MYMODULE2_TF_CHECKBOX}><{$smarty.const._MA_MYMODULE2_TF_YESNO}><{$smarty.const._MA_MYMODULE2_TF_SELECTBOX}><{$smarty.const._MA_MYMODULE2_TF_USER}><{$smarty.const._MA_MYMODULE2_TF_COLOR}><{$smarty.const._MA_MYMODULE2_TF_IMAGELIST}><{$smarty.const._MA_MYMODULE2_TF_URLFILE}><{$smarty.const._MA_MYMODULE2_TF_UPLIMAGE}><{$smarty.const._MA_MYMODULE2_TF_UPLFILE}><{$smarty.const._MA_MYMODULE2_TF_TEXTDATESELECT}><{$smarty.const._MA_MYMODULE2_TF_SELECTFILE}><{$smarty.const._MA_MYMODULE2_TF_STATUS}>
      <{$list.id}><{$list.text}><{$list.textarea}><{$list.dhtml}><{$list.checkbox}><{$list.yesno}><{$list.selectbox}><{$list.user}> testfields<{$list.urlfile}>testfields<{$list.uplfile}><{$list.textdateselect}><{$list.selectfile}><{$list.status}>
      -<{include file="db:mymodule2_footer.tpl"}> \ No newline at end of file diff --git a/testdata/mymodule2/templates/mymodule2_rate.tpl b/testdata/mymodule2/templates/mymodule2_rate.tpl deleted file mode 100644 index 752cc340..00000000 --- a/testdata/mymodule2/templates/mymodule2_rate.tpl +++ /dev/null @@ -1,46 +0,0 @@ -<{include file="db:mymodule2_header.tpl"}> - - - - - - - - - - - - - - - - - - - - - - - <{foreach item=list from=$testfields}> - - - - - - - - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE2_TF_ID}><{$smarty.const._MA_MYMODULE2_TF_TEXT}><{$smarty.const._MA_MYMODULE2_TF_TEXTAREA}><{$smarty.const._MA_MYMODULE2_TF_DHTML}><{$smarty.const._MA_MYMODULE2_TF_CHECKBOX}><{$smarty.const._MA_MYMODULE2_TF_YESNO}><{$smarty.const._MA_MYMODULE2_TF_SELECTBOX}><{$smarty.const._MA_MYMODULE2_TF_USER}><{$smarty.const._MA_MYMODULE2_TF_COLOR}><{$smarty.const._MA_MYMODULE2_TF_IMAGELIST}><{$smarty.const._MA_MYMODULE2_TF_URLFILE}><{$smarty.const._MA_MYMODULE2_TF_UPLIMAGE}><{$smarty.const._MA_MYMODULE2_TF_UPLFILE}><{$smarty.const._MA_MYMODULE2_TF_TEXTDATESELECT}><{$smarty.const._MA_MYMODULE2_TF_SELECTFILE}><{$smarty.const._MA_MYMODULE2_TF_STATUS}>
      <{$list.id}><{$list.text}><{$list.textarea}><{$list.dhtml}><{$list.checkbox}><{$list.yesno}><{$list.selectbox}><{$list.user}> testfields<{$list.urlfile}>testfields<{$list.uplfile}><{$list.textdateselect}><{$list.selectfile}><{$list.status}>
      -<{include file="db:mymodule2_footer.tpl"}> \ No newline at end of file diff --git a/testdata/mymodule2/templates/mymodule2_rss.tpl b/testdata/mymodule2/templates/mymodule2_rss.tpl deleted file mode 100644 index 594ebe0e..00000000 --- a/testdata/mymodule2/templates/mymodule2_rss.tpl +++ /dev/null @@ -1,33 +0,0 @@ - - - - <{$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}> - - diff --git a/testdata/mymodule2/templates/mymodule2_single.tpl b/testdata/mymodule2/templates/mymodule2_single.tpl deleted file mode 100644 index 61f6d9c2..00000000 --- a/testdata/mymodule2/templates/mymodule2_single.tpl +++ /dev/null @@ -1,11 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -
      -
      -
      - -
      -
      -
      - -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_submit.tpl b/testdata/mymodule2/templates/mymodule2_submit.tpl deleted file mode 100644 index ed02ef87..00000000 --- a/testdata/mymodule2/templates/mymodule2_submit.tpl +++ /dev/null @@ -1,18 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -
      -
        -
      • <{$smarty.const._MA_MYMODULE2_SUBMIT_SUBMITONCE}>
      • -
      • <{$smarty.const._MA_MYMODULE2_SUBMIT_ALLPENDING}>
      • -
      • <{$smarty.const._MA_MYMODULE2_SUBMIT_DONTABUSE}>
      • -
      • <{$smarty.const._MA_MYMODULE2_SUBMIT_TAKEDAYS}>
      • -
      -
      -<{if $message_error != ''}> -
      <{$message_error}>
      -<{/if}> -
      - <{$form}> -
      - -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_testfields.tpl b/testdata/mymodule2/templates/mymodule2_testfields.tpl deleted file mode 100644 index 27778bd1..00000000 --- a/testdata/mymodule2/templates/mymodule2_testfields.tpl +++ /dev/null @@ -1,30 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -<{if $testfieldsCount > 0}> -
      - - - - - - - - - <{foreach item=testfield from=$testfields}> - - <{if $testfield.count is div by $divideby}> - - <{/if}> - <{/foreach}> - - - -
      <{$smarty.const._MA_MYMODULE2_TESTFIELDS_TITLE}>
      -
      - <{include file='db:mymodule2_testfields_list.tpl' testfield=$testfield}> -
      -
       
      -
      -<{/if}> - -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_testfields_cat.tpl b/testdata/mymodule2/templates/mymodule2_testfields_cat.tpl deleted file mode 100644 index 3c965ebc..00000000 --- a/testdata/mymodule2/templates/mymodule2_testfields_cat.tpl +++ /dev/null @@ -1,20 +0,0 @@ -<{include file='db:mymodule2_header.tpl'}> - -
      -
      -<{$smarty.const._MA_MYMODULE2_TESTFIELDS_TITLE}>
      - -<{foreach item=testfield from=$testfields}> -
      -<{include file='db:mymodule2_testfields_list.tpl' testfield=$testfield}> -<{if $testfield.count is div by $numb_col}> -
      -<{/if}> - -
      - -<{/foreach}> - -
      - -<{include file='db:mymodule2_footer.tpl'}> diff --git a/testdata/mymodule2/templates/mymodule2_testfields_cat_list.tpl b/testdata/mymodule2/templates/mymodule2_testfields_cat_list.tpl deleted file mode 100644 index 5e7d4ca3..00000000 --- a/testdata/mymodule2/templates/mymodule2_testfields_cat_list.tpl +++ /dev/null @@ -1,33 +0,0 @@ -
      -
      - -
      -<{$article.cat}> - -<{$article.title}> - -<{$article.descr}> - -articles - -<{$article.file}> - -<{$article.created}> - -<{$article.submitter}> - -
      - -
      -<{$testfield.text}> - -<{$testfield.textarea}> - -<{$testfield.dhtml}> - -testfields - -<{$testfield.status}> - -
      - diff --git a/testdata/mymodule2/templates/mymodule2_testfields_list.tpl b/testdata/mymodule2/templates/mymodule2_testfields_list.tpl deleted file mode 100644 index 08817fe3..00000000 --- a/testdata/mymodule2/templates/mymodule2_testfields_list.tpl +++ /dev/null @@ -1,11 +0,0 @@ -
      -
      -
      - <{$testfield.text}> - <{$testfield.textarea}> - <{$testfield.dhtml}> - testfields - <{$testfield.status}> -
      -
      -
      diff --git a/testdata/mymodule2/testdata/english/group_permission.yml b/testdata/mymodule2/testdata/english/group_permission.yml deleted file mode 100644 index 641b39ac..00000000 --- a/testdata/mymodule2/testdata/english/group_permission.yml +++ /dev/null @@ -1,195 +0,0 @@ -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles -- - gperm_groupid: '1' - gperm_itemid: '4' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles -- - gperm_groupid: '1' - gperm_itemid: '16' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '1' - gperm_itemid: '8' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '2' - gperm_itemid: '8' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '2' - gperm_itemid: '16' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '3' - gperm_itemid: '16' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '3' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles diff --git a/testdata/mymodule2/testdata/english/index.html b/testdata/mymodule2/testdata/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/testdata/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/testdata/english/mymodule2_articles.yml b/testdata/mymodule2/testdata/english/mymodule2_articles.yml deleted file mode 100644 index 8644170b..00000000 --- a/testdata/mymodule2/testdata/english/mymodule2_articles.yml +++ /dev/null @@ -1,30 +0,0 @@ -- - art_id: '1' - art_cat: '1' - art_title: 'Article 1' - art_descr: 'this is first article, with usage of testcategory 1' - art_img: blank.gif - art_status: '1' - art_file: '' - art_created: '1586959525' - art_submitter: '1' -- - art_id: '2' - art_cat: '2' - art_title: 'Article 2' - art_descr: 'Second article, using testcategory 2' - art_img: blank.gif - art_status: '2' - art_file: '' - art_created: '1586959501' - art_submitter: '1' -- - art_id: '3' - art_cat: '1' - art_title: 'Third Article' - art_descr: 'Third article, using again testcategory 1' - art_img: blank.gif - art_status: '3' - art_file: '' - art_created: '1586959510' - art_submitter: '1' diff --git a/testdata/mymodule2/testdata/english/mymodule2_categories.yml b/testdata/mymodule2/testdata/english/mymodule2_categories.yml deleted file mode 100644 index 815cfc63..00000000 --- a/testdata/mymodule2/testdata/english/mymodule2_categories.yml +++ /dev/null @@ -1,12 +0,0 @@ -- - cat_id: '1' - cat_name: 'Testcategory 1' - cat_logo: '' - cat_created: '1586937232' - cat_submitter: '0' -- - cat_id: '2' - cat_name: 'Testcategory 2' - cat_logo: '' - cat_created: '1586937244' - cat_submitter: '0' diff --git a/testdata/mymodule2/testdata/english/mymodule2_testfields.yml b/testdata/mymodule2/testdata/english/mymodule2_testfields.yml deleted file mode 100644 index 8c327e11..00000000 --- a/testdata/mymodule2/testdata/english/mymodule2_testfields.yml +++ /dev/null @@ -1,34 +0,0 @@ -- - tf_id: '1' - tf_text: 'Item 1 test field' - tf_textarea: 'first item for testing all xoops form field elements' - tf_dhtml: '' - tf_checkbox: '1' - tf_yesno: '1' - tf_selectbox: Empty - tf_user: '1' - tf_color: '#ff8000' - tf_imagelist: album.png - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1586959592' - tf_selectfile: '' - tf_status: '3' -- - tf_id: '2' - tf_text: 'Item 2 test field' - tf_textarea: '' - tf_dhtml: 'second item' - tf_checkbox: '0' - tf_yesno: '0' - tf_selectbox: Empty - tf_user: '1' - tf_color: '#000000' - tf_imagelist: blank.gif - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1586938009' - tf_selectfile: '' - tf_status: '0' diff --git a/testdata/mymodule2/testdata/german/group_permission.yml b/testdata/mymodule2/testdata/german/group_permission.yml deleted file mode 100644 index 641b39ac..00000000 --- a/testdata/mymodule2/testdata/german/group_permission.yml +++ /dev/null @@ -1,195 +0,0 @@ -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles -- - gperm_groupid: '1' - gperm_itemid: '4' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles -- - gperm_groupid: '1' - gperm_itemid: '16' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '1' - gperm_itemid: '8' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '2' - gperm_itemid: '8' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '2' - gperm_itemid: '16' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '3' - gperm_itemid: '16' - gperm_modid: '34' - gperm_name: mymodule2_ac -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_submit_articles -- - gperm_groupid: '3' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '34' - gperm_name: mymodule2_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '34' - gperm_name: mymodule2_approve_articles diff --git a/testdata/mymodule2/testdata/german/index.html b/testdata/mymodule2/testdata/german/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/testdata/german/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/testdata/german/mymodule2_articles.yml b/testdata/mymodule2/testdata/german/mymodule2_articles.yml deleted file mode 100644 index 8644170b..00000000 --- a/testdata/mymodule2/testdata/german/mymodule2_articles.yml +++ /dev/null @@ -1,30 +0,0 @@ -- - art_id: '1' - art_cat: '1' - art_title: 'Article 1' - art_descr: 'this is first article, with usage of testcategory 1' - art_img: blank.gif - art_status: '1' - art_file: '' - art_created: '1586959525' - art_submitter: '1' -- - art_id: '2' - art_cat: '2' - art_title: 'Article 2' - art_descr: 'Second article, using testcategory 2' - art_img: blank.gif - art_status: '2' - art_file: '' - art_created: '1586959501' - art_submitter: '1' -- - art_id: '3' - art_cat: '1' - art_title: 'Third Article' - art_descr: 'Third article, using again testcategory 1' - art_img: blank.gif - art_status: '3' - art_file: '' - art_created: '1586959510' - art_submitter: '1' diff --git a/testdata/mymodule2/testdata/german/mymodule2_categories.yml b/testdata/mymodule2/testdata/german/mymodule2_categories.yml deleted file mode 100644 index 815cfc63..00000000 --- a/testdata/mymodule2/testdata/german/mymodule2_categories.yml +++ /dev/null @@ -1,12 +0,0 @@ -- - cat_id: '1' - cat_name: 'Testcategory 1' - cat_logo: '' - cat_created: '1586937232' - cat_submitter: '0' -- - cat_id: '2' - cat_name: 'Testcategory 2' - cat_logo: '' - cat_created: '1586937244' - cat_submitter: '0' diff --git a/testdata/mymodule2/testdata/german/mymodule2_testfields.yml b/testdata/mymodule2/testdata/german/mymodule2_testfields.yml deleted file mode 100644 index 8c327e11..00000000 --- a/testdata/mymodule2/testdata/german/mymodule2_testfields.yml +++ /dev/null @@ -1,34 +0,0 @@ -- - tf_id: '1' - tf_text: 'Item 1 test field' - tf_textarea: 'first item for testing all xoops form field elements' - tf_dhtml: '' - tf_checkbox: '1' - tf_yesno: '1' - tf_selectbox: Empty - tf_user: '1' - tf_color: '#ff8000' - tf_imagelist: album.png - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1586959592' - tf_selectfile: '' - tf_status: '3' -- - tf_id: '2' - tf_text: 'Item 2 test field' - tf_textarea: '' - tf_dhtml: 'second item' - tf_checkbox: '0' - tf_yesno: '0' - tf_selectbox: Empty - tf_user: '1' - tf_color: '#000000' - tf_imagelist: blank.gif - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1586938009' - tf_selectfile: '' - tf_status: '0' diff --git a/testdata/mymodule2/testdata/images/blank.gif b/testdata/mymodule2/testdata/images/blank.gif deleted file mode 100644 index 3a469695..00000000 Binary files a/testdata/mymodule2/testdata/images/blank.gif and /dev/null differ diff --git a/testdata/mymodule2/testdata/images/blank.png b/testdata/mymodule2/testdata/images/blank.png deleted file mode 100644 index e1ee728a..00000000 Binary files a/testdata/mymodule2/testdata/images/blank.png and /dev/null differ diff --git a/testdata/mymodule2/testdata/images/index.html b/testdata/mymodule2/testdata/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/testdata/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/testdata/index.html b/testdata/mymodule2/testdata/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule2/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule2/testdata/index.php b/testdata/mymodule2/testdata/index.php deleted file mode 100644 index dff0282b..00000000 --- a/testdata/mymodule2/testdata/index.php +++ /dev/null @@ -1,207 +0,0 @@ -loadLanguage('common'); - -switch ($op) { - case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('../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_cp_footer(); - } - break; - case 'save': - saveSampleData(); - break; -} - -// XMF TableLoad for SAMPLE data - -function loadSampleData() -{ - global $xoopsConfig; - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $utility = new Mymodule2\Utility(); - $configurator = new Common\Configurator(); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { - $language = $xoopsConfig['language'] . '/'; - } - - // load module tables - foreach ($tables as $table) { - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - \Xmf\Database\TableLoad::truncateTable($table); - \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); - } - - // load permissions - $table = 'group_permission'; - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - $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 = __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')); -} - -function saveSampleData() -{ - global $xoopsConfig; - - $configurator = new Common\Configurator(); - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; - if (!file_exists($languageFolder . '/')) { - Utility::createFolder($languageFolder . '/'); - } - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; - Utility::createFolder($exportFolder); - - // save module tables - foreach ($tables as $table) { - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); - } - - // save permissions - $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('gperm_modid', \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); - $skipColumns[] = 'gperm_id'; - \Xmf\Database\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 . '_' . 'SAMPLEDATA_SUCCESS')); -} - -function exportSchema() -{ - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - try { - // TODO set exportSchema - // $migrate = new Mymodule2\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')); - } - -} - -/** - * loadTableFromArrayWithReplace - * - * @param string $table value with should be used insead of original value of $search - * - * @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) -{ - /** @var \XoopsDatabase */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - - $prefixedTable = $db->prefix($table); - $count = 0; - - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); - - $result = $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 .= ', '; - } - - $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; - } - } - - return $count; -} diff --git a/testdata/mymodule2/testfields.php b/testdata/mymodule2/testfields.php deleted file mode 100644 index aaad076f..00000000 --- a/testdata/mymodule2/testfields.php +++ /dev/null @@ -1,75 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule2_testfields.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; - -$start = Request::getInt('start', 0); -$limit = Request::getInt('limit', $helper->getConfig('userpager')); - -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); - -$testfieldsCount = $testfieldsHandler->getCountTestfields(); -$GLOBALS['xoopsTpl']->assign('testfieldsCount', $testfieldsCount); -$testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); -$keywords = []; -if ($testfieldsCount > 0) { - $testfields = []; - // Get All Testfields - foreach(array_keys($testfieldsAll) as $i) { - $testfields[] = $testfieldsAll[$i]->getValuesTestfields(); - $keywords[] = $testfieldsAll[$i]->getVar('tf_text'); - } - $GLOBALS['xoopsTpl']->assign('testfields', $testfields); - unset($testfields); - // Display Navigation - if ($testfieldsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} - -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_TESTFIELDS]; - -// Keywords -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); - -// Description -mymodule2MetaDescription(_MA_MYMODULE2_TESTFIELDS_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/testfields.php'); -$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule2/view.tag.php b/testdata/mymodule2/view.tag.php deleted file mode 100644 index c5e7059f..00000000 --- a/testdata/mymodule2/view.tag.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -include XOOPS_ROOT_PATH . '/modules/tag/view.tag.php'; diff --git a/testdata/mymodule2/visit.php b/testdata/mymodule2/visit.php deleted file mode 100644 index 0af9fae6..00000000 --- a/testdata/mymodule2/visit.php +++ /dev/null @@ -1,28 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule2; -use XoopsModules\Mymodule2\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id', 0); diff --git a/testdata/mymodule2/xoops_version.php b/testdata/mymodule2/xoops_version.php deleted file mode 100644 index 9ca3e850..00000000 --- a/testdata/mymodule2/xoops_version.php +++ /dev/null @@ -1,659 +0,0 @@ - - Website: - */ - -// -$moduleDirName = basename(__DIR__); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -// ------------------- Informations ------------------- // -$modversion = [ - 'name' => _MI_MYMODULE2_NAME, - 'version' => 1.0, - 'description' => _MI_MYMODULE2_DESC, - 'author' => 'TDM XOOPS', - 'author_mail' => 'info@email.com', - 'author_website_url' => 'http://xoops.org', - 'author_website_name' => 'XOOPS Project', - 'credits' => 'XOOPS Development Team', - 'license' => 'GPL 2.0 or later', - 'license_url' => 'http://www.gnu.org/licenses/gpl-3.0.en.html', - 'help' => 'page=help', - 'release_info' => 'release_info', - 'release_file' => XOOPS_URL . '/modules/mymodule2/docs/release_info file', - 'release_date' => '2020/04/16', - 'manual' => 'link to manual file', - 'manual_file' => XOOPS_URL . '/modules/mymodule2/docs/install.txt', - 'min_php' => '7.0', - 'min_xoops' => '2.5.9', - 'min_admin' => '1.2', - 'min_db' => array('mysql' => '5.6', 'mysqli' => '5.6'), - 'image' => 'assets/images/logoModule.png', - 'dirname' => basename(__DIR__), - 'dirmoduleadmin' => 'Frameworks/moduleclasses/moduleadmin', - 'sysicons16' => '../../Frameworks/moduleclasses/icons/16', - 'sysicons32' => '../../Frameworks/moduleclasses/icons/32', - 'modicons16' => 'assets/icons/16', - 'modicons32' => 'assets/icons/32', - 'demo_site_url' => 'https://xoops.org', - 'demo_site_name' => 'XOOPS Demo Site', - 'support_url' => 'https://xoops.org/modules/newbb', - 'support_name' => 'Support Forum', - 'module_website_url' => 'www.xoops.org', - 'module_website_name' => 'XOOPS Project', - 'release' => '2017-12-02', - 'module_status' => 'Beta 1', - 'system_menu' => 1, - 'hasAdmin' => 1, - 'hasMain' => 1, - 'adminindex' => 'admin/index.php', - 'adminmenu' => 'admin/menu.php', - 'onInstall' => 'include/install.php', - 'onUninstall' => 'include/uninstall.php', - 'onUpdate' => 'include/update.php', -]; -// ------------------- Templates ------------------- // -$modversion['templates'] = [ - // Admin templates - ['file' => 'mymodule2_admin_about.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_header.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_index.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_categories.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_articles.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_testfields.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_permissions.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule2_admin_footer.tpl', 'description' => '', 'type' => 'admin'], - // User templates - ['file' => 'mymodule2_header.tpl', 'description' => ''], - ['file' => 'mymodule2_index.tpl', 'description' => ''], - ['file' => 'mymodule2_categories.tpl', 'description' => ''], - ['file' => 'mymodule2_categories_list.tpl', 'description' => ''], - ['file' => 'mymodule2_articles.tpl', 'description' => ''], - ['file' => 'mymodule2_articles_list.tpl', 'description' => ''], - ['file' => 'mymodule2_testfields.tpl', 'description' => ''], - ['file' => 'mymodule2_testfields_list.tpl', 'description' => ''], - ['file' => 'mymodule2_breadcrumbs.tpl', 'description' => ''], - ['file' => 'mymodule2_broken.tpl', 'description' => ''], - ['file' => 'mymodule2_pdf.tpl', 'description' => ''], - ['file' => 'mymodule2_print.tpl', 'description' => ''], - ['file' => 'mymodule2_rate.tpl', 'description' => ''], - ['file' => 'mymodule2_rss.tpl', 'description' => ''], - ['file' => 'mymodule2_search.tpl', 'description' => ''], - ['file' => 'mymodule2_single.tpl', 'description' => ''], - ['file' => 'mymodule2_submit.tpl', 'description' => ''], - ['file' => 'mymodule2_footer.tpl', 'description' => ''], -]; -// ------------------- Mysql ------------------- // -$modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; -// Tables -$modversion['tables'] = [ - 'mymodule2_categories', - 'mymodule2_articles', - 'mymodule2_testfields', -]; -// ------------------- Search ------------------- // -$modversion['hasSearch'] = 1; -$modversion['search'] = [ - 'file' => 'include/search.inc.php', - 'func' => 'mymodule2_search', -]; -// ------------------- Comments ------------------- // -$modversion['comments']['pageName'] = 'comments.php'; -$modversion['comments']['itemName'] = 'com_id'; -// Comment callback functions -$modversion['comments']['callbackFile'] = 'include/comment_functions.php'; -$modversion['comments']['callback'] = [ - 'approve' => 'mymodule2CommentsApprove', - 'update' => 'mymodule2CommentsUpdate', -]; -// ------------------- Menu ------------------- // -$currdirname = isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system'; -if ($moduleDirName == $currdirname) { - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE2_SMNAME1, - 'url' => 'index.php', - ]; - // Sub articles - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE2_SMNAME2, - 'url' => 'articles.php', - ]; - // Sub testfields - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE2_SMNAME3, - 'url' => 'testfields.php', - ]; - // Sub Submit - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE2_SMNAME4, - 'url' => 'submit.php', - ]; - // Sub Search - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE2_SMNAME5, - 'url' => 'search.php', - ]; -} -// ------------------- Blocks ------------------- // -// Articles last -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE2_ARTICLES_BLOCK_LAST, - 'description' => _MI_MYMODULE2_ARTICLES_BLOCK_LAST_DESC, - 'show_func' => 'b_mymodule2_articles_show', - 'edit_func' => 'b_mymodule2_articles_edit', - 'template' => 'mymodule2_block_articles.tpl', - 'options' => 'last|5|25|0', -]; -// Articles new -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE2_ARTICLES_BLOCK_NEW, - 'description' => _MI_MYMODULE2_ARTICLES_BLOCK_NEW_DESC, - 'show_func' => 'b_mymodule2_articles_show', - 'edit_func' => 'b_mymodule2_articles_edit', - 'template' => 'mymodule2_block_articles.tpl', - 'options' => 'new|5|25|0', -]; -// Articles hits -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE2_ARTICLES_BLOCK_HITS, - 'description' => _MI_MYMODULE2_ARTICLES_BLOCK_HITS_DESC, - 'show_func' => 'b_mymodule2_articles_show', - 'edit_func' => 'b_mymodule2_articles_edit', - 'template' => 'mymodule2_block_articles.tpl', - 'options' => 'hits|5|25|0', -]; -// Articles top -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE2_ARTICLES_BLOCK_TOP, - 'description' => _MI_MYMODULE2_ARTICLES_BLOCK_TOP_DESC, - 'show_func' => 'b_mymodule2_articles_show', - 'edit_func' => 'b_mymodule2_articles_edit', - 'template' => 'mymodule2_block_articles.tpl', - 'options' => 'top|5|25|0', -]; -// Articles random -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE2_ARTICLES_BLOCK_RANDOM, - 'description' => _MI_MYMODULE2_ARTICLES_BLOCK_RANDOM_DESC, - 'show_func' => 'b_mymodule2_articles_show', - 'edit_func' => 'b_mymodule2_articles_edit', - 'template' => 'mymodule2_block_articles.tpl', - 'options' => 'random|5|25|0', -]; -// Testfields last -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE2_TESTFIELDS_BLOCK_LAST, - 'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_LAST_DESC, - 'show_func' => 'b_mymodule2_testfields_show', - 'edit_func' => 'b_mymodule2_testfields_edit', - 'template' => 'mymodule2_block_testfields.tpl', - 'options' => 'last|5|25|0', -]; -// Testfields new -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE2_TESTFIELDS_BLOCK_NEW, - 'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_NEW_DESC, - 'show_func' => 'b_mymodule2_testfields_show', - 'edit_func' => 'b_mymodule2_testfields_edit', - 'template' => 'mymodule2_block_testfields.tpl', - 'options' => 'new|5|25|0', -]; -// Testfields hits -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE2_TESTFIELDS_BLOCK_HITS, - 'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_HITS_DESC, - 'show_func' => 'b_mymodule2_testfields_show', - 'edit_func' => 'b_mymodule2_testfields_edit', - 'template' => 'mymodule2_block_testfields.tpl', - 'options' => 'hits|5|25|0', -]; -// Testfields top -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE2_TESTFIELDS_BLOCK_TOP, - 'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_TOP_DESC, - 'show_func' => 'b_mymodule2_testfields_show', - 'edit_func' => 'b_mymodule2_testfields_edit', - 'template' => 'mymodule2_block_testfields.tpl', - 'options' => 'top|5|25|0', -]; -// Testfields random -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM, - 'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM_DESC, - 'show_func' => 'b_mymodule2_testfields_show', - 'edit_func' => 'b_mymodule2_testfields_edit', - 'template' => 'mymodule2_block_testfields.tpl', - 'options' => 'random|5|25|0', -]; -// ------------------- Config ------------------- // -// Editor descr -xoops_load('xoopseditorhandler'); -$editorHandlerDescr = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_descr', - 'title' => '_MI_MYMODULE2_EDITOR_DESCR', - 'description' => '_MI_MYMODULE2_EDITOR_DESCR_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerDescr->getList()), -]; -// Editor textarea -xoops_load('xoopseditorhandler'); -$editorHandlerTextarea = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_textarea', - 'title' => '_MI_MYMODULE2_EDITOR_TEXTAREA', - 'description' => '_MI_MYMODULE2_EDITOR_TEXTAREA_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerTextarea->getList()), -]; -// Editor dhtml -xoops_load('xoopseditorhandler'); -$editorHandlerDhtml = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_dhtml', - 'title' => '_MI_MYMODULE2_EDITOR_DHTML', - 'description' => '_MI_MYMODULE2_EDITOR_DHTML_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerDhtml->getList()), -]; -// Get groups -$memberHandler = xoops_getHandler('member'); -$xoopsGroups = $memberHandler->getGroupList(); -foreach($xoopsGroups as $key => $group) { - $groups[$group] = $key; -} -// General access groups -$modversion['config'][] = [ - 'name' => 'groups', - 'title' => '_MI_MYMODULE2_GROUPS', - 'description' => '_MI_MYMODULE2_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $groups, - 'options' => $groups, -]; -// Upload groups -$modversion['config'][] = [ - 'name' => 'upload_groups', - 'title' => '_MI_MYMODULE2_UPLOAD_GROUPS', - 'description' => '_MI_MYMODULE2_UPLOAD_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $groups, - 'options' => $groups, -]; -// Get Admin groups -$criteria = new \CriteriaCompo(); -$criteria->add( new \Criteria( 'group_type', 'Admin' ) ); -$memberHandler = xoops_getHandler('member'); -$adminXoopsGroups = $memberHandler->getGroupList($criteria); -foreach($adminXoopsGroups as $key => $adminGroup) { - $adminGroups[$adminGroup] = $key; -} -$modversion['config'][] = [ - 'name' => 'admin_groups', - 'title' => '_MI_MYMODULE2_ADMIN_GROUPS', - 'description' => '_MI_MYMODULE2_ADMIN_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $adminGroups, - 'options' => $adminGroups, -]; -// Keywords -$modversion['config'][] = [ - 'name' => 'keywords', - 'title' => '_MI_MYMODULE2_KEYWORDS', - 'description' => '_MI_MYMODULE2_KEYWORDS_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'text', - 'default' => 'mymodule2, categories, articles, testfields', -]; -// create increment steps for file size -include_once __DIR__ . '/include/xoops_version.inc.php'; -$iniPostMaxSize = mymodule2ReturnBytes(ini_get('post_max_size')); -$iniUploadMaxFileSize = mymodule2ReturnBytes(ini_get('upload_max_filesize')); -$maxSize = min($iniPostMaxSize, $iniUploadMaxFileSize); -if ($maxSize > 10000 * 1048576) { - $increment = 500; -} -if ($maxSize <= 10000 * 1048576) { - $increment = 200; -} -if ($maxSize <= 5000 * 1048576) { - $increment = 100; -} -if ($maxSize <= 2500 * 1048576) { - $increment = 50; -} -if ($maxSize <= 1000 * 1048576) { - $increment = 10; -} -if ($maxSize <= 500 * 1048576) { - $increment = 5; -} -if ($maxSize <= 100 * 1048576) { - $increment = 2; -} -if ($maxSize <= 50 * 1048576) { - $increment = 1; -} -if ($maxSize <= 25 * 1048576) { - $increment = 0.5; -} -$optionMaxsize = []; -$i = $increment; -while ($i * 1048576 <= $maxSize) { - $optionMaxsize[$i . ' ' . _MI_MYMODULE2_SIZE_MB] = $i * 1048576; - $i += $increment; -} -// Uploads : maxsize of image -$modversion['config'][] = [ - 'name' => 'maxsize_image', - 'title' => '_MI_MYMODULE2_MAXSIZE_IMAGE', - 'description' => '_MI_MYMODULE2_MAXSIZE_IMAGE_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 3145728, - 'options' => $optionMaxsize, -]; -// Uploads : mimetypes of image -$modversion['config'][] = [ - 'name' => 'mimetypes_image', - 'title' => '_MI_MYMODULE2_MIMETYPES_IMAGE', - 'description' => '_MI_MYMODULE2_MIMETYPES_IMAGE_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - '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'], -]; -$modversion['config'][] = [ - 'name' => 'maxwidth_image', - 'title' => '_MI_MYMODULE2_MAXWIDTH_IMAGE', - 'description' => '_MI_MYMODULE2_MAXWIDTH_IMAGE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 8000, -]; -$modversion['config'][] = [ - 'name' => 'maxheight_image', - 'title' => '_MI_MYMODULE2_MAXHEIGHT_IMAGE', - 'description' => '_MI_MYMODULE2_MAXHEIGHT_IMAGE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 8000, -]; -// Uploads : maxsize of file -$modversion['config'][] = [ - 'name' => 'maxsize_file', - 'title' => '_MI_MYMODULE2_MAXSIZE_FILE', - 'description' => '_MI_MYMODULE2_MAXSIZE_FILE_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 3145728, - 'options' => $optionMaxsize, -]; -// Uploads : mimetypes of file -$modversion['config'][] = [ - 'name' => 'mimetypes_file', - 'title' => '_MI_MYMODULE2_MIMETYPES_FILE', - 'description' => '_MI_MYMODULE2_MIMETYPES_FILE_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - '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'], -]; -// Admin pager -$modversion['config'][] = [ - 'name' => 'adminpager', - 'title' => '_MI_MYMODULE2_ADMIN_PAGER', - 'description' => '_MI_MYMODULE2_ADMIN_PAGER_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 10, -]; -// User pager -$modversion['config'][] = [ - 'name' => 'userpager', - 'title' => '_MI_MYMODULE2_USER_PAGER', - 'description' => '_MI_MYMODULE2_USER_PAGER_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 10, -]; -// Use tag -$modversion['config'][] = [ - 'name' => 'usetag', - 'title' => '_MI_MYMODULE2_USE_TAG', - 'description' => '_MI_MYMODULE2_USE_TAG_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, -]; -// Number column -$modversion['config'][] = [ - 'name' => 'numb_col', - 'title' => '_MI_MYMODULE2_NUMB_COL', - 'description' => '_MI_MYMODULE2_NUMB_COL_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => [1 => '1', 2 => '2', 3 => '3', 4 => '4'], -]; -// Divide by -$modversion['config'][] = [ - 'name' => 'divideby', - 'title' => '_MI_MYMODULE2_DIVIDEBY', - 'description' => '_MI_MYMODULE2_DIVIDEBY_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => [1 => '1', 2 => '2', 3 => '3', 4 => '4'], -]; -// Table type -$modversion['config'][] = [ - 'name' => 'table_type', - 'title' => '_MI_MYMODULE2_TABLE_TYPE', - 'description' => '_MI_MYMODULE2_DIVIDEBY_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 'bordered', - 'options' => ['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed'], -]; -// Panel by -$modversion['config'][] = [ - 'name' => 'panel_type', - 'title' => '_MI_MYMODULE2_PANEL_TYPE', - 'description' => '_MI_MYMODULE2_PANEL_TYPE_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'default', - 'options' => ['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger'], -]; -// Advertise -$modversion['config'][] = [ - 'name' => 'advertise', - 'title' => '_MI_MYMODULE2_ADVERTISE', - 'description' => '_MI_MYMODULE2_ADVERTISE_DESC', - 'formtype' => 'textarea', - 'valuetype' => 'text', - 'default' => '', -]; -// Bookmarks -$modversion['config'][] = [ - 'name' => 'bookmarks', - 'title' => '_MI_MYMODULE2_BOOKMARKS', - 'description' => '_MI_MYMODULE2_BOOKMARKS_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, -]; -// Make Sample button visible? -$modversion['config'][] = [ - 'name' => 'displaySampleButton', - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 1, -]; -// Maintained by -$modversion['config'][] = [ - 'name' => 'maintainedby', - 'title' => '_MI_MYMODULE2_MAINTAINEDBY', - 'description' => '_MI_MYMODULE2_MAINTAINEDBY_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'text', - 'default' => 'https://xoops.org/modules/newbb', -]; -// ------------------- Notifications ------------------- // -$modversion['hasNotification'] = 1; -$modversion['notification'] = [ - 'lookup_file' => 'include/notification.inc.php', - 'lookup_func' => 'mymodule2_notify_iteminfo', -]; -// Global Notify -$modversion['notification']['category'][1] = [ - 'name' => 'global', - 'title' => _MI_MYMODULE2_GLOBAL_NOTIFY, - 'description' => _MI_MYMODULE2_GLOBAL_NOTIFY_DESC, - 'subscribe_from' => ['index.php', 'articles.php', 'testfields.php'], -]; -// Category Notify -$modversion['notification']['category'][2] = [ - 'name' => 'category', - 'title' => _MI_MYMODULE2_CATEGORY_NOTIFY, - 'description' => _MI_MYMODULE2_CATEGORY_NOTIFY_DESC, - 'subscribe_from' => ['articles.php', 'testfields.php'], - 'item_name' => '', - 'allow_bookmark' => 1, -]; -// Testfield Notify -$modversion['notification']['category'][3] = [ - 'name' => 'testfield', - 'title' => _MI_MYMODULE2_TESTFIELD_NOTIFY, - 'description' => _MI_MYMODULE2_TESTFIELD_NOTIFY_DESC, - 'subscribe_from' => 'testfields.php', - 'item_name' => 'tf_id', - 'allow_bookmark' => 1, -]; -// GLOBAL_NEW_CATEGORY Notify -$modversion['notification']['event'][1] = [ - 'name' => 'new_category', - 'category' => 'global', - 'admin_only' => 0, - 'title' => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY, - 'caption' => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_DESC, - 'mail_template' => 'global_newcategory_notify', - 'mail_subject' => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT, -]; -// GLOBAL_MODIFY Notify -$modversion['notification']['event'][2] = [ - 'name' => 'modify', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY, - 'caption' => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_DESC, - 'mail_template' => 'global_modify_notify', - 'mail_subject' => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_SUBJECT, -]; -// GLOBAL_BROKEN Notify -$modversion['notification']['event'][3] = [ - 'name' => 'broken', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY, - 'caption' => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_DESC, - 'mail_template' => 'global_broken_notify', - 'mail_subject' => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_SUBJECT, -]; -// GLOBAL_SUBMIT Notify -$modversion['notification']['event'][4] = [ - 'name' => 'submit', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY, - 'caption' => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_DESC, - 'mail_template' => 'global_submit_notify', - 'mail_subject' => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_SUBJECT, -]; -// GLOBAL_NEW Notify -$modversion['notification']['event'][5] = [ - 'name' => 'new_testfield', - 'category' => 'global', - 'admin_only' => 0, - 'title' => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY, - 'caption' => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_DESC, - 'mail_template' => 'global_newtestfield_notify', - 'mail_subject' => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_SUBJECT, -]; -// CATEGORY_SUBMIT Notify -$modversion['notification']['event'][6] = [ - 'name' => 'submit', - 'category' => 'category', - 'admin_only' => 1, - 'title' => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY, - 'caption' => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_DESC, - 'mail_template' => 'category_testfieldsubmit_notify', - 'mail_subject' => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_SUBJECT, -]; -// CATEGORY Notify -$modversion['notification']['event'][7] = [ - 'name' => 'new_category', - 'category' => 'category', - 'admin_only' => 0, - 'title' => _MI_MYMODULE2_CATEGORY_NOTIFY, - 'caption' => _MI_MYMODULE2_CATEGORY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_CATEGORY_NOTIFY_DESC, - 'mail_template' => 'category_newtestfield_notify', - 'mail_subject' => _MI_MYMODULE2_CATEGORY_NOTIFY_SUBJECT, -]; -// TESTFIELD Notify -$modversion['notification']['event'][8] = [ - 'name' => 'approve', - 'category' => 'testfield', - 'admin_only' => 1, - 'title' => _MI_MYMODULE2_TESTFIELD_NOTIFY, - 'caption' => _MI_MYMODULE2_TESTFIELD_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE2_TESTFIELD_NOTIFY_DESC, - 'mail_template' => 'testfield_approve_notify', - 'mail_subject' => _MI_MYMODULE2_TESTFIELD_NOTIFY_SUBJECT, -]; diff --git a/testdata/mymodule3/admin/about.php b/testdata/mymodule3/admin/about.php deleted file mode 100644 index abc4acbd..00000000 --- a/testdata/mymodule3/admin/about.php +++ /dev/null @@ -1,27 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -$templateMain = 'mymodule3_admin_about.tpl'; -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('about.php')); -$adminObject->setPaypal('6KJ7RW5DR3VTJ'); -$GLOBALS['xoopsTpl']->assign('about', $adminObject->renderAbout(false)); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/admin/articles.php b/testdata/mymodule3/admin/articles.php deleted file mode 100644 index d0633e4b..00000000 --- a/testdata/mymodule3/admin/articles.php +++ /dev/null @@ -1,219 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request art_id -$artId = Request::getInt('art_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule3_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ADD_ARTICLE, 'articles.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $articlesCount = $articlesHandler->getCountArticles(); - $articlesAll = $articlesHandler->getAllArticles($start, $limit); - $GLOBALS['xoopsTpl']->assign('articles_count', $articlesCount); - $GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - // Table view articles - if ($articlesCount > 0) { - foreach(array_keys($articlesAll) as $i) { - $article = $articlesAll[$i]->getValuesArticles(); - $GLOBALS['xoopsTpl']->append('articles_list', $article); - unset($article); - } - // Display Navigation - if ($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE3_THEREARENT_ARTICLES); - } - break; - case 'new': - $templateMain = 'mymodule3_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ARTICLES_LIST, 'articles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $articlesObj = $articlesHandler->create(); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($artId)) { - $articlesObj = $articlesHandler->get($artId); - } else { - $articlesObj = $articlesHandler->create(); - } - // Set Vars - $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0)); - $articlesObj->setVar('art_title', Request::getString('art_title', '')); - $articlesObj->setVar('art_descr', Request::getString('art_descr', '')); - // Set Var art_img - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['art_img']['name']; - $imgMimetype = $_FILES['art_img']['type']; - $imgNameDef = Request::getString('art_title'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_IMAGE_PATH . '/articles/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule3\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename; - $imgHandler->endFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $articlesObj->setVar('art_img', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $articlesObj->setVar('art_img', Request::getString('art_img')); - } - $articlesObj->setVar('art_online', Request::getInt('art_online', 0)); - // Set Var art_file - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['art_file']['name']; - $imgNameDef = Request::getString('art_title'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/articles/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $articlesObj->setVar('art_file', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $articlesObj->setVar('art_file', Request::getString('art_file')); - } - $articleCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('art_created')); - $articlesObj->setVar('art_created', $articleCreated->getTimestamp()); - $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0)); - // Insert Data - if ($articlesHandler->insert($articlesObj)) { - $newArtId = $articlesObj->getNewInsertedIdArticles(); - $permId = isset($_REQUEST['art_id']) ? $artId : $newArtId; - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $GLOBALS['xoopsModule']->getVar('mid'); - // Permission to view_articles - $grouppermHandler->deleteByModule($mid, 'mymodule3_view_articles', $permId); - if (isset($_POST['groups_view_articles'])) { - foreach($_POST['groups_view_articles'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_view_articles', $permId, $onegroupId, $mid); - } - } - // Permission to submit_articles - $grouppermHandler->deleteByModule($mid, 'mymodule3_submit_articles', $permId); - if (isset($_POST['groups_submit_articles'])) { - foreach($_POST['groups_submit_articles'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_submit_articles', $permId, $onegroupId, $mid); - } - } - // Permission to approve_articles - $grouppermHandler->deleteByModule($mid, 'mymodule3_approve_articles', $permId); - if (isset($_POST['groups_approve_articles'])) { - foreach($_POST['groups_approve_articles'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_approve_articles', $permId, $onegroupId, $mid); - } - } - if ('' !== $uploaderErrors) { - redirect_header('articles.php?op=edit&art_id=' . $artId, 5, $uploaderErrors); - } else { - redirect_header('articles.php?op=list', 2, _AM_MYMODULE3_FORM_OK); - } - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'edit': - $templateMain = 'mymodule3_admin_articles.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ADD_ARTICLE, 'articles.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE3_ARTICLES_LIST, 'articles.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $articlesObj = $articlesHandler->get($artId); - $form = $articlesObj->getFormArticles(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'delete': - $articlesObj = $articlesHandler->get($artId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('articles.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($articlesHandler->delete($articlesObj)) { - redirect_header('articles.php', 3, _AM_MYMODULE3_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'art_id' => $artId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE3_FORM_SURE_DELETE, $articlesObj->getVar('art_title'))); - } - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/admin/categories.php b/testdata/mymodule3/admin/categories.php deleted file mode 100644 index 069a6c6d..00000000 --- a/testdata/mymodule3/admin/categories.php +++ /dev/null @@ -1,168 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request cat_id -$catId = Request::getInt('cat_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule3_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ADD_CATEGORY, 'categories.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $categoriesCount = $categoriesHandler->getCountCategories(); - $categoriesAll = $categoriesHandler->getAllCategories($start, $limit); - $GLOBALS['xoopsTpl']->assign('categories_count', $categoriesCount); - $GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - // Table view categories - if ($categoriesCount > 0) { - foreach(array_keys($categoriesAll) as $i) { - $category = $categoriesAll[$i]->getValuesCategories(); - $GLOBALS['xoopsTpl']->append('categories_list', $category); - unset($category); - } - // Display Navigation - if ($categoriesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE3_THEREARENT_CATEGORIES); - } - break; - case 'new': - $templateMain = 'mymodule3_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE3_CATEGORIES_LIST, 'categories.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $categoriesObj = $categoriesHandler->create(); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('categories.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($catId)) { - $categoriesObj = $categoriesHandler->get($catId); - } else { - $categoriesObj = $categoriesHandler->create(); - } - // Set Vars - $categoriesObj->setVar('cat_name', Request::getString('cat_name', '')); - // Set Var cat_logo - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['cat_logo']['name']; - $imgMimetype = $_FILES['cat_logo']['type']; - $imgNameDef = Request::getString('cat_name'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_IMAGE_PATH . '/categories/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule3\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename; - $imgHandler->endFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $categoriesObj->setVar('cat_logo', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $categoriesObj->setVar('cat_logo', Request::getString('cat_logo')); - } - $categoryCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('cat_created')); - $categoriesObj->setVar('cat_created', $categoryCreated->getTimestamp()); - $categoriesObj->setVar('cat_submitter', Request::getInt('cat_submitter', 0)); - // Insert Data - if ($categoriesHandler->insert($categoriesObj)) { - if ('' !== $uploaderErrors) { - redirect_header('categories.php?op=edit&cat_id=' . $catId, 5, $uploaderErrors); - } else { - redirect_header('categories.php?op=list', 2, _AM_MYMODULE3_FORM_OK); - } - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors()); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'edit': - $templateMain = 'mymodule3_admin_categories.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ADD_CATEGORY, 'categories.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE3_CATEGORIES_LIST, 'categories.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $categoriesObj = $categoriesHandler->get($catId); - $form = $categoriesObj->getFormCategories(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'delete': - $categoriesObj = $categoriesHandler->get($catId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('categories.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($categoriesHandler->delete($categoriesObj)) { - redirect_header('categories.php', 3, _AM_MYMODULE3_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'cat_id' => $catId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE3_FORM_SURE_DELETE, $categoriesObj->getVar('cat_name'))); - } - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/admin/footer.php b/testdata/mymodule3/admin/footer.php deleted file mode 100644 index 54afd351..00000000 --- a/testdata/mymodule3/admin/footer.php +++ /dev/null @@ -1,27 +0,0 @@ - - Website: - */ -if (isset($templateMain)) { - $GLOBALS['xoopsTpl']->assign('maintainedby', $helper->getConfig('maintainedby')); - $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); -} - -xoops_cp_footer(); diff --git a/testdata/mymodule3/admin/header.php b/testdata/mymodule3/admin/header.php deleted file mode 100644 index 3b64c8bf..00000000 --- a/testdata/mymodule3/admin/header.php +++ /dev/null @@ -1,63 +0,0 @@ - - Website: - */ -include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; -include_once dirname(__DIR__) . '/include/common.php'; - -$sysPathIcon16 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons16'); -$sysPathIcon32 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -$modPathIcon16 = MYMODULE3_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons16') . '/'; -$modPathIcon32 = MYMODULE3_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons32') . '/'; - -// Get instance of module -$helper = \XoopsModules\Mymodule3\Helper::getInstance(); -$categoriesHandler = $helper->getHandler('categories'); -$articlesHandler = $helper->getHandler('articles'); -$testfieldsHandler = $helper->getHandler('testfields'); -$myts = MyTextSanitizer::getInstance(); -// -if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once XOOPS_ROOT_PATH . '/class/template.php'; - $xoopsTpl = new \XoopsTpl(); -} - -// Load languages -xoops_loadLanguage('admin'); -xoops_loadLanguage('modinfo'); - -// Local admin menu class -if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) { - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); -} else { - redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); -} - -xoops_cp_header(); - -// System icons path -$GLOBALS['xoopsTpl']->assign('sysPathIcon16', $sysPathIcon16); -$GLOBALS['xoopsTpl']->assign('sysPathIcon32', $sysPathIcon32); -$GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); -$GLOBALS['xoopsTpl']->assign('modPathIcon32', $modPathIcon32); - -$adminObject = \Xmf\Module\Admin::getInstance(); -$style = MYMODULE3_URL . '/assets/css/admin/style.css'; diff --git a/testdata/mymodule3/admin/index.html b/testdata/mymodule3/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/admin/index.php b/testdata/mymodule3/admin/index.php deleted file mode 100644 index 1f77f28b..00000000 --- a/testdata/mymodule3/admin/index.php +++ /dev/null @@ -1,70 +0,0 @@ - - Website: - */ - - -use XoopsModules\Mymodule3\Common; - -include_once dirname(__DIR__) . '/preloads/autoloader.php'; -require __DIR__ . '/header.php'; - -// Template Index -$templateMain = 'mymodule3_admin_index.tpl'; - -// Count elements -$countCategories = $categoriesHandler->getCount(); -$countArticles = $articlesHandler->getCount(); -$countTestfields = $testfieldsHandler->getCount(); - -// InfoBox Statistics -$adminObject->addInfoBox(_AM_MYMODULE3_STATISTICS); -// Info elements -$adminObject->addInfoBoxLine(sprintf( '', $countCategories)); -$adminObject->addInfoBoxLine(sprintf( '', $countArticles)); -$adminObject->addInfoBoxLine(sprintf( '', $countTestfields)); - -// Upload Folders -$configurator = new Common\Configurator(); -if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - foreach(array_keys($configurator->uploadFolders) as $i) { - $folder[] = $configurator->uploadFolders[$i]; - } -} -// Uploads Folders Created -foreach(array_keys($folder) as $i) { - $adminObject->addConfigBoxLine($folder[$i], 'folder'); - $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); -} - -// Render Index -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('index.php')); -// Test Data -if ($helper->getConfig('displaySampleButton')) { - xoops_loadLanguage('admin/modulesadmin', 'system'); - include_once dirname(__DIR__) . '/testdata/index.php'; - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_ADD_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->displayButton('left'); -} -$GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex()); -// End Test Data -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/admin/menu.php b/testdata/mymodule3/admin/menu.php deleted file mode 100644 index 8fa3dac1..00000000 --- a/testdata/mymodule3/admin/menu.php +++ /dev/null @@ -1,63 +0,0 @@ - - Website: - */ - -$dirname = basename(dirname(__DIR__)); -$moduleHandler = xoops_getHandler('module'); -$xoopsModule = XoopsModule::getByDirname($dirname); -$moduleInfo = $moduleHandler->get($xoopsModule->getVar('mid')); -$sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); - -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ADMENU1, - 'link' => 'admin/index.php', - 'icon' => $sysPathIcon32.'/dashboard.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ADMENU2, - 'link' => 'admin/categories.php', - 'icon' => 'assets/icons/32/category.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ADMENU3, - 'link' => 'admin/articles.php', - 'icon' => 'assets/icons/32/penguin.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ADMENU4, - 'link' => 'admin/testfields.php', - 'icon' => 'assets/icons/32/alert.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ADMENU5, - 'link' => 'admin/permissions.php', - 'icon' => $sysPathIcon32.'/permissions.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ADMENU6, - 'link' => 'admin/feedback.php', - 'icon' => $sysPathIcon32.'/mail_foward.png', -]; -$adminmenu[] = [ - 'title' => _MI_MYMODULE3_ABOUT, - 'link' => 'admin/about.php', - 'icon' => $sysPathIcon32.'/about.png', -]; diff --git a/testdata/mymodule3/admin/permissions.php b/testdata/mymodule3/admin/permissions.php deleted file mode 100644 index 4abdeb40..00000000 --- a/testdata/mymodule3/admin/permissions.php +++ /dev/null @@ -1,132 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; - -// Template Index -$templateMain = 'mymodule3_admin_permissions.tpl'; -$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('permissions.php')); - -$op = Request::getString('op', 'global'); - -// Get Form -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -xoops_load('XoopsFormLoader'); -$permTableForm = new \XoopsSimpleForm('', 'fselperm', 'permissions.php', 'post'); -$formSelect = new \XoopsFormSelect('', 'op', $op); -$formSelect->setExtra('onchange="document.fselperm.submit()"'); -$formSelect->addOption('global', _AM_MYMODULE3_PERMISSIONS_GLOBAL); -$formSelect->addOption('approve_articles', _AM_MYMODULE3_PERMISSIONS_APPROVE . ' Articles'); -$formSelect->addOption('submit_articles', _AM_MYMODULE3_PERMISSIONS_SUBMIT . ' Articles'); -$formSelect->addOption('view_articles', _AM_MYMODULE3_PERMISSIONS_VIEW . ' Articles'); -$formSelect->addOption('approve_testfields', _AM_MYMODULE3_PERMISSIONS_APPROVE . ' Testfields'); -$formSelect->addOption('submit_testfields', _AM_MYMODULE3_PERMISSIONS_SUBMIT . ' Testfields'); -$formSelect->addOption('view_testfields', _AM_MYMODULE3_PERMISSIONS_VIEW . ' Testfields'); -$permTableForm->addElement($formSelect); -$permTableForm->display(); -switch($op) { - case 'global': - default: - $formTitle = _AM_MYMODULE3_PERMISSIONS_GLOBAL; - $permName = 'mymodule3_ac'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_GLOBAL_DESC; - $globalPerms = array( '4' => _AM_MYMODULE3_PERMISSIONS_GLOBAL_4, '8' => _AM_MYMODULE3_PERMISSIONS_GLOBAL_8, '16' => _AM_MYMODULE3_PERMISSIONS_GLOBAL_16 ); - break; - case 'approve_articles': - $formTitle = _AM_MYMODULE3_PERMISSIONS_APPROVE; - $permName = 'mymodule3_approve_articles'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_APPROVE_DESC . ' Articles'; - $handler = $helper->getHandler('articles'); - break; - case 'submit_articles': - $formTitle = _AM_MYMODULE3_PERMISSIONS_SUBMIT; - $permName = 'mymodule3_submit_articles'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_SUBMIT_DESC . ' Articles'; - $handler = $helper->getHandler('articles'); - break; - case 'view_articles': - $formTitle = _AM_MYMODULE3_PERMISSIONS_VIEW; - $permName = 'mymodule3_view_articles'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_VIEW_DESC . ' Articles'; - $handler = $helper->getHandler('articles'); - break; - case 'approve_testfields': - $formTitle = _AM_MYMODULE3_PERMISSIONS_APPROVE; - $permName = 'mymodule3_approve_testfields'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_APPROVE_DESC . ' Testfields'; - $handler = $helper->getHandler('testfields'); - break; - case 'submit_testfields': - $formTitle = _AM_MYMODULE3_PERMISSIONS_SUBMIT; - $permName = 'mymodule3_submit_testfields'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_SUBMIT_DESC . ' Testfields'; - $handler = $helper->getHandler('testfields'); - break; - case 'view_testfields': - $formTitle = _AM_MYMODULE3_PERMISSIONS_VIEW; - $permName = 'mymodule3_view_testfields'; - $permDesc = _AM_MYMODULE3_PERMISSIONS_VIEW_DESC . ' Testfields'; - $handler = $helper->getHandler('testfields'); - break; -} -$moduleId = $xoopsModule->getVar('mid'); -$permform = new \XoopsGroupPermForm($formTitle, $moduleId, $permName, $permDesc, 'admin/permissions.php'); -$permFound = false; -if ($op === 'global') { - foreach($globalPerms as $gPermId => $gPermName) { - $permform->addItem($gPermId, $gPermName); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - $permFound = true; -} -if ($op === 'approve_articles' || $op === 'submit_articles' || $op === 'view_articles') { - $articlesCount = $articlesHandler->getCountArticles(); - if ($articlesCount > 0) { - $articlesAll = $articlesHandler->getAllArticles(0, 'art_title'); - foreach(array_keys($articlesAll) as $i) { - $permform->addItem($articlesAll[$i]->getVar('art_id'), $articlesAll[$i]->getVar('art_title')); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - } - $permFound = true; -} -if ($op === 'approve_testfields' || $op === 'submit_testfields' || $op === 'view_testfields') { - $testfieldsCount = $testfieldsHandler->getCountTestfields(); - if ($testfieldsCount > 0) { - $testfieldsAll = $testfieldsHandler->getAllTestfields(0, 'tf_text'); - foreach(array_keys($testfieldsAll) as $i) { - $permform->addItem($testfieldsAll[$i]->getVar('tf_id'), $testfieldsAll[$i]->getVar('tf_text')); - } - $GLOBALS['xoopsTpl']->assign('form', $permform->render()); - } - $permFound = true; -} -unset($permform); -if ($permFound !== true) { - redirect_header('permissions.php', 3, _AM_MYMODULE3_NO_PERMISSIONS_SET); - exit(); -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/admin/testfields.php b/testdata/mymodule3/admin/testfields.php deleted file mode 100644 index 489b88e7..00000000 --- a/testdata/mymodule3/admin/testfields.php +++ /dev/null @@ -1,298 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'list'); -// Request tf_id -$tfId = Request::getInt('tf_id'); -switch($op) { - case 'list': - default: - // Define Stylesheet - $GLOBALS['xoTheme']->addStylesheet( $style, null ); - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('adminpager')); - $templateMain = 'mymodule3_admin_testfields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ADD_TESTFIELD, 'testfields.php?op=new', 'add'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - $testfieldsCount = $testfieldsHandler->getCountTestfields(); - $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); - $GLOBALS['xoopsTpl']->assign('testfields_count', $testfieldsCount); - $GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - // Table view testfields - if ($testfieldsCount > 0) { - foreach(array_keys($testfieldsAll) as $i) { - $testfield = $testfieldsAll[$i]->getValuesTestfields(); - $GLOBALS['xoopsTpl']->append('testfields_list', $testfield); - unset($testfield); - } - // Display Navigation - if ($testfieldsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - } else { - $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE3_THEREARENT_TESTFIELDS); - } - break; - case 'new': - $templateMain = 'mymodule3_admin_testfields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php')); - $adminObject->addItemButton(_AM_MYMODULE3_TESTFIELDS_LIST, 'testfields.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - if (isset($tfId)) { - $testfieldsObj = $testfieldsHandler->get($tfId); - } else { - $testfieldsObj = $testfieldsHandler->create(); - } - // Set Vars - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getInt('tf_selectbox', 0)); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule3\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $tfPassword = Request::getString('tf_password', ''); - if ('' !== $tfPassword) { - $testfieldsObj->setVar('tf_password', password_hash($tfPassword, PASSWORD_DEFAULT)); - } - $testfieldsObj->setVar('tf_country_list', Request::getString('tf_country_list', '')); - $testfieldsObj->setVar('tf_language', Request::getString('tf_language', '')); - $testfieldsObj->setVar('tf_radio', Request::getInt('tf_radio', 0)); - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - $testfieldDatetimeArr = Request::getArray('tf_datetime'); - $testfieldDatetime = strtotime($testfieldDatetimeArr['date']) + (int)$testfieldDatetimeArr['time']; - $testfieldsObj->setVar('tf_datetime', $testfieldDatetime); - $testfieldsObj->setVar('tf_combobox', Request::getInt('tf_combobox', 0)); - // Insert Data - if ($testfieldsHandler->insert($testfieldsObj)) { - $newTfId = $testfieldsObj->getNewInsertedIdTestfields(); - $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId; - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $GLOBALS['xoopsModule']->getVar('mid'); - // Permission to view_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule3_view_testfields', $permId); - if (isset($_POST['groups_view_testfields'])) { - foreach($_POST['groups_view_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_view_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to submit_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule3_submit_testfields', $permId); - if (isset($_POST['groups_submit_testfields'])) { - foreach($_POST['groups_submit_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_submit_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to approve_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule3_approve_testfields', $permId); - if (isset($_POST['groups_approve_testfields'])) { - foreach($_POST['groups_approve_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_approve_testfields', $permId, $onegroupId, $mid); - } - } - if ('' !== $uploaderErrors) { - redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors); - } else { - redirect_header('testfields.php?op=list', 2, _AM_MYMODULE3_FORM_OK); - } - } - // Get Form - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'edit': - $templateMain = 'mymodule3_admin_testfields.tpl'; - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php')); - $adminObject->addItemButton(_AM_MYMODULE3_ADD_TESTFIELD, 'testfields.php?op=new', 'add'); - $adminObject->addItemButton(_AM_MYMODULE3_TESTFIELDS_LIST, 'testfields.php', 'list'); - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); - // Get Form - $testfieldsObj = $testfieldsHandler->get($tfId); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'delete': - $testfieldsObj = $testfieldsHandler->get($tfId); - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); - } - if ($testfieldsHandler->delete($testfieldsObj)) { - redirect_header('testfields.php', 3, _AM_MYMODULE3_FORM_DELETE_OK); - } else { - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - } - } else { - xoops_confirm(array('ok' => 1, 'tf_id' => $tfId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE3_FORM_SURE_DELETE, $testfieldsObj->getVar('tf_text'))); - } - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/articles.php b/testdata/mymodule3/articles.php deleted file mode 100644 index fe708217..00000000 --- a/testdata/mymodule3/articles.php +++ /dev/null @@ -1,83 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule3_articles.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; - -$op = Request::getString('op', 'list'); -$artId = Request::getInt('art_id', 0); -$start = Request::getInt('start', 0); -$limit = Request::getInt('limit', $helper->getConfig('userpager')); - -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); - -$critArticles = new \CriteriaCompo(); -if ($artId > 0) { - $critArticles->add( new \Criteria( 'art_id', $artId ) ); -} -$articlesCount = $articlesHandler->getCount($critArticles); -$GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); -$critArticles->setStart( $start ); -$critArticles->setLimit( $limit ); -$articlesAll = $articlesHandler->getAll($critArticles); -$keywords = []; -if ($articlesCount > 0) { - $articles = []; - // Get All Articles - foreach(array_keys($articlesAll) as $i) { - $articles[] = $articlesAll[$i]->getValuesArticles(); - $keywords[] = $articlesAll[$i]->getVar('art_title'); - } - $GLOBALS['xoopsTpl']->assign('articles', $articles); - unset($articles); - // Display Navigation - if ($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} - -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_ARTICLES]; - -// Keywords -mymodule3MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); - -// Description -mymodule3MetaDescription(_MA_MYMODULE3_ARTICLES_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE3_URL.'/articles.php'); -$GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/assets/css/admin/index.html b/testdata/mymodule3/assets/css/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/css/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/css/admin/style.css b/testdata/mymodule3/assets/css/admin/style.css deleted file mode 100644 index 934ef313..00000000 --- a/testdata/mymodule3/assets/css/admin/style.css +++ /dev/null @@ -1,24 +0,0 @@ -@charset "UTF-8"; -/* - 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. -*/ - -/** - * My Module 3 module for xoops - * - * @copyright 2020 XOOPS Project (https://xooops.org) - * @license GPL 2.0 or later - * @package mymodule3 - * @since 1.0 - * @min_xoops 2.5.9 - * @author TDM XOOPS - Email: - Website: - */ -img { - max-width: 200px; -} \ No newline at end of file diff --git a/testdata/mymodule3/assets/css/index.html b/testdata/mymodule3/assets/css/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/css/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/css/style.css b/testdata/mymodule3/assets/css/style.css deleted file mode 100644 index efd8c1e8..00000000 --- a/testdata/mymodule3/assets/css/style.css +++ /dev/null @@ -1,42 +0,0 @@ -@charset "UTF-8"; -/* - 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. -*/ - -/** - * My Module 3 module for xoops - * - * @copyright 2020 XOOPS Project (https://xooops.org) - * @license GPL 2.0 or later - * @package mymodule3 - * @since 1.0 - * @min_xoops 2.5.9 - * @author TDM XOOPS - Email: - Website: - */ -ul.menu { - list-style: none; - background-color: #f5f5f5; - border-radius: 4px; -} - -ul.menu > li { - display: inline-block; -} - -ul.menu > li + li:before { - content: "|\a0"; -} - -.printOnly { - display: none; -} - -img { - max-width: 300px; -} \ No newline at end of file diff --git a/testdata/mymodule3/assets/icons/16/index.html b/testdata/mymodule3/assets/icons/16/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/icons/16/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/icons/16/status0.png b/testdata/mymodule3/assets/icons/16/status0.png deleted file mode 100644 index 7ad3c3c7..00000000 Binary files a/testdata/mymodule3/assets/icons/16/status0.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/16/status1.png b/testdata/mymodule3/assets/icons/16/status1.png deleted file mode 100644 index a9a721e8..00000000 Binary files a/testdata/mymodule3/assets/icons/16/status1.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/16/status2.png b/testdata/mymodule3/assets/icons/16/status2.png deleted file mode 100644 index 26535e51..00000000 Binary files a/testdata/mymodule3/assets/icons/16/status2.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/16/status3.png b/testdata/mymodule3/assets/icons/16/status3.png deleted file mode 100644 index d5b94d94..00000000 Binary files a/testdata/mymodule3/assets/icons/16/status3.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/32/alert.png b/testdata/mymodule3/assets/icons/32/alert.png deleted file mode 100644 index 4bd83676..00000000 Binary files a/testdata/mymodule3/assets/icons/32/alert.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/32/category.png b/testdata/mymodule3/assets/icons/32/category.png deleted file mode 100644 index 42852b53..00000000 Binary files a/testdata/mymodule3/assets/icons/32/category.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/32/index.html b/testdata/mymodule3/assets/icons/32/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/icons/32/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/icons/32/penguin.png b/testdata/mymodule3/assets/icons/32/penguin.png deleted file mode 100644 index 28f86e3a..00000000 Binary files a/testdata/mymodule3/assets/icons/32/penguin.png and /dev/null differ diff --git a/testdata/mymodule3/assets/icons/index.html b/testdata/mymodule3/assets/icons/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/icons/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/images/blank.gif b/testdata/mymodule3/assets/images/blank.gif deleted file mode 100644 index 3a469695..00000000 Binary files a/testdata/mymodule3/assets/images/blank.gif and /dev/null differ diff --git a/testdata/mymodule3/assets/images/blank.png b/testdata/mymodule3/assets/images/blank.png deleted file mode 100644 index e1ee728a..00000000 Binary files a/testdata/mymodule3/assets/images/blank.png and /dev/null differ diff --git a/testdata/mymodule3/assets/images/index.html b/testdata/mymodule3/assets/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/images/logoModule.png b/testdata/mymodule3/assets/images/logoModule.png deleted file mode 100644 index 2df3e5ab..00000000 Binary files a/testdata/mymodule3/assets/images/logoModule.png and /dev/null differ diff --git a/testdata/mymodule3/assets/images/tdmxoops_logo.png b/testdata/mymodule3/assets/images/tdmxoops_logo.png deleted file mode 100644 index 5b7f5d97..00000000 Binary files a/testdata/mymodule3/assets/images/tdmxoops_logo.png and /dev/null differ diff --git a/testdata/mymodule3/assets/index.html b/testdata/mymodule3/assets/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/assets/js/functions.js b/testdata/mymodule3/assets/js/functions.js deleted file mode 100644 index dce2bb75..00000000 --- a/testdata/mymodule3/assets/js/functions.js +++ /dev/null @@ -1,71 +0,0 @@ -$(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(); -}); - -// \ No newline at end of file diff --git a/testdata/mymodule3/assets/js/index.html b/testdata/mymodule3/assets/js/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/assets/js/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/blocks/articles.php b/testdata/mymodule3/blocks/articles.php deleted file mode 100644 index f06ec7ab..00000000 --- a/testdata/mymodule3/blocks/articles.php +++ /dev/null @@ -1,136 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Helper; -use XoopsModules\Mymodule3\Constants; - -include_once XOOPS_ROOT_PATH . '/modules/mymodule3/include/common.php'; - -/** - * Function show block - * @param $options - * @return array - */ -function b_mymodule3_articles_show($options) -{ - include_once XOOPS_ROOT_PATH . '/modules/mymodule3/class/articles.php'; -$myts = MyTextSanitizer::getInstance(); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - $block = []; - $typeBlock = $options[0]; - $limit = $options[1]; - $lenghtTitle = $options[2]; - $helper = Helper::getInstance(); - $articlesHandler = $helper->getHandler('articles'); - $crArticles = new \CriteriaCompo(); - array_shift($options); - array_shift($options); - array_shift($options); - - switch($typeBlock) { - case 'last': - default: - // For the block: articles last - $crArticles->setSort( 'art_date' ); - $crArticles->setOrder( 'DESC' ); - break; - case 'new': - // For the block: articles new - $crArticles->add( new \Criteria( 'art_date', strtotime(date(_SHORTDATESTRING)), '>=' ) ); - $crArticles->add( new \Criteria( 'art_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); - $crArticles->setSort( 'art_date' ); - $crArticles->setOrder( 'ASC' ); - break; - case 'hits': - // For the block: articles hits - $crArticles->setSort( 'art_hits' ); - $crArticles->setOrder( 'DESC' ); - break; - case 'top': - // For the block: articles top - $crArticles->add( new \Criteria( 'art_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); - $crArticles->setSort( 'art_top' ); - $crArticles->setOrder( 'ASC' ); - break; - case 'random': - // For the block: articles random - $crArticles->add( new \Criteria( 'art_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); - $crArticles->setSort( 'RAND()' ); - break; - } - - $crArticles->setLimit( $limit ); - $articlesAll = $articlesHandler->getAll($crArticles); - unset($crArticles); - if (count($articlesAll) > 0) { - foreach(array_keys($articlesAll) as $i) { - $block[$i]['cat'] = $articlesAll[$i]->getVar('art_cat'); - $block[$i]['title'] = $myts->htmlSpecialChars($articlesAll[$i]->getVar('art_title')); - $block[$i]['descr'] = strip_tags($articlesAll[$i]->getVar('art_descr')); - $block[$i]['img'] = $articlesAll[$i]->getVar('art_img'); - $block[$i]['file'] = $articlesAll[$i]->getVar('art_file'); - $block[$i]['created'] = formatTimeStamp($articlesAll[$i]->getVar('art_created')); - $block[$i]['submitter'] = \XoopsUser::getUnameFromId($articlesAll[$i]->getVar('art_submitter')); - } - } - - return $block; - -} - -/** - * Function edit block - * @param $options - * @return string - */ -function b_mymodule3_articles_edit($options) -{ - include_once XOOPS_ROOT_PATH . '/modules/mymodule3/class/articles.php'; - $helper = Helper::getInstance(); - $articlesHandler = $helper->getHandler('articles'); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - $form = _MB_MYMODULE3_DISPLAY; - $form .= ""; - $form .= " 
      "; - $form .= _MB_MYMODULE3_TITLE_LENGTH . " :

      "; - array_shift($options); - array_shift($options); - array_shift($options); - - $crArticles = new \CriteriaCompo(); - $crArticles->add( new \Criteria( 'art_id', 0, '!=' ) ); - $crArticles->setSort( 'art_id' ); - $crArticles->setOrder( 'ASC' ); - $articlesAll = $articlesHandler->getAll($crArticles); - unset($crArticles); - $form .= _MB_MYMODULE3_ARTICLES_TO_DISPLAY . "
      '; - - return $form; - -} diff --git a/testdata/mymodule3/blocks/index.html b/testdata/mymodule3/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/blocks/testfields.php b/testdata/mymodule3/blocks/testfields.php deleted file mode 100644 index 6404be18..00000000 --- a/testdata/mymodule3/blocks/testfields.php +++ /dev/null @@ -1,134 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Helper; -use XoopsModules\Mymodule3\Constants; - -include_once XOOPS_ROOT_PATH . '/modules/mymodule3/include/common.php'; - -/** - * Function show block - * @param $options - * @return array - */ -function b_mymodule3_testfields_show($options) -{ - include_once XOOPS_ROOT_PATH . '/modules/mymodule3/class/testfields.php'; -$myts = MyTextSanitizer::getInstance(); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - $block = []; - $typeBlock = $options[0]; - $limit = $options[1]; - $lenghtTitle = $options[2]; - $helper = Helper::getInstance(); - $testfieldsHandler = $helper->getHandler('testfields'); - $crTestfields = new \CriteriaCompo(); - array_shift($options); - array_shift($options); - array_shift($options); - - switch($typeBlock) { - case 'last': - default: - // For the block: testfields last - $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); - $crTestfields->setSort( 'tf_date' ); - $crTestfields->setOrder( 'DESC' ); - break; - case 'new': - // For the block: testfields new - $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); - $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING)), '>=' ) ); - $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); - $crTestfields->setSort( 'tf_date' ); - $crTestfields->setOrder( 'ASC' ); - break; - case 'hits': - // For the block: testfields hits - $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); - $crTestfields->setSort( 'tf_hits' ); - $crTestfields->setOrder( 'DESC' ); - break; - case 'top': - // For the block: testfields top - $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); - $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); - $crTestfields->setSort( 'tf_top' ); - $crTestfields->setOrder( 'ASC' ); - break; - case 'random': - // For the block: testfields random - $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); - $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); - $crTestfields->setSort( 'RAND()' ); - break; - } - - $crTestfields->setLimit( $limit ); - $testfieldsAll = $testfieldsHandler->getAll($crTestfields); - unset($crTestfields); - if (count($testfieldsAll) > 0) { - foreach(array_keys($testfieldsAll) as $i) { - } - } - - return $block; - -} - -/** - * Function edit block - * @param $options - * @return string - */ -function b_mymodule3_testfields_edit($options) -{ - include_once XOOPS_ROOT_PATH . '/modules/mymodule3/class/testfields.php'; - $helper = Helper::getInstance(); - $testfieldsHandler = $helper->getHandler('testfields'); - $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); - $form = _MB_MYMODULE3_DISPLAY; - $form .= ""; - $form .= " 
      "; - $form .= _MB_MYMODULE3_TITLE_LENGTH . " :

      "; - array_shift($options); - array_shift($options); - array_shift($options); - - $crTestfields = new \CriteriaCompo(); - $crTestfields->add( new \Criteria( 'tf_id', 0, '!=' ) ); - $crTestfields->setSort( 'tf_id' ); - $crTestfields->setOrder( 'ASC' ); - $testfieldsAll = $testfieldsHandler->getAll($crTestfields); - unset($crTestfields); - $form .= _MB_MYMODULE3_TESTFIELDS_TO_DISPLAY . "
      '; - - return $form; - -} diff --git a/testdata/mymodule3/broken.php b/testdata/mymodule3/broken.php deleted file mode 100644 index 709ecb98..00000000 --- a/testdata/mymodule3/broken.php +++ /dev/null @@ -1,232 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$op = Request::getString('op', 'list'); -$tfId = Request::getInt('tf_id'); -// Template -$GLOBALS['xoopsOption']['template_main'] = 'mymodule3_broken.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -// Redirection if not permissions -if ($permSubmit === false) { - redirect_header('index.php', 2, _NOPERM); - exit(); -} -switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE3_SUBMIT_PROPOSER; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE3_SUBMIT_PROPOSER . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE3_SUBMIT_PROPOSER)); - // Form Create - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - // Security Check - if ($GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $testfieldsObj = $testfieldsHandler->create(); - $error = false; - $errorMessage = ''; - // Test first the validation - xoops_load('captcha'); - $xoopsCaptcha = \XoopsCaptcha::getInstance(); - if (!$xoopsCaptcha->verify()) { - $errorMessage .= $xoopsCaptcha->getMessage().'
      '; - $error = true; - } - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getInt('tf_selectbox', 0)); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule3\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $tfPassword = Request::getString('tf_password', ''); - if ('' !== $tfPassword) { - $testfieldsObj->setVar('tf_password', password_hash($tfPassword, PASSWORD_DEFAULT)); - } - $testfieldsObj->setVar('tf_country_list', Request::getString('tf_country_list', '')); - $testfieldsObj->setVar('tf_language', Request::getString('tf_language', '')); - $testfieldsObj->setVar('tf_radio', Request::getInt('tf_radio', 0)); - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - $testfieldDatetimeArr = Request::getArray('tf_datetime'); - $testfieldDatetime = strtotime($testfieldDatetimeArr['date']) + (int)$testfieldDatetimeArr['time']; - $testfieldsObj->setVar('tf_datetime', $testfieldDatetime); - $testfieldsObj->setVar('tf_combobox', Request::getInt('tf_combobox', 0)); - if ($error === true) { - $GLOBALS['xoopsTpl']->assign('error_message', $errorMessage); - } else { - // Insert Data - if ($testfieldsHandler->insert($testfieldsObj)) { - redirect_header('index.php', 2, _MA_MYMODULE3_FORM_OK); - } - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - break; -} -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/class/Articles.php b/testdata/mymodule3/class/Articles.php deleted file mode 100644 index dbe95e24..00000000 --- a/testdata/mymodule3/class/Articles.php +++ /dev/null @@ -1,251 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Articles - */ -class Articles extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('art_id', XOBJ_DTYPE_INT); - $this->initVar('art_cat', XOBJ_DTYPE_INT); - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_descr', XOBJ_DTYPE_TXTAREA); - $this->initVar('art_img', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_online', XOBJ_DTYPE_INT); - $this->initVar('art_file', XOBJ_DTYPE_TXTBOX); - $this->initVar('art_created', XOBJ_DTYPE_INT); - $this->initVar('art_submitter', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdArticles() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return \XoopsThemeForm - */ - public function getFormArticles($action = false) - { - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - if (false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Permissions for uploader - $grouppermHandler = xoops_getHandler('groupperm'); - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; - if ($GLOBALS['xoopsUser']) { - if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } else { - $permissionUpload = true; - } - } else { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE3_ARTICLE_ADD) : sprintf(_AM_MYMODULE3_ARTICLE_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Use tag module - $dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false; - if (($helper->getConfig('usetag') == 1) && $dirTag) { - $tagId = $this->isNew() ? 0 : $this->getVar('art_id'); - include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; - $form->addElement(new \XoopsFormTag( 'tag', 60, 255, $tagId, 0 ), true); - } - // Form Table categories - $categoriesHandler = $helper->getHandler('categories'); - $artCatSelect = new \XoopsFormSelect( _AM_MYMODULE3_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); - $artCatSelect->addOptionArray($categoriesHandler->getList()); - $form->addElement($artCatSelect, true); - // Form Text artTitle - $form->addElement(new \XoopsFormText( _AM_MYMODULE3_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title') ), true); - // Form Editor DhtmlTextArea artDescr - $editorConfigs = []; - $editorConfigs['name'] = 'art_descr'; - $editorConfigs['value'] = $this->getVar('art_descr', 'e'); - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $editorConfigs['editor'] = $helper->getConfig('editor_descr'); - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE3_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); - // Form Image artImg - // Form Image artImg: Select Uploaded Image - $getArtImg = $this->getVar('art_img'); - $artImg = $getArtImg ? $getArtImg : 'blank.gif'; - $imageDirectory = '/uploads/mymodule3/images/articles'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE3_ARTICLE_IMG, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE3_ARTICLE_IMG_UPLOADS, ".{$imageDirectory}/"), 'art_img', $artImg, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_art_img\", \"art_img\", \"" . $imageDirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form Image artImg: Upload new image - if ($permissionUpload) { - $maxsize = $helper->getConfig('maxsize_image'); - $imageTray->addElement(new \XoopsFormFile( '
      ' . _AM_MYMODULE3_FORM_UPLOAD_NEW, 'art_img', $maxsize )); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE3_FORM_UPLOAD_SIZE_MB)); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); - } else { - $imageTray->addElement(new \XoopsFormHidden( 'art_img', $artImg )); - } - $form->addElement($imageTray, ); - // Form Radio Yes/No artOnline - $artOnline = $this->isNew() ? 0 : $this->getVar('art_online'); - $form->addElement(new \XoopsFormRadioYN( _AM_MYMODULE3_ARTICLE_ONLINE, 'art_online', $artOnline), true); - // Form File Upload artFile - $artFile = $this->isNew() ? '' : $this->getVar('art_file'); - if ($permissionUpload) { - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE3_ARTICLE_FILE, '
      ' ); - $fileDirectory = '/uploads/mymodule3/files/articles'; - if (!$this->isNew()) { - $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE3_ARTICLE_FILE_UPLOADS, ".{$fileDirectory}/"), $artFile)); - } - $maxsize = $helper->getConfig('maxsize_file'); - $fileUploadTray->addElement(new \XoopsFormFile( '', 'art_file', $maxsize )); - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE3_FORM_UPLOAD_SIZE_MB)); - $form->addElement($fileUploadTray, ); - } else { - $form->addElement(new \XoopsFormHidden( 'art_file', $artFile )); - } - // Form Text Date Select artCreated - $artCreated = $this->isNew() ? 0 : $this->getVar('art_created'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE3_ARTICLE_CREATED, 'art_created', '', $artCreated )); - // Form Select User artSubmitter - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE3_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter') )); - // Permissions - $memberHandler = xoops_getHandler('member'); - $groupList = $memberHandler->getGroupList(); - $grouppermHandler = xoops_getHandler('groupperm'); - $fullList[] = array_keys($groupList); - if (!$this->isNew()) { - $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule3_approve_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsApprove[] = array_values($groupsIdsApprove); - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $groupsIdsApprove); - $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule3_submit_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsSubmit[] = array_values($groupsIdsSubmit); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $groupsIdsSubmit); - $groupsIdsView = $grouppermHandler->getGroupIds('mymodule3_view_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsView[] = array_values($groupsIdsView); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_VIEW, 'groups_view_articles[]', $groupsIdsView); - } else { - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $fullList); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $fullList); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_VIEW, 'groups_view_articles[]', $fullList); - } - // To Approve - $groupsCanApproveCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanApproveCheckbox); - // To Submit - $groupsCanSubmitCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanSubmitCheckbox); - // To View - $groupsCanViewCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanViewCheckbox); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesArticles($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('art_id'); - $categoriesHandler = $helper->getHandler('categories'); - $categoriesObj = $categoriesHandler->get($this->getVar('art_cat')); - $ret['cat'] = $categoriesObj->getVar('cat_name'); - $ret['title'] = $this->getVar('art_title'); - $ret['descr'] = strip_tags($this->getVar('art_descr')); - $ret['img'] = $this->getVar('art_img'); - $ret['online'] = (int)$this->getVar('art_online') > 0 ? _YES : _NO; - $ret['file'] = $this->getVar('art_file'); - $ret['created'] = formatTimeStamp($this->getVar('art_created'), 's'); - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('art_submitter')); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayArticles() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule3/class/Articleshandler.php b/testdata/mymodule3/class/Articleshandler.php deleted file mode 100644 index 58611c15..00000000 --- a/testdata/mymodule3/class/Articleshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - - -/** - * Class Object Handler Articles - */ -class ArticlesHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param \XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule3_articles', Articles::class, 'art_id', 'art_title'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Articles in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountArticles($start = 0, $limit = 0, $sort = 'art_id ASC, art_title', $order = 'ASC') - { - $crCountArticles = new \CriteriaCompo(); - $crCountArticles = $this->getArticlesCriteria($crCountArticles, $start, $limit, $sort, $order); - return parent::getCount($crCountArticles); - } - - /** - * Get All Articles in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllArticles($start = 0, $limit = 0, $sort = 'art_id ASC, art_title', $order = 'ASC') - { - $crAllArticles = new \CriteriaCompo(); - $crAllArticles = $this->getArticlesCriteria($crAllArticles, $start, $limit, $sort, $order); - return parent::getAll($crAllArticles); - } - - /** - * Get Criteria Articles - * @param $crArticles - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getArticlesCriteria($crArticles, $start, $limit, $sort, $order) - { - $crArticles->setStart( $start ); - $crArticles->setLimit( $limit ); - $crArticles->setSort( $sort ); - $crArticles->setOrder( $order ); - return $crArticles; - } -} diff --git a/testdata/mymodule3/class/Categories.php b/testdata/mymodule3/class/Categories.php deleted file mode 100644 index e5bc2370..00000000 --- a/testdata/mymodule3/class/Categories.php +++ /dev/null @@ -1,133 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Categories - */ -class Categories extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('cat_id', XOBJ_DTYPE_INT); - $this->initVar('cat_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_logo', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_created', XOBJ_DTYPE_INT); - $this->initVar('cat_submitter', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdCategories() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return \XoopsThemeForm - */ - public function getFormCategories($action = false) - { - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - if (false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE3_CATEGORY_ADD) : sprintf(_AM_MYMODULE3_CATEGORY_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Form Text catName - $form->addElement(new \XoopsFormText( _AM_MYMODULE3_CATEGORY_NAME, 'cat_name', 50, 255, $this->getVar('cat_name') ), true); - // Form Text Date Select catCreated - $catCreated = $this->isNew() ? 0 : $this->getVar('cat_created'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE3_CATEGORY_CREATED, 'cat_created', '', $catCreated ), true); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesCategories($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('cat_id'); - $ret['name'] = $this->getVar('cat_name'); - $ret['logo'] = $this->getVar('cat_logo'); - $ret['created'] = formatTimeStamp($this->getVar('cat_created'), 's'); - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('cat_submitter')); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayCategories() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule3/class/Categorieshandler.php b/testdata/mymodule3/class/Categorieshandler.php deleted file mode 100644 index 327de438..00000000 --- a/testdata/mymodule3/class/Categorieshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - - -/** - * Class Object Handler Categories - */ -class CategoriesHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param \XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule3_categories', Categories::class, 'cat_id', 'cat_name'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Categories in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') - { - $crCountCategories = new \CriteriaCompo(); - $crCountCategories = $this->getCategoriesCriteria($crCountCategories, $start, $limit, $sort, $order); - return parent::getCount($crCountCategories); - } - - /** - * Get All Categories in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') - { - $crAllCategories = new \CriteriaCompo(); - $crAllCategories = $this->getCategoriesCriteria($crAllCategories, $start, $limit, $sort, $order); - return parent::getAll($crAllCategories); - } - - /** - * Get Criteria Categories - * @param $crCategories - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getCategoriesCriteria($crCategories, $start, $limit, $sort, $order) - { - $crCategories->setStart( $start ); - $crCategories->setLimit( $limit ); - $crCategories->setSort( $sort ); - $crCategories->setOrder( $order ); - return $crCategories; - } -} diff --git a/testdata/mymodule3/class/Common/Configurator.php b/testdata/mymodule3/class/Common/Configurator.php deleted file mode 100644 index 92f079f6..00000000 --- a/testdata/mymodule3/class/Common/Configurator.php +++ /dev/null @@ -1,68 +0,0 @@ -name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; - $this->copyTestFolders = $config->copyTestFolders; - $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->renameTables = $config->renameTables; - $this->moduleStats = $config->moduleStats; - $this->modCopyright = $config->modCopyright; - } -} diff --git a/testdata/mymodule3/class/Common/FilesManagement.php b/testdata/mymodule3/class/Common/FilesManagement.php deleted file mode 100644 index 32c64e3a..00000000 --- a/testdata/mymodule3/class/Common/FilesManagement.php +++ /dev/null @@ -1,294 +0,0 @@ - - */ -trait FilesManagement -{ - /** - * Function responsible for checking if a directory exists, we can also write in and create an index.html file - * - * @param string $folder The full path of the directory to check - * - * @return void - * @throws \RuntimeException - */ - public static function createFolder($folder) - { - try { - if (!file_exists($folder)) { - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); - } - - file_put_contents($folder . '/index.html', ''); - } - } catch (\Exception $e) { - echo 'Caught exception: ', $e->getMessage(), '
      '; - } - } - - /** - * @param $file - * @param $folder - * @return bool - */ - public static function copyFile($file, $folder) - { - return copy($file, $folder); - } - - /** - * @param $src - * @param $dst - */ - public static function recurseCopy($src, $dst) - { - $dir = opendir($src); - // @mkdir($dst); - if (!@mkdir($dst) && !is_dir($dst)) { - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); - } - while (false !== ($file = readdir($dir))) { - if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); - } else { - copy($src . '/' . $file, $dst . '/' . $file); - } - } - } - closedir($dir); - } - - /** - * Copy a file, or recursively copy a folder and its contents - * @param string $source Source path - * @param string $dest Destination path - * @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/ - */ - public static function xcopy($source, $dest) - { - // Check for symlinks - if (is_link($source)) { - return symlink(readlink($source), $dest); - } - - // Simple copy for a file - if (is_file($source)) { - return copy($source, $dest); - } - - // Make destination directory - if (!is_dir($dest)) { - if (!mkdir($dest) && !is_dir($dest)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dest)); - } - } - - // Loop through the folder - $dir = dir($source); - if (@is_dir($dir)) { - while (false !== $entry = $dir->read()) { - // Skip pointers - if ('.' === $entry || '..' === $entry) { - continue; - } - // Deep copy directories - self::xcopy("$source/$entry", "$dest/$entry"); - } - // Clean up - $dir->close(); - } - - return true; - } - - /** - * Remove files and (sub)directories - * - * @param string $src source directory to delete - * - * @return bool true on success - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @uses \Xmf\Module\Helper::getHelper() - */ - public static function deleteDirectory($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - $success = true; - // remove old files - $dirInfo = new \SplFileInfo($src); - // validate is a directory - if ($dirInfo->isDir()) { - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); - foreach ($fileList as $k => $v) { - $fileInfo = new \SplFileInfo("{$src}/{$v}"); - if ($fileInfo->isDir()) { - // recursively handle subdirectories - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { - break; - } - } else { - // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { - break; - } - } - } - // now delete this (sub)directory if all the files are gone - if ($success) { - $success = rmdir($dirInfo->getRealPath()); - } - } else { - // input is not a valid directory - $success = false; - } - - return $success; - } - - /** - * Recursively remove directory - * - * @todo currently won't remove directories with hidden files, should it? - * - * @param string $src directory to remove (delete) - * - * @return bool true on success - */ - public static function rrmdir($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - $success = true; - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file - if (!unlink($filename)) { - return false; // couldn't delete the file - } - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rrmdir($fObj->getPathname()); - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively move files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - */ - public static function rmove($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - // rmdir($fObj->getPath()); // now delete the directory - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively copy directories and files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @uses \Xmf\Module\Helper::getHelper() - */ - public static function rcopy($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } - } - - return true; - } -} diff --git a/testdata/mymodule3/class/Common/Migrate.php b/testdata/mymodule3/class/Common/Migrate.php deleted file mode 100644 index 3c59a1ab..00000000 --- a/testdata/mymodule3/class/Common/Migrate.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @link https://xoops.org - */ - -class Migrate extends \Xmf\Database\Migrate -{ - private $renameTables; - - /** - * Migrate constructor. - * @param Common\Configurator $configurator - * @throws \RuntimeException - * @throws \InvalidArgumentException - */ - public function __construct(Common\Configurator $configurator = null) - { - if (null !== $configurator) { - $this->renameTables = $configurator->renameTables; - - $moduleDirName = basename(dirname(dirname(__DIR__))); - parent::__construct($moduleDirName); - } - } - - /** - * change table prefix if needed - */ - private function changePrefix() - { - foreach ($this->renameTables as $oldName => $newName) { - if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { - $this->tableHandler->renameTable($oldName, $newName); - } - } - } - - /** - * Change integer IPv4 column to varchar IPv6 capable - * - * @param string $tableName table to convert - * @param string $columnName column with IP address - */ - private function convertIPAddresses($tableName, $columnName) - { - if ($this->tableHandler->useTable($tableName)) { - $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); - if (false !== mb_strpos($attributes, ' int(')) { - if (false === mb_strpos($attributes, 'unsigned')) { - $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); - $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); - } - $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45) NOT NULL DEFAULT '' "); - $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false); - } - } - } - - /** - * Move do* columns from newbb_posts to newbb_posts_text table - */ - private function moveDoColumns() - { - $tableName = 'newbb_posts_text'; - $srcTableName = 'newbb_posts'; - if ($this->tableHandler->useTable($tableName) - && $this->tableHandler->useTable($srcTableName)) { - $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml'); - if (false === $attributes) { - $this->synchronizeTable($tableName); - $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); - $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); - $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; - $this->tableHandler->addToQueue($sql); - } - } - } - - /** - * Perform any upfront actions before synchronizing the schema - * - * Some typical uses include - * table and column renames - * data conversions - */ - protected function preSyncActions() - { - /* - // change 'bb' table prefix to 'newbb' - $this->changePrefix(); - // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point - $this->moveDoColumns(); - // Convert IP address columns from int to readable varchar(45) for IPv6 - $this->convertIPAddresses('newbb_posts', 'poster_ip'); - $this->convertIPAddresses('newbb_report', 'reporter_ip'); - */ - } -} diff --git a/testdata/mymodule3/class/Common/ModuleFeedback.php b/testdata/mymodule3/class/Common/ModuleFeedback.php deleted file mode 100644 index 27b4a043..00000000 --- a/testdata/mymodule3/class/Common/ModuleFeedback.php +++ /dev/null @@ -1,115 +0,0 @@ - - * @author Wedega - Email: - * @author Fernando Santos (topet05) - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object ModuleFeedback - */ -class ModuleFeedback extends \XoopsObject -{ - public $name = ''; - public $email = ''; - public $site = ''; - public $type = ''; - public $content = ''; - - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * @public function getFormFeedback: - * provide form for sending a feedback to module author - * @return \XoopsThemeForm - */ - public function getFormFeedback() - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $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')); - $recipient->setExtra('disabled="disabled"'); - $form->addElement($recipient); - $your_name = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); - $your_name->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); - $form->addElement($your_name); - $your_site = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); - $your_site->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); - $form->addElement($your_site); - $your_mail = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); - $your_mail->setExtra('placeholder="' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); - $form->addElement($your_mail); - - $fbtypeSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); - $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')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); - $fbtypeSelect->addOption(constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); - $form->addElement($fbtypeSelect, true); - - $editorConfigs = []; - $editorConfigs['name'] = 'fb_content'; - $editorConfigs['value'] = $this->content; - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $moduleHandler = xoops_getHandler('module'); - $module = $moduleHandler->getByDirname('system'); - $configHandler = xoops_getHandler('config'); - $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); - - $form->addElement(new \XoopsFormHidden('op', 'send')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - - return $form; - } -} diff --git a/testdata/mymodule3/class/Common/ModuleStats.php b/testdata/mymodule3/class/Common/ModuleStats.php deleted file mode 100644 index 3a366bb5..00000000 --- a/testdata/mymodule3/class/Common/ModuleStats.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -trait ModuleStats -{ - /** - * @param \XoopsModules\Mymodule3\Common\Configurator $configurator - * @param array $moduleStats - * @return array - */ - public static function getModuleStats($configurator, $moduleStats) - { - if (count($configurator->moduleStats) > 0) { - foreach (array_keys($configurator->moduleStats) as $i) { - $moduleStats[$i] = $configurator->moduleStats[$i]; - } - } - - return $moduleStats; - } -} diff --git a/testdata/mymodule3/class/Common/Resizer.php b/testdata/mymodule3/class/Common/Resizer.php deleted file mode 100644 index 2f6adc0a..00000000 --- a/testdata/mymodule3/class/Common/Resizer.php +++ /dev/null @@ -1,296 +0,0 @@ - - Website: - * @version $Id: 1.0 Resizer.php 1 Mon 2019-02-09 10:04:49Z XOOPS Project (www.xoops.org) $ - */ -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 = ''; - - /** - * resize image if size exceed given width/height - * @return string|bool - */ - public function resizeImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $img = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $img = imagecreatefromjpeg($this->sourceFile); - if (!$img) { - $img = imagecreatefromstring(file_get_contents($this->sourceFile)); - } - break; - case 'image/gif': - $img = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - $width = imagesx($img); - $height = imagesy($img); - - if ($width > $this->maxWidth || $height > $this->maxHeight) { - // recalc image size based on this->maxWidth/this->maxHeight - $new_width = 0; - $new_height = 0; - if ($width > $height) { - if ($width < $this->maxWidth) { - $new_width = $width; - } else { - $new_width = $this->maxWidth; - $divisor = $width / $new_width; - $new_height = floor($height / $divisor); - } - } elseif ($height < $this->maxHeight) { - $new_height = $height; - } else { - $new_height = $this->maxHeight; - $divisor = $height / $new_height; - $new_width = floor($width / $divisor); - } - - // Create a new temporary image. - $tmpimg = imagecreatetruecolor($new_width, $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); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - imagepng($tmpimg, $this->endFile, 0); - break; - case 'image/jpeg': - imagejpeg($tmpimg, $this->endFile, 100); - break; - case 'image/gif': - imagegif($tmpimg, $this->endFile); - break; - } - - // release the memory - imagedestroy($tmpimg); - } else { - return 'copy'; - } - imagedestroy($img); - - return true; - } - - /** - * @return bool|string - */ - public function resizeAndCrop() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // GET ORIGINAL IMAGE DIMENSIONS - list($original_w, $original_h) = getimagesize($this->sourceFile); - - // RESIZE IMAGE AND PRESERVE PROPORTIONS - $max_width_resize = $this->maxWidth; - $max_height_resize = $this->maxHeight; - if ($original_w > $original_h) { - $max_height_ratio = $this->maxHeight / $original_h; - $max_width_resize = (int)round($original_w * $max_height_ratio); - } else { - $max_width_ratio = $this->maxWidth / $original_w; - $max_height_resize = (int)round($original_h * $max_width_ratio); - } - if ($max_width_resize < $this->maxWidth) { - $max_height_ratio = $this->maxWidth / $max_width_resize; - $max_height_resize = (int)round($this->maxHeight * $max_height_ratio); - $max_width_resize = $this->maxWidth; - } - - // CREATE THE PROPORTIONAL IMAGE RESOURCE - $thumb = imagecreatetruecolor($max_width_resize, $max_height_resize); - if (!imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { - return false; - } - // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS - $final = imagecreatetruecolor($this->maxWidth, $this->maxHeight); - - $max_width_offset = 0; - $max_height_offset = 0; - if ($this->maxWidth < $max_width_resize) { - $max_width_offset = (int)round(($max_width_resize - $this->maxWidth) / 2); - } else { - $max_height_offset = (int)round(($max_height_resize - $this->maxHeight) / 2); - } - - if (!imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { - return false; - } - // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile - if (!imagejpeg($final, $this->endFile, $this->jpgQuality)) { - return false; - } - - return true; - } - - public function mergeImage() - { - $dest = imagecreatefromjpeg($this->endFile); - $src = imagecreatefromjpeg($this->sourceFile); - if (4 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 2 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 2 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 3: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 4: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - if (6 == $this->mergeType) { - $imgWidth = (int)round($this->maxWidth / 3 - 1); - $imgHeight = (int)round($this->maxHeight / 2 - 1); - $posCol2 = (int)round($this->maxWidth / 3 + 1); - $posCol3 = $posCol2 + (int)round($this->maxWidth / 3 + 1); - $posRow2 = (int)round($this->maxHeight / 2 + 1); - - switch ($this->mergePos) { - case 1: - imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left - break; - case 2: - imagecopy($dest, $src, $posCol2, 0, 0, 0, $imgWidth, $imgHeight); //top center - break; - case 3: - imagecopy($dest, $src, $posCol3, 0, 0, 0, $imgWidth, $imgHeight); //top right - break; - case 4: - imagecopy($dest, $src, 0, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom left - break; - case 5: - imagecopy($dest, $src, $posCol2, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom center - break; - case 6: - imagecopy($dest, $src, $posCol3, $posRow2, 0, 0, $imgWidth, $imgHeight); //bottom right - break; - } - } - imagejpeg($dest, $this->endFile); - - imagedestroy($src); - imagedestroy($dest); - } - - /** - * @return bool|string - */ - public function rotateImage() - { - // check file extension - switch ($this->imageMimetype) { - case 'image/png': - $original = imagecreatefrompng($this->sourceFile); - break; - case 'image/jpeg': - $original = imagecreatefromjpeg($this->sourceFile); - break; - case 'image/gif': - $original = imagecreatefromgif($this->sourceFile); - break; - default: - return 'Unsupported format'; - } - - if (!$original) { - return false; - } - // Rotate - $tmpimg = imagerotate($original, $this->degrees, 0); - - unlink($this->endFile); - //compressing the file - switch ($this->imageMimetype) { - case 'image/png': - if (!imagepng($tmpimg, $this->endFile, 0)) { - return false; - } - break; - case 'image/jpeg': - if (!imagejpeg($tmpimg, $this->endFile, $this->jpgQuality)) { - return false; - } - break; - case 'image/gif': - if (!imagegif($tmpimg, $this->endFile)) { - return false; - } - break; - } - - // release the memory - imagedestroy($tmpimg); - - return true; - } -} diff --git a/testdata/mymodule3/class/Common/ServerStats.php b/testdata/mymodule3/class/Common/ServerStats.php deleted file mode 100644 index 632d6e84..00000000 --- a/testdata/mymodule3/class/Common/ServerStats.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -trait ServerStats -{ - /** - * serverStats() - * - * @return string - */ - public static function getServerStats() - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - $html = ''; - // $sql = 'SELECT metavalue'; - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); - // $sql .= " WHERE metakey='version' LIMIT 1"; - // $query = $GLOBALS['xoopsDB']->query($sql); - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= '
      '; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; - $html .= "
      "; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; - // $html .= "
      "; - // $html .= "
      "; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; - $html .= '
        '; - - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; - } - } - - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - - // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; - $html .= '
      '; - $html .= '
        '; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; - $html .= '
      '; - $html .= '
      '; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; - $html .= '
      '; - $html .= '

      '; - - return $html; - } -} diff --git a/testdata/mymodule3/class/Common/VersionChecks.php b/testdata/mymodule3/class/Common/VersionChecks.php deleted file mode 100644 index 6c88d39e..00000000 --- a/testdata/mymodule3/class/Common/VersionChecks.php +++ /dev/null @@ -1,144 +0,0 @@ - - */ -trait VersionChecks -{ - /** - * Verifies XOOPS version meets minimum requirements for this module - * @static - * - * @param null|string $requiredVer - * @return bool true if meets requirements, false if not - */ - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - - //check for minimum XOOPS version - $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 - } - $success = true; - - if (version_compare($currentVer, $requiredVer, '<')) { - $success = false; - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); - } - - return $success; - } - - /** - * Verifies PHP version meets minimum requirements for this module - * @static - * - * @return bool true if meets requirements, false if not - */ - public static function checkVerPhp(\XoopsModule $module = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - // check for minimum PHP version - $success = true; - - $verNum = PHP_VERSION; - $reqVer = &$module->getInfo('min_php'); - - if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); - $success = false; - } - } - - return $success; - } - - /** - * compares current module version with latest GitHub release - * @static - * @param \Xmf\Module\Helper $helper - * @param string|null $source - * @param string|null $default - * - * @return string|array info about the latest module version, if newer - */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; - // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; - $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"]); - $curlReturn = curl_exec($curlHandle); - if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); - } elseif (mb_strpos($curlReturn, 'Not Found')) { - 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); - $latestVersion = $file[0]->tag_name; - $prerelease = $file[0]->prerelease; - if ('master' !== $latestVersionLink) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; - } - //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); - if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); - } - $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); - //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); - // $moduleVersion = '1.0'; //for testing only - // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { - $ret = []; - $ret[] = $update; - $ret[] = $latestVersionLink; - } - } - curl_close($curlHandle); - } - } - - return $ret; - } -} diff --git a/testdata/mymodule3/class/Common/index.html b/testdata/mymodule3/class/Common/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/class/Constants.php b/testdata/mymodule3/class/Constants.php deleted file mode 100644 index 60f144fa..00000000 --- a/testdata/mymodule3/class/Constants.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Constants - */ -class Constants -{ - // Constants for status - const STATUS_NONE = 0; - const STATUS_OFFLINE = 1; - const STATUS_SUBMITTED = 2; - const STATUS_APPROVED = 3; - - // Constants for permissions - const PERM_GLOBAL_NONE = 0; - const PERM_GLOBAL_VIEW = 1; - const PERM_GLOBAL_SUBMIT = 2; - const PERM_GLOBAL_APPROVE = 3; - -} diff --git a/testdata/mymodule3/class/Helper.php b/testdata/mymodule3/class/Helper.php deleted file mode 100644 index 5bb9d0e6..00000000 --- a/testdata/mymodule3/class/Helper.php +++ /dev/null @@ -1,86 +0,0 @@ -debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); - parent::__construct($moduleDirName); - } - - /** - * @param bool $debug - * - * @return \XoopsModules\Mymodule3\Helper - */ - public static function getInstance($debug = false) - { - static $instance; - if (null === $instance) { - $instance = new static($debug); - } - - return $instance; - } - - /** - * @return string - */ - public function getDirname() - { - return $this->dirname; - } - - /** - * Get an Object Handler - * - * @param string $name name of handler to load - * - * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler - */ - public function getHandler($name) - { - $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; - if (!class_exists($class)) { - throw new \RuntimeException("Class '$class' not found"); - } - /** @var \XoopsMySQLDatabase $db */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - $helper = self::getInstance(); - $ret = new $class($db, $helper); - $this->addLog("Getting handler '{$name}'"); - - return $ret; - } -} -//require __DIR__ . '/../../mainfile.php'; diff --git a/testdata/mymodule3/class/Permissions.php b/testdata/mymodule3/class/Permissions.php deleted file mode 100644 index ee855357..00000000 --- a/testdata/mymodule3/class/Permissions.php +++ /dev/null @@ -1,56 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Permissions - */ -class Permissions extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } -} diff --git a/testdata/mymodule3/class/Permissionshandler.php b/testdata/mymodule3/class/Permissionshandler.php deleted file mode 100644 index 376c8891..00000000 --- a/testdata/mymodule3/class/Permissionshandler.php +++ /dev/null @@ -1,145 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Permissionshandler - */ -class Permissionshandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - } - - /** - * @public function permGlobalApprove - * returns right for global approve - * - * @param null - * @return bool - */ - public function getPermGlobalApprove() - { - global $xoopsUser, $xoopsModule; - $currentuid = 0; - if (isset($xoopsUser) && is_object($xoopsUser)) { - if ($xoopsUser->isAdmin($xoopsModule->mid())) { - return true; - } - $currentuid = $xoopsUser->uid(); - } - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $xoopsModule->mid(); - $memberHandler = xoops_getHandler('member'); - if (0 == $currentuid) { - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; - } else { - $my_group_ids = $memberHandler->getGroupsByUser($currentuid);; - } - if ($grouppermHandler->checkRight('mymodule3_ac', 4, $my_group_ids, $mid)) { - return true; - } - return false; - } - - /** - * @public function permGlobalSubmit - * returns right for global submit - * - * @param null - * @return bool - */ - public function getPermGlobalSubmit() - { - global $xoopsUser, $xoopsModule; - $currentuid = 0; - if (isset($xoopsUser) && is_object($xoopsUser)) { - if ($xoopsUser->isAdmin($xoopsModule->mid())) { - return true; - } - $currentuid = $xoopsUser->uid(); - } - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $xoopsModule->mid(); - $memberHandler = xoops_getHandler('member'); - if (0 == $currentuid) { - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; - } else { - $my_group_ids = $memberHandler->getGroupsByUser($currentuid);; - } - if ($this->getGlobalApprove()) { - return true; - } - if ($grouppermHandler->checkRight('mymodule3_ac', 8, $my_group_ids, $mid)) { - return true; - } - return false; - } - - /** - * @public function permGlobalView - * returns right for global view - * - * @param null - * @return bool - */ - public function getPermGlobalView() - { - global $xoopsUser, $xoopsModule; - $currentuid = 0; - if (isset($xoopsUser) && is_object($xoopsUser)) { - if ($xoopsUser->isAdmin($xoopsModule->mid())) { - return true; - } - $currentuid = $xoopsUser->uid(); - } - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $xoopsModule->mid(); - $memberHandler = xoops_getHandler('member'); - if (0 == $currentuid) { - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; - } else { - $my_group_ids = $memberHandler->getGroupsByUser($currentuid);; - } - if ($this->getGlobalApprove()) { - return true; - } - if ($this->getGlobalSubmit()) { - return true; - } - if ($grouppermHandler->checkRight('mymodule3_ac', 16, $my_group_ids, $mid)) { - return true; - } - return false; - } -} diff --git a/testdata/mymodule3/class/Testfields.php b/testdata/mymodule3/class/Testfields.php deleted file mode 100644 index 27c7e1fe..00000000 --- a/testdata/mymodule3/class/Testfields.php +++ /dev/null @@ -1,368 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); - -/** - * Class Object Testfields - */ -class Testfields extends \XoopsObject -{ - /** - * Constructor - * - * @param null - */ - public function __construct() - { - $this->initVar('tf_id', XOBJ_DTYPE_INT); - $this->initVar('tf_text', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_textarea', XOBJ_DTYPE_TXTAREA); - $this->initVar('tf_dhtml', XOBJ_DTYPE_TXTAREA); - $this->initVar('tf_checkbox', XOBJ_DTYPE_INT); - $this->initVar('tf_yesno', XOBJ_DTYPE_INT); - $this->initVar('tf_selectbox', XOBJ_DTYPE_INT); - $this->initVar('tf_user', XOBJ_DTYPE_INT); - $this->initVar('tf_color', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_imagelist', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_urlfile', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_uplimage', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_uplfile', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_textdateselect', XOBJ_DTYPE_INT); - $this->initVar('tf_selectfile', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_password', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_country_list', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_language', XOBJ_DTYPE_TXTBOX); - $this->initVar('tf_radio', XOBJ_DTYPE_INT); - $this->initVar('tf_status', XOBJ_DTYPE_INT); - $this->initVar('tf_datetime', XOBJ_DTYPE_INT); - $this->initVar('tf_combobox', XOBJ_DTYPE_INT); - } - - /** - * @static function &getInstance - * - * @param null - */ - public static function getInstance() - { - static $instance = false; - if (!$instance) { - $instance = new self(); - } - } - - /** - * The new inserted $Id - * @return inserted id - */ - public function getNewInsertedIdTestfields() - { - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); - return $newInsertedId; - } - - /** - * @public function getForm - * @param bool $action - * @return \XoopsThemeForm - */ - public function getFormTestfields($action = false) - { - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - if (false === $action) { - $action = $_SERVER['REQUEST_URI']; - } - // Permissions for uploader - $grouppermHandler = xoops_getHandler('groupperm'); - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; - if ($GLOBALS['xoopsUser']) { - if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } else { - $permissionUpload = true; - } - } else { - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; - } - // Title - $title = $this->isNew() ? sprintf(_AM_MYMODULE3_TESTFIELD_ADD) : sprintf(_AM_MYMODULE3_TESTFIELD_EDIT); - // Get Theme Form - xoops_load('XoopsFormLoader'); - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - // Form Text tfText - $form->addElement(new \XoopsFormText( _AM_MYMODULE3_TESTFIELD_TEXT, 'tf_text', 50, 255, $this->getVar('tf_text') )); - // Form Editor TextArea tfTextarea - $form->addElement(new \XoopsFormTextArea( _AM_MYMODULE3_TESTFIELD_TEXTAREA, 'tf_textarea', $this->getVar('tf_textarea'), 4, 47 )); - // Form Editor DhtmlTextArea tfDhtml - $editorConfigs = []; - $editorConfigs['name'] = 'tf_dhtml'; - $editorConfigs['value'] = $this->getVar('tf_dhtml', 'e'); - $editorConfigs['rows'] = 5; - $editorConfigs['cols'] = 40; - $editorConfigs['width'] = '100%'; - $editorConfigs['height'] = '400px'; - $editorConfigs['editor'] = $helper->getConfig('editor_dhtml'); - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE3_TESTFIELD_DHTML, 'tf_dhtml', $editorConfigs)); - // Form Check Box tfCheckbox - $tfCheckbox = $this->isNew() ? 0 : $this->getVar('tf_checkbox'); - $checkTfCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_TESTFIELD_CHECKBOX, 'tf_checkbox', $tfCheckbox); - $checkTfCheckbox->addOption(1, _AM_MYMODULE3_TESTFIELD_CHECKBOX); - $form->addElement($checkTfCheckbox); - // Form Radio Yes/No tfYesno - $tfYesno = $this->isNew() ? 0 : $this->getVar('tf_yesno'); - $form->addElement(new \XoopsFormRadioYN( _AM_MYMODULE3_TESTFIELD_YESNO, 'tf_yesno', $tfYesno)); - // Testfields handler - $testfieldsHandler = $helper->getHandler('testfields'); - // Form Select tfSelectbox - $tfSelectboxSelect = new \XoopsFormSelect( _AM_MYMODULE3_TESTFIELD_SELECTBOX, 'tf_selectbox', $this->getVar('tf_selectbox')); - $tfSelectboxSelect->addOption('Empty'); - $tfSelectboxSelect->addOptionArray($testfieldsHandler->getList()); - $form->addElement($tfSelectboxSelect); - // Form Select User tfUser - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE3_TESTFIELD_USER, 'tf_user', false, $this->getVar('tf_user') )); - // Form Color Picker tfColor - $form->addElement(new \XoopsFormColorPicker( _AM_MYMODULE3_TESTFIELD_COLOR, 'tf_color', $this->getVar('tf_color') )); - // Form Frameworks Images Files tfImagelist - // Form Frameworks Images tfImagelist: Select Uploaded Image - $getTfImagelist = $this->getVar('tf_imagelist'); - $tfImagelist = $getTfImagelist ? $getTfImagelist : 'blank.gif'; - $imageDirectory = '/Frameworks/moduleclasses/icons/32'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE3_TESTFIELD_IMAGELIST, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE3_TESTFIELD_IMAGELIST_UPLOADS, ".{$imageDirectory}/"), 'tf_imagelist', $tfImagelist, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_tf_imagelist\", \"tf_imagelist\", \"" . $imageDirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form Frameworks Images tfImagelist: Upload new image - $fileSelectTray = new \XoopsFormElementTray('', '
      ' ); - $fileSelectTray->addElement(new \XoopsFormFile( _AM_MYMODULE3_FORM_UPLOAD_NEW, 'tf_imagelist', $helper->getConfig('maxsize_image') )); - $fileSelectTray->addElement(new \XoopsFormLabel('')); - $imageTray->addElement($fileSelectTray); - $form->addElement($imageTray); - // Form Url Text File tfUrlfile - $formUrlFile = new \XoopsFormElementTray(_AM_MYMODULE3_TESTFIELD_URLFILE, '

      ' ); - $formUrl = $this->isNew() ? '' : $this->getVar('tf_urlfile'); - $formText = new \XoopsFormText( _AM_MYMODULE3_TESTFIELD_URLFILE_UPLOADS, 'tf_urlfile', 75, 255, $formUrl ); - $formUrlFile->addElement($formText); - $formUrlFile->addElement(new \XoopsFormFile( _AM_MYMODULE3_FORM_UPLOAD, 'tf_urlfile', $helper->getConfig('maxsize_file') )); - $form->addElement($formUrlFile); - // Form Image tfUplimage - // Form Image tfUplimage: Select Uploaded Image - $getTfUplimage = $this->getVar('tf_uplimage'); - $tfUplimage = $getTfUplimage ? $getTfUplimage : 'blank.gif'; - $imageDirectory = '/uploads/mymodule3/images/testfields'; - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE3_TESTFIELD_UPLIMAGE, '
      ' ); - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE3_TESTFIELD_UPLIMAGE_UPLOADS, ".{$imageDirectory}/"), 'tf_uplimage', $tfUplimage, 5); - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); - foreach($imageArray as $image1) { - $imageSelect->addOption("{$image1}", $image1); - } - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_tf_uplimage\", \"tf_uplimage\", \"" . $imageDirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); - $imageTray->addElement($imageSelect, false); - $imageTray->addElement(new \XoopsFormLabel('', "
      ")); - // Form Image tfUplimage: Upload new image - if ($permissionUpload) { - $maxsize = $helper->getConfig('maxsize_image'); - $imageTray->addElement(new \XoopsFormFile( '
      ' . _AM_MYMODULE3_FORM_UPLOAD_NEW, 'tf_uplimage', $maxsize )); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE3_FORM_UPLOAD_SIZE_MB)); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); - } else { - $imageTray->addElement(new \XoopsFormHidden( 'tf_uplimage', $tfUplimage )); - } - $form->addElement($imageTray, ); - // Form File Upload tfUplfile - $tfUplfile = $this->isNew() ? '' : $this->getVar('tf_uplfile'); - if ($permissionUpload) { - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE3_TESTFIELD_UPLFILE, '
      ' ); - $fileDirectory = '/uploads/mymodule3/files/testfields'; - if (!$this->isNew()) { - $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE3_TESTFIELD_UPLFILE_UPLOADS, ".{$fileDirectory}/"), $tfUplfile)); - } - $maxsize = $helper->getConfig('maxsize_file'); - $fileUploadTray->addElement(new \XoopsFormFile( '', 'tf_uplfile', $maxsize )); - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE3_FORM_UPLOAD_SIZE_MB)); - $form->addElement($fileUploadTray, ); - } else { - $form->addElement(new \XoopsFormHidden( 'tf_uplfile', $tfUplfile )); - } - // Form Text Date Select tfTextdateselect - $tfTextdateselect = $this->isNew() ? 0 : $this->getVar('tf_textdateselect'); - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE3_TESTFIELD_TEXTDATESELECT, 'tf_textdateselect', '', $tfTextdateselect )); - // Form File tfSelectfile - // Form File tfSelectfile: Select Uploaded File - $getTfSelectfile = $this->getVar('tf_selectfile'); - $tfSelectfile = $getTfSelectfile ? $getTfSelectfile : 'blank.gif'; - $fileDirectory = '/uploads/mymodule3/files/testfields'; - $fileTray = new \XoopsFormElementTray(_AM_MYMODULE3_TESTFIELD_SELECTFILE, '
      ' ); - $fileSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE3_TESTFIELD_SELECTFILE_UPLOADS, ".{$fileDirectory}/"), 'tf_selectfile', $tfSelectfile, 5); - $fileArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $fileDirectory ); - foreach($fileArray as $file1) { - $fileSelect->addOption("{$file1}", $file1); - } - $fileTray->addElement($fileSelect, false); - // Form File tfSelectfile: Upload new file - if ($permissionUpload) { - $maxsize = $helper->getConfig('maxsize_file'); - $fileTray->addElement(new \XoopsFormFile( '
      ' . _AM_MYMODULE3_FORM_UPLOAD_NEW, 'tf_selectfile', $maxsize )); - $fileTray->addElement(new \XoopsFormLabel(_AM_MYMODULE3_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE3_FORM_UPLOAD_SIZE_MB)); - } else { - $fileTray->addElement(new \XoopsFormHidden( 'tf_selectfile', $tfSelectfile )); - } - $form->addElement($fileTray, ); - // Form Text Enter Password tfPassword - $form->addElement(new \XoopsFormPassword( _AM_MYMODULE3_TESTFIELD_PASSWORD, 'tf_password', 10, 32 )); - // Form Select Country tfCountry_list - $tfCountry_listSelect = new \XoopsFormSelect( _AM_MYMODULE3_TESTFIELD_COUNTRY_LIST, 'tf_country_list', $this->getVar('tf_country_list')); - $tfCountry_listSelect->addOption('', _NONE); - $countryArray = \XoopsLists::getCountryList(); - $tfCountry_listSelect->addOptionArray($countryArray); - $form->addElement($tfCountry_listSelect); - // Form Select Lang tfLanguage - $tfLanguageSelect = new \XoopsFormSelect( _AM_MYMODULE3_TESTFIELD_LANGUAGE, 'tf_language', $this->getVar('tf_language')); - $tfLanguageSelect->addOption('', _NONE); - $langArray = \XoopsLists::getLangList(); - $tfLanguageSelect->addOptionArray($langArray); - $form->addElement($tfLanguageSelect); - // Form Radio tfRadio - $tfRadio = $this->isNew() ? 0 : $this->getVar('tf_radio'); - $tfRadioSelect = new \XoopsFormRadio( _AM_MYMODULE3_TESTFIELD_RADIO, 'tf_radio', $tfRadio); - $tfRadioSelect->addOption('0', _NONE); - $tfRadioSelect->addOption('1', _AM_MYMODULE3_LIST_1); - $tfRadioSelect->addOption('2', _AM_MYMODULE3_LIST_2); - $tfRadioSelect->addOption('3', _AM_MYMODULE3_LIST_3); - $form->addElement($tfRadioSelect); - // Form Select Status tfStatus - $tfStatusSelect = new \XoopsFormSelect( _AM_MYMODULE3_TESTFIELD_STATUS, 'tf_status', $this->getVar('tf_status')); - $tfStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE3_STATUS_NONE); - $tfStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE3_STATUS_OFFLINE); - $tfStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE3_STATUS_SUBMITTED); - $tfStatusSelect->addOption(Constants::STATUS_APPROVED, _AM_MYMODULE3_STATUS_APPROVED); - $form->addElement($tfStatusSelect, true); - // Form Text Date Select tfDatetime - $tfDatetime = $this->isNew() ? 0 : $this->getVar('tf_datetime'); - $form->addElement(new \XoopsFormDateTime( _AM_MYMODULE3_TESTFIELD_DATETIME, 'tf_datetime', '', $tfDatetime )); - // Testfields handler - $testfieldsHandler = $helper->getHandler('testfields'); - // Form Select tfCombobox - $tfComboboxSelect = new \XoopsFormSelect( _AM_MYMODULE3_TESTFIELD_COMBOBOX, 'tf_combobox', $this->getVar('tf_combobox'), 5); - $tfComboboxSelect->addOption('0', _NONE); - $tfComboboxSelect->addOption('1', _AM_MYMODULE3_LIST_1); - $tfComboboxSelect->addOption('2', _AM_MYMODULE3_LIST_2); - $tfComboboxSelect->addOption('3', _AM_MYMODULE3_LIST_3); - $form->addElement($tfComboboxSelect); - // Permissions - $memberHandler = xoops_getHandler('member'); - $groupList = $memberHandler->getGroupList(); - $grouppermHandler = xoops_getHandler('groupperm'); - $fullList[] = array_keys($groupList); - if (!$this->isNew()) { - $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule3_approve_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsApprove[] = array_values($groupsIdsApprove); - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_APPROVE, 'groups_approve_testfields[]', $groupsIdsApprove); - $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule3_submit_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsSubmit[] = array_values($groupsIdsSubmit); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_SUBMIT, 'groups_submit_testfields[]', $groupsIdsSubmit); - $groupsIdsView = $grouppermHandler->getGroupIds('mymodule3_view_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); - $groupsIdsView[] = array_values($groupsIdsView); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_VIEW, 'groups_view_testfields[]', $groupsIdsView); - } else { - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_APPROVE, 'groups_approve_testfields[]', $fullList); - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_SUBMIT, 'groups_submit_testfields[]', $fullList); - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE3_PERMISSIONS_VIEW, 'groups_view_testfields[]', $fullList); - } - // To Approve - $groupsCanApproveCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanApproveCheckbox); - // To Submit - $groupsCanSubmitCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanSubmitCheckbox); - // To View - $groupsCanViewCheckbox->addOptionArray($groupList); - $form->addElement($groupsCanViewCheckbox); - // To Save - $form->addElement(new \XoopsFormHidden('op', 'save')); - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); - return $form; - } - - /** - * Get Values - * @param null $keys - * @param null $format - * @param null$maxDepth - * @return array - */ - public function getValuesTestfields($keys = null, $format = null, $maxDepth = null) - { - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - $ret = $this->getValues($keys, $format, $maxDepth); - $ret['id'] = $this->getVar('tf_id'); - $ret['text'] = $this->getVar('tf_text'); - $ret['textarea'] = strip_tags($this->getVar('tf_textarea')); - $ret['dhtml'] = strip_tags($this->getVar('tf_dhtml')); - $ret['checkbox'] = $this->getVar('tf_checkbox'); - $ret['yesno'] = (int)$this->getVar('tf_yesno') > 0 ? _YES : _NO; - $ret['selectbox'] = $this->getVar('tf_selectbox'); - $ret['user'] = \XoopsUser::getUnameFromId($this->getVar('tf_user')); - $ret['color'] = $this->getVar('tf_color'); - $ret['imagelist'] = $this->getVar('tf_imagelist'); - $ret['urlfile'] = $this->getVar('tf_urlfile'); - $ret['uplimage'] = $this->getVar('tf_uplimage'); - $ret['uplfile'] = $this->getVar('tf_uplfile'); - $ret['textdateselect'] = formatTimeStamp($this->getVar('tf_textdateselect'), 's'); - $ret['selectfile'] = $this->getVar('tf_selectfile'); - $ret['password'] = $this->getVar('tf_password'); - $ret['country_list'] = $this->getVar('tf_country_list'); - $ret['language'] = $this->getVar('tf_language'); - $ret['radio'] = $this->getVar('tf_radio'); - $ret['status'] = $this->getVar('tf_status'); - $ret['datetime'] = formatTimeStamp($this->getVar('tf_datetime'), 'm'); - $ret['combobox'] = $this->getVar('tf_combobox'); - return $ret; - } - - /** - * Returns an array representation of the object - * - * @return array - */ - public function toArrayTestfields() - { - $ret = []; - $vars = $this->getVars(); - foreach(array_keys($vars) as $var) { - $ret[$var] = $this->getVar('"{$var}"'); - } - return $ret; - } -} diff --git a/testdata/mymodule3/class/Testfieldshandler.php b/testdata/mymodule3/class/Testfieldshandler.php deleted file mode 100644 index 86e9bc00..00000000 --- a/testdata/mymodule3/class/Testfieldshandler.php +++ /dev/null @@ -1,124 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - - -/** - * Class Object Handler Testfields - */ -class TestfieldsHandler extends \XoopsPersistableObjectHandler -{ - /** - * Constructor - * - * @param \XoopsDatabase $db - */ - public function __construct(\XoopsDatabase $db) - { - parent::__construct($db, 'mymodule3_testfields', Testfields::class, 'tf_id', 'tf_text'); - } - - /** - * @param bool $isNew - * - * @return object - */ - public function create($isNew = true) - { - return parent::create($isNew); - } - - /** - * retrieve a field - * - * @param int $i field id - * @param null fields - * @return mixed reference to the {@link Get} object - */ - public function get($i = null, $fields = null) - { - return parent::get($i, $fields); - } - - /** - * get inserted id - * - * @param null - * @return integer reference to the {@link Get} object - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Get Count Testfields in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - public function getCountTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') - { - $crCountTestfields = new \CriteriaCompo(); - $crCountTestfields = $this->getTestfieldsCriteria($crCountTestfields, $start, $limit, $sort, $order); - return parent::getCount($crCountTestfields); - } - - /** - * Get All Testfields in the database - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return array - */ - public function getAllTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') - { - $crAllTestfields = new \CriteriaCompo(); - $crAllTestfields = $this->getTestfieldsCriteria($crAllTestfields, $start, $limit, $sort, $order); - return parent::getAll($crAllTestfields); - } - - /** - * Get Criteria Testfields - * @param $crTestfields - * @param int $start - * @param int $limit - * @param string $sort - * @param string $order - * @return int - */ - private function getTestfieldsCriteria($crTestfields, $start, $limit, $sort, $order) - { - $crTestfields->setStart( $start ); - $crTestfields->setLimit( $limit ); - $crTestfields->setSort( $sort ); - $crTestfields->setOrder( $order ); - return $crTestfields; - } -} diff --git a/testdata/mymodule3/class/Utility.php b/testdata/mymodule3/class/Utility.php deleted file mode 100644 index 3f61259a..00000000 --- a/testdata/mymodule3/class/Utility.php +++ /dev/null @@ -1,253 +0,0 @@ - - * @author Mamba - * @since - */ - -use XoopsModules\Mymodule3; - -/** - * Class Utility - */ -class Utility -{ - use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits - - use Common\ServerStats; // getServerStats Trait - - use Common\FilesManagement; // Files Management Trait - - /** - * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags - * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags - * www.cakephp.org - * - * @param string $text String to truncate. - * @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 - * - * @return string Trimmed string. - */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) - { - if ($considerHtml) { - // if the plain text is shorter than the maximum length, return the whole text - 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); - $open_tags = []; - $truncate = ''; - foreach ($lines as $line_matchings) { - // if there is any html-tag in this line, handle it and add it (uncounted) to the output - if (!empty($line_matchings[1])) { - // if it's an "empty element" with or without xhtml-conform closing slash - if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { - // do nothing - // if tag is a closing tag - } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { - // delete tag from $open_tags list - $pos = array_search($tag_matchings[1], $open_tags, true); - if (false !== $pos) { - unset($open_tags[$pos]); - } - // if tag is an opening tag - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { - // add tag to the beginning of $open_tags list - array_unshift($open_tags, mb_strtolower($tag_matchings[1])); - } - // add html-tag to $truncate'd text - $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])); - 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)) { - // 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]); - } else { - // no more characters left - break; - } - } - } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); - // maximum lenght is reached, so get off the loop - break; - } - $truncate .= $line_matchings[2]; - $total_length += $content_length; - - // if the maximum length is reached, get off the loop - if ($total_length >= $length) { - break; - } - } - } else { - if (mb_strlen($text) <= $length) { - return $text; - } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); - } - // if the words shouldn't be cut in the middle... - if (!$exact) { - // ...search the last occurance of a space... - $spacepos = mb_strrpos($truncate, ' '); - if (isset($spacepos)) { - // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); - } - } - // add the defined ending to the text - $truncate .= $ending; - if ($considerHtml) { - // close all unclosed html-tags - foreach ($open_tags as $tag) { - $truncate .= ''; - } - } - - return $truncate; - } - - /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options - * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor - */ - public static function getEditor($helper = null, $options = null) - { - /** @var Mymodule3\Helper $helper */ - if (null === $options) { - $options = []; - $options['name'] = 'Editor'; - $options['value'] = 'Editor'; - $options['rows'] = 10; - $options['cols'] = '100%'; - $options['width'] = '100%'; - $options['height'] = '400px'; - } - - $isAdmin = $helper->isUserAdmin(); - - if (class_exists('XoopsFormEditor')) { - if ($isAdmin) { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); - } else { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); - } - } else { - $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); - } - - // $form->addElement($descEditor); - - return $descEditor; - } - - //--------------- Custom module methods ----------------------------- - - /** - * @param $about - * @return string - */ - public static function MakeDonationForm($about) - { - $donationform = [ - 0 => '
      ', - 1 => '
      ' - . _AM_MYMODULE3_ABOUT_MAKE_DONATION - . '
      ' - . _AM_MYMODULE3_DONATION_AMOUNT - . '*
      ', - 2 => '
      ', - 'D' => '', - 3 => '', - 4 => ' - -', - ]; - $paypalform = [ - 0 => '
      ', - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 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; - } - } - $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); - $aboutRes .= implode("\n", $donationform); - $aboutRes .= mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1); - - return $aboutRes; - } - - /** - * @param $str - * - * @return string - */ - public static function UcFirstAndToLower($str) - { - return ucfirst(mb_strtolower(trim($str))); - } -} diff --git a/testdata/mymodule3/class/index.html b/testdata/mymodule3/class/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/class/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/config/admin.yml b/testdata/mymodule3/config/admin.yml deleted file mode 100644 index 32d9dd3d..00000000 --- a/testdata/mymodule3/config/admin.yml +++ /dev/null @@ -1 +0,0 @@ -displaySampleButton: 1 diff --git a/testdata/mymodule3/config/config.php b/testdata/mymodule3/config/config.php deleted file mode 100644 index 0a794e14..00000000 --- a/testdata/mymodule3/config/config.php +++ /dev/null @@ -1,72 +0,0 @@ - - Website: - */ - -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -return (object)[ - 'name' => mb_strtoupper($moduleDirName) . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/testfields', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/testfields', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/files/testfields', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/temp', - ], - 'copyBlankFiles' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/categories', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/articles', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images/testfields', - ], - 'copyTestFolders' => [ - XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - ], - 'templateFolders' => [ - '/templates/', - ], - 'oldFiles' => [ - ], - 'oldFolders' => [ - ], - 'renameTables' => [ - ], - 'moduleStats' => [ - ], - 'modCopyright' => "XOOPS Project", -]; diff --git a/testdata/mymodule3/config/icons.php b/testdata/mymodule3/config/icons.php deleted file mode 100644 index 0eba0bc5..00000000 --- a/testdata/mymodule3/config/icons.php +++ /dev/null @@ -1,22 +0,0 @@ - mb_strtoupper($moduleDirName) . ' IconConfigurator', - 'icons' => [ - 'edit' => " . _EDIT . ", - 'delete' => "" . _DELETE . "", - 'clone' => "" . _CLONE . "", - 'preview' => "" . _PREVIEW . "", - 'print' => "" . _CLONE . "", - 'pdf' => "" . _CLONE . "", - 'add' => "" . _ADD . "", - '0' => "" . 0 . "", - '1' => "" . 1 . "", - ], - ]; -} diff --git a/testdata/mymodule3/config/index.html b/testdata/mymodule3/config/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/config/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/config/paths.php b/testdata/mymodule3/config/paths.php deleted file mode 100644 index 2ff95a2c..00000000 --- a/testdata/mymodule3/config/paths.php +++ /dev/null @@ -1,25 +0,0 @@ - mb_strtoupper($moduleDirName) . ' PathConfigurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - ]; -} diff --git a/testdata/mymodule3/docs/changelog.txt b/testdata/mymodule3/docs/changelog.txt deleted file mode 100644 index 99104807..00000000 --- a/testdata/mymodule3/docs/changelog.txt +++ /dev/null @@ -1,4 +0,0 @@ -============================================================== -Change Log for My Module 3 - 2020/04/28 21:04:20 Version 1.0 -============================================================== - - Original release mymodule3 (TDM XOOPS) \ No newline at end of file diff --git a/testdata/mymodule3/docs/credits.txt b/testdata/mymodule3/docs/credits.txt deleted file mode 100644 index bf06b0ab..00000000 --- a/testdata/mymodule3/docs/credits.txt +++ /dev/null @@ -1,10 +0,0 @@ -Read Me First -============= - -Originally created by the TDM Team. - -Modified by Timgno (http://www.txmodxoops.org) - -Contributors: Mamba (https://xoops.org), Goffy (German Xoops) - -Included ideas for Logo Generator from Trabis (Publisher module) and Suin (Koins module) \ No newline at end of file diff --git a/testdata/mymodule3/docs/index.html b/testdata/mymodule3/docs/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/docs/install.txt b/testdata/mymodule3/docs/install.txt deleted file mode 100644 index 469bfd3a..00000000 --- a/testdata/mymodule3/docs/install.txt +++ /dev/null @@ -1,4 +0,0 @@ -Read Me First -============= - -Install just like another XOOPS module \ No newline at end of file diff --git a/testdata/mymodule3/docs/lang.diff b/testdata/mymodule3/docs/lang.diff deleted file mode 100644 index 233be6a5..00000000 --- a/testdata/mymodule3/docs/lang.diff +++ /dev/null @@ -1,7 +0,0 @@ -Legend : -+ Added -- Removed -* Modified - -To see the differences of language files, see the language folder -+ file name update language 1:59 to 1.91 \ No newline at end of file diff --git a/testdata/mymodule3/docs/license.txt b/testdata/mymodule3/docs/license.txt deleted file mode 100644 index aac9317c..00000000 --- a/testdata/mymodule3/docs/license.txt +++ /dev/null @@ -1,66 +0,0 @@ -End User License Agreement for Xoops Modules - -IMPORTANT NOTICE Read and understand this License -Agreement carefully before installing and using this Software. -It contains extremely important information. - -BY USING THIS SOFTWARE IN ANY WAY YOU ACKNOWLEDGE -THAT YOU HAVE READ, UNDERSTAND AND AGREE TO THE -TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO -THESE TERMS, DO NOT USE THIS SOFTWARE IN ANY WAY, -AND PROMPTLY RETURN IT OR DELETE ANY COPIES OF -THIS SOFTWARE IN YOUR POSSESSION. - -LICENSE GRANT the copyright holder grants you a non-exclusive -license to use this software, and any associated documentation -("The Software"), as indicated herein. - -You may install and use the Software on two computers for your use -only. - -RESTRICTIONS You MAY NOT: (a) sell or distribute this Software -package without prior written approval (b) cause or permit reverse -engineering, disassembly, decompilation or alteration of this -Software; (c) remove any product identification, copyright notices, -or other notices or proprietary restrictions from this Software; - -TERM: This License is effective until terminated. You may terminate -it at any time by destroying the Software, together with all copies -thereof. This License will also terminate if you fail to comply with any -term or condition of this Agreement. Upon such termination, you -agree to destroy the Software, together with all copies thereof. - -COPYRIGHT/OWNERSHIP This Software and its source -code are proprietary products of Pablo Software Solutions -and are protected by copyright, trade secret and other intellectual -property laws. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -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 -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 -spyware. The maker of this software does not support any -questionable forms of use where this software could be misused in -any way. - -http://www.txmodxoops.org -https://xoops.org diff --git a/testdata/mymodule3/docs/readme.txt b/testdata/mymodule3/docs/readme.txt deleted file mode 100644 index 62b1640e..00000000 --- a/testdata/mymodule3/docs/readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -Read Me First -============= - -Please make sure that you download the XOOPS Icon Set, and upload it to uploads/images directory -Read the table in admin help for the accurate description of the functionality of this module - -Using the new class xoopsrequest.php - -Version of xoops ----------------- -TDMCreate is a module that create other basic modules for CMS Xoops. - -Tested with xoops 2.5.7, you can not use it with earlier versions, unless because you do not fit some core files in the background and after some tests. - -Now that is ahead xoops versions, and goes to 2.6.0, you should download xoops 2.5.7 and use with this latest version. - -Therefore recommended not to use TDMCreate 1.91, with previous versions, to xoops 2.5.7 \ No newline at end of file diff --git a/testdata/mymodule3/footer.php b/testdata/mymodule3/footer.php deleted file mode 100644 index b22230f9..00000000 --- a/testdata/mymodule3/footer.php +++ /dev/null @@ -1,33 +0,0 @@ - - Website: - */ -if (count($xoBreadcrumbs) > 1) { - $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); -} -$GLOBALS['xoopsTpl']->assign('adv', $helper->getConfig('advertise')); -// -$GLOBALS['xoopsTpl']->assign('bookmarks', $helper->getConfig('bookmarks')); -$GLOBALS['xoopsTpl']->assign('fbcomments', $helper->getConfig('fbcomments')); -// -$GLOBALS['xoopsTpl']->assign('admin', MYMODULE3_ADMIN); -$GLOBALS['xoopsTpl']->assign('copyright', $copyright); -// -include_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/testdata/mymodule3/header.php b/testdata/mymodule3/header.php deleted file mode 100644 index bc45877e..00000000 --- a/testdata/mymodule3/header.php +++ /dev/null @@ -1,56 +0,0 @@ - - Website: - */ -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include __DIR__ . '/include/common.php'; -$moduleDirName = basename(__DIR__); -// Breadcrumbs -$xoBreadcrumbs = []; -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_TITLE, 'link' => MYMODULE3_URL . '/']; -// Get instance of module -$helper = \XoopsModules\Mymodule3\Helper::getInstance(); -$categoriesHandler = $helper->getHandler('categories'); -$articlesHandler = $helper->getHandler('articles'); -$testfieldsHandler = $helper->getHandler('testfields'); -// Permission -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -$grouppermHandler = xoops_getHandler('groupperm'); -if (is_object($xoopsUser)) { - $groups = $xoopsUser->getGroups(); -} else { - $groups = XOOPS_GROUP_ANONYMOUS; -} -// -$myts = MyTextSanitizer::getInstance(); -// Default Css Style -$style = MYMODULE3_URL . '/assets/css/style.css'; -if (!file_exists($style)) { - return false; -} -// Smarty Default -$sysPathIcon16 = $GLOBALS['xoopsModule']->getInfo('sysicons16'); -$sysPathIcon32 = $GLOBALS['xoopsModule']->getInfo('sysicons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -$modPathIcon16 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -$modPathIcon32 = $GLOBALS['xoopsModule']->getInfo('modicons16'); -// Load Languages -xoops_loadLanguage('main'); -xoops_loadLanguage('modinfo'); diff --git a/testdata/mymodule3/include/comment_functions.php b/testdata/mymodule3/include/comment_functions.php deleted file mode 100644 index e2caeaec..00000000 --- a/testdata/mymodule3/include/comment_functions.php +++ /dev/null @@ -1,53 +0,0 @@ - - Website: - */ - -/** - * CommentsUpdate - * - * @param mixed $itemId - * @param mixed $itemNumb - * @return bool - */ -function mymodule3CommentsUpdate($itemId, $itemNumb) -{ - $itemId = (int)$itemId; - $itemNumb = (int)$itemNumb; - $article = new Mymodule3Testfields($itemId); - if (!$article->updateComments($itemNumb)) { - return false; - } - return true; -} - -/** - * CommentsApprove - * - * @param mixed $comment - * @return bool - */ -function mymodule3CommentsApprove(&$comment) -{ - // notification mail here - - return false; - -} diff --git a/testdata/mymodule3/include/comment_new.php b/testdata/mymodule3/include/comment_new.php deleted file mode 100644 index e3b64a10..00000000 --- a/testdata/mymodule3/include/comment_new.php +++ /dev/null @@ -1,30 +0,0 @@ - - Website: - */ -include __DIR__ . '/../../../mainfile.php'; -include_once XOOPS_ROOT_PATH.'/modules/mymodule3/class/testfields.php'; -$com_itemid = isset($_REQUEST['com_itemid']) ? (int)$_REQUEST['com_itemid'] : 0; -if ($com_itemid > 0) { - $testfieldsHandler = xoops_getModuleHandler('testfields', 'mymodule3'); - $testfields = $testfieldsHandler->get($com_itemid); - $com_replytitle = $testfields->getVar('tf_text'); - include XOOPS_ROOT_PATH.'/include/comment_new.php'; -} \ No newline at end of file diff --git a/testdata/mymodule3/include/common.php b/testdata/mymodule3/include/common.php deleted file mode 100644 index 129ce501..00000000 --- a/testdata/mymodule3/include/common.php +++ /dev/null @@ -1,49 +0,0 @@ - - Website: - */ -if (!defined('XOOPS_ICONS32_PATH')) { - 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('MYMODULE3_DIRNAME', 'mymodule3'); -define('MYMODULE3_PATH', XOOPS_ROOT_PATH.'/modules/'.MYMODULE3_DIRNAME); -define('MYMODULE3_URL', XOOPS_URL.'/modules/'.MYMODULE3_DIRNAME); -define('MYMODULE3_ICONS_PATH', MYMODULE3_PATH.'/assets/icons'); -define('MYMODULE3_ICONS_URL', MYMODULE3_URL.'/assets/icons'); -define('MYMODULE3_IMAGE_PATH', MYMODULE3_PATH.'/assets/images'); -define('MYMODULE3_IMAGE_URL', MYMODULE3_URL.'/assets/images'); -define('MYMODULE3_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.MYMODULE3_DIRNAME); -define('MYMODULE3_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.MYMODULE3_DIRNAME); -define('MYMODULE3_UPLOAD_FILES_PATH', MYMODULE3_UPLOAD_PATH.'/files'); -define('MYMODULE3_UPLOAD_FILES_URL', MYMODULE3_UPLOAD_URL.'/files'); -define('MYMODULE3_UPLOAD_IMAGE_PATH', MYMODULE3_UPLOAD_PATH.'/images'); -define('MYMODULE3_UPLOAD_IMAGE_URL', MYMODULE3_UPLOAD_URL.'/images'); -define('MYMODULE3_UPLOAD_SHOTS_PATH', MYMODULE3_UPLOAD_PATH.'/images/shots'); -define('MYMODULE3_UPLOAD_SHOTS_URL', MYMODULE3_UPLOAD_URL.'/images/shots'); -define('MYMODULE3_ADMIN', MYMODULE3_URL . '/admin/index.php'); -$localLogo = MYMODULE3_IMAGE_URL . '/tdmxoops_logo.png'; -// Module Information -$copyright = "XOOPS Project"; -include_once XOOPS_ROOT_PATH . '/class/xoopsrequest.php'; -include_once MYMODULE3_PATH . '/class/helper.php'; -include_once MYMODULE3_PATH . '/include/functions.php'; diff --git a/testdata/mymodule3/include/functions.php b/testdata/mymodule3/include/functions.php deleted file mode 100644 index 0ed8643f..00000000 --- a/testdata/mymodule3/include/functions.php +++ /dev/null @@ -1,239 +0,0 @@ - - Website: - */ - -/** - * function add selected cats to block - * - * @param $cats - * @return string - */ -function mymodule3_block_addCatSelect($cats) -{ - $cat_sql = '('; - if (is_array($cats)) { - $cat_sql .= current($cats); - array_shift($cats); - foreach($cats as $cat) { - $cat_sql .= ',' . $cat; - } - } - $cat_sql .= ')'; - return $cat_sql; -} - -/** - * Get the permissions ids - * - * @param $permtype - * @param $dirname - * @return mixed $itemIds - */ -function mymodule3GetMyItemIds($permtype, $dirname) -{ - global $xoopsUser; - static $permissions = []; - if (is_array($permissions) && array_key_exists($permtype, $permissions)) { - return $permissions[$permtype]; - } - $moduleHandler = xoops_getHandler('module'); - $mymodule3Module = $moduleHandler->getByDirname($dirname); - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $grouppermHandler = xoops_getHandler('groupperm'); - $itemIds = $grouppermHandler->getItemIds($permtype, $groups, $mymodule3Module->getVar('mid')); - return $itemIds; -} - -/** - * Get the number of testfields from the sub categories of a category or sub topics of or topic - * @param $mytree - * @param $testfields - * @param $entries - * @param $cid - * @return int - */ -function mymodule3NumbersOfEntries($mytree, $testfields, $entries, $cid) -{ - $count = 0; - if(in_array($cid, $testfields)) { - $child = $mytree->getAllChild($cid); - foreach (array_keys($entries) as $i) { - if ($entries[$i]->getVar('tf_id') == $cid){ - $count++; - } - foreach (array_keys($child) as $j) { - if ($entries[$i]->getVar('tf_id') == $j){ - $count++; - } - } - } - } - return $count; -} - -/** - * Add content as meta tag to template - * @param $content - * @return void - */ - -function mymodule3MetaKeywords($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)); - } -} - -/** - * Add content as meta description to template - * @param $content - * @return void - */ - -function mymodule3MetaDescription($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)); - } -} - -/** - * 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 mymodule3_RewriteUrl($module, $array, $type = 'content') -{ - $comment = ''; - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - $testfieldsHandler = $helper->getHandler('testfields'); - $lenght_id = $helper->getConfig('lenght_id'); - $rewrite_url = $helper->getConfig('rewrite_url'); - - if ($lenght_id != 0) { - $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 = mymodule3_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 ($type === 'content/') { - $type = ''; - } - if ($type === 'comment-edit/' || $type === 'comment-reply/' || $type === 'comment-delete/') { - 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 ($type === 'content/') { - $type = ''; - } - if ($type === 'comment-edit/' || $type === 'comment-reply/' || $type === 'comment-delete/') { - 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; -} -/** - * 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 mymodule3_Filter($url, $type = '') { - - // Get regular expression from module setting. default setting is : `[^a-z0-9]`i - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - $testfieldsHandler = $helper->getHandler('testfields'); - $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(array($regular_expression, "`[-]+`"), '-', $url); - $url = ($url == '') ? $type : strtolower(trim($url, '-')); - return $url; -} \ No newline at end of file diff --git a/testdata/mymodule3/include/index.html b/testdata/mymodule3/include/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/include/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/include/install.php b/testdata/mymodule3/include/install.php deleted file mode 100644 index 6ac01177..00000000 --- a/testdata/mymodule3/include/install.php +++ /dev/null @@ -1,95 +0,0 @@ - - Website: XOOPS Project (www.xoops.org) $ - */ - -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Common; - -/** - * @param \XoopsModule $module - * @return bool - */ -function xoops_module_pre_install_mymodule3(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var Mymodule3\Utility $utility */ - $utility = new Mymodule3\Utility(); - - //check for minimum XOOPS version - $xoopsSuccess = $utility::checkVerXoops($module); - - // check for minimum PHP version - $phpSuccess = $utility::checkVerPhp($module); - - if (false !== $xoopsSuccess && false !== $phpSuccess) { - $moduleTables = &$module->getInfo('tables'); - foreach ($moduleTables as $table) { - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); - } - } - - return $xoopsSuccess && $phpSuccess; -} - -/** - * @param \XoopsModule $module - * @return bool|string - */ -function xoops_module_install_mymodule3(\XoopsModule $module) -{ - require dirname(__DIR__) . '/preloads/autoloader.php'; - - /** @var Mymodule3\Helper $helper */ - /** @var Mymodule3\Utility $utility */ - /** @var Common\Configurator $configurator */ - $helper = Mymodule3\Helper::getInstance(); - $utility = new Mymodule3\Utility(); - $configurator = new Common\Configurator(); - - // Load language files - $helper->loadLanguage('admin'); - $helper->loadLanguage('modinfo'); - $helper->loadLanguage('common'); - - // --- CREATE FOLDERS --------------- - if ($configurator->uploadFolders && is_array($configurator->uploadFolders)) { - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - foreach (array_keys($configurator->uploadFolders) as $i) { - $utility::createFolder($configurator->uploadFolders[$i]); - } - } - - // --- COPY blank.gif FILES --------------- - if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $file = dirname(__DIR__) . '/assets/images/blank.gif'; - foreach (array_keys($configurator->copyBlankFiles) as $i) { - $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; -} diff --git a/testdata/mymodule3/include/notifications.inc.php b/testdata/mymodule3/include/notifications.inc.php deleted file mode 100644 index db0b29f6..00000000 --- a/testdata/mymodule3/include/notifications.inc.php +++ /dev/null @@ -1,62 +0,0 @@ - - Website: - */ - -/** - * comment callback functions - * - * @param $category - * @param $item_id - * @return array item|null - */ -function mymodule3_notify_iteminfo($category, $item_id) -{ - global $xoopsDB; - - if (!defined('MYMODULE3_URL')) { - define('MYMODULE3_URL', XOOPS_URL . '/modules/mymodule3'); - } - - switch($category) { - case 'global': - $item['name'] = ''; - $item['url'] = ''; - return $item; - break; - case 'articles': - $sql = 'SELECT art_title FROM ' . $xoopsDB->prefix('mymodule3_articles') . ' WHERE art_id = '. $item_id; - $result = $xoopsDB->query($sql); - $result_array = $xoopsDB->fetchArray($result); - $item['name'] = $result_array['art_title']; - $item['url'] = MYMODULE3_URL . '/articles.php?art_id=' . $item_id; - return $item; - break; - case 'testfields': - $sql = 'SELECT tf_text FROM ' . $xoopsDB->prefix('mymodule3_testfields') . ' WHERE tf_id = '. $item_id; - $result = $xoopsDB->query($sql); - $result_array = $xoopsDB->fetchArray($result); - $item['name'] = $result_array['tf_text']; - $item['url'] = MYMODULE3_URL . '/testfields.php?tf_id=' . $item_id; - return $item; - break; - } - return null; -} diff --git a/testdata/mymodule3/include/search.inc.php b/testdata/mymodule3/include/search.inc.php deleted file mode 100644 index 51bc8d96..00000000 --- a/testdata/mymodule3/include/search.inc.php +++ /dev/null @@ -1,146 +0,0 @@ - - Website: - */ - -use XoopsModules\Mymodule3; - - -/** - * search callback functions - * - * @param $queryarray - * @param $andor - * @param $limit - * @param $offset - * @param $userid - * @return mixed $itemIds - */ -function mymodule3_search($queryarray, $andor, $limit, $offset, $userid) -{ - $ret = []; - $helper = \XoopsModules\Mymodule3\Helper::getInstance(); - - // search in table articles - // search keywords - $elementCount = 0; - $articlesHandler = $helper->getHandler('articles'); - if (is_array($queryarray)) { - $elementCount = count($queryarray); - } - if ($elementCount > 0) { - $criteriaKeywords = new \CriteriaCompo(); - for($i = 0; $i < $elementCount; $i++) { - $criteriaKeyword = new \CriteriaCompo(); - $criteriaKeyword->add( new \Criteria( 'art_cat', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' ); - $criteriaKeyword->add( new \Criteria( 'art_title', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' ); - $criteriaKeyword->add( new \Criteria( 'art_descr', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' ); - $criteriaKeywords->add( $criteriaKeyword, $andor ); - unset($criteriaKeyword); - } - } - // search user(s) - if ($userid && is_array($userid)) { - $userid = array_map('intval', $userid); - $criteriaUser = new \CriteriaCompo(); - $criteriaUser->add( new \Criteria( 'art_submitter', '(' . implode(',', $userid) . ')', 'IN' ), 'OR' ); - } elseif (is_numeric($userid) && $userid > 0) { - $criteriaUser = new \CriteriaCompo(); - $criteriaUser->add( new \Criteria( 'art_submitter', $userid ), 'OR' ); - } - $criteriaSearch = new \CriteriaCompo(); - if (isset($criteriaKeywords)) { - $criteriaSearch->add( $criteriaKeywords, 'AND' ); - } - if (isset($criteriaUser)) { - $criteriaSearch->add( $criteriaUser, 'AND' ); - } - $criteriaSearch->setStart( $offset ); - $criteriaSearch->setLimit( $limit ); - $criteriaSearch->setSort( 'art_created' ); - $criteriaSearch->setOrder( 'DESC' ); - $articlesAll = $articlesHandler->getAll($criteriaSearch); - foreach(array_keys($articlesAll) as $i) { - $ret[] = [ - 'image' => 'assets/icons/16/articles.png', - 'link' => 'articles.php?op=show&art_id=' . $articlesAll[$i]->getVar('art_id'), - 'title' => $articlesAll[$i]->getVar('art_title'), - 'time' => $articlesAll[$i]->getVar('art_created') - ]; - } - unset($criteriaKeywords); - unset($criteriaKeyword); - unset($criteriaUser); - unset($criteriaSearch); - - // search in table testfields - // search keywords - $elementCount = 0; - $testfieldsHandler = $helper->getHandler('testfields'); - if (is_array($queryarray)) { - $elementCount = count($queryarray); - } - if ($elementCount > 0) { - $criteriaKeywords = new \CriteriaCompo(); - for($i = 0; $i < $elementCount; $i++) { - $criteriaKeyword = new \CriteriaCompo(); - $criteriaKeyword->add( new \Criteria( 'tf_text', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' ); - $criteriaKeyword->add( new \Criteria( 'tf_textarea', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' ); - $criteriaKeywords->add( $criteriaKeyword, $andor ); - unset($criteriaKeyword); - } - } - // search user(s) - if ($userid && is_array($userid)) { - $userid = array_map('intval', $userid); - $criteriaUser = new \CriteriaCompo(); - $criteriaUser->add( new \Criteria( 'tf_submitter', '(' . implode(',', $userid) . ')', 'IN' ), 'OR' ); - } elseif (is_numeric($userid) && $userid > 0) { - $criteriaUser = new \CriteriaCompo(); - $criteriaUser->add( new \Criteria( 'tf_submitter', $userid ), 'OR' ); - } - $criteriaSearch = new \CriteriaCompo(); - if (isset($criteriaKeywords)) { - $criteriaSearch->add( $criteriaKeywords, 'AND' ); - } - if (isset($criteriaUser)) { - $criteriaSearch->add( $criteriaUser, 'AND' ); - } - $criteriaSearch->setStart( $offset ); - $criteriaSearch->setLimit( $limit ); - $criteriaSearch->setSort( 'tf_datetime' ); - $criteriaSearch->setOrder( 'DESC' ); - $testfieldsAll = $testfieldsHandler->getAll($criteriaSearch); - foreach(array_keys($testfieldsAll) as $i) { - $ret[] = [ - 'image' => 'assets/icons/16/testfields.png', - 'link' => 'testfields.php?op=show&tf_id=' . $testfieldsAll[$i]->getVar('tf_id'), - 'title' => $testfieldsAll[$i]->getVar('tf_text'), - 'time' => $testfieldsAll[$i]->getVar('tf_datetime') - ]; - } - unset($criteriaKeywords); - unset($criteriaKeyword); - unset($criteriaUser); - unset($criteriaSearch); - - return $ret; - -} diff --git a/testdata/mymodule3/include/uninstall.php b/testdata/mymodule3/include/uninstall.php deleted file mode 100644 index 427d2ac6..00000000 --- a/testdata/mymodule3/include/uninstall.php +++ /dev/null @@ -1,78 +0,0 @@ -loadLanguage('admin'); - - //------------------------------------------------------------------ - // Remove uploads folder (and all subfolders) if they exist - //------------------------------------------------------------------ - - $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; - } - } - unset($dirInfo); - } - /* - //------------ START ---------------- - //------------------------------------------------------------------ - // Remove xsitemap.xml from XOOPS root folder if it exists - //------------------------------------------------------------------ - $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); - if (is_file($xmlfile)) { - if (false === ($delOk = unlink($xmlfile))) { - $module->setErrors(sprintf(_AM_MYMODULE3_ERROR_BAD_REMOVE, $xmlfile)); - } - } -// return $success && $delOk; // use this if you're using this routine -*/ - - return $success; - //------------ END ---------------- -} diff --git a/testdata/mymodule3/include/update.php b/testdata/mymodule3/include/update.php deleted file mode 100644 index 59294305..00000000 --- a/testdata/mymodule3/include/update.php +++ /dev/null @@ -1,154 +0,0 @@ - - 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 - */ - -/** - * @param $module - * @param null $prev_version - * - * @return bool|null - */ -function xoops_module_update_mymodule3(&$module, $prev_version = null) -{ - $ret = null; - if ($prev_version < 10) { - $ret = update_mymodule3_v10($module); - } - - $ret = mymodule3_check_db($module); - - //check upload directory - include_once __DIR__ . '/install.php'; - $ret = xoops_module_install_mymodule3($module); - - $errors = $module->getErrors(); - if (!empty($errors)) { - print_r($errors); - } - - return $ret; - -} - -// irmtfan bug fix: solve templates duplicate issue -/** - * @param $module - * - * @return bool - */ -function update_mymodule3_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 (false !== (list($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 - * - * @return bool - */ -function mymodule3_check_db($module) -{ - $ret = true; - //insert here code for database check - - /* - // Example: update table (add new field) - $table = $GLOBALS['xoopsDB']->prefix('mymodule3_images'); - $field = 'img_exif'; - $check = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if (!$numRows) { - $sql = "ALTER TABLE `$table` ADD `$field` TEXT NULL AFTER `img_state`;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); - $module->setErrors("Error when adding '$field' to table '$table'."); - $ret = false; - } - } - - // Example: create new table - $table = $GLOBALS['xoopsDB']->prefix('mymodule3_categories'); - $check = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'"); - $numRows = $GLOBALS['xoopsDB']->getRowsNum($check); - if (!$numRows) { - // create new table 'mymodule3_categories' - $sql = "CREATE TABLE `$table` ( - `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `cat_text` VARCHAR(100) NOT NULL DEFAULT '', - `cat_date` INT(8) NOT NULL DEFAULT '0', - `cat_submitter` INT(8) NOT NULL DEFAULT '0', - PRIMARY KEY (`cat_id`) - ) ENGINE=InnoDB;"; - if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - xoops_error($GLOBALS['xoopsDB']->error() . '
      ' . $sql); - $module->setErrors("Error when creating table '$table'."); - $ret = false; - } - } - */ - return $ret; -} diff --git a/testdata/mymodule3/include/xoops_version.inc.php b/testdata/mymodule3/include/xoops_version.inc.php deleted file mode 100644 index 817222c8..00000000 --- a/testdata/mymodule3/include/xoops_version.inc.php +++ /dev/null @@ -1,40 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule3_index.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = []; -// -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); -// -$articlesCount = $articlesHandler->getCountArticles(); -$GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); -$count = 1; -if ($articlesCount > 0) { - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('userpager')); - $articlesAll = $articlesHandler->getAllArticles($start, $limit); - // Get All Articles - $articles = []; - foreach(array_keys($articlesAll) as $i) { - $article = $articlesAll[$i]->getValuesArticles(); - $acount = ['count', $count]; - $articles[] = array_merge($article, $acount); - $keywords[] = $articlesAll[$i]->getVar('tf_text'); - ++$count; - } - $GLOBALS['xoopsTpl']->assign('articles', $articles); - unset($articles); - // Display Navigation - if ($articlesCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE3_INDEX_THEREARE, $articlesCount)); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} -unset($count); -$GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); -// -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); -// -$testfieldsCount = $testfieldsHandler->getCountTestfields(); -$GLOBALS['xoopsTpl']->assign('testfieldsCount', $testfieldsCount); -$count = 1; -if ($testfieldsCount > 0) { - $start = Request::getInt('start', 0); - $limit = Request::getInt('limit', $helper->getConfig('userpager')); - $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); - // Get All Testfields - $testfields = []; - foreach(array_keys($testfieldsAll) as $i) { - $testfield = $testfieldsAll[$i]->getValuesTestfields(); - $acount = ['count', $count]; - $testfields[] = array_merge($testfield, $acount); - $keywords[] = $testfieldsAll[$i]->getVar('tf_text'); - ++$count; - } - $GLOBALS['xoopsTpl']->assign('testfields', $testfields); - unset($testfields); - // Display Navigation - if ($testfieldsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE3_INDEX_THEREARE, $testfieldsCount)); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} -unset($count); -$GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_INDEX]; -// Keywords -mymodule3MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// Description -mymodule3MetaDescription(_MA_MYMODULE3_INDEX_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE3_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/language/english/admin.php b/testdata/mymodule3/language/english/admin.php deleted file mode 100644 index 7b2c562a..00000000 --- a/testdata/mymodule3/language/english/admin.php +++ /dev/null @@ -1,142 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Index ---------------- -define('_AM_MYMODULE3_STATISTICS', 'Statistics'); -// There are -define('_AM_MYMODULE3_THEREARE_CATEGORIES', "There are %s categories in the database"); -define('_AM_MYMODULE3_THEREARE_ARTICLES', "There are %s articles in the database"); -define('_AM_MYMODULE3_THEREARE_TESTFIELDS', "There are %s testfields in the database"); -// ---------------- Admin Files ---------------- -// There aren't -define('_AM_MYMODULE3_THEREARENT_CATEGORIES', "There aren't categories"); -define('_AM_MYMODULE3_THEREARENT_ARTICLES', "There aren't articles"); -define('_AM_MYMODULE3_THEREARENT_TESTFIELDS', "There aren't testfields"); -// Save/Delete -define('_AM_MYMODULE3_FORM_OK', 'Successfully saved'); -define('_AM_MYMODULE3_FORM_DELETE_OK', 'Successfully deleted'); -define('_AM_MYMODULE3_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_AM_MYMODULE3_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Buttons -define('_AM_MYMODULE3_ADD_CATEGORY', 'Add New Category'); -define('_AM_MYMODULE3_ADD_ARTICLE', 'Add New Article'); -define('_AM_MYMODULE3_ADD_TESTFIELD', 'Add New Testfield'); -// Lists -define('_AM_MYMODULE3_CATEGORIES_LIST', 'List of Categories'); -define('_AM_MYMODULE3_ARTICLES_LIST', 'List of Articles'); -define('_AM_MYMODULE3_TESTFIELDS_LIST', 'List of Testfields'); -// ---------------- Admin Classes ---------------- -// Category add/edit -define('_AM_MYMODULE3_CATEGORY_ADD', 'Add Category'); -define('_AM_MYMODULE3_CATEGORY_EDIT', 'Edit Category'); -// Elements of Category -define('_AM_MYMODULE3_CATEGORY_ID', 'Id'); -define('_AM_MYMODULE3_CATEGORY_NAME', 'Name'); -define('_AM_MYMODULE3_CATEGORY_LOGO', 'Logo'); -define('_AM_MYMODULE3_CATEGORY_LOGO_UPLOADS', 'Logo in %s :'); -define('_AM_MYMODULE3_CATEGORY_CREATED', 'Created'); -define('_AM_MYMODULE3_CATEGORY_SUBMITTER', 'Submitter'); -// Article add/edit -define('_AM_MYMODULE3_ARTICLE_ADD', 'Add Article'); -define('_AM_MYMODULE3_ARTICLE_EDIT', 'Edit Article'); -// Elements of Article -define('_AM_MYMODULE3_ARTICLE_ID', 'Id'); -define('_AM_MYMODULE3_ARTICLE_CAT', 'Categories'); -define('_AM_MYMODULE3_ARTICLE_TITLE', 'Title'); -define('_AM_MYMODULE3_ARTICLE_DESCR', 'Descr'); -define('_AM_MYMODULE3_ARTICLE_IMG', 'Img'); -define('_AM_MYMODULE3_ARTICLE_IMG_UPLOADS', 'Img in %s :'); -define('_AM_MYMODULE3_ARTICLE_ONLINE', 'Online'); -define('_AM_MYMODULE3_ARTICLE_FILE', 'File'); -define('_AM_MYMODULE3_ARTICLE_FILE_UPLOADS', 'File in %s :'); -define('_AM_MYMODULE3_ARTICLE_CREATED', 'Created'); -define('_AM_MYMODULE3_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield add/edit -define('_AM_MYMODULE3_TESTFIELD_ADD', 'Add Testfield'); -define('_AM_MYMODULE3_TESTFIELD_EDIT', 'Edit Testfield'); -// Elements of Testfield -define('_AM_MYMODULE3_TESTFIELD_ID', 'Id'); -define('_AM_MYMODULE3_TESTFIELD_TEXT', 'Text'); -define('_AM_MYMODULE3_TESTFIELD_TEXTAREA', 'Textarea'); -define('_AM_MYMODULE3_TESTFIELD_DHTML', 'Dhtml'); -define('_AM_MYMODULE3_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_AM_MYMODULE3_TESTFIELD_YESNO', 'Yesno'); -define('_AM_MYMODULE3_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_AM_MYMODULE3_TESTFIELD_USER', 'User'); -define('_AM_MYMODULE3_TESTFIELD_COLOR', 'Color'); -define('_AM_MYMODULE3_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_AM_MYMODULE3_TESTFIELD_IMAGELIST_UPLOADS', 'Imagelist in frameworks images: %s'); -define('_AM_MYMODULE3_TESTFIELD_URLFILE', 'Urlfile'); -define('_AM_MYMODULE3_TESTFIELD_URLFILE_UPLOADS', 'Urlfile in uploads'); -define('_AM_MYMODULE3_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_AM_MYMODULE3_TESTFIELD_UPLIMAGE_UPLOADS', 'Uplimage in %s :'); -define('_AM_MYMODULE3_TESTFIELD_UPLFILE', 'Uplfile'); -define('_AM_MYMODULE3_TESTFIELD_UPLFILE_UPLOADS', 'Uplfile in %s :'); -define('_AM_MYMODULE3_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_AM_MYMODULE3_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_AM_MYMODULE3_TESTFIELD_SELECTFILE_UPLOADS', 'Selectfile in %s :'); -define('_AM_MYMODULE3_TESTFIELD_PASSWORD', 'Password'); -define('_AM_MYMODULE3_TESTFIELD_COUNTRY_LIST', 'SelectCountry'); -define('_AM_MYMODULE3_TESTFIELD_LANGUAGE', 'SelectLang'); -define('_AM_MYMODULE3_TESTFIELD_RADIO', 'Radio'); -define('_AM_MYMODULE3_TESTFIELD_STATUS', 'Status'); -define('_AM_MYMODULE3_TESTFIELD_DATETIME', 'DateTime'); -define('_AM_MYMODULE3_TESTFIELD_COMBOBOX', 'SelectCombo'); -// General -define('_AM_MYMODULE3_FORM_UPLOAD', 'Upload file'); -define('_AM_MYMODULE3_FORM_UPLOAD_NEW', 'Upload new file: '); -define('_AM_MYMODULE3_FORM_UPLOAD_SIZE', 'Max file size: '); -define('_AM_MYMODULE3_FORM_UPLOAD_SIZE_MB', 'MB'); -define('_AM_MYMODULE3_FORM_UPLOAD_IMG_WIDTH', 'Max image width: '); -define('_AM_MYMODULE3_FORM_UPLOAD_IMG_HEIGHT', 'Max image height: '); -define('_AM_MYMODULE3_FORM_IMAGE_PATH', 'Files in %s :'); -define('_AM_MYMODULE3_FORM_ACTION', 'Action'); -define('_AM_MYMODULE3_FORM_EDIT', 'Modification'); -define('_AM_MYMODULE3_FORM_DELETE', 'Clear'); -// Status -define('_AM_MYMODULE3_STATUS_NONE', 'No status'); -define('_AM_MYMODULE3_STATUS_OFFLINE', 'Offline'); -define('_AM_MYMODULE3_STATUS_SUBMITTED', 'Submitted'); -define('_AM_MYMODULE3_STATUS_APPROVED', 'Approved'); -// Sample List Values -define('_AM_MYMODULE3_LIST_1', 'Sample List Value 1'); -define('_AM_MYMODULE3_LIST_2', 'Sample List Value 2'); -define('_AM_MYMODULE3_LIST_3', 'Sample List Value 3'); -// ---------------- Admin Permissions ---------------- -// Permissions -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL', 'Permissions global'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_16', 'Permissions global to view'); -define('_AM_MYMODULE3_PERMISSIONS_APPROVE', 'Permissions to approve'); -define('_AM_MYMODULE3_PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); -define('_AM_MYMODULE3_PERMISSIONS_SUBMIT', 'Permissions to submit'); -define('_AM_MYMODULE3_PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); -define('_AM_MYMODULE3_PERMISSIONS_VIEW', 'Permissions to view'); -define('_AM_MYMODULE3_PERMISSIONS_VIEW_DESC', 'Permissions to view'); -define('_AM_MYMODULE3_NO_PERMISSIONS_SET', 'No permission set'); -// ---------------- Admin Others ---------------- -define('_AM_MYMODULE3_MAINTAINEDBY', ' is maintained by '); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/english/blocks.php b/testdata/mymodule3/language/english/blocks.php deleted file mode 100644 index 8a21e7e9..00000000 --- a/testdata/mymodule3/language/english/blocks.php +++ /dev/null @@ -1,40 +0,0 @@ - - Website: - */ -// Admin Edit -define('_MB_MYMODULE3_DISPLAY', 'How Many Tables to Display'); -define('_MB_MYMODULE3_TITLE_LENGTH', 'Title Length'); -define('_MB_MYMODULE3_CATTODISPLAY', 'Categories to Display'); -define('_MB_MYMODULE3_ALLCAT', 'All Categories'); -// Articles -define('_MB_MYMODULE3_ARTICLES_TO_DISPLAY', 'Articles to Display'); -define('_MB_MYMODULE3_ALL_ARTICLES', 'All Articles'); -define('_MB_MYMODULE3_ART_CAT', 'Cat'); -define('_MB_MYMODULE3_ART_TITLE', 'Title'); -define('_MB_MYMODULE3_ART_DESCR', 'Descr'); -define('_MB_MYMODULE3_ART_IMG', 'Img'); -define('_MB_MYMODULE3_ART_FILE', 'File'); -define('_MB_MYMODULE3_ART_CREATED', 'Created'); -define('_MB_MYMODULE3_ART_SUBMITTER', 'Submitter'); -// Testfields -define('_MB_MYMODULE3_TESTFIELDS_TO_DISPLAY', 'Testfields to Display'); -define('_MB_MYMODULE3_ALL_TESTFIELDS', 'All Testfields'); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/english/common.php b/testdata/mymodule3/language/english/common.php deleted file mode 100644 index 214982f0..00000000 --- a/testdata/mymodule3/language/english/common.php +++ /dev/null @@ -1,183 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/testdata/mymodule3/language/english/feedback.php b/testdata/mymodule3/language/english/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/testdata/mymodule3/language/english/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/testdata/mymodule3/language/english/help/help.html b/testdata/mymodule3/language/english/help/help.html deleted file mode 100644 index e3b73b94..00000000 --- a/testdata/mymodule3/language/english/help/help.html +++ /dev/null @@ -1,27 +0,0 @@ -
      -

      Help: - My Module 3 Back to the Administration of My Module 3 -

      - -

      Description

      -

      - The My Module 3 module can be used to modules in XOOPS

      -

      -

      Install/uninstall

      -

      -No special measures necessary, follow the standard installation process and extract the mymodule3 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 TDMCreate 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 -

      - -
      \ No newline at end of file diff --git a/testdata/mymodule3/language/english/help/index.html b/testdata/mymodule3/language/english/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/english/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/language/english/index.html b/testdata/mymodule3/language/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/language/english/mail_template/category_new_notify.tpl b/testdata/mymodule3/language/english/mail_template/category_new_notify.tpl deleted file mode 100644 index 15071a28..00000000 --- a/testdata/mymodule3/language/english/mail_template/category_new_notify.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, - -A new story "{STORY_NAME}" has been added at {X_SITENAME}. - -You can view this story here: -{STORY_URL} - ------------ - -You are receiving this message because you selected to be notified when new stories are added to our site. - -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} - -Please do not reply to this message. - ------------ - -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} \ No newline at end of file diff --git a/testdata/mymodule3/language/english/mail_template/index.html b/testdata/mymodule3/language/english/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/english/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/language/english/main.php b/testdata/mymodule3/language/english/main.php deleted file mode 100644 index 1ee4560c..00000000 --- a/testdata/mymodule3/language/english/main.php +++ /dev/null @@ -1,105 +0,0 @@ - - Website: - */ - -// ---------------- Main ---------------- -define('_MA_MYMODULE3_INDEX', 'Home'); -define('_MA_MYMODULE3_TITLE', 'My Module 3'); -define('_MA_MYMODULE3_DESC', 'This module is for doing following...'); -define('_MA_MYMODULE3_INDEX_DESC', "Welcome to the homepage of your new module My Module 3!
      -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."); -define('_MA_MYMODULE3_NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); -define('_MA_MYMODULE3_NO', 'No'); -// ---------------- Contents ---------------- -// Category -define('_MA_MYMODULE3_CATEGORY', 'Category'); -define('_MA_MYMODULE3_CATEGORIES', 'Categories'); -define('_MA_MYMODULE3_CATEGORIES_TITLE', 'Categories title'); -define('_MA_MYMODULE3_CATEGORIES_DESC', 'Categories description'); -// Caption of Category -define('_MA_MYMODULE3_CATEGORY_ID', 'Id'); -define('_MA_MYMODULE3_CATEGORY_NAME', 'Name'); -define('_MA_MYMODULE3_CATEGORY_LOGO', 'Logo'); -define('_MA_MYMODULE3_CATEGORY_CREATED', 'Created'); -define('_MA_MYMODULE3_CATEGORY_SUBMITTER', 'Submitter'); -// Article -define('_MA_MYMODULE3_ARTICLE', 'Article'); -define('_MA_MYMODULE3_ARTICLES', 'Articles'); -define('_MA_MYMODULE3_ARTICLES_TITLE', 'Articles title'); -define('_MA_MYMODULE3_ARTICLES_DESC', 'Articles description'); -// Caption of Article -define('_MA_MYMODULE3_ARTICLE_ID', 'Id'); -define('_MA_MYMODULE3_ARTICLE_CAT', 'Cat'); -define('_MA_MYMODULE3_ARTICLE_TITLE', 'Title'); -define('_MA_MYMODULE3_ARTICLE_DESCR', 'Descr'); -define('_MA_MYMODULE3_ARTICLE_IMG', 'Img'); -define('_MA_MYMODULE3_ARTICLE_ONLINE', 'Online'); -define('_MA_MYMODULE3_ARTICLE_FILE', 'File'); -define('_MA_MYMODULE3_ARTICLE_CREATED', 'Created'); -define('_MA_MYMODULE3_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield -define('_MA_MYMODULE3_TESTFIELD', 'Testfield'); -define('_MA_MYMODULE3_TESTFIELDS', 'Testfields'); -define('_MA_MYMODULE3_TESTFIELDS_TITLE', 'Testfields title'); -define('_MA_MYMODULE3_TESTFIELDS_DESC', 'Testfields description'); -// Caption of Testfield -define('_MA_MYMODULE3_TESTFIELD_ID', 'Id'); -define('_MA_MYMODULE3_TESTFIELD_TEXT', 'Text'); -define('_MA_MYMODULE3_TESTFIELD_TEXTAREA', 'Textarea'); -define('_MA_MYMODULE3_TESTFIELD_DHTML', 'Dhtml'); -define('_MA_MYMODULE3_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_MA_MYMODULE3_TESTFIELD_YESNO', 'Yesno'); -define('_MA_MYMODULE3_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_MA_MYMODULE3_TESTFIELD_USER', 'User'); -define('_MA_MYMODULE3_TESTFIELD_COLOR', 'Color'); -define('_MA_MYMODULE3_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_MA_MYMODULE3_TESTFIELD_URLFILE', 'Urlfile'); -define('_MA_MYMODULE3_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_MA_MYMODULE3_TESTFIELD_UPLFILE', 'Uplfile'); -define('_MA_MYMODULE3_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_MA_MYMODULE3_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_MA_MYMODULE3_TESTFIELD_PASSWORD', 'Password'); -define('_MA_MYMODULE3_TESTFIELD_COUNTRY_LIST', 'Country_list'); -define('_MA_MYMODULE3_TESTFIELD_LANGUAGE', 'Language'); -define('_MA_MYMODULE3_TESTFIELD_RADIO', 'Radio'); -define('_MA_MYMODULE3_TESTFIELD_STATUS', 'Status'); -define('_MA_MYMODULE3_TESTFIELD_DATETIME', 'Datetime'); -define('_MA_MYMODULE3_TESTFIELD_COMBOBOX', 'Combobox'); -define('_MA_MYMODULE3_INDEX_THEREARE', 'There are %s Testfields'); -define('_MA_MYMODULE3_INDEX_LATEST_LIST', 'Last My Module 3'); -// Submit -define('_MA_MYMODULE3_SUBMIT', 'Submit'); -define('_MA_MYMODULE3_SUBMIT_TESTFIELD', 'Submit Testfield'); -define('_MA_MYMODULE3_SUBMIT_ALLPENDING', 'All testfield/script information are posted pending verification.'); -define('_MA_MYMODULE3_SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); -define('_MA_MYMODULE3_SUBMIT_ISAPPROVED', 'Your testfield has been approved'); -define('_MA_MYMODULE3_SUBMIT_PROPOSER', 'Submit a testfield'); -define('_MA_MYMODULE3_SUBMIT_RECEIVED', 'We have received your testfield info. Thank you !'); -define('_MA_MYMODULE3_SUBMIT_SUBMITONCE', 'Submit your testfield/script only once.'); -define('_MA_MYMODULE3_SUBMIT_TAKEDAYS', 'This will take many days to see your testfield/script added successfully in our database.'); -// Form -define('_MA_MYMODULE3_FORM_OK', 'Successfully saved'); -define('_MA_MYMODULE3_FORM_DELETE_OK', 'Successfully deleted'); -define('_MA_MYMODULE3_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_MA_MYMODULE3_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Admin link -define('_MA_MYMODULE3_ADMIN', 'Admin'); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/english/modinfo.php b/testdata/mymodule3/language/english/modinfo.php deleted file mode 100644 index d910058e..00000000 --- a/testdata/mymodule3/language/english/modinfo.php +++ /dev/null @@ -1,193 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Main ---------------- -define('_MI_MYMODULE3_NAME', 'My Module 3'); -define('_MI_MYMODULE3_DESC', 'This module is for doing following...'); -// ---------------- Admin Menu ---------------- -define('_MI_MYMODULE3_ADMENU1', 'Dashboard'); -define('_MI_MYMODULE3_ADMENU2', 'Categories'); -define('_MI_MYMODULE3_ADMENU3', 'Articles'); -define('_MI_MYMODULE3_ADMENU4', 'Testfields'); -define('_MI_MYMODULE3_ADMENU5', 'Permissions'); -define('_MI_MYMODULE3_ADMENU6', 'Feedback'); -define('_MI_MYMODULE3_ABOUT', 'About'); -// ---------------- Admin Nav ---------------- -define('_MI_MYMODULE3_ADMIN_PAGER', 'Admin pager'); -define('_MI_MYMODULE3_ADMIN_PAGER_DESC', 'Admin per page list'); -// User -define('_MI_MYMODULE3_USER_PAGER', 'User pager'); -define('_MI_MYMODULE3_USER_PAGER_DESC', 'User per page list'); -// Submenu -define('_MI_MYMODULE3_SMNAME1', 'Index page'); -define('_MI_MYMODULE3_SMNAME2', 'Articles'); -define('_MI_MYMODULE3_SMNAME3', 'Testfields'); -define('_MI_MYMODULE3_SMNAME4', 'Submit'); -define('_MI_MYMODULE3_SMNAME5', 'Search'); -// Blocks -define('_MI_MYMODULE3_CATEGORIES_BLOCK', 'Categories block'); -define('_MI_MYMODULE3_CATEGORIES_BLOCK_DESC', 'Categories block description'); -define('_MI_MYMODULE3_CATEGORIES_BLOCK_CATEGORY', 'Categories block CATEGORY'); -define('_MI_MYMODULE3_CATEGORIES_BLOCK_CATEGORY_DESC', 'Categories block CATEGORY description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK', 'Articles block'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_DESC', 'Articles block description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_ARTICLE', 'Articles block ARTICLE'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_ARTICLE_DESC', 'Articles block ARTICLE description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_LAST', 'Articles block last'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_LAST_DESC', 'Articles block last description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_NEW', 'Articles block new'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_NEW_DESC', 'Articles block new description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_HITS', 'Articles block hits'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_HITS_DESC', 'Articles block hits description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_TOP', 'Articles block top'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_TOP_DESC', 'Articles block top description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_RANDOM', 'Articles block random'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_RANDOM_DESC', 'Articles block random description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK', 'Testfields block'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_DESC', 'Testfields block description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TESTFIELD', 'Testfields block TESTFIELD'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TESTFIELD_DESC', 'Testfields block TESTFIELD description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_LAST', 'Testfields block last'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_LAST_DESC', 'Testfields block last description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_NEW', 'Testfields block new'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_NEW_DESC', 'Testfields block new description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_HITS', 'Testfields block hits'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_HITS_DESC', 'Testfields block hits description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TOP', 'Testfields block top'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TOP_DESC', 'Testfields block top description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_RANDOM', 'Testfields block random'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_RANDOM_DESC', 'Testfields block random description'); -// Config -define('_MI_MYMODULE3_EDITOR_DESCR', 'Editor'); -define('_MI_MYMODULE3_EDITOR_DESCR_DESC', 'Select the Editor Descr to use'); -define('_MI_MYMODULE3_EDITOR_DHTML', 'Editor'); -define('_MI_MYMODULE3_EDITOR_DHTML_DESC', 'Select the Editor Dhtml to use'); -define('_MI_MYMODULE3_KEYWORDS', 'Keywords'); -define('_MI_MYMODULE3_KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); -define('_MI_MYMODULE3_SIZE_MB', 'MB'); -define('_MI_MYMODULE3_MAXSIZE_IMAGE', 'Max size image'); -define('_MI_MYMODULE3_MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); -define('_MI_MYMODULE3_MIMETYPES_IMAGE', 'Mime types image'); -define('_MI_MYMODULE3_MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); -define('_MI_MYMODULE3_MAXWIDTH_IMAGE', 'Max width image'); -define('_MI_MYMODULE3_MAXWIDTH_IMAGE_DESC', 'Set the max width which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE3_MAXHEIGHT_IMAGE', 'Max height image'); -define('_MI_MYMODULE3_MAXHEIGHT_IMAGE_DESC', 'Set the max height which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE3_MAXSIZE_FILE', 'Max size file'); -define('_MI_MYMODULE3_MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); -define('_MI_MYMODULE3_MIMETYPES_FILE', 'Mime types file'); -define('_MI_MYMODULE3_MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); -define('_MI_MYMODULE3_USE_TAG', 'Use TAG'); -define('_MI_MYMODULE3_USE_TAG_DESC', 'If you use tag module, check this option to yes'); -define('_MI_MYMODULE3_NUMB_COL', 'Number Columns'); -define('_MI_MYMODULE3_NUMB_COL_DESC', 'Number Columns to View.'); -define('_MI_MYMODULE3_DIVIDEBY', 'Divide By'); -define('_MI_MYMODULE3_DIVIDEBY_DESC', 'Divide by columns number.'); -define('_MI_MYMODULE3_TABLE_TYPE', 'Table Type'); -define('_MI_MYMODULE3_TABLE_TYPE_DESC', 'Table Type is the bootstrap html table.'); -define('_MI_MYMODULE3_PANEL_TYPE', 'Panel Type'); -define('_MI_MYMODULE3_PANEL_TYPE_DESC', 'Panel Type is the bootstrap html div.'); -define('_MI_MYMODULE3_IDPAYPAL', 'Paypal ID'); -define('_MI_MYMODULE3_IDPAYPAL_DESC', 'Insert here your PayPal ID for donactions.'); -define('_MI_MYMODULE3_ADVERTISE', 'Advertisement Code'); -define('_MI_MYMODULE3_ADVERTISE_DESC', 'Insert here the advertisement code'); -define('_MI_MYMODULE3_MAINTAINEDBY', 'Maintained By'); -define('_MI_MYMODULE3_MAINTAINEDBY_DESC', 'Allow url of support site or community'); -define('_MI_MYMODULE3_BOOKMARKS', 'Social Bookmarks'); -define('_MI_MYMODULE3_BOOKMARKS_DESC', 'Show Social Bookmarks in the single page'); -define('_MI_MYMODULE3_FACEBOOK_COMMENTS', 'Facebook comments'); -define('_MI_MYMODULE3_FACEBOOK_COMMENTS_DESC', 'Allow Facebook comments in the single page'); -define('_MI_MYMODULE3_DISQUS_COMMENTS', 'Disqus comments'); -define('_MI_MYMODULE3_DISQUS_COMMENTS_DESC', 'Allow Disqus comments in the single page'); -// Notifications -define('_MI_MYMODULE3_GLOBAL_NOTIFY', 'Global notify'); -define('_MI_MYMODULE3_GLOBAL_NOTIFY_DESC', 'Global notify desc'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY', 'Global modify notify'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_CAPTION', 'Global modify notify caption'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_DESC', 'Global modify notify desc'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_SUBJECT', 'Global modify notify subject'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY', 'Global broken notify'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_CAPTION', 'Global broken notify caption'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_DESC', 'Global broken notify desc'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_SUBJECT', 'Global broken notify subject'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY', 'Global submit notify'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_CAPTION', 'Global submit notify caption'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_DESC', 'Global submit notify desc'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_SUBJECT', 'Global submit notify subject'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY', 'Global new notify'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY_CAPTION', 'Global new notify caption'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY_DESC', 'Global new notify desc'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY_SUBJECT', 'Global new notify subject'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY', 'Category notify'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY_DESC', 'Category notify desc'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY_CAPTION', 'Category notify caption'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY_SUBJECT', 'Category notify Subject'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY', 'Category submit notify'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_CAPTION', 'Category submit notify caption'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_DESC', 'Category submit notify desc'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_SUBJECT', 'Category submit notify subject'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY', 'Testfield notify'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY_DESC', 'Testfield notify desc'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY_CAPTION', 'Testfield notify caption'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY_SUBJECT', 'Testfield notify subject'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY', 'Global newcategory notify'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION', 'Global newcategory notify caption'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_DESC', 'Global newcategory notify desc'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT', 'Global newcategory notify subject'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY', 'Global testfield modify notify'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY_CAPTION', 'Global testfield modify notify caption'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY_DESC', 'Global testfield modify notify desc'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY_SUBJECT', 'Global testfield modify notify subject'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY', 'Global testfield broken notify'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY_CAPTION', 'Global testfield broken notify caption'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY_DESC', 'Global testfield broken notify desc'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY_SUBJECT', 'Global testfield broken notify subject'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY', 'Global testfield submit notify'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Global testfield submit notify caption'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Global testfield submit notify desc'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Global testfield submit notify subject'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY', 'Global new testfield notify'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY_CAPTION', 'Global new testfield notify caption'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY_DESC', 'Global new testfield notify desc'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Global new testfield notify subject'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY', 'Category testfield submit notify'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Category testfield submit notify caption'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Category testfield submit notify desc'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Category testfield submit notify subject'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY', 'Category new testfield notify'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY_CAPTION', 'Category new testfield notify caption'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY_DESC', 'Category new testfield notify desc'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Category new testfield notify subject'); -define('_MI_MYMODULE3_APPROVE_NOTIFY', 'Testfield approve notify'); -define('_MI_MYMODULE3_APPROVE_NOTIFY_CAPTION', 'Testfield approve notify caption'); -define('_MI_MYMODULE3_APPROVE_NOTIFY_DESC', 'Testfield approve notify desc'); -define('_MI_MYMODULE3_APPROVE_NOTIFY_SUBJECT', 'Testfield approve notify subject'); -// Permissions Groups -define('_MI_MYMODULE3_GROUPS', 'Groups access'); -define('_MI_MYMODULE3_GROUPS_DESC', 'Select general access permission for groups.'); -define('_MI_MYMODULE3_ADMIN_GROUPS', 'Admin Group Permissions'); -define('_MI_MYMODULE3_ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); -define('_MI_MYMODULE3_UPLOAD_GROUPS', 'Upload Group Permissions'); -define('_MI_MYMODULE3_UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/german/admin.php b/testdata/mymodule3/language/german/admin.php deleted file mode 100644 index 7b2c562a..00000000 --- a/testdata/mymodule3/language/german/admin.php +++ /dev/null @@ -1,142 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Index ---------------- -define('_AM_MYMODULE3_STATISTICS', 'Statistics'); -// There are -define('_AM_MYMODULE3_THEREARE_CATEGORIES', "There are %s categories in the database"); -define('_AM_MYMODULE3_THEREARE_ARTICLES', "There are %s articles in the database"); -define('_AM_MYMODULE3_THEREARE_TESTFIELDS', "There are %s testfields in the database"); -// ---------------- Admin Files ---------------- -// There aren't -define('_AM_MYMODULE3_THEREARENT_CATEGORIES', "There aren't categories"); -define('_AM_MYMODULE3_THEREARENT_ARTICLES', "There aren't articles"); -define('_AM_MYMODULE3_THEREARENT_TESTFIELDS', "There aren't testfields"); -// Save/Delete -define('_AM_MYMODULE3_FORM_OK', 'Successfully saved'); -define('_AM_MYMODULE3_FORM_DELETE_OK', 'Successfully deleted'); -define('_AM_MYMODULE3_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_AM_MYMODULE3_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Buttons -define('_AM_MYMODULE3_ADD_CATEGORY', 'Add New Category'); -define('_AM_MYMODULE3_ADD_ARTICLE', 'Add New Article'); -define('_AM_MYMODULE3_ADD_TESTFIELD', 'Add New Testfield'); -// Lists -define('_AM_MYMODULE3_CATEGORIES_LIST', 'List of Categories'); -define('_AM_MYMODULE3_ARTICLES_LIST', 'List of Articles'); -define('_AM_MYMODULE3_TESTFIELDS_LIST', 'List of Testfields'); -// ---------------- Admin Classes ---------------- -// Category add/edit -define('_AM_MYMODULE3_CATEGORY_ADD', 'Add Category'); -define('_AM_MYMODULE3_CATEGORY_EDIT', 'Edit Category'); -// Elements of Category -define('_AM_MYMODULE3_CATEGORY_ID', 'Id'); -define('_AM_MYMODULE3_CATEGORY_NAME', 'Name'); -define('_AM_MYMODULE3_CATEGORY_LOGO', 'Logo'); -define('_AM_MYMODULE3_CATEGORY_LOGO_UPLOADS', 'Logo in %s :'); -define('_AM_MYMODULE3_CATEGORY_CREATED', 'Created'); -define('_AM_MYMODULE3_CATEGORY_SUBMITTER', 'Submitter'); -// Article add/edit -define('_AM_MYMODULE3_ARTICLE_ADD', 'Add Article'); -define('_AM_MYMODULE3_ARTICLE_EDIT', 'Edit Article'); -// Elements of Article -define('_AM_MYMODULE3_ARTICLE_ID', 'Id'); -define('_AM_MYMODULE3_ARTICLE_CAT', 'Categories'); -define('_AM_MYMODULE3_ARTICLE_TITLE', 'Title'); -define('_AM_MYMODULE3_ARTICLE_DESCR', 'Descr'); -define('_AM_MYMODULE3_ARTICLE_IMG', 'Img'); -define('_AM_MYMODULE3_ARTICLE_IMG_UPLOADS', 'Img in %s :'); -define('_AM_MYMODULE3_ARTICLE_ONLINE', 'Online'); -define('_AM_MYMODULE3_ARTICLE_FILE', 'File'); -define('_AM_MYMODULE3_ARTICLE_FILE_UPLOADS', 'File in %s :'); -define('_AM_MYMODULE3_ARTICLE_CREATED', 'Created'); -define('_AM_MYMODULE3_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield add/edit -define('_AM_MYMODULE3_TESTFIELD_ADD', 'Add Testfield'); -define('_AM_MYMODULE3_TESTFIELD_EDIT', 'Edit Testfield'); -// Elements of Testfield -define('_AM_MYMODULE3_TESTFIELD_ID', 'Id'); -define('_AM_MYMODULE3_TESTFIELD_TEXT', 'Text'); -define('_AM_MYMODULE3_TESTFIELD_TEXTAREA', 'Textarea'); -define('_AM_MYMODULE3_TESTFIELD_DHTML', 'Dhtml'); -define('_AM_MYMODULE3_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_AM_MYMODULE3_TESTFIELD_YESNO', 'Yesno'); -define('_AM_MYMODULE3_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_AM_MYMODULE3_TESTFIELD_USER', 'User'); -define('_AM_MYMODULE3_TESTFIELD_COLOR', 'Color'); -define('_AM_MYMODULE3_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_AM_MYMODULE3_TESTFIELD_IMAGELIST_UPLOADS', 'Imagelist in frameworks images: %s'); -define('_AM_MYMODULE3_TESTFIELD_URLFILE', 'Urlfile'); -define('_AM_MYMODULE3_TESTFIELD_URLFILE_UPLOADS', 'Urlfile in uploads'); -define('_AM_MYMODULE3_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_AM_MYMODULE3_TESTFIELD_UPLIMAGE_UPLOADS', 'Uplimage in %s :'); -define('_AM_MYMODULE3_TESTFIELD_UPLFILE', 'Uplfile'); -define('_AM_MYMODULE3_TESTFIELD_UPLFILE_UPLOADS', 'Uplfile in %s :'); -define('_AM_MYMODULE3_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_AM_MYMODULE3_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_AM_MYMODULE3_TESTFIELD_SELECTFILE_UPLOADS', 'Selectfile in %s :'); -define('_AM_MYMODULE3_TESTFIELD_PASSWORD', 'Password'); -define('_AM_MYMODULE3_TESTFIELD_COUNTRY_LIST', 'SelectCountry'); -define('_AM_MYMODULE3_TESTFIELD_LANGUAGE', 'SelectLang'); -define('_AM_MYMODULE3_TESTFIELD_RADIO', 'Radio'); -define('_AM_MYMODULE3_TESTFIELD_STATUS', 'Status'); -define('_AM_MYMODULE3_TESTFIELD_DATETIME', 'DateTime'); -define('_AM_MYMODULE3_TESTFIELD_COMBOBOX', 'SelectCombo'); -// General -define('_AM_MYMODULE3_FORM_UPLOAD', 'Upload file'); -define('_AM_MYMODULE3_FORM_UPLOAD_NEW', 'Upload new file: '); -define('_AM_MYMODULE3_FORM_UPLOAD_SIZE', 'Max file size: '); -define('_AM_MYMODULE3_FORM_UPLOAD_SIZE_MB', 'MB'); -define('_AM_MYMODULE3_FORM_UPLOAD_IMG_WIDTH', 'Max image width: '); -define('_AM_MYMODULE3_FORM_UPLOAD_IMG_HEIGHT', 'Max image height: '); -define('_AM_MYMODULE3_FORM_IMAGE_PATH', 'Files in %s :'); -define('_AM_MYMODULE3_FORM_ACTION', 'Action'); -define('_AM_MYMODULE3_FORM_EDIT', 'Modification'); -define('_AM_MYMODULE3_FORM_DELETE', 'Clear'); -// Status -define('_AM_MYMODULE3_STATUS_NONE', 'No status'); -define('_AM_MYMODULE3_STATUS_OFFLINE', 'Offline'); -define('_AM_MYMODULE3_STATUS_SUBMITTED', 'Submitted'); -define('_AM_MYMODULE3_STATUS_APPROVED', 'Approved'); -// Sample List Values -define('_AM_MYMODULE3_LIST_1', 'Sample List Value 1'); -define('_AM_MYMODULE3_LIST_2', 'Sample List Value 2'); -define('_AM_MYMODULE3_LIST_3', 'Sample List Value 3'); -// ---------------- Admin Permissions ---------------- -// Permissions -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL', 'Permissions global'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_DESC', 'Permissions global to check type of.'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_4', 'Permissions global to approve'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_8', 'Permissions global to submit'); -define('_AM_MYMODULE3_PERMISSIONS_GLOBAL_16', 'Permissions global to view'); -define('_AM_MYMODULE3_PERMISSIONS_APPROVE', 'Permissions to approve'); -define('_AM_MYMODULE3_PERMISSIONS_APPROVE_DESC', 'Permissions to approve'); -define('_AM_MYMODULE3_PERMISSIONS_SUBMIT', 'Permissions to submit'); -define('_AM_MYMODULE3_PERMISSIONS_SUBMIT_DESC', 'Permissions to submit'); -define('_AM_MYMODULE3_PERMISSIONS_VIEW', 'Permissions to view'); -define('_AM_MYMODULE3_PERMISSIONS_VIEW_DESC', 'Permissions to view'); -define('_AM_MYMODULE3_NO_PERMISSIONS_SET', 'No permission set'); -// ---------------- Admin Others ---------------- -define('_AM_MYMODULE3_MAINTAINEDBY', ' is maintained by '); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/german/blocks.php b/testdata/mymodule3/language/german/blocks.php deleted file mode 100644 index 8a21e7e9..00000000 --- a/testdata/mymodule3/language/german/blocks.php +++ /dev/null @@ -1,40 +0,0 @@ - - Website: - */ -// Admin Edit -define('_MB_MYMODULE3_DISPLAY', 'How Many Tables to Display'); -define('_MB_MYMODULE3_TITLE_LENGTH', 'Title Length'); -define('_MB_MYMODULE3_CATTODISPLAY', 'Categories to Display'); -define('_MB_MYMODULE3_ALLCAT', 'All Categories'); -// Articles -define('_MB_MYMODULE3_ARTICLES_TO_DISPLAY', 'Articles to Display'); -define('_MB_MYMODULE3_ALL_ARTICLES', 'All Articles'); -define('_MB_MYMODULE3_ART_CAT', 'Cat'); -define('_MB_MYMODULE3_ART_TITLE', 'Title'); -define('_MB_MYMODULE3_ART_DESCR', 'Descr'); -define('_MB_MYMODULE3_ART_IMG', 'Img'); -define('_MB_MYMODULE3_ART_FILE', 'File'); -define('_MB_MYMODULE3_ART_CREATED', 'Created'); -define('_MB_MYMODULE3_ART_SUBMITTER', 'Submitter'); -// Testfields -define('_MB_MYMODULE3_TESTFIELDS_TO_DISPLAY', 'Testfields to Display'); -define('_MB_MYMODULE3_ALL_TESTFIELDS', 'All Testfields'); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/german/common.php b/testdata/mymodule3/language/german/common.php deleted file mode 100644 index 214982f0..00000000 --- a/testdata/mymodule3/language/german/common.php +++ /dev/null @@ -1,183 +0,0 @@ -Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails 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): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); - -// Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - -//Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); - -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); - -//help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -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 Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -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 . '_' . '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 . '_' . 'CONFIRM', 'Confirm'); - -//letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); - -// block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); - -//myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); - -//Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); - -//Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); - -//Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); - -//DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); - -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); - -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -//image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); - -//Preferences -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); - -//Module Stats -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); diff --git a/testdata/mymodule3/language/german/feedback.php b/testdata/mymodule3/language/german/feedback.php deleted file mode 100644 index 8977d931..00000000 --- a/testdata/mymodule3/language/german/feedback.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -$moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); - -define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT', 'Recipient'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME', 'Name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER', 'Please enter your name'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE', 'Website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER', 'Please enter your website'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL', 'Email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER', 'Please enter your email'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE', 'Type of feedback'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION', 'Suggestions'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS', 'Bugs'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL', 'Testimonials'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES', 'Features'); -define('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS', 'Misc'); -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!'); diff --git a/testdata/mymodule3/language/german/help/help.html b/testdata/mymodule3/language/german/help/help.html deleted file mode 100644 index e3b73b94..00000000 --- a/testdata/mymodule3/language/german/help/help.html +++ /dev/null @@ -1,27 +0,0 @@ -
      -

      Help: - My Module 3 Back to the Administration of My Module 3 -

      - -

      Description

      -

      - The My Module 3 module can be used to modules in XOOPS

      -

      -

      Install/uninstall

      -

      -No special measures necessary, follow the standard installation process and extract the mymodule3 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 TDMCreate 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 -

      - -
      \ No newline at end of file diff --git a/testdata/mymodule3/language/german/help/index.html b/testdata/mymodule3/language/german/help/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/german/help/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/language/german/index.html b/testdata/mymodule3/language/german/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/german/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/language/german/mail_template/category_new_notify.tpl b/testdata/mymodule3/language/german/mail_template/category_new_notify.tpl deleted file mode 100644 index 15071a28..00000000 --- a/testdata/mymodule3/language/german/mail_template/category_new_notify.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// ---------- Templates Mail Content Dummy ---------- // -Hello {X_UNAME}, - -A new story "{STORY_NAME}" has been added at {X_SITENAME}. - -You can view this story here: -{STORY_URL} - ------------ - -You are receiving this message because you selected to be notified when new stories are added to our site. - -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: -{X_UNSUBSCRIBE_URL} - -Please do not reply to this message. - ------------ - -{X_SITENAME} ({X_SITEURL}) -webmaster -{X_ADMINMAIL} \ No newline at end of file diff --git a/testdata/mymodule3/language/german/mail_template/index.html b/testdata/mymodule3/language/german/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/german/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/language/german/main.php b/testdata/mymodule3/language/german/main.php deleted file mode 100644 index 1ee4560c..00000000 --- a/testdata/mymodule3/language/german/main.php +++ /dev/null @@ -1,105 +0,0 @@ - - Website: - */ - -// ---------------- Main ---------------- -define('_MA_MYMODULE3_INDEX', 'Home'); -define('_MA_MYMODULE3_TITLE', 'My Module 3'); -define('_MA_MYMODULE3_DESC', 'This module is for doing following...'); -define('_MA_MYMODULE3_INDEX_DESC', "Welcome to the homepage of your new module My Module 3!
      -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."); -define('_MA_MYMODULE3_NO_PDF_LIBRARY', 'Libraries TCPDF not there yet, upload them in root/Frameworks'); -define('_MA_MYMODULE3_NO', 'No'); -// ---------------- Contents ---------------- -// Category -define('_MA_MYMODULE3_CATEGORY', 'Category'); -define('_MA_MYMODULE3_CATEGORIES', 'Categories'); -define('_MA_MYMODULE3_CATEGORIES_TITLE', 'Categories title'); -define('_MA_MYMODULE3_CATEGORIES_DESC', 'Categories description'); -// Caption of Category -define('_MA_MYMODULE3_CATEGORY_ID', 'Id'); -define('_MA_MYMODULE3_CATEGORY_NAME', 'Name'); -define('_MA_MYMODULE3_CATEGORY_LOGO', 'Logo'); -define('_MA_MYMODULE3_CATEGORY_CREATED', 'Created'); -define('_MA_MYMODULE3_CATEGORY_SUBMITTER', 'Submitter'); -// Article -define('_MA_MYMODULE3_ARTICLE', 'Article'); -define('_MA_MYMODULE3_ARTICLES', 'Articles'); -define('_MA_MYMODULE3_ARTICLES_TITLE', 'Articles title'); -define('_MA_MYMODULE3_ARTICLES_DESC', 'Articles description'); -// Caption of Article -define('_MA_MYMODULE3_ARTICLE_ID', 'Id'); -define('_MA_MYMODULE3_ARTICLE_CAT', 'Cat'); -define('_MA_MYMODULE3_ARTICLE_TITLE', 'Title'); -define('_MA_MYMODULE3_ARTICLE_DESCR', 'Descr'); -define('_MA_MYMODULE3_ARTICLE_IMG', 'Img'); -define('_MA_MYMODULE3_ARTICLE_ONLINE', 'Online'); -define('_MA_MYMODULE3_ARTICLE_FILE', 'File'); -define('_MA_MYMODULE3_ARTICLE_CREATED', 'Created'); -define('_MA_MYMODULE3_ARTICLE_SUBMITTER', 'Submitter'); -// Testfield -define('_MA_MYMODULE3_TESTFIELD', 'Testfield'); -define('_MA_MYMODULE3_TESTFIELDS', 'Testfields'); -define('_MA_MYMODULE3_TESTFIELDS_TITLE', 'Testfields title'); -define('_MA_MYMODULE3_TESTFIELDS_DESC', 'Testfields description'); -// Caption of Testfield -define('_MA_MYMODULE3_TESTFIELD_ID', 'Id'); -define('_MA_MYMODULE3_TESTFIELD_TEXT', 'Text'); -define('_MA_MYMODULE3_TESTFIELD_TEXTAREA', 'Textarea'); -define('_MA_MYMODULE3_TESTFIELD_DHTML', 'Dhtml'); -define('_MA_MYMODULE3_TESTFIELD_CHECKBOX', 'Checkbox'); -define('_MA_MYMODULE3_TESTFIELD_YESNO', 'Yesno'); -define('_MA_MYMODULE3_TESTFIELD_SELECTBOX', 'Selectbox'); -define('_MA_MYMODULE3_TESTFIELD_USER', 'User'); -define('_MA_MYMODULE3_TESTFIELD_COLOR', 'Color'); -define('_MA_MYMODULE3_TESTFIELD_IMAGELIST', 'Imagelist'); -define('_MA_MYMODULE3_TESTFIELD_URLFILE', 'Urlfile'); -define('_MA_MYMODULE3_TESTFIELD_UPLIMAGE', 'Uplimage'); -define('_MA_MYMODULE3_TESTFIELD_UPLFILE', 'Uplfile'); -define('_MA_MYMODULE3_TESTFIELD_TEXTDATESELECT', 'Textdateselect'); -define('_MA_MYMODULE3_TESTFIELD_SELECTFILE', 'Selectfile'); -define('_MA_MYMODULE3_TESTFIELD_PASSWORD', 'Password'); -define('_MA_MYMODULE3_TESTFIELD_COUNTRY_LIST', 'Country_list'); -define('_MA_MYMODULE3_TESTFIELD_LANGUAGE', 'Language'); -define('_MA_MYMODULE3_TESTFIELD_RADIO', 'Radio'); -define('_MA_MYMODULE3_TESTFIELD_STATUS', 'Status'); -define('_MA_MYMODULE3_TESTFIELD_DATETIME', 'Datetime'); -define('_MA_MYMODULE3_TESTFIELD_COMBOBOX', 'Combobox'); -define('_MA_MYMODULE3_INDEX_THEREARE', 'There are %s Testfields'); -define('_MA_MYMODULE3_INDEX_LATEST_LIST', 'Last My Module 3'); -// Submit -define('_MA_MYMODULE3_SUBMIT', 'Submit'); -define('_MA_MYMODULE3_SUBMIT_TESTFIELD', 'Submit Testfield'); -define('_MA_MYMODULE3_SUBMIT_ALLPENDING', 'All testfield/script information are posted pending verification.'); -define('_MA_MYMODULE3_SUBMIT_DONTABUSE', 'Username and IP are recorded, so please do not abuse the system.'); -define('_MA_MYMODULE3_SUBMIT_ISAPPROVED', 'Your testfield has been approved'); -define('_MA_MYMODULE3_SUBMIT_PROPOSER', 'Submit a testfield'); -define('_MA_MYMODULE3_SUBMIT_RECEIVED', 'We have received your testfield info. Thank you !'); -define('_MA_MYMODULE3_SUBMIT_SUBMITONCE', 'Submit your testfield/script only once.'); -define('_MA_MYMODULE3_SUBMIT_TAKEDAYS', 'This will take many days to see your testfield/script added successfully in our database.'); -// Form -define('_MA_MYMODULE3_FORM_OK', 'Successfully saved'); -define('_MA_MYMODULE3_FORM_DELETE_OK', 'Successfully deleted'); -define('_MA_MYMODULE3_FORM_SURE_DELETE', "Are you sure to delete: %s "); -define('_MA_MYMODULE3_FORM_SURE_RENEW', "Are you sure to update: %s "); -// Admin link -define('_MA_MYMODULE3_ADMIN', 'Admin'); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/german/modinfo.php b/testdata/mymodule3/language/german/modinfo.php deleted file mode 100644 index d910058e..00000000 --- a/testdata/mymodule3/language/german/modinfo.php +++ /dev/null @@ -1,193 +0,0 @@ - - Website: - */ - -include_once 'common.php'; - -// ---------------- Admin Main ---------------- -define('_MI_MYMODULE3_NAME', 'My Module 3'); -define('_MI_MYMODULE3_DESC', 'This module is for doing following...'); -// ---------------- Admin Menu ---------------- -define('_MI_MYMODULE3_ADMENU1', 'Dashboard'); -define('_MI_MYMODULE3_ADMENU2', 'Categories'); -define('_MI_MYMODULE3_ADMENU3', 'Articles'); -define('_MI_MYMODULE3_ADMENU4', 'Testfields'); -define('_MI_MYMODULE3_ADMENU5', 'Permissions'); -define('_MI_MYMODULE3_ADMENU6', 'Feedback'); -define('_MI_MYMODULE3_ABOUT', 'About'); -// ---------------- Admin Nav ---------------- -define('_MI_MYMODULE3_ADMIN_PAGER', 'Admin pager'); -define('_MI_MYMODULE3_ADMIN_PAGER_DESC', 'Admin per page list'); -// User -define('_MI_MYMODULE3_USER_PAGER', 'User pager'); -define('_MI_MYMODULE3_USER_PAGER_DESC', 'User per page list'); -// Submenu -define('_MI_MYMODULE3_SMNAME1', 'Index page'); -define('_MI_MYMODULE3_SMNAME2', 'Articles'); -define('_MI_MYMODULE3_SMNAME3', 'Testfields'); -define('_MI_MYMODULE3_SMNAME4', 'Submit'); -define('_MI_MYMODULE3_SMNAME5', 'Search'); -// Blocks -define('_MI_MYMODULE3_CATEGORIES_BLOCK', 'Categories block'); -define('_MI_MYMODULE3_CATEGORIES_BLOCK_DESC', 'Categories block description'); -define('_MI_MYMODULE3_CATEGORIES_BLOCK_CATEGORY', 'Categories block CATEGORY'); -define('_MI_MYMODULE3_CATEGORIES_BLOCK_CATEGORY_DESC', 'Categories block CATEGORY description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK', 'Articles block'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_DESC', 'Articles block description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_ARTICLE', 'Articles block ARTICLE'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_ARTICLE_DESC', 'Articles block ARTICLE description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_LAST', 'Articles block last'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_LAST_DESC', 'Articles block last description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_NEW', 'Articles block new'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_NEW_DESC', 'Articles block new description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_HITS', 'Articles block hits'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_HITS_DESC', 'Articles block hits description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_TOP', 'Articles block top'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_TOP_DESC', 'Articles block top description'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_RANDOM', 'Articles block random'); -define('_MI_MYMODULE3_ARTICLES_BLOCK_RANDOM_DESC', 'Articles block random description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK', 'Testfields block'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_DESC', 'Testfields block description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TESTFIELD', 'Testfields block TESTFIELD'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TESTFIELD_DESC', 'Testfields block TESTFIELD description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_LAST', 'Testfields block last'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_LAST_DESC', 'Testfields block last description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_NEW', 'Testfields block new'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_NEW_DESC', 'Testfields block new description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_HITS', 'Testfields block hits'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_HITS_DESC', 'Testfields block hits description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TOP', 'Testfields block top'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_TOP_DESC', 'Testfields block top description'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_RANDOM', 'Testfields block random'); -define('_MI_MYMODULE3_TESTFIELDS_BLOCK_RANDOM_DESC', 'Testfields block random description'); -// Config -define('_MI_MYMODULE3_EDITOR_DESCR', 'Editor'); -define('_MI_MYMODULE3_EDITOR_DESCR_DESC', 'Select the Editor Descr to use'); -define('_MI_MYMODULE3_EDITOR_DHTML', 'Editor'); -define('_MI_MYMODULE3_EDITOR_DHTML_DESC', 'Select the Editor Dhtml to use'); -define('_MI_MYMODULE3_KEYWORDS', 'Keywords'); -define('_MI_MYMODULE3_KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); -define('_MI_MYMODULE3_SIZE_MB', 'MB'); -define('_MI_MYMODULE3_MAXSIZE_IMAGE', 'Max size image'); -define('_MI_MYMODULE3_MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); -define('_MI_MYMODULE3_MIMETYPES_IMAGE', 'Mime types image'); -define('_MI_MYMODULE3_MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); -define('_MI_MYMODULE3_MAXWIDTH_IMAGE', 'Max width image'); -define('_MI_MYMODULE3_MAXWIDTH_IMAGE_DESC', 'Set the max width which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE3_MAXHEIGHT_IMAGE', 'Max height image'); -define('_MI_MYMODULE3_MAXHEIGHT_IMAGE_DESC', 'Set the max height which is allowed for uploading images (in pixel)
      0 means that images keep original size
      If original image is smaller the image will be not enlarged'); -define('_MI_MYMODULE3_MAXSIZE_FILE', 'Max size file'); -define('_MI_MYMODULE3_MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); -define('_MI_MYMODULE3_MIMETYPES_FILE', 'Mime types file'); -define('_MI_MYMODULE3_MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); -define('_MI_MYMODULE3_USE_TAG', 'Use TAG'); -define('_MI_MYMODULE3_USE_TAG_DESC', 'If you use tag module, check this option to yes'); -define('_MI_MYMODULE3_NUMB_COL', 'Number Columns'); -define('_MI_MYMODULE3_NUMB_COL_DESC', 'Number Columns to View.'); -define('_MI_MYMODULE3_DIVIDEBY', 'Divide By'); -define('_MI_MYMODULE3_DIVIDEBY_DESC', 'Divide by columns number.'); -define('_MI_MYMODULE3_TABLE_TYPE', 'Table Type'); -define('_MI_MYMODULE3_TABLE_TYPE_DESC', 'Table Type is the bootstrap html table.'); -define('_MI_MYMODULE3_PANEL_TYPE', 'Panel Type'); -define('_MI_MYMODULE3_PANEL_TYPE_DESC', 'Panel Type is the bootstrap html div.'); -define('_MI_MYMODULE3_IDPAYPAL', 'Paypal ID'); -define('_MI_MYMODULE3_IDPAYPAL_DESC', 'Insert here your PayPal ID for donactions.'); -define('_MI_MYMODULE3_ADVERTISE', 'Advertisement Code'); -define('_MI_MYMODULE3_ADVERTISE_DESC', 'Insert here the advertisement code'); -define('_MI_MYMODULE3_MAINTAINEDBY', 'Maintained By'); -define('_MI_MYMODULE3_MAINTAINEDBY_DESC', 'Allow url of support site or community'); -define('_MI_MYMODULE3_BOOKMARKS', 'Social Bookmarks'); -define('_MI_MYMODULE3_BOOKMARKS_DESC', 'Show Social Bookmarks in the single page'); -define('_MI_MYMODULE3_FACEBOOK_COMMENTS', 'Facebook comments'); -define('_MI_MYMODULE3_FACEBOOK_COMMENTS_DESC', 'Allow Facebook comments in the single page'); -define('_MI_MYMODULE3_DISQUS_COMMENTS', 'Disqus comments'); -define('_MI_MYMODULE3_DISQUS_COMMENTS_DESC', 'Allow Disqus comments in the single page'); -// Notifications -define('_MI_MYMODULE3_GLOBAL_NOTIFY', 'Global notify'); -define('_MI_MYMODULE3_GLOBAL_NOTIFY_DESC', 'Global notify desc'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY', 'Global modify notify'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_CAPTION', 'Global modify notify caption'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_DESC', 'Global modify notify desc'); -define('_MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_SUBJECT', 'Global modify notify subject'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY', 'Global broken notify'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_CAPTION', 'Global broken notify caption'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_DESC', 'Global broken notify desc'); -define('_MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_SUBJECT', 'Global broken notify subject'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY', 'Global submit notify'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_CAPTION', 'Global submit notify caption'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_DESC', 'Global submit notify desc'); -define('_MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_SUBJECT', 'Global submit notify subject'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY', 'Global new notify'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY_CAPTION', 'Global new notify caption'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY_DESC', 'Global new notify desc'); -define('_MI_MYMODULE3_GLOBAL_NEW_NOTIFY_SUBJECT', 'Global new notify subject'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY', 'Category notify'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY_DESC', 'Category notify desc'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY_CAPTION', 'Category notify caption'); -define('_MI_MYMODULE3_CATEGORY_NOTIFY_SUBJECT', 'Category notify Subject'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY', 'Category submit notify'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_CAPTION', 'Category submit notify caption'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_DESC', 'Category submit notify desc'); -define('_MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_SUBJECT', 'Category submit notify subject'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY', 'Testfield notify'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY_DESC', 'Testfield notify desc'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY_CAPTION', 'Testfield notify caption'); -define('_MI_MYMODULE3_TESTFIELD_NOTIFY_SUBJECT', 'Testfield notify subject'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY', 'Global newcategory notify'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION', 'Global newcategory notify caption'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_DESC', 'Global newcategory notify desc'); -define('_MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT', 'Global newcategory notify subject'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY', 'Global testfield modify notify'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY_CAPTION', 'Global testfield modify notify caption'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY_DESC', 'Global testfield modify notify desc'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_MODIFY_NOTIFY_SUBJECT', 'Global testfield modify notify subject'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY', 'Global testfield broken notify'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY_CAPTION', 'Global testfield broken notify caption'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY_DESC', 'Global testfield broken notify desc'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_BROKEN_NOTIFY_SUBJECT', 'Global testfield broken notify subject'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY', 'Global testfield submit notify'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Global testfield submit notify caption'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Global testfield submit notify desc'); -define('_MI_MYMODULE3_GLOBAL_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Global testfield submit notify subject'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY', 'Global new testfield notify'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY_CAPTION', 'Global new testfield notify caption'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY_DESC', 'Global new testfield notify desc'); -define('_MI_MYMODULE3_GLOBAL_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Global new testfield notify subject'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY', 'Category testfield submit notify'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_CAPTION', 'Category testfield submit notify caption'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_DESC', 'Category testfield submit notify desc'); -define('_MI_MYMODULE3_CATEGORY_TESTFIELD_SUBMIT_NOTIFY_SUBJECT', 'Category testfield submit notify subject'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY', 'Category new testfield notify'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY_CAPTION', 'Category new testfield notify caption'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY_DESC', 'Category new testfield notify desc'); -define('_MI_MYMODULE3_CATEGORY_NEW_TESTFIELD_NOTIFY_SUBJECT', 'Category new testfield notify subject'); -define('_MI_MYMODULE3_APPROVE_NOTIFY', 'Testfield approve notify'); -define('_MI_MYMODULE3_APPROVE_NOTIFY_CAPTION', 'Testfield approve notify caption'); -define('_MI_MYMODULE3_APPROVE_NOTIFY_DESC', 'Testfield approve notify desc'); -define('_MI_MYMODULE3_APPROVE_NOTIFY_SUBJECT', 'Testfield approve notify subject'); -// Permissions Groups -define('_MI_MYMODULE3_GROUPS', 'Groups access'); -define('_MI_MYMODULE3_GROUPS_DESC', 'Select general access permission for groups.'); -define('_MI_MYMODULE3_ADMIN_GROUPS', 'Admin Group Permissions'); -define('_MI_MYMODULE3_ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); -define('_MI_MYMODULE3_UPLOAD_GROUPS', 'Upload Group Permissions'); -define('_MI_MYMODULE3_UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); -// ---------------- End ---------------- diff --git a/testdata/mymodule3/language/index.html b/testdata/mymodule3/language/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/language/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/list.tag.php b/testdata/mymodule3/list.tag.php deleted file mode 100644 index 6af38e65..00000000 --- a/testdata/mymodule3/list.tag.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -include XOOPS_ROOT_PATH . '/modules/tag/list.tag.php'; diff --git a/testdata/mymodule3/notification_update.php b/testdata/mymodule3/notification_update.php deleted file mode 100644 index 66423c0d..00000000 --- a/testdata/mymodule3/notification_update.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include XOOPS_ROOT_PATH . '/include/notification_update.php'; diff --git a/testdata/mymodule3/pdf.php b/testdata/mymodule3/pdf.php deleted file mode 100644 index 698b336c..00000000 --- a/testdata/mymodule3/pdf.php +++ /dev/null @@ -1,102 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id'); -if (file_exists($tcpdf = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php')) { - require_once $tcpdf; -} else { - redirect_header('testfields.php', 2, _MA_MYMODULE3_NO_PDF_LIBRARY); -} -// Get Instance of Handler -$testfieldsHandler = $helper->getHandler('testfields'); - -$pdfData['content'] = strip_tags($testfieldsHandler->getVar('tf_textarea')); -$pdfData['content'] = strip_tags($testfieldsHandler->getVar('tf_dhtml')); -$pdfData['author'] = \XoopsUser::getUnameFromId($testfieldsHandler->getVar('tf_user')); -$pdfData['date'] = formatTimeStamp($testfieldsHandler->getVar('tf_textdateselect'), 's'); - -// Get Config -$pdfData['creator'] = $GLOBALS['xoopsConfig']['xoops_sitename']; -$pdfData['subject'] = $GLOBALS['xoopsConfig']['slogan']; -$pdfData['keywords'] = $GLOBALS['xoopsConfig']['keywords']; -// Defines -define('MYMODULE3_CREATOR', $pdfData['creator']); -define('MYMODULE3_AUTHOR', $pdfData['author']); -define('MYMODULE3_HEADER_TITLE', $pdfData['title']); -define('MYMODULE3_HEADER_STRING', $pdfData['subject']); -define('MYMODULE3_HEADER_LOGO', 'logo.gif'); -define('MYMODULE3_IMAGES_PATH', XOOPS_ROOT_PATH.'/images/'); -$myts = MyTextSanitizer::getInstance(); -$content = ''; -$content .= $myts->undoHtmlSpecialChars($pdfData['content']); -$content = $myts->displayTarea($content); -$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, _CHARSET, false); -$title = $myts->undoHtmlSpecialChars($pdfData['title']); -$keywords = $myts->undoHtmlSpecialChars($pdfData['keywords']); -$pdfData['fontsize'] = 12; -// For schinese -if (_LANGCODE == 'cn') { - $pdf->SetFont('gbsn00lp', '', $pdfData['fontsize']); -} else { - $pdf->SetFont($pdfData['fontname'], '', $pdfData['fontsize']); -} -// Set document information -$pdf->SetCreator($pdfData['creator']); -$pdf->SetAuthor($pdfData['author']); -$pdf->SetTitle($title); -$pdf->SetKeywords($keywords); -// Set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, MYMODULE3_HEADER_TITLE, MYMODULE3_HEADER_STRING); -// Set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT); -// Set auto page breaks -$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor -if (_LANGCODE == 'cn') { - $pdf->setHeaderFont(array('gbsn00lp', '', $pdfData['fontsize'])); - $pdf->setFooterFont(array('gbsn00lp', '', $pdfData['fontsize'])); -} else { - $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); -} -// Set some language-dependent strings (optional) -$lang = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php'; -if (@file_exists($lang)) { - require_once $lang; - $pdf->setLanguageArray($lang); -} -// Initialize document -$pdf->AliasNbPages(); -// Add Page document -$pdf->AddPage(); -$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $content, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); -// Pdf Filename -// Output -$GLOBALS['xoopsTpl']->assign('pdfoutput', $pdf->Output('testfields.pdf', 'I')); -$GLOBALS['xoopsTpl']->display('db:mymodule3_pdf.tpl'); diff --git a/testdata/mymodule3/preloads/autoloader.php b/testdata/mymodule3/preloads/autoloader.php deleted file mode 100644 index e23c6e01..00000000 --- a/testdata/mymodule3/preloads/autoloader.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -defined('XOOPS_ROOT_PATH') || die('Restricted access.'); - -/** - * Class Mymodule3CorePreload - */ -class Mymodule3CorePreload extends \XoopsPreloadItem -{ - // to add PSR-4 autoloader - - /** - * @param $args - */ - public static function eventCoreIncludeCommonEnd($args) - { - include __DIR__ . '/autoloader.php'; - } -} diff --git a/testdata/mymodule3/preloads/index.html b/testdata/mymodule3/preloads/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/testdata/mymodule3/preloads/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/testdata/mymodule3/print.php b/testdata/mymodule3/print.php deleted file mode 100644 index 06ff62d3..00000000 --- a/testdata/mymodule3/print.php +++ /dev/null @@ -1,49 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id'); -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -if (empty($tfId)) { - redirect_header(MYMODULE3_URL . '/index.php', 2, _MA_MYMODULE3_NOTFID); -} -// Get Instance of Handler -$testfieldsHandler = $helper->getHandler('testfields'); -// Verify that the article is published -$testfields = $testfieldsHandler->get($tfId); -// Verify permissions -if (!$grouppermHandler->checkRight('mymodule3_view', $tfId->getVar('tf_id'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) { - redirect_header(MYMODULE3_URL . '/index.php', 3, _NOPERM); - exit(); -} -$testfield = $testfields->getValuesTestfields(); -foreach($testfield as $k => $v) { - $GLOBALS['xoopsTpl']->append('"{$k}"', $v); -} -$GLOBALS['xoopsTpl']->assign('xoops_sitename', $GLOBALS['xoopsConfig']['sitename']); -$GLOBALS['xoopsTpl']->assign('xoops_pagetitle', strip_tags($testfield->getVar('tf_text') - _MA_MYMODULE3_PRINT - $GLOBALS['xoopsModule']->name())); -$GLOBALS['xoopsTpl']->display('db:testfields_print.tpl'); diff --git a/testdata/mymodule3/rate.php b/testdata/mymodule3/rate.php deleted file mode 100644 index de264f5b..00000000 --- a/testdata/mymodule3/rate.php +++ /dev/null @@ -1,21 +0,0 @@ - - Website: - */ diff --git a/testdata/mymodule3/rss.php b/testdata/mymodule3/rss.php deleted file mode 100644 index fea6e1b3..00000000 --- a/testdata/mymodule3/rss.php +++ /dev/null @@ -1,101 +0,0 @@ - - Website: - */ - -use Xmf\Request; - -require __DIR__ . '/header.php'; - -$cid = Request::getInt('cid', 0, 'GET'); -include_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 = mymodule3MyGetItemIds('mymodule3_view', 'mymodule3'); -$criteria = new \CriteriaCompo(); - -$criteria->add(new \Criteria('cat_status', 0, '!=')); -$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')','IN')); -if ($cid != 0){ - $criteria->add(new \Criteria('cid', $cid)); - $testfields = $testfieldsHandler->get($cid); - $title = $xoopsConfig['sitename'] . ' - ' . $xoopsModule->getVar('name') . ' - ' . $testfields->getVar('tf_combobox'); -} else { - $title = $xoopsConfig['sitename'] . ' - ' . $xoopsModule->getVar('name'); -} -$criteria->setLimit($helper->getConfig('perpagerss')); -$criteria->setSort('date'); -$criteria->setOrder('DESC'); -$testfieldsArr = $testfieldsHandler->getAll($criteria); -unset($criteria); - -if (!$tpl->is_cached('db:mymodule3_rss.tpl', $cid)) { - $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('tf_combobox'), ENT_QUOTES)); - $tpl->assign('channel_language', _LANGCODE); - if ( _LANGCODE == 'fr' ) { - $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($testfieldsArr) as $i) { - $description = $testfieldsArr[$i]->getVar('description'); - //permet d'afficher uniquement la description courte - if (strpos($description,'[pagebreak]')==false){ - $description_short = $description; - } else { - $description_short = substr($description,0,strpos($description,'[pagebreak]')); - } - $tpl->append('items', array('title' => htmlspecialchars($testfieldsArr[$i]->getVar('tf_combobox'), ENT_QUOTES), - 'link' => XOOPS_URL . '/modules/mymodule3/single.php?cid=' . $testfieldsArr[$i]->getVar('cid') . '&tf_id=' . $testfieldsArr[$i]->getVar('tf_id'), - 'guid' => XOOPS_URL . '/modules/mymodule3/single.php?cid=' . $testfieldsArr[$i]->getVar('cid') . '&tf_id=' . $testfieldsArr[$i]->getVar('tf_id'), - 'pubdate' => formatTimestamp($testfieldsArr[$i]->getVar('date'), 'rss'), - 'description' => htmlspecialchars($description_short, ENT_QUOTES))); - } -} -header('Content-Type:text/xml; charset=' . _CHARSET); -$tpl->display('db:mymodule3_rss.tpl', $cid); \ No newline at end of file diff --git a/testdata/mymodule3/single.php b/testdata/mymodule3/single.php deleted file mode 100644 index 0ad51b4c..00000000 --- a/testdata/mymodule3/single.php +++ /dev/null @@ -1,44 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id', 0); -$GLOBALS['xoopsOption']['template_main'] = 'mymodule3_single.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$keywords = array(); -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_TESTFIELDS]; -// Keywords -mymodule3MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); -// Description -mymodule3MetaDescription(_MA_MYMODULE3_TESTFIELDS_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE3_URL.'/index.php'); -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/sql/index.html b/testdata/mymodule3/sql/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/sql/mysql.sql b/testdata/mymodule3/sql/mysql.sql deleted file mode 100644 index eab4c581..00000000 --- a/testdata/mymodule3/sql/mysql.sql +++ /dev/null @@ -1,69 +0,0 @@ -# SQL Dump for my module 3 module -# PhpMyAdmin Version: 4.0.4 -# http://www.phpmyadmin.net -# -# Host: localhost -# Generated on: Tue Apr 28, 2020 to 21:04:20 -# Server version: 5.5.5-10.4.10-MariaDB -# PHP Version: 7.3.12 - -# -# Structure table for `mymodule3_categories` 5 -# - -CREATE TABLE `mymodule3_categories` ( - `cat_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `cat_name` VARCHAR(200) NOT NULL DEFAULT '', - `cat_logo` VARCHAR(200) NOT NULL DEFAULT '', - `cat_created` INT(10) NOT NULL DEFAULT '0', - `cat_submitter` INT(8) NOT NULL DEFAULT '0', - PRIMARY KEY (`cat_id`) -) ENGINE=InnoDB; - -# -# Structure table for `mymodule3_articles` 9 -# - -CREATE TABLE `mymodule3_articles` ( - `art_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `art_cat` INT(8) NOT NULL DEFAULT '0', - `art_title` VARCHAR(200) NOT NULL DEFAULT '', - `art_descr` MEDIUMTEXT NOT NULL , - `art_img` VARCHAR(200) NULL DEFAULT '''', - `art_online` TINYINT(1) NOT NULL DEFAULT '0', - `art_file` VARCHAR(200) NOT NULL DEFAULT '', - `art_created` INT(10) NOT NULL DEFAULT '0', - `art_submitter` INT(10) NOT NULL DEFAULT '0', - PRIMARY KEY (`art_id`) -) ENGINE=InnoDB; - -# -# Structure table for `mymodule3_testfields` 22 -# - -CREATE TABLE `mymodule3_testfields` ( - `tf_id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `tf_text` VARCHAR(255) NOT NULL DEFAULT '', - `tf_textarea` TEXT NOT NULL , - `tf_dhtml` TEXT NOT NULL , - `tf_checkbox` INT(10) NOT NULL DEFAULT '0', - `tf_yesno` INT(1) NOT NULL DEFAULT '0', - `tf_selectbox` INT(10) NOT NULL DEFAULT '0', - `tf_user` INT(10) NOT NULL DEFAULT '0', - `tf_color` VARCHAR(7) NOT NULL DEFAULT '', - `tf_imagelist` VARCHAR(255) NOT NULL DEFAULT '', - `tf_urlfile` VARCHAR(255) NOT NULL DEFAULT '', - `tf_uplimage` VARCHAR(255) NOT NULL DEFAULT '', - `tf_uplfile` VARCHAR(255) NOT NULL DEFAULT '', - `tf_textdateselect` INT(10) NOT NULL DEFAULT '0', - `tf_selectfile` VARCHAR(255) NOT NULL DEFAULT '', - `tf_password` VARCHAR(255) NOT NULL DEFAULT '', - `tf_country_list` VARCHAR(3) NOT NULL DEFAULT '', - `tf_language` VARCHAR(100) NOT NULL DEFAULT '', - `tf_radio` INT(10) NOT NULL DEFAULT '0', - `tf_status` INT(1) NOT NULL DEFAULT '0', - `tf_datetime` INT(10) NOT NULL DEFAULT '0', - `tf_combobox` INT(10) NOT NULL DEFAULT '0', - PRIMARY KEY (`tf_id`) -) ENGINE=InnoDB; - diff --git a/testdata/mymodule3/submit.php b/testdata/mymodule3/submit.php deleted file mode 100644 index e5c93376..00000000 --- a/testdata/mymodule3/submit.php +++ /dev/null @@ -1,253 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -xoops_loadLanguage('admin', 'mymodule3'); -// It recovered the value of argument op in URL$ -$op = Request::getString('op', 'form'); -// Template -$GLOBALS['xoopsOption']['template_main'] = 'mymodule3_submit.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; -$GLOBALS['xoTheme']->addStylesheet( $style, null ); -$permissionsHandler = $helper->getHandler('permissions'); -$permSubmit = $permissionsHandler->getPermGlobalSubmit(); -// Redirection if not permissions -if ($permSubmit === false) { - redirect_header('index.php', 2, _NOPERM); - exit(); -} -switch($op) { - case 'form': - default: - // Navigation - $navigation = _MA_MYMODULE3_SUBMIT_PROPOSER; - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); - // Title of page - $title = _MA_MYMODULE3_SUBMIT_PROPOSER . ' - '; - $title .= $GLOBALS['xoopsModule']->name(); - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); - // Description - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE3_SUBMIT_PROPOSER)); - // Form Create - $testfieldsObj = $testfieldsHandler->create(); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->render()); - break; - case 'save': - // Security Check - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); - } - $testfieldsObj = $testfieldsHandler->create(); - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); - $testfieldsObj->setVar('tf_selectbox', Request::getInt('tf_selectbox', 0)); - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); - // Set Var tf_imagelist - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - //$uploader->setPrefix(tf_imagelist_); - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1).php', 3, $errors); - } else { - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); - } - } else { - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); - } - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); - // Set Var tf_urlfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_urlfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); - } - // Set Var tf_uplimage - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplimage']['name']; - $imgMimetype = $_FILES['tf_uplimage']['type']; - $imgNameDef = Request::getString('tf_text'); - $uploaderErrors = ''; - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/', - $helper->getConfig('mimetypes_image'), - $helper->getConfig('maxsize_image'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); - if (!$uploader->upload()) { - $uploaderErrors = $uploader->getErrors(); - } else { - $savedFilename = $uploader->getSavedFileName(); - $maxwidth = (int)$helper->getConfig('maxwidth_image'); - $maxheight = (int)$helper->getConfig('maxheight_image'); - if ($maxwidth > 0 && $maxheight > 0) { - // Resize image - $imgHandler = new Mymodule3\Common\Resizer(); - $imgHandler->sourceFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->endFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; - $imgHandler->imageMimetype = $imgMimetype; - $imgHandler->maxWidth = $maxwidth; - $imgHandler->maxHeight = $maxheight; - $result = $imgHandler->resizeImage(); - } - $testfieldsObj->setVar('tf_uplimage', $savedFilename); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); - } - // Set Var tf_uplfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_uplfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); - } - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); - // Set Var tf_selectfile - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; - $filename = $_FILES['tf_selectfile']['name']; - $imgNameDef = Request::getString('tf_text'); - $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', - $helper->getConfig('mimetypes_file'), - $helper->getConfig('maxsize_file'), null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; - $uploader->setPrefix($imgName); - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - } else { - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); - } - } else { - if ($filename > '') { - $uploaderErrors = $uploader->getErrors(); - } - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); - } - $tfPassword = Request::getString('tf_password', ''); - if ('' !== $tfPassword) { - $testfieldsObj->setVar('tf_password', password_hash($tfPassword, PASSWORD_DEFAULT)); - } - $testfieldsObj->setVar('tf_country_list', Request::getString('tf_country_list', '')); - $testfieldsObj->setVar('tf_language', Request::getString('tf_language', '')); - $testfieldsObj->setVar('tf_radio', Request::getInt('tf_radio', 0)); - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); - $testfieldDatetimeArr = Request::getArray('tf_datetime'); - $testfieldDatetime = strtotime($testfieldDatetimeArr['date']) + (int)$testfieldDatetimeArr['time']; - $testfieldsObj->setVar('tf_datetime', $testfieldDatetime); - $testfieldsObj->setVar('tf_combobox', Request::getInt('tf_combobox', 0)); - // Insert Data - if ($testfieldsHandler->insert($testfieldsObj)) { - $newTfId = $testfieldsObj->getNewInsertedIdTestfields(); - $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId; - $grouppermHandler = xoops_getHandler('groupperm'); - $mid = $GLOBALS['xoopsModule']->getVar('mid'); - // Permission to view_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule3_view_testfields', $permId); - if (isset($_POST['groups_view_testfields'])) { - foreach($_POST['groups_view_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_view_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to submit_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule3_submit_testfields', $permId); - if (isset($_POST['groups_submit_testfields'])) { - foreach($_POST['groups_submit_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_submit_testfields', $permId, $onegroupId, $mid); - } - } - // Permission to approve_testfields - $grouppermHandler->deleteByModule($mid, 'mymodule3_approve_testfields', $permId); - if (isset($_POST['groups_approve_testfields'])) { - foreach($_POST['groups_approve_testfields'] as $onegroupId) { - $grouppermHandler->addRight('mymodule3_approve_testfields', $permId, $onegroupId, $mid); - } - } - if ('' !== $uploaderErrors) { - redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors); - } else { - redirect_header('testfields.php?op=list', 2, _MA_MYMODULE3_FORM_OK); - } - } - // Get Form Error - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); - $form = $testfieldsObj->getFormTestfields(); - $GLOBALS['xoopsTpl']->assign('form', $form->display()); - break; -} -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_SUBMIT]; -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/templates/admin/index.html b/testdata/mymodule3/templates/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/templates/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_about.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_about.tpl deleted file mode 100644 index 929c2a34..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_about.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -<{includeq file='db:mymodule3_admin_header.tpl'}> - - -
      <{$about}>
      - - -<{includeq file='db:mymodule3_admin_footer.tpl'}> diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_articles.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_articles.tpl deleted file mode 100644 index bf730dd4..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_articles.tpl +++ /dev/null @@ -1,56 +0,0 @@ - -<{include file='db:mymodule3_admin_header.tpl'}> - -<{if $articles_list}> - - - - - - - - - - - - - - - - <{if $articles_count}> - - <{foreach item=article from=$articles_list}> - '> - - - - - - - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE3_ARTICLE_ID}><{$smarty.const._AM_MYMODULE3_ARTICLE_CAT}><{$smarty.const._AM_MYMODULE3_ARTICLE_TITLE}><{$smarty.const._AM_MYMODULE3_ARTICLE_DESCR}><{$smarty.const._AM_MYMODULE3_ARTICLE_IMG}><{$smarty.const._AM_MYMODULE3_ARTICLE_ONLINE}><{$smarty.const._AM_MYMODULE3_ARTICLE_FILE}><{$smarty.const._AM_MYMODULE3_ARTICLE_CREATED}><{$smarty.const._AM_MYMODULE3_ARTICLE_SUBMITTER}><{$smarty.const._AM_MYMODULE3_FORM_ACTION}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articles<{$article.online}><{$article.file}><{$article.created}><{$article.submitter}> - articles - articles -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule3_admin_footer.tpl'}> diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_categories.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_categories.tpl deleted file mode 100644 index 5f02d863..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_categories.tpl +++ /dev/null @@ -1,44 +0,0 @@ - -<{include file='db:mymodule3_admin_header.tpl'}> - -<{if $categories_list}> - - - - - - - - - - <{if $categories_count}> - - <{foreach item=category from=$categories_list}> - '> - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE3_CATEGORY_ID}><{$smarty.const._AM_MYMODULE3_CATEGORY_NAME}><{$smarty.const._AM_MYMODULE3_CATEGORY_CREATED}><{$smarty.const._AM_MYMODULE3_FORM_ACTION}>
      <{$category.id}><{$category.name}><{$category.created}> - categories - categories -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule3_admin_footer.tpl'}> diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_footer.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_footer.tpl deleted file mode 100644 index b1a0f43d..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_footer.tpl +++ /dev/null @@ -1,6 +0,0 @@ -
      - XOOPS -
      -
      - My Module 3<{$smarty.const._AM_MYMODULE3_MAINTAINEDBY}>Support Forum -
      diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_header.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_header.tpl deleted file mode 100644 index 95b90868..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_header.tpl +++ /dev/null @@ -1,6 +0,0 @@ -
      - <{$navigation}> - <{if $buttons}> - <{$buttons}> - <{/if}> -
      diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_index.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_index.tpl deleted file mode 100644 index 58186fac..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_index.tpl +++ /dev/null @@ -1,8 +0,0 @@ - -<{includeq file='db:mymodule3_admin_header.tpl'}> - - -
      <{$index}>
      - - -<{includeq file='db:mymodule3_admin_footer.tpl'}> diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_permissions.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_permissions.tpl deleted file mode 100644 index 316957f3..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_permissions.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<{include file='db:mymodule3_admin_header.tpl'}> - -
      <{$form}>
      - -<{include file='db:mymodule3_admin_footer.tpl'}> diff --git a/testdata/mymodule3/templates/admin/mymodule3_admin_testfields.tpl b/testdata/mymodule3/templates/admin/mymodule3_admin_testfields.tpl deleted file mode 100644 index c6739bb5..00000000 --- a/testdata/mymodule3/templates/admin/mymodule3_admin_testfields.tpl +++ /dev/null @@ -1,82 +0,0 @@ - -<{include file='db:mymodule3_admin_header.tpl'}> - -<{if $testfields_list}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <{if $testfields_count}> - - <{foreach item=testfield from=$testfields_list}> - '> - - - - - - - - - - - - - - - - - - - - - - - - - <{/foreach}> - - <{/if}> -
      <{$smarty.const._AM_MYMODULE3_TESTFIELD_ID}><{$smarty.const._AM_MYMODULE3_TESTFIELD_TEXT}><{$smarty.const._AM_MYMODULE3_TESTFIELD_TEXTAREA}><{$smarty.const._AM_MYMODULE3_TESTFIELD_DHTML}><{$smarty.const._AM_MYMODULE3_TESTFIELD_CHECKBOX}><{$smarty.const._AM_MYMODULE3_TESTFIELD_YESNO}><{$smarty.const._AM_MYMODULE3_TESTFIELD_SELECTBOX}><{$smarty.const._AM_MYMODULE3_TESTFIELD_USER}><{$smarty.const._AM_MYMODULE3_TESTFIELD_COLOR}><{$smarty.const._AM_MYMODULE3_TESTFIELD_IMAGELIST}><{$smarty.const._AM_MYMODULE3_TESTFIELD_URLFILE}><{$smarty.const._AM_MYMODULE3_TESTFIELD_UPLIMAGE}><{$smarty.const._AM_MYMODULE3_TESTFIELD_UPLFILE}><{$smarty.const._AM_MYMODULE3_TESTFIELD_TEXTDATESELECT}><{$smarty.const._AM_MYMODULE3_TESTFIELD_SELECTFILE}><{$smarty.const._AM_MYMODULE3_TESTFIELD_PASSWORD}><{$smarty.const._AM_MYMODULE3_TESTFIELD_COUNTRY_LIST}><{$smarty.const._AM_MYMODULE3_TESTFIELD_LANGUAGE}><{$smarty.const._AM_MYMODULE3_TESTFIELD_RADIO}><{$smarty.const._AM_MYMODULE3_TESTFIELD_STATUS}><{$smarty.const._AM_MYMODULE3_TESTFIELD_DATETIME}><{$smarty.const._AM_MYMODULE3_TESTFIELD_COMBOBOX}><{$smarty.const._AM_MYMODULE3_FORM_ACTION}>
      <{$testfield.id}><{$testfield.text}><{$testfield.textarea}><{$testfield.dhtml}>testfields<{$testfield.yesno}><{$testfield.selectbox}><{$testfield.user}>    testfields<{$testfield.urlfile}>testfields<{$testfield.uplfile}><{$testfield.textdateselect}><{$testfield.selectfile}><{$testfield.password}><{$testfield.country_list}><{$testfield.language}><{$testfield.radio}>testfields<{$testfield.datetime}><{$testfield.combobox}> - testfields - testfields -
      -
       
      - <{if $pagenav}> -
      <{$pagenav}>
      -
      - <{/if}> -<{/if}> -<{if $form}> - <{$form}> -<{/if}> -<{if $error}> -
      <{$error}>
      -<{/if}> - - -<{include file='db:mymodule3_admin_footer.tpl'}> diff --git a/testdata/mymodule3/templates/blocks/index.html b/testdata/mymodule3/templates/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/templates/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/templates/blocks/mymodule3_block_articles.tpl b/testdata/mymodule3/templates/blocks/mymodule3_block_articles.tpl deleted file mode 100644 index 5423e6a7..00000000 --- a/testdata/mymodule3/templates/blocks/mymodule3_block_articles.tpl +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - <{if count($block)}> - - <{foreach item=article from=$block}> - - - - - - - - - - - <{/foreach}> - - <{/if}> - -
       <{$smarty.const._MB_MYMODULE3_ART_CAT}><{$smarty.const._MB_MYMODULE3_ART_TITLE}><{$smarty.const._MB_MYMODULE3_ART_DESCR}><{$smarty.const._MB_MYMODULE3_ART_IMG}><{$smarty.const._MB_MYMODULE3_ART_FILE}><{$smarty.const._MB_MYMODULE3_ART_CREATED}><{$smarty.const._MB_MYMODULE3_ART_SUBMITTER}>
      <{$article.id}><{$article.cat}><{$article.title}><{$article.descr}>articles<{$article.file}><{$article.created}><{$article.submitter}>
       
      diff --git a/testdata/mymodule3/templates/blocks/mymodule3_block_testfields.tpl b/testdata/mymodule3/templates/blocks/mymodule3_block_testfields.tpl deleted file mode 100644 index b784ef1b..00000000 --- a/testdata/mymodule3/templates/blocks/mymodule3_block_testfields.tpl +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - <{if count($block)}> - - <{foreach item=testfield from=$block}> - - - - <{/foreach}> - - <{/if}> - -
       
      <{$testfield.id}>
       
      diff --git a/testdata/mymodule3/templates/index.html b/testdata/mymodule3/templates/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/templates/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/templates/mymodule3_articles.tpl b/testdata/mymodule3/templates/mymodule3_articles.tpl deleted file mode 100644 index 960558ae..00000000 --- a/testdata/mymodule3/templates/mymodule3_articles.tpl +++ /dev/null @@ -1,30 +0,0 @@ -<{include file='db:mymodule3_header.tpl'}> - -<{if $articlesCount > 0}> -
      - - - - - - - - - <{foreach item=article from=$articles}> - - <{if $article.count is div by $divideby}> - - <{/if}> - <{/foreach}> - - - -
      <{$smarty.const._MA_MYMODULE3_ARTICLES_TITLE}>
      -
      - <{include file='db:mymodule3_articles_list.tpl' article=$article}> -
      -
       
      -
      -<{/if}> - -<{include file='db:mymodule3_footer.tpl'}> diff --git a/testdata/mymodule3/templates/mymodule3_articles_list.tpl b/testdata/mymodule3/templates/mymodule3_articles_list.tpl deleted file mode 100644 index a700115b..00000000 --- a/testdata/mymodule3/templates/mymodule3_articles_list.tpl +++ /dev/null @@ -1,21 +0,0 @@ -
      -

      <{$article.submitter}>

      -
      -
      - <{$article.cat}> - <{$article.title}> - <{$article.descr}> - articles - <{$article.file}> - <{$article.created}> - <{$article.submitter}> -
      -
      - <{$smarty.const._MA_MYMODULE3_ARTICLE_CAT}>: <{$article.cat}> - <{$smarty.const._MA_MYMODULE3_ARTICLE_TITLE}>: <{$article.title}> - <{$smarty.const._MA_MYMODULE3_ARTICLE_DESCR}>: <{$article.descr}> - <{$smarty.const._MA_MYMODULE3_ARTICLE_IMG}>: <{$article.img}> - <{$smarty.const._MA_MYMODULE3_ARTICLE_FILE}>: <{$article.file}> - <{$smarty.const._MA_MYMODULE3_ARTICLE_CREATED}>: <{$article.created}> - <{$smarty.const._MA_MYMODULE3_ARTICLE_SUBMITTER}>: <{$article.submitter}> -
      diff --git a/testdata/mymodule3/templates/mymodule3_breadcrumbs.tpl b/testdata/mymodule3/templates/mymodule3_breadcrumbs.tpl deleted file mode 100644 index 2290b814..00000000 --- a/testdata/mymodule3/templates/mymodule3_breadcrumbs.tpl +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/testdata/mymodule3/templates/mymodule3_broken.tpl b/testdata/mymodule3/templates/mymodule3_broken.tpl deleted file mode 100644 index ee14ae9c..00000000 --- a/testdata/mymodule3/templates/mymodule3_broken.tpl +++ /dev/null @@ -1,59 +0,0 @@ -<{include file='db:mymodule3_header.tpl'}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <{foreach item=testfield from=$testfields}> - - - - - - - - - - - - - - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE3_TF_ID}><{$smarty.const._MA_MYMODULE3_TF_TEXT}><{$smarty.const._MA_MYMODULE3_TF_TEXTAREA}><{$smarty.const._MA_MYMODULE3_TF_DHTML}><{$smarty.const._MA_MYMODULE3_TF_CHECKBOX}><{$smarty.const._MA_MYMODULE3_TF_YESNO}><{$smarty.const._MA_MYMODULE3_TF_SELECTBOX}><{$smarty.const._MA_MYMODULE3_TF_USER}><{$smarty.const._MA_MYMODULE3_TF_COLOR}><{$smarty.const._MA_MYMODULE3_TF_IMAGELIST}><{$smarty.const._MA_MYMODULE3_TF_URLFILE}><{$smarty.const._MA_MYMODULE3_TF_UPLIMAGE}><{$smarty.const._MA_MYMODULE3_TF_UPLFILE}><{$smarty.const._MA_MYMODULE3_TF_TEXTDATESELECT}><{$smarty.const._MA_MYMODULE3_TF_SELECTFILE}><{$smarty.const._MA_MYMODULE3_TF_PASSWORD}><{$smarty.const._MA_MYMODULE3_TF_COUNTRY_LIST}><{$smarty.const._MA_MYMODULE3_TF_LANGUAGE}><{$smarty.const._MA_MYMODULE3_TF_RADIO}><{$smarty.const._MA_MYMODULE3_TF_STATUS}><{$smarty.const._MA_MYMODULE3_TF_DATETIME}><{$smarty.const._MA_MYMODULE3_TF_COMBOBOX}>
      <{$testfield.id}><{$testfield.text}><{$testfield.textarea}><{$testfield.dhtml}><{$testfield.checkbox}><{$testfield.yesno}><{$testfield.selectbox}><{$testfield.user}><{$mymodule3_upload_url}>/images/testfields/<{$testfield.color}> -testfields<{$testfield.urlfile}>testfields<{$testfield.uplfile}><{$testfield.textdateselect}><{$testfield.selectfile}><{$testfield.password}><{$testfield.country_list}><{$testfield.language}><{$testfield.radio}><{$testfield.status}><{$testfield.datetime}><{$testfield.combobox}>
      -<{include file='db:mymodule3_footer.tpl'}> diff --git a/testdata/mymodule3/templates/mymodule3_footer.tpl b/testdata/mymodule3/templates/mymodule3_footer.tpl deleted file mode 100644 index b16053d7..00000000 --- a/testdata/mymodule3/templates/mymodule3_footer.tpl +++ /dev/null @@ -1,27 +0,0 @@ -<{if $bookmarks != 0}> - <{include file="db:system_bookmarks.tpl"}> -<{/if}> - -<{if $fbcomments != 0}> - <{include file="db:system_fbcomments.tpl"}> -<{/if}> -
      <{$copyright}>
      -<{if $pagenav != ''}> -
      <{$pagenav}>
      -<{/if}> -
      -<{if $xoops_isadmin}> -
      -<{/if}> -
      - <{if $comment_mode == "flat"}> - <{include file="db:system_comments_flat.tpl"}> - <{elseif $comment_mode == "thread"}> - <{include file="db:system_comments_thread.tpl"}> - <{elseif $comment_mode == "nest"}> - <{include file="db:system_comments_nest.tpl"}> - <{/if}> -
      - -
      -<{include file='db:system_notification_select.tpl'}> \ No newline at end of file diff --git a/testdata/mymodule3/templates/mymodule3_header.tpl b/testdata/mymodule3/templates/mymodule3_header.tpl deleted file mode 100644 index ece8f5d8..00000000 --- a/testdata/mymodule3/templates/mymodule3_header.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<{includeq file='db:mymodule3_breadcrumbs.tpl'}> - -<{if $ads != ''}> -
      <{$ads}>
      -<{/if}> diff --git a/testdata/mymodule3/templates/mymodule3_index.tpl b/testdata/mymodule3/templates/mymodule3_index.tpl deleted file mode 100644 index 0c2c0013..00000000 --- a/testdata/mymodule3/templates/mymodule3_index.tpl +++ /dev/null @@ -1,128 +0,0 @@ -<{include file='db:mymodule3_header.tpl'}> - -<{if $testfieldsCount == 0}> - - - - - - - - - - - - - <{if $adv != ''}> - - <{else}> - - <{/if}> - -
      <{$smarty.const._MA_MYMODULE3_TITLE}> - <{$smarty.const._MA_MYMODULE3_DESC}>
      - -
      <{$smarty.const._MA_MYMODULE3_INDEX_DESC}>
      -
      <{$adv}>
       
      -<{/if}> -<{if $articlesCount > 0}> -
      - - - - - - - - - <{foreach item=article from=$articles}> - - <{if $article.count is div by $numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
      <{$smarty.const._MA_MYMODULE3_ARTICLES}>
      - <{include file="db:mymodule3_articles_list.tpl" article=$article}> -
      <{$lang_thereare}>
      -
      -<{/if}> - -<{if $articlesCount > 0}> - -
      <{$smarty.const._MA_MYMODULE3_INDEX_LATEST_LIST}>
      - - - - <{section name=i loop=$articles}> - - <{if $articles[i].count is div by $divideby}> - - <{/if}> - <{/section}> - - -
      - <{include file="db:mymodule3_articles_list.tpl" article=$articles[i]}> -
      - -<{/if}> -<{if $testfieldsCount > 0}> -
      - - - - - - - - - <{foreach item=testfield from=$testfields}> - - <{if $testfield.count is div by $numb_col}> - - <{/if}> - <{/foreach}> - - - - - - - -
      <{$smarty.const._MA_MYMODULE3_TESTFIELDS}>
      - <{include file="db:mymodule3_testfields_list.tpl" testfield=$testfield}> -
      <{$lang_thereare}>
      -
      -<{/if}> - -<{if $testfieldsCount > 0}> - -
      <{$smarty.const._MA_MYMODULE3_INDEX_LATEST_LIST}>
      - - - - <{section name=i loop=$testfields}> - - <{if $testfields[i].count is div by $divideby}> - - <{/if}> - <{/section}> - - -
      - <{include file="db:mymodule3_testfields_list.tpl" testfield=$testfields[i]}> -
      - -<{/if}> -<{include file='db:mymodule3_footer.tpl'}> diff --git a/testdata/mymodule3/templates/mymodule3_pdf.tpl b/testdata/mymodule3/templates/mymodule3_pdf.tpl deleted file mode 100644 index 524fd9d6..00000000 --- a/testdata/mymodule3/templates/mymodule3_pdf.tpl +++ /dev/null @@ -1 +0,0 @@ -
      <{$pdfoutput}>
      \ No newline at end of file diff --git a/testdata/mymodule3/templates/mymodule3_print.tpl b/testdata/mymodule3/templates/mymodule3_print.tpl deleted file mode 100644 index 32d00909..00000000 --- a/testdata/mymodule3/templates/mymodule3_print.tpl +++ /dev/null @@ -1,58 +0,0 @@ -<{include file="db:mymodule3_header.tpl"}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <{foreach item=list from=$testfields}> - - - - - - - - - - - - - - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE3_TF_ID}><{$smarty.const._MA_MYMODULE3_TF_TEXT}><{$smarty.const._MA_MYMODULE3_TF_TEXTAREA}><{$smarty.const._MA_MYMODULE3_TF_DHTML}><{$smarty.const._MA_MYMODULE3_TF_CHECKBOX}><{$smarty.const._MA_MYMODULE3_TF_YESNO}><{$smarty.const._MA_MYMODULE3_TF_SELECTBOX}><{$smarty.const._MA_MYMODULE3_TF_USER}><{$smarty.const._MA_MYMODULE3_TF_COLOR}><{$smarty.const._MA_MYMODULE3_TF_IMAGELIST}><{$smarty.const._MA_MYMODULE3_TF_URLFILE}><{$smarty.const._MA_MYMODULE3_TF_UPLIMAGE}><{$smarty.const._MA_MYMODULE3_TF_UPLFILE}><{$smarty.const._MA_MYMODULE3_TF_TEXTDATESELECT}><{$smarty.const._MA_MYMODULE3_TF_SELECTFILE}><{$smarty.const._MA_MYMODULE3_TF_PASSWORD}><{$smarty.const._MA_MYMODULE3_TF_COUNTRY_LIST}><{$smarty.const._MA_MYMODULE3_TF_LANGUAGE}><{$smarty.const._MA_MYMODULE3_TF_RADIO}><{$smarty.const._MA_MYMODULE3_TF_STATUS}><{$smarty.const._MA_MYMODULE3_TF_DATETIME}><{$smarty.const._MA_MYMODULE3_TF_COMBOBOX}>
      <{$list.id}><{$list.text}><{$list.textarea}><{$list.dhtml}><{$list.checkbox}><{$list.yesno}><{$list.selectbox}><{$list.user}> testfields<{$list.urlfile}>testfields<{$list.uplfile}><{$list.textdateselect}><{$list.selectfile}><{$list.password}><{$list.country_list}><{$list.language}><{$list.radio}><{$list.status}><{$list.datetime}><{$list.combobox}>
      -<{include file="db:mymodule3_footer.tpl"}> \ No newline at end of file diff --git a/testdata/mymodule3/templates/mymodule3_rate.tpl b/testdata/mymodule3/templates/mymodule3_rate.tpl deleted file mode 100644 index 32d00909..00000000 --- a/testdata/mymodule3/templates/mymodule3_rate.tpl +++ /dev/null @@ -1,58 +0,0 @@ -<{include file="db:mymodule3_header.tpl"}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <{foreach item=list from=$testfields}> - - - - - - - - - - - - - - - - - - - - - - - - - <{/foreach}> - -
      <{$smarty.const._MA_MYMODULE3_TF_ID}><{$smarty.const._MA_MYMODULE3_TF_TEXT}><{$smarty.const._MA_MYMODULE3_TF_TEXTAREA}><{$smarty.const._MA_MYMODULE3_TF_DHTML}><{$smarty.const._MA_MYMODULE3_TF_CHECKBOX}><{$smarty.const._MA_MYMODULE3_TF_YESNO}><{$smarty.const._MA_MYMODULE3_TF_SELECTBOX}><{$smarty.const._MA_MYMODULE3_TF_USER}><{$smarty.const._MA_MYMODULE3_TF_COLOR}><{$smarty.const._MA_MYMODULE3_TF_IMAGELIST}><{$smarty.const._MA_MYMODULE3_TF_URLFILE}><{$smarty.const._MA_MYMODULE3_TF_UPLIMAGE}><{$smarty.const._MA_MYMODULE3_TF_UPLFILE}><{$smarty.const._MA_MYMODULE3_TF_TEXTDATESELECT}><{$smarty.const._MA_MYMODULE3_TF_SELECTFILE}><{$smarty.const._MA_MYMODULE3_TF_PASSWORD}><{$smarty.const._MA_MYMODULE3_TF_COUNTRY_LIST}><{$smarty.const._MA_MYMODULE3_TF_LANGUAGE}><{$smarty.const._MA_MYMODULE3_TF_RADIO}><{$smarty.const._MA_MYMODULE3_TF_STATUS}><{$smarty.const._MA_MYMODULE3_TF_DATETIME}><{$smarty.const._MA_MYMODULE3_TF_COMBOBOX}>
      <{$list.id}><{$list.text}><{$list.textarea}><{$list.dhtml}><{$list.checkbox}><{$list.yesno}><{$list.selectbox}><{$list.user}> testfields<{$list.urlfile}>testfields<{$list.uplfile}><{$list.textdateselect}><{$list.selectfile}><{$list.password}><{$list.country_list}><{$list.language}><{$list.radio}><{$list.status}><{$list.datetime}><{$list.combobox}>
      -<{include file="db:mymodule3_footer.tpl"}> \ No newline at end of file diff --git a/testdata/mymodule3/templates/mymodule3_rss.tpl b/testdata/mymodule3/templates/mymodule3_rss.tpl deleted file mode 100644 index 594ebe0e..00000000 --- a/testdata/mymodule3/templates/mymodule3_rss.tpl +++ /dev/null @@ -1,33 +0,0 @@ - - - - <{$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}> - - diff --git a/testdata/mymodule3/templates/mymodule3_single.tpl b/testdata/mymodule3/templates/mymodule3_single.tpl deleted file mode 100644 index 96eeb313..00000000 --- a/testdata/mymodule3/templates/mymodule3_single.tpl +++ /dev/null @@ -1,11 +0,0 @@ -<{include file='db:mymodule3_header.tpl'}> - -
      -
      -
      - -
      -
      -
      - -<{include file='db:mymodule3_footer.tpl'}> diff --git a/testdata/mymodule3/templates/mymodule3_submit.tpl b/testdata/mymodule3/templates/mymodule3_submit.tpl deleted file mode 100644 index b513a443..00000000 --- a/testdata/mymodule3/templates/mymodule3_submit.tpl +++ /dev/null @@ -1,18 +0,0 @@ -<{include file='db:mymodule3_header.tpl'}> - -
      -
        -
      • <{$smarty.const._MA_MYMODULE3_SUBMIT_SUBMITONCE}>
      • -
      • <{$smarty.const._MA_MYMODULE3_SUBMIT_ALLPENDING}>
      • -
      • <{$smarty.const._MA_MYMODULE3_SUBMIT_DONTABUSE}>
      • -
      • <{$smarty.const._MA_MYMODULE3_SUBMIT_TAKEDAYS}>
      • -
      -
      -<{if $message_error != ''}> -
      <{$message_error}>
      -<{/if}> -
      - <{$form}> -
      - -<{include file='db:mymodule3_footer.tpl'}> diff --git a/testdata/mymodule3/templates/mymodule3_testfields.tpl b/testdata/mymodule3/templates/mymodule3_testfields.tpl deleted file mode 100644 index 86bc1c7c..00000000 --- a/testdata/mymodule3/templates/mymodule3_testfields.tpl +++ /dev/null @@ -1,30 +0,0 @@ -<{include file='db:mymodule3_header.tpl'}> - -<{if $testfieldsCount > 0}> -
      - - - - - - - - - <{foreach item=testfield from=$testfields}> - - <{if $testfield.count is div by $divideby}> - - <{/if}> - <{/foreach}> - - - -
      <{$smarty.const._MA_MYMODULE3_TESTFIELDS_TITLE}>
      -
      - <{include file='db:mymodule3_testfields_list.tpl' testfield=$testfield}> -
      -
       
      -
      -<{/if}> - -<{include file='db:mymodule3_footer.tpl'}> diff --git a/testdata/mymodule3/templates/mymodule3_testfields_list.tpl b/testdata/mymodule3/templates/mymodule3_testfields_list.tpl deleted file mode 100644 index 36b6167d..00000000 --- a/testdata/mymodule3/templates/mymodule3_testfields_list.tpl +++ /dev/null @@ -1,25 +0,0 @@ -
      -
      -
      - <{$testfield.text}> - <{$testfield.textarea}> - <{$testfield.dhtml}> - <{$testfield.checkbox}> - <{$testfield.yesno}> - <{$testfield.selectbox}> - <{$testfield.user}> - <{$testfield.color}> - testfields - <{$testfield.urlfile}> - testfields - <{$testfield.uplfile}> - <{$testfield.textdateselect}> - <{$testfield.selectfile}> - <{$testfield.country_list}> - <{$testfield.radio}> - <{$testfield.status}> - <{$testfield.datetime}> - <{$testfield.combobox}> -
      -
      -
      diff --git a/testdata/mymodule3/testdata/english/group_permission.yml b/testdata/mymodule3/testdata/english/group_permission.yml deleted file mode 100644 index 51029bcb..00000000 --- a/testdata/mymodule3/testdata/english/group_permission.yml +++ /dev/null @@ -1,140 +0,0 @@ -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_approve_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_submit_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_approve_articles -- - gperm_groupid: '3' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '3' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_approve_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_approve_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '3' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_approve_testfields diff --git a/testdata/mymodule3/testdata/english/index.html b/testdata/mymodule3/testdata/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/testdata/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/testdata/english/mymodule3_articles.yml b/testdata/mymodule3/testdata/english/mymodule3_articles.yml deleted file mode 100644 index fbb22feb..00000000 --- a/testdata/mymodule3/testdata/english/mymodule3_articles.yml +++ /dev/null @@ -1,30 +0,0 @@ -- - art_id: '1' - art_cat: '1' - art_title: 'First Article for Cat 1' - art_descr: 'This is the first article for category 1' - art_img: blank.gif - art_online: '0' - art_file: '' - art_created: '1588087130' - art_submitter: '1' -- - art_id: '2' - art_cat: '1' - art_title: 'Second for 1' - art_descr: 'This is the second article for cat 1' - art_img: blank.gif - art_online: '0' - art_file: '' - art_created: '1588087177' - art_submitter: '1' -- - art_id: '3' - art_cat: '2' - art_title: 'Number 1 of Cat 2' - art_descr: 'First article of category 2' - art_img: blank.gif - art_online: '0' - art_file: '' - art_created: '1588102081' - art_submitter: '1' diff --git a/testdata/mymodule3/testdata/english/mymodule3_categories.yml b/testdata/mymodule3/testdata/english/mymodule3_categories.yml deleted file mode 100644 index e23bd4b4..00000000 --- a/testdata/mymodule3/testdata/english/mymodule3_categories.yml +++ /dev/null @@ -1,12 +0,0 @@ -- - cat_id: '1' - cat_name: 'My Cat 1' - cat_logo: '' - cat_created: '1588087059' - cat_submitter: '0' -- - cat_id: '2' - cat_name: 'Second Category' - cat_logo: '' - cat_created: '1588102072' - cat_submitter: '0' diff --git a/testdata/mymodule3/testdata/english/mymodule3_testfields.yml b/testdata/mymodule3/testdata/english/mymodule3_testfields.yml deleted file mode 100644 index dbe0f6e9..00000000 --- a/testdata/mymodule3/testdata/english/mymodule3_testfields.yml +++ /dev/null @@ -1,46 +0,0 @@ -- - tf_id: '2' - tf_text: 'Testfields 2' - tf_textarea: '' - tf_dhtml: '' - tf_checkbox: '0' - tf_yesno: '0' - tf_selectbox: '0' - tf_user: '1' - tf_color: '#ff8000' - tf_imagelist: administration.png - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1588107919' - tf_selectfile: '' - tf_password: '' - tf_country_list: '' - tf_language: '' - tf_radio: '0' - tf_status: '1' - tf_datetime: '1588087800' - tf_combobox: '0' -- - tf_id: '3' - tf_text: 'Testfields 2' - tf_textarea: 'Text in Text area line 1Text in Text area line 2' - tf_dhtml: "Text in dhtml line 1\r\nText in dhtml line 2\r\nText in dhtml line 3" - tf_checkbox: '1' - tf_yesno: '1' - tf_selectbox: '2' - tf_user: '1' - tf_color: '#80ff00' - tf_imagelist: administration.png - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1588107948' - tf_selectfile: '' - tf_password: $2y$10$V9T.M01xetztsHXWtrhZceHV7QqOlHAHFYJfVdoHJtfOIiv7m7tDm - tf_country_list: AT - tf_language: german - tf_radio: '1' - tf_status: '3' - tf_datetime: '1588107000' - tf_combobox: '3' diff --git a/testdata/mymodule3/testdata/german/group_permission.yml b/testdata/mymodule3/testdata/german/group_permission.yml deleted file mode 100644 index 51029bcb..00000000 --- a/testdata/mymodule3/testdata/german/group_permission.yml +++ /dev/null @@ -1,140 +0,0 @@ -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_approve_testfields -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_submit_testfields -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_approve_articles -- - gperm_groupid: '3' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '3' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '3' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_approve_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_approve_articles -- - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '47' - gperm_name: mymodule3_view_articles -- - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '47' - gperm_name: mymodule3_submit_articles -- - gperm_groupid: '3' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_view_testfields -- - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_submit_testfields -- - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '47' - gperm_name: mymodule3_approve_testfields diff --git a/testdata/mymodule3/testdata/german/index.html b/testdata/mymodule3/testdata/german/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/testdata/german/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/testdata/german/mymodule3_articles.yml b/testdata/mymodule3/testdata/german/mymodule3_articles.yml deleted file mode 100644 index fbb22feb..00000000 --- a/testdata/mymodule3/testdata/german/mymodule3_articles.yml +++ /dev/null @@ -1,30 +0,0 @@ -- - art_id: '1' - art_cat: '1' - art_title: 'First Article for Cat 1' - art_descr: 'This is the first article for category 1' - art_img: blank.gif - art_online: '0' - art_file: '' - art_created: '1588087130' - art_submitter: '1' -- - art_id: '2' - art_cat: '1' - art_title: 'Second for 1' - art_descr: 'This is the second article for cat 1' - art_img: blank.gif - art_online: '0' - art_file: '' - art_created: '1588087177' - art_submitter: '1' -- - art_id: '3' - art_cat: '2' - art_title: 'Number 1 of Cat 2' - art_descr: 'First article of category 2' - art_img: blank.gif - art_online: '0' - art_file: '' - art_created: '1588102081' - art_submitter: '1' diff --git a/testdata/mymodule3/testdata/german/mymodule3_categories.yml b/testdata/mymodule3/testdata/german/mymodule3_categories.yml deleted file mode 100644 index e23bd4b4..00000000 --- a/testdata/mymodule3/testdata/german/mymodule3_categories.yml +++ /dev/null @@ -1,12 +0,0 @@ -- - cat_id: '1' - cat_name: 'My Cat 1' - cat_logo: '' - cat_created: '1588087059' - cat_submitter: '0' -- - cat_id: '2' - cat_name: 'Second Category' - cat_logo: '' - cat_created: '1588102072' - cat_submitter: '0' diff --git a/testdata/mymodule3/testdata/german/mymodule3_testfields.yml b/testdata/mymodule3/testdata/german/mymodule3_testfields.yml deleted file mode 100644 index dbe0f6e9..00000000 --- a/testdata/mymodule3/testdata/german/mymodule3_testfields.yml +++ /dev/null @@ -1,46 +0,0 @@ -- - tf_id: '2' - tf_text: 'Testfields 2' - tf_textarea: '' - tf_dhtml: '' - tf_checkbox: '0' - tf_yesno: '0' - tf_selectbox: '0' - tf_user: '1' - tf_color: '#ff8000' - tf_imagelist: administration.png - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1588107919' - tf_selectfile: '' - tf_password: '' - tf_country_list: '' - tf_language: '' - tf_radio: '0' - tf_status: '1' - tf_datetime: '1588087800' - tf_combobox: '0' -- - tf_id: '3' - tf_text: 'Testfields 2' - tf_textarea: 'Text in Text area line 1Text in Text area line 2' - tf_dhtml: "Text in dhtml line 1\r\nText in dhtml line 2\r\nText in dhtml line 3" - tf_checkbox: '1' - tf_yesno: '1' - tf_selectbox: '2' - tf_user: '1' - tf_color: '#80ff00' - tf_imagelist: administration.png - tf_urlfile: '' - tf_uplimage: blank.gif - tf_uplfile: '' - tf_textdateselect: '1588107948' - tf_selectfile: '' - tf_password: $2y$10$V9T.M01xetztsHXWtrhZceHV7QqOlHAHFYJfVdoHJtfOIiv7m7tDm - tf_country_list: AT - tf_language: german - tf_radio: '1' - tf_status: '3' - tf_datetime: '1588107000' - tf_combobox: '3' diff --git a/testdata/mymodule3/testdata/images/blank.gif b/testdata/mymodule3/testdata/images/blank.gif deleted file mode 100644 index 3a469695..00000000 Binary files a/testdata/mymodule3/testdata/images/blank.gif and /dev/null differ diff --git a/testdata/mymodule3/testdata/images/blank.png b/testdata/mymodule3/testdata/images/blank.png deleted file mode 100644 index e1ee728a..00000000 Binary files a/testdata/mymodule3/testdata/images/blank.png and /dev/null differ diff --git a/testdata/mymodule3/testdata/images/index.html b/testdata/mymodule3/testdata/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/testdata/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/testdata/index.html b/testdata/mymodule3/testdata/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/mymodule3/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/mymodule3/testdata/index.php b/testdata/mymodule3/testdata/index.php deleted file mode 100644 index 0bcc5cc5..00000000 --- a/testdata/mymodule3/testdata/index.php +++ /dev/null @@ -1,207 +0,0 @@ -loadLanguage('common'); - -switch ($op) { - case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('../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_cp_footer(); - } - break; - case 'save': - saveSampleData(); - break; -} - -// XMF TableLoad for SAMPLE data - -function loadSampleData() -{ - global $xoopsConfig; - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $utility = new Mymodule3\Utility(); - $configurator = new Common\Configurator(); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $language = 'english/'; - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { - $language = $xoopsConfig['language'] . '/'; - } - - // load module tables - foreach ($tables as $table) { - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - \Xmf\Database\TableLoad::truncateTable($table); - \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); - } - - // load permissions - $table = 'group_permission'; - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - $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 = __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')); -} - -function saveSampleData() -{ - global $xoopsConfig; - - $configurator = new Common\Configurator(); - - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; - if (!file_exists($languageFolder . '/')) { - Utility::createFolder($languageFolder . '/'); - } - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; - Utility::createFolder($exportFolder); - - // save module tables - foreach ($tables as $table) { - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); - } - - // save permissions - $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('gperm_modid', \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); - $skipColumns[] = 'gperm_id'; - \Xmf\Database\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 . '_' . 'SAMPLEDATA_SUCCESS')); -} - -function exportSchema() -{ - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - try { - // TODO set exportSchema - // $migrate = new Mymodule3\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')); - } - -} - -/** - * loadTableFromArrayWithReplace - * - * @param string $table value with should be used insead of original value of $search - * - * @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) -{ - /** @var \XoopsDatabase */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - - $prefixedTable = $db->prefix($table); - $count = 0; - - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); - - $result = $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 .= ', '; - } - - $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; - } - } - - return $count; -} diff --git a/testdata/mymodule3/testfields.php b/testdata/mymodule3/testfields.php deleted file mode 100644 index f78d69e6..00000000 --- a/testdata/mymodule3/testfields.php +++ /dev/null @@ -1,83 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$GLOBALS['xoopsOption']['template_main'] = 'mymodule3_testfields.tpl'; -include_once XOOPS_ROOT_PATH . '/header.php'; - -$op = Request::getString('op', 'list'); -$tfId = Request::getInt('tf_id', 0); -$start = Request::getInt('start', 0); -$limit = Request::getInt('limit', $helper->getConfig('userpager')); - -// Define Stylesheet -$GLOBALS['xoTheme']->addStylesheet( $style, null ); - -$GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); -$GLOBALS['xoopsTpl']->assign('mymodule3_url', MYMODULE3_URL); - -$critTestfields = new \CriteriaCompo(); -if ($tfId > 0) { - $critTestfields->add( new \Criteria( 'tf_id', $tfId ) ); -} -$testfieldsCount = $testfieldsHandler->getCount($critTestfields); -$GLOBALS['xoopsTpl']->assign('testfieldsCount', $testfieldsCount); -$critTestfields->setStart( $start ); -$critTestfields->setLimit( $limit ); -$testfieldsAll = $testfieldsHandler->getAll($critTestfields); -$keywords = []; -if ($testfieldsCount > 0) { - $testfields = []; - // Get All Testfields - foreach(array_keys($testfieldsAll) as $i) { - $testfields[] = $testfieldsAll[$i]->getValuesTestfields(); - $keywords[] = $testfieldsAll[$i]->getVar('tf_text'); - } - $GLOBALS['xoopsTpl']->assign('testfields', $testfields); - unset($testfields); - // Display Navigation - if ($testfieldsCount > $limit) { - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); - } - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); -} - -// Breadcrumbs -$xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_TESTFIELDS]; - -// Keywords -mymodule3MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); -unset($keywords); - -// Description -mymodule3MetaDescription(_MA_MYMODULE3_TESTFIELDS_DESC); -$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE3_URL.'/testfields.php'); -$GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); -require __DIR__ . '/footer.php'; diff --git a/testdata/mymodule3/view.tag.php b/testdata/mymodule3/view.tag.php deleted file mode 100644 index 4a827fde..00000000 --- a/testdata/mymodule3/view.tag.php +++ /dev/null @@ -1,23 +0,0 @@ - - Website: - */ -require __DIR__ . '/header.php'; -include XOOPS_ROOT_PATH . '/modules/tag/view.tag.php'; diff --git a/testdata/mymodule3/visit.php b/testdata/mymodule3/visit.php deleted file mode 100644 index 2b8896a7..00000000 --- a/testdata/mymodule3/visit.php +++ /dev/null @@ -1,28 +0,0 @@ - - Website: - */ - -use Xmf\Request; -use XoopsModules\Mymodule3; -use XoopsModules\Mymodule3\Constants; - -require __DIR__ . '/header.php'; -$tfId = Request::getInt('tf_id', 0); diff --git a/testdata/mymodule3/xoops_version.php b/testdata/mymodule3/xoops_version.php deleted file mode 100644 index 750804d2..00000000 --- a/testdata/mymodule3/xoops_version.php +++ /dev/null @@ -1,656 +0,0 @@ - - Website: - */ - -// -$moduleDirName = basename(__DIR__); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); -// ------------------- Informations ------------------- // -$modversion = [ - 'name' => _MI_MYMODULE3_NAME, - 'version' => 1.0, - 'description' => _MI_MYMODULE3_DESC, - 'author' => 'TDM XOOPS', - 'author_mail' => 'info@email.com', - 'author_website_url' => 'http://xoops.org', - 'author_website_name' => 'XOOPS Project', - 'credits' => 'XOOPS Development Team', - 'license' => 'GPL 2.0 or later', - 'license_url' => 'http://www.gnu.org/licenses/gpl-3.0.en.html', - 'help' => 'page=help', - 'release_info' => 'release_info', - 'release_file' => XOOPS_URL . '/modules/mymodule3/docs/release_info file', - 'release_date' => '2020/04/28', - 'manual' => 'link to manual file', - 'manual_file' => XOOPS_URL . '/modules/mymodule3/docs/install.txt', - 'min_php' => '7.0', - 'min_xoops' => '2.5.9', - 'min_admin' => '1.2', - 'min_db' => array('mysql' => '5.6', 'mysqli' => '5.6'), - 'image' => 'assets/images/logoModule.png', - 'dirname' => basename(__DIR__), - 'dirmoduleadmin' => 'Frameworks/moduleclasses/moduleadmin', - 'sysicons16' => '../../Frameworks/moduleclasses/icons/16', - 'sysicons32' => '../../Frameworks/moduleclasses/icons/32', - 'modicons16' => 'assets/icons/16', - 'modicons32' => 'assets/icons/32', - 'demo_site_url' => 'https://xoops.org', - 'demo_site_name' => 'XOOPS Demo Site', - 'support_url' => 'https://xoops.org/modules/newbb', - 'support_name' => 'Support Forum', - 'module_website_url' => 'www.xoops.org', - 'module_website_name' => 'XOOPS Project', - 'release' => '2017-12-02', - 'module_status' => 'Beta 1', - 'system_menu' => 1, - 'hasAdmin' => 1, - 'hasMain' => 1, - 'adminindex' => 'admin/index.php', - 'adminmenu' => 'admin/menu.php', - 'onInstall' => 'include/install.php', - 'onUninstall' => 'include/uninstall.php', - 'onUpdate' => 'include/update.php', -]; -// ------------------- Templates ------------------- // -$modversion['templates'] = [ - // Admin templates - ['file' => 'mymodule3_admin_about.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_header.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_index.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_categories.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_articles.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_testfields.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_permissions.tpl', 'description' => '', 'type' => 'admin'], - ['file' => 'mymodule3_admin_footer.tpl', 'description' => '', 'type' => 'admin'], - // User templates - ['file' => 'mymodule3_header.tpl', 'description' => ''], - ['file' => 'mymodule3_index.tpl', 'description' => ''], - ['file' => 'mymodule3_categories.tpl', 'description' => ''], - ['file' => 'mymodule3_categories_list.tpl', 'description' => ''], - ['file' => 'mymodule3_articles.tpl', 'description' => ''], - ['file' => 'mymodule3_articles_list.tpl', 'description' => ''], - ['file' => 'mymodule3_testfields.tpl', 'description' => ''], - ['file' => 'mymodule3_testfields_list.tpl', 'description' => ''], - ['file' => 'mymodule3_breadcrumbs.tpl', 'description' => ''], - ['file' => 'mymodule3_broken.tpl', 'description' => ''], - ['file' => 'mymodule3_pdf.tpl', 'description' => ''], - ['file' => 'mymodule3_print.tpl', 'description' => ''], - ['file' => 'mymodule3_rate.tpl', 'description' => ''], - ['file' => 'mymodule3_rss.tpl', 'description' => ''], - ['file' => 'mymodule3_search.tpl', 'description' => ''], - ['file' => 'mymodule3_single.tpl', 'description' => ''], - ['file' => 'mymodule3_submit.tpl', 'description' => ''], - ['file' => 'mymodule3_footer.tpl', 'description' => ''], -]; -// ------------------- Mysql ------------------- // -$modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; -// Tables -$modversion['tables'] = [ - 'mymodule3_categories', - 'mymodule3_articles', - 'mymodule3_testfields', -]; -// ------------------- Search ------------------- // -$modversion['hasSearch'] = 1; -$modversion['search'] = [ - 'file' => 'include/search.inc.php', - 'func' => 'mymodule3_search', -]; -// ------------------- Comments ------------------- // -$modversion['comments']['pageName'] = 'comments.php'; -$modversion['comments']['itemName'] = 'com_id'; -// Comment callback functions -$modversion['comments']['callbackFile'] = 'include/comment_functions.php'; -$modversion['comments']['callback'] = [ - 'approve' => 'mymodule3CommentsApprove', - 'update' => 'mymodule3CommentsUpdate', -]; -// ------------------- Menu ------------------- // -$currdirname = isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system'; -if ($moduleDirName == $currdirname) { - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE3_SMNAME1, - 'url' => 'index.php', - ]; - // Sub articles - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE3_SMNAME2, - 'url' => 'articles.php', - ]; - // Sub testfields - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE3_SMNAME3, - 'url' => 'testfields.php', - ]; - // Sub Submit - $modversion['sub'][] = [ - 'name' => _MI_MYMODULE3_SMNAME4, - 'url' => 'submit.php', - ]; -} -// ------------------- Blocks ------------------- // -// Articles last -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE3_ARTICLES_BLOCK_LAST, - 'description' => _MI_MYMODULE3_ARTICLES_BLOCK_LAST_DESC, - 'show_func' => 'b_mymodule3_articles_show', - 'edit_func' => 'b_mymodule3_articles_edit', - 'template' => 'mymodule3_block_articles.tpl', - 'options' => 'last|5|25|0', -]; -// Articles new -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE3_ARTICLES_BLOCK_NEW, - 'description' => _MI_MYMODULE3_ARTICLES_BLOCK_NEW_DESC, - 'show_func' => 'b_mymodule3_articles_show', - 'edit_func' => 'b_mymodule3_articles_edit', - 'template' => 'mymodule3_block_articles.tpl', - 'options' => 'new|5|25|0', -]; -// Articles hits -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE3_ARTICLES_BLOCK_HITS, - 'description' => _MI_MYMODULE3_ARTICLES_BLOCK_HITS_DESC, - 'show_func' => 'b_mymodule3_articles_show', - 'edit_func' => 'b_mymodule3_articles_edit', - 'template' => 'mymodule3_block_articles.tpl', - 'options' => 'hits|5|25|0', -]; -// Articles top -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE3_ARTICLES_BLOCK_TOP, - 'description' => _MI_MYMODULE3_ARTICLES_BLOCK_TOP_DESC, - 'show_func' => 'b_mymodule3_articles_show', - 'edit_func' => 'b_mymodule3_articles_edit', - 'template' => 'mymodule3_block_articles.tpl', - 'options' => 'top|5|25|0', -]; -// Articles random -$modversion['blocks'][] = [ - 'file' => 'articles.php', - 'name' => _MI_MYMODULE3_ARTICLES_BLOCK_RANDOM, - 'description' => _MI_MYMODULE3_ARTICLES_BLOCK_RANDOM_DESC, - 'show_func' => 'b_mymodule3_articles_show', - 'edit_func' => 'b_mymodule3_articles_edit', - 'template' => 'mymodule3_block_articles.tpl', - 'options' => 'random|5|25|0', -]; -// Testfields last -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE3_TESTFIELDS_BLOCK_LAST, - 'description' => _MI_MYMODULE3_TESTFIELDS_BLOCK_LAST_DESC, - 'show_func' => 'b_mymodule3_testfields_show', - 'edit_func' => 'b_mymodule3_testfields_edit', - 'template' => 'mymodule3_block_testfields.tpl', - 'options' => 'last|5|25|0', -]; -// Testfields new -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE3_TESTFIELDS_BLOCK_NEW, - 'description' => _MI_MYMODULE3_TESTFIELDS_BLOCK_NEW_DESC, - 'show_func' => 'b_mymodule3_testfields_show', - 'edit_func' => 'b_mymodule3_testfields_edit', - 'template' => 'mymodule3_block_testfields.tpl', - 'options' => 'new|5|25|0', -]; -// Testfields hits -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE3_TESTFIELDS_BLOCK_HITS, - 'description' => _MI_MYMODULE3_TESTFIELDS_BLOCK_HITS_DESC, - 'show_func' => 'b_mymodule3_testfields_show', - 'edit_func' => 'b_mymodule3_testfields_edit', - 'template' => 'mymodule3_block_testfields.tpl', - 'options' => 'hits|5|25|0', -]; -// Testfields top -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE3_TESTFIELDS_BLOCK_TOP, - 'description' => _MI_MYMODULE3_TESTFIELDS_BLOCK_TOP_DESC, - 'show_func' => 'b_mymodule3_testfields_show', - 'edit_func' => 'b_mymodule3_testfields_edit', - 'template' => 'mymodule3_block_testfields.tpl', - 'options' => 'top|5|25|0', -]; -// Testfields random -$modversion['blocks'][] = [ - 'file' => 'testfields.php', - 'name' => _MI_MYMODULE3_TESTFIELDS_BLOCK_RANDOM, - 'description' => _MI_MYMODULE3_TESTFIELDS_BLOCK_RANDOM_DESC, - 'show_func' => 'b_mymodule3_testfields_show', - 'edit_func' => 'b_mymodule3_testfields_edit', - 'template' => 'mymodule3_block_testfields.tpl', - 'options' => 'random|5|25|0', -]; -// ------------------- Config ------------------- // -// Editor descr -xoops_load('xoopseditorhandler'); -$editorHandlerDescr = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_descr', - 'title' => '_MI_MYMODULE3_EDITOR_DESCR', - 'description' => '_MI_MYMODULE3_EDITOR_DESCR_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerDescr->getList()), -]; -// Editor textarea -xoops_load('xoopseditorhandler'); -$editorHandlerTextarea = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_textarea', - 'title' => '_MI_MYMODULE3_EDITOR_TEXTAREA', - 'description' => '_MI_MYMODULE3_EDITOR_TEXTAREA_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerTextarea->getList()), -]; -// Editor dhtml -xoops_load('xoopseditorhandler'); -$editorHandlerDhtml = XoopsEditorHandler::getInstance(); -$modversion['config'][] = [ - 'name' => 'editor_dhtml', - 'title' => '_MI_MYMODULE3_EDITOR_DHTML', - 'description' => '_MI_MYMODULE3_EDITOR_DHTML_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'dhtml', - 'options' => array_flip($editorHandlerDhtml->getList()), -]; -// Get groups -$memberHandler = xoops_getHandler('member'); -$xoopsGroups = $memberHandler->getGroupList(); -$groups = []; -foreach($xoopsGroups as $key => $group) { - $groups[$group] = $key; -} -// General access groups -$modversion['config'][] = [ - 'name' => 'groups', - 'title' => '_MI_MYMODULE3_GROUPS', - 'description' => '_MI_MYMODULE3_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $groups, - 'options' => $groups, -]; -// Upload groups -$modversion['config'][] = [ - 'name' => 'upload_groups', - 'title' => '_MI_MYMODULE3_UPLOAD_GROUPS', - 'description' => '_MI_MYMODULE3_UPLOAD_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $groups, - 'options' => $groups, -]; -// Get Admin groups -$criteria = new \CriteriaCompo(); -$criteria->add( new \Criteria( 'group_type', 'Admin' ) ); -$memberHandler = xoops_getHandler('member'); -$adminXoopsGroups = $memberHandler->getGroupList($criteria); -$adminGroups = []; -foreach($adminXoopsGroups as $key => $adminGroup) { - $adminGroups[$adminGroup] = $key; -} -$modversion['config'][] = [ - 'name' => 'admin_groups', - 'title' => '_MI_MYMODULE3_ADMIN_GROUPS', - 'description' => '_MI_MYMODULE3_ADMIN_GROUPS_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => $adminGroups, - 'options' => $adminGroups, -]; -// Keywords -$modversion['config'][] = [ - 'name' => 'keywords', - 'title' => '_MI_MYMODULE3_KEYWORDS', - 'description' => '_MI_MYMODULE3_KEYWORDS_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'text', - 'default' => 'mymodule3, categories, articles, testfields', -]; -// create increment steps for file size -include_once __DIR__ . '/include/xoops_version.inc.php'; -$iniPostMaxSize = mymodule3ReturnBytes(ini_get('post_max_size')); -$iniUploadMaxFileSize = mymodule3ReturnBytes(ini_get('upload_max_filesize')); -$maxSize = min($iniPostMaxSize, $iniUploadMaxFileSize); -if ($maxSize > 10000 * 1048576) { - $increment = 500; -} -if ($maxSize <= 10000 * 1048576) { - $increment = 200; -} -if ($maxSize <= 5000 * 1048576) { - $increment = 100; -} -if ($maxSize <= 2500 * 1048576) { - $increment = 50; -} -if ($maxSize <= 1000 * 1048576) { - $increment = 10; -} -if ($maxSize <= 500 * 1048576) { - $increment = 5; -} -if ($maxSize <= 100 * 1048576) { - $increment = 2; -} -if ($maxSize <= 50 * 1048576) { - $increment = 1; -} -if ($maxSize <= 25 * 1048576) { - $increment = 0.5; -} -$optionMaxsize = []; -$i = $increment; -while ($i * 1048576 <= $maxSize) { - $optionMaxsize[$i . ' ' . _MI_MYMODULE3_SIZE_MB] = $i * 1048576; - $i += $increment; -} -// Uploads : maxsize of image -$modversion['config'][] = [ - 'name' => 'maxsize_image', - 'title' => '_MI_MYMODULE3_MAXSIZE_IMAGE', - 'description' => '_MI_MYMODULE3_MAXSIZE_IMAGE_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 3145728, - 'options' => $optionMaxsize, -]; -// Uploads : mimetypes of image -$modversion['config'][] = [ - 'name' => 'mimetypes_image', - 'title' => '_MI_MYMODULE3_MIMETYPES_IMAGE', - 'description' => '_MI_MYMODULE3_MIMETYPES_IMAGE_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - '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'], -]; -$modversion['config'][] = [ - 'name' => 'maxwidth_image', - 'title' => '_MI_MYMODULE3_MAXWIDTH_IMAGE', - 'description' => '_MI_MYMODULE3_MAXWIDTH_IMAGE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 8000, -]; -$modversion['config'][] = [ - 'name' => 'maxheight_image', - 'title' => '_MI_MYMODULE3_MAXHEIGHT_IMAGE', - 'description' => '_MI_MYMODULE3_MAXHEIGHT_IMAGE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 8000, -]; -// Uploads : maxsize of file -$modversion['config'][] = [ - 'name' => 'maxsize_file', - 'title' => '_MI_MYMODULE3_MAXSIZE_FILE', - 'description' => '_MI_MYMODULE3_MAXSIZE_FILE_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 3145728, - 'options' => $optionMaxsize, -]; -// Uploads : mimetypes of file -$modversion['config'][] = [ - 'name' => 'mimetypes_file', - 'title' => '_MI_MYMODULE3_MIMETYPES_FILE', - 'description' => '_MI_MYMODULE3_MIMETYPES_FILE_DESC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - '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'], -]; -// Admin pager -$modversion['config'][] = [ - 'name' => 'adminpager', - 'title' => '_MI_MYMODULE3_ADMIN_PAGER', - 'description' => '_MI_MYMODULE3_ADMIN_PAGER_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 10, -]; -// User pager -$modversion['config'][] = [ - 'name' => 'userpager', - 'title' => '_MI_MYMODULE3_USER_PAGER', - 'description' => '_MI_MYMODULE3_USER_PAGER_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 10, -]; -// Use tag -$modversion['config'][] = [ - 'name' => 'usetag', - 'title' => '_MI_MYMODULE3_USE_TAG', - 'description' => '_MI_MYMODULE3_USE_TAG_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, -]; -// Number column -$modversion['config'][] = [ - 'name' => 'numb_col', - 'title' => '_MI_MYMODULE3_NUMB_COL', - 'description' => '_MI_MYMODULE3_NUMB_COL_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => [1 => '1', 2 => '2', 3 => '3', 4 => '4'], -]; -// Divide by -$modversion['config'][] = [ - 'name' => 'divideby', - 'title' => '_MI_MYMODULE3_DIVIDEBY', - 'description' => '_MI_MYMODULE3_DIVIDEBY_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => [1 => '1', 2 => '2', 3 => '3', 4 => '4'], -]; -// Table type -$modversion['config'][] = [ - 'name' => 'table_type', - 'title' => '_MI_MYMODULE3_TABLE_TYPE', - 'description' => '_MI_MYMODULE3_DIVIDEBY_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 'bordered', - 'options' => ['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed'], -]; -// Panel by -$modversion['config'][] = [ - 'name' => 'panel_type', - 'title' => '_MI_MYMODULE3_PANEL_TYPE', - 'description' => '_MI_MYMODULE3_PANEL_TYPE_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'default', - 'options' => ['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger'], -]; -// Advertise -$modversion['config'][] = [ - 'name' => 'advertise', - 'title' => '_MI_MYMODULE3_ADVERTISE', - 'description' => '_MI_MYMODULE3_ADVERTISE_DESC', - 'formtype' => 'textarea', - 'valuetype' => 'text', - 'default' => '', -]; -// Bookmarks -$modversion['config'][] = [ - 'name' => 'bookmarks', - 'title' => '_MI_MYMODULE3_BOOKMARKS', - 'description' => '_MI_MYMODULE3_BOOKMARKS_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, -]; -// Make Sample button visible? -$modversion['config'][] = [ - 'name' => 'displaySampleButton', - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 1, -]; -// Maintained by -$modversion['config'][] = [ - 'name' => 'maintainedby', - 'title' => '_MI_MYMODULE3_MAINTAINEDBY', - 'description' => '_MI_MYMODULE3_MAINTAINEDBY_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'text', - 'default' => 'https://xoops.org/modules/newbb', -]; -// ------------------- Notifications ------------------- // -$modversion['hasNotification'] = 1; -$modversion['notification'] = [ - 'lookup_file' => 'include/notification.inc.php', - 'lookup_func' => 'mymodule3_notify_iteminfo', -]; -// Global Notify -$modversion['notification']['category'][1] = [ - 'name' => 'global', - 'title' => _MI_MYMODULE3_GLOBAL_NOTIFY, - 'description' => _MI_MYMODULE3_GLOBAL_NOTIFY_DESC, - 'subscribe_from' => ['index.php', 'articles.php', 'testfields.php'], -]; -// Category Notify -$modversion['notification']['category'][2] = [ - 'name' => 'category', - 'title' => _MI_MYMODULE3_CATEGORY_NOTIFY, - 'description' => _MI_MYMODULE3_CATEGORY_NOTIFY_DESC, - 'subscribe_from' => ['articles.php', 'testfields.php'], - 'item_name' => 'tf_combobox', - 'allow_bookmark' => 1, -]; -// Testfield Notify -$modversion['notification']['category'][3] = [ - 'name' => 'testfield', - 'title' => _MI_MYMODULE3_TESTFIELD_NOTIFY, - 'description' => _MI_MYMODULE3_TESTFIELD_NOTIFY_DESC, - 'subscribe_from' => 'testfields.php', - 'item_name' => 'tf_id', - 'allow_bookmark' => 1, -]; -// GLOBAL_NEW_CATEGORY Notify -$modversion['notification']['event'][1] = [ - 'name' => 'new_category', - 'category' => 'global', - 'admin_only' => 0, - 'title' => _MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY, - 'caption' => _MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_DESC, - 'mail_template' => 'global_newcategory_notify', - 'mail_subject' => _MI_MYMODULE3_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT, -]; -// GLOBAL_MODIFY Notify -$modversion['notification']['event'][2] = [ - 'name' => 'modify', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY, - 'caption' => _MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_DESC, - 'mail_template' => 'global_modify_notify', - 'mail_subject' => _MI_MYMODULE3_GLOBAL_MODIFY_NOTIFY_SUBJECT, -]; -// GLOBAL_BROKEN Notify -$modversion['notification']['event'][3] = [ - 'name' => 'broken', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY, - 'caption' => _MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_DESC, - 'mail_template' => 'global_broken_notify', - 'mail_subject' => _MI_MYMODULE3_GLOBAL_BROKEN_NOTIFY_SUBJECT, -]; -// GLOBAL_SUBMIT Notify -$modversion['notification']['event'][4] = [ - 'name' => 'submit', - 'category' => 'global', - 'admin_only' => 1, - 'title' => _MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY, - 'caption' => _MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_DESC, - 'mail_template' => 'global_submit_notify', - 'mail_subject' => _MI_MYMODULE3_GLOBAL_SUBMIT_NOTIFY_SUBJECT, -]; -// GLOBAL_NEW Notify -$modversion['notification']['event'][5] = [ - 'name' => 'new_testfield', - 'category' => 'global', - 'admin_only' => 0, - 'title' => _MI_MYMODULE3_GLOBAL_NEW_NOTIFY, - 'caption' => _MI_MYMODULE3_GLOBAL_NEW_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_GLOBAL_NEW_NOTIFY_DESC, - 'mail_template' => 'global_newtestfield_notify', - 'mail_subject' => _MI_MYMODULE3_GLOBAL_NEW_NOTIFY_SUBJECT, -]; -// CATEGORY_SUBMIT Notify -$modversion['notification']['event'][6] = [ - 'name' => 'submit', - 'category' => 'category', - 'admin_only' => 1, - 'title' => _MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY, - 'caption' => _MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_DESC, - 'mail_template' => 'category_testfieldsubmit_notify', - 'mail_subject' => _MI_MYMODULE3_CATEGORY_SUBMIT_NOTIFY_SUBJECT, -]; -// CATEGORY Notify -$modversion['notification']['event'][7] = [ - 'name' => 'new_category', - 'category' => 'category', - 'admin_only' => 0, - 'title' => _MI_MYMODULE3_CATEGORY_NOTIFY, - 'caption' => _MI_MYMODULE3_CATEGORY_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_CATEGORY_NOTIFY_DESC, - 'mail_template' => 'category_newtestfield_notify', - 'mail_subject' => _MI_MYMODULE3_CATEGORY_NOTIFY_SUBJECT, -]; -// TESTFIELD Notify -$modversion['notification']['event'][8] = [ - 'name' => 'approve', - 'category' => 'testfield', - 'admin_only' => 1, - 'title' => _MI_MYMODULE3_TESTFIELD_NOTIFY, - 'caption' => _MI_MYMODULE3_TESTFIELD_NOTIFY_CAPTION, - 'description' => _MI_MYMODULE3_TESTFIELD_NOTIFY_DESC, - 'mail_template' => 'testfield_approve_notify', - 'mail_subject' => _MI_MYMODULE3_TESTFIELD_NOTIFY_SUBJECT, -]; diff --git a/xoops_version.php b/xoops_version.php index 05a8c58c..11b4dd0c 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -1,4 +1,4 @@ - '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=358118'; -$modversion['forum_site_name'] = 'TDMCreate 1.91 alpha for Testing'; +$modversion['forum_site_url'] = 'https://xoops.org/modules/newbb/viewtopic.php?post_id=365223'; +$modversion['forum_site_name'] = 'ModuleBuilder 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 -$modversion['templates'][] = ['file' => 'tdmcreate_about.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_building.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_fields.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_fields_item.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_footer.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_header.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_index.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_modules.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_tables.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_tables_item.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_settings.tpl', 'description' => '', 'type' => 'admin']; -$modversion['templates'][] = ['file' => 'tdmcreate_morefiles.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_about.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_building.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_fields.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_fields_item.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_footer.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_header.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_index.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_modules.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_tables.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_tables_item.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_settings.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_morefiles.tpl', 'description' => '', 'type' => 'admin']; +$modversion['templates'][] = ['file' => 'modulebuilder_devtools.tpl', 'description' => '', 'type' => 'admin']; // ------------------- Mysql ------------------- // $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; @@ -108,20 +110,20 @@ $modversion['config'][] = [ 'name' => 'break' . $c, - 'title' => '_MI_TDMCREATE_CONFIG_BREAK_GENERAL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_BREAK_GENERAL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'head', ]; -xoops_load('xoopseditorhandler'); +\xoops_load('xoopseditorhandler'); $editorHandler = \XoopsEditorHandler::getInstance(); $modversion['config'][] = [ - 'name' => 'tdmcreate_editor', - 'title' => '_MI_TDMCREATE_CONFIG_EDITOR', - 'description' => '_MI_TDMCREATE_CONFIG_EDITOR_DESC', + 'name' => 'modulebuilder_editor', + 'title' => '\_MI_MODULEBUILDER_CONFIG_EDITOR', + 'description' => '\_MI_MODULEBUILDER_CONFIG_EDITOR_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'dhtml', @@ -131,8 +133,8 @@ $modversion['config'][] = [ //Uploads : mimetypes 'name' => 'mimetypes_image', - 'title' => '_MI_TDMCREATE_CONFIG_MIMETYPES_IMAGE', - 'description' => '_MI_TDMCREATE_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', @@ -141,8 +143,8 @@ $modversion['config'][] = [ //Uploads : maxsize 'name' => 'maxsize_image', - 'title' => '_MI_TDMCREATE_CONFIG_MAXSIZE_IMAGE', - 'description' => '_MI_TDMCREATE_CONFIG_MAXSIZE_IMAGE_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MAXSIZE_IMAGE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => '5000000', @@ -150,8 +152,8 @@ $modversion['config'][] = [ 'name' => 'settings_adminpager', - 'title' => '_MI_TDMCREATE_CONFIG_SETTINGS_ADMINPAGER', - 'description' => '_MI_TDMCREATE_CONFIG_SETTINGS_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_SETTINGS_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -159,8 +161,8 @@ $modversion['config'][] = [ 'name' => 'modules_adminpager', - 'title' => '_MI_TDMCREATE_CONFIG_MODULES_ADMINPAGER', - 'description' => '_MI_TDMCREATE_CONFIG_MODULES_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MODULES_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -168,8 +170,8 @@ $modversion['config'][] = [ 'name' => 'tables_adminpager', - 'title' => '_MI_TDMCREATE_CONFIG_TABLES_ADMINPAGER', - 'description' => '_MI_TDMCREATE_CONFIG_TABLES_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_TABLES_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -177,8 +179,8 @@ $modversion['config'][] = [ 'name' => 'fields_adminpager', - 'title' => '_MI_TDMCREATE_CONFIG_FIELDS_ADMINPAGER', - 'description' => '_MI_TDMCREATE_CONFIG_FIELDS_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_FIELDS_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -186,8 +188,8 @@ $modversion['config'][] = [ 'name' => 'morefiles_adminpager', - 'title' => '_MI_TDMCREATE_CONFIG_MOREFILES_ADMINPAGER', - 'description' => '_MI_TDMCREATE_CONFIG_MOREFILES_ADMINPAGER_DESC', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER', + 'description' => '\_MI_MODULEBUILDER_CONFIG_MOREFILES_ADMINPAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10, @@ -196,8 +198,8 @@ ++$c; $modversion['config'][] = [ 'name' => 'break' . $c, - 'title' => '_MI_TDMCREATE_CONFIG_BREAK_REQUIRED', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_BREAK_REQUIRED', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'head', @@ -205,8 +207,8 @@ $modversion['config'][] = [ 'name' => 'name', - 'title' => '_MI_TDMCREATE_CONFIG_NAME', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'My Module', @@ -214,8 +216,8 @@ $modversion['config'][] = [ 'name' => 'dirname', - 'title' => '_MI_TDMCREATE_CONFIG_DIRNAME', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DIRNAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'mymoduledirname', @@ -223,17 +225,17 @@ $modversion['config'][] = [ 'name' => 'version', - 'title' => '_MI_TDMCREATE_CONFIG_VERSION', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_VERSION', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', - 'default' => '1.0', + 'default' => '1.0.0', ]; $modversion['config'][] = [ 'name' => 'since', - 'title' => '_MI_TDMCREATE_CONFIG_SINCE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SINCE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '1.0', @@ -241,8 +243,8 @@ $modversion['config'][] = [ 'name' => 'min_php', - 'title' => '_MI_TDMCREATE_CONFIG_MIN_PHP', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_PHP', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '5.5', @@ -250,17 +252,17 @@ $modversion['config'][] = [ 'name' => 'min_xoops', - 'title' => '_MI_TDMCREATE_CONFIG_MIN_XOOPS', - 'description' => '_MI_TDMCREATE_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_TDMCREATE_CONFIG_MIN_ADMIN', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_ADMIN', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '1.2', @@ -268,8 +270,8 @@ $modversion['config'][] = [ 'name' => 'min_mysql', - 'title' => '_MI_TDMCREATE_CONFIG_MIN_MYSQL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MIN_MYSQL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '5.5', @@ -277,8 +279,8 @@ $modversion['config'][] = [ 'name' => 'description', - 'title' => '_MI_TDMCREATE_CONFIG_DESCRIPTION', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DESCRIPTION', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => 'This module is for doing following...', @@ -286,8 +288,8 @@ $modversion['config'][] = [ 'name' => 'author', - 'title' => '_MI_TDMCREATE_CONFIG_AUTHOR', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Development Team', @@ -295,8 +297,8 @@ $modversion['config'][] = [ 'name' => 'image', - 'title' => '_MI_TDMCREATE_CONFIG_IMAGE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_IMAGE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'empty.png', @@ -304,8 +306,8 @@ $modversion['config'][] = [ 'name' => 'display_admin', - 'title' => '_MI_TDMCREATE_CONFIG_DISPLAY_ADMIN_SIDE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DISPLAY_ADMIN_SIDE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, @@ -313,8 +315,8 @@ $modversion['config'][] = [ 'name' => 'display_user', - 'title' => '_MI_TDMCREATE_CONFIG_DISPLAY_USER_SIDE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DISPLAY_USER_SIDE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, @@ -322,8 +324,8 @@ $modversion['config'][] = [ 'name' => 'active_blocks', - 'title' => '_MI_TDMCREATE_CONFIG_ACTIVE_BLOCKS', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_BLOCKS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, @@ -331,8 +333,8 @@ $modversion['config'][] = [ 'name' => 'active_search', - 'title' => '_MI_TDMCREATE_CONFIG_ACTIVE_SEARCH', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_SEARCH', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -340,8 +342,8 @@ $modversion['config'][] = [ 'name' => 'active_comments', - 'title' => '_MI_TDMCREATE_CONFIG_ACTIVE_COMMENTS', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_COMMENTS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -349,8 +351,8 @@ $modversion['config'][] = [ 'name' => 'active_notifications', - 'title' => '_MI_TDMCREATE_CONFIG_ACTIVE_NOTIFICATIONS', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_NOTIFICATIONS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -358,8 +360,8 @@ $modversion['config'][] = [ 'name' => 'active_permissions', - 'title' => '_MI_TDMCREATE_CONFIG_ACTIVE_PERMISSIONS', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_ACTIVE_PERMISSIONS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -367,8 +369,8 @@ $modversion['config'][] = [ 'name' => 'inroot_copy', - 'title' => '_MI_TDMCREATE_CONFIG_INROOT_COPY', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_INROOT_COPY', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -377,8 +379,8 @@ ++$c; $modversion['config'][] = [ 'name' => 'break' . $c, - 'title' => '_MI_TDMCREATE_CONFIG_BREAK_OPTIONAL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_BREAK_OPTIONAL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'head', @@ -386,8 +388,8 @@ $modversion['config'][] = [ 'name' => 'author_email', - 'title' => '_MI_TDMCREATE_CONFIG_AUTHOR_EMAIL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR_EMAIL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'name@site.com', @@ -395,8 +397,8 @@ $modversion['config'][] = [ 'name' => 'author_website_url', - 'title' => '_MI_TDMCREATE_CONFIG_AUTHOR_WEBSITE_URL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR_WEBSITE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://xoops.org', @@ -404,8 +406,8 @@ $modversion['config'][] = [ 'name' => 'author_website_name', - 'title' => '_MI_TDMCREATE_CONFIG_AUTHOR_WEBSITE_NAME', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_AUTHOR_WEBSITE_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Project', @@ -413,8 +415,8 @@ $modversion['config'][] = [ 'name' => 'credits', - 'title' => '_MI_TDMCREATE_CONFIG_CREDITS', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_CREDITS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Development Team', @@ -422,8 +424,8 @@ $modversion['config'][] = [ 'name' => 'license', - 'title' => '_MI_TDMCREATE_CONFIG_LICENSE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_LICENSE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'GPL 2.0 or later', @@ -431,26 +433,26 @@ $modversion['config'][] = [ 'name' => 'license_url', - 'title' => '_MI_TDMCREATE_CONFIG_LICENSE_URL', - 'description' => '_MI_TDMCREATE_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', + 'default' => 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', ]; $modversion['config'][] = [ 'name' => 'repository', - 'title' => '_MI_TDMCREATE_CONFIG_REPOSITORY', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_REPOSITORY', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', - 'default' => 'https://github.com/txmodxoops/TDMCreate-1.91', + 'default' => 'https://github.com/txmodxoops/ModuleBuilder-1.91', ]; $modversion['config'][] = [ 'name' => 'release_info', - 'title' => '_MI_TDMCREATE_CONFIG_RELEASE_INFO', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_RELEASE_INFO', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'release_info', @@ -458,8 +460,8 @@ $modversion['config'][] = [ 'name' => 'release_file', - 'title' => '_MI_TDMCREATE_CONFIG_RELEASE_FILE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_RELEASE_FILE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'release_info file', @@ -467,8 +469,8 @@ $modversion['config'][] = [ 'name' => 'manual', - 'title' => '_MI_TDMCREATE_CONFIG_MANUAL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MANUAL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'link to manual file', @@ -476,8 +478,8 @@ $modversion['config'][] = [ 'name' => 'manual_file', - 'title' => '_MI_TDMCREATE_CONFIG_MANUAL_FILE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_MANUAL_FILE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'install.txt', @@ -485,8 +487,8 @@ $modversion['config'][] = [ 'name' => 'demo_site_url', - 'title' => '_MI_TDMCREATE_CONFIG_DEMO_SITE_URL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DEMO_SITE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://xoops.org', @@ -494,8 +496,8 @@ $modversion['config'][] = [ 'name' => 'demo_site_name', - 'title' => '_MI_TDMCREATE_CONFIG_DEMO_SITE_NAME', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_DEMO_SITE_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Demo Site', @@ -503,8 +505,8 @@ $modversion['config'][] = [ 'name' => 'support_url', - 'title' => '_MI_TDMCREATE_CONFIG_SUPPORT_URL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SUPPORT_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'https://xoops.org/modules/newbb', @@ -512,8 +514,8 @@ $modversion['config'][] = [ 'name' => 'support_name', - 'title' => '_MI_TDMCREATE_CONFIG_SUPPORT_NAME', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SUPPORT_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'Support Forum', @@ -521,8 +523,8 @@ $modversion['config'][] = [ 'name' => 'website_url', - 'title' => '_MI_TDMCREATE_CONFIG_WEBSITE_URL', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_WEBSITE_URL', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'www.xoops.org', @@ -530,8 +532,8 @@ $modversion['config'][] = [ 'name' => 'website_name', - 'title' => '_MI_TDMCREATE_CONFIG_WEBSITE_NAME', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_WEBSITE_NAME', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'XOOPS Project', @@ -539,8 +541,8 @@ $modversion['config'][] = [ 'name' => 'release_date', - 'title' => '_MI_TDMCREATE_CONFIG_RELEASE_DATE', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_RELEASE_DATE', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => date(_DBDATESTRING), @@ -548,8 +550,8 @@ $modversion['config'][] = [ 'name' => 'status', - 'title' => '_MI_TDMCREATE_CONFIG_STATUS', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_STATUS', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'Beta 1', @@ -557,8 +559,8 @@ $modversion['config'][] = [ 'name' => 'donations', - 'title' => '_MI_TDMCREATE_CONFIG_PAYPAL_BUTTON', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_PAYPAL_BUTTON', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '6KJ7RW5DR3VTJ', @@ -566,8 +568,8 @@ $modversion['config'][] = [ 'name' => 'subversion', - 'title' => '_MI_TDMCREATE_CONFIG_SUBVERSION', - 'description' => '_MI_TDMCREATE_CONFIG_', + 'title' => '\_MI_MODULEBUILDER_CONFIG_SUBVERSION', + 'description' => '\_MI_MODULEBUILDER_CONFIG_', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '13040',