4images Forum & Community
4images Help / Hilfe => Bug Fixes & Patches => Topic started by: Chris 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:
$main_template = ($action == "createcard") ? "postcard_create" : (($action == "previewcard") ? "postcard_create" : "postcard_send");
Change to:
$main_template = ($action == "createcard" || $action == "modifycard") ? "postcard_create" : (($action == "previewcard") ? "postcard_create" : "postcard_send");
Locate:
if ($action == "createcard") {
Change to:
if ($action == "createcard" || $action == "modifycard") {
Locate:
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:
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:
$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:
$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:
<form method="post" action="{url_postcard}">
Change to:
<form method="post" action="{url_postcard}" name="createCard">
Locate:
</form>
Change to:
</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:
<form action="{url_postcard}" method="post">
Change to:
<form action="{url_postcard}" method="post" name="previewCard">
Locate:
<input type="button" value="{lang_edit_postcard}" onclick="history.go(-1)" class="button" />
Change to:
<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
-
THANX THANX THANX
this was i m searching!!
Thanx a lot! :lol: :lol: :D :D
-
Sind die fixes in der zum Download angebotenen Version jeweils schon eingearbeitet?
Danke
-
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
-
Sind die fixes in der zum Download angebotenen Version jeweils schon eingearbeitet?
Nein, und Ich spreche nicht Deutsches
-
Gracias a quien haya puesto a disposición este MOD, me ayudó a resolver este problema :)
No hablo español
-
No hablo espaсol
but u just did! :lol: ;)
-
That's all I remember from 3 years of high school spanish. :P
-
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...
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.
-
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!
-
Hi Chris
Thank you very much for this fix!
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.....
-
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.
-
Hi
Help me I Want To See Example ..Please
-
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:
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? :?
-
Your includes/functions.php file is alter or check_email function uncomment. Chek for function in file.
-
ok, solved.
The following code in red was missing in "functions.php".
(To compare 2 files,the original and the modified one, I use WINMERGE software which is very usefull to immediatly see differences).
function check_email($email) {
return (preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $email)) ? 1 : 0;
}.
Ouch, now when I click to send the postcard, it tells me to enter the captcha code, okk I 'll try to install this.. (hey this is the neverending story)