"; } $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 = ''; // Get picture thumbnail url $result = db_query("SELECT * from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET"); if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); $row = mysql_fetch_array($result); $thumb_pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) cpg_die(ERROR, $lang_ecard_php['error_not_image'], __FILE__, __LINE__); // 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 = '' . $lang_ecard_php['invalid_email'] . ''; 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_url_prefix = $CONFIG['ecards_more_pic_target']. (substr($CONFIG['ecards_more_pic_target'], -1) == '/' ? '' : '/'); if($CONFIG['thumb_use']=='ht' && $row['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored $condition = true; }elseif($CONFIG['thumb_use']=='wd' && $row['pwidth'] > $CONFIG['picture_width']){ $condition = true; }elseif($CONFIG['thumb_use']=='any' && max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width']){ $condition = true; }else{ $condition = false; } if ($CONFIG['make_intermediate'] && $condition ) { $n_picname = get_pic_url($row, 'normal'); } else { $n_picname = get_pic_url($row, 'fullsize'); } if (!stristr($n_picname, 'http:')) $n_picname = $gallery_url_prefix . $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' => $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}' => "{$gallery_url_prefix}displayecard.php?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'], '{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'], ); $message = template_eval($template_ecard, $params); $tempTime = time(); $message .= "Sent by $sender_name from IP {$_SERVER['REMOTE_ADDR']} at ".gmstrftime("%A, %B,%d,%Y %I:%M %p ", time())." [GMT]"; $subject = sprintf($lang_ecard_php['ecard_title'], $sender_name); $result = cpg_mail($recipient_email, $subject, $message, 'text/html', $sender_name, $sender_email); //write ecard log if ($CONFIG['log_ecards'] == 1) { $result_log = db_query("INSERT INTO {$CONFIG['TABLE_ECARDS']} (sender_name, sender_email, recipient_name, recipient_email, link, date, sender_ip) VALUES ('$sender_name', '$sender_email', '$recipient_name', '$recipient_email', '$encoded_data', '$tempTime', '{$_SERVER["REMOTE_ADDR"]}')"); } if (!USER_ID) { $USER['name'] = $sender_name; $USER['email'] = $sender_email; } if ($result) { pageheader($lang_ecard_php['title'], ""); msg_box($lang_cpg_die[INFORMATION], $lang_ecard_php['send_success'], $lang_continue, "displayimage.php?album=$album&pos=$pos"); pagefooter(); ob_end_flush(); exit; } else { cpg_die(ERROR, $lang_ecard_php['send_failed'], __FILE__, __LINE__); } } pageheader($lang_ecard_php['title']); starttable("100%", $lang_ecard_php['title'], 3); echo << {$lang_ecard_php['from']}
{$lang_ecard_php['your_name']}

{$lang_ecard_php['your_email']}
{$sender_box} {$sender_email_warning} {$lang_ecard_php['to']} {$lang_ecard_php['rcpt_name']}

{$lang_ecard_php['rcpt_email']}

$recipient_email_warning {$lang_ecard_php['greetings']}
{$lang_ecard_php['message']}


EOT; echo generate_smilies(); echo << EOT; endtable(); pagefooter(); ob_end_flush(); ?>