News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Fix Session Verification for Polls

Started by Matthew K., February 07, 2010, 12:59:08 AM

Previous topic - Next topic

Matthew K.

Link to Mod

Fix Session Verification for Polls





Written by: Labradoodle-360
Current version: 1.0
Suitable for: SMF 1.1.11 ONLY

Link to Mod | Donate





Summary

Fix Session Verification for Polls fixes a bug in SMF v1.1.11, as the link to remove polls did not have session verification, this mod simply adds session verification to the link fixing the bug which will not let you delete a poll.

Note that after installing this mod you must log out for the effect to take place. (Before removing a poll)

Edit was originally written by mizuno151

Installation

Package Manager should work in most cases. If you need to make any edits, the full list can be obtained from the Parse function on the right..

Useful links
Manual Installation Of Mods
How Do I Modify Files?

Support

Questions should be address to the mod support topic.

Updating

Updates will be added here.

Changelog

1.0 - 22 January 2010
First release of Fix Session Verification for Polls

Files modified by Fix Session Verification for Polls
./Themes/default/Display.template.php

Rehash D Internet

The parse doesn't apply to the theme I'm using (Morestyle)

My code is as follows:

if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';

What do I change?

Thanks a lot.

Matthew K.

Lets take a deeper look into the mod.

./Themes/default/Display.template.php
Code (Find) Select


'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start']),

Code (Replace) Select


'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),


Note the change it makes.

Before:    After:
' . $context['start']    ' . $context['start'] . ';sesc=' . $context['session_id']

As a response to your question, I would appreciate it if you would further more use the code tags for actual code for easier review.
This code *should* work for you
Code (Find) Select
if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';

Code (Replace) Select

if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' , $context['session_id'], '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';


Edit: I fixed an issue in the code I posted back.

Hope this helps,
Labradoodle-360

Rehash D Internet

Ah yes, sorry about that, I always forget to use code tags.

Thanks massively for the speed of help.

Rehash D Internet

I'm afraid that hasn't worked. I've tried copying your amends in twice and it brings this up:

http://www.surgicalaplomb.com/index.php?topic=3953.msg457735#new

Any further ideas?

Thanks

Matthew K.

Please screenshot it's effect/or lack of effect as I am not an Administrator.

Labradoodle-360

Rehash D Internet

There should be a template parse error appearing here:

http://www.surgicalaplomb.com/index.php?topic=3953.msg457735#new

The area highlighted is:

658:       $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=


Matthew K.

That's the issue, I apologize.

I appreciate the screenshot.

Here is the edit to correct the error and hopefully resolve your issue.
Code (Find) Select

if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' , $context['session_id'], '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';

Code (Replace) Select

if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']. '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';


Labradoodle-360

Rehash D Internet


Matthew K.

Not a problem, glad you got it :)

Labradoodle-360

ModelBoatMayhem

#11

NB. Mod only works if using Forum default Theme!!!

Fix..... Login to Admin / Themes and Layout

Overall forum default:  SMF Default Theme
Reset everyone to:        Forum defalt

                                                SAVE

-  go to topic - remove POLL - reset your forum themes -  Job Done!
   :)
That's my firm opinion.... but what do I know?!

scotty

Worked perfectly on my default theme, thanks

Now all I need is an auto page refresh so members don't have to keep hitting F5 all the time. I wonder why SMF does not automatically refresh after every post be default? Seems obvious to me . .

Oh, well

Thanks again - wonderful! Polls all gone!

Matthew K.

Well, this is Fix Session Verification for Polls mod support topic, not for other SMF related questions. That's what the main support boards are for.

However, take a peak at this mod: http://custom.simplemachines.org/mods/index.php?mod=1492
That should work for you.

Thanks for using my mod =)

Sincere

I have tried this mod at least 5 times. It is very consistent. Each time it gives:
An Error Has Occurred!
The package you tried to upload either is not a valid package or has become corrupted.
Do you need a special mod for your smf forums? contact me for a quote.

MS Modders Team

What version of SMF are you running please?
Please do not send us PMs. If you have a question, ask in our forum.
http://smfmodders.com/index.php

Sincere

Do you need a special mod for your smf forums? contact me for a quote.

MS Modders Team

Please attach your Display.template.php
Please do not send us PMs. If you have a question, ask in our forum.
http://smfmodders.com/index.php

Sincere

Quote from: S-M-F Modders Team on September 23, 2010, 10:02:45 PM
Please attach your Display.template.php

sorry but there is no point now, as I have modified that file manually as recommended here
http://www.simplemachines.org/community/index.php?topic=356688.msg2795074#msg2795074

that indeed solved my issue immediately.
Do you need a special mod for your smf forums? contact me for a quote.

Biology Forums

I'm having this problem in 1.1.13 :S I can't even parse it because the code isn't even there.

Advertisement: