summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-05-07 18:22:20 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-05-07 18:22:20 +1000
commit890b541191286a7ce0d62df86fef37cf86abb1a8 (patch)
tree9afc985f6a3104bd7cb663d6ad92e9c004d48b9d /post.php
parente132e4c2b3dc62c2ddb6bdbcc562e67fa61c9fa8 (diff)
custom capcode permissions
Diffstat (limited to 'post.php')
-rw-r--r--post.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/post.php b/post.php
index b4a256a5..11465a6e 100644
--- a/post.php
+++ b/post.php
@@ -310,13 +310,23 @@ if (isset($_POST['delete'])) {
)));
}
- if ($mod && $mod['type'] >= MOD && preg_match('/^((.+) )?## (.+)$/', $post['name'], $match)) {
- if (($mod['type'] == MOD && $match[3] == 'Mod') || $mod['type'] >= ADMIN) {
- $post['capcode'] = utf8tohtml($match[3]);
- $post['name'] = $match[2] != '' ? $match[2] : $config['anonymous'];
+
+ $post['capcode'] = false;
+
+ if ($mod && preg_match('/^((.+) )?## (.+)$/', $post['name'], $matches)) {
+ $name = $matches[2] != '' ? $matches[2] : $config['anonymous'];
+ $cap = $matches[3];
+
+ if (isset($config['mod']['capcode'][$mod['type']])) {
+ if ( $config['mod']['capcode'][$mod['type']] === true ||
+ (is_array($config['mod']['capcode'][$mod['type']]) &&
+ in_array($cap, $config['mod']['capcode'][$mod['type']])
+ )) {
+
+ $post['capcode'] = utf8tohtml($cap);
+ $post['name'] = $name;
+ }
}
- } else {
- $post['capcode'] = false;
}
$trip = generate_tripcode($post['name']);