XMB Forum Software
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: [Resolved] Prevent disply of admin actions
Aerosmith
Experienced
***




Posts: 26
Registered: 4-12-2002
Location: Earth
Member Is Offline

Mood: Semi-something

[*] posted on 7-2-2019 at 09:34 PM
[Resolved] Prevent disply of admin actions


Full Board URL: url invalid - provide a real forum address
XMB Version: 1.9.11

How do I disable the display of things like this ?



Thread Split
10-21-18 at 01:24 AM
View user's profile Visit user's homepage View All Posts By User
bfgadmin
Member
***




Posts: 52
Registered: 5-7-2020
Location: Pittsburgh, PA
Member Is Offline

Mood: Technical

[*] posted on 5-7-2020 at 08:20 PM


These are pulled out of $table_logs from your forum's database and displayed in-line.

There are a few options for preventing it. One would be removing the UNION SELECT statement from this query in viewthread.php

Code:
$sql = "SELECT p.*, m.* " . "FROM " . "( " . " ( " . " SELECT 'post' AS type, fid, tid, author, subject, dateline, pid, message, icon, usesig, useip, bbcodeoff, smileyoff " . " FROM ".X_PREFIX."posts " . " WHERE tid=$tid AND (dateline > $startdate OR dateline = $startdate AND pid >= $startpid)" . " ORDER BY dateline ASC, pid ASC " . " LIMIT $ppp " . " ) " . " UNION ALL " . " ( " . " SELECT 'modlog' AS type, fid, tid, username AS author, action AS subject, date AS dateline, '', '', '', '', '', '', '' " . " FROM ".X_PREFIX."logs " . " WHERE tid=$tid AND date >= $startdate AND date < $enddate " . " ) " . ") AS p " . "LEFT JOIN ".X_PREFIX."members m ON m.username=p.author " . "ORDER BY p.dateline ASC, p.type DESC, p.pid ASC "; $querypost = $db->query($sql);


Don't go nuking your forum with this just yet. I have a test board setup to check code before rolling it out to our production site. I'll remove it on there and see what it does.

Also, since it is pulled from $table_logs, clearing the log would presumably have the same effect. So would preventing the log from being written in the first place, although you'd lose the ability to audit moderators and other administrators (who can clear logs anyhow...)

Give me a few, I'll come up with something.



View user's profile Visit user's homepage View All Posts By User
bfgadmin
Member
***




Posts: 52
Registered: 5-7-2020
Location: Pittsburgh, PA
Member Is Offline

Mood: Technical

[*] posted on 5-8-2020 at 03:07 AM


OK, so I can verify that using the Admin CP feature "Clear CP Logs" only clears administrative logs and not use of moderator functions (topicadmin.php stuff).

As written earlier, you can either 1) modify the above query to prevent mod logs from being displayed in-line with posts, 2) modify the query that writes the logs or 3) manually clear the entries from $table_logs.

Here's a simple way of doing option #1. There are certainly prettier ways to go about this, but here's a quick & dirty way to disable it. Change the above query to this:

Code:
$sql = "SELECT p.*, m.* " . "FROM " . "( " . " ( " . " SELECT 'post' AS type, fid, tid, author, subject, dateline, pid, message, icon, usesig, useip, bbcodeoff, smileyoff " . " FROM ".X_PREFIX."posts " . " WHERE tid=$tid AND (dateline > $startdate OR dateline = $startdate AND pid >= $startpid)" . " ORDER BY dateline ASC, pid ASC " . " LIMIT $ppp " . " ) " . " UNION ALL " . " ( " . " SELECT 'modlog' AS type, fid, tid, username AS author, action AS subject, date AS dateline, '', '', '', '', '', '', '' " . " FROM ".X_PREFIX."logs " . " WHERE tid=$tid AND date >= $startdate AND date < 1 " . " ) " . ") AS p " . "LEFT JOIN ".X_PREFIX."members m ON m.username=p.author " . "ORDER BY p.dateline ASC, p.type DESC, p.pid ASC ";


The "sabotage" happens in the UNION ALL's where clause: WHERE tid=$tid AND date >= $startdate AND date < 1

On my test forum, this prevented in-line view of mod log entries while still preserving the log itself for auditing purposes. You could also easily re-enable it once you realize how useful the feature is. :lol:



View user's profile Visit user's homepage View All Posts By User
miqrogroove
XMB 1.9.12 Lead Developer
*********


Avatar


Posts: 460
Registered: 10-1-2002
Location: Florida
Member Is Offline

Mood: Past Three O'Clock

[*] posted on 9-3-2020 at 06:04 AM


This will be turned off by default in 1.9.12.
View user's profile Visit user's homepage View All Posts By User

  Go To Top

Powered by XMB 1.9.12 (Debug Mode)
XMB Forum Software © 2001-2024 The XMB Group
[Queries: 16] [PHP: 33.3% - SQL: 66.7%]