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 | /* |
||
4 | You may not change or alter any portion of this comment or credits |
||
5 | of supporting developers from this source code or any supporting source code |
||
6 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
7 | |||
8 | This program is distributed in the hope that it will be useful, |
||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
11 | */ |
||
12 | /** |
||
13 | * modulebuilder module. |
||
14 | * |
||
15 | * @copyright XOOPS Project (https://xoops.org) |
||
16 | * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
17 | * |
||
18 | * @since 2.5.0 |
||
19 | * |
||
20 | * @author Txmod Xoops https://xoops.org |
||
21 | * Goffy https://myxoops.org |
||
22 | * |
||
23 | */ |
||
24 | |||
25 | use XoopsModules\Modulebuilder; |
||
26 | use XoopsModules\Modulebuilder\Files; |
||
27 | use Xmf\Request; |
||
28 | |||
29 | $templateMain = 'modulebuilder_building.tpl'; |
||
30 | |||
31 | require __DIR__ . '/header.php'; |
||
32 | $op = Request::getString('op', 'default'); |
||
33 | $mid = Request::getInt('mod_id'); |
||
34 | $inrootCopy = Request::getInt('inroot_copy'); |
||
35 | $testdataRestore = Request::getInt('testdata_restore'); |
||
36 | $checkData = Request::hasVar('check_data'); |
||
37 | $moduleObj = $helper->getHandler('Modules')->get($mid); |
||
38 | |||
39 | $cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_'; |
||
40 | if (!\is_dir($cachePath)) { |
||
41 | if (!\mkdir($cachePath, 0777) && !\is_dir($cachePath)) { |
||
42 | throw new \RuntimeException(\sprintf('Directory "%s" was not created', $cachePath)); |
||
43 | } |
||
44 | chmod($cachePath, 0777); |
||
45 | } |
||
46 | // Clear cache |
||
47 | if (\file_exists($cache = $cachePath . '/classpaths.cache')) { |
||
48 | \unlink($cache); |
||
49 | } |
||
50 | if (!\file_exists($indexFile = $cachePath . '/index.php')) { |
||
51 | \copy('index.php', $indexFile); |
||
52 | } |
||
53 | |||
54 | if ($checkData > 0) { |
||
55 | $op = 'check_data'; |
||
56 | } |
||
57 | // Switch option |
||
58 | switch ($op) { |
||
59 | case 'check_data': |
||
60 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); |
||
61 | $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16); |
||
62 | $checkdata = Modulebuilder\Files\CheckData::getInstance(); |
||
63 | |||
64 | // check data for inconsistences |
||
65 | $checkResults = []; |
||
66 | $checkResults = $checkdata->getCheckPreBuilding($moduleObj); |
||
67 | |||
68 | if (\count($checkResults) > 0) { |
||
69 | //$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); |
||
70 | $GLOBALS['xoopsTpl']->assign('checkResults', $checkResults); |
||
71 | } else { |
||
72 | $GLOBALS['xoopsTpl']->assign('checkResultsNice', true); |
||
73 | } |
||
74 | |||
75 | break; |
||
76 | case 'build': |
||
77 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); |
||
78 | $building = Modulebuilder\Building::getInstance(); |
||
79 | $structure = Modulebuilder\Files\CreateStructure::getInstance(); |
||
80 | $architecture = Modulebuilder\Files\CreateArchitecture::getInstance(); |
||
81 | $checkdata = Modulebuilder\Files\CheckData::getInstance(); |
||
82 | // Get var module dirname |
||
83 | $moduleDirname = $moduleObj->getVar('mod_dirname'); |
||
84 | |||
85 | //save test data of selected module before building new version |
||
86 | if (1 === $testdataRestore) { |
||
87 | // Directories for copy from |
||
88 | $fromDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata'; |
||
89 | if (\is_dir($fromDir)) { |
||
90 | // Directories for copy to |
||
91 | $toDir = TDMC_UPLOAD_TEMP_PATH . '/' . \mb_strtolower($moduleDirname); |
||
92 | $structure->isDir($toDir); |
||
93 | $toDir .= '/testdata'; |
||
94 | if (\is_dir($toDir)) { |
||
95 | $building->clearDir($toDir); |
||
96 | } else { |
||
97 | $structure->isDir($toDir); |
||
98 | } |
||
99 | $building->copyDir($fromDir, $toDir); |
||
100 | } else { |
||
101 | $testdataRestore = 0; |
||
102 | } |
||
103 | } |
||
104 | |||
105 | // Directories for copy from to |
||
106 | $fromDir = TDMC_UPLOAD_REPOSITORY_PATH . '/' . \mb_strtolower($moduleDirname); |
||
107 | $toDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname); |
||
108 | if (isset($moduleDirname)) { |
||
109 | // Clear this module if it's in repository |
||
110 | $building = Modulebuilder\Building::getInstance(); |
||
111 | if (\is_dir($fromDir)) { |
||
112 | $building->clearDir($fromDir); |
||
113 | } |
||
114 | } |
||
115 | // Structure |
||
116 | // Creation of the structure of folders and files |
||
117 | $baseArchitecture = $architecture->setBaseFoldersFiles($moduleObj); |
||
0 ignored issues
–
show
|
|||
118 | if (false !== $baseArchitecture) { |
||
0 ignored issues
–
show
|
|||
119 | $GLOBALS['xoopsTpl']->assign('base_architecture', true); |
||
120 | } else { |
||
121 | $GLOBALS['xoopsTpl']->assign('base_architecture', false); |
||
122 | } |
||
123 | // Get files |
||
124 | $build = []; |
||
125 | $files = $architecture->setFilesToBuilding($moduleObj); |
||
126 | foreach ($files as $file) { |
||
127 | if ($file) { |
||
128 | $build['list'] = $file; |
||
129 | } |
||
130 | $GLOBALS['xoopsTpl']->append('builds', $build); |
||
131 | } |
||
132 | unset($build); |
||
133 | |||
134 | // Get common files |
||
135 | $resCommon = $architecture->setCommonFiles($moduleObj); |
||
136 | $build['list'] = \_AM_MODULEBUILDER_BUILDING_COMMON; |
||
137 | $GLOBALS['xoopsTpl']->append('builds', $build); |
||
138 | unset($build); |
||
139 | |||
140 | // Directory to saved all files |
||
141 | $building_directory = \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY, $moduleDirname); |
||
142 | |||
143 | // Copy this module in root modules |
||
144 | if (1 === $inrootCopy) { |
||
145 | if (isset($moduleDirname)) { |
||
146 | // Clear this module if it's in root/modules |
||
147 | // Warning: If you have an older operating module with the same name, |
||
148 | // it's good to make a copy in another safe folder, |
||
149 | // otherwise it will be deleted irreversibly. |
||
150 | if (\is_dir($fromDir)) { |
||
151 | $building->clearDir($toDir); |
||
152 | } |
||
153 | } |
||
154 | $building->copyDir($fromDir, $toDir); |
||
155 | $building_directory .= \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT, $toDir); |
||
156 | } |
||
157 | if (1 === $testdataRestore) { |
||
158 | // Directories for copy from to |
||
159 | $fromDir = TDMC_UPLOAD_TEMP_PATH . '/' . \mb_strtolower($moduleDirname) . '/testdata'; |
||
160 | $toDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata'; |
||
161 | if (\is_dir($toDir)) { |
||
162 | $building->clearDir($toDir); |
||
163 | } |
||
164 | if (\is_dir($fromDir)) { |
||
165 | $building->copyDir($fromDir, $toDir); |
||
166 | } |
||
167 | } |
||
168 | |||
169 | $GLOBALS['xoopsTpl']->assign('building_directory', $building_directory); |
||
170 | break; |
||
171 | case 'default': |
||
172 | default: |
||
173 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php')); |
||
174 | // Redirect if there aren't modules |
||
175 | $nbModules = $helper->getHandler('Modules')->getCount(); |
||
176 | if (0 == $nbModules) { |
||
177 | \redirect_header('modules.php?op=new', 2, \_AM_MODULEBUILDER_THEREARENT_MODULES2); |
||
178 | } |
||
179 | unset($nbModules); |
||
180 | $building = Modulebuilder\Building::getInstance(); |
||
181 | $form = $building->getForm(); |
||
182 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
183 | |||
184 | break; |
||
185 | } |
||
186 | require __DIR__ . '/footer.php'; |
||
187 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.