XoopsModules25x /
wfdownloads
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 | You may not change or alter any portion of this comment or credits |
||||
| 4 | of supporting developers from this source code or any supporting source code |
||||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||
| 6 | |||||
| 7 | This program is distributed in the hope that it will be useful, |
||||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
| 10 | */ |
||||
| 11 | |||||
| 12 | /** |
||||
| 13 | * Wfdownloads module |
||||
| 14 | * |
||||
| 15 | * @copyright XOOPS Project (https://xoops.org) |
||||
| 16 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||
| 17 | * @package wfdownload |
||||
| 18 | * @since 3.23 |
||||
| 19 | * @author Xoops Development Team |
||||
| 20 | */ |
||||
| 21 | |||||
| 22 | use Xmf\Language; |
||||
| 23 | use XoopsModules\Wfdownloads\{ |
||||
| 24 | Common\Configurator, |
||||
| 25 | Helper, |
||||
| 26 | Utility |
||||
| 27 | }; |
||||
| 28 | /** @var Helper $helper */ |
||||
| 29 | /** @var Utility $utility */ |
||||
| 30 | |||||
| 31 | defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
||||
| 32 | require_once __DIR__ . '/common.php'; |
||||
| 33 | //@require_once WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php'; |
||||
| 34 | $helper = Helper::getInstance(); |
||||
| 35 | xoops_loadLanguage('admin', $GLOBALS['xoopsModule']->dirname()); |
||||
| 36 | |||||
| 37 | define('INDEX_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/index.html'); |
||||
| 38 | define('BLANK_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/blank.png'); |
||||
| 39 | |||||
| 40 | /** |
||||
| 41 | * Prepares system prior to attempting to install module |
||||
| 42 | * @param \XoopsModule $module {@link XoopsModule} |
||||
| 43 | * |
||||
| 44 | * @return bool true if ready to install, false if not |
||||
| 45 | */ |
||||
| 46 | function xoops_module_pre_install_wfdownloads(XoopsModule $module) |
||||
| 47 | { |
||||
| 48 | $utility = new Utility(); |
||||
| 49 | |||||
| 50 | //check for minimum XOOPS version |
||||
| 51 | $xoopsSuccess = $utility::checkVerXoops($module); |
||||
| 52 | |||||
| 53 | // check for minimum PHP version |
||||
| 54 | $phpSuccess = $utility::checkVerPhp($module); |
||||
| 55 | |||||
| 56 | if ($xoopsSuccess && $phpSuccess) { |
||||
| 57 | $moduleTables = &$module->getInfo('tables'); |
||||
| 58 | foreach ($moduleTables as $table) { |
||||
| 59 | $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
||||
| 60 | } |
||||
| 61 | } |
||||
| 62 | |||||
| 63 | return $xoopsSuccess && $phpSuccess; |
||||
| 64 | } |
||||
| 65 | |||||
| 66 | /** |
||||
| 67 | * Performs tasks required during installation of the module |
||||
| 68 | * @param \XoopsModule $module {@link XoopsModule} |
||||
| 69 | * |
||||
| 70 | * @return bool true if installation successful, false if not |
||||
| 71 | */ |
||||
| 72 | function xoops_module_install_wfdownloads(XoopsModule $module) |
||||
|
0 ignored issues
–
show
|
|||||
| 73 | { |
||||
| 74 | global $xoopsModule; |
||||
| 75 | require_once dirname(__DIR__, 3) . '/mainfile.php'; |
||||
| 76 | require_once __DIR__ . '/common.php'; |
||||
| 77 | |||||
| 78 | // $moduleDirName = $xoopsModule->getVar('dirname'); |
||||
| 79 | $moduleDirName = basename(dirname(__DIR__)); |
||||
| 80 | xoops_loadLanguage('admin', $moduleDirName); |
||||
| 81 | xoops_loadLanguage('modinfo', $moduleDirName); |
||||
| 82 | |||||
| 83 | // $configurator = require __DIR__ . '/config.php'; |
||||
| 84 | $configurator = new Configurator(); |
||||
| 85 | $utility = new Utility(); |
||||
| 86 | |||||
| 87 | // default Permission Settings |
||||
| 88 | $module_id = $xoopsModule->getVar('mid'); |
||||
| 89 | $module_name = $xoopsModule->getVar('name'); |
||||
|
0 ignored issues
–
show
|
|||||
| 90 | $module_dirname = $xoopsModule->getVar('dirname'); |
||||
|
0 ignored issues
–
show
|
|||||
| 91 | $module_version = $xoopsModule->getVar('version'); |
||||
|
0 ignored issues
–
show
|
|||||
| 92 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
| 93 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
| 94 | // access rights |
||||
| 95 | $grouppermHandler->addRight('nw_approve', 1, XOOPS_GROUP_ADMIN, $module_id); |
||||
|
0 ignored issues
–
show
XOOPS_GROUP_ADMIN of type string is incompatible with the type integer expected by parameter $gperm_groupid of XoopsGroupPermHandler::addRight().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 96 | $grouppermHandler->addRight('nw_submit', 1, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 97 | $grouppermHandler->addRight('nw_view', 1, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 98 | $grouppermHandler->addRight('nw_view', 1, XOOPS_GROUP_USERS, $module_id); |
||||
| 99 | $grouppermHandler->addRight('nw_view', 1, XOOPS_GROUP_ANONYMOUS, $module_id); |
||||
| 100 | |||||
| 101 | // --- CREATE FOLDERS --------------- |
||||
| 102 | /* |
||||
| 103 | if (count($configurator['uploadFolders']) > 0) { |
||||
| 104 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||
| 105 | foreach (array_keys($configurator['uploadFolders']) as $i) { |
||||
| 106 | $utility::createFolder($configurator['uploadFolders'][$i]); |
||||
| 107 | } |
||||
| 108 | } |
||||
| 109 | */ |
||||
| 110 | if (count($configurator->uploadFolders) > 0) { |
||||
| 111 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||
| 112 | foreach (array_keys($configurator->uploadFolders) as $i) { |
||||
| 113 | $utility::createFolder($configurator->uploadFolders[$i]); |
||||
| 114 | } |
||||
| 115 | } |
||||
| 116 | |||||
| 117 | // --- COPY blank.png FILES --------------- |
||||
| 118 | if (count($configurator->copyBlankFiles) > 0) { |
||||
| 119 | $file = dirname(__DIR__) . '/assets/images/blank.png'; |
||||
| 120 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
||||
| 121 | $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
||||
| 122 | $utility::copyFile($file, $dest); |
||||
| 123 | } |
||||
| 124 | } |
||||
| 125 | |||||
| 126 | return true; |
||||
| 127 | } |
||||
| 128 | |||||
| 129 | /** |
||||
| 130 | * @param \XoopsModule $xoopsModule |
||||
| 131 | * |
||||
| 132 | * @return bool |
||||
| 133 | */ |
||||
| 134 | /* |
||||
| 135 | function xoops_module_install_wfdownloads(\XoopsModule $xoopsModule) |
||||
| 136 | { |
||||
| 137 | // get module config values |
||||
| 138 | $hModConfig = xoops_getHandler('config'); |
||||
| 139 | $configArray = $hModConfig->getConfigsByCat(0, $xoopsModule->getVar('mid')); |
||||
| 140 | |||||
| 141 | // create and populate directories with empty blank.png and index.html |
||||
| 142 | $path = $configArray['uploaddir']; |
||||
| 143 | if (!is_dir($path)) { |
||||
| 144 | mkdir($path, 0777, true); |
||||
| 145 | } |
||||
| 146 | chmod($path, 0777); |
||||
| 147 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 148 | // |
||||
| 149 | $path = $configArray['batchdir']; |
||||
| 150 | if (!is_dir($path)) { |
||||
| 151 | mkdir($path, 0777); |
||||
| 152 | } |
||||
| 153 | chmod($path, 0777); |
||||
| 154 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 155 | // |
||||
| 156 | $path = XOOPS_ROOT_PATH . '/' . $configArray['mainimagedir']; |
||||
| 157 | if (!is_dir($path)) { |
||||
| 158 | mkdir($path, 0777, true); |
||||
| 159 | } |
||||
| 160 | chmod($path, 0777); |
||||
| 161 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 162 | copy(BLANK_FILE_PATH, $path . '/blank.png'); |
||||
| 163 | // |
||||
| 164 | $path = XOOPS_ROOT_PATH . '/' . $configArray['screenshots']; |
||||
| 165 | if (!is_dir($path)) { |
||||
| 166 | mkdir($path, 0777, true); |
||||
| 167 | } |
||||
| 168 | chmod($path, 0777); |
||||
| 169 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 170 | copy(BLANK_FILE_PATH, $path . '/blank.png'); |
||||
| 171 | // |
||||
| 172 | $path = XOOPS_ROOT_PATH . '/' . $configArray['screenshots'] . '/' . 'thumbs'; |
||||
| 173 | if (!is_dir($path)) { |
||||
| 174 | mkdir($path, 0777, true); |
||||
| 175 | } |
||||
| 176 | chmod($path, 0777); |
||||
| 177 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 178 | copy(BLANK_FILE_PATH, $path . '/blank.png'); |
||||
| 179 | // |
||||
| 180 | $path = XOOPS_ROOT_PATH . '/' . $configArray['catimage']; |
||||
| 181 | if (!is_dir($path)) { |
||||
| 182 | mkdir($path, 0777, true); |
||||
| 183 | } |
||||
| 184 | chmod($path, 0777); |
||||
| 185 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 186 | copy(BLANK_FILE_PATH, $path . '/blank.png'); |
||||
| 187 | // |
||||
| 188 | $path = XOOPS_ROOT_PATH . '/' . $configArray['catimage'] . '/' . 'thumbs'; |
||||
| 189 | if (!is_dir($path)) { |
||||
| 190 | mkdir($path, 0777, true); |
||||
| 191 | } |
||||
| 192 | chmod($path, 0777); |
||||
| 193 | copy(INDEX_FILE_PATH, $path . '/index.html'); |
||||
| 194 | copy(BLANK_FILE_PATH, $path . '/blank.png'); |
||||
| 195 | |||||
| 196 | return true; |
||||
| 197 | } |
||||
| 198 | */ |
||||
| 199 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.