[ Index ] |
PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 // load special functions 31 require_once (PHPWCMS_ROOT.'/include/inc_front/img.func.inc.php'); 32 33 //ecard 34 35 $CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]); 36 $ecard = unserialize($crow["acontent_form"]); 37 38 $ecard["send_err"] = 0; 39 $ecard["send_success"] = 0; 40 $ecard["selected"] = ''; 41 42 // check if e-card was posted 43 if(isset($_POST['ecard_chooser'])) { 44 45 $ecard["chooser"] = isset($_POST['ecard_chooser']) ? intval($_POST['ecard_chooser']) : 0; 46 $ecard["selected"] = $ecard["chooser"]; 47 $ecard["sender_name"] = clean_slweg(remove_unsecure_rptags($_POST["ecard_sender_name"])); 48 $ecard["sender_email"] = clean_slweg(remove_unsecure_rptags($_POST["ecard_sender_email"])); 49 $ecard["recipient_name"] = clean_slweg(remove_unsecure_rptags($_POST["ecard_recipient_name"])); 50 $ecard["recipient_email"] = clean_slweg(remove_unsecure_rptags($_POST["ecard_recipient_email"])); 51 $ecard["sender_msg"] = clean_slweg(remove_unsecure_rptags($_POST["ecard_sender_msg"])); 52 53 if(!is_valid_email($ecard["sender_email"]) || !is_valid_email($ecard["recipient_email"])) { 54 $ecard["send_err"] = 1; 55 } else { 56 //send message 57 include_once ('include/inc_ext/phpmailer/class.phpmailer.php'); 58 $ecard["capt"] = explode("\n", $ecard["caption"]); 59 60 $thumb_image = get_cached_image( 61 array( "target_ext" => $ecard['images'][$ecard["chooser"]][3], 62 "image_name" => $ecard['images'][$ecard["chooser"]][2] . '.' . $ecard['images'][$ecard["chooser"]][3], 63 "max_width" => $ecard['images'][$ecard["chooser"]][4], 64 "max_height" => $ecard['images'][$ecard["chooser"]][5], 65 "thumb_name" => md5( $ecard['images'][$ecard["chooser"]][2].$ecard['images'][$ecard["chooser"]][4]. 66 $ecard['images'][$ecard["chooser"]][5].$GLOBALS['phpwcms']["sharpen_level"] 67 ) 68 ) 69 ); 70 $list_img_temp = '<img src="'.PHPWCMS_IMAGES.$thumb_image[0].'" '.$thumb_image[3].' alt="'.html_specialchars($ecard['images'][$ecard["chooser"]][1]).'" />'; 71 72 $ecard["send"] = str_replace('###ECARD_TITLE###', html_specialchars(chop($ecard["capt"][$ecard["chooser"]])), $ecard["send"]); 73 $ecard["send"] = str_replace('###ECARD_IMAGE###', $list_img_temp, $ecard["send"]); 74 $ecard["send"] = str_replace('###RECIPIENT_NAME###', ($ecard["recipient_name"]) ? html_specialchars($ecard["recipient_name"]) : html_specialchars($ecard["recipient_email"]), $ecard["send"]); 75 $ecard["send"] = str_replace('###RECIPIENT_EMAIL###', html_specialchars($ecard["recipient_email"]), $ecard["send"]); 76 $ecard["send"] = str_replace('###SENDER_MESSAGE###', nl2br(html_specialchars($ecard["sender_msg"])), $ecard["send"]); 77 $ecard["send"] = str_replace('###ECARD_SUBJECT###', html_specialchars($ecard["subject"]), $ecard["send"]); 78 79 $ecard["mailer"] = new PHPMailer(); 80 $ecard["mailer"]->Mailer = $phpwcms['SMTP_MAILER']; 81 $ecard["mailer"]->IsHTML(1); 82 $ecard['mailer']->CharSet = $phpwcms["charset"]; 83 $ecard["mailer"]->From = $ecard["sender_email"]; 84 if($ecard["sender_name"]) $ecard["mailer"]->FromName = $ecard["sender_name"]; 85 $ecard["mailer"]->AddAddress($ecard["recipient_email"], $ecard["recipient_name"]); 86 $ecard["mailer"]->Subject = ($ecard["subject"]) ? $ecard["subject"] : 'E-Card: '.chop($ecard["capt"][$ecard["chooser"]]); 87 88 $thumb_image = get_cached_image( 89 array( "target_ext" => $ecard['images'][$ecard["chooser"]][3], 90 "image_name" => $ecard['images'][$ecard["chooser"]][2] . '.' . $ecard['images'][$ecard["chooser"]][3], 91 "max_width" => $ecard['images'][$ecard["chooser"]][4], 92 "max_height" => $ecard['images'][$ecard["chooser"]][5], 93 "thumb_name" => md5( $ecard['images'][$ecard["chooser"]][2].$GLOBALS['phpwcms']["img_prev_width"]. 94 $GLOBALS['phpwcms']["img_prev_height"].$GLOBALS['phpwcms']["sharpen_level"] 95 ) 96 ) 97 ); 98 $list_img_temp = '<img src="'.PHPWCMS_URL.PHPWCMS_IMAGES.$thumb_image[0].'" '.$thumb_image[3].' alt="'.html_specialchars($ecard['images'][$ecard["chooser"]][1]).'" />'; 99 100 if($ecard["mail"]) { 101 $ecard["mail"] = str_replace('###ECARD_TITLE###', html_specialchars(chop($ecard["capt"][$ecard["chooser"]])), $ecard["mail"]); 102 $ecard["mail"] = str_replace('###ECARD_IMAGE###', $list_img_temp, $ecard["mail"]); 103 $ecard["mail"] = str_replace('###RECIPIENT_NAME###', ($ecard["recipient_name"]) ? html_specialchars($ecard["recipient_name"]) : html_specialchars($ecard["recipient_email"]), $ecard["mail"]); 104 $ecard["mail"] = str_replace('###RECIPIENT_EMAIL###', html_specialchars($ecard["recipient_email"]), $ecard["mail"]); 105 $ecard["mail"] = str_replace('###SENDER_MESSAGE###', nl2br(html_specialchars($ecard["sender_msg"])), $ecard["mail"]); 106 $ecard["mail"] = str_replace('###SENDER_NAME###', ($ecard["sender_name"]) ? html_specialchars($ecard["sender_name"]) : html_specialchars($ecard["sender_email"]), $ecard["mail"]); 107 $ecard["mail"] = str_replace('###SENDER_EMAIL###', html_specialchars($ecard["sender_email"]), $ecard["mail"]); 108 $ecard["mail"] = str_replace('###ECARD_SUBJECT###', html_specialchars($ecard["subject"]), $ecard["mail"]); 109 $ecard["mailer"]->Body = $ecard["mail"]; 110 } else { 111 $ecard["mailer"]->Body = '<div align="center"><h3>E-Card "'.html_specialchars(chop($ecard["capt"][$ecard["chooser"]])).'"</h3>'. 112 '<p><strong>sent to you from '.html_specialchars($ecard["sender_name"].(($ecard["sender_name"]) ? ' ('.$ecard["sender_email"].')': $ecard["sender_email"])).'</strong></p>'. 113 '<p>'.$list_img_temp.'</p>'. 114 '<p>'.nl2br(html_specialchars($ecard["sender_msg"])).'</p><hr /><a href="'.$phpwcms["site"].'" target="_blank">'.$phpwcms["site"].'</a></div>'; 115 } 116 117 if(strtolower($phpwcms['SMTP_MAILER']) == 'smtp') { 118 $ecard["mailer"]->Port = (!$phpwcms['SMTP_PORT']) ? 25 : $phpwcms['SMTP_PORT']; 119 $ecard["mailer"]->Host = $phpwcms['SMTP_HOST']; 120 $ecard["mailer"]->SMTPAuth = $phpwcms['SMTP_AUTH']; 121 $ecard["mailer"]->Username = $phpwcms['SMTP_USER']; 122 $ecard["mailer"]->Password = $phpwcms['SMTP_PASS']; 123 } 124 125 $ecard["mailer"]->Send(); 126 127 $CNT_TMP .= $ecard["send"]; 128 $ecard["send_success"] = 1; 129 } 130 } 131 132 if(is_array($ecard['images']) && count($ecard['images']) && !$ecard["send_success"]) { 133 //Nochmal Prüfen auf leere Werte oder Dopplungen und Zuweisen der einzelnen Werte 134 135 $ecard["onover"] = preg_replace('/;{1,}$/', '', $ecard["onover"]) .';'; 136 $ecard["onclick"] = preg_replace('/;{1,}$/', '', $ecard["onclick"]) .';'; 137 $ecard["onout"] = preg_replace('/;{1,}$/', '', $ecard["onout"]) .';'; 138 139 //$ecard["capt"] = explode("\n", $ecard["caption"]); 140 $ecard["show"] = array(); 141 142 $ecard_count = 0; 143 144 foreach($ecard['images'] as $key => $value) { 145 146 $ecard['temp_caption'] = explode('|', $ecard['images'][$key][6], 2); 147 $ecard['images'][$key][6] = $ecard['temp_caption'][0]; 148 //check if image should be available as e-card 149 if(substr($ecard['images'][$key][6], 0, 1) != '~') { 150 151 //check if radio button or javascript 152 if(!$ecard["selector"]) { 153 154 $temp_cap = '<table '.$template_default["article"]["ecard_chooser_css"].' border="0" cellpadding="0" cellspacing="0">'."\n<tr>\n"; 155 $temp_cap .= '<td valign="top"><input type="radio" name="ecard_chooser" id="ecard_chooser_'.$ecard_count.'" value="'.$key.'" '; 156 if(isset($ecard["chooser"]) && $ecard["chooser"] == $key) { 157 $temp_cap .= ' checked="checked" '; 158 } 159 $temp_cap .= "/></td>\n<td ".$template_default["article"]["ecard_chooser_text"].">"; 160 $temp_cap .= html_specialchars(trim($ecard['images'][$key][6]))."</td>\n</tr>\n</table>"; //Bildunterschrift 161 162 } else { 163 164 $temp_cap = '<table width="100%" '.$template_default["article"]["ecard_chooser_css"].' border="0" cellpadding="0" cellspacing="0">'; 165 $temp_cap .= '<tr><td id="ecard'.$key.'" '.$template_default["article"]["ecard_chooser_text"]; 166 if($ecard["onover"]) { 167 $temp_cap .= ' onmouseover="'.$ecard["onover"].'"'; 168 } 169 if($ecard["onclick"]) { 170 $temp_cap .= ' onclick="'.$ecard["onclick"].'"'; 171 } 172 if($ecard["onout"]) { 173 $temp_cap .= ' onmouseout="'.$ecard["onout"].'"'; 174 } 175 $temp_cap .= '>'.html_specialchars(trim($ecard['images'][$key][6])).'</td></tr></table>'; 176 177 } 178 179 } else { 180 181 // show image caption only 182 $temp_cap = html_specialchars(substr($ecard['images'][$key][6], 1)); 183 184 } 185 186 $ecard['images'][$key][6] = $temp_cap; 187 if(!empty($ecard['temp_caption'][1])) { 188 $ecard['images'][$key][6] .= '|'.$ecard['temp_caption'][1]; 189 } 190 191 $ecard_count++; 192 193 } 194 switch($ecard["pos"]) { 195 case 0: $ecard["chooser"] = imagelisttable($ecard, "0:5:0:0", '', 1); break; //links 196 case 1: $ecard["chooser"] = imagelisttable($ecard, "0:5:0:0", "center", 1); break; //center 197 case 1: $ecard["chooser"] = imagelisttable($ecard, "0:5:0:0", "center", 1); break; //right 198 } 199 $ecard["form"] = str_replace('###ECARD_CHOOSER###', $ecard["chooser"], $ecard["form"]); 200 if(!$ecard["send_err"]) { 201 $ecard["form"] = preg_replace("/<!--FORM_ERROR_START-->(.*?)<!--FORM_ERROR_END-->/si", '', $ecard["form"]); 202 } 203 $ecard["form"] = preg_replace("/name=[\'|\"]###SENDER_NAME###[\'|\"]/i", 'name="ecard_sender_name"', $ecard["form"]); 204 $ecard["form"] = preg_replace("/name=[\'|\"]###SENDER_EMAIL###[\'|\"]/i", 'name="ecard_sender_email"', $ecard["form"]); 205 $ecard["form"] = preg_replace("/name=[\'|\"]###RECIPIENT_NAME###[\'|\"]/i", 'name="ecard_recipient_name"', $ecard["form"]); 206 $ecard["form"] = preg_replace("/name=[\'|\"]###RECIPIENT_EMAIL###[\'|\"]/i", 'name="ecard_recipient_email"', $ecard["form"]); 207 $ecard["form"] = preg_replace("/name=[\'|\"]###SENDER_MESSAGE###[\'|\"]/i", 'name="ecard_sender_msg"', $ecard["form"]); 208 209 $ecard["form"] = str_replace('###SENDER_NAME###', isset($ecard["sender_name"]) ? html_specialchars($ecard["sender_name"]) : '', $ecard["form"]); 210 $ecard["form"] = str_replace('###SENDER_EMAIL###', isset($ecard["sender_email"]) ? html_specialchars($ecard["sender_email"]) : '', $ecard["form"]); 211 $ecard["form"] = str_replace('###RECIPIENT_NAME###', isset($ecard["recipient_name"]) ? html_specialchars($ecard["recipient_name"]) : '', $ecard["form"]); 212 $ecard["form"] = str_replace('###RECIPIENT_EMAIL###', isset($ecard["recipient_email"]) ? html_specialchars($ecard["recipient_email"]) : '', $ecard["form"]); 213 $ecard["form"] = str_replace('###SENDER_MESSAGE###', isset($ecard["sender_msg"]) ? html_specialchars($ecard["sender_msg"]) : '', $ecard["form"]); 214 $ecard["form"] = str_replace('###ECARD_SUBJECT###', isset($ecard["subject"]) ? html_specialchars($ecard["subject"]) : '', $ecard["form"]); 215 216 $CNT_TMP .= '<form action="'.html_specialchars($_SERVER['REQUEST_URI']).'" method="post" name="send_ecard">'; 217 $CNT_TMP .= $ecard["form"]; 218 if($ecard["selector"]) { 219 //add hidden form field ecard_chooser 220 $CNT_TMP .= '<input type="hidden" name="ecard_chooser" value="'.$ecard["selected"].'" />'; 221 } 222 $CNT_TMP .= '</form>'; 223 } 224 225 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 30 05:55:15 2009 | Cross-referenced by PHPXref 0.7 |