When sending a E-Card Using ver 1.1.D and Nuke 6.9 the photo and stamp never appears in the e-mail but the smiley icon does. Looking at the code below something always places - modules/coppermine/ - in the code before the url. Take it out manually and it works. The smiley code does not have it. Can someone tell me where this is coming from? Not that familiar with PHP and this is driving me crazy.
img src="modules/coppermine/http://www.domainname.com/modules/coppermine/albums/userpics/10002/normal_P8120875.JPG"
img src="modules/coppermine/http://www.domainname.com/images/stamp.gif"
img src="http://www.domainname.com/modules/coppermine/images/smiles/icon_redface.gif"
This code is in ecard.php
line ~=82-3
$gallery_dir = strtr(dirname($PHP_SELF),'\\','/');
$gallery_url_prefix = 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'] . $gallery_dir . (substr($gallery_dir, -1) == '/' ? '' : '/');
line ~= 110
'{VIEW_ECARD_TGT}' => "{$gallery_url_prefix}modules.php?name=coppermine&file=displayecard&data=$encoded_data",
Try change the code in the second example to:
line ~= 110
'{VIEW_ECARD_TGT}' => "{$CONFIG['ecards_more_pic_target']}/modules.php?name=coppermine&file=displayecard&data=$encoded_data",
Let me know if this works![/code]
No, and it still placing the modules/coppermine/ in front of the url.
If you care to test it go to:
http://www.nasgcounty.com/modules.php?name=coppermine
Thanks
Switch to the default theme and try sending an ecard. The theme.php file generates the actual email code. If the default theme sends ecards correctly, your current theme is the problem. In your theme.php file, look for $template_ecard and compare it to the default theme's $template_ecard code.
Thanks kegobeer -put me on the right track
in nuke/theme.php it uses URL_PREFIX from ecard.php
<img src="{URL_PREFIX}/modules/coppermine/images/stamp.gif"
so try changing in ecard.php
$gallery_url_prefix = 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'] .
to
$gallery_url_prefix = "$CONFIG['ecards_more_pic_target']";
and change the code that you changed before on line 110 back
make sure your config value for ecards_more_pic_target is the directory where you have coppermine in your case that would be http://www.nasgcounty.com no trailing slash
I think the problem is just bad code in his original theme; atlantic2 switched to the default theme and my test ecard displayed correctly. There must be something like /modules/coppermine{url_prefix} in the theme.
This works in the nuke theme and should work in the others
replace content of ecard.php (BACKUP FIRST)[edited=gtroll]
USE THE Trailing slash in the config
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery v1.1 Beta 2 //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002,2003 Grégory DEMAR <gdemar@wanadoo.fr> //
// http://www.chezgreg.net/coppermine/ //
// ------------------------------------------------------------------------- //
// Based on PHPhotoalbum by Henning Støverud <henning@stoverud.com> //
// http://www.stoverud.com/PHPhotoalbum/ //
// ------------------------------------------------------------------------- //
// 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. //
// ------------------------------------------------------------------------- //
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$pagetitle = "- Coppermine";
define('IN_COPPERMINE', true);
define('ECARDS_PHP', true);
if (!USER_CAN_SEND_ECARDS) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
switch($func) {
default:
include("header.php");
require('modules/coppermine/include/init.inc.php');
require("modules/coppermine/include/smilies.inc.php");
require("modules/coppermine/include/mailer.inc.php");
function get_post_var($name, $default='')
{
global $HTTP_POST_VARS;
return isset($HTTP_POST_VARS[$name]) ? $HTTP_POST_VARS[$name] : $default;
}
$pid = (int)$HTTP_GET_VARS['pid'];
$album = $HTTP_GET_VARS['album'];
$pos = (int)$HTTP_GET_VARS['pos'];
$sender_name = get_post_var('sender_name', USER_ID ? username : (isset($USER['name']) ? $USER['name'] : ''));
$sender_email = get_post_var('sender_email', USER_ID ? $USER_DATA['user_email'] : (isset($USER['email']) ? $USER['email'] : ''));
$recipient_name = get_post_var('recipient_name');
$recipient_email = get_post_var('recipient_email');
$greetings = get_post_var('greetings');
$message = get_post_var('message');
$sender_email_warning = '';
$recipient_email_warning = '';
// Build the private album set
if (!GALLERY_ADMIN_MODE && $CONFIG['allow_private_albums']) get_private_album_set();
// Get picture thumbnail url
$result = mysql_query("SELECT * from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET");
if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap']);
$row = mysql_fetch_array($result);
$thumb_pic_url = get_pic_url($row, 'thumb');
// Check supplied email address
$valid_email_pattern = "^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$";
$valid_sender_email = eregi($valid_email_pattern, $sender_email);
$valid_recipient_email = eregi($valid_email_pattern,$recipient_email);
$invalid_email = '<font size="1">'.$lang_ecard_php['invalid_email'].'</font>';
if (!$valid_sender_email && count($HTTP_POST_VARS) > 0) $sender_email_warning = $invalid_email;
if (!$valid_recipient_email && count($HTTP_POST_VARS) > 0) $recipient_email_warning = $invalid_email;
// Create and send the e-card
if (count($HTTP_POST_VARS) > 0 && $valid_sender_email && $valid_recipient_email){
$gallery_dir = strtr(dirname($PHP_SELF),'\\','/');
$gallery_url_prefix = $CONFIG['ecards_more_pic_target'];
if ($CONFIG['make_intermediate'] && max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width']) {
$n_picname = get_pic_url($row, 'normal');
} else {
$n_picname = get_pic_url($row, 'fullsize');
}
if(!stristr($n_picname, 'http:')) $n_picname = $CONFIG['ecards_more_pic_target']."$n_picname";
$msg_content = nl2br(process_smilies($message, $gallery_url_prefix));
$data = array(
'rn' => $HTTP_POST_VARS['recipient_name'],
'sn' => $HTTP_POST_VARS['sender_name'],
'se' => $HTTP_POST_VARS['sender_email'],
'p' => $n_picname,
'g' => $greetings,
'm' => $message,
);
$encoded_data = urlencode(base64_encode(serialize($data)));
$params = array(
'{LANG_DIR}' => $lang_text_dir,
'{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $sender_name),
'{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
'{VIEW_ECARD_TGT}' => $CONFIG['ecards_more_pic_target']."modules.php?name=coppermine&file=displayecard&data=$encoded_data",
'{VIEW_ECARD_LNK}' => $lang_ecard_php['view_ecard'],
'{PIC_URL}' => $n_picname,
'{URL_PREFIX}' => $gallery_url_prefix,
'{GREETINGS}' => $greetings,
'{MESSAGE}' => $msg_content,
'{SENDER_EMAIL}' => $sender_email,
'{SENDER_NAME}' => $sender_name,
'{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target']."modules.php?name=coppermine",
'{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'],
);
$message = template_eval($template_ecard, $params);
$subject = sprintf($lang_ecard_php['ecard_title'], $sender_name);
$result = cpg_mail($recipient_email, $subject, $message, 'text/html', $sender_name, $sender_email);
if (!USER_ID) {
$USER['name'] = $sender_name;
$USER['email'] = $sender_email;
}
if ($result){
pageheader($lang_ecard_php['title'],"<META http-equiv=\"refresh\" content=\"3;url=modules.php?name=coppermine&file=displayimage&album=$album&pos=$pos\">");
msg_box($lang_cpg_die[INFORMATION], $lang_ecard_php['send_success'], $lang_continue, "modules.php?name=coppermine&file=displayimage&album=$album&pos=$pos");
pagefooter();
exit;
} else {
cpg_die(ERROR, $lang_ecard_php['send_failed'], __FILE__, __LINE__);
}
}
pageheader($lang_ecard_php['title']);
starttable("100%");
echo <<<EOT
<tr>
<td colspan="3" class="tableh1"><h2>{$lang_ecard_php['title']}</h2></td>
</tr>
<tr>
<td class="tableh2" colspan="2"><b>{$lang_ecard_php['from']}</b></td>
<td rowspan="6" align="center" valign="top" class="tableb">
<img src="$thumb_pic_url" alt="" vspace="8" border="0" class="image"><br />
</td>
</tr>
<tr>
<td class="tableb" valign="top" width="40%">
<form method="post" name="post" action="modules.php?name=coppermine&file=ecard&album=$album&pid=$pid&pos=$pos">
{$lang_ecard_php['your_name']}<br />
</td>
<td valign="top" class="tableb" width="60%">
<input type="text" class="textinput" name="sender_name" value="$sender_name" style="WIDTH: 100%;"><br />
</td>
</tr>
<tr>
<td class="tableb" valign="top" width="40%">
{$lang_ecard_php['your_email']}<br />
</td>
<td valign="top" class="tableb" width="60%">
<input type="text" class="textinput" name="sender_email" value="$sender_email" style="WIDTH: 100%;"><br />
$sender_email_warning
</td>
</tr>
<tr>
<td class="tableh2" colspan="2"><b>{$lang_ecard_php['to']}</b></td>
</tr>
<tr>
<td class="tableb" valign="top" width="40%">
{$lang_ecard_php['rcpt_name']}<br />
</td>
<td valign="top" class="tableb" width="60%">
<input type="text" class="textinput" name="recipient_name" value="$recipient_name" style="WIDTH: 100%;"><br />
</td>
</tr>
<tr>
<td class="tableb" valign="top" width="40%">
{$lang_ecard_php['rcpt_email']}<br />
</td>
<td valign="top" class="tableb" width="60%">
<input type="text" class="textinput" name="recipient_email" value="$recipient_email" style="WIDTH: 100%;"><br />
$recipient_email_warning
</td>
</tr>
<tr>
<td class="tableh2" colspan="3"><b>{$lang_ecard_php['greetings']}</b></td>
</tr>
<tr>
<td class="tableb" colspan="3">
<input type="text" class="textinput" name="greetings" value="$greetings" style="WIDTH: 100%;"><br />
</td>
</tr>
<tr>
<td class="tableh2" colspan="3"><b>{$lang_ecard_php['message']}</b></td>
</tr>
<tr>
<td class="tableb" colspan="3" valign="top"><br />
<textarea name="message" class="textinput" ROWS="8" COLS="40" WRAP="virtual" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" STYLE="WIDTH: 100%;">$message</textarea><br /><br />
</td>
</tr>
<tr>
<td class="tableb" colspan="3" valign="top">
EOT;
echo generate_smilies();
echo <<<EOT
</td>
</tr>
<tr>
<td colspan="3" align="center" class="tablef">
<input type="submit" class="button" value="{$lang_ecard_php['title']}">
</form>
</td>
</tr>
EOT;
endtable();
pagefooter();
include("footer.php");
break;
}
?>
atlantic2: what theme were you using before you switched to default?
kegobeer: I was able to recreate the problem in the nuke theme, the above fix worked for me...
Using hardwired I couldn't get the new code to work. I sent two ecards, one to my yahoo account (box around some text, no images) and one to my webmaster account (raw html code).
There were a lot of trailing spaces when I copied and pasted the code into htmlKit, so I'll try again and see if that makes a difference.
[update]No luck. I'll PM you my email address, can you send the file to me?
After changing the theme.php in the theme to the same ecard settings as in the default one it works fine. Strange that we used the same set of files on another site with no problem, it has just now occured. Doesn't matter now it works fine and I know where to look in the future.
Thanks a lot for all the help...
BTW - I was using rainy day...
I just tried rainy day on my site and the ecard didn't work correctly. I know for sure default and hardwired work great. I have hardwired available for download if you're interested. Just post here and let me know.
I would like to see it.
Check out the downloads section:
http://prdownloads.sourceforge.net/coppermine/theme_phpnuke_hardwired.zip?download