mambax7 /
extgallery
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 | * ExtGallery functions |
||||
| 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 | * This program is distributed in the hope that it will be useful, |
||||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
| 12 | * |
||||
| 13 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||
| 14 | * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||||
| 15 | * @author Zoullou (http://www.zoullou.net) |
||||
| 16 | * @package ExtGallery |
||||
| 17 | * @param $module |
||||
| 18 | * @return bool |
||||
| 19 | */ |
||||
| 20 | function xoops_module_pre_install_extgallery(\XoopsModule $module) |
||||
|
0 ignored issues
–
show
|
|||||
| 21 | { |
||||
| 22 | // Check if this XOOPS version is supported |
||||
| 23 | $minSupportedVersion = explode('.', '2.5.0'); |
||||
| 24 | $currentVersion = explode('.', mb_substr(XOOPS_VERSION, 6)); |
||||
| 25 | |||||
| 26 | if ($currentVersion[0] > $minSupportedVersion[0]) { |
||||
| 27 | return true; |
||||
| 28 | } elseif ($currentVersion[0] == $minSupportedVersion[0]) { |
||||
| 29 | if ($currentVersion[1] > $minSupportedVersion[1]) { |
||||
| 30 | return true; |
||||
| 31 | } elseif ($currentVersion[1] == $minSupportedVersion[1]) { |
||||
| 32 | if ($currentVersion[2] > $minSupportedVersion[2]) { |
||||
| 33 | return true; |
||||
| 34 | } elseif ($currentVersion[2] == $minSupportedVersion[2]) { |
||||
| 35 | return true; |
||||
| 36 | } |
||||
| 37 | } |
||||
| 38 | } |
||||
| 39 | |||||
| 40 | return false; |
||||
| 41 | } |
||||
| 42 | |||||
| 43 | /** |
||||
| 44 | * @param \XoopsModule $module |
||||
| 45 | * |
||||
| 46 | * @return bool |
||||
| 47 | */ |
||||
| 48 | function xoops_module_install_extgallery(\XoopsModule $module) |
||||
| 49 | { |
||||
| 50 | $module_id = $module->getVar('mid'); |
||||
| 51 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
| 52 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
| 53 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||
| 54 | /** @var \XoopsConfigHandler $configHandler */ |
||||
| 55 | $configHandler = xoops_getHandler('config'); |
||||
|
0 ignored issues
–
show
|
|||||
| 56 | |||||
| 57 | /** |
||||
| 58 | * Default public category permission mask |
||||
| 59 | */ |
||||
| 60 | |||||
| 61 | // Access right |
||||
| 62 | $grouppermHandler->addRight('extgallery_public_mask', 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...
|
|||||
| 63 | $grouppermHandler->addRight('extgallery_public_mask', 1, XOOPS_GROUP_USERS, $module_id); |
||||
| 64 | $grouppermHandler->addRight('extgallery_public_mask', 1, XOOPS_GROUP_ANONYMOUS, $module_id); |
||||
| 65 | |||||
| 66 | // Public rate |
||||
| 67 | $grouppermHandler->addRight('extgallery_public_mask', 2, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 68 | $grouppermHandler->addRight('extgallery_public_mask', 2, XOOPS_GROUP_USERS, $module_id); |
||||
| 69 | |||||
| 70 | // Public eCard |
||||
| 71 | $grouppermHandler->addRight('extgallery_public_mask', 4, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 72 | $grouppermHandler->addRight('extgallery_public_mask', 4, XOOPS_GROUP_USERS, $module_id); |
||||
| 73 | |||||
| 74 | // Public download |
||||
| 75 | $grouppermHandler->addRight('extgallery_public_mask', 8, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 76 | $grouppermHandler->addRight('extgallery_public_mask', 8, XOOPS_GROUP_USERS, $module_id); |
||||
| 77 | |||||
| 78 | // Public upload |
||||
| 79 | $grouppermHandler->addRight('extgallery_public_mask', 16, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 80 | |||||
| 81 | // Public autoapprove |
||||
| 82 | $grouppermHandler->addRight('extgallery_public_mask', 32, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 83 | |||||
| 84 | // Public display |
||||
| 85 | $grouppermHandler->addRight('extgallery_public_mask', 128, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 86 | $grouppermHandler->addRight('extgallery_public_mask', 128, XOOPS_GROUP_USERS, $module_id); |
||||
| 87 | $grouppermHandler->addRight('extgallery_public_mask', 128, XOOPS_GROUP_ANONYMOUS, $module_id); |
||||
| 88 | |||||
| 89 | /** |
||||
| 90 | * Default User's category permission |
||||
| 91 | */ |
||||
| 92 | |||||
| 93 | // Private gallery |
||||
| 94 | |||||
| 95 | // Private rate |
||||
| 96 | $grouppermHandler->addRight('extgallery_private', 2, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 97 | $grouppermHandler->addRight('extgallery_private', 2, XOOPS_GROUP_USERS, $module_id); |
||||
| 98 | |||||
| 99 | // Private eCard |
||||
| 100 | $grouppermHandler->addRight('extgallery_private', 4, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 101 | $grouppermHandler->addRight('extgallery_private', 4, XOOPS_GROUP_USERS, $module_id); |
||||
| 102 | |||||
| 103 | // Private download |
||||
| 104 | $grouppermHandler->addRight('extgallery_private', 8, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 105 | $grouppermHandler->addRight('extgallery_private', 8, XOOPS_GROUP_USERS, $module_id); |
||||
| 106 | |||||
| 107 | // Private autoapprove |
||||
| 108 | $grouppermHandler->addRight('extgallery_private', 16, XOOPS_GROUP_ADMIN, $module_id); |
||||
| 109 | |||||
| 110 | // Create eXtGallery main upload directory |
||||
| 111 | $dir = XOOPS_ROOT_PATH . '/uploads/extgallery'; |
||||
| 112 | if (!is_dir($dir)) { |
||||
| 113 | if (!mkdir($dir, 0777) && !is_dir($dir)) { |
||||
| 114 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); |
||||
| 115 | } |
||||
| 116 | } |
||||
| 117 | chmod($dir, 0777); |
||||
| 118 | // Create directory for photo in public album |
||||
| 119 | $dir = XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo'; |
||||
| 120 | if (!is_dir($dir)) { |
||||
| 121 | if (!mkdir($dir, 0777) && !is_dir($dir)) { |
||||
| 122 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); |
||||
| 123 | } |
||||
| 124 | } |
||||
| 125 | chmod($dir, 0777); |
||||
| 126 | $dir = XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/original'; |
||||
| 127 | if (!is_dir($dir)) { |
||||
| 128 | if (!mkdir($dir, 0777) && !is_dir($dir)) { |
||||
| 129 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); |
||||
| 130 | } |
||||
| 131 | } |
||||
| 132 | chmod($dir, 0777); |
||||
| 133 | $dir = XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/large'; |
||||
| 134 | if (!is_dir($dir)) { |
||||
| 135 | if (!mkdir($dir, 0777) && !is_dir($dir)) { |
||||
| 136 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); |
||||
| 137 | } |
||||
| 138 | } |
||||
| 139 | chmod($dir, 0777); |
||||
| 140 | $dir = XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/medium'; |
||||
| 141 | if (!is_dir($dir)) { |
||||
| 142 | if (!mkdir($dir, 0777) && !is_dir($dir)) { |
||||
| 143 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); |
||||
| 144 | } |
||||
| 145 | } |
||||
| 146 | chmod($dir, 0777); |
||||
| 147 | $dir = XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/thumb'; |
||||
| 148 | if (!is_dir($dir)) { |
||||
| 149 | if (!mkdir($dir, 0777) && !is_dir($dir)) { |
||||
| 150 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); |
||||
| 151 | } |
||||
| 152 | } |
||||
| 153 | chmod($dir, 0777); |
||||
| 154 | // Create directory for photo in user's album |
||||
| 155 | //mkdir(XOOPS_ROOT_PATH."/uploads/extgallery/user-photo"); |
||||
| 156 | |||||
| 157 | // Copy index.html files on uploads folders |
||||
| 158 | $indexFile = XOOPS_ROOT_PATH . '/modules/extgallery/include/index.html'; |
||||
| 159 | copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extgallery/index.html'); |
||||
| 160 | copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/index.html'); |
||||
| 161 | copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/original/index.html'); |
||||
| 162 | copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/large/index.html'); |
||||
| 163 | copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/medium/index.html'); |
||||
| 164 | copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/thumb/index.html'); |
||||
| 165 | |||||
| 166 | return true; |
||||
| 167 | } |
||||
| 168 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.