Author Topic: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button  (Read 66669 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« on: March 16, 2005, 04:17:32 AM »
From the postcard_preview.html template, 4images versions 1.7 and 1.7.1 both tie the {lang_edit_postcard}, "Modify eCard" / "eCard bearbeiten", form button to the browser history back function. This sends the visitor back to the postcard_create.html templated page. But whether the values previously entered into the form fields appear or the form is reset to its defaults depends on the browser being used. Under Internet Explorer 6, the browser doesn't even navigate back!

The code posted here fixes the "Modify eCard" / "eCard bearbeiten" button so that the user is always sent back to the postcard_create.html templated page and the values they entered previously are reused when the page loads.

Open postcards.php

Locate:
Code: [Select]
$main_template = ($action == "createcard") ? "postcard_create" : (($action == "previewcard") ? "postcard_create" : "postcard_send");
Change to:
Code: [Select]
$main_template = ($action == "createcard" || $action == "modifycard") ? "postcard_create" : (($action == "previewcard") ? "postcard_create" : "postcard_send");

Locate:
Code: [Select]
if ($action == "createcard") {
Change to:
Code: [Select]
if ($action == "createcard" || $action == "modifycard") {

Locate:
Code: [Select]
  if (!$sendprocess) {
    $bg_color = "";
    $border_color = "";
    $font_color = "";
    $font_face = "";
    $sender_name = ($user_info['user_level'] != GUEST) ? $user_info['user_name'] : "";
    $sender_email = ($user_info['user_level'] != GUEST) ? $user_info['user_email'] : "";
    $recipient_name = "";
    $recipient_email = "";
    $headline = "";
    $message = "";
  }

Add immediately after on a new line:
Code: [Select]
  if ($action == "modifycard") {
    $bg_color = un_htmlspecialchars(trim($HTTP_POST_VARS['bg_color']));
    $border_color = un_htmlspecialchars(trim($HTTP_POST_VARS['border_color']));
    $font_color = un_htmlspecialchars(trim($HTTP_POST_VARS['font_color']));
    $font_face = un_htmlspecialchars(trim($HTTP_POST_VARS['font_face']));

    $sender_name = un_htmlspecialchars(trim($HTTP_POST_VARS['sender_name']));
    $sender_email = un_htmlspecialchars(trim($HTTP_POST_VARS['sender_email']));
    $recipient_name = un_htmlspecialchars(trim($HTTP_POST_VARS['recipient_name']));
    $recipient_email = un_htmlspecialchars(trim($HTTP_POST_VARS['recipient_email']));

    $headline = un_htmlspecialchars(trim($HTTP_POST_VARS['headline']));
    $message = un_htmlspecialchars(trim($HTTP_POST_VARS['message']));
  }


Three lines down locate:
Code: [Select]
  $site_template->register_vars(array(
    "image" => $image,
    "thumbnail" => $thumbnail,
    "image_name" => $image_row['image_name'],
    "lang_bg_color" => $lang['bg_color'],
    "lang_border_color" => $lang['border_color'],
    "lang_font_color" => $lang['font_color'],
    "lang_font_face" => $lang['font_face'],
    "lang_sender" => $lang['sender'],
    "lang_recipient" => $lang['recipient'],
    "lang_email" => $lang['email'],
    "lang_name" => $lang['name'],
    "lang_headline" => $lang['headline'],
    "lang_message" => $lang['message'],
    "lang_preview_postcard" => $lang['preview_postcard'],
    "url_postcard" => $site_sess->url(ROOT_PATH."postcards.php?".URL_IMAGE_ID."=".$image_id),
    "sender_name" => stripslashes($sender_name),
    "sender_email" => stripslashes($sender_email),
    "recipient_name" => stripslashes($recipient_name),
    "recipient_email" => stripslashes($recipient_email),
    "headline" => stripslashes($headline),
    "message" => stripslashes($message),
    "lang_send_postcard" => $lang['send_postcard'],
    "back_url" => stripslashes($url)
  ));

Change to:
Code: [Select]
  $site_template->register_vars(array(
    "image" => $image,
    "thumbnail" => $thumbnail,
    "image_name" => $image_row['image_name'],
    "lang_bg_color" => $lang['bg_color'],
    "bg_color" => $bg_color,
    "lang_border_color" => $lang['border_color'],
    "border_color" => $border_color,
    "lang_font_color" => $lang['font_color'],
    "font_color" => $font_color,
    "lang_font_face" => $lang['font_face'],
    "font_face" => $font_face,
    "lang_sender" => $lang['sender'],
    "lang_recipient" => $lang['recipient'],
    "lang_email" => $lang['email'],
    "lang_name" => $lang['name'],
    "lang_headline" => $lang['headline'],
    "lang_message" => $lang['message'],
    "lang_preview_postcard" => $lang['preview_postcard'],
    "url_postcard" => $site_sess->url(ROOT_PATH."postcards.php?".URL_IMAGE_ID."=".$image_id),
    "sender_name" => stripslashes($sender_name),
    "sender_email" => stripslashes($sender_email),
    "recipient_name" => stripslashes($recipient_name),
    "recipient_email" => stripslashes($recipient_email),
    "headline" => stripslashes($headline),
    "message" => stripslashes($message),
    "lang_send_postcard" => $lang['send_postcard'],
    "back_url" => stripslashes($url)
  ));


Open postcard_create.html

Locate:
Code: [Select]
                  <form method="post" action="{url_postcard}">
Change to:
Code: [Select]
                  <form method="post" action="{url_postcard}" name="createCard">

Locate:
Code: [Select]
                  </form>
Change to:
Code: [Select]
                  </form>
<script language="javascript" type="text/javascript">
var bg_color = "{bg_color}";
var border_color = "{border_color}";
var font_color = "{font_color}";
var font_face = "{font_face}";
   
function RestoreUserValues()
{
  var x = document.forms.createCard;
  for (i=0;i<x.bg_color.length;i++) {
    if (x.bg_color[i].value == bg_color) {
      x.bg_color[i].checked = true;
      break;
    }
  }
  for (i=0;i<x.border_color.length;i++) {
    if (x.border_color[i].value == border_color) {
      x.border_color[i].checked = true;
      break;
    }
  }
  for (i=0;i<x.font_color.length;i++) {
    if (x.font_color[i].value == font_color) {
      x.font_color[i].checked = true;
      break;
    }
  }
  for (i=0;i<x.font_face.length;i++) {
    if (x.font_face[i].value == font_face) {
      x.font_face[i].checked = true;
      break;
    }
  }
}
if( bg_color != "" )
  RestoreUserValues();
</script>


Open postcard_preview.html

Locate:
Code: [Select]
<form action="{url_postcard}" method="post">
Change to:
Code: [Select]
<form action="{url_postcard}" method="post" name="previewCard">

Locate:
Code: [Select]
    <input type="button" value="{lang_edit_postcard}" onclick="history.go(-1)" class="button" />
Change to:
Code: [Select]
    <input type="button" value="{lang_edit_postcard}" onclick="document.forms.previewCard.elements['action'].value = 'modifycard';document.forms.previewCard.submit();" class="button" />

NOTES:
This FIX is compatible with the [Mod] Keep text formatting of eCard message
« Last Edit: July 16, 2005, 08:08:59 PM by V@no »

Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #1 on: March 19, 2005, 06:51:40 PM »
THANX THANX THANX

this was i m searching!!

Thanx a lot! :lol: :lol: :D :D

Offline RoadDogg

  • Sr. Member
  • ****
  • Posts: 488
    • View Profile
    • Düsipixel
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #2 on: March 25, 2005, 09:39:49 PM »
Sind die fixes in der zum Download angebotenen Version jeweils schon eingearbeitet?

Danke
For support requests please don´t forget link to your Gallery/to phpinfo.php
Code: [Select]
<?
phpinfo()
?>
safe_mode must turned OFF
Please check Error Messages

Offline Hernán

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #3 on: June 06, 2005, 12:20:16 AM »
Gracias a quien haya puesto a disposición este MOD, me ayudó a resolver este problema :) :D

Gracias por tu ayuda
Saludos de Hernán

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #4 on: June 06, 2005, 02:47:26 PM »
Sind die fixes in der zum Download angebotenen Version jeweils schon eingearbeitet?
Nein, und Ich spreche nicht Deutsches

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #5 on: June 06, 2005, 02:47:47 PM »
Gracias a quien haya puesto a disposición este MOD, me ayudó a resolver este problema :)
No hablo español

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #6 on: June 06, 2005, 02:51:21 PM »
No hablo espaсol
but u just did! :lol: ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #7 on: June 06, 2005, 02:56:02 PM »
That's all I remember from 3 years of high school spanish.   :P

Offline WhiteRabbit

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: 1.7, 1.7.1: "Modify eCard" / "eCard bearbeiten" button
« Reply #8 on: July 30, 2005, 02:28:11 PM »
Gracias a quien haya puesto a disposición este MOD, me ayudó a resolver este problema :) :D

