mambax7 /
tdmcreate-1.91
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 namespace XoopsModules\Tdmcreate; |
||||
| 2 | |||||
| 3 | use XoopsModules\Tdmcreate; |
||||
| 4 | |||||
| 5 | /* |
||||
| 6 | You may not change or alter any portion of this comment or credits |
||||
| 7 | of supporting developers from this source code or any supporting source code |
||||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||
| 9 | |||||
| 10 | This program is distributed in the hope that it will be useful, |
||||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
| 13 | */ |
||||
| 14 | |||||
| 15 | /** |
||||
| 16 | * morefiles class. |
||||
| 17 | * |
||||
| 18 | * @copyright The XOOPS Project http:sourceforge.net/projects/xoops/ |
||||
| 19 | * @license GNU GPL 2 (http:www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||||
| 20 | * |
||||
| 21 | * @since 2.5.7 |
||||
| 22 | * |
||||
| 23 | * @author Txmod Xoops <[email protected]> - <http:www.txmodxoops.org/> |
||||
| 24 | * |
||||
| 25 | * @version $Id: morefiles.php 13080 2015-06-12 10:12:32Z timgno $ |
||||
| 26 | */ |
||||
| 27 | //include __DIR__.'/autoload.php'; |
||||
| 28 | |||||
| 29 | /** |
||||
| 30 | * Class MoreFiles. |
||||
| 31 | */ |
||||
| 32 | class AddFiles extends \XoopsObject |
||||
| 33 | { |
||||
| 34 | /** |
||||
| 35 | * Tdmcreate. |
||||
| 36 | * |
||||
| 37 | * @var mixed |
||||
| 38 | */ |
||||
| 39 | private $helper; |
||||
| 40 | |||||
| 41 | /** |
||||
| 42 | * Settings. |
||||
| 43 | * |
||||
| 44 | * @var mixed |
||||
| 45 | */ |
||||
| 46 | private $settings; |
||||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
| 47 | |||||
| 48 | /** |
||||
| 49 | * @public function constructor class |
||||
| 50 | * @param null |
||||
| 51 | */ |
||||
| 52 | |||||
| 53 | public function __construct() |
||||
| 54 | { |
||||
| 55 | $this->helper = Tdmcreate\Helper::getInstance(); |
||||
| 56 | |||||
| 57 | $this->initVar('file_id', XOBJ_DTYPE_INT); |
||||
| 58 | $this->initVar('file_mid', XOBJ_DTYPE_INT); |
||||
| 59 | $this->initVar('file_name', XOBJ_DTYPE_TXTBOX); |
||||
| 60 | $this->initVar('file_extension', XOBJ_DTYPE_TXTBOX); |
||||
| 61 | $this->initVar('file_infolder', XOBJ_DTYPE_TXTBOX); |
||||
| 62 | } |
||||
| 63 | |||||
| 64 | /** |
||||
| 65 | * @param string $method |
||||
| 66 | * @param array $args |
||||
| 67 | * |
||||
| 68 | * @return mixed |
||||
| 69 | */ |
||||
| 70 | public function __call($method, $args) |
||||
| 71 | { |
||||
| 72 | $arg = isset($args[0]) ? $args[0] : null; |
||||
| 73 | |||||
| 74 | return $this->getVar($method, $arg); |
||||
| 75 | } |
||||
| 76 | |||||
| 77 | /** |
||||
| 78 | * @static function getInstance |
||||
| 79 | * @param null |
||||
| 80 | * @return AddFiles |
||||
| 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 | * @param mixed $action |
||||
| 95 | * |
||||
| 96 | * @return \XoopsThemeForm |
||||
| 97 | */ |
||||
| 98 | public function getFormAddFiles($action = false) |
||||
| 99 | { |
||||
| 100 | if (false === $action) { |
||||
| 101 | $action = $_SERVER['REQUEST_URI']; |
||||
| 102 | } |
||||
| 103 | |||||
| 104 | $isNew = $this->isNew(); |
||||
| 105 | $title = $isNew ? sprintf(_AM_TDMCREATE_ADDFILES_NEW) : sprintf(_AM_TDMCREATE_ADDFILES_EDIT); |
||||
|
0 ignored issues
–
show
|
|||||
| 106 | |||||
| 107 | xoops_load('XoopsFormLoader'); |
||||
| 108 | |||||
| 109 | $form = new \XoopsThemeForm($title, 'addfilesform', $action, 'post', true); |
||||
| 110 | $form->setExtra('enctype="multipart/form-data"'); |
||||
| 111 | |||||
| 112 | $modules = $this->helper->getHandler('modules')->getObjects(null); |
||||
| 113 | $modulesSelect = new \XoopsFormSelect(_AM_TDMCREATE_ADDFILES_MODULES, 'file_mid', $this->getVar('file_mid')); |
||||
|
0 ignored issues
–
show
|
|||||
| 114 | $modulesSelect->addOption('', _AM_TDMCREATE_ADDFILES_MODULE_SELECT); |
||||
|
0 ignored issues
–
show
|
|||||
| 115 | foreach ($modules as $mod) { |
||||
| 116 | $modulesSelect->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name')); |
||||
| 117 | } |
||||
| 118 | $form->addElement($modulesSelect, true); |
||||
| 119 | |||||
| 120 | $modName = new \XoopsFormText(_AM_TDMCREATE_ADDFILES_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...
|
|||||
| 121 | $modName->setDescription(_AM_TDMCREATE_ADDFILES_NAME_DESC); |
||||
|
0 ignored issues
–
show
|
|||||
| 122 | $form->addElement($modName, true); |
||||
| 123 | |||||
| 124 | $fileEstension = new \XoopsFormText(_AM_TDMCREATE_ADDFILES_EXTENSION, 'file_extension', 50, 255, $this->getVar('file_extension')); |
||||
|
0 ignored issues
–
show
|
|||||
| 125 | $fileEstension->setDescription(_AM_TDMCREATE_ADDFILES_EXTENSION_DESC); |
||||
|
0 ignored issues
–
show
|
|||||
| 126 | $form->addElement($fileEstension, true); |
||||
| 127 | |||||
| 128 | $fileInfolder = new \XoopsFormText(_AM_TDMCREATE_ADDFILES_INFOLDER, 'file_infolder', 50, 255, $this->getVar('file_infolder')); |
||||
|
0 ignored issues
–
show
|
|||||
| 129 | $fileInfolder->setDescription(_AM_TDMCREATE_ADDFILES_INFOLDER_DESC); |
||||
|
0 ignored issues
–
show
|
|||||
| 130 | $form->addElement($fileInfolder, true); |
||||
| 131 | |||||
| 132 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||
| 133 | $form->addElement(new \XoopsFormButton(_REQUIRED.' <sup class="red bold">*</sup>', 'submit', _SUBMIT, 'submit')); |
||||
| 134 | |||||
| 135 | return $form; |
||||
| 136 | } |
||||
| 137 | |||||
| 138 | /** |
||||
| 139 | * Get AddFiles Values. |
||||
| 140 | * @param null $keys |
||||
|
0 ignored issues
–
show
|
|||||
| 141 | * @param null $format |
||||
|
0 ignored issues
–
show
|
|||||
| 142 | * @param null $maxDepth |
||||
|
0 ignored issues
–
show
|
|||||
| 143 | * @return array |
||||
| 144 | */ |
||||
| 145 | public function getAddFilesValues($keys = null, $format = null, $maxDepth = null) |
||||
| 146 | { |
||||
| 147 | $ret = $this->getValues($keys, $format, $maxDepth); |
||||
| 148 | // Values |
||||
| 149 | $ret['id'] = $this->getVar('file_id'); |
||||
| 150 | $ret['mid'] = $this->helper->getHandler('modules')->get($this->getVar('file_mid'))->getVar('mod_name'); |
||||
| 151 | $ret['name'] = $this->getVar('file_name'); |
||||
| 152 | $ret['extension'] = $this->getVar('file_extension'); |
||||
| 153 | $ret['infolder'] = $this->getVar('file_infolder'); |
||||
| 154 | |||||
| 155 | return $ret; |
||||
| 156 | } |
||||
| 157 | } |
||||
| 158 | |||||
| 159 |