######################################################################################
sub blogLinks() {

	my ($cidSQL);


	print qq~


	<div align=center>
        <!--/* OpenX Javascript Tag v2.7.25-beta (Rich Media - Doubleclick) */-->

<script type='text/javascript'><!--//<![CDATA[
   document.MAX_ct0 ='%c';

   var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=359");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
       document.write ("&amp;ct0=" + escape(document.MAX_ct0));
   }
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://d1.openx.org/ck.php?n=a7202cab&amp;cb=%n' target='_blank'><img src='http://d1.openx.org/avw.php?zoneid=359&amp;cb=%n&amp;n=a7202cab&amp;ct0=%c' border='0' alt='' /></a></noscript>
	</div>

	$DIVIDER

	~;

	printContentBrowser();

	print qq~

	$DIVIDER

	<table class=data width=100%>
	<form name=search action=searchBlogs.cgi>
		<input type=hidden name=cid value=$cid>
		<input type=hidden name=club_id value=$club_id>
	<tr><th style=text-align:left colspan=2>$blogStr Quick Search</th></tr>
	<tr >
	<td width=50%><input name=keywords size=19></td>
	<td><input type=submit name=Search value=Go>
	</td></tr></form></table>

	$DIVIDER


	<table class=data width=100%>
	<tr><th style=text-align:left nowrap>Most Active $bloggerStr</th></tr>
	~;

	#### Set Filters
	if ($HBCU) {
	  $hbcuSQL = "and (b.hbcu like '$HBCU' or a.associated_hbcu like '$HBCU')";
	}

	#### need to set cid sql
	if ($cid) { $cidSQL = "cid=$cid"; } 
	else { $cidSQL = "cid>=0"; }

	$sql="select name,a.registry_id,count(a.registry_id) as posts from blogs as a
		left join registry_data as b on a.registry_id=b.registry_id WHERE $cidSQL
		$hbcuSQL and name<>'' group by a.registry_id order by posts desc limit 0,10";
	$sth = $dbh->prepare($sql);
	$sth->execute() || print $sth->errstr;
	while ($blogHash=$sth->fetchrow_hashref()) {
		print qq~
		<tr class=odd>
		<td><font style=font-size:10>&nbsp;
		<a href=blog.cgi?id=$blogHash->{'registry_id'}>$blogHash->{'name'}</a>
		($blogHash->{'posts'})</td></tr>
		~;
	}

	print qq~
	</table>

	~;

	if ( index($SITE,"HBCU")>=0 )  {
	print qq~
	<br><br>
	<script type="text/javascript"><!--
	google_ad_client = "pub-0253456783231705";
	google_ad_width = 160;
	google_ad_height = 600;
	google_ad_format = "160x600_as";
	google_ad_channel ="";
	google_ad_type = "text";
	google_page_url = document.location;
	google_color_border = "";
	google_color_bg = "#ffffff";
	google_color_link = "990000";
	google_color_url = "990000";
	google_color_text = "000000";
	//--></script>
	<script type="text/javascript"
	src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	</script>
	~;
	}

	print "</div>";

	print qq~
	$DIVIDER
	<div align=center>
        <!--/* OpenX Javascript Tag v2.7.25-beta (Rich Media - Doubleclick) */-->

<script type='text/javascript'><!--//<![CDATA[
   document.MAX_ct0 ='%c';

   var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=362");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
       document.write ("&amp;ct0=" + escape(document.MAX_ct0));
   }
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://d1.openx.org/ck.php?n=a93cde55&amp;cb=%n' target='_blank'><img src='http://d1.openx.org/avw.php?zoneid=362&amp;n=a93cde55&amp;ct0=%c' border='0' alt='' /></a></noscript>

	</div>

	~;

}