Gracias por tu ayuda
Saludos de Hernán

He did just say:

"Thanks to who has released this mod, It did help me to solve this problem.
thanks for your help.
Greetings from Hernán".

I think that he has a little confusion... it's a bugfix, not a mod...

Quote from: Chris
That's all I remember from 3 years of high school spanish.


hehehe spanish is my first language, and my english is of 5 years of secondary school... :lol:

Best regards.
WR.

Offline renicolay

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« Reply #9 on: November 13, 2005, 05:51:02 PM »
Hi Chris,
Thanks for the great fix! I've added another choice to the postcard_create.html and it allows the user to choose one of three postcard templates to send.  However that is the only field that is not sticky.  How can I make this field stay when the user clicks modify ecard?

The radio button has three choices and is named "template_card"

Thanks!


Offline Eagle Eye

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« Reply #10 on: January 21, 2006, 04:53:00 PM »
Hi Chris

Thank you very much for this fix!

Quote
Hi Chris,
Thanks for the great fix! I've added another choice to the postcard_create.html and it allows the user to choose one of three postcard templates to send.  However that is the only field that is not sticky.  How can I make this field stay when the user clicks modify ecard?

The radio button has three choices and is named "template_card"

Thanks!


if you don't mind, can you share this MOD, looks intresting.....

