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

// [links 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


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

if ($warp_module_var_check_auth != 'x99warpv12.cms') {
	$y_hlocalmodz_xdate = date("Y-m-d");
	$y_hlocalmodz_xtime = date("H:i:s");
	$wpmod_xdyech =	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n".
			"<!--:: xantis.warp.cms :: Xantis Warp - Content Management Server - v.1.2 :: $y_hlocalmodz_xdate :: $y_hlocalmodz_xtime :: -->\n".
			"<html>\n".
			"<head>\n".
			"<title>! ! !</title>\n".
			"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n".
			"</head>\n".
			"<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n".
			"<br>\n".
			"<div align=\"center\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash6/cabs/swflash.cab#version=6,0,0,0\" width=\"30\" height=\"30\">\n".
			"<param name=\"movie\" value=\"flagger.swf\">\n".
			"<param name=\"flashvars\" value=\"&xaction=err&\">\n".
			"<param name=\"quality\" value=\"high\">\n".
			"<param name=\"bgcolor\" value=\"#FFFFFF\">\n".
			"<param name=\"menu\" value=\"false\">\n".
			"<embed src=\"flagger.swf\" flashvars=\"&xaction=err&\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"30\" height=\"30\" menu=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n".
			"</object>\n".
			"</div>\n".
			"</body>\n".
			"</html>\n" ;
	die("$wpmod_xdyech");
} //end if


//--------------------- data display links


function xshow_rep_links_data ($ytitle, $yurl, $ytext, $yidx, $yrankx) {

	global 	$ybar_color, $y_warp_print_text;
	global 	$ymain_color, $y_warp_picts_dir, $ywebsite_addr;
	global 	$ydisplay_width_corrected;
	global	$wpsid, $y_warp_links_hits, $y_warp_links_report;

	$ysize = $ydisplay_width_corrected;
	$ysize_icon = '40';
	$ysize_prn = '40';
	$ysize_date = $ysize - ($ysize_icon + $ysize_prn);

xtable_start ("$ysize");

	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ybar_color");
			xtext_title ("$ytitle");
		xtable_column_end ();
	xtable_row_end ();

	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ymain_color");
			xvline ("$ysize");
		xtable_column_end ();
	xtable_row_end ();


	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ymain_color");

		xtable_start ("$ysize");

		xtable_row_start ();

			//the icon
			xtable_column_start ('1', "$ysize_icon", "$ymain_color");
				xspace ();
				xpict ("$ywebsite_addr"."$y_warp_picts_dir".'/links.jpg', '30', '30');
			xtable_column_end ();

			//the url and rank
			xtable_column_start ('1', "$ysize_date", "$ymain_color");

				xspace ();

				$op_var = "$ywebsite_addr"."req_redir.php?xid=$yidx&xop=xlnk&wpsid=$wpsid";
				xtext_link ("$yurl", "$op_var", '_blank');

				xspace ();
				xtext_small ('[ '."$y_warp_links_hits".' '."$yrankx".' ]');

			xtable_column_end ();

			//the prn
			xtable_column_start ('1', "$ysize_prn", "$ymain_color");

				xcenter_right_start ();
					$hxtt_link_reff_text = rawurlencode("$y_warp_links_report - [id=$yidx]");
					xpict_link ("$ywebsite_addr"."$y_warp_picts_dir".'/redir_mini.jpg', "$y_warp_links_report", '20', '20', "$ywebsite_addr"."adm_contact.php?wpsid=$wpsid&vxmsgx=$hxtt_link_reff_text", '_self');
					xspace ();
				xcenter_end ();

			xtable_column_end ();

		xtable_row_end ();

		xtable_end ();

		xtable_column_end ();
	xtable_row_end ();
	
	//the details
	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ymain_color");
			xtext_small ("$ytext");
			xnewline ();
			xvline ("$ysize");
		xtable_column_end ();
	xtable_row_end ();


xtable_end ();

} //end function
//----------------