#################################################################################
sub printBlogMenu() {

	 print qq~
	 <table class=data cellpadding=1 width=100%>
	 <tr><th colspan=2 style=text-align:left>
		  &nbsp;<b>$blogStr Menu</td></tr>
		  <tr class=odd><td align=right width=10%>
			   <img src=$BULLET></td>
		      <td align=left width=90%>
			   <a href=$blogHome>$blogStr Home</a></td></tr>
		  <tr class=odd><td align=right width=10%>
			   <img src=$BULLET ></td>
		      <td align=left width=90%>
			   <a href=blog.cgi?id=$memberHash->{'registry_id'}>
			   Jump To Your Blog</a></td></tr>
		  <tr class=odd><td align=right width=10%>
			   <img src=$BULLET ></td>
		      <td align=left width=90%>
			   <a href=blog.cgi?add=1&cid=$cid>Post $blogStr Entry</a></td></tr>
		  <tr class=odd><td align=right width=10%>
			   <img src=$BULLET ></td>
		      <td align=left width=90%>
			   <a href=blog.cgi?help=1>What is a Blogging?</a></td></tr>
		  <tr class=odd><td align=right width=10%>
			   <img src=$BULLET ></td>
		      <td align=left width=90%>
			   <a href=blog.cgi?bookmarks=1>Blog Subscriptions</a></td></tr>
		  <tr class=odd><td align=right width=10%>
			   <img src=$BULLET ></td>
		      <td align=left width=90%>
			   <a href=memberMain.cgi>Member Home Page</a></td></tr>
	 </table>
	 $DIVIDER
	 ~;
}

#################################################################################
sub printFeaturedBlog() {

	print qq~
	<table class=data width=100%>
	<tr><th style=text-align:left>Featured Blogger... </th></tr>
	<tr class=odd><td>
		<a href=blog.cgi?blog_id=28696&cid=17>
		<img border=1 src=http://hbcuconnect.com/ads/fusion/images/FlexFusion_SEMA12.jpg
		width=50 height=50 align=right></a>
		<font face=tahoma size=1><b>NAME:</b>
		<a href=blog.cgi?blog_id=28696&cid=17>Funk Master Flex</a><br>
		Check out the latest Blog Entries featuring Funk Master and his
		For Fusion!
		<a href=blog.cgi?blog_id=28696&cid=17>Check it out...</a>
	</td></tr></table>
	$DIVIDER
	~;
}


