[BETA] MOD Logbook

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
`checho`
Registered User
Posts: 63
Joined: Fri Nov 12, 2004 7:08 pm
Contact:

Post by `checho` »

I am shocked to see that no one has an answer to my issue. Does nobody really has experienced that kind of error?
`checho` wrote: That is when trying to delete messages.

Please help...

Code: Select all

Could not insert data into logbook 

DEBUG MODE 

SQL Error : 1054 Unknown column 'permanent' in 'field list' 

INSERT INTO phpbb_logbook (action, user_id, username, user_ip, time, old_forum_id, old_topic_id, old_topic_title, old_post_id, old_post_time, old_title, old_text, new_forum_id, new_topic_id, new_topic_title, new_post_id, new_title, new_text, permanent ) VALUES ('delete_post', 2142, 'Luxuria', '0a042407', 1140517491, '14', '50230', 'Допиши изреченията и опиши себе си и живота си', '573373', '', 'Допиши изреченията и опиши себе си и живота си', '[quote=\"LETHAL\"][quote=\"Krasen\"]Бих написал всичко това, но се съмнявам, че някой чете всички тея писания.[/quote]Аз неам нерви да ги прочета. :D[/quote] Аз чета на всички ,защото ми е интересно... :D', '14', '50230', 'Допиши изреченията и опиши себе си и живота си', '', '', '', '0' ) 
Line : 58 
File : functions_logbook.php


And... what about this?
`checho` wrote: Another question: How can we enable this mod to be accessible by the other admin(s), but not the main admin only? The board I am installing it in is administered by me, but previously installed by a person that is now gone and left me administer it by myself. I have shell access to the machine and I can do mysql queries if necessary. What is the query to enable the access to Logbook for admin w/ user ID=3 ?
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Sorry, I have missed my watch mails on this topic. The field "permanent" was added for myself and obviously made its way into the mod here. I'll check that out as soon as possible.

The idea is that you can set the "permanent" flag for certain logbook entries based on certain criteria. For example, I also log changes to the user profile, since I'm developing a proper user database with real names and adresses, membership information and payment details. Now payment details, if they are changed, I want to know about, and I want changes to those fields to be permanent, never deleted from the log book. So that is the purpose of that field.

To solve current errors, simply create a field called 'permanent' in the table, TinyInt, lenth 1, default zero.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

`checho` wrote: Another question: How can we enable this mod to be accessible by the other admin(s), but not the main admin only? The board I am installing it in is administered by me, but previously installed by a person that is now gone and left me administer it by myself. I have shell access to the machine and I can do mysql queries if necessary. What is the query to enable the access to Logbook for admin w/ user ID=3 ?


There is an ACP section where you can add any moderator you fancy to the list of people who has access to the log book.

If you cannot access the ACP, you're in trouble, you cannot effectively administer a board, you must make yourself admin first.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

indiebandradio wrote: Is it possible to allow multiple admins access to the logbook?


Download the documentation with screenshots and read it, it tells you all about it.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

`checho` wrote:

Code: Select all

Could not insert data into logbook 

DEBUG MODE 

SQL Error : 1054 Unknown column 'permanent' in 'field list' 


OK, I found the problem, and there is a new zip file to download.
The problem was in functions_logbook.php, so simply upload this new file from the zip file and everything should work fine.
The field 'permanent' is not used.
`checho`
Registered User
Posts: 63
Joined: Fri Nov 12, 2004 7:08 pm
Contact:

Post by `checho` »

Merlin Sythove: Thank you very much for your help. The problem is now gone.

I am the administrator of the board. But not the main one. :) The one who created the board (user #2) gave me administrator rights, I can access the ACP, I can access the server via ssh, I have full access to the database etc.

When I try to access logbook.php in browser, I am getting info that I am not allowed to access this page. A similar error is displayed on the ACP - Logbook configuration.

I suspect you may have configured it in the way that by default only the main admin can access it, and after that he should enable access to the Logbook to other admins, moderators etc.

If this is the case, then I have a problem. The main admin of the board is now gone and does not visit my board anymore. So, if I want to access the Logbook, I will have to give myself permission to do so via some manual mysql query or so.

So, let's assume my user ID is #3. How can I give myself rights to view the logbook, if I am not the main admin, but I have all access to the server, including shell?

Thanks in advance.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Look in the admin logbook files for 'user_id' and whenever it compares to 2 somehow, change it to 3. Don't have time now, but you'll find it.
`checho`
Registered User
Posts: 63
Joined: Fri Nov 12, 2004 7:08 pm
Contact:

Post by `checho` »

It's me again. :wink: I am posting you some conflicts of your code with parts of the Save Posts as Drafts mod.

posting.php

Code: Select all

#
#-----[ FIND ]-------------------------------------------------
#

		$select_sql = (!$submit) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : '';
		$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
		$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';

		$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . " 
			FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " 
			WHERE p.post_id = $post_id 
				AND t.topic_id = p.topic_id 
				AND f.forum_id = p.forum_id
				$where_sql";
The above find request cannot be found as an exact match. It is slightly changed by Save Posts as Drafts mod and does look like:

Code: Select all

		$select_sql = (!$submit) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig,  p.post_draft, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : '';
		$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
		$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';

		$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . " 
			FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " 
			WHERE p.post_id = $post_id 
				AND t.topic_id = p.topic_id 
				AND f.forum_id = p.forum_id
				$where_sql";
I feel confused and do not know how to edit my file so that both of the mods are compatible.
I have looked over the topic of Save Posts as Drafts mod and noticed that there were other compatibility complaints about the old Log Actions Mod and the Save Posts as Drafts mod. It may be interesting for you to look over that. :wink:
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Apart from maybe line breaks, formatting, spaces and tabs, those two sections of code are identical as far as I can see at first sight.
`checho`
Registered User
Posts: 63
Joined: Fri Nov 12, 2004 7:08 pm
Contact:

Post by `checho` »

Merlin Sythove wrote: Apart from maybe line breaks, formatting, spaces and tabs, those two sections of code are identical as far as I can see at first sight.


And at secont sight you may notice the "p.post_draft," added by the Drafts mod on the first line. :wink: :wink: :wink: I do not know where to put it in.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Tru:

Replace with:

Code: Select all

		//START MOD Logbook
		//$select_sql = (!$submit) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : '';
		//$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
		//$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';
		//
		//$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . " 
		//	FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " 
		//	WHERE p.post_id = $post_id 
		//		AND t.topic_id = p.topic_id 
		//		AND f.forum_id = p.forum_id
		//		$where_sql";


    if ($submit)
    {
			$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_title, t.topic_first_post_id, 
				t.topic_last_post_id, t.topic_vote, p.post_id, p.post_time, p.poster_id,  p.post_draft,
				pt.post_subject, pt.post_text, pt.bbcode_uid
  			FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f , " . POSTS_TEXT_TABLE . " pt 
  			WHERE p.post_id = $post_id
  				AND t.topic_id = p.topic_id
  				AND f.forum_id = p.forum_id 
					AND pt.post_id = p.post_id ";    
    }
    else
    {
  		$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, 
				t.topic_vote, t.topic_title, p.post_id, p.post_time, p.poster_id , p.enable_bbcode, 
				p.enable_html, p.enable_smilies, p.enable_sig,  p.post_draft, p.post_username, pt.post_subject, pt.post_text, 
				pt.bbcode_uid, u.username, u.user_id, u.user_sig
  			FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u 
  			WHERE p.post_id = $post_id
  				AND t.topic_id = p.topic_id
  				AND f.forum_id = p.forum_id
  				AND pt.post_id = p.post_id AND u.user_id = p.poster_id";
		}
`checho`
Registered User
Posts: 63
Joined: Fri Nov 12, 2004 7:08 pm
Contact:

Post by `checho` »

Thank you a lot for the help. Now I have some little questions that I want to ask. On the end of the message I will give my suggestions for new features. I would be really thankful if you can give my post as much attention as possible. Thanks.

1. I am getting an error:

Code: Select all

Warning: mysql_free_result(): 43 is not a valid MySQL result resource in /var/www/forum.interbild.net/db/mysql4.php on line 318
on the logbook.php page in browser. It is above the entries. I triple-checked all my edits and I am sure I have no editing mistakes. Please help.

2. I do see the dates and times when the actions of the moderators took place, but I do not see the date and time on the left side where the original content is posted. The places where it should be displayed just stays blank and nothing is shown there.

3. I see all the actions and changes that occured, but I have a very large board and there are lots of changes that are made by users who wrote the messages. For example, I see that user X has edited their post 1 minute after they posted. Generally I don't care about such changes, I want to log the actions of moderators only. Since the user X is not a moderator, I want to hide their changes so that they are not displayed. I would appreciate if you could tell me what to touch in the code so that I log only what my moderators did on the board.

4. On the Logbook I see entries which have BBCodes but these BBCodes are not parsed but displayed as codes instead. Is there a way to have these BBCodes parsed and the content to be presented "as-is" and in the way it originally existed on the board?

--------------------

Now I want to give my suggestions for changes/new features for future versions:

1. A setting in the ACP where we set what to log: actions of users / actions of moderators / actions of administrators / actions of specified users only.
2. A setting in the ACP where we define which users (individually) to be exempt from logging.
3. A setting in the ACP where we choose if we want BBCodes parsed on the logbook or displayed as codes (above point #4).
4. A statistics page where most active people are seen graphically or on a table (most active moderators, least active moderators)
5. An option in the ACP that enables the logbook to be integrated into Viewtopic and Viewforum for whoever we authorize to see changes. Example for viewtopic: we read the originally posted message of the user, then we see some divider (-----------------) and below the post we see the history of the post (changes, by whom etc). Example for viewforum: we should see deleted topics with the text (Deleted) before the title and this way we may access topics that had been previously deleted. Of course, logbook.php may continue to work so that we can see all the changes in one place.

Thank you for reading my post. I am looking forward to seeing your replies to my suggestions. I have no patience left. :wink:
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Hi Checko,
`checho` wrote: Thank you a lot for the help. Now I have some little questions that I want to ask. On the end of the message I will give my suggestions for new features. I would be really thankful if you can give my post as much attention as possible. Thanks.

1. I am getting an error:

Code: Select all

Warning: mysql_free_result(): 43 is not a valid MySQL result resource in /var/www/forum.interbild.net/db/mysql4.php on line 318
on the logbook.php page in browser. It is above the entries. I triple-checked all my edits and I am sure I have no editing mistakes. Please help.


Simply put two // in front of that line to solve this error. I have seen the error report before , the line is not critical (results are freed at the end of execution anyway).
2. I do see the dates and times when the actions of the moderators took place, but I do not see the date and time on the left side where the original content is posted. The places where it should be displayed just stays blank and nothing is shown there.


Check the mod installation, it should be there, certainly with edited posts.
3. I see all the actions and changes that occured, but I have a very large board and there are lots of changes that are made by users who wrote the messages. For example, I see that user X has edited their post 1 minute after they posted. Generally I don't care about such changes, I want to log the actions of moderators only. Since the user X is not a moderator, I want to hide their changes so that they are not displayed. I would appreciate if you could tell me what to touch in the code so that I log only what my moderators did on the board.


In posting.php find log_action and those lines need either removing, or putting inside an IF statement to change this behaviour. If you remove them (put // in front) then no post changes will be logged. If you to this:
if ($userdata['user_level']==MOD || $userdata['user_level']==ADMIN)
{
log_action....
}
then only post edits of admin and mods are logged.

The reason for me to log ALL post edits (and clean them after 30 days) is because some people write malicious posts and then edit it, hopefully before you have seen it, to cause havoc on the board.
4. On the Logbook I see entries which have BBCodes but these BBCodes are not parsed but displayed as codes instead. Is there a way to have these BBCodes parsed and the content to be presented "as-is" and in the way it originally existed on the board?


The post "as shown" is meant to be able to copy/paste into the posting area for restoring original post content. If a full conversion of BBCode was done, you would have to convert that back again.
--------------------

Now I want to give my suggestions for changes/new features for future versions:...


Thanks for all these suggestions. I can definitely see the use for some of them, but I personally don't need them and have no plans to extend this mod myself. However, if anyone else is capable and wants to expand this mod into their own "logbook-Plus" version, be my guest, and I'll help if necessary, After all, this mod is an expansion of an existing mod of Morpheus that was abandoned / and / or just did not work anymore, and where I added the post edit logging because that was important to me.
`checho`
Registered User
Posts: 63
Joined: Fri Nov 12, 2004 7:08 pm
Contact:

Post by `checho` »

Thank you very much.

I saw anotner small problem with the Save posts as drafts mod.

Code: Select all

Missing argument 9 for delete_post() in functions_post.php on line 568
The modded line is:

Code: Select all

function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$was_a_draft)
The original unmodded line is:

Code: Select all

function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
(without the &$was_a_draft at the end).

If we remove the &$was_a_draft at the end, the error is not presented.

I wonder where should I add this &$was_a_draft in your mod, so that I have no problems?
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

What does my mod change in that line?
Post Reply

Return to “[2.0.x] MODs in Development”