Location: PHPKode > projects > Warp.cms - php/mysql content management > warp_121/print_app.php
<?php

// [print module v.1.2.1]
// xantis.warp.cms - version 1.2
// (c) 2002 xantis - all rights reserved
// this code is registered and protected by international copyrights laws


//####### Register Globals !

extract($HTTP_ENV_VARS);
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);

//#########################

$ysecure = rawurldecode("$ysec");
$ysecure = base64_decode("$ysecure");

if ($ysecure == 'printok') {
	$xnt_control_var = 'xnt2002warp.cms';
} //end if

if (empty($yfilename)) {
	$yfilename = 'print_app.php';
} //end if

require("lib_adv.php");


//##################################################


function xprint_remove_colors ($y_html_text) {
	//remove colors from tags
	$y_html_text = eregi_replace('COLOR="#+[[:alnum:]]+"', 'color=""', $y_html_text);
	return $y_html_text;
} //end function


function xprint_app () {
//-------------------

//admin access
global	$admacc ;

//main
global	$PHP_AUTH_PW, $PHP_AUTH_USER, $ymain_color, $wpsid, $warp_registrat_fail,
	$y_warp_back_text_x ;

//cfg globals
global 	$arr_var_result, $y_warp_print_ready_txt, $ywebsite_name, $xid, $xop,
	$y_warp_xdate, $y_warp_xtime, $ywebsite_addr, $y_warp_pitm_picts_dir,
	$y_warp_picts_dir, $y_warp_crr_dir ;

//news
global 	$y_warp_news_text, $y_warp_news_subj, $y_warp_news_text, $y_warp_news_date,
	$y_warp_news_subj ;

//forum
global	$yforum_forum_title_short, $yforum_topics, $yforum_replies, $yforum_subject,
	$yforum_sender, $yforum_message, $yforum_created_on, $yforum_categ_title_selected,
	$yforum_reply_title_selected, $yforum_topic_title_selected ;

//events
global	$y_warp_events_text, $y_warp_events_subj, $y_warp_events_sdate, $y_warp_events_edate, 
	$y_warp_events_view_details ;

//products
global	$yprods_show_title, $yprods_categ_title_xs_short, $yprods_item_pname,
	$yprods_item_code_full, $yprods_item_descr, $yprods_item_details,
	$yprods_item_specifications, $yprods_item_package, $yprods_item_weight_um, 
	$yprods_item_weight, $yecomm_active, $yprods_item_noprice, $yprods_item_promo,
	$yprods_item_delivery_method, $yprods_item_delivery_method_p, 
	$yprods_item_delivery_pst_note, $yprods_item_delivery_method_d,
	$yprods_item_delivery_dwn_note, $yprods_item_crr, $yprods_item_price,
	$yprods_item_crr_expl, $yprods_item_delivery_method_s ;

//orders (e-commerce)
global	$ywusr_status_of_orders_viewedon, $yecomm_order_ord_txtstatx, $yecomm_order_ord_txtstat, 
	$yecomm_order_status_unknown, $yecomm_order_status_valid, $yecomm_order_status_valid_wait, 
	$yecomm_order_status_invalid, $yecomm_order_status_invalid_wait ;

//number format
global	$warp_numform_decimal_sep, $warp_numform_thousand_sep ;

global	$REQUEST_METHOD, $QUERY_STRING, $y_warp_direct_file_acc_msg_reff ;

//sec
global	$wrshruid_xhlock_fct_usr_id ;

//meta
global	$warp_meta_author, $warp_meta_copyright ;

//prn restrict
global	$y_warp_news_restrict_prn_acc, $y_warp_events_restrict_details_prn,
	$ywarp_forum_restrict_tr_prn, $y_warp_prods_restrict_prn ;


//-------------------

$xid = rawurldecode("$xid");
$xop = rawurldecode("$xop");
$xop = base64_decode("$xop");

$yw_internal_prn_authentifx = 'n';
if ($admacc != 'admin') {
	if ( (($xop == 'news') AND ($y_warp_news_restrict_prn_acc == 'y')) OR 
	     (($xop == 'events') AND ($y_warp_events_restrict_details_prn == 'y')) OR
	     (($xop == 'topic') AND ($ywarp_forum_restrict_tr_prn == 'y')) OR
	     (($xop == 'reply') AND ($ywarp_forum_restrict_tr_prn == 'y')) OR
	     (($xop == 'products') AND ($y_warp_prods_restrict_prn == 'y')) ) {
		xsecure_header ('xwndz');
		$yw_internal_prn_authentifx = 'y';
	} //end if
} //end if
else {
	xsecure_admin_header ();
} //end else

//---------------------the header
echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n");
echo ("<!--:: xantis.warp.cms :: Xantis Warp - Content Management Server - v.1.2 :: ".$y_warp_xdate." :: ".$y_warp_xtime." :: -->\n");
echo ("<html>\n<head>\n<title>$y_warp_print_ready_txt</title>\n");
echo ("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
echo ("<meta name=\"resource-type\" content=\"document\">\n");
echo ("<meta name=\"author\" content=\"$warp_meta_author\">\n");
echo ("<meta name=\"copyright\" content=\"$warp_meta_copyright\">\n");
echo ("<meta name=\"GENERATOR\" content=\"xantis.warp.cms\">\n");
echo ("</head>\n");
echo ("<body bgcolor=\"#666666\" text=\"#000000\">\n");
echo ("<!-- start page content -->\n\n");


//check request method
if ( ($REQUEST_METHOD <> 'POST') OR (!empty($QUERY_STRING)) ) {
	xzerr_die_after_header ($y_warp_direct_file_acc_msg_reff);
} //end if


if ( ($admacc != 'admin') AND ($yw_internal_prn_authentifx == 'y') ) {
	//------------------------ check user auth
	xrecheck_secure_header_ret_usrid ('x');
	//------------------------
} //end if


//get user
$WARP_B64_ENC_AUTH_PASSW = base64_encode($PHP_AUTH_PW);
xmysql_read_data ("SELECT id from users WHERE ( (usr_name='$PHP_AUTH_USER') AND (usr_pass='$WARP_B64_ENC_AUTH_PASSW') ) ");
$hvzx_prn_usr_id = $arr_var_result[0];



//-------------start table
echo ("<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">");
echo ("<tr>\n<td colspan=\"1\" width=\"100%\" bgcolor=\"#FFFFFF\" valign=\"top\">");


//#####################################

//------------------------NEWS

if ($xop == 'news') {


	xmysql_read_data ("SELECT title, w_date, news FROM news WHERE (id='$xid') ");
	//$arr_var_result;

	echo ('<br>');
	xtext_print (
		"<b>[ $ywebsite_name / $y_warp_news_text ]</b> - <i>$y_warp_xdate :: $y_warp_xtime</i><br><br>".
		"<b>[ $y_warp_news_subj : $arr_var_result[0] ]</b><br>".
		"<hr size=\"1\" noshade><br>".
		"<i>$y_warp_news_text :</i><br>".
		xprint_remove_colors ($arr_var_result[2]).'<br>'.
		"<hr size=\"1\" noshade><br>".
		"<i>[ $y_warp_news_date : $arr_var_result[1] ]</i><br>".
		"<br>"
	);

}//end if


//------------------------EVENTS

if ($xop == 'events') {


	xmysql_read_data ("SELECT title, s_date, e_date, event FROM events WHERE (id='$xid') ");
	//$arr_var_result;

	echo ('<br>');
	xtext_print (
		"<b>[ $ywebsite_name / $y_warp_events_text ]</b> - <i>$y_warp_xdate :: $y_warp_xtime</i><br><br>".
		"<b>[ $y_warp_events_subj : $arr_var_result[0] ]</b><br>".
		"<hr size=\"1\" noshade><br>".
		"<i>[ $y_warp_events_sdate : <b>$arr_var_result[1]</b> ]</i><br>".
		"<i>[ $y_warp_events_edate : <b>$arr_var_result[2]</b> ]</i><br><br>".
		"<i>$y_warp_events_view_details :</i><br>".
		xprint_remove_colors ($arr_var_result[3]).'<br>'.
		"<hr size=\"1\" noshade><br>"
	);

}//end if


//------------------------FORUM TOPIC

if ($xop == 'topic') {

	xmysql_read_data ("SELECT subject, message, sender, w_date, w_time, id, block FROM forum_topics WHERE (id='$xid') ");
	$arr_prn_tmp_res=$arr_var_result;
	xmysql_read_data ("SELECT name FROM forum_categs WHERE (id='$arr_prn_tmp_res[6]') ");

	echo ('<br>');
	xtext_print (
		"<b>[ $ywebsite_name / $yforum_forum_title_short / $yforum_topics ]</b> - <i>$y_warp_xdate :: $y_warp_xtime</i><br>".
		"<b>[ <i>$yforum_categ_title_selected :</i> $arr_var_result[0] / <i>$yforum_topic_title_selected :</i> # $arr_prn_tmp_res[5] ]</b><br><br>".
		"<b>[ $yforum_subject : $arr_prn_tmp_res[0] ]</b><br>".
		"<i>[ $yforum_sender : $arr_prn_tmp_res[2] ]</i><br>".
		"<hr size=\"1\" noshade><br>".
		"<i>$yforum_message :</i><br>".
		xprint_remove_colors ($arr_prn_tmp_res[1]).'<br>'.
		"<hr size=\"1\" noshade><br>".
		"<i>$yforum_created_on : $arr_prn_tmp_res[4] - $arr_prn_tmp_res[3]</i><br>".
		"<br>"
	);

}//end if

//------------------------FORUM REPLY

if ($xop == 'reply') {

	xmysql_read_data ("SELECT subject, message, sender, w_date, w_time, id, block FROM forum_replies WHERE (id='$xid') ");
	$arr_prn_tmp_res=$arr_var_result;
	xmysql_read_data ("SELECT subject, block FROM forum_topics WHERE (id='$arr_prn_tmp_res[6]') ");
	$arr_prn_tmp_res_xx=$arr_var_result;
	xmysql_read_data ("SELECT name FROM forum_categs WHERE (id='$arr_prn_tmp_res_xx[1]') ");

	echo ('<br>');
	xtext_print (
		"<b>[ $ywebsite_name / $yforum_forum_title_short / $yforum_replies ]</b> - <i>$y_warp_xdate :: $y_warp_xtime</i><br>".
		"<b>[ <i>$yforum_categ_title_selected :</i> $arr_var_result[0] / <i>$yforum_topic_title_selected : </i> # $arr_prn_tmp_res[6] ($arr_prn_tmp_res_xx[0]) / <i>$yforum_reply_title_selected :</i> # $arr_prn_tmp_res[5] ]</b><br><br>".
		"<b>[ $yforum_subject : $arr_prn_tmp_res[0] ]</b><br>".
		"<i>[ $yforum_sender : $arr_prn_tmp_res[2] ]</i><br>".
		"<hr size=\"1\" noshade><br>".
		"<i>$yforum_message :</i><br>".
		xprint_remove_colors ($arr_prn_tmp_res[1]).'<br>'.
		"<hr size=\"1\" noshade><br>".
		"<i>$yforum_created_on : $arr_prn_tmp_res[4] - $arr_prn_tmp_res[3]</i><br>".
		"<br>"
	);

}//end if



//------------------------PRODUCTS

if ($xop == 'products') {

	xmysql_read_data ("SELECT id, p_code, title, description, full_detail, u_m, price, weight_g, pict_b, e_comm, e_deliver, categ_id, promo, promo_txt  FROM prod_items WHERE (id='$xid') ");
	$arr_prod_result = $arr_var_result;

	xmysql_read_data ("SELECT title FROM prod_categs WHERE (id='$arr_prod_result[11]') ");
	//$arr_var_result

	$y_local_itm_typx = xestab_ptyp ($yecomm_active, $arr_prod_result[9], $arr_prod_result[6]);

	//-----head, categ, title, code
	echo ('<br>');
	xtext_print (
		"<b>[ $ywebsite_name / $yprods_show_title ]</b> - <i>$y_warp_xdate :: $y_warp_xtime</i><br>".
		"<b>[ <i>$yprods_categ_title_xs_short :</i> $arr_var_result[0] ]</b><br><br>".
		"<b>[ <i>$yprods_item_code_full :</i> $arr_prod_result[1] ]</b><br>".
		"<b>[ <i>$yprods_item_pname :</i> $arr_prod_result[2] ]</b><br><br>"
	);

	if ($arr_prod_result[12] == '1') {
		xtext_print ("<i>$yprods_item_promo </i> $arr_prod_result[13]<br><br>");
	} //end if

	//-----pict
		if (substr($arr_prod_result[8], -4, 4) == '.swf') {
		xcenter_start ();
			xtext_print ("<hr size=\"1\" noshade><br>");
			xwriteflash_nobg ("$ywebsite_addr"."$y_warp_pitm_picts_dir".'/'."$arr_prod_result[8]", '400', '250');
			xtext_print ("<hr size=\"1\" noshade><br>");
		xcenter_end ();
	} //end if
	elseif (!empty($arr_prod_result[8])) {
		xcenter_start ();
			xtext_print ("<hr size=\"1\" noshade><br>");
			xpict ("$ywebsite_addr"."$y_warp_pitm_picts_dir".'/'."$arr_prod_result[8]", '400', '250');
			xtext_print ("<hr size=\"1\" noshade><br>");
		xcenter_end ();
	} //end elseif


	//-----description

	//check price
	if ($y_local_itm_typx <> 'x') {
		$y_itm_price = number_format($arr_prod_result[6], 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
	} //end if
	else {
		$y_itm_price = $yprods_item_noprice;
	} //end else


	if ($arr_prod_result[10] == 'p') {
		$y_itm_weight = number_format($arr_prod_result[7], 0, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
		$y_itm_weight = $y_itm_weight.' '."$yprods_item_weight_um";
		$y_itm_weight = "$yprods_item_weight".' : '."$y_itm_weight";
	} //end if
	else {
		$y_itm_weight = 'xno';
	}



	xtext_print (
		"<i>$yprods_item_descr :</i><br>".
		"$arr_prod_result[3]<br><br>".
		"<i>$yprods_item_details :</i><br>".
		xprint_remove_colors ($arr_prod_result[4]).'<br><br>'.
		"<i>$yprods_item_specifications :</i><br>".
		"$yprods_item_package : $arr_prod_result[5]<br>"
	);

	//show postal delivery note if sell online and pst
	if ( ($y_local_itm_typx == 'e') AND ($arr_prod_result[10] == 'p') ) {

		//show weight if have
		if ($y_itm_weight <> 'xno') {
			xtext_print ("$y_itm_weight".'<br>');
		} //end if

		xtext_print (
			'<br><i>'."$yprods_item_delivery_method".' : '.'</i><br>'.
			"$yprods_item_delivery_method_p".'<br>'.
			"$yprods_item_delivery_pst_note".'<br>'
		);

	} //end if

	//show download delivery note if sell online and dwn
	if ( ($y_local_itm_typx == 'e') AND ($arr_prod_result[10] == 'd') ) {
		xtext_print (
			'<br><i>'."$yprods_item_delivery_method".' : '.'</i><br>'.
			"$yprods_item_delivery_method_d".'<br>'.
			"$yprods_item_delivery_dwn_note".'<br>'
		);

	} //end if

	//show download delivery note if sell online and service
	if ( ($y_local_itm_typx == 'e') AND ($arr_prod_result[10] == 's') ) {
		xtext_print (
			'<br><i>'."$yprods_item_delivery_method".' : '.'</i><br>'.
			"$yprods_item_delivery_method_s".'<br>'
		);
	} //end if


	//the price
	$y_crr_active = '/crr_'."$yprods_item_crr".'.jpg';

	xtext_print ('<br><i>'."$yprods_item_price".' :</i> '."$y_itm_price");

	if ($y_local_itm_typx <> 'x') {
		echo ('&nbsp;');
		xpict ("$ywebsite_addr"."$y_warp_crr_dir"."$y_crr_active", '20', '20');
		echo ('<br>');
		xtext_print ("$yprods_item_crr_expl");
	} //end if

	echo ('<br>');
	echo ('<br>');


}//end if


//------------------------ORDERS E-COMMERCE

if ($xop == 'orders') {


	if ($admacc != 'admin') {
		xmysql_read_data ("SELECT details_htm, comments, payed, confirmed FROM orders WHERE ( ( ord_id='$xid' ) AND (usr_id='$hvzx_prn_usr_id') ) ");
	} //end if
	else {
		xmysql_read_data ("SELECT details_htm, comments, payed, fulfilled FROM orders WHERE ( id='$xid' ) ");
	} //end else

	$ylocal_msg_ord_stats = $yecomm_order_status_unknown;
	if ($arr_var_result[2] == 'y') {
		if ($arr_var_result[3] == 'y') {
			$ylocal_msg_ord_stats = $yecomm_order_status_valid;
		} //end if
		else {
			$ylocal_msg_ord_stats = $yecomm_order_status_valid_wait;
		} //end else
	} //end if
	else {
		if ($arr_var_result[3] == 'y') {
			$ylocal_msg_ord_stats = $yecomm_order_status_invalid;
		} //end if
		else {
			$ylocal_msg_ord_stats = $yecomm_order_status_invalid_wait;
		} //end else
	} //end else


	echo ('<br>');
	echo (xdex_warp_decrypt ("$arr_var_result[0]"));
	echo ('<br>');
	xtext_print (
		"<hr size=\"1\" noshade>".
		"$ywusr_status_of_orders_viewedon".' : '.'<b>'."$y_warp_xdate".' - '."$y_warp_xtime".'</b><br>'.
		"$yecomm_order_ord_txtstat".' : '.'<b>'."$ylocal_msg_ord_stats".'</b><br>'.
		"$yecomm_order_ord_txtstatx".' : '.'<br>'.
		'<i>'."$arr_var_result[1]".'</i><br>'.
		"<hr size=\"1\" noshade>"
	) ;
	echo ('<br>');

}//end if


//#####################################

//-------------end table
echo ("</td>\n</tr>\n</table>");

//bring focus
echo ( 
	"<script type=\"text/javascript\" language=\"JavaScript\">\n".
	"<!-- \n".
	"window.focus('');\n".
	" //-->\n".
	"</script>\n"
);

//---------------------//footer
echo ("\n\n<!-- end page content -->\n");
echo ("</body>\n</html>\n");


//#####################################################

} //END FUNCTION



//----------------------------------------

if ($ysecure == 'printok') {
	xprint_app ();
} //end if

//----------------------------------------


// end of php code
?>
Return current item: Warp.cms - php/mysql content management