admin on oktober 16th, 2009

 

PhotoContest Plugin

This plugin automatically turns a WordPress-page into a photo contest.


Contributors: Frank van der Stad

Donate link: http://www.vanderstad.nl/wp-photocontest/donate

Tags: photocontest, images, photos, photo contest, contest, thumbnail, pictures, post, automatic, voting, vote

Requires at least: 2.7

Tested up to: 2.8.4

Stable tag: 1.3.6

Demo: http://www.vanderstad.nl/wordpress/?page_id=78

 


Description

Important

  • WHEN USING AUTO-UPGRADE, BE SURE TO BACKUP THE CONTEST_HOLDER DIRECTORY.
  • As reported by Rene Schmidt, version 1.0 and 1.01 show a couple of SQL Injection and XSS leaks. It’s recommended to upgrade to version 1.2 as soon as possible.

Description

This plugin permits you to create a ‘voting for photos-contest’ from the WordPress admin panel
Subscribed users can uploads photos and everyone else can vote for the uploaded photos.

When creating a contest, you can set the voting period, the period uploaders can upload photos
and you can set the maximum number of photos per user.

This plugin will create a Wordpress page with all the necessary links to handle the uploading,
voting and subscribing to your blog.

Features

  • Simple form to create, edit and delete a contest in the Wordpress Admin panel
  • Active/Deactivate photos in the Wordpress Admin panel
  • View vote-details for each photo in the Wordpress Admin panel
  • Sidemenu ‘PhotoContest’ in the Wordpress Admin panel
  • Autocreate small, medium, large and user defined thumbnails on the upload
  • Check for a human voter (with captcha). The voter is identified with cookie.
  • Sends mail to admin when a upload occurs in the contest
  • Uploading is permitted to subscribed users only
  • Last uploaded, most viewed and most voted pages
  • Themeable with an template file (See Customization)

Customization

The plugin provides a config entry in wp-photocontest-config.php file to skins the pages
created by WP-PhotoContest. This entry points to a directory underneath the ’skins’ directory.
This directory must contain the following files:

  • template.tpl : This file is used as template for the pages created by WP-PhotoContest (*)
  • theme.css : This stylesheet is used for styling the pages created by WP-PhotoContest

To create a new skin, you can copy the aqua directory in the directory ’skins’ into and other
directory and edit as aproperiate. Then change the ‘CONTESTS_SKIN’ contant in
wp-photocontest-config.php file.

(*) Important: When using a theme, you need to copy page.php or index.php to template.tpl
and replace “The_Loop” with [WP-PHOTOCONTEST CONTENT]. See for more information:
‘http://codex.wordpress.org/The_Loop’


Installation

  1. Unzip the downloaded file, you should end up with a folder called “wp-photocontest”.
  2. Upload the “wp-photocontest” folder to your “plugin” directory (wp-content/plugins).
  3. Make sure that the file permissions of the “wp-photocontest” directory are such that
    the plugin is allowed to write to it (otherwise, the uploaded photos cannot be stored).
    (Double check the file permissions for the “contestsholder”. When you run php
    in safe
    mode, you need to set it to the same UID (owner) as the script is being executed)
  4. If your web hosting provider enabled the mod_security Apache module on your web server,
    you need to add the following directives to your .htaccess file in order for batch uploads
    to work:

            <IfModule mod_security.c>
                SecFilterEngine Off
                SecFilterScanPOST Off
            </IfModule>
    
  5. Go to the “Plugins” Wordpress admin panel and activate the PhotoContest plugin.

=Optional=
* When you would like people to upload, you need to let visitors subscribe to your blog)
* When you use a theme, you need to create a template file. Read ‘Customization’)


Frequently Asked Questions

Will the plugin delete the page/post when I delete a photocontest?

No, it won’t delete the page/post. To delete the page/post you need to follow the
directions to delete a page/post.

Can I change the directory where the contest-files are saved?

Yes, the target directory can only be a subdirectory in the “wp-photocontest” directory.

How can I change the directory where the contest-files are saved?

Create the directory, make it writeable and change the ‘CONTESTS_PATH’ contant in
wp-photocontest-config.php file.

Can I change the look and feel of the contest?

Copy the aqua directory in the directory ’skins’ and edit as aproperiate. Then change
the ‘CONTESTS_SKIN’ contant in wp-photocontest-config.php file. Read ‘Customization’!

How to permit users to subscribe in order to upload the photo in the contest?

Go in the admin panel, in the Settings section you can able visitors to subscribe to your blog.
When you done, it will be visible the link “subscribe” in the requested login page.

I am having a problem with mkdir. Everytime I try to create a contest I get an error.

Check if you have safe_mode enabled, because when safe mode is enabled, PHP checks
whether the directory in which the script is operating has the same UID (owner) as the
script that is being executed. Note: Since version 1.2 we do some extra checks and return
more detailed errors.

Is there any way to change the layout/text in the view of the contest?

Yes, you can. Open images/polaroid.fla and edit as wanted. Upload polaroid.swf to you skins
directory. (So, don’t upload it the the images directory)

Where can I get other answers to my questions regarding wp-PhotoContest?

Send a mail to antispam@vanderstad.nl


Screenshots

WordPress Admin panel:

  • Listing the contests
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/backendcontestlist.jpg
  • Adding a contest
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/backendcontestadd.jpg
  • View contest details
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/backendcontestdetails.jpg
  • Viewing contest voters
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/backendcontestvoters.jpg

Blog:

  • Introduction
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/frontend_introduction.jpg
  • Photodetails and voting
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/frontend_photodetails.jpg
  • Photo uploading
    http://www.vanderstad.nl/wordpress/wp-content/uploads/2009/10/frontend_uploading.jpg

Changelog

1.2.1- 27.10.2009

  • Auto upgrade fix, and uninstall checks. While upgrading the plugin tries to keep the contest_folder.
  • In 1.2 the database changed, but when using auto-upgrade, this change didn’t got executed.
    If you still have problems, run the follwing sql command:
    ALTER TABLE wp_photocontest_votes CHANGE voter_id voter_id VARCHAR( 36 ) NOT NULL

1.2 – 26.10.2009

  • Applied security checks to solve the SQL injection leaks and at least one XSS leak [Thanks to Rene Schmidt for reporting]
  • Uses a template file for the generation of the pages created by WP-PhotoContest.
  • Fixed captcha-bug introduced in version 1.1

1.1 – 19.10.2009

  • Applied security checks to solve the SQL injection leaks and at least one XSS leak [Thanks to Rene Schmidt for reporting]
  • Removed all functionality from login.php. Now uses the wp-login.php file for handling login/logut requests
  • Fixed a problem with users uploading photo’s and had unsufficient rights to update the post.
    (Subscribers can’t post -tags, which is used by the plugin)
  • Added a function that notifies (by sending a mail to the ‘admin_email’) if there is a new upload.
    (As alternative for the automatich post updating)

1.0.1 – 17.10.2009

  • Fixed a ‘Fatal error’ if PHP was compiled without mbstring

1.0 – 15.10.2009

  • initial release

Todos

  • Documentation in the sources
  • Explain how to use the skins
  • Create more example skins
  • photocontest-add.php: 188 Add rollback of directory and page if db insert fails

Credits

Copyright 2009 by Frank van der Stad

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Thanks go to Paolo Palmonari – http://wordpress.org/extend/plugins/photoracer/ – because this
plugin was greatly inspired by the PhotoRacer plugin.