Offline germish

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« Reply #11 on: July 13, 2006, 03:32:14 PM »
Hi,
I have version 1.72 and the mod is part of it.
Unfortunaley it's not so easy to sort out and get it working because I had to alter 1.72 to get my sound modifation of 1.70 working.
Since the sent card has a button to turn of sond when the receiver gets the card I have various form actions already.
And in my HTML files the form already has a name to make the javascript toggle the sound with the button.
Not sure How to give the same form two different names to also get this datamemorising working.
Best Regards
Ralf, the Island Ape !

Offline siavashmusic

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« Reply #12 on: July 28, 2006, 08:49:12 PM »
Hi
Help me I Want To See Example ..Please
Free RapidShare premium Account with 5 Ref.=>
http://premiumforfree.com/index.php?referral=30331

Offline orb4

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« Reply #13 on: September 09, 2007, 10:49:05 PM »
Hi,
I got an error message when  I want to access "postcard_preview.php" after filling the e-card:

Fatal error: Call to undefined function: check_email() in /x/x/x/x/x/x/postcards.php on line 199

Here is line 199 to 202:

Code: [Select]
  if (($sender_email != "" && !check_email($sender_email)) || ($recipient_email != "" && !check_email($recipient_email))) {
    $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format'];
    $error = 1;
  }

Anyone has an idea please?  :?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
« Reply #14 on: September 09, 2007, 11:01:01 PM »
Your includes/functions.php file is alter or check_email function uncomment. Chek for function in file.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?