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: E-Card Path Incorrect  (Read 13310 times)

0 Members and 1 Guest are viewing this topic.

atlantic2

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
E-Card Path Incorrect
« on: October 10, 2003, 04:54:40 pm »

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"
Logged

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
E-Card Path Incorrect
« Reply #1 on: October 10, 2003, 09:39:10 pm »

This code is in ecard.php
line ~=82-3
Code: [Select]
$gallery_dir = strtr(dirname($PHP_SELF),'\\','/');
        $gallery_url_prefix = 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'] . $gallery_dir . (substr($gallery_dir, -1) == '/' ? '' : '/');

line ~= 110
Code: [Select]
'{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
Code: [Select]

'{VIEW_ECARD_TGT}' => "{$CONFIG['ecards_more_pic_target']}/modules.php?name=coppermine&file=displayecard&data=$encoded_data",

Let me know if this works![/code]

atlantic2

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
E-Card Path Incorrect
« Reply #2 on: October 10, 2003, 10:04:31 pm »

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
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
E-Card Path Incorrect
« Reply #3 on: October 10, 2003, 10:44:55 pm »

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.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
E-Card Path Incorrect
« Reply #4 on: October 10, 2003, 11:12:34 pm »

Thanks kegobeer -put me on the right track
in nuke/theme.php it uses URL_PREFIX from ecard.php
Code: [Select]
<img src="{URL_PREFIX}/modules/coppermine/images/stamp.gif"
so try changing in ecard.php

Code: [Select]
$gallery_url_prefix = 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'] .
to
Code: [Select]

$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

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
E-Card Path Incorrect
« Reply #5 on: October 10, 2003, 11:26:01 pm »

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.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
E-Card Path Incorrect
« Reply #6 on: October 10, 2003, 11:57:26 pm »

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
Code: [Select]
<?php
// ------------------------------------------------------------------------- //
//  Coppermine Photo Gallery v1.1 Beta 2                                     //
// ------------------------------------------------------------------------- //
//  Copyright &#40;C&#41; 2002,2003  Grégory DEMAR <gdemar@wanadoo.fr>               //
//  http&#58;//www.chezgreg.net/coppermine/                                      //
// ------------------------------------------------------------------------- //
//  Based on PHPhotoalbum by Henning Střverud <henning@stoverud.com>         //
//  http&#58;//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        //
//  &#40;at your option&#41; any later version.                                      //
// ------------------------------------------------------------------------- //
if &#40;!eregi&#40;"modules.php", $_SERVER['PHP_SELF'&#93;&#41;&#41; &#123;
    
die &#40;"You can't access this file directly..."&#41;;
&#125;

require_once&#40;"mainfile.php"&#41;;


$pagetitle "- Coppermine";



define&#40;'IN_COPPERMINE', true&#41;;
define&#40;'ECARDS_PHP', true&#41;;

if &#40;!USER_CAN_SEND_ECARDS&#41; cpg_die&#40;ERROR, $lang_errors['access_denied'&#93;, __FILE__, __LINE__&#41;;

switch&#40;$func&#41; &#123;
default&#58;
include&#40;"header.php"&#41;;


require&#40;'modules/coppermine/include/init.inc.php'&#41;;
require&#40;"modules/coppermine/include/smilies.inc.php"&#41;;
require&#40;"modules/coppermine/include/mailer.inc.php"&#41;;

function get_post_var&#40;$name, $default=''&#41;
&#123;
        
global $HTTP_POST_VARS;

        return isset&
#40;$HTTP_POST_VARS[$name&#93;&#41; ? $HTTP_POST_VARS[$name&#93; &#58; $default;
&#125;

