| [ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: tell_a_friend.php 3 2006-05-27 04:59:07Z user $ 4 5 osCMax Power E-Commerce 6 http://oscdox.com 7 8 Copyright 2006 osCMax 9 10 Released under the GNU General Public License 11 */ 12 13 // Most of this file is changed or moved to BTS - Basic Template System - format. 14 // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). 15 // catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). 16 // (Sub 'fallback' with your current template to see if there is a template specific file.) 17 18 require ('includes/application_top.php'); 19 20 if (!tep_session_is_registered('customer_id') && (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false')) { 21 $navigation->set_snapshot(); 22 tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); 23 } 24 25 $valid_product = false; 26 if (isset($HTTP_GET_VARS['products_id'])) { 27 $product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); 28 if (tep_db_num_rows($product_info_query)) { 29 $valid_product = true; 30 31 $product_info = tep_db_fetch_array($product_info_query); 32 } else { 33 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); 34 } 35 } 36 37 // BOF: MOD - Article Manager 38 //if ($valid_product == false) { 39 // tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); 40 $valid_article = false; 41 if (isset($HTTP_GET_VARS['articles_id'])) { 42 $article_info_query = tep_db_query("select pd.articles_name from " . TABLE_ARTICLES . " p, " . TABLE_ARTICLES_DESCRIPTION . " pd where p.articles_status = '1' and p.articles_id = '" . (int)$HTTP_GET_VARS['articles_id'] . "' and p.articles_id = pd.articles_id and pd.language_id = '" . (int)$languages_id . "'"); 43 if (tep_db_num_rows($article_info_query)) { 44 $valid_article = true; 45 46 $article_info = tep_db_fetch_array($article_info_query); 47 } else { 48 tep_redirect(tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $HTTP_GET_VARS['articles_id'])); 49 } 50 // EOF: MOD - Article Manager 51 } 52 53 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TELL_A_FRIEND); 54 55 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) { 56 $error = false; 57 58 $to_email_address = tep_db_prepare_input($HTTP_POST_VARS['to_email_address']); 59 $to_name = tep_db_prepare_input($HTTP_POST_VARS['to_name']); 60 $from_email_address = tep_db_prepare_input($HTTP_POST_VARS['from_email_address']); 61 $from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']); 62 $message = tep_db_prepare_input($HTTP_POST_VARS['message']); 63 64 if (empty($from_name)) { 65 $error = true; 66 67 $messageStack->add('friend', ERROR_FROM_NAME); 68 } 69 70 if (!tep_validate_email($from_email_address)) { 71 $error = true; 72 73 $messageStack->add('friend', ERROR_FROM_ADDRESS); 74 } 75 76 if (empty($to_name)) { 77 $error = true; 78 79 $messageStack->add('friend', ERROR_TO_NAME); 80 } 81 82 if (!tep_validate_email($to_email_address)) { 83 $error = true; 84 85 $messageStack->add('friend', ERROR_TO_ADDRESS); 86 } 87 88 if ($error == false) { 89 // BOF: MOD - Article Manager 90 // Modify e-mail depending on whether product or article 91 // if product 92 if ($valid_product) { 93 // EOF: MOD - Article Manager 94 $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME); 95 $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $product_info['products_name'], STORE_NAME) . "\n\n"; 96 97 if (tep_not_null($message)) { 98 $email_body .= $message . "\n\n"; 99 } 100 101 $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL', false)) . "\n\n" . 102 sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); 103 104 tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address); 105 106 $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success'); 107 108 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); 109 // BOF: MOD - Article Manager 110 // if article 111 } else if ($valid_article) { 112 $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME); 113 $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $article_info['articles_name'], STORE_NAME) . "\n\n"; 114 115 if (tep_not_null($message)) { 116 $email_body .= $message . "\n\n"; 117 } 118 119 $email_body .= sprintf(TEXT_EMAIL_LINK_ARTICLE, tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $HTTP_GET_VARS['articles_id'])) . "\n\n" . 120 sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); 121 122 tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address); 123 124 $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $article_info['articles_name'], tep_output_string_protected($to_name)), 'success'); 125 126 tep_redirect(tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $HTTP_GET_VARS['articles_id'])); 127 } 128 // EOF: MOD - Article Manager 129 } 130 } elseif (tep_session_is_registered('customer_id')) { 131 $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'"); 132 $account = tep_db_fetch_array($account_query); 133 134 $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname']; 135 $from_email_address = $account['customers_email_address']; 136 } 137 138 // LINE ADDED: MOD - Article Manager 139 if ($valid_product) { 140 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $HTTP_GET_VARS['products_id'])); 141 // BOF: MOD - Article Manager 142 } else if ($valid_article) { 143 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'articles_id=' . $HTTP_GET_VARS['articles_id'])); 144 } 145 // EOF: MOD - Article Manager 146 147 $content = CONTENT_TELL_A_FRIEND; 148 149 include (bts_select('main', $content_template)); // BTSv1.5 150 151 require (DIR_WS_INCLUDES . 'application_bottom.php'); 152 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |