Kunena 6.2.5 & module Kunena Latest 6.0.7 released

The Kunena team has announce the arrival of Kunena 6.2.5 [K 6.2.5] which is now available for download as a native Joomla extension for J! 4.3.x/4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1 / K 6.2 and issues discovered during the last development stages of K 6.2

Solved Adding Kunena topics via SQL injection

More
3 years 1 month ago #1 by antifm
I have kunena installed for some time now into Joomla but there is another section of the site i would like to tie to it. Its essentially a list of topics that exist outside of the Joomla function. To import or inject these topics into Kunena, I would need to go into my PHPAdmin panel on the server and run a few SQL commands.
Ok no problem there but as i am trying to do the, i keep getting something funny and i think its because of my understanding of the Kunena Topics SQL table columns.
So maybe someone can help me clarify them.

I have over 3,000 topics i need to add into Kunena and here is what i did.
I went into the PHPAdmin area and downloaded an sql copy of the "xx_kunena_topics" table. I can use this as a template to write additional topic IDs and their needed information.
xx_kunena_topics has COLUMS with the following names and most of them, i know what they represent. But there is a couple which i am wrong about. I need to know what the colums are looking for.

Below i have typed up my understanding of each of the comumn ROWS but 3 of them i think i am getting incorrect when i creat my write up my SQL INSERT command.

fist_post_id 
last_post_id
last_post_time

The reason that i said if you have 100 topics, you dont nessasarily have 100 topics in your SQL table. If you created a topic and its ID was 100 but then deleted the topic, when you create another one, it becomes 101. It does NOT take the place in the system becoming
topic ID number 100 
and
last post ID 100

So i think thats where i am going wrong. I was able to test this by creating TWO lines of SQL INSERT commands that would create 2 topics into a specific category FROM the PHPadmin area.
I ran the code, and SUCCESS!
I see on the front end that the two topics are created correctly in the right area, with appropriate name and ID in the URL
but when i click them:
first it kept showing the BODY of the very first TOPIC so i corrected that.
Then it created it with the right topic + ID + URL+  everything else, however because of the TIMESTAMP i applied for
first_post_time
last_post_time
It told me i dont have access to the message. I believe this is also related to the FIRST and LAST post_id) Keep in mind, the post ID is relative to HOW MANY ACUTAL POSTS were created INCLUDING any deleted topics.

So my questions are below.




id - topic id number (the first topic created would be id = 1) If there is 100 topics, the last one would NOT be 100 however and below you will see why.
category_id = category ID number from the categories admin area. I am working with category number 9
subject = The text of the subject of topic name.
icon_id = denotes WHICH icon your topic uses. I have NO topic icons so this is 0
label_id = As above. This is 0
locked = These will not be locked. So this is 0
hold = Not on hold so this is 0
ordering = no particular ordering so this is 0
posts = I believ this means HOW MANY POSTS or REPLIES are tied to this topic. I am creating new topics sothis is 0
hits = the number of times this topic has been clicked to view
attachments = None so this will be 0
poll_id = As above so this is 0
moved_id = this was not moved from another category so this is 0
first_post_id = WHAT IS THIS ASKING FOR?
first_post_time = The number of seconds since Jan 1st 2021 to the time of this topic created
first_post_userid = User Id of the person creating the post
first_post_message = The BODY of the topic.
first_post_guest_name = the USERNAME tied to that USER ID
last_post_id = WHAT IS THIS ASKING FOR?
last_post_time = Is this the same as FIRST_POST_TIME ?

last_post_userid = again the USER ID tied to the USERNAME for this post
last_post_message = Same as first_post_message
last_post_guest_name = Sane as first_post_guest_name
rating = I am not using RATING so this is 0
params = this is blank

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #2 by antifm
Here is the error i am currently getting.
After inserting the (almost correct) sql into the table to create additional 2 topics. They show on the forum index as created in a category.
ok great
When i go to the category i can see the topics
ok great
when i scroll over the topic links, they have the appropriate URL for thei Topic ID number.
when i click on the topic i see this error message and i think the problem is the POST_TIME that im using.
I used a time of 1614286038 which is apparently 5 hours ago and thats fine but it doesnt work


404 Not Found
You may not be able to visit this page because of:

an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.
If difficulties persist, please contact the System Administrator of this site and report the error below.
Last edit: 3 years 1 month ago by antifm.

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago #3 by antifm
So i have been able to trace doen the priblem.

When i INSERT SQL COMMAND to create new tables, the
first_post_message
And
last_post_message

Are not being recognized so the information in the sql table is blank. Thats why i get the error when i try to view the topic.

Any ideas?

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #4 by rich

first_post_id = WHAT IS THIS ASKING FOR?
last_post_id = WHAT IS THIS ASKING FOR?
last_post_time = Is this the same as FIRST_POST_TIME ?

first_post_id is the id of the first message in a topic
last_post_id is the last message id in a topic
last_post_time is the posting time of the last message in this topic
Last edit: 3 years 1 month ago by rich.

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago #5 by antifm
Rich. Thanks for that explanation but still a couple questions.

first_post_id is the id of the first message in a topic
(I guess this is the ID Number according to the number of topics posted to the forum over all)

last_post_id is the last message id in a topic
(If there are NO MESSAGES other than the first, i guess this would be the same ID NUMBER as "first post id") correct?

last_post_time is the posting time of the last message in this topic
This is where i got lots as well. What is the format the SQL table wants to use to understand?

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago - 2 years 9 months ago #6 by rich
Sorry, maybe I was vague about it. The IDs are assigned continuously for all posts for the complete forum. You may not use the same ID for different posts.
Example, if you have a clean Forum:

If you create the first topic without answer, you have
First post ID 1
Last post ID 1 (and the posting time)

If you write an answer, you see
First post ID 1
Last post ID 2 (and the posting time)

Now create a second topic with an answer, and you see
First post ID 3
Last post ID 4

If you now answer again to the first topic you get
First post ID 1
Last post ID 5 (and the posting time)

In this example, the messages of the first topic have the IDs 1 2 5 and messages in the second topic ID 3 and 4
Last edit: 2 years 9 months ago by rich.

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago #7 by antifm
ok cool i understand that part now. Thanks very much mate.
The final question is still about the POST TIME.

In my SQL table for example. I see a POST TIME as
1614286027
what is this representing? Number of seconds since the beginning of the year?
I want to create these topics and insert them but ill need to make sure i enter in a POST TIME for each one that represents a time always PRIOR to my activity on the SQL table. otherwise i could end up with a different problem
Also i need to make sure im formating it correctly or the SQL table wont understand it or kick an error within the POST.

So

What does 1614286027 represent in the SQL table for TIME? Any idea?

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago #8 by antifm
Hmm..
I must still be missing something. I made the edits to an SQL INSERT command and queried it to the system.
The result was good on the SQL output. It states that 2 rows were inserted successfully.  (Good because im testing this by inserting just two lines anyway)
BUT.....

when i go to the area on the FRONT end where the topics are supposed to show up.
1. I can see the topics created on the forum by way of the SQL command.
2. When i click a topic SUBJECT to open and read it, i get this error

404 Not Found
You may not be able to visit this page because of:

an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.
If difficulties persist, please contact the System Administrator of this site and report the error below.

 

Im going to bet the problem is the TIME format. Here is what i am inserting.
INSERT INTO `XXXXXXX_kunena_topics` (`id`, `category_id`, `subject`, `icon_id`, `label_id`, `locked`, `hold`, `ordering`, `posts`, `hits`, `attachments`, `poll_id`, `moved_id`, `first_post_id`, `first_post_time`, `first_post_userid`, `first_post_message`, `first_post_guest_name`, `last_post_id`, `last_post_time`, `last_post_userid`, `last_post_message`, `last_post_guest_name`, `rating`, `params`) VALUES
(114, 9, 'Luca Morris and Mozzy Rekorder - Stepping Stone Original Mix', 0, 0, 0, 0, 0, 1, 44, 0, 0, 0, 114, 1614286027, 42, 'Discuss this track below', 'Antifmradio', 114, 1614286027, 42, 'Discuss this track below', 'Antifmradio', 0, ''),
(115, 9, 'Armin van Buuren and BT - Always Assaf extended remix', 0, 0, 0, 0, 0, 1, 200, 0, 0, 0, 115, 1614286038, 42, 'Discuss this track below', 'Antifmradio', 115, 1614286038, 42, 'Discuss this track below', 'Antifmradio', 0, '');

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago - 2 years 9 months ago #9 by xillibit

ok cool i understand that part now. Thanks very much mate.
The final question is still about the POST TIME.

In my SQL table for example. I see a POST TIME as
1614286027
what is this representing? Number of seconds since the beginning of the year?
I want to create these topics and insert them but ill need to make sure i enter in a POST TIME for each one that represents a time always PRIOR to my activity on the SQL table. otherwise i could end up with a different problem
Also i need to make sure im formating it correctly or the SQL table wont understand it or kick an error within the POST.

So

What does 1614286027 represent in the SQL table for TIME? Any idea?
 

 

This number is just a timestamp, which is a precise time in seconds

I don't provide support by PM, because this can be useful for someone else.
Last edit: 2 years 9 months ago by xillibit.

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago #10 by antifm

 

 

This number is just a timestamp, which is a precise time in seconds

Then i have no idea whats causing the 404 error.
I wonder what would happen if i delete the TIMESTAMP in the SQL table for these two lines.

If it works, ill just leave the TIME blank when i run the SQL next time

Please Log in or Create an account to join the conversation.

Time to create page: 0.424 seconds