board3 /
Board3-Portal
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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * |
||
| 4 | * @package Board3 Portal v2.1 |
||
| 5 | * @copyright (c) 2014 Board3 Group ( www.board3.de ) |
||
| 6 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
||
| 7 | * |
||
| 8 | */ |
||
| 9 | |||
| 10 | namespace board3\portal\includes; |
||
| 11 | |||
| 12 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
||
| 13 | |||
| 14 | class modules_helper |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Auth object |
||
| 18 | * @var \phpbb\auth\auth |
||
| 19 | */ |
||
| 20 | protected $auth; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * phpBB config |
||
| 24 | * @var \phpbb\config\config |
||
| 25 | */ |
||
| 26 | protected $config; |
||
| 27 | |||
| 28 | /** @var \phpbb\controller\helper Controller helper */ |
||
| 29 | protected $controller_helper; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * phpBB request |
||
| 33 | * @var \phpbb\request\request |
||
| 34 | */ |
||
| 35 | protected $request; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Constructor |
||
| 39 | * NOTE: The parameters of this method must match in order and type with |
||
| 40 | * the dependencies defined in the services.yml file for this service. |
||
| 41 | * @param \phpbb\auth\auth $auth Auth object |
||
| 42 | * @param \phpbb\config\config $config phpBB config |
||
| 43 | * @param \phpbb\controller\helper $controller_helper Controller helper |
||
| 44 | * @param \phpbb\request\request $request phpBB request |
||
| 45 | */ |
||
| 46 | 100 | public function __construct($auth, $config, $controller_helper, $request) |
|
| 47 | { |
||
| 48 | 100 | $this->auth = $auth; |
|
| 49 | 100 | $this->config = $config; |
|
| 50 | 100 | $this->controller_helper = $controller_helper; |
|
| 51 | 100 | $this->request = $request; |
|
| 52 | 100 | } |
|
| 53 | |||
| 54 | /** |
||
| 55 | * Get an array of disallowed forums |
||
| 56 | * |
||
| 57 | * @param bool $disallow_access Whether the array for disallowing access |
||
| 58 | * should be filled |
||
| 59 | * @return array Array of forums the user is not allowed to access |
||
| 60 | */ |
||
| 61 | 32 | public function get_disallowed_forums($disallow_access) |
|
| 62 | { |
||
| 63 | 32 | if ($disallow_access == true) |
|
| 64 | 32 | { |
|
| 65 | 13 | $disallow_access = array_unique(array_keys($this->auth->acl_getf('!f_read', true))); |
|
| 66 | 13 | } |
|
| 67 | else |
||
| 68 | { |
||
| 69 | 19 | $disallow_access = array(); |
|
| 70 | } |
||
| 71 | |||
| 72 | 32 | return $disallow_access; |
|
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Generate select box |
||
| 77 | * |
||
| 78 | * @param string $key Key of select box |
||
| 79 | * @param array $select_ary Array of select box options |
||
| 80 | * @param array $selected_options Array of selected options |
||
| 81 | * @param bool $multiple Whether multiple options should be selectable |
||
| 82 | * |
||
| 83 | * @return string HTML code of select box |
||
| 84 | * @access public |
||
| 85 | */ |
||
| 86 | 4 | public function generate_select_box($key, $select_ary, $selected_options, $multiple = false) |
|
| 87 | { |
||
| 88 | // Build options |
||
| 89 | 4 | $options = '<select id="' . $key . '" name="' . $key; |
|
| 90 | 4 | $options .= ($multiple) ? '[]" multiple="multiple">' : '">'; |
|
| 91 | 4 | foreach ($select_ary as $id => $option) |
|
| 92 | { |
||
| 93 | 4 | $options .= '<option value="' . $option['value'] . '"' . ((in_array($option['value'], $selected_options)) ? ' selected="selected"' : '') . (!empty($option['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $option['title'] . '</option>'; |
|
| 94 | 4 | } |
|
| 95 | 4 | $options .= '</select>'; |
|
| 96 | |||
| 97 | 4 | return $options; |
|
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Generate forum select box |
||
| 102 | * |
||
| 103 | * @param string $value Value of select box |
||
| 104 | * @param string $key Key of select box |
||
| 105 | * |
||
| 106 | * @return string HTML code of select box |
||
| 107 | * @access public |
||
| 108 | */ |
||
| 109 | 1 | public function generate_forum_select($value, $key) |
|
|
0 ignored issues
–
show
|
|||
| 110 | { |
||
| 111 | 1 | $forum_list = make_forum_select(false, false, true, true, true, false, true); |
|
| 112 | |||
| 113 | 1 | $selected_options = $select_ary = array(); |
|
| 114 | 1 | if (isset($this->config[$key]) && strlen($this->config[$key]) > 0) |
|
| 115 | 1 | { |
|
| 116 | 1 | $selected_options = explode(',', $this->config[$key]); |
|
| 117 | 1 | } |
|
| 118 | |||
| 119 | // Build forum options |
||
| 120 | 1 | foreach ($forum_list as $f_id => $f_row) |
|
| 121 | { |
||
| 122 | 1 | $select_ary[] = array( |
|
| 123 | 1 | 'value' => $f_id, |
|
| 124 | 1 | 'title' => $f_row['padding'] . $f_row['forum_name'], |
|
| 125 | 1 | 'disabled' => $f_row['disabled'], |
|
| 126 | ); |
||
| 127 | 1 | } |
|
| 128 | |||
| 129 | 1 | return $this->generate_select_box($key, $select_ary, $selected_options, true); |
|
| 130 | } |
||
| 131 | |||
| 132 | /** |
||
| 133 | * Store selected forums |
||
| 134 | * |
||
| 135 | * @param string $key Key name |
||
| 136 | * |
||
| 137 | * @return null |
||
| 138 | * @access public |
||
| 139 | */ |
||
| 140 | 1 | View Code Duplication | public function store_selected_forums($key) |
| 141 | { |
||
| 142 | // Get selected extensions |
||
| 143 | 1 | $values = $this->request->variable($key, array(0 => '')); |
|
| 144 | 1 | $news = implode(',', $values); |
|
| 145 | 1 | $this->config->set($key, $news); |
|
| 146 | 1 | } |
|
| 147 | |||
| 148 | /** |
||
| 149 | * Wrapper method for controller_helper::route() |
||
| 150 | * |
||
| 151 | * @param string $route Route name |
||
| 152 | * @param array $params Route parameters |
||
| 153 | * @param bool $is_amp |
||
| 154 | * @param bool $session_id |
||
| 155 | * @param bool $reference_type |
||
| 156 | * |
||
| 157 | * @return string URL for route |
||
| 158 | */ |
||
| 159 | 1 | public function route($route, $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH) |
|
| 160 | { |
||
| 161 | 1 | return $this->controller_helper->route($route, $params, $is_amp, $session_id, $reference_type); |
|
| 162 | } |
||
| 163 | |||
| 164 | /** |
||
| 165 | * Display radio buttons for left/right choice |
||
| 166 | * |
||
| 167 | * @param int $value Selected value |
||
| 168 | * @param string $key Key of config variable |
||
| 169 | * |
||
| 170 | * @return string |
||
| 171 | */ |
||
| 172 | 2 | public function display_left_right($value, $key) |
|
| 173 | { |
||
| 174 | 2 | $radio_ary = array(0 => 'PORTAL_SHOW_ALL_LEFT', 1 => 'PORTAL_SHOW_ALL_RIGHT'); |
|
| 175 | |||
| 176 | 2 | return h_radio($key, $radio_ary, $value, $key); |
|
| 177 | } |
||
| 178 | |||
| 179 | /** |
||
| 180 | * Store left right choice |
||
| 181 | * |
||
| 182 | * @param string $key Config key |
||
| 183 | */ |
||
| 184 | 1 | public function store_left_right($key) |
|
| 185 | { |
||
| 186 | // Get selected side |
||
| 187 | 1 | $value = $this->request->variable($key, 0); |
|
| 188 | |||
| 189 | 1 | $this->config->set($key, $value); |
|
| 190 | 1 | } |
|
| 191 | } |
||
| 192 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.