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

// [xw warp main display 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);

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


$xnt_control_var = 'xnt2002warp.cms';
$warp_module_var_check_auth = 'x99warpv12.cms';

require("lib_adv.php");


//check session
if (strlen($wpsid) < '32') {
	$hlocal_sess_req_redr = "$ywebsite_addr".'xindex.php';
	header("Location: $hlocal_sess_req_redr");
} //end if


//check page id
if (empty ($wpqid)) {
	$wpqid = $ywarp_homepage_id;
} //end if



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

//---------------------------------------------------------read page content

//read page content
$arr_page_result = array();
xmysql_read_data ("SELECT title, content, hasmenu, block, comments, hasvoting, whvoting, hasbanner, whbanner, userarea, init_seq FROM content_pages WHERE ( (id ='$wpqid') AND (active='y') ) " );
//move into another var
$arr_page_result = $arr_var_result;

//get init_seq
eval(' '."\n"."$arr_page_result[10]".' '."\n");

//---------------------------------------------------------page header

// set page header
if ( ($arr_page_result[9] == 'y') OR ($mod_req_sec == 'y') ) {
	xheader ("$arr_page_result[0]", 'secure');
} //end if
else {
	xheader ("$arr_page_result[0]", '');
} //end else

xshow_page_title ("$arr_page_result[0]", "$wpsid");
xnewline ();

if ( ($arr_page_result[9] == 'y') OR ($mod_req_sec == 'y') ) {
	//------------------------ check user auth
	xrecheck_secure_header_ret_usrid ('y');
	//------------------------
} //end if

//---------------------------------------------------------page register

//page register
$y_main_xregister_visited_page = '<'.$wpqid.'>, ';
xmysql_read_data ("SELECT w_visited FROM counter WHERE (w_sess='$wpsid') ");
if (!stristr($arr_var_result[0], $y_main_xregister_visited_page)) {
	xmysql_write_data ("UPDATE counter SET w_visited=CONCAT(w_visited, '$y_main_xregister_visited_page') WHERE (w_sess='$wpsid') ");
} //end if

//---------------------------------------------------------up main menu

xshow_section_menu_start ();

xmysql_read_data ("SELECT title, h_page FROM content_sections WHERE ( (block = 'u') AND (active='y') ) ORDER BY position ASC");
$arr_count = count($arr_var_result);
for ($i=0; $i < $arr_count; $i++) {
	$i_name = $i;
	$i_page = $i +1;
	$i = $i + 1;

	xtext_small ('|');
	xtext_link ("$arr_var_result[$i_name]", "$ywebsite_addr"."xw_main.php"."?wpqid=$arr_var_result[$i_page]&wpsid=$wpsid", '_self');
}//end for
	xtext_small ('|');

xshow_section_menu_end ();

xnewline ();

//---------------------------------------------------------page display


if ( ($arr_page_result[2] == 'y') OR ($arr_page_result[5] == 'y') OR ($arr_page_result[7] == 'y') OR ($arr_page_result[4] <> '') ) {
	$ymenu_width_corrected = $ymenu_width;
	$yspace_width_corrected = $yspace_width;
	$ydisplay_width_corrected = $ydisplay_width;
} else {
	$ymenu_width_corrected = '0';
	$yspace_width_corrected = '0';
	$ydisplay_width_corrected = $ywarp_max_display_cfg;
} //end if


xcenter_start ();

xtable_start ("$ywarp_max_display_cfg");

xtable_row_start ();

//------------------------------------page left

