satanasov /
phpbbgallery
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * phpBB Gallery - Core Extension |
||||||
| 4 | * |
||||||
| 5 | * @package phpbbgallery/core |
||||||
| 6 | * @author nickvergessen |
||||||
| 7 | * @author satanasov |
||||||
| 8 | * @author Leinad4Mind |
||||||
| 9 | * @copyright 2007-2012 nickvergessen, 2014- satanasov, 2018- Leinad4Mind |
||||||
| 10 | * @license GPL-2.0-only |
||||||
| 11 | */ |
||||||
| 12 | |||||||
| 13 | namespace phpbbgallery\core\acp; |
||||||
| 14 | |||||||
| 15 | class config_module |
||||||
| 16 | { |
||||||
| 17 | /** |
||||||
| 18 | * This function is called, when the main() function is called. |
||||||
| 19 | * You can use this function to add your language files, check for a valid mode, unset config options and more. |
||||||
| 20 | * |
||||||
| 21 | * @param int $id The ID of the module |
||||||
| 22 | * @param string $mode The name of the mode we want to display |
||||||
| 23 | * @return void |
||||||
| 24 | */ |
||||||
| 25 | public function main($id, $mode) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 26 | { |
||||||
| 27 | // Check whether the mode is allowed. |
||||||
| 28 | if (!isset($this->display_vars[$mode])) |
||||||
| 29 | { |
||||||
| 30 | trigger_error('NO_MODE', E_USER_ERROR); |
||||||
| 31 | } |
||||||
| 32 | |||||||
| 33 | global $config, $db, $user, $template, $cache, $phpbb_container, $phpbb_root_path, $phpEx, $phpbb_gallery_url; |
||||||
| 34 | global $request, $config; |
||||||
| 35 | |||||||
| 36 | $phpbb_gallery_url = $phpbb_container->get('phpbbgallery.core.url'); |
||||||
| 37 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 38 | $this->language->add_lang(array('gallery', 'gallery_acp'), 'phpbbgallery/core'); |
||||||
| 39 | |||||||
| 40 | $submit = (isset($_POST['submit'])) ? true : false; |
||||||
| 41 | $form_key = 'acp_time'; |
||||||
| 42 | add_form_key($form_key); |
||||||
|
0 ignored issues
–
show
The function
add_form_key was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 43 | |||||||
| 44 | switch ($mode) |
||||||
| 45 | { |
||||||
| 46 | case 'main': |
||||||
| 47 | $vars = $this->get_display_vars('main'); |
||||||
| 48 | break; |
||||||
| 49 | } |
||||||
| 50 | // Init gallery block class |
||||||
| 51 | $phpbb_ext_gallery_core_constants = $phpbb_container->get('phpbbgallery.core.block'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 52 | // Init gallery configs class |
||||||
| 53 | $phpbb_gallery_configs = new \phpbbgallery\core\config($config); |
||||||
| 54 | $this->new_config = $phpbb_gallery_configs->get_all(); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 55 | $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config; |
||||||
|
0 ignored issues
–
show
The function
utf8_normalize_nfc was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 56 | $error = array(); |
||||||
| 57 | |||||||
| 58 | // We validate the complete config if whished |
||||||
| 59 | validate_config_vars($vars['vars'], $cfg_array, $error); |
||||||
|
0 ignored issues
–
show
The function
validate_config_vars was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 60 | if ($submit && !check_form_key($form_key)) |
||||||
|
0 ignored issues
–
show
The function
check_form_key was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 61 | { |
||||||
| 62 | $error[] = $this->language->lang('FORM_INVALID'); |
||||||
| 63 | } |
||||||
| 64 | |||||||
| 65 | // Do not write values if there is an error |
||||||
| 66 | if (sizeof($error)) |
||||||
| 67 | { |
||||||
| 68 | $submit = false; |
||||||
| 69 | } |
||||||
| 70 | //now we display the variables |
||||||
| 71 | foreach ($vars['vars'] as $config_name => $null) |
||||||
| 72 | { |
||||||
| 73 | if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) |
||||||
| 74 | { |
||||||
| 75 | continue; |
||||||
| 76 | } |
||||||
| 77 | $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; |
||||||
| 78 | |||||||
| 79 | if ($submit) |
||||||
| 80 | { |
||||||
| 81 | // Check for RRC-display-options |
||||||
| 82 | if (isset($null['method']) && (($null['method'] == 'rrc_display') || ($null['method'] == 'rrc_modes'))) |
||||||
| 83 | { |
||||||
| 84 | // Changing the value, casted by int to not mess up anything |
||||||
| 85 | $config_value = (int) array_sum($request->variable($config_name, array(0))); |
||||||
| 86 | } |
||||||
| 87 | // Recalculate the Watermark-position |
||||||
| 88 | if (isset($null['method']) && ($null['method'] == 'watermark_position')) |
||||||
| 89 | { |
||||||
| 90 | // Changing the value, casted by int to not mess up anything |
||||||
| 91 | $config_value = $request->variable('watermark_position_x', 0) + $request->variable('watermark_position_y', 0); |
||||||
| 92 | } |
||||||
| 93 | if ($config_name == 'link_thumbnail') |
||||||
| 94 | { |
||||||
| 95 | $update_bbcode = $request->variable('update_bbcode', ''); |
||||||
| 96 | // Update the BBCode |
||||||
| 97 | if ($update_bbcode) |
||||||
| 98 | { |
||||||
| 99 | if (!class_exists('acp_bbcodes')) |
||||||
| 100 | { |
||||||
| 101 | $phpbb_gallery_url->_include('acp/acp_bbcodes', 'phpbb'); |
||||||
| 102 | } |
||||||
| 103 | $acp_bbcodes = new \acp_bbcodes(); |
||||||
|
0 ignored issues
–
show
The type
acp_bbcodes was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 104 | $bbcode_match = '[image]{NUMBER}[/image]'; |
||||||
| 105 | $bbcode_tpl = $this->bbcode_tpl($config_value); |
||||||
| 106 | |||||||
| 107 | $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl); |
||||||
| 108 | $sql_ary = array_merge($sql_ary, array( |
||||||
| 109 | 'bbcode_match' => $bbcode_match, |
||||||
| 110 | 'bbcode_tpl' => $bbcode_tpl, |
||||||
| 111 | 'display_on_posting' => true, |
||||||
| 112 | 'bbcode_helpline' => 'GALLERY_HELPLINE_ALBUM', |
||||||
| 113 | )); |
||||||
| 114 | $sql = 'UPDATE ' . BBCODES_TABLE . ' |
||||||
|
0 ignored issues
–
show
|
|||||||
| 115 | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " |
||||||
| 116 | WHERE bbcode_tag = '" . $db->sql_escape($sql_ary['bbcode_tag']) . "'"; |
||||||
| 117 | $db->sql_query($sql); |
||||||
| 118 | $cache->destroy('sql', BBCODES_TABLE); |
||||||
| 119 | } |
||||||
| 120 | } |
||||||
| 121 | if ((strpos($config_name, 'watermark') !== false) && ($phpbb_gallery_configs->get($config_name) != $config_value)) |
||||||
| 122 | { |
||||||
| 123 | $phpbb_gallery_configs->set('watermark_changed', time()); |
||||||
| 124 | // OK .. let's try and destroy watermarked images |
||||||
| 125 | $cache_dir = @opendir($phpbb_gallery_url->path('thumbnail')); |
||||||
| 126 | while ($cache_file = @readdir($cache_dir)) |
||||||
|
0 ignored issues
–
show
It seems like
$cache_dir can also be of type false; however, parameter $dir_handle of readdir() does only seem to accept resource, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 127 | { |
||||||
| 128 | if (preg_match('/(\_wm.webp$|\_wm.gif$|\_wm.png$|\_wm.jpg|\_wm.jpeg)$/is', $cache_file)) |
||||||
| 129 | { |
||||||
| 130 | @unlink($phpbb_gallery_url->path('thumbnail') . $cache_file); |
||||||
|
0 ignored issues
–
show
It seems like you do not handle an error condition for
unlink(). This can introduce security issues, and is generally not recommended.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
|
|||||||
| 131 | } |
||||||
| 132 | } |
||||||
| 133 | @closedir($cache_dir); |
||||||
|
0 ignored issues
–
show
It seems like
$cache_dir can also be of type false; however, parameter $dir_handle of closedir() does only seem to accept resource, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
Are you sure the usage of
closedir($cache_dir) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
It seems like you do not handle an error condition for
closedir(). This can introduce security issues, and is generally not recommended.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
|
|||||||
| 134 | |||||||
| 135 | $medium_dir = @opendir($phpbb_gallery_url->path('medium')); |
||||||
| 136 | while ($medium_file = @readdir($medium_dir)) |
||||||
| 137 | { |
||||||
| 138 | if (preg_match('/(\_wm.webp$|\_wm.gif$|\_wm.png$|\_wm.jpg|\_wm.jpeg)$/is', $medium_file)) |
||||||
| 139 | { |
||||||
| 140 | @unlink($phpbb_gallery_url->path('medium') . $medium_file); |
||||||
| 141 | } |
||||||
| 142 | } |
||||||
| 143 | @closedir($medium_dir); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
closedir($medium_dir) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 144 | $upload_dir = @opendir($phpbb_gallery_url->path('upload')); |
||||||
| 145 | while ($upload_file = @readdir($upload_dir)) |
||||||
| 146 | { |
||||||
| 147 | if (preg_match('/(\_wm.webp$|\_wm.gif$|\_wm.png$|\_wm.jpg|\_wm.jpeg)$/is', $upload_file)) |
||||||
| 148 | { |
||||||
| 149 | @unlink($phpbb_gallery_url->path('upload') . $upload_file); |
||||||
| 150 | } |
||||||
| 151 | } |
||||||
| 152 | @closedir($upload_dir); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
closedir($upload_dir) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 153 | |||||||
| 154 | for ($i = 1; $i <= $phpbb_gallery_configs->get('current_upload_dir'); $i++) |
||||||
| 155 | { |
||||||
| 156 | $cache_dir = @opendir($phpbb_gallery_url->path('thumbnail') . $i . '/'); |
||||||
| 157 | while ($cache_file = @readdir($cache_dir)) |
||||||
| 158 | { |
||||||
| 159 | if (preg_match('/(\_wm.webp$|\_wm.gif$|\_wm.png$|\_wm.jpg|\_wm.jpeg)$/is', $cache_file)) |
||||||
| 160 | { |
||||||
| 161 | @unlink($phpbb_gallery_url->path('thumbnail') . $i . '/' . $cache_file); |
||||||
| 162 | } |
||||||
| 163 | } |
||||||
| 164 | @closedir($cache_dir); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
closedir($cache_dir) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 165 | |||||||
| 166 | $medium_dir = @opendir($phpbb_gallery_url->path('medium') . $i . '/'); |
||||||
| 167 | while ($medium_file = @readdir($medium_dir)) |
||||||
| 168 | { |
||||||
| 169 | if (preg_match('/(\_wm.webp$|\_wm.gif$|\_wm.png$|\_wm.jpg|\_wm.jpeg)$/is', $medium_file)) |
||||||
| 170 | { |
||||||
| 171 | @unlink($phpbb_gallery_url->path('medium') . $i . '/' . $medium_file); |
||||||
| 172 | } |
||||||
| 173 | } |
||||||
| 174 | @closedir($medium_dir); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
closedir($medium_dir) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 175 | $upload_dir = @opendir($phpbb_gallery_url->path('upload') . $i . '/'); |
||||||
| 176 | while ($upload_file = @readdir($upload_dir)) |
||||||
| 177 | { |
||||||
| 178 | if (preg_match('/(\_wm.webp$|\_wm.gif$|\_wm.png$|\_wm.jpg|\_wm.jpeg)$/is', $upload_file)) |
||||||
| 179 | { |
||||||
| 180 | @unlink($phpbb_gallery_url->path('upload') . $upload_file); |
||||||
| 181 | } |
||||||
| 182 | } |
||||||
| 183 | @closedir($upload_dir); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
closedir($upload_dir) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 184 | } |
||||||
| 185 | } |
||||||
| 186 | $phpbb_gallery_configs->set($config_name, $config_value); |
||||||
| 187 | } |
||||||
| 188 | } |
||||||
| 189 | if ($submit) |
||||||
| 190 | { |
||||||
| 191 | $cache->destroy('sql', CONFIG_TABLE); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 192 | trigger_error($this->language->lang('GALLERY_CONFIG_UPDATED') . adm_back_link($this->u_action)); |
||||||
|
0 ignored issues
–
show
The function
adm_back_link was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 193 | } |
||||||
| 194 | |||||||
| 195 | $this->tpl_name = 'acp_board'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 196 | $this->page_title = $vars['title']; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 197 | |||||||
| 198 | $template->assign_vars(array( |
||||||
| 199 | 'L_TITLE' => $this->language->lang($vars['title']), |
||||||
| 200 | 'L_TITLE_EXPLAIN' => $this->language->lang($vars['title'] . '_EXPLAIN'), |
||||||
| 201 | |||||||
| 202 | 'S_ERROR' => (sizeof($error)) ? true : false, |
||||||
| 203 | 'ERROR_MSG' => implode('<br />', $error), |
||||||
| 204 | |||||||
| 205 | 'U_ACTION' => $this->u_action) |
||||||
| 206 | ); |
||||||
| 207 | |||||||
| 208 | // Output relevant page |
||||||
| 209 | foreach ($vars['vars'] as $config_key => $vars) |
||||||
| 210 | { |
||||||
| 211 | if (!is_array($vars) && strpos($config_key, 'legend') === false) |
||||||
| 212 | { |
||||||
| 213 | continue; |
||||||
| 214 | } |
||||||
| 215 | |||||||
| 216 | if (strpos($config_key, 'legend') !== false) |
||||||
| 217 | { |
||||||
| 218 | $legend_text = ($this->language->is_set($vars)) ? $this->language->lang($vars) : $vars; |
||||||
| 219 | |||||||
| 220 | if (!empty($legend_text)) |
||||||
| 221 | { |
||||||
| 222 | $template->assign_block_vars('options', array( |
||||||
| 223 | 'S_LEGEND' => true, |
||||||
| 224 | 'LEGEND' => $legend_text |
||||||
| 225 | )); |
||||||
| 226 | } |
||||||
| 227 | |||||||
| 228 | continue; |
||||||
| 229 | } |
||||||
| 230 | |||||||
| 231 | if (isset($vars['append'])) |
||||||
| 232 | { |
||||||
| 233 | $langs_var = $this->language->lang_raw($vars['append']); |
||||||
| 234 | if (is_array($langs_var)) |
||||||
| 235 | { |
||||||
| 236 | $vars['append'] = ' ' . substr($this->language->lang($vars['append'], 0), 1); |
||||||
| 237 | } |
||||||
| 238 | else |
||||||
| 239 | { |
||||||
| 240 | $vars['append'] = ' ' . $this->language->lang($vars['append']); |
||||||
| 241 | } |
||||||
| 242 | } |
||||||
| 243 | |||||||
| 244 | $this->new_config[$config_key] = $phpbb_gallery_configs->get($config_key); |
||||||
| 245 | |||||||
| 246 | $type = explode(':', $vars['type']); |
||||||
| 247 | |||||||
| 248 | $l_explain = ''; |
||||||
| 249 | if (isset($vars['explain'])) |
||||||
| 250 | { |
||||||
| 251 | $l_explain = $this->language->lang($vars['lang'] . '_EXP') ? $this->language->lang($vars['lang'] . '_EXP') : ''; |
||||||
| 252 | } |
||||||
| 253 | |||||||
| 254 | $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); |
||||||
|
0 ignored issues
–
show
The function
build_cfg_template was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 255 | |||||||
| 256 | if (empty($content)) |
||||||
| 257 | { |
||||||
| 258 | continue; |
||||||
| 259 | } |
||||||
| 260 | |||||||
| 261 | $template->assign_block_vars('options', array( |
||||||
| 262 | 'KEY' => $config_key, |
||||||
| 263 | 'TITLE' => $this->language->lang($vars['lang']) ? $this->language->lang($vars['lang']) : $vars['lang'], |
||||||
| 264 | 'S_EXPLAIN' => (isset($vars['explain']) ? $vars['explain'] : ''), |
||||||
| 265 | 'TITLE_EXPLAIN' => $l_explain, |
||||||
| 266 | 'CONTENT' => $content, |
||||||
| 267 | )); |
||||||
| 268 | |||||||
| 269 | unset($this->display_vars['vars'][$config_key]); |
||||||
| 270 | } |
||||||
| 271 | } |
||||||
| 272 | |||||||
| 273 | /** |
||||||
| 274 | * Returns an array with the display_var array for the given mode |
||||||
| 275 | * The returned display must have the two keys title and vars |
||||||
| 276 | * @key string title The page title or lang key for the page title |
||||||
| 277 | * @key array vars An array of tupels, one foreach config option we display: |
||||||
| 278 | * @key The name of the config in the get_config_array() array. |
||||||
| 279 | * If the key starts with 'legend' a new box is opened with the value being the title of this box. |
||||||
| 280 | * @value An array with several options: |
||||||
| 281 | * @key lang Description for the config value (can be a language key) |
||||||
| 282 | * @key explain Boolean whether the config has an explanation of not. |
||||||
| 283 | * If true, <lang>_EXP (and <lang>_EXPLAIN) is displayed as explanation |
||||||
| 284 | * @key validate The config value can be validated as bool, int or string. |
||||||
| 285 | * Additional a min and max value can be specified for integers |
||||||
| 286 | * On strings the min and max value are the length of the string |
||||||
| 287 | * If your config value shall not be casted, remove the validate-key. |
||||||
| 288 | * @key type The type of the config option: |
||||||
| 289 | * - Radio buttons: Either with "Yes and No" (radio:yes_no) or "Enabled and Disabled" (radio:enabled_disabled) as description |
||||||
| 290 | * - Text/password field: "text:<field-size>:<text-max-length>" and "password:<field-size>:<text-max-length>" |
||||||
| 291 | * - Select: "select" requires the key "function" or "method" to be set which provides the html code for the options |
||||||
| 292 | * - Custom template: "custom" requires the key "function" or "method" to be set which provides the html code |
||||||
| 293 | * @key function/method Required when using type select and custom |
||||||
| 294 | * @key append A language string that is appended after the config type (e.g. You can append 'px' to a pixel size field) |
||||||
| 295 | * This last parameter is optional |
||||||
| 296 | * @key string tpl Name of the template file we use to display the configs |
||||||
| 297 | * |
||||||
| 298 | * @param string $mode The name of the mode we want to display |
||||||
| 299 | * @return array See description above |
||||||
| 300 | */ |
||||||
| 301 | public function get_display_vars($mode) |
||||||
| 302 | { |
||||||
| 303 | global $phpbb_dispatcher; |
||||||
| 304 | |||||||
| 305 | $return_ary = $this->display_vars[$mode]; |
||||||
| 306 | |||||||
| 307 | /** |
||||||
| 308 | * Event to send the display vars |
||||||
| 309 | * @event phpbbgallery.core.acp.config.get_display_vars |
||||||
| 310 | * @var string mode Mode we are requesting for |
||||||
| 311 | * @var array return_ary Array we are sending back |
||||||
| 312 | * @since 1.2.0 |
||||||
| 313 | */ |
||||||
| 314 | $vars = array('mode', 'return_ary'); |
||||||
| 315 | extract($phpbb_dispatcher->trigger_event('phpbbgallery.core.acp.config.get_display_vars', compact($vars))); |
||||||
| 316 | |||||||
| 317 | $vars = array(); |
||||||
| 318 | $legend_count = 1; |
||||||
| 319 | foreach ($return_ary['vars'] as $legend_name => $configs) |
||||||
| 320 | { |
||||||
| 321 | $vars['legend' . $legend_count] = $legend_name; |
||||||
| 322 | foreach ($configs as $key => $options) |
||||||
| 323 | { |
||||||
| 324 | $vars[$key] = $options; |
||||||
| 325 | } |
||||||
| 326 | $legend_count++; |
||||||
| 327 | } |
||||||
| 328 | |||||||
| 329 | // Add one last legend for the buttons |
||||||
| 330 | $vars['legend' . $legend_count] = ''; |
||||||
| 331 | $return_ary['vars'] = $vars; |
||||||
| 332 | |||||||
| 333 | return $return_ary; |
||||||
| 334 | } |
||||||
| 335 | |||||||
| 336 | protected $display_vars = array( |
||||||
| 337 | 'main' => array( |
||||||
| 338 | 'title' => 'GALLERY_CONFIG', |
||||||
| 339 | 'vars' => array( |
||||||
| 340 | '' => array(), |
||||||
| 341 | 'GALLERY_CONFIG' => array( |
||||||
| 342 | 'items_per_page' => array('lang' => 'ITEMS_PER_PAGE', 'validate' => 'int', 'type' => 'text:7:3', 'explain' => true), |
||||||
| 343 | 'allow_comments' => array('lang' => 'COMMENT_SYSTEM', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 344 | 'comment_user_control' => array('lang' => 'COMMENT_USER_CONTROL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
||||||
| 345 | 'comment_length' => array('lang' => 'COMMENT_MAX_LENGTH', 'validate' => 'int', 'type' => 'text:7:5', 'append' => 'CHARACTERS'), |
||||||
| 346 | 'allow_rates' => array('lang' => 'RATE_SYSTEM', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 347 | 'max_rating' => array('lang' => 'RATE_SCALE', 'validate' => 'int', 'type' => 'text:7:2'), |
||||||
| 348 | 'allow_hotlinking' => array('lang' => 'HOTLINK_PREVENT', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 349 | 'hotlinking_domains' => array('lang' => 'HOTLINK_ALLOWED', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), |
||||||
| 350 | ), |
||||||
| 351 | |||||||
| 352 | 'ALBUM_SETTINGS' => array( |
||||||
| 353 | 'album_display' => array('lang' => 'RRC_DISPLAY_OPTIONS', 'validate' => 'int', 'type' => 'custom', 'method' => 'rrc_display'), |
||||||
| 354 | 'default_sort_key' => array('lang' => 'DEFAULT_SORT_METHOD', 'validate' => 'string', 'type' => 'custom', 'method' => 'sort_method_select'), |
||||||
| 355 | 'default_sort_dir' => array('lang' => 'DEFAULT_SORT_ORDER', 'validate' => 'string', 'type' => 'custom', 'method' => 'sort_order_select'), |
||||||
| 356 | 'album_images' => array('lang' => 'MAX_IMAGES_PER_ALBUM', 'validate' => 'int', 'type' => 'text:7:7', 'explain' => true), |
||||||
| 357 | 'mini_thumbnail_disp' => array('lang' => 'DISP_FAKE_THUMB', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 358 | 'mini_thumbnail_size' => array('lang' => 'FAKE_THUMB_SIZE', 'validate' => 'int', 'type' => 'text:7:4', 'explain' => true, 'append' => 'PIXELS'), |
||||||
| 359 | ), |
||||||
| 360 | |||||||
| 361 | 'SEARCH_SETTINGS' => array( |
||||||
| 362 | 'search_display' => array('lang' => 'RRC_DISPLAY_OPTIONS', 'validate' => 'int', 'type' => 'custom', 'method' => 'rrc_display'), |
||||||
| 363 | ), |
||||||
| 364 | |||||||
| 365 | 'IMAGE_SETTINGS' => array( |
||||||
| 366 | 'num_uploads' => array('lang' => 'UPLOAD_IMAGES', 'validate' => 'int', 'type' => 'text:7:2'), |
||||||
| 367 | 'max_filesize' => array('lang' => 'MAX_FILE_SIZE', 'validate' => 'int', 'type' => 'text:12:9', 'append' => 'BYTES'), |
||||||
| 368 | 'max_width' => array('lang' => 'MAX_WIDTH', 'validate' => 'int', 'type' => 'text:7:5', 'append' => 'PIXELS'), |
||||||
| 369 | 'max_height' => array('lang' => 'MAX_HEIGHT', 'validate' => 'int', 'type' => 'text:7:5', 'append' => 'PIXELS'), |
||||||
| 370 | 'allow_resize' => array('lang' => 'RESIZE_IMAGES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 371 | 'allow_rotate' => array('lang' => 'ROTATE_IMAGES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 372 | 'jpg_quality' => array('lang' => 'JPG_QUALITY', 'validate' => 'int', 'type' => 'text:7:5', 'explain' => true), |
||||||
| 373 | //'medium_cache' => array('lang' => 'MEDIUM_CACHE', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 374 | 'medium_width' => array('lang' => 'RSZ_WIDTH', 'validate' => 'int', 'type' => 'text:7:4', 'append' => 'PIXELS'), |
||||||
| 375 | 'medium_height' => array('lang' => 'RSZ_HEIGHT', 'validate' => 'int', 'type' => 'text:7:4', 'append' => 'PIXELS'), |
||||||
| 376 | 'allow_gif' => array('lang' => 'GIF_ALLOWED', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 377 | 'allow_jpg' => array('lang' => 'JPG_ALLOWED', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 378 | 'allow_png' => array('lang' => 'PNG_ALLOWED', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 379 | 'allow_webp' => array('lang' => 'WEBP_ALLOWED', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 380 | 'allow_zip' => array('lang' => 'ZIP_ALLOWED', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 381 | 'description_length' => array('lang' => 'IMAGE_DESC_MAX_LENGTH', 'validate' => 'int', 'type' => 'text:7:5', 'append' => 'CHARACTERS'), |
||||||
| 382 | 'disp_nextprev_thumbnail' => array('lang' => 'DISP_NEXTPREV_THUMB','validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 383 | 'disp_image_url' => array('lang' => 'VIEW_IMAGE_URL', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 384 | ), |
||||||
| 385 | |||||||
| 386 | 'THUMBNAIL_SETTINGS' => array( |
||||||
| 387 | //'thumbnail_cache' => array('lang' => 'THUMBNAIL_CACHE', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 388 | 'gdlib_version' => array('lang' => 'GD_VERSION', 'validate' => 'int', 'type' => 'custom', 'method' => 'gd_radio'), |
||||||
| 389 | 'thumbnail_width' => array('lang' => 'THUMBNAIL_WIDTH', 'validate' => 'int', 'type' => 'text:7:3', 'append' => 'PIXELS'), |
||||||
| 390 | 'thumbnail_height' => array('lang' => 'THUMBNAIL_HEIGHT', 'validate' => 'int', 'type' => 'text:7:3', 'append' => 'PIXELS'), |
||||||
| 391 | 'thumbnail_quality' => array('lang' => 'THUMBNAIL_QUALITY', 'validate' => 'int', 'type' => 'text:7:3', 'explain' => true, 'append' => 'PERCENT'), |
||||||
| 392 | //'thumbnail_infoline' => array('lang' => 'INFO_LINE', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 393 | ), |
||||||
| 394 | |||||||
| 395 | 'WATERMARK_OPTIONS' => array( |
||||||
| 396 | 'watermark_enabled' => array('lang' => 'WATERMARK_IMAGES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 397 | 'watermark_source' => array('lang' => 'WATERMARK_SOURCE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'watermark_source'), |
||||||
| 398 | 'watermark_height' => array('lang' => 'WATERMARK_HEIGHT', 'validate' => 'int', 'type' => 'text:7:4', 'explain' => true, 'append' => 'PIXELS'), |
||||||
| 399 | 'watermark_width' => array('lang' => 'WATERMARK_WIDTH', 'validate' => 'int', 'type' => 'text:7:4', 'explain' => true, 'append' => 'PIXELS'), |
||||||
| 400 | 'watermark_position' => array('lang' => 'WATERMARK_POSITION', 'validate' => '', 'type' => 'custom', 'method' => 'watermark_position'), |
||||||
| 401 | ), |
||||||
| 402 | |||||||
| 403 | 'UC_LINK_CONFIG' => array( |
||||||
| 404 | 'link_thumbnail' => array('lang' => 'UC_THUMBNAIL', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'uc_select'), |
||||||
| 405 | 'link_imagepage' => array('lang' => 'UC_IMAGEPAGE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'uc_select'), |
||||||
| 406 | 'link_image_name' => array('lang' => 'UC_IMAGE_NAME', 'validate' => 'string', 'type' => 'custom', 'method' => 'uc_select'), |
||||||
| 407 | 'link_image_icon' => array('lang' => 'UC_IMAGE_ICON', 'validate' => 'string', 'type' => 'custom', 'method' => 'uc_select'), |
||||||
| 408 | ), |
||||||
| 409 | |||||||
| 410 | 'RRC_GINDEX' => array( |
||||||
| 411 | 'rrc_gindex_mode' => array('lang' => 'RRC_GINDEX_MODE', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'rrc_modes'), |
||||||
| 412 | 'rrc_gindex_comments' => array('lang' => 'RRC_GINDEX_COMMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 413 | //'rrc_gindex_contests' => array('lang' => 'RRC_GINDEX_CONTESTS', 'validate' => 'int', 'type' => 'text:7:3'), |
||||||
| 414 | 'rrc_gindex_display' => array('lang' => 'RRC_DISPLAY_OPTIONS', 'validate' => '', 'type' => 'custom', 'method' => 'rrc_display'), |
||||||
| 415 | 'rrc_gindex_pegas' => array('lang' => 'RRC_GINDEX_PGALLERIES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 416 | ), |
||||||
| 417 | |||||||
| 418 | 'PHPBB_INTEGRATION' => array( |
||||||
| 419 | 'disp_gallery_icon' => array('lang' => 'DISP_GALLERY_ICON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
||||||
| 420 | 'disp_total_images' => array('lang' => 'DISP_TOTAL_IMAGES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 421 | 'profile_user_images' => array('lang' => 'DISP_USER_IMAGES_PROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 422 | 'profile_pega' => array('lang' => 'DISP_PERSONAL_ALBUM_PROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 423 | 'rrc_profile_mode' => array('lang' => 'RRC_PROFILE_MODE', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'rrc_modes'), |
||||||
| 424 | 'rrc_profile_items' => array('lang' => 'RRC_PROFILE_ITEMS', 'validate' => 'int', 'type' => 'text:7:3'), |
||||||
| 425 | 'rrc_profile_display' => array('lang' => 'RRC_DISPLAY_OPTIONS', 'validate' => 'int', 'type' => 'custom', 'method' => 'rrc_display'), |
||||||
| 426 | //'rrc_profile_pegas' => array('lang' => 'RRC_GINDEX_PGALLERIES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 427 | //'viewtopic_icon' => array('lang' => 'DISP_VIEWTOPIC_ICON', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 428 | //'viewtopic_images' => array('lang' => 'DISP_VIEWTOPIC_IMAGES', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 429 | //'viewtopic_link' => array('lang' => 'DISP_VIEWTOPIC_LINK', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 430 | ), |
||||||
| 431 | |||||||
| 432 | 'INDEX_SETTINGS' => array( |
||||||
| 433 | 'pegas_index_album' => array('lang' => 'PERSONAL_ALBUM_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
||||||
| 434 | //'pegas_index_random' => array('lang' => 'RANDOM_ON_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
||||||
| 435 | 'pegas_index_rnd_count' => array('lang' => 'RANDOM_ON_INDEX_COUNT', 'validate' => 'int', 'type' => 'text:7:3'), |
||||||
| 436 | //'pegas_index_recent' => array('lang' => 'RECENT_ON_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
||||||
| 437 | 'pegas_index_rct_count' => array('lang' => 'RECENT_ON_INDEX_COUNT', 'validate' => 'int', 'type' => 'text:7:3'), |
||||||
| 438 | 'disp_login' => array('lang' => 'DISP_LOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
||||||
| 439 | 'disp_whoisonline' => array('lang' => 'DISP_WHOISONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 440 | 'disp_birthdays' => array('lang' => 'DISP_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 441 | 'disp_statistic' => array('lang' => 'DISP_STATISTIC', 'validate' => 'bool', 'type' => 'radio:yes_no'), |
||||||
| 442 | ), |
||||||
| 443 | ), |
||||||
| 444 | ), |
||||||
| 445 | ); |
||||||
| 446 | |||||||
| 447 | /** |
||||||
| 448 | * Disabled Radio Buttons |
||||||
| 449 | * @param $value |
||||||
| 450 | * @param $key |
||||||
| 451 | * @return string |
||||||
| 452 | */ |
||||||
| 453 | function disabled_boolean($value, $key) |
||||||
|
0 ignored issues
–
show
The parameter
$value is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 454 | { |
||||||
| 455 | global $phpbb_container; |
||||||
| 456 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 457 | |||||||
| 458 | $tpl = ''; |
||||||
| 459 | |||||||
| 460 | $tpl .= "<label><input type=\"radio\" name=\"config[$key]\" value=\"1\" disabled=\"disabled\" class=\"radio\" /> " . $this->language->lang('YES') . '</label>'; |
||||||
| 461 | $tpl .= "<label><input type=\"radio\" id=\"$key\" name=\"config[$key]\" value=\"0\" checked=\"checked\" disabled=\"disabled\" class=\"radio\" /> " . $this->language->lang('NO') . '</label>'; |
||||||
| 462 | |||||||
| 463 | return $tpl; |
||||||
| 464 | } |
||||||
| 465 | |||||||
| 466 | /** |
||||||
| 467 | * Select sort method |
||||||
| 468 | * @param $value |
||||||
| 469 | * @param $key |
||||||
| 470 | * @return string |
||||||
| 471 | */ |
||||||
| 472 | function sort_method_select($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 473 | { |
||||||
| 474 | global $phpbb_container; |
||||||
| 475 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 476 | |||||||
| 477 | $sort_method_options = ''; |
||||||
| 478 | |||||||
| 479 | $sort_method_options .= '<option' . (($value == 't') ? ' selected="selected"' : '') . " value='t'>" . $this->language->lang('TIME') . '</option>'; |
||||||
| 480 | $sort_method_options .= '<option' . (($value == 'n') ? ' selected="selected"' : '') . " value='n'>" . $this->language->lang('IMAGE_NAME') . '</option>'; |
||||||
| 481 | $sort_method_options .= '<option' . (($value == 'vc') ? ' selected="selected"' : '') . " value='vc'>" . $this->language->lang('GALLERY_VIEWS') . '</option>'; |
||||||
| 482 | $sort_method_options .= '<option' . (($value == 'u') ? ' selected="selected"' : '') . " value='u'>" . $this->language->lang('USERNAME') . '</option>'; |
||||||
| 483 | $sort_method_options .= '<option' . (($value == 'ra') ? ' selected="selected"' : '') . " value='ra'>" . $this->language->lang('RATING') . '</option>'; |
||||||
| 484 | $sort_method_options .= '<option' . (($value == 'r') ? ' selected="selected"' : '') . " value='r'>" . $this->language->lang('RATES_COUNT') . '</option>'; |
||||||
| 485 | $sort_method_options .= '<option' . (($value == 'c') ? ' selected="selected"' : '') . " value='c'>" . $this->language->lang('COMMENTS') . '</option>'; |
||||||
| 486 | $sort_method_options .= '<option' . (($value == 'lc') ? ' selected="selected"' : '') . " value='lc'>" . $this->language->lang('NEW_COMMENT') . '</option>'; |
||||||
| 487 | |||||||
| 488 | return "<select name=\"config[$key]\" id=\"$key\">$sort_method_options</select>"; |
||||||
| 489 | } |
||||||
| 490 | |||||||
| 491 | /** |
||||||
| 492 | * Select sort order |
||||||
| 493 | * @param $value |
||||||
| 494 | * @param $key |
||||||
| 495 | * @return string |
||||||
| 496 | */ |
||||||
| 497 | function sort_order_select($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 498 | { |
||||||
| 499 | global $phpbb_container; |
||||||
| 500 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 501 | |||||||
| 502 | $sort_order_options = ''; |
||||||
| 503 | |||||||
| 504 | $sort_order_options .= '<option' . (($value == 'd') ? ' selected="selected"' : '') . " value='d'>" . $this->language->lang('SORT_DESCENDING') . '</option>'; |
||||||
| 505 | $sort_order_options .= '<option' . (($value == 'a') ? ' selected="selected"' : '') . " value='a'>" . $this->language->lang('SORT_ASCENDING') . '</option>'; |
||||||
| 506 | |||||||
| 507 | return "<select name=\"config[$key]\" id=\"$key\">$sort_order_options</select>"; |
||||||
| 508 | } |
||||||
| 509 | |||||||
| 510 | /** |
||||||
| 511 | * Radio Buttons for GD library |
||||||
| 512 | * @param $value |
||||||
| 513 | * @param $key |
||||||
| 514 | * @return string |
||||||
| 515 | */ |
||||||
| 516 | function gd_radio($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 517 | { |
||||||
| 518 | global $phpbb_container; |
||||||
| 519 | $phpbb_ext_gallery_core_file = $phpbb_container->get('phpbbgallery.core.file.tool'); |
||||||
| 520 | $key_gd1 = ($value == $phpbb_ext_gallery_core_file::GDLIB1) ? ' checked="checked"' : ''; |
||||||
| 521 | $key_gd2 = ($value == $phpbb_ext_gallery_core_file::GDLIB2) ? ' checked="checked"' : ''; |
||||||
| 522 | |||||||
| 523 | $tpl = ''; |
||||||
| 524 | |||||||
| 525 | $tpl .= "<label><input type=\"radio\" name=\"config[$key]\" value=\"" . $phpbb_ext_gallery_core_file::GDLIB1 . "\" $key_gd1 class=\"radio\" /> GD1</label>"; |
||||||
| 526 | $tpl .= "<label><input type=\"radio\" id=\"$key\" name=\"config[$key]\" value=\"" . $phpbb_ext_gallery_core_file::GDLIB2 . "\" $key_gd2 class=\"radio\" /> GD2</label>"; |
||||||
| 527 | |||||||
| 528 | return $tpl; |
||||||
| 529 | } |
||||||
| 530 | |||||||
| 531 | /** |
||||||
| 532 | * Display watermark |
||||||
| 533 | * @param $value |
||||||
| 534 | * @param $key |
||||||
| 535 | * @return string |
||||||
| 536 | */ |
||||||
| 537 | function watermark_source($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 538 | { |
||||||
| 539 | global $phpbb_container; |
||||||
| 540 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 541 | |||||||
| 542 | return generate_board_url() . "<br /><input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" size =\"40\" maxlength=\"125\" /><br /><img src=\"" . generate_board_url() . "/$value\" alt=\"" . $this->language->lang('WATERMARK') . "\" />"; |
||||||
|
0 ignored issues
–
show
The function
generate_board_url was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 543 | } |
||||||
| 544 | |||||||
| 545 | /** |
||||||
| 546 | * Display watermark |
||||||
| 547 | * @param $value |
||||||
| 548 | * @param $key |
||||||
| 549 | * @return string |
||||||
| 550 | */ |
||||||
| 551 | function watermark_position($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 552 | { |
||||||
| 553 | global $phpbb_container; |
||||||
| 554 | |||||||
| 555 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 556 | |||||||
| 557 | $phpbb_ext_gallery_core_constants = new \phpbbgallery\core\constants(); |
||||||
| 558 | |||||||
| 559 | $x_position_options = $y_position_options = ''; |
||||||
| 560 | |||||||
| 561 | $x_position_options .= '<option' . (($value & $phpbb_ext_gallery_core_constants::WATERMARK_TOP) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_constants::WATERMARK_TOP . "'>" . $this->language->lang('WATERMARK_POSITION_TOP') . '</option>'; |
||||||
| 562 | $x_position_options .= '<option' . (($value & $phpbb_ext_gallery_core_constants::WATERMARK_MIDDLE) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_constants::WATERMARK_MIDDLE . "'>" . $this->language->lang('WATERMARK_POSITION_MIDDLE') . '</option>'; |
||||||
| 563 | $x_position_options .= '<option' . (($value & $phpbb_ext_gallery_core_constants::WATERMARK_BOTTOM) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_constants::WATERMARK_BOTTOM . "'>" . $this->language->lang('WATERMARK_POSITION_BOTTOM') . '</option>'; |
||||||
| 564 | |||||||
| 565 | $y_position_options .= '<option' . (($value & $phpbb_ext_gallery_core_constants::WATERMARK_LEFT) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_constants::WATERMARK_LEFT . "'>" . $this->language->lang('WATERMARK_POSITION_LEFT') . '</option>'; |
||||||
| 566 | $y_position_options .= '<option' . (($value & $phpbb_ext_gallery_core_constants::WATERMARK_CENTER) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_constants::WATERMARK_CENTER . "'>" . $this->language->lang('WATERMARK_POSITION_CENTER') . '</option>'; |
||||||
| 567 | $y_position_options .= '<option' . (($value & $phpbb_ext_gallery_core_constants::WATERMARK_RIGHT) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_constants::WATERMARK_RIGHT . "'>" . $this->language->lang('WATERMARK_POSITION_RIGHT') . '</option>'; |
||||||
| 568 | |||||||
| 569 | // Cheating is an evil-thing, but most times it's successful, that's why it is used. |
||||||
| 570 | return "<input type='hidden' name='config[$key]' value='$value' /><select name='" . $key . "_x' id='" . $key . "_x'>$x_position_options</select><select name='" . $key . "_y' id='" . $key . "_y'>$y_position_options</select>"; |
||||||
| 571 | } |
||||||
| 572 | |||||||
| 573 | /** |
||||||
| 574 | * Select the link destination |
||||||
| 575 | * @param $value |
||||||
| 576 | * @param $key |
||||||
| 577 | * @return string |
||||||
| 578 | */ |
||||||
| 579 | function uc_select($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 580 | { |
||||||
| 581 | global $phpbb_container; |
||||||
| 582 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 583 | |||||||
| 584 | $sort_order_options = '';//phpbb_gallery_plugins::uc_select($value, $key); |
||||||
| 585 | |||||||
| 586 | if ($key != 'link_imagepage') |
||||||
| 587 | { |
||||||
| 588 | $sort_order_options .= '<option' . (($value == 'image_page') ? ' selected="selected"' : '') . " value='image_page'>" . $this->language->lang('UC_LINK_IMAGE_PAGE') . '</option>'; |
||||||
| 589 | } |
||||||
| 590 | else |
||||||
| 591 | { |
||||||
| 592 | $sort_order_options .= '<option' . (($value == 'next') ? ' selected="selected"' : '') . " value='next'>" . $this->language->lang('UC_LINK_NEXT') . '</option>'; |
||||||
| 593 | } |
||||||
| 594 | $sort_order_options .= '<option' . (($value == 'image') ? ' selected="selected"' : '') . " value='image'>" . $this->language->lang('UC_LINK_IMAGE') . '</option>'; |
||||||
| 595 | $sort_order_options .= '<option' . (($value == 'none') ? ' selected="selected"' : '') . " value='none'>" . $this->language->lang('UC_LINK_NONE') . '</option>'; |
||||||
| 596 | |||||||
| 597 | return "<select name='config[$key]' id='$key'>$sort_order_options</select>" |
||||||
| 598 | . (($key == 'link_thumbnail') ? '<br /><input class="checkbox" type="checkbox" name="update_bbcode" id="update_bbcode" value="update_bbcode" /><label for="update_bbcode">' . $this->language->lang('UPDATE_BBCODE') . '</label>' : ''); |
||||||
| 599 | } |
||||||
| 600 | |||||||
| 601 | /** |
||||||
| 602 | * Select RRC-Config on gallery/index.php and in the profile |
||||||
| 603 | * @param $value |
||||||
| 604 | * @param $key |
||||||
| 605 | * @return string |
||||||
| 606 | */ |
||||||
| 607 | function rrc_modes($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 608 | { |
||||||
| 609 | global $phpbb_container; |
||||||
| 610 | |||||||
| 611 | $phpbb_ext_gallery_core_block = $phpbb_container->get('phpbbgallery.core.block'); |
||||||
| 612 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 613 | |||||||
| 614 | $rrc_mode_options = ''; |
||||||
| 615 | |||||||
| 616 | $rrc_mode_options .= "<option value='" . $phpbb_ext_gallery_core_block::MODE_NONE . "'>" . $this->language->lang('RRC_MODE_NONE') . '</option>'; |
||||||
| 617 | $rrc_mode_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::MODE_RECENT) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::MODE_RECENT . "'>" . $this->language->lang('RRC_MODE_RECENT') . '</option>'; |
||||||
| 618 | $rrc_mode_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::MODE_RANDOM) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::MODE_RANDOM . "'>" . $this->language->lang('RRC_MODE_RANDOM') . '</option>'; |
||||||
| 619 | if ($key != 'rrc_profile_mode') |
||||||
| 620 | { |
||||||
| 621 | $rrc_mode_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::MODE_COMMENT) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::MODE_COMMENT . "'>" . $this->language->lang('RRC_MODE_COMMENTS') . '</option>'; |
||||||
| 622 | } |
||||||
| 623 | |||||||
| 624 | // Cheating is an evil-thing, but most times it's successful, that's why it is used. |
||||||
| 625 | return "<input type='hidden' name='config[$key]' value='$value' /><select name='" . $key . "[]' multiple='multiple' id='$key'>$rrc_mode_options</select>"; |
||||||
| 626 | } |
||||||
| 627 | |||||||
| 628 | /** |
||||||
| 629 | * Select RRC display options |
||||||
| 630 | * @param $value |
||||||
| 631 | * @param $key |
||||||
| 632 | * @return string |
||||||
| 633 | */ |
||||||
| 634 | function rrc_display($value, $key) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 635 | { |
||||||
| 636 | global $phpbb_container; |
||||||
| 637 | // Init gallery block class |
||||||
| 638 | $phpbb_ext_gallery_core_block = $phpbb_container->get('phpbbgallery.core.block'); |
||||||
| 639 | $this->language = $phpbb_container->get('language'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 640 | |||||||
| 641 | $rrc_display_options = ''; |
||||||
| 642 | |||||||
| 643 | $rrc_display_options .= "<option value='" . $phpbb_ext_gallery_core_block::DISPLAY_NONE . "'>" . $this->language->lang('RRC_DISPLAY_NONE') . '</option>'; |
||||||
| 644 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_ALBUMNAME) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_ALBUMNAME . "'>" . $this->language->lang('RRC_DISPLAY_ALBUMNAME') . '</option>'; |
||||||
| 645 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_COMMENTS) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_COMMENTS . "'>" . $this->language->lang('RRC_DISPLAY_COMMENTS') . '</option>'; |
||||||
| 646 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_IMAGENAME) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_IMAGENAME . "'>" . $this->language->lang('RRC_DISPLAY_IMAGENAME') . '</option>'; |
||||||
| 647 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_IMAGETIME) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_IMAGETIME . "'>" . $this->language->lang('RRC_DISPLAY_IMAGETIME') . '</option>'; |
||||||
| 648 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_IMAGEVIEWS) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_IMAGEVIEWS . "'>" . $this->language->lang('RRC_DISPLAY_IMAGEVIEWS') . '</option>'; |
||||||
| 649 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_USERNAME) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_USERNAME . "'>" . $this->language->lang('RRC_DISPLAY_USERNAME') . '</option>'; |
||||||
| 650 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_RATINGS) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_RATINGS . "'>" . $this->language->lang('RRC_DISPLAY_RATINGS') . '</option>'; |
||||||
| 651 | $rrc_display_options .= '<option' . (($value & $phpbb_ext_gallery_core_block::DISPLAY_IP) ? ' selected="selected"' : '') . " value='" . $phpbb_ext_gallery_core_block::DISPLAY_IP . "'>" . $this->language->lang('RRC_DISPLAY_IP') . '</option>'; |
||||||
| 652 | |||||||
| 653 | // Cheating is an evil-thing, but most times it's successful, that's why it is used. |
||||||
| 654 | return "<input type='hidden' name='config[$key]' value='$value' /><select name='" . $key . "[]' multiple='multiple' id='$key'>$rrc_display_options</select>"; |
||||||
| 655 | } |
||||||
| 656 | |||||||
| 657 | /** |
||||||
| 658 | * BBCode-Template |
||||||
| 659 | * @param $value |
||||||
| 660 | * @return string |
||||||
| 661 | */ |
||||||
| 662 | function bbcode_tpl($value) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 663 | { |
||||||
| 664 | global $phpbb_gallery_url; |
||||||
| 665 | $gallery_url = $phpbb_gallery_url->path('full'); |
||||||
| 666 | |||||||
| 667 | if ($value == 'image_page') |
||||||
| 668 | { |
||||||
| 669 | $bbcode_tpl = '<a href="' . $gallery_url . 'image/{NUMBER}"><img src="' . $gallery_url . 'image/{NUMBER}/mini" alt="{NUMBER}" /></a>'; |
||||||
| 670 | } |
||||||
| 671 | else if ($value == 'image') |
||||||
| 672 | { |
||||||
| 673 | $bbcode_tpl = '<a href="' . $gallery_url . 'image/{NUMBER}/source"><img src="' . $gallery_url . 'image/{NUMBER}/mini" alt="{NUMBER}" /></a>'; |
||||||
| 674 | } |
||||||
| 675 | else |
||||||
| 676 | { |
||||||
| 677 | $bbcode_tpl = '<img src="' . $gallery_url . 'image/{NUMBER}/mini" alt="{NUMBER}" />'; |
||||||
| 678 | } |
||||||
| 679 | |||||||
| 680 | return $bbcode_tpl; |
||||||
| 681 | } |
||||||
| 682 | } |
||||||
| 683 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.