Location: PHPKode > projects > Freeway > freeway_1_5_Alpha/events_invite_friend.php
<?php
/*
	osCommRes, Services Oline 
	http://www.oscommres.com 
	Copyright (c) 2005 osCommRes 
	
	Freeway eCommerce 
	http://www.openfreeway.org
	Copyright (c) 2007 ZacWare

	Released under the GNU General Public License
*/


// Set flag that this is a parent file
	define( '_FEXEC', 1 );
	
	require('includes/application_top.php');

	require(DIR_WS_LANGUAGES . $FSESSION->language . '/' . FILENAME_EVENTS_INVITE_FRIEND);
	
	if (!$FSESSION->is_registered("customer_id")){
		$navigation->set_snapshot();
		$return=($FREQUEST->getvalue('R')!=""?"R=1":'');
		tep_redirect(tep_href_link(FILENAME_LOGIN, $return, 'SSL'));
	}
	
	if ($FREQUEST->postvalue('action')=='invite'){
		if ($FREQUEST->postvalue('eID')=="" || is_numeric($FREQUEST->postvalue('eID'))==false)
			tep_redirect(tep_href_link(FILENAME_ACCOUNT,'','SSL'));

		if ($FREQUEST->postvalue('invite_address')=="")
			tep_redirect(tep_href_link(FILENAME_ACCOUNT,'','SSL'));
		
		$invite_address=split(";",tep_db_prepare_input($FREQUEST->postvalue('invite_address')));

		$events_id=$FREQUEST->postvalue('eID','int');
		$to_address=array();
		$to_name=array();
		for ($icnt=0;$icnt<sizeof($invite_address);$icnt++){
			if ($invite_address[$icnt]!=""){
				$split_arr=split(":>",$invite_address[$icnt]);
				if (sizeof($split_arr)>1){
					$to_name[]=$split_arr[0];
					$to_address[]=$split_arr[1];
				}
			}
		}
		if (sizeof($to_address)>0){
			$send_details['address']=&$to_address;
			$send_details['name']=&$to_name;
			$send_details['events_id']=$events_id;
			$send_details['customers_id']=$FSESSION->customer_id;
			$send_details['comments']=tep_db_prepare_input($FREQUEST->postvalue('invite_comments'));
			$send_details['mail_type']='INV';
		
			tep_send_invite_email($send_details);
			$messageStack->add_session('account', SUCCESS_INVITE_FRIENDS, 'success');
		}
		tep_redirect(tep_href_link(FILENAME_ACCOUNT,'','SSL'));
	}
	if ($FREQUEST->getvalue('eID')=="" || is_numeric($FREQUEST->getvalue('eID'))==false)
		tep_redirect(tep_href_link(FILENAME_ACCOUNT,'','SSL'));
    
	$events_id=$FREQUEST->getvalue('eID','int');
	
	$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNTS_RESERVATIONS));
	$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_EVENTS_INVITE_FRIEND));
	
	$content = CONTENT_EVENTS_INVITE_FRIEND;
	$javascript = 'popup_window.js';
	require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);
	
	require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Return current item: Freeway