if ($ymenu_width_corrected <> '0') {

xtable_column_start ('1', "$ymenu_width_corrected", "$ysite_back_color");


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

//if menu
	if ($arr_page_result[2] == 'y') {

		$warp_menu_now =  $arr_page_result[3];
		xmysql_read_data ("SELECT title, id FROM content_pages WHERE ( (block = '$warp_menu_now') AND (active='y') ) ORDER BY menu_pos ASC");

		xshow_left_module_start ("$ymenu_name");

		$arr_count = count($arr_var_result);
		if ($arr_count > 2) {
			for ($i=0; $i < $arr_count; $i++) {
				$i_name = $i;
				$i_page = $i +1;
				$i = $i + 1;

				xtext_link ("$arr_var_result[$i_name]", "$ywebsite_addr"."xw_main.php"."?wpqid=$arr_var_result[$i_page]&wpsid=$wpsid", '_self');
				xnewline ();
			} //end for
		} //end if

		//user
		$xwm_width_01 = '40';
		$xwm_width_02 = $ymenu_width - $xwm_width_01;

		xtable_start('100%');

		if ($arr_count > 2) {
			xtable_row_start ();
				xtable_column_start ('2', '', "$ymain_color");
					xvline ("100%");
				xtable_column_end ();
			xtable_row_end ();
		} //end if

		xtable_row_start ();
			xtable_column_start ('1', "$xwm_width_01", "$ymain_color");
				xspace();
				xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."usr_accnt.jpg", '30', '30', "$ywusr_user_areatlx");
			xtable_column_end ();

			xtable_column_start_vcenter ('1', "$xwm_width_02", "$ymain_color");
				xtext_link ("$y_warp_profile_text", "$ywebsite_addr"."usr_prof.php?wpsid=$wpsid", '_self');
				xnewline ();
				if ($warp_user_can_register == 'y') {
					xtext_link ("$y_warp_new_user_text", "$ywebsite_addr"."usr_reg.php?wpsid=$wpsid", '_self');
					xnewline ();
				} //end if
				xtext_link ("$ywusr_password_fgt_retrieve", "$ywebsite_addr"."usr_fgt.php?wpsid=$wpsid", '_self');
				xnewline ();
			xtable_column_end ();
		xtable_row_end ();

		xtable_row_start ();
			xtable_column_start ('2', "$ymenu_width", "$ymain_color");
				xvline('100%');
			xtable_column_end ();
		xtable_row_end ();

		xtable_row_start ();
			xtable_column_start ('1', "$xwm_width_01", "$ymain_color");
				xspace();
				xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."contact_us.jpg", '30', '30', "$ywusr_user_areatlx");
			xtable_column_end ();

			xtable_column_start_vcenter ('1', "$xwm_width_02", "$ymain_color");
				xtext_link ("$ywusr_adm_cont_lnk_txt", "$ywebsite_addr"."adm_contact.php?wpsid=$wpsid", '_self');
				xnewline ();
				xtext_link ("$ywusr_adm_cont_lnkoff_txt", "$ywebsite_addr"."adm_contact.php?wpsid=$wpsid&opvar=office", '_self');
				xnewline ();
			xtable_column_end ();
		xtable_row_end ();

		xtable_end();

		xshow_left_module_end ();

		xnewline ();

	} //end if


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

//if banner
	if ($arr_page_result[7] == 'y') {

		xmysql_read_data ("SELECT pict_url, id FROM banners WHERE (id='$arr_page_result[8]')");

		xshow_left_module_start ("$ytxtbanners_name");
			xcenter_start();

				if (substr($arr_var_result[0], -4, 4) == '.swf') {
					xwriteflash_nobg_var ("$ywebsite_addr"."flash_banner.swf",
						"&yurl=".rawurlencode($arr_var_result[0]).
						"&xurl=".rawurlencode("$ywebsite_addr"."req_redir.php?xid=$arr_var_result[1]&xop=xbann&wpsid=$wpsid").
						"&"
					, '150', '250');
				} //end if
				else {
					xpict_link ($arr_var_result[0], '', '150', '250', "$ywebsite_addr"."req_redir.php?xid=$arr_var_result[1]&xop=xbann&wpsid=$wpsid", '_blank');
				} //end elseif

			xcenter_end();
		xshow_left_module_end ();
		xnewline ();

	} //end if

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