$pid   = &#40;int&#41;$HTTP_GET_VARS['pid'&#93;;
$album $HTTP_GET_VARS['album'&#93;;
$pos   = &#40;int&#41;$HTTP_GET_VARS['pos'&#93;;

$sender_name  get_post_var&#40;'sender_name', USER_ID ? username &#58; &#40;isset&#40;$USER['name'&#93;&#41; ? $USER['name'&#93; &#58; ''&#41;&#41;;
$sender_email get_post_var&#40;'sender_email', USER_ID ? $USER_DATA['user_email'&#93; &#58; &#40;isset&#40;$USER['email'&#93;&#41; ? $USER['email'&#93; &#58; ''&#41;&#41;;
$recipient_name get_post_var&#40;'recipient_name'&#41;;
$recipient_email get_post_var&#40;'recipient_email'&#41;;
$greetings get_post_var&#40;'greetings'&#41;;
$message get_post_var&#40;'message'&#41;;
$sender_email_warning '';
$recipient_email_warning '';


// Build the private album set
if &#40;!GALLERY_ADMIN_MODE && $CONFIG['allow_private_albums'&#93;&#41; get_private_album_set&#40;&#41;;
 
// Get picture thumbnail url
$result mysql_query&#40;"SELECT * from &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE pid='$pid' $ALBUM_SET"&#41;;
if &#40;!mysql_num_rows&#40;$result&#41;&#41; cpg_die&#40;ERROR, $lang_errors['non_exist_ap'&#93;&#41;;
$row mysql_fetch_array&#40;$result&#41;;
$thumb_pic_url get_pic_url&#40;$row, 'thumb'&#41;;

// Check supplied email address
$valid_email_pattern "^[_\.0-9a-z\-&#93;+@&#40;[0-9a-z&#93;[0-9a-z-&#93;+\.&#41;+[a-z&#93;&#123;2,6&#125;$";
$valid_sender_email eregi&#40;$valid_email_pattern, $sender_email&#41;;
$valid_recipient_email eregi&#40;$valid_email_pattern,$recipient_email&#41;;
$invalid_email '<font size="1">'.$lang_ecard_php['invalid_email'&#93;.'</font>';
if &#40;!$valid_sender_email && count&#40;$HTTP_POST_VARS&#41; > 0&#41; $sender_email_warning = $invalid_email;
if &#40;!$valid_recipient_email && count&#40;$HTTP_POST_VARS&#41; > 0&#41; $recipient_email_warning = $invalid_email;

// Create and send the e-card
if &#40;count&#40;$HTTP_POST_VARS&#41; > 0 && $valid_sender_email && $valid_recipient_email&#41;&#123;

        
$gallery_dir strtr&#40;dirname&#40;$PHP_SELF&#41;,'\\','/'&#41;;
        
$gallery_url_prefix $CONFIG['ecards_more_pic_target'&#93;;

        
if &#40;$CONFIG['make_intermediate'&#93; && max&#40;$row['pwidth'&#93;, $row['pheight'&#93;&#41; > $CONFIG['picture_width'&#93;&#41;  &#123;
            
$n_picname get_pic_url&#40;$row, 'normal'&#41;;
         
&#125; else &#123;
             
$n_picname get_pic_url&#40;$row, 'fullsize'&#41;;
         
&#125;
        
        
if&#40;!stristr&#40;$n_picname, 'http&#58;'&#41;&#41; $n_picname = $CONFIG['ecards_more_pic_target'&#93;."$n_picname";

        
$msg_content nl2br&#40;process_smilies&#40;$message, $gallery_url_prefix&#41;&#41;;

        
$data = array&#40;
                
'rn' => $HTTP_POST_VARS['recipient_name'&#93;,
                
'sn' => $HTTP_POST_VARS['sender_name'&#93;,
                
'se' => $HTTP_POST_VARS['sender_email'&#93;,
                
'p'  => $n_picname,
                
'g'  => $greetings,
                
'm'  => $message,
        &
#41;;

        
$encoded_data urlencode&#40;base64_encode&#40;serialize&#40;$data&#41;&#41;&#41;;

        
$params = array&#40;
                
'&#123;LANG_DIR&#125;' => $lang_text_dir,
                
'&#123;TITLE&#125;' => sprintf&#40;$lang_ecard_php['ecard_title'&#93;, $sender_name&#41;,
                
'&#123;CHARSET&#125;' => $CONFIG['charset'&#93; == 'language file' ? $lang_charset &#58; $CONFIG['charset'&#93;,
                
'&#123;VIEW_ECARD_TGT&#125;' => $CONFIG['ecards_more_pic_target'&#93;."modules.php?name=coppermine&file=displayecard&data=$encoded_data",
                
'&#123;VIEW_ECARD_LNK&#125;' => $lang_ecard_php['view_ecard'&#93;,
                
'&#123;PIC_URL&#125;' => $n_picname,
                
'&#123;URL_PREFIX&#125;' => $gallery_url_prefix,
                
'&#123;GREETINGS&#125;' => $greetings,
                
'&#123;MESSAGE&#125;' => $msg_content,
                
'&#123;SENDER_EMAIL&#125;' => $sender_email,
                
'&#123;SENDER_NAME&#125;' => $sender_name,
                
'&#123;VIEW_MORE_TGT&#125;' => $CONFIG['ecards_more_pic_target'&#93;."modules.php?name=coppermine",
                
'&#123;VIEW_MORE_LNK&#125;' => $lang_ecard_php['view_more_pics'&#93;,
        
&#41;;

        
$message template_eval&#40;$template_ecard, $params&#41;;

        
$subject sprintf&#40;$lang_ecard_php['ecard_title'&#93;, $sender_name&#41;;
        
$result cpg_mail&#40;$recipient_email, $subject, $message, 'text/html', $sender_name, $sender_email&#41;;

        
if &#40;!USER_ID&#41; &#123;
                
$USER['name'&#93; = $sender_name;
                
$USER['email'&#93; = $sender_email;
        
&#125;

        
if &#40;$result&#41;&#123;
                
pageheader&#40;$lang_ecard_php['title'&#93;,"<META http-equiv=\"refresh\" content=\"3;url=modules.php?name=coppermine&file=displayimage&album=$album&pos=$pos\">"&#41;;
                
msg_box&#40;$lang_cpg_die[INFORMATION&#93;, $lang_ecard_php['send_success'&#93;, $lang_continue, "modules.php?name=coppermine&file=displayimage&album=$album&pos=$pos"&#41;;
                
pagefooter&#40;&#41;;
                
exit;
        &
#125; else &#123;
                
cpg_die&#40;ERROR, $lang_ecard_php['send_failed'&#93;, __FILE__, __LINE__&#41;;
        
&#125;
&#125;

pageheader&#40;$lang_ecard_php['title'&#93;&#41;;
starttable&#40;"100%"&#41;;

echo <<<EOT
        <tr>
                <td colspan="3" class="tableh1"><h2>&#123;
$lang_ecard_php['title'&#93;&#125;</h2></td>
        </tr>
        <tr>
                <td class="tableh2" colspan="2"><b>&#123;
$lang_ecard_php['from'&#93;&#125;</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">
                        &#123;
$lang_ecard_php['your_name'&#93;&#125;<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        <input type="text" class="textinput" name="sender_name"  value="
$sender_name" style="WIDTH&#58; 100%;"><br />
                </td>
        </tr>
        <tr>
                <td class="tableb" valign="top" width="40%">
                        &#123;
$lang_ecard_php['your_email'&#93;&#125;<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        <input type="text" class="textinput" name="sender_email"  value="
$sender_email" style="WIDTH&#58; 100%;"><br />
                        
$sender_email_warning
                </td>
        </tr>
        <tr>
                <td class="tableh2" colspan="2"><b>&#123;
$lang_ecard_php['to'&#93;&#125;</b></td>
        </tr>
        <tr>
                <td class="tableb" valign="top" width="40%">
                        &#123;
$lang_ecard_php['rcpt_name'&#93;&#125;<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        <input type="text" class="textinput" name="recipient_name"  value="
$recipient_name" style="WIDTH&#58; 100%;"><br />
                </td>
        </tr>
        <tr>
                <td class="tableb" valign="top" width="40%">
                        &#123;
$lang_ecard_php['rcpt_email'&#93;&#125;<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        <input type="text" class="textinput" name="recipient_email"  value="
$recipient_email" style="WIDTH&#58; 100%;"><br />
                        
$recipient_email_warning
                </td>
        </tr>
        <tr>
                <td class="tableh2" colspan="3"><b>&#123;
$lang_ecard_php['greetings'&#93;&#125;</b></td>
        </tr>
        <tr>
                <td class="tableb" colspan="3">
                        <input type="text" class="textinput" name="greetings"  value="
$greetings" style="WIDTH&#58; 100%;"><br />
                </td>
        </tr>
        <tr>
                <td class="tableh2" colspan="3"><b>&#123;
$lang_ecard_php['message'&#93;&#125;</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&#40;this&#41;;" onclick="storeCaret_post&#40;this&#41;;" onkeyup="storeCaret_post&#40;this&#41;;" STYLE="WIDTH&#58; 100%;">
$message</textarea><br /><br />
                </td>
        </tr>
        <tr>
                <td class="tableb" colspan="3" valign="top">

EOT;
echo 
generate_smilies&#40;&#41;;
echo <<<EOT
                </td>
        </tr>
        <tr>
                <td colspan="3" align="center" class="tablef">
                        <input type="submit" class="button" value="&#123;
$lang_ecard_php['title'&#93;&#125;">
                        </form>
                </td>
        </tr>
EOT;

endtable&#40;&#41;;
pagefooter&#40;&#41;;
include&#40;"footer.php"&#41;;
break;
&
#125;
?>

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
E-Card Path Incorrect
« Reply #7 on: October 11, 2003, 12:04:54 am »

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...

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
E-Card Path Incorrect
« Reply #8 on: October 11, 2003, 01:22:33 am »

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?
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

atlantic2

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
E-Card Path Incorrect
« Reply #9 on: October 11, 2003, 03:05:02 am »

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...
Logged

atlantic2

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
E-Card Path Incorrect
« Reply #10 on: October 11, 2003, 03:06:38 am »

BTW - I was using rainy day...
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
E-Card Path Incorrect
« Reply #11 on: October 11, 2003, 03:44:21 am »

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.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

atlantic2

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
E-Card Path Incorrect
« Reply #12 on: October 12, 2003, 05:19:06 am »

I would like to see it.
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
E-Card Path Incorrect
« Reply #13 on: October 12, 2003, 06:07:24 pm »

Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 18 queries.