diff options
| author | czaks <marcin@6irc.net> | 2013-08-04 21:17:38 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-08-04 21:17:38 -0400 |
| commit | f494b34562e555edb4c7ba14ce8444a001f36d00 (patch) | |
| tree | 5503897969e7f82f95c3607f78e3cbc3f9c8f79f /inc/mod | |
| parent | 7407593ec5b3b3857719a72e7bf98e0fcae4e929 (diff) | |
| parent | 0c829aa8f6fb592c15086e8b2b0276fd862e89f1 (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts:
inc/image.php
Diffstat (limited to 'inc/mod')
| -rw-r--r-- | inc/mod/config-editor.php | 42 | ||||
| -rw-r--r-- | inc/mod/pages.php | 7 |
2 files changed, 46 insertions, 3 deletions
diff --git a/inc/mod/config-editor.php b/inc/mod/config-editor.php index caca5a0e..27740378 100644 --- a/inc/mod/config-editor.php +++ b/inc/mod/config-editor.php @@ -1,5 +1,43 @@ <?php +function permission_to_edit_config_var($varname) { + global $config, $mod; + + if (is_array($config['mod']['config'][DISABLED])) { + foreach ($config['mod']['config'][DISABLED] as $disabled_var_name) { + $disabled_var_name = explode('>', $disabled_var_name); + if (count($disabled_var_name) == 1) + $disabled_var_name = $disabled_var_name[0]; + if ($varname == $disabled_var_name) + return false; + } + } + + $allow_only = false; + // for ($perm = (int)$mod['type']; $perm >= JANITOR; $perm --) { + for ($perm = JANITOR; $perm <= (int)$mod['type']; $perm ++) { + $allow_only = false; + if (is_array($config['mod']['config'][$perm])) { + foreach ($config['mod']['config'][$perm] as $perm_var_name) { + if ($perm_var_name == '!') { + $allow_only = true; + continue; + } + $perm_var_name = explode('>', $perm_var_name); + if ((count($perm_var_name) == 1 && $varname == $perm_var_name[0]) || + (is_array($varname) && array_slice($varname, 0, count($perm_var_name)) == $perm_var_name)) { + if ($allow_only) + return true; + else + return false; + } + } + } + } + + return !$allow_only; +} + function config_vars() { global $config; @@ -77,8 +115,8 @@ function config_vars() { $already_exists = true; } - if (!$already_exists) - $conf[] = $var; + if (!$already_exists && permission_to_edit_config_var($var['name'])) + $conf[] = $var; } } diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 0a9f825b..706d747d 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -480,7 +480,12 @@ function mod_new_board() { if (!openBoard($_POST['uri'])) error(_("Couldn't open board after creation.")); - query(Element('posts.sql', array('board' => $board['uri']))) or error(db_error()); + $query = Element('posts.sql', array('board' => $board['uri'])); + + if (mysql_version() < 50503) + $query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query); + + query($query) or error(db_error()); if ($config['cache']['enabled']) cache::delete('all_boards'); |