//if voting
	if ($arr_page_result[5] == 'y') {

		xmysql_read_data ("SELECT id, name, type, acc FROM voting_sections WHERE (id ='$arr_page_result[6]') ");
		$voting_question = $arr_var_result[1];
		$voting_type = $arr_var_result[2];
		if ($arr_var_result[3] == 'y') {
			$voting_access = '['.$yvoting_access_text.' : '.$yvoting_restricted_text.']' ;
		} //end if
		else {
			$voting_access = '['.$yvoting_access_text.' : '.$yvoting_public_text.']' ;
		} //end else
		xmysql_read_data ("SELECT id, name FROM voting_quest WHERE (block ='$arr_page_result[6]') ORDER BY id ASC");

		xshow_left_module_start ("$yvoting_name");

			xtext_small ("$voting_question");
			xnewline ();

			$local_ysecure = base64_encode ("xvoteok");
			$local_ysecure = rawurlencode ("$local_ysecure");

			xform_start ('voting', "$ywebsite_addr"."castvote.php");
				xform_hidden ('vqsid', "$arr_page_result[6]");
				xform_hidden ('vtyp', "$voting_type");
				xform_hidden ('ysec', "$local_ysecure");
				xform_hidden ('wpqid', "$wpqid");
				xform_hidden ('wpsid', "$wpsid");

				$icnt = '0';
				$arr_count = count($arr_var_result);
				for ($i=0; $i < $arr_count; $i++) {
					$i_id = $i;
					$i_name = $i +1;

					if ($voting_type == 'm') {
						xform_check_box ("vqid[$icnt]", "$arr_var_result[$i_id]");
					} //end if
					else {
						xform_radio_bttn ("vqid", "$arr_var_result[$i_id]");
					} //end else
					xtext_small ("$arr_var_result[$i_name]");
					xnewline ();

					$i = $i + 1;
					$icnt = $icnt + 1;

				} //end for

				xform_hidden ('yoptmax', "$icnt");
				xnewline ();
				xcenter_start ();
					xform_send_bttn ("$yvoting_bttn_txt");
				xcenter_end ();
			xform_end ();
			xcenter_start();
				xtext_small ('&nbsp;<i>'."$voting_access".'</i>');
			xcenter_end ();

		xshow_left_module_end ();

		xnewline ();

	} //end if


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

//if not empty show comments

	//comment
	if ($arr_page_result[4] <> '') {
		xshow_left_module_start ("$ytxtcomments_name");
			xtext_small ($arr_page_result[4]);
			xnewline ();
		xshow_left_module_end ();
		xnewline ();
	} //end if


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

xtable_column_end ();

xtable_column_start ('1', "$yspace_width_corrected", "$ysite_back_color");
	xspace ();
xtable_column_end ();

} //end if


//------------------------------------page right

xtable_column_start ('1', "$ydisplay_width", "$ysite_back_color");
	$wp_page = "\n"."?>"."\n".$arr_page_result[1]."<?php\n\n";
	eval("$wp_page");
xtable_column_end ();

xtable_row_end ();

xtable_end ();
xcenter_end ();

xnewline ();


//---------------------------------------------------------down main menu

xshow_section_menu_start ();

xmysql_read_data ("SELECT title, h_page FROM content_sections WHERE ( (block = 'd') AND (active='y') ) ORDER BY position ASC");
$arr_count = count($arr_var_result);
for ($i=0; $i < $arr_count; $i++) {
	$i_name = $i;
	$i_page = $i +1;
	$i = $i + 1;

	xtext_small ('|');
	xtext_link ("$arr_var_result[$i_name]", "$ywebsite_addr"."xw_main.php"."?wpqid=$arr_var_result[$i_page]&wpsid=$wpsid", '_self');
}
	xtext_small ('|');


xshow_section_menu_end ();
xnewline ();
xnewline ();


//---------------------------------------------------------page footer

xfooter ();

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