mambax7 /
xoopsmembers
| 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 | * @copyright XOOPS Project https://xoops.org/ |
||||||
| 14 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||||
| 15 | * @package |
||||||
| 16 | * @since |
||||||
| 17 | * @author XOOPS Development Team |
||||||
| 18 | */ |
||||||
| 19 | |||||||
| 20 | use XoopsModules\Xoopsmembers; |
||||||
| 21 | |||||||
| 22 | //require_once __DIR__ . '/setup.php'; |
||||||
| 23 | |||||||
| 24 | /** |
||||||
| 25 | * Prepares system prior to attempting to install module |
||||||
| 26 | * @param \XoopsModule $module {@link XoopsModule} |
||||||
| 27 | * |
||||||
| 28 | * @return bool true if ready to install, false if not |
||||||
| 29 | */ |
||||||
| 30 | function xoops_module_pre_install_xoopsmembers(\XoopsModule $module) |
||||||
| 31 | { |
||||||
| 32 | require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
||||||
| 33 | /** @var \Xoopsmembers\Utility $utility */ |
||||||
| 34 | $utility = new \XoopsModules\Xoopsmembers\Utility(); |
||||||
| 35 | $xoopsSuccess = $utility::checkVerXoops($module); |
||||||
| 36 | $phpSuccess = $utility::checkVerPhp($module); |
||||||
| 37 | |||||||
| 38 | if (false !== $xoopsSuccess && false !== $phpSuccess) { |
||||||
| 39 | $moduleTables = &$module->getInfo('tables'); |
||||||
| 40 | foreach ($moduleTables as $table) { |
||||||
| 41 | $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
||||||
| 42 | } |
||||||
| 43 | } |
||||||
| 44 | |||||||
| 45 | return $xoopsSuccess && $phpSuccess; |
||||||
| 46 | } |
||||||
| 47 | |||||||
| 48 | /** |
||||||
| 49 | * Performs tasks required during installation of the module |
||||||
| 50 | * @param \XoopsModule $module {@link XoopsModule} |
||||||
| 51 | * |
||||||
| 52 | * @return bool true if installation successful, false if not |
||||||
| 53 | */ |
||||||
| 54 | function xoops_module_install_xoopsmembers(\XoopsModule $module) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 55 | { |
||||||
| 56 | require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; |
||||||
| 57 | |||||||
| 58 | $moduleDirName = basename(dirname(__DIR__)); |
||||||
| 59 | /** @var \Xoopsmembers\Helper $helper */ |
||||||
| 60 | $helper = Xoopsmembers\Helper::getInstance(); |
||||||
| 61 | $utility = new Xoopsmembers\Utility(); |
||||||
| 62 | $configurator = new Xoopsmembers\Common\Configurator(); |
||||||
| 63 | // Load language files |
||||||
| 64 | $helper->loadLanguage('admin'); |
||||||
| 65 | $helper->loadLanguage('modinfo'); |
||||||
| 66 | |||||||
| 67 | // default Permission Settings ---------------------- |
||||||
| 68 | global $xoopsModule; |
||||||
| 69 | $moduleId = $xoopsModule->getVar('mid'); |
||||||
| 70 | // $moduleId2 = $helper->getModule()->mid(); |
||||||
| 71 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 72 | // access rights ------------------------------------------ |
||||||
| 73 | $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); |
||||||
|
0 ignored issues
–
show
The method
addRight() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsGroupPermHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 74 | $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); |
||||||
| 75 | $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); |
||||||
| 76 | $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); |
||||||
| 77 | $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); |
||||||
| 78 | |||||||
| 79 | // --- CREATE FOLDERS --------------- |
||||||
| 80 | if (count($configurator->uploadFolders) > 0) { |
||||||
| 81 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||||
| 82 | foreach (array_keys($configurator->uploadFolders) as $i) { |
||||||
| 83 | $utility::createFolder($configurator->uploadFolders[$i]); |
||||||
| 84 | } |
||||||
| 85 | } |
||||||
| 86 | |||||||
| 87 | // --- COPY blank.png FILES --------------- |
||||||
| 88 | if (count($configurator->copyBlankFiles) > 0) { |
||||||
| 89 | $file = dirname(__DIR__) . '/assets/images/blank.png'; |
||||||
| 90 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
||||||
| 91 | $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
||||||
| 92 | $utility::copyFile($file, $dest); |
||||||
| 93 | } |
||||||
| 94 | } |
||||||
| 95 | //delete .html entries from the tpl table |
||||||
| 96 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
||||||
| 97 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
| 98 | |||||||
| 99 | return true; |
||||||
| 100 | } |
||||||
| 101 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.