ggoffy /
modulebuilder
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace XoopsModules\Modulebuilder; |
||||
| 4 | |||||
| 5 | use XoopsModules\Modulebuilder; |
||||
| 6 | |||||
| 7 | /* |
||||
| 8 | You may not change or alter any portion of this comment or credits |
||||
| 9 | of supporting developers from this source code or any supporting source code |
||||
| 10 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||
| 11 | |||||
| 12 | This program is distributed in the hope that it will be useful, |
||||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
| 15 | */ |
||||
| 16 | |||||
| 17 | /** |
||||
| 18 | * morefiles class. |
||||
| 19 | * |
||||
| 20 | * @copyright XOOPS Project (https://xoops.org) |
||||
| 21 | * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||||
| 22 | * |
||||
| 23 | * @since 2.5.7 |
||||
| 24 | * |
||||
| 25 | * @author Txmod Xoops <[email protected]> - <https://xoops.org/> |
||||
| 26 | * |
||||
| 27 | */ |
||||
| 28 | |||||
| 29 | /* |
||||
| 30 | * @Class Morefiles |
||||
| 31 | * @extends \XoopsObject |
||||
| 32 | */ |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * Class Morefiles. |
||||
| 36 | */ |
||||
| 37 | class Morefiles extends \XoopsObject |
||||
| 38 | { |
||||
| 39 | /** |
||||
| 40 | * Settings. |
||||
| 41 | * |
||||
| 42 | * @var mixed |
||||
| 43 | */ |
||||
| 44 | private $settings; |
||||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
| 45 | |||||
| 46 | /** |
||||
| 47 | * @public function constructor class |
||||
| 48 | * |
||||
| 49 | * @param null |
||||
| 50 | */ |
||||
| 51 | public function __construct() |
||||
| 52 | { |
||||
| 53 | $this->initVar('file_id', XOBJ_DTYPE_INT); |
||||
| 54 | $this->initVar('file_mid', XOBJ_DTYPE_INT); |
||||
| 55 | $this->initVar('file_type', XOBJ_DTYPE_INT); |
||||
| 56 | $this->initVar('file_name', XOBJ_DTYPE_TXTBOX); |
||||
| 57 | $this->initVar('file_extension', XOBJ_DTYPE_TXTBOX); |
||||
| 58 | $this->initVar('file_upload', XOBJ_DTYPE_TXTBOX); |
||||
| 59 | $this->initVar('file_infolder', XOBJ_DTYPE_TXTBOX); |
||||
| 60 | } |
||||
| 61 | |||||
| 62 | /** |
||||
| 63 | * @param string $method |
||||
| 64 | * @param array $args |
||||
| 65 | * |
||||
| 66 | * @return mixed |
||||
| 67 | */ |
||||
| 68 | public function __call($method, $args) |
||||
| 69 | { |
||||
| 70 | $arg = isset($args[0]) ? $args[0] : null; |
||||
| 71 | |||||
| 72 | return $this->getVar($method, $arg); |
||||
| 73 | } |
||||
| 74 | |||||
| 75 | /** |
||||
| 76 | * @static function getInstance |
||||
| 77 | * |
||||
| 78 | * @param null |
||||
| 79 | * |
||||
| 80 | * @return Morefiles |
||||
| 81 | */ |
||||
| 82 | public static function getInstance() |
||||
| 83 | { |
||||
| 84 | static $instance = false; |
||||
| 85 | if (!$instance) { |
||||
| 86 | $instance = new self(); |
||||
| 87 | } |
||||
| 88 | |||||
| 89 | return $instance; |
||||
| 90 | } |
||||
| 91 | |||||
| 92 | /** |
||||
| 93 | * @public function getFormMorefiles |
||||
| 94 | * |
||||
| 95 | * @param bool|mixed $action |
||||
| 96 | * @return \XoopsThemeForm |
||||
| 97 | */ |
||||
| 98 | public function getFormMorefiles($action = false) |
||||
| 99 | { |
||||
| 100 | $helper = Modulebuilder\Helper::getInstance(); |
||||
| 101 | if (false === $action) { |
||||
| 102 | $action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'); |
||||
| 103 | } |
||||
| 104 | |||||
| 105 | $isNew = $this->isNew(); |
||||
| 106 | $title = $isNew ? \sprintf(\_AM_MODULEBUILDER_MORE_FILES_NEW) : \sprintf(\_AM_MODULEBUILDER_MORE_FILES_EDIT); |
||||
| 107 | |||||
| 108 | \xoops_load('XoopsFormLoader'); |
||||
| 109 | |||||
| 110 | $form = new \XoopsThemeForm($title, 'morefilesform', $action, 'post', true); |
||||
| 111 | $form->setExtra('enctype="multipart/form-data"'); |
||||
| 112 | |||||
| 113 | $modules = $helper->getHandler('Modules')->getObjects(null); |
||||
| 114 | $modulesSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_MORE_FILES_MODULES, 'file_mid', $this->getVar('file_mid')); |
||||
| 115 | $modulesSelect->addOption('', \_AM_MODULEBUILDER_MORE_FILES_MODULE_SELECT); |
||||
| 116 | foreach ($modules as $mod) { |
||||
| 117 | //$modulesSelect->addOptionArray(); |
||||
| 118 | $modulesSelect->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); |
||||
| 119 | } |
||||
| 120 | $form->addElement($modulesSelect, true); |
||||
| 121 | |||||
| 122 | $typeSelect = new \XoopsFormSelect(\_AM_MODULEBUILDER_MORE_FILES_TYPE, 'file_type', $this->getVar('file_type')); |
||||
| 123 | $typeSelect->addOption(0, ' '); |
||||
| 124 | $typeSelect->addOption(Constants::MORE_FILES_TYPE_EMPTY, \_AM_MODULEBUILDER_MORE_FILES_TYPE_EMPTY); |
||||
| 125 | $typeSelect->addOption(Constants::MORE_FILES_TYPE_COPY, \_AM_MODULEBUILDER_MORE_FILES_TYPE_COPY); |
||||
| 126 | $form->addElement($typeSelect, true); |
||||
| 127 | |||||
| 128 | $fileName = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_NAME, 'file_name', 50, 255, $this->getVar('file_name')); |
||||
|
0 ignored issues
–
show
It seems like
$this->getVar('file_name') can also be of type array and array; however, parameter $value of XoopsFormText::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 129 | $fileName->setDescription(\_AM_MODULEBUILDER_MORE_FILES_NAME_DESC); |
||||
| 130 | $form->addElement($fileName); |
||||
| 131 | |||||
| 132 | $fileExtension = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_EXTENSION, 'file_extension', 50, 255, $this->getVar('file_extension')); |
||||
| 133 | $fileExtension->setDescription(\_AM_MODULEBUILDER_MORE_FILES_EXTENSION_DESC); |
||||
| 134 | $form->addElement($fileExtension); |
||||
| 135 | |||||
| 136 | |||||
| 137 | $fileUpload = $this->isNew() ? '' : $this->getVar('file_upload'); |
||||
| 138 | $fileTray = new \XoopsFormElementTray(\_AM_MODULEBUILDER_MORE_FILES_UPLOAD, '<br>' ); |
||||
| 139 | $fileDirectory = '/uploads/modulebuilder/files'; |
||||
| 140 | $fileSelect = new \XoopsFormSelect( ".{$fileDirectory}/", 'file_upload', $fileUpload, 5); |
||||
| 141 | $filesArray = \XoopsLists::getFileListAsArray( TDMC_UPLOAD_FILES_PATH); |
||||
| 142 | $fileSelect->addOption('', ' - '); |
||||
| 143 | foreach($filesArray as $file1) { |
||||
| 144 | if ('index.html' !== $file1 && 'index.php' !== $file1) { |
||||
| 145 | $fileSelect->addOption("{$file1}", $file1); |
||||
| 146 | } |
||||
| 147 | } |
||||
| 148 | $fileTray->addElement($fileSelect, false); |
||||
| 149 | $form->addElement($fileTray); |
||||
| 150 | |||||
| 151 | |||||
| 152 | $fileInfolder = new \XoopsFormText(\_AM_MODULEBUILDER_MORE_FILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); |
||||
| 153 | $fileInfolder->setDescription(\_AM_MODULEBUILDER_MORE_FILES_INFOLDER_DESC); |
||||
| 154 | $form->addElement($fileInfolder, true); |
||||
| 155 | |||||
| 156 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||
| 157 | $form->addElement(new \XoopsFormButton(_REQUIRED . ' <sup class="red bold">*</sup>', 'submit', \_SUBMIT, 'submit')); |
||||
| 158 | |||||
| 159 | return $form; |
||||
| 160 | } |
||||
| 161 | |||||
| 162 | /** |
||||
| 163 | * Get Values. |
||||
| 164 | * |
||||
| 165 | * @param null $keys |
||||
|
0 ignored issues
–
show
|
|||||
| 166 | * @param null $format |
||||
|
0 ignored issues
–
show
|
|||||
| 167 | * @param null $maxDepth |
||||
|
0 ignored issues
–
show
|
|||||
| 168 | * |
||||
| 169 | * @return array |
||||
| 170 | */ |
||||
| 171 | public function getValuesMorefiles($keys = null, $format = null, $maxDepth = null) |
||||
| 172 | { |
||||
| 173 | $helper = Modulebuilder\Helper::getInstance(); |
||||
| 174 | $ret = $this->getValues($keys, $format, $maxDepth); |
||||
| 175 | // Values |
||||
| 176 | $ret['id'] = $this->getVar('file_id'); |
||||
| 177 | $ret['mid'] = $helper->getHandler('Modules')->get($this->getVar('file_mid'))->getVar('mod_name'); |
||||
| 178 | $ret['type'] = $this->getVar('file_type') == Constants::MORE_FILES_TYPE_EMPTY ? \_AM_MODULEBUILDER_MORE_FILES_TYPE_EMPTY : \_AM_MODULEBUILDER_MORE_FILES_TYPE_COPY; |
||||
| 179 | $ret['name'] = $this->getVar('file_name'); |
||||
| 180 | $ret['extension'] = $this->getVar('file_extension'); |
||||
| 181 | $ret['upload'] = $this->getVar('file_upload'); |
||||
| 182 | $ret['infolder'] = $this->getVar('file_infolder'); |
||||
| 183 | |||||
| 184 | return $ret; |
||||
| 185 | } |
||||
| 186 | } |
||||
| 187 |