Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Contact us mail form plugin with image verification for Coppermine Photo Gallery  (Read 63071 times)

0 Members and 1 Guest are viewing this topic.

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

Contact us mail form plugin with image verification by wirewolf, v1.1 - for Coppermine Photo Gallery, 1.4.x

Original mod by myself, wirewolf, http://forum.coppermine-gallery.net/index.php?topic=37846.0

For this plugin, original files for the codebase, configuration and the init.inc are from the devs, donnoman, gaugau, with modifications by BMossavari, Frantz (inspired from GYZMO's Add On) and adaptation by myself for this plugin. This is my first plugin for Coopermine and I learned a lot by studying the scripts from other plugins.

Original contact_us.php and english.php files by myself, randomimage.php file by unknown author. If anyone would like to provide translations for other languages, please do so.

This plugin will add a contact us mail form with image verification and a 'Contact Us' link on the top menu bar for Coppermine Photo Gallery, 1.4.x  Tested with classic theme, not tested with others, but it should work.

The contact form will display error messages when a users fails to enter the required information. All fields are required, Name, Email Address, Subject, Comments, and the image verification code. It also allows for the user to 'Reset' the image if they have difficulty reading the code. The error messages are displayed right on the contact form page. Even if they have only entered partial information, the error messages will toggle on or off accordingly upon hitting the 'Submit' button. It not only checks for a required email address from the user, but it also checks that the email address they enter is correctly formatted.

A new image code is generated any time they hit the 'Submit' button without all of the required information entered, or if they hit the 'Reset Image' button. However, they will not lose any of the information they have entered up to that point. unless they hit the 'Reset Form' button (reloads the entire form) or, of course, leave the page.

They can't send a message until the form is successfully submitted, when they are then directed automatically to a 'Thank You Page'. The email is then sent via the email address you have entered in the Admin Control Panel. The email you receive not only has the users input, but contains a link to check out their ip address (with ARIN Whois) and lists their server agent.

See working plugin at http://academyphotos.net/photogallery/index.php?file=contact_us/contact_us

Added the cpg_mail() function, so it should work with both mail() and SMTP (thanks to Nibbler for some guidance on the correct coding)

You can download the zip file at the end of this post. It contains all of the plugin files plus a README.txt file with full instructions. For those unfamilar with installing a plugin, see http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin_manager

step 1:
Download and unzip the archive - contact_us.zip
Upload the "contact_us" directory structure as is to your Coppermine gallery's plugins folder.

end upload plugin

step 2:
Login to your admin panel, go to config, then "Manage Plugins"
Find the Contact Us entry in the available plugins and click install.
A new menu button is now added for opening contact us mail form.
If you want, you can also add a link to the form in your custom footer, IE:
<a href="index.php?file=contact_us/contact_us">Contact Us</a>

Enjoy! wirewolf, John

If the devs like, please move move post accordingly, Thanks

Add On: Uploaded new zip file with corrections for cpg_mail function as suggested by Nibbler
« Last Edit: November 03, 2006, 11:23:48 am by wirewolf »
Logged

Nibbler

  • Guest

You might like to consider using cpg_mail() instead of mail(). That way it will work for people who use SMTP to send emails too. Also, if you name the plugin's directory as contact_us then it will play much better with the plugin manager.

Thanks for your contribution.
Logged

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

Hi Nibbler, thanks

The folder is named contact_us. (I didn't want it to conflict with other mods or plugins named contact).

I just tried the script with the cpg_mail() and got this:
Fatal error: Call to undefined function: cpg_mail() in photogallery/plugins/contact_us/contact_us.php on line 93

For now I'll go back to the mail() until I can figure it out. The contact_us.php file calls for the include/init.inc.php file, so the cpg_mail() function should have been defined. Any clues?

wirewolf

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

I just looked up the function
Code: [Select]
cpg_mail($to, $subject, $msg_body = '', $type = 'text/plain', $sender_name = '', $sender_email = '', $msg_body_plaintext = '') in the mailer.inc.php file

this is my line of code in my contact_us.php script:
Code: [Select]
mail($CONFIG['gallery_admin_email'], $sender_subject, $messageproper, "From: \"$sender_name\" <$sender_email>" . $headersep . "Reply-To: \"$sender_name\" <$sender_email>");
Would I have to match the coding variables to my script in order for cpg_mail() to work?

wirewolf

Nibbler

  • Guest

You need to

Code: [Select]
include 'include/mailer.inc.php';
 to be able to use cpg_mail(). You also need to give it the right arguments, yes.

Code: [Select]
cpg_mail('admin', $sender_subject, $messageproper, 'text/plain', $sender_name, $sender_email);
The folder is named 'contact_us_plugin_v1.1' in the package I downloaded.
Logged

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

Thanks Nibbler.

I was starting to look at some of the coding from existing scripts when I got the email notice about your reply. Applied the changes you suggested and it works like a charm now, Thank you.

added - include 'include/mailer.inc.php'; - to the script and changed the one line to:
cpg_mail('admin', $sender_subject, $messageproper, 'text/plain', $sender_name, $sender_email);
 

I replaced the zip file with the corrections in the top post.

Again, Thanks for the assist,
wirewolf

m@rk

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 39
Modification, German Translation
« Reply #6 on: December 27, 2006, 07:04:25 pm »

Great Plugin!

Here's my German translation.
I left the "Check your spelling" fields blank.

Modification:

With attached modified contact_us.php, the anti spam protection appears only for not-logged-in-guests.
Also, members have their name and email fix in the form.
By default, the gallery name is set as subject.
« Last Edit: December 28, 2006, 06:26:35 am by m@rk »
Logged

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

Thank you m@rk, for the translation and the guests/members coding addition.

I didn't even occur to me of adding that. My site has no registered users (except for me!). It's for display of photos I'm taking only. Great add-on

I also have a mod for capcha for e-cards - http://forum.coppermine-gallery.net/index.php?topic=37635.0 . Your additional code would be great for that too.

Have to look in to it.

Again, thanks
wirewolf

JvM

  • Coppermine newbie
  • Offline Offline
  • Posts: 4

My dutch translation ;)
Logged

kushti

  • Coppermine newbie
  • Offline Offline
  • Posts: 7

I got a problem with all the contact plug-ins I have installed because the image verification does not work - this did work at first but has now stopped! Does anyone have an idea why this has happened how how to fix it?
Logged

LukaszP

  • Coppermine newbie
  • Offline Offline
  • Posts: 1

Polish lang
polskie tłumaczenie
Logged

panatan

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92

Hi all !

Instead "Captcha (Visual Confirmation) for adding comments" like shown in this post "http://forum.coppermine-gallery.net/index.php?topic=36319.msg233202#msg233202" i've installed "Contact Us Mail Form v1.1" (wirewolf)

But i never receive any message when i'm testing...

I've changed "cpg_mail" in "mail" but it doesn't works...

Could you help me ?
Logged

sard

  • Coppermine newbie
  • Offline Offline
  • Posts: 14

This is macedonian translation of this plugin.

Logged

Luksi1

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • Tomatine

Great plugin!

You can find Slovenian translation here.

Chears,

Luka
Logged

durangod

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42

Most excellent Mod, works perfectly on the fruity theme... only thing i changed was i added a back button, other than that PERFECT!!  NICE JOB...
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 20 queries.