Firefox PHP

Topic Poll Module

Posted by Maurice Makaay 
Re: Topic Poll Module
October 30, 2010 08:02PM
Within the custom action hook code, there is only code that involves the posting editor. Therefore, the 'post' argument is assigned to the posting token building code. The posting code must be valid for the script to which the post is done.

{POST_VARS} is and can be built from many places in the code. It is a global generic variable that is not directly related to the topic poll module. The phorum_check_posting_token('read') call is the call that adds the posting token to this {POST_DATA} variable.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 30, 2010 08:24PM
Why is it originally set to 'post' then? As soon as I change that value to 'read', the voting actions generate a "possible hack attempt" message in read.php, but the vote does go through. When I go back to read.php and refresh it shows poll results.

<input type="hidden" name="posting_token:read" value="933da64ae4225f81a4b9565200c5fe59"/>
appears in read.php but not in list.php

function phorum_mod_topic_poll_read($messages) runs in read.php but not in list.php
I have the following in info.txt:
hook: read|phorum_mod_topic_poll_read
hook: list|phorum_mod_topic_poll_read

phorum_mod_topic_poll_read should run in both read.php and list.php right?

*I updated to the latest version of Phorum and everything works now. Must have been something wrong with the list hook? No idea.



Edited 7 time(s). Last edit at 10/30/2010 09:34PM by Meadock.
Re: Topic Poll Module
October 30, 2010 10:12PM
The correct posting check is on "post", not on "read". The reason for that, is that the read page does not do a CSRF check of its own, but the posting.php script is included from the read page, which triggers the CSRF check that is in the posting script (and which checks for "post").

What could have gone wrong with the hook, is that you added the hook without going to the admin.php interface afterwards. In that case, Phorum would not have updated its hook cache, resulting in the list hook not being called.

"everything works now" you say. Does that mean that all is working correctly for you now? If yes, then I can take a look at incorporating a list hook, that calls the read hook when the bodies in list page switch is enabled. That way, the module would be compatible with your kind of setup by default.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
November 02, 2010 10:06PM
Quote
Maurice Makaay
What could have gone wrong with the hook, is that you added the hook without going to the admin.php interface afterwards. In that case, Phorum would not have updated its hook cache, resulting in the list hook not being called.

That sounds like it could have been the problem. Updating to the newest version of Phorum must have inadvertently corrected that.

Quote
Maurice Makaay
"everything works now" you say. Does that mean that all is working correctly for you now? If yes, then I can take a look at incorporating a list hook, that calls the read hook when the bodies in list page switch is enabled. That way, the module would be compatible with your kind of setup by default.

As far as I can tell, topic poll is function correctly with the value 'post' in phorum_check_posting_token as opposed to 'read'. I'll let you know if I run into any problems. Your incorporation plans sound promising for me :) Thank you for all your help.
Re: Topic Poll Module
November 12, 2010 12:27AM
Just out of curiosity...Is there a simple way to automatically add polls to messages?
Re: Topic Poll Module
November 12, 2010 12:46AM
To me, "a simple way" would mean that there is a separate API (application programming interface) for handling the polls, where the main module code would use that API. In such setup, it would be possible to use the API from other scripts as well. This is not the case however, which automatically makes it not simple to create polls from code other than the module itself.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
November 12, 2010 03:46AM
Maybe I can figure something out.
Re: Topic Poll Module
December 16, 2010 04:02PM
Hi!

I´m trying to get the Topic Poll Module to work, but when I´we put it in the mods-folder, turned it on in the Admin Panel, saving, and then pressing settings, I get a lift of my forums, when i put the forum I get this message:

You are accessing the admin after a security timeout.

The requested URL was:
[*******.***]

Please make sure that you really want to access this URL and weren't tricked to go to the admin.
Please click on continue to go to this URL or on cancel to go to the forum homepage.

This is the same even if I´m trying other web-browsers as well, so I don´t think it´s a cookie/casche-problem.
And when I click "Continue" I just get my "Edit Forum"-page, and no settings what so ever regarding the Topic Poll...
Re: Topic Poll Module
December 16, 2010 04:54PM
If you have installed the module from this thread, then you are using the wrong one. This module is for Phorum 5.1. I presume that you are using the most recent stable 5.2 release? Please, try the 5.2 compatible version of the module


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
December 17, 2010 08:56AM
Thanks Maurice, I noticed it about 2 minutes after I posted the message here :)
Sorry, only registered users may post in this forum.

Click here to login