vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Post Edit History Viewer (https://vborg.vbsupport.ru/showthread.php?t=105989)

bashy 01-22-2006 03:00 PM

Not a problem m8, least we got there in the end..
If another bod has the same issue at least ya can
narow it down if they use the prefixes lol

Thanks again

Have fun

Alex_ 01-22-2006 03:46 PM

I don't have prefixes but the same problem... several edits (not just re-save) but all versions show the same text. Looking at the database I see the old version but it won't show up in the thread... :(

bashy 01-22-2006 03:49 PM

Try editing the same post and saving it about 6 times, just want to see
if its the same as mine...

Lieva 01-22-2006 04:03 PM

Quote:

Originally Posted by Alex_
I don't have prefixes but the same problem... several edits (not just re-save) but all versions show the same text. Looking at the database I see the old version but it won't show up in the thread... :(

Which version of vbulletin are you using and also which version of the plugin are you using?

The original version should be a little more reliable as it doesn't do any checks before reverting to an older version.

Alex_ 01-22-2006 04:05 PM

I edited it now 8 times without success...
I tested the can_moderate condition (filled in some debug output in the showtread plugin) - this is working - I also printed out the history post as plain text on the page - this is also working.
So I guess it's a problem with this line
$post['pagetext'] = $post_temp['message'];
It seems that $post[pagetext] is not the place where my vB reads the post? Or it does overwrite it or something like that...

---
Edit:

Ok in post[pagetext] is the text of the post - I can read it out, it matches... but when I change it within the plugin the post itself doesn't change - so it seems to me that the forum takes the post text not from this var - but from where?

bashy 01-22-2006 04:10 PM

Hi m8y...

I just had to do an official edit on my own post, i forgot to
add an attachment and also had to edit again to include
more text, but again it only shows the latest edit even though
theres 4 links 0 to 3

I am going to try a single edit on another post...

bashy 01-22-2006 04:12 PM

OK just mad a single edit with a 4 word text edit
and the links only show the latest edit!!

Lieva 01-22-2006 04:15 PM

Quote:

Originally Posted by Alex_
I edited it now 8 times without success...
I tested the can_moderate condition (filled in some debug output in the showtread plugin) - this is working - I also printed out the history post as plain text on the page - this is also working.
So I guess it's a problem with this line
$post['pagetext'] = $post_temp['message'];
It seems that $post[pagetext] is not the place where my vB reads the post? Or it does overwrite it or something like that...

---
Edit:

Ok in post[pagetext] is the text of the post - I can read it out, it matches... but when I change it within the plugin the post itself doesn't change - so it seems to me that the forum takes the post text not from this var - but from where?

Maybe showthread.php was modified in 3.5.3.

If you set $post['pagetext'] to some string, then that would indicate if $post['pagetext'] is being used. It would only modify the post that you are viewing page history for.

Alex_ 01-22-2006 04:19 PM

Because your plugin does a
$post['pagetext'] = 'matched change post';
I can answer your question already - no it is not used by showthread... I'm trying to find the correct var it reads out

Lieva 01-22-2006 04:27 PM

Quote:

Originally Posted by Alex_
Because your plugin does a
$post['pagetext'] = 'matched change post';
I can answer your question already - no it is not used by showthread... I'm trying to find the correct var it reads out

Ahh ok. In 3.5.1 (and it seems 3.5.2), that variable is used for the message.

Is this section of code the same in 3.5.3 ? (are we allowed post code snippets as long as they are in [ code ] tags ? )
Code:

                $post['islastshown'] = ($post['postid'] == $lastpostid);
                $post['attachments'] =& $postattach["$post[postid]"];

                $parsed_postcache = array('text' => '', 'images' => 1, 'skip' => false);
               
                $postbits .= $postbit_obj->construct_postbit($post);

It passes $post to the postbit generator function/class. The plugin mods the $post variable just before this section.

The above is from showthread.php

Lieva 01-22-2006 04:29 PM

Quote:

Originally Posted by bashy
OK just mad a single edit with a 4 word text edit
and the links only show the latest edit!!

You have to click view post history at least once ... or does it just show

View Edit History: 1

and not

View Edit History: 0 1

?

Alex_ 01-22-2006 04:39 PM

From the hook on:
Code:

($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false;

                $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype);
                if ($fetchtype == 'post')
                {
                        $postbit_obj->highlight =& $replacewords;
                }
                $postbit_obj->cachable = $post_cachable;

                $post['islastshown'] = ($post['postid'] == $lastpostid);
                $post['attachments'] =& $postattach["$post[postid]"];

                $parsed_postcache = array('text' => '', 'images' => 1, 'skip' => false);

                $postbits .= $postbit_obj->construct_postbit($post);

Hmhm, I don't understand it... does the postbit constructer change something?!

---
Edit

The constructer does this
Code:

$this->post['message'] = $this->bbcode_parser->parse($this->post['pagetext'], $this->forum['forumid'], $this->post['allowsmilie']);
So he does use the pagetext - *confused*

Lieva 01-22-2006 04:49 PM

Quote:

Originally Posted by Alex_
From the hook on:
Code:

($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false;

                $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype);
                if ($fetchtype == 'post')
                {
                        $postbit_obj->highlight =& $replacewords;
                }
                $postbit_obj->cachable = $post_cachable;

                $post['islastshown'] = ($post['postid'] == $lastpostid);
                $post['attachments'] =& $postattach["$post[postid]"];

                $parsed_postcache = array('text' => '', 'images' => 1, 'skip' => false);

                $postbits .= $postbit_obj->construct_postbit($post);

Hmhm, I don't understand it... does the postbit constructer change something?!

It looks the same as mine. postbit_obj->construct_postbit($post) generates the actual code for the postbit.

Perhaps that has been changed.

In
includes/class_postbit.php

The postbit functions are defined.

There should be a section of code something like:

/**
* Parses the post for BB code.
*/
function parse_bbcode()
{
$this->post['message'] = $this->bbcode_parser->parse($this->post['pagetext'], $this->forum['forumid'], $this->post['allowsmilie']);
}

Maybe that refers to a different variable.

Alex_ 01-22-2006 04:50 PM

I just edited ;)
This is the same code as mine... I am confused...

Lieva 01-22-2006 04:55 PM

Quote:

Originally Posted by Alex_
I just edited ;)
This is the same code as mine... I am confused...

hard to debug without the files in front of me :(.

One other possibility is that there is a parse error in the plugin. This results in the server just ignoring it. You could add another plugin at the same hook with just $post['pagetext'] = "testing" and see if that modifies the message.

Also

showthread.php?p=68298&prev_postid=68298&prev_edit num=0#post68298

should show the original version of a given post (change 68298 to the postid of the post you want to check).

Alex_ 01-22-2006 05:01 PM

I just did a $post['pagetext'] = "something" within the showthread.php to show _all_ posts with the same text but the they were still the same... so this couldn't be.
I opened another thread and now it showed the forced text.

I think this has something to do with post cache (not browser cache because I have two browsers showing the same).
So if you open the thread the posting gets cached... now you click on history version - the page reloads but the forum says - hey, I just showed you this thread, I'll load it from the cache...

This would mean I have to hook in on an earlier stage? I don't know how the cache system works but we do cache posts for 10 days I think...

Lieva 01-22-2006 05:14 PM

Quote:

Originally Posted by Alex_
I just did a $post['pagetext'] = "something" within the showthread.php to show _all_ posts with the same text but the they were still the same... so this couldn't be.
I opened another thread and now it showed the forced text.

I think this has something to do with post cache (not browser cache because I have two browsers showing the same).
So if you open the thread the posting gets cached... now you click on history version - the page reloads but the forum says - hey, I just showed you this thread, I'll load it from the cache...

This would mean I have to hook in on an earlier stage? I don't know how the cache system works but we do cache posts for 10 days I think...

Sounds reasonably and might explain why Bashy was having some issues which fixed themselves.

One test that might be worth doing is to disable post caching and see if that fixes it.

COBRAws 01-22-2006 05:20 PM

leet

Alex_ 01-22-2006 05:21 PM

Yes it did sound reasonably but setting it to zero doesn't change anything :(

Lieva 01-22-2006 05:34 PM

Quote:

Originally Posted by Alex_
Yes it did sound reasonably but setting it to zero doesn't change anything :(

That's wierd. I set mine to 10 days and it broke it ... maybe it would take 10 days to clear the cache ...

silurius 01-22-2006 05:37 PM

This is awesome. Been looking for this for a while. It covers about half of a request I put out.

Would you mind establishing a wishlist for this thread and adding version comparison & revert capability to that list? (Even if you can't get to such features yourself, at least they'd be noted somewhere central).

Will definitely install when it matures a bit. Thank you!!!

Alex_ 01-22-2006 05:38 PM

But I like the cache feature...
I tried it with $post_cachable = false within the plugin without success... there must be point when the forum decides to use the cached version.

Lieva 01-22-2006 05:53 PM

Quote:

Originally Posted by Alex_
But I like the cache feature...
I tried it with $post_cachable = false within the plugin without success... there must be point when the forum decides to use the cached version.

It seems that if

$post['pagetext_html'] exists then it uses that instead of $postbit['pagetext'].

Adding:

$post['pagetext_html'] = "";

to the end of the plugin fixed it for me.

If this solves your problem, I will update the two XML files.

Lieva 01-22-2006 05:55 PM

Quote:

Originally Posted by silurius
This is awesome. Been looking for this for a while. It covers about half of a request I put out.

Would you mind establishing a wishlist for this thread and adding version comparison & revert capability to that list? (Even if you can't get to such features yourself, at least they'd be noted somewhere central).

Will definitely install when it matures a bit. Thank you!!!

Is there a wishlist function or something (or do you just mean that I would add a wishlist section in the original post ) ?

Alex_ 01-22-2006 06:16 PM

Quote:

Originally Posted by Lieva
It seems that if

$post['pagetext_html'] exists then it uses that instead of $postbit['pagetext'].

Adding:

$post['pagetext_html'] = "";

to the end of the plugin fixed it for me.

If this solves your problem, I will update the two XML files.

Not yet...

Lieva 01-22-2006 06:16 PM

Quote:

Originally Posted by Alex_
Not yet...

It had no effect ?

Lieva 01-22-2006 06:18 PM

Quote:

Originally Posted by Lieva
It had no effect ?

Try adding:

$post_cachable = 0

too. I assumed that that wasn't needed.

silurius 01-22-2006 06:18 PM

Quote:

Originally Posted by Lieva
Is there a wishlist function or something (or do you just mean that I would add a wishlist section in the original post ) ?

Wherever, doesn't really matter to me, just so long as it's somewhere visible.

Alex_ 01-22-2006 06:21 PM

Quote:

Originally Posted by Lieva
Try adding:

$post_cachable = 0

too. I assumed that that wasn't needed.


Argh, I'm sorry - while testing I tried several other hooks - I forgot to switch back.
It is working now, great work.

Lieva 01-22-2006 06:27 PM

Quote:

Originally Posted by Alex_
Argh, I'm sorry - while testing I tried several other hooks - I forgot to switch back.
It is working now, great work.

great, hopefully it stays working :).

Alex_ 01-22-2006 06:28 PM

I added the cachable just to be sure... without there seem to come up some side effects when using the cache.

Lieva 01-22-2006 06:36 PM

Quote:

Originally Posted by Alex_
I added the cachable just to be sure... without there seem to come up some side effects when using the cache.

Yeah, seems that it sometimes caches one of the older versions of the post.

Anyway, have updated both versions of the XML.

Alex_ 01-22-2006 06:38 PM

Just another question ;)

I guess can_administer is not a function like can_moderate?
Is it possible to restrict it to administrator only? I don't want my moderators to be able to view the history

SnickersTK 01-22-2006 06:45 PM

Wait, if your running 3.5.2 and you install the mod one, it should work now right?

I am scared of all the replies in this mod to install it :-(

Lieva 01-22-2006 06:54 PM

Quote:

Originally Posted by SnickersTK
Wait, if your running 3.5.2 and you install the mod one, it should work now right?

I am scared of all the replies in this mod to install it :-(

Well, the worst that will happen is that it won't do anything. Also, the uninstall function will undo any database edit. The problems in this thread were pretty minor and don't represent a risk of damaging the database or anything.

The changes necessary for 3.5.2 operation are already included.

Lieva 01-22-2006 06:56 PM

Quote:

Originally Posted by Alex_
Just another question ;)

I guess can_administer is not a function like can_moderate?
Is it possible to restrict it to administrator only? I don't want my moderators to be able to view the history

You would have to check the person's main usergroup.

Something like ( $vbulletin->userinfo['usergroupid'] == 6 )

6 is the default admin usergroup, so you may need to change that.

Alex_ 01-22-2006 06:57 PM

Quote:

Originally Posted by SnickersTK
Wait, if your running 3.5.2 and you install the mod one, it should work now right?

I am scared of all the replies in this mod to install it :-(

You shouldn't be scared... IMO there are some problems with caching - after going around the vB post cache and testing it for a while my browser does cache some sites not showing then up right. But that's a browser thing...

I restricted now to a userid and I'm happy with it :)

Alex_ 01-22-2006 07:01 PM

One last thing for me today... you should add the if condition to the postbit modifier as well so users who cannot view the history don't get the 'View History' link.

Lieva 01-22-2006 07:49 PM

Quote:

Originally Posted by Alex_
One last thing for me today... you should add the if condition to the postbit modifier as well so users who cannot view the history don't get the 'View History' link.

The mod to the postbit should already mean that only those with rights to see the text can see it.

Alex_ 01-22-2006 07:55 PM

Sure?
I don't see the according code... it's just a simple str_replace, isn't it?
When I restricted it to one user only this one could view the history but the link showed up for others as wellg giving them always the same version on every number...

My code looks now like
Code:

if ( $vbulletin->userinfo['usergroupid'] == 6 ) {

$vbulletin->templatecache['postbit'] =  str_replace( $insert_point,  $insert_point . $new_text , $vbulletin->templatecache['postbit'] );

$vbulletin->templatecache['postbit_legacy'] =  str_replace( $insert_point,  $insert_point . $new_text , $vbulletin->templatecache['postbit_legacy'] );

$vbulletin->templatecache['postbit'] =  str_replace( $insert_point2,  $insert_point2 . $new_text , $vbulletin->templatecache['postbit'] );

$vbulletin->templatecache['postbit_legacy'] =  str_replace( $insert_point2,  $insert_point2 . $new_text , $vbulletin->templatecache['postbit_legacy'] );
}



All times are GMT. The time now is 11:09 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01442 seconds
  • Memory Usage 1,849KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (21)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete