4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 12, 2018, 11:24:17 AM

Login with username, password and session length
Search:     Advanced search
Follow 4images on twitter: Click here to follow!
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Help / Hilfe
| |-+  Bug Fixes & Patches
| | |-+  [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 » »» Print
Author Topic: [1.7 / 1.7.1] "Modify eCard" / "eCard bearbeiten" button  (Read 53501 times)
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« 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:
1
$main_template = ($action == "createcard") ? "postcard_create" : (($action == "previewcard") ? "postcard_create" : "postcard_send");

Change to:
1
$main_template = ($action == "createcard" || $action == "modifycard") ? "postcard_create" : (($action == "previewcard") ? "postcard_create" : "postcard_send");


Locate:
1
if ($action == "createcard") {

Change to:
1
if ($action == "createcard" || $action == "modifycard") {


Locate:
1
2
3
4
5
6
7
8
9
10
11
12
  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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  $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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  $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:
1
                  <form method="post" action="{url_postcard}">

Change to:
1
                  <form method="post" action="{url_postcard}" name="createCard">


Locate:
1
                  </form>

Change to:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
                  </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:
1
<form action="{url_postcard}" method="post">

Change to:
1
<form action="{url_postcard}" method="post" name="previewCard">


Locate:
1
    <input type="button" value="{lang_edit_postcard}" onclick="history.go(-1)" class="button" />

Change to:
1
    <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 » Logged

glitzer
Full Member
***
Offline Offline

Posts: 204

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #1 on: March 19, 2005, 06:51:40 PM »

THANX THANX THANX

this was i m searching!!

Thanx a lot! Laughing Laughing Very Happy Very Happy
Logged

RoadDogg
Sr. Member
****
Offline Offline

Posts: 488

Thank You
-Given: 1
-Receive: 1


View Profile WWW
« Reply #2 on: March 25, 2005, 09:39:49 PM »

Sind die fixes in der zum Download angebotenen Version jeweils schon eingearbeitet?

Danke
Logged

For support requests please don´t forget link to your Gallery/to phpinfo.php
1
2
3
<?
phpinfo()
?>
safe_mode must turned OFF
Please check Error Messages
Hernán
Pre-Newbie

Offline Offline

Posts: 8

Thank You
-Given: 0
-Receive: 0


View Profile
« 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 Smile Very Happy

Gracias por tu ayuda
Saludos de Hernán
Logged
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« 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
Logged

Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« 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 Smile
No hablo español
Logged

V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 578

mmm PHP...


View Profile WWW
« Reply #6 on: June 06, 2005, 02:51:21 PM »

but u just did! Laughing Wink
Logged

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)
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« Reply #7 on: June 06, 2005, 02:56:02 PM »

That's all I remember from 3 years of high school spanish.   Razz
Logged

WhiteRabbit
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 0
-Receive: 0


View Profile
« 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 Smile Very Happy

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   [Expand]
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... Laughing

Best regards.
WR.
Logged
renicolay
Newbie
*
Offline Offline

Posts: 43

Thank You
-Given: 0
-Receive: 0


View Profile
« 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!

Logged
Eagle Eye
Full Member
***
Offline Offline

Posts: 191

Thank You
-Given: 2
-Receive: 0


View Profile
« Reply #10 on: January 21, 2006, 04:53:00 PM »

Hi Chris

Thank you very much for this fix!

Quote  [Expand]
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.....
Logged
germish
Full Member
***
Offline Offline

Posts: 102

Thank You
-Given: 0
-Receive: 0


View Profile
« 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.
Logged

Best Regards
Ralf, the Island Ape !
siavashmusic
Pre-Newbie

Offline Offline

Posts: 2

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #12 on: July 28, 2006, 08:49:12 PM »

Hi
Help me I Want To See Example ..Please
Logged

Free RapidShare premium Account with 5 Ref.=>
http://premiumforfree.com/index.php?referral=30331
orb4
Newbie
*
Offline Offline

Posts: 28

Thank You
-Given: 0
-Receive: 0


View Profile
« 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:

1
2
3
4
  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?  Confused
Logged
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« 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.
Logged

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 ?
Pages: [1] 2 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.084 seconds with 19 queries.
Post your comments here