mambax7 /
smartfaq
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 declare(strict_types=1); |
||
| 2 | |||
| 3 | /** |
||
| 4 | * CBB 4.0, or newbb, the forum module for XOOPS project |
||
| 5 | * |
||
| 6 | * @copyright XOOPS Project (https://xoops.org) |
||
| 7 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 8 | * @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
||
| 9 | * @since 4.00 |
||
| 10 | */ |
||
| 11 | |||
| 12 | use XoopsModules\Newbb\IconHandler; |
||
|
0 ignored issues
–
show
|
|||
| 13 | use XoopsModules\Smartfaq; |
||
| 14 | |||
| 15 | defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; |
||
| 16 | define('NEWBB_FUNCTIONS_RENDER_LOADED', true); |
||
| 17 | |||
| 18 | if (!defined('NEWBB_FUNCTIONS_RENDER')) : |
||
| 19 | define('NEWBB_FUNCTIONS_RENDER', 1); |
||
| 20 | |||
| 21 | /* |
||
| 22 | * Sorry, we have to use the stupid solution unless there is an option in MyTextSanitizer:: htmlspecialchars(); |
||
| 23 | */ |
||
| 24 | /** |
||
| 25 | * @param $text |
||
| 26 | * @return mixed |
||
| 27 | */ |
||
| 28 | function sf_htmlSpecialChars($text) |
||
| 29 | { |
||
| 30 | return preg_replace(['/&/i', '/ /i'], ['&', '&nbsp;'], htmlspecialchars($text, ENT_QUOTES)); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param int $html |
||
| 35 | * @param int $smiley |
||
| 36 | * @param int $xcode |
||
| 37 | * @param int $image |
||
| 38 | * @param int $br |
||
| 39 | * @param mixed $text |
||
| 40 | * @return mixed |
||
| 41 | */ |
||
| 42 | function &sf_displayTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) |
||
| 43 | { |
||
| 44 | global $myts; |
||
| 45 | |||
| 46 | if (1 != $html) { |
||
| 47 | // html not allowed |
||
| 48 | $text = sf_htmlSpecialChars($text); |
||
| 49 | } |
||
| 50 | $text = $myts->codePreConv($text, $xcode); // Ryuji_edit(2003-11-18) |
||
| 51 | $text = $myts->makeClickable($text); |
||
| 52 | if (0 != $smiley) { |
||
| 53 | // process smiley |
||
| 54 | $text = $myts->smiley($text); |
||
| 55 | } |
||
| 56 | if (0 != $xcode) { |
||
| 57 | // decode xcode |
||
| 58 | if (0 != $image) { |
||
| 59 | // image allowed |
||
| 60 | $text = &$myts->xoopsCodeDecode($text); |
||
| 61 | } else { |
||
| 62 | // image not allowed |
||
| 63 | $text = &$myts->xoopsCodeDecode($text, 0); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | if (0 != $br) { |
||
| 67 | $text = &$myts->nl2Br($text); |
||
| 68 | } |
||
| 69 | $text = $myts->codeConv($text, $xcode, $image); // Ryuji_edit(2003-11-18) |
||
| 70 | |||
| 71 | return $text; |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param $document |
||
| 76 | * @return string |
||
| 77 | */ |
||
| 78 | function sf_html2text($document) |
||
| 79 | { |
||
| 80 | $text = strip_tags($document); |
||
| 81 | |||
| 82 | return $text; |
||
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Display forrum button |
||
| 87 | * |
||
| 88 | * @param string $link |
||
| 89 | * @param string $button image/button name, without extension |
||
| 90 | * @param string $alt alt message |
||
| 91 | * @param bool $asImage true for image mode; false for text mode |
||
| 92 | * @param string $extra extra attribute for the button |
||
| 93 | * @return mixed |
||
| 94 | */ |
||
| 95 | function sf_getButton($link, $button, $alt = '', $asImage = true, $extra = "class='forum_button'") |
||
| 96 | { |
||
| 97 | $button = "<input type='button' name='{$button}' {$extra} value='{$alt}' onclick='window.location.href={$link}'>"; |
||
| 98 | if (empty($asImage)) { |
||
| 99 | $button = "<a href='{$link}' title='{$alt}' {$extra}>" . sf_displayImage($button, $alt, true) . '</a>'; |
||
| 100 | } |
||
| 101 | |||
| 102 | return $button; |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Display forrum images |
||
| 107 | * |
||
| 108 | * @param string $image image name, without extension |
||
| 109 | * @param string $alt alt message |
||
| 110 | * @param bool $display true for return image anchor; faulse for assign to $xoopsTpl |
||
| 111 | * @param string $extra extra attribute for the image |
||
| 112 | * @return mixed |
||
| 113 | */ |
||
| 114 | function sf_displayImage($image, $alt = '', $display = true, $extra = "class='forum_icon'") |
||
| 115 | { |
||
| 116 | $iconHandler = sf_getIconHandler(); |
||
| 117 | // START hacked by irmtfan |
||
| 118 | // to show text links instead of buttons - func_num_args()==2 => only when $image, $alt is set and optional $display not set |
||
| 119 | /** @var Smartfaq\Helper $helper */ |
||
| 120 | $helper = Smartfaq\Helper::getInstance(); |
||
| 121 | |||
| 122 | if (2 == func_num_args()) { |
||
| 123 | // overall setting |
||
| 124 | if (!empty($helper->getConfig('display_text_links'))) { |
||
| 125 | $display = false; |
||
| 126 | } |
||
| 127 | // if set for each link => overwrite $display |
||
| 128 | if (null !== $helper->getConfig('display_text_each_link')[$image]) { |
||
| 129 | $display = empty($helper->getConfig('display_text_each_link')[$image]); |
||
| 130 | } |
||
| 131 | } |
||
| 132 | // END hacked by irmtfan |
||
| 133 | if (empty($display)) { |
||
| 134 | return $iconHandler->assignImage($image, $alt, $extra); |
||
| 135 | } |
||
| 136 | |||
| 137 | return $iconHandler->getImage($image, $alt, $extra); |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @return \XoopsModules\Newbb\IconHandler |
||
| 142 | */ |
||
| 143 | function sf_getIconHandler() |
||
| 144 | { |
||
| 145 | global $xoTheme, $xoopsConfig; |
||
| 146 | static $iconHandler; |
||
| 147 | |||
| 148 | if (isset($iconHandler)) { |
||
| 149 | return $iconHandler; |
||
| 150 | } |
||
| 151 | /* |
||
| 152 | if (!class_exists('NewbbIconHandler')) { |
||
| 153 | // require_once \dirname(__DIR__) . '/class/icon.php'; |
||
| 154 | } |
||
| 155 | */ |
||
| 156 | $iconHandler = IconHandler::getInstance(); |
||
| 157 | $iconHandler->template = $xoTheme->template; |
||
| 158 | $iconHandler->init($xoopsConfig['language']); |
||
| 159 | |||
| 160 | return $iconHandler; |
||
| 161 | } |
||
| 162 | |||
| 163 | endif; |
||
| 164 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths