add telegrams
This commit is contained in:
@@ -1554,6 +1554,12 @@
|
||||
$config['mod']['create_notes'] = $config['mod']['view_notes'];
|
||||
// Remote notes
|
||||
$config['mod']['remove_notes'] = ADMIN;
|
||||
// View telegrams
|
||||
$config['mod']['view_telegrams'] = JANITOR;
|
||||
// Create telegrams
|
||||
$config['mod']['create_telegrams'] = $config['mod']['view_telegrams'];
|
||||
// Remote telegrams
|
||||
$config['mod']['remove_telegrams'] = ADMIN;
|
||||
// Create a new board
|
||||
$config['mod']['newboard'] = ADMIN;
|
||||
// Manage existing boards (change title, etc)
|
||||
|
Binary file not shown.
@@ -2286,6 +2286,9 @@ msgstr "usuń"
|
||||
#: ../../../../templates/cache/b1/4c/16a427b0d49ecf353c259d9fb606841783484eca9d790e766fdf0e3e9754.php:208
|
||||
msgid "New note"
|
||||
msgstr "Nowa notka"
|
||||
|
||||
msgid "New telegram"
|
||||
msgstr "Nowa depesza"
|
||||
|
||||
#. line 94
|
||||
#. line 7
|
||||
@@ -3510,3 +3513,6 @@ msgstr "Pokazuj bany tylko z boardów, które moderuję"
|
||||
#: ../../../../templates/cache/ba/55/2553cc018aecf7d29a62331aec4bedc71b646817c7e4c4e7d1a885263676.php:55
|
||||
msgid "Show only active bans"
|
||||
msgstr "Pokazuj tylko aktywne bany"
|
||||
|
||||
msgid "Important message from Moderation"
|
||||
msgstr "Ważna wiadomość od Moderacji"
|
||||
|
@@ -793,6 +793,27 @@ function mod_ip_remove_note($cloaked_ip, $id) {
|
||||
header('Location: ?/IP/' . $cloaked_ip . '#notes', true, $config['redirect_http']);
|
||||
}
|
||||
|
||||
function mod_ip_remove_telegram($cloaked_ip, $id) {
|
||||
$ip = uncloak_ip($cloaked_ip);
|
||||
global $config, $mod;
|
||||
|
||||
if (!hasPermission($config['mod']['remove_telegrams']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
if (filter_var($ip, FILTER_VALIDATE_IP) === false)
|
||||
error("Invalid IP address.");
|
||||
|
||||
$query = prepare('DELETE FROM ``telegrams`` WHERE `ip` = :ip AND `id` = :id');
|
||||
$query->bindValue(':ip', $ip);
|
||||
$query->bindValue(':id', $id);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
modLog("Removed a telegram for <a href=\"?/IP/{$cloaked_ip}\">{$cloaked_ip}</a>");
|
||||
|
||||
header('Location: ?/IP/' . $cloaked_ip . '#telegrams', true, $config['redirect_http']);
|
||||
}
|
||||
|
||||
|
||||
function mod_page_ip($cip) {
|
||||
$ip = uncloak_ip($cip);
|
||||
global $config, $mod;
|
||||
@@ -828,7 +849,26 @@ function mod_page_ip($cip) {
|
||||
header('Location: ?/IP/' . $cip . '#notes', true, $config['redirect_http']);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['telegram'])) {
|
||||
if (!hasPermission($config['mod']['create_telegrams']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$_POST['telegram'] = escape_markup_modifiers($_POST['telegram']);
|
||||
markup($_POST['telegram']);
|
||||
$query = prepare('INSERT INTO ``telegrams`` VALUES (NULL, :mod_id, :ip, :message, 0, :created_at)');
|
||||
$query->bindValue(':ip', $ip);
|
||||
$query->bindValue(':mod_id', $mod['id']);
|
||||
$query->bindValue(':created_at', time());
|
||||
$query->bindValue(':message', $_POST['telegram']);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
modLog("Added a telegram for <a href=\"?/IP/{$cip}\">{$cip}</a>");
|
||||
|
||||
header('Location: ?/IP/' . $cip . '#telegrams', true, $config['redirect_http']);
|
||||
return;
|
||||
}
|
||||
|
||||
$args = array();
|
||||
$args['ip'] = $ip;
|
||||
$args['posts'] = array();
|
||||
@@ -872,7 +912,14 @@ function mod_page_ip($cip) {
|
||||
$query->execute() or error(db_error($query));
|
||||
$args['notes'] = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
|
||||
if (hasPermission($config['mod']['view_telegrams'])) {
|
||||
$query = prepare("SELECT ``telegrams``.*, `username` FROM ``telegrams`` LEFT JOIN ``mods`` ON `mod_id` = ``mods``.`id` WHERE `ip` = :ip ORDER BY `created_at` DESC");
|
||||
$query->bindValue(':ip', $ip);
|
||||
$query->execute() or error(db_error($query));
|
||||
$args['telegrams'] = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
if (hasPermission($config['mod']['modlog_ip'])) {
|
||||
$query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `text` LIKE :search ORDER BY `time` DESC LIMIT 50");
|
||||
$query->bindValue(':search', '%' . $cip . '%');
|
||||
|
Reference in New Issue
Block a user