##################################################################
sub setContext() {
    #### Since we can use this script for different types of content
    #### Lets set the context correctly based on the passed in category id.

    $cid=$q->param('cid');
    if ($q->param('blog_cid') ne "") { $cid=$q->param('blog_cid'); }
    $blogHome = "blog.cgi?cid=$cid&reading=1";
    $club_id = $q->param('club_id');
    $blogsPerPage=10;
    $blogOrder = "blogstamp desc";
    $thumbWidth = "width=90";
    $thumbHeight = "height=90";
    $galleryFormat = 0;

    if ($cid==1) {
	$blogStr="News";
	$bloggerStr="Authors";
    } elsif ($cid==19) {
	$blogStr="Black Issues";
	$bloggerStr="Authors";
	$external_link=1;
    } elsif ($cid==20) {
	$blogStr="Entertainment News";
	$bloggerStr="Authors";
	$external_link=1;
    } elsif ($cid==21) {
	$blogStr="Business News";
	$bloggerStr="Authors";
    } elsif ($cid==2) {
	$blogStr="Event";
	$bloggerStr="Promoters";
	$dateTag = "Event Date";
    } elsif ($cid==5) {
	$blogStr="Sports";
	$bloggerStr="Sports Fans";
	#$blogHome = "/sports";
	$emailBoss=1;
    } elsif ($cid==6) {
	$maxfilesize=200000;
	$blogStr="Photo";
	$bloggerStr="Photographers";
	$galleryFormat=1;
	$showHBCUFilter=1;
    } elsif ($cid==7) {
	$blogStr="Career Fair";
	$bloggerStr="Career Mentors";
	$emailBoss=1;
    } elsif ($cid==8) {
	$blogStr="Career News";
	$bloggerStr="Career Mentors";
	$emailBoss=1;
    } elsif ($cid==9) {
	$blogStr="Video";
	$bloggerStr="Videographers";
	$emailBoss=1;
	$galleryFormat=1;
	$showHBCUFilter=1;
	$videoCapable=1;
    } elsif ($cid==11) {
	$blogStr="Web Link";
	$bloggerStr="Webmasters";
	$thumbWidth = "width=120";
	$thumbHeight = "";
	$blogOrder = "referred_hits desc";
	$blogsPerPage=10;
	$emailBoss=1;
	$external_link=1;
	if ($q->param('add') eq "") {$reading=1;}
    } elsif ($cid==12) {
	$thumbWidth = "width=120";
	$thumbHeight = "";
	$blogOrder = "referred_hits desc";
	$blogsPerPage=10;
	if ($q->param('add') eq "") {$reading=1;}
	$blogStr="Partnership";
	$bloggerStr="Partners";
	$emailBoss=1;
	$external_link=1;
    } elsif ($cid==13) {
	$blogStr="Notable Alumni";
	$bloggerStr="Authors";
	$emailBoss=1;
	$galleryFormat=1;
	$showHBCUFilter=1;
    } elsif ($cid==14) {
	$maxfilesize=1000000;
	$albumsAllowed=1;
	$blogStr="Cruise Photo";
	$bloggerStr="Photographers";
	$AD_HEADER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/header.html`;
	$FOOTER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/footer.html`;
	$emailBoss=1;
	$galleryFormat=1;
	$needsLogin=1; #### Template needs a login form if user not authorized
	if ($q->param('add') eq "") {$reading=1;}
    } elsif ($cid==15) {
	$blogStr="Cruise Video";
	$bloggerStr="Videographers";
	$AD_HEADER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/header.html`;
	$FOOTER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/footer.html`;
	$emailBoss=1;
	$galleryFormat=1;
	$needsLogin=1; #### Template needs a login form if user not authorized
	$videoCapable=1;
	if ($q->param('add') eq "") {$reading=1;}
    } elsif ($cid==16) {
	$blogStr="Campaign";
	$bloggingStr="Fund Raising";
	$bloggerStr="Fund Raisers";
	$showFinancialGoal=1;
	$fundRaiser=1;
	$dateTag = "Campaign Ends";
    } elsif ($cid==17) {
	$blogStr="Poll";
	$bloggingStr="Polling";
	$bloggerStr="Poll Sponsors";
	$hasPoll = 1;
    } elsif ($cid==18) {
        $blogStr="HBCU Queen(s)";
        $bloggerStr="Promoters";
        $emailBoss=1;
        $galleryFormat=1;
        $showHBCUFilter=1;
    } elsif ($cid==22) {
        $blogStr="Entrepreneur News";
        $bloggerStr="Authors";
        $emailBoss=1;
    } elsif ($cid==24) {
        $maxfilesize=1000000;
        $albumsAllowed=1;
        $blogStr="2006 Cruise Photo";
        $bloggerStr="Photographers";
        $AD_HEADER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/header.html`;
        $FOOTER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/footer.html`;
        $emailBoss=1;
        $galleryFormat=1;
        $needsLogin=1; #### Template needs a login form if user not authorized
        if ($q->param('add') eq "") {$reading=1;}
    } elsif ($cid==25) {
        $blogStr="2006 Cruise Video";
        $bloggerStr="Videographers";
        $AD_HEADER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/header.html`;
        $FOOTER = `/bin/cat /var/www/vhosts/hbcucruise.com/httpdocs/footer.html`;
        $emailBoss=1;
        $galleryFormat=1;
        $needsLogin=1; #### Template needs a login form if user not authorized
        $videoCapable=1;
        if ($q->param('add') eq "") {$reading=1;}
    } elsif ($cid==38) {
        $blogStr="HBCUConnect Press Release";
        $bloggerStr="Authors";
        $emailBoss=1;
    } elsif ($cid==55) {
        $blogStr="Web Site Help";
        $bloggerStr="Helpers";
    } elsif ($cid==58) {
        $blogStr="Profiles In Leadership";
        $bloggerStr="Bloggers";
    } else {
	$blogStr="Blog";
	$bloggingStr="Blogging";
	$bloggerStr="Bloggers";
	$cid=10;
	if ($club_id) { $blogStr="Message"; }
    }
}

#####################################################################################
sub CheckForOffensiveTerms
{
        my (@ta) = @_;
	if (&isAdmin($blogHash->{'email'})) { return(0); }
        for (@ta)
        {
                if ($_ =~ /\bpussy|\bcunt|\bbitch|dick|fuck|asshole/i)          { return 1; }
                if ($_ =~ /<a|<object|<param|<img|<embed|pussie|\bbible\b|blowjob|\bbutt\b|butthead/i)   { return 1; }
                if ($_ =~ /ass hole|bastard|christ\b|\bcock|\bbathroom\b/i){ return 1; }
                if ($_ =~ /clitor|cornhol|\bcum\b|cunnili/i)          { return 1; }
                if ($_ =~ /defecat|honkey|horny|nigga|nigger|ofay/i)       { return 1; }
                if ($_ =~ /dickhead|douche|\bfag\b|\bass\b|faggot/i)               { return 1; }
                if ($_ =~ /fellatio|damn|genital|goddam|god dam|\bhomo\b/i)     { return 1; }
                if ($_ =~ /peckerwood|penis|\bpiss\b|whore|rape/i)         { return 1; }
                if ($_ =~ /satan|masoc|semen|pimp|shit|\bslut|\bdago\b/i)       { return 1; }
                if ($_ =~ /\btit\b|twat|urinat|vagina|suck/i)              { return 1; }
                if ($_ =~ /blowjob|rim job|rimjob|blow job/i)              { return 1; }
                if ($_ =~ /fart|felch|potty|\bjiz|\bkill you\b/i)          { return 1; }
        }
        return 0;
} # sub CheckForOffensiveTerms

sub printFeaturedContent() {

	#### Get passed in parameters
	my ($cid) = $_[0];
	my ($sth,$sql);

	if ($cid==0) { $cidSQL = " cid in (0,10)"; }
	else { $cidSQL = "cid=$cid"; }

	#### Load up featured article
	$sql = "SELECT a.*,b.*,c.photo_link 
		FROM blogs as a, blog_categories as b, registry_data as c WHERE
		featured IS NOT NULL and $cidSQL and a.cid=b.cat_id and a.registry_id=c.registry_id
		ORDER BY featured desc";
	$sth = $dbh->prepare($sql);
	$sth->execute() || print $sth->errstr;
	$feature = $sth->fetchrow_hashref();

	if ($feature) {
	#### Set img string
	if ($feature->{blog_img}) { $imgSrc = $feature->{blog_img}; }
	else { $imgSrc = $feature->{photo_link}; }

	#### Set blogStr if it's null
	if ($blogStr eq "") { $blogStr = $feature->{blog_category}; }

	#### Print out featured content
	print qq~
        <!-- ---------------------- FEATURED ARTICLE ------------------------ -->

        <table width=100% class=data>
        <tr><th class=left style=font-size:18>This Week's Featured $blogStr!</th></tr>
        <tr><td>
        <a href=$CGI_URL/blog.cgi?cid=$cid&blog_id=$feature->{blog_id}>
	<img src="$imgSrc" width=180 height=150 align=left border=1></a>
        <b><font style=font-size:18>$feature->{title}</font></b><br>
	$feature->{brief}
        <a href=$CGI_URL/blog.cgi?cid=$cid&blog_id=$feature->{blog_id}>[More...]</a>
        </td></tr>
        </table>
	~;

	} #### Only show if something was found...

}

sub printFeaturedEventContent() {

        #### Get passed in parameters
        my ($sth,$sql);

        #### Load up featured article
        $sql = "SELECT a.*,c.photo_link
                FROM events as a, registry_data as c WHERE
                featured IS NOT NULL and a.registry_id=c.registry_id
                ORDER BY featured desc";
        $sth = $dbh->prepare($sql);
        $sth->execute() || print $sth->errstr;
        $feature = $sth->fetchrow_hashref();

        if ($feature) {
        #### Set img string
        if ($feature->{flyer_img}) { $imgSrc = $feature->{flyer_img}; }
        else { $imgSrc = $feature->{photo_link}; }

        #### Print out featured content
        print qq~
        <table width=100% class=data>
        <tr><th class=left style=font-size:18>This Week's Featured Event!</th></tr>
        <tr><td>
        <a href=/alumnidb/cgi-bin/eventblog.cgi?event_id=$feature->{event_id}>
        <img src="$imgSrc" width=180 height=150 align=left border=1></a>
        <b><font style=font-size:18>$feature->{title}</font></b><br>
        $feature->{brief}
        <a href=/alumnidb/cgi-bin/eventblog.cgi?event_id=$feature->{event_id}>[More...]</a>
        </td></tr>
        </table>
        ~;

        } #### Only show if something (event) was found...

}

sub printContentBrowser() {

    print qq~
        <table class=data width=100%>
        <form name=categories action=blog.cgi>
        <tr><th style=text-align:left colspan=2>Quick Content Browser</th></tr>
        <tr>
        <td align=right width=90%>
                <select name=cid style=font-family:tahoma;font-size:12;font-weight:heavy>
                <option value="" selected>
                <option value=0>Blogs
                <option value=1>News
                <option value=2>Events
                <option value=17>Polls
                <option value=5>Sports
                <option value=6>Photos
                <option value=9>Videos
                <option value=11>Links
                <option value=18>HBCU Queens
                <option value=13>Famous HBCU Grads
                <option value=22>Entrepreneur News
                </select>
        </td>
        <td><input type=submit name=Search value=Go>
        </td></tr></form></table>
    ~;
}

1;