function links_module () {
//-------------------


//remote and lib vars
global	$ywebsite_addr, $arr_var_result, $var_result_size, $wpqid, $wpsid ;

//cfg vars
global	$ydisplay_width_corrected, $ysite_back_color, $ybar_menu_color ;
global	$y_warp_total_text, $y_warp_filter_text, $y_warp_filter_text_bttn, $y_warp_filter_hint, $ymain_color, $ysmall_text_color ;
global	$y_warp_prev_text, $y_warp_next_text, $y_warp_filtered_text, $y_warp_picts_dir, $y_warp_filter_remove, $y_warp_filter_sign;

//links cfg vars
global	$y_warp_links_text, $y_warp_max_links_perpage, $y_warp_links_subj, $y_warp_links_descr, $y_warp_links_url ;

//local vars
global	$qval,	$offset;


//vars
$y_db_tablename = "links";
$limit = $y_warp_max_links_perpage;
$xdesired_fields = 'title, url, description, rank_h, id';

//------------------------------------------------------search process
//vars
$qval = rawurldecode($qval);
$qwval_src = trim($qval);
$qwval_src_arr = array ();
$qwval_src_arr = explode("$y_warp_filter_sign", $qwval_src);
$qval_url = rawurlencode(stripslashes($qval));
$xurl = "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=0";
//----------------------------------------

//filter empties
$qwval_src_arr_new = array ();
for ($i=0 ; $i<count($qwval_src_arr) ; $i++) {
	if ( trim($qwval_src_arr[$i]) <> '' ) {
		array_push ($qwval_src_arr_new, trim($qwval_src_arr[$i]));
	} //end if
} //end for

//build the querry
if (count($qwval_src_arr_new) <> '0') {
	$w_querryx_bld = " WHERE ";
	for ($i=0 ; $i<count($qwval_src_arr_new) ; $i++) {
		$w_querryx_bld_i = $qwval_src_arr_new[$i];
		$w_querryx_bld = " ".$w_querryx_bld." ( (title LIKE '%".$w_querryx_bld_i."%') OR (description LIKE '%".$w_querryx_bld_i."%') OR (url LIKE '%".$w_querryx_bld_i."%') ) ";
		if ($i <> ( count($qwval_src_arr_new) - 1 ) ) {
			$w_querryx_bld = $w_querryx_bld." AND " ;
		} //end if
	} //end for
} //end if

//[set text if filtered] or [empty querry]
$w_src_filteredby = " - ".$y_warp_filtered_text ;
if (count($qwval_src_arr_new) == '0') {
	$w_querryx_bld = ' ';
	$w_src_filteredby = '';
} //end if

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


//---------------------
if (empty($offset)) {
   $offset = 0;
}
//---------------------

	$w_querryx = "  ".$w_querryx_bld." ";

	$wquerry_main = "SELECT $xdesired_fields FROM $y_db_tablename ".$w_querryx;

	$wquerry_main_c = "SELECT COUNT(*) FROM $y_db_tablename ".$w_querryx;

	xmysql_count_data ($wquerry_main_c);
	xmysql_read_data ($wquerry_main." ORDER BY id DESC LIMIT $offset, $limit");


//---------------------------------------------
	//vars
	$newoffsetnext = $offset + $limit ;
	$newoffsetprev = $offset - $limit ;
	$offsetlistedmin = $offset + 1;

	if ($newoffsetnext <= $var_result_size) {
		$offsetlistedmax = $newoffsetnext;
	} //end if
	else {
		$offsetlistedmax = $var_result_size;
	} //end else

	if ($offsetlistedmax == 0) {
		$offsetlistedmin = 0;
	} //end if
//---------------------------------------------


//=====================================


xtable_start ("$ydisplay_width_corrected");
	xtable_row_start ();
		xtable_column_start ('1', '', "$ysite_back_color");
			xcenter_start ();

				xwriteflash_nobg_var ("$ywebsite_addr"."src_frm.swf",
					"&flash_form_backcolor=".rawurlencode($ymain_color).
					"&flash_form_textcolor=".rawurlencode($ysmall_text_color).
					"&flash_form_text_flby=".rawurlencode($y_warp_filter_text).
					"&flash_form_text_hint=".rawurlencode($y_warp_filter_hint).
					"&flash_form_text_bttn=".rawurlencode($y_warp_filter_text_bttn).
					"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/links.jpg').
					"&flash_form_listall=".rawurlencode($y_warp_filter_remove).
					"&qval_hint=".rawurlencode("[$y_warp_links_subj | $y_warp_links_descr | $y_warp_links_url]").
					"&qval=".$qval_url.
					"&xurl=".rawurlencode("$xurl").
					"&"
				, '500', '40');


			xcenter_end ();
		xtable_column_end ();
	xtable_row_end ();
xtable_end ();

xnewline ();


//====================

xtable_start ("$ydisplay_width_corrected");
	xtable_row_start ();
		xtable_column_start ('1', '', "$ybar_menu_color");
			xtext_small ('|');
			xspace ();
			xtext_small ("<b>$y_warp_links_text</b> [<b>$offsetlistedmin</b> - <b>$offsetlistedmax</b> (<b>$var_result_size</b> $y_warp_total_text)]"."$w_src_filteredby");
			xspace ();
			xtext_small ('|');
		xtable_column_end ();

		xtable_column_start ('1', '', "$ybar_menu_color");
			xcenter_right_start ();
				xtext_small ('|');
					xspace ();
					//Show PREV
					if ($newoffsetprev >= 0) {
						xtext_link ("$y_warp_prev_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetprev&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if

					//Show NEXT
					if ($newoffsetnext < $var_result_size) {
						xtext_link ("$y_warp_next_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetnext&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if
			xcenter_end ();
		xtable_column_end ();
	xtable_row_end ();
xtable_end ();

xnewline ();

//=====================================


$arr_count = count($arr_var_result);
for ($i=0; $i < $arr_count; $i++) {
	$i_title = $i;
	$i_url = $i +1;
	$i_descr = $i + 2;
	$i_rank = $i + 3;
	$i_id = $i + 4;
	$i = $i + 4;

	xshow_rep_links_data ($arr_var_result[$i_title], $arr_var_result[$i_url], $arr_var_result[$i_descr], $arr_var_result[$i_id], $arr_var_result[$i_rank]);

	xnewline ();
} //end for


//====================

xtable_start ("$ydisplay_width_corrected");
	xtable_row_start ();
		xtable_column_start ('1', '', "$ybar_menu_color");
			xtext_small ('|');
			xspace ();
			xtext_small ("<b>$y_warp_links_text</b> [<b>$offsetlistedmin</b> - <b>$offsetlistedmax</b> (<b>$var_result_size</b> $y_warp_total_text)]"."$w_src_filteredby");
			xspace ();
			xtext_small ('|');
		xtable_column_end ();

		xtable_column_start ('1', '', "$ybar_menu_color");
			xcenter_right_start ();
				xtext_small ('|');
					xspace ();
					//Show PREV
					if ($newoffsetprev >= 0) {
						xtext_link ("$y_warp_prev_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetprev&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if

					//Show NEXT
					if ($newoffsetnext < $var_result_size) {
						xtext_link ("$y_warp_next_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetnext&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if
			xcenter_end ();
		xtable_column_end ();
	xtable_row_end ();
xtable_end ();

xnewline ();

//=====================================


}//-------------------end function



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

//links_module ();

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

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