custom capcode permissions
This commit is contained in:
parent
e132e4c2b3
commit
890b541191
@ -871,6 +871,19 @@
|
||||
* ====================
|
||||
*/
|
||||
|
||||
// Capcode permissions
|
||||
$config['mod']['capcode'] = array(
|
||||
// JANITOR => array('Janitor'),
|
||||
MOD => array('Mod'),
|
||||
ADMIN => true
|
||||
);
|
||||
|
||||
// Example: Allow mods to post with "## Moderator" as well
|
||||
// $config['mod']['capcode'][MOD][] = 'Moderator';
|
||||
|
||||
// Example: Allow janitors to post with any capcode
|
||||
// $config['mod']['capcode'][JANITOR] = true;
|
||||
|
||||
// Set any of the below to "DISABLED" to make them unavailable for everyone.
|
||||
|
||||
// Don't worry about per-board moderators. Let all mods moderate any board.
|
||||
|
22
post.php
22
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']);
|
||||
|
Loading…
Reference in New Issue
Block a user