Location: PHPKode > projects > Communication Kit > programs/live/news_display_inc.php
<?php
$page_ref = (isset($_REQUEST["page_ref"])) ? $_REQUEST["page_ref"] : "" ;
$action = (isset($_REQUEST["action"])) ? $_REQUEST["action"] : "" ;
$item = (isset($_REQUEST["item"])) ? $_REQUEST["item"] : "" ;
$offset = (isset($_REQUEST["offset"])) ? $_REQUEST["offset"] : 0 ;
if ((isset($n_type_include))||(isset($page_form_id))){
		$moderator = moderator($_SESSION['sess_userid']);
    if (isset($n_type_include)) {
        $req_n_type = $n_type_include;
		} elseif (isset($page_form_id)){
        $req_n_type = $page_form_id ;
		}
    $sql = mysql_query("SELECT * FROM ".NEWS_TYPES."
    		 	 							WHERE news_type_id = '$req_n_type'");
    $row = mysql_fetch_array($sql);
 		foreach( $row AS $key => $val ){
            $$key = stripslashes( $val );
 		}
		if ($page_type=="N"){
    		$news_page_ref = $page_ref;
		} else {
        $sql = mysql_query("SELECT page_id FROM ".PAGES."
                            WHERE page_type = 'N' AND
																	page_form_id = '$req_n_type'");
        $row = mysql_fetch_array($sql);
        foreach($row AS $key => $val){
            $$key = stripslashes($val);
        }
    		$news_page_ref = $page_id;
		}
    $title_bg_style = (isset($news_type_color_title)) ? "style=\"background-color: $news_type_color_title; layer-background-color: $news_type_color_title;\"" : "" ;
    $subject_bg_style = (isset($news_type_color_subject)) ? "style=\"background-color: $news_type_color_subject; layer-background-color: $news_type_color_subject;\"" : "" ;
    $detail_bg_style = (isset($news_type_color_detail)) ? "style=\"background-color: $news_type_color_detail; layer-background-color: $news_type_color_detail;\"" : "" ;
		if (($action=="del")&&($moderator)) {
        $sql = mysql_query("DELETE FROM ".NEWS_ITEMS."
     	 											WHERE news_item_id = '$item'")
              or die (mysql_error());
				$item="";
		}
		if (($action=="app")&&($moderator)) {
    		$sql = mysql_query("UPDATE ".NEWS_ITEMS."
						 	 							SET news_item_status='0'
     	 											WHERE news_item_id = '$item'")
              or die (mysql_error());
				$item="";
		}
		if ($action=="yes") {
 				$sql = mysql_query("SELECT news_item_agree_qty FROM ".NEWS_ITEMS."
         		 	 							WHERE news_item_id = '$item'")
            or die (mysql_error());
				if (mysql_numrows($sql)==1){
            $row = mysql_fetch_array($sql);
         		foreach( $row AS $key => $val ){
                    $$key = stripslashes( $val );
         		}
        		$sql = mysql_query("UPDATE ".NEWS_ITEMS."
    						 	 							SET news_item_agree_qty=$news_item_agree_qty+1
         	 											WHERE news_item_id = '$item'")
                  or die (mysql_error());
				}
		}
		if ($action=="no") {
 				$sql = mysql_query("SELECT news_item_disagree_qty FROM ".NEWS_ITEMS."
         		 	 							WHERE news_item_id = '$item'")
            or die (mysql_error());
				if (mysql_numrows($sql)==1){
            $row = mysql_fetch_array($sql);
         		foreach( $row AS $key => $val ){
                    $$key = stripslashes( $val );
         		}
        		$sql = mysql_query("UPDATE ".NEWS_ITEMS."
    						 	 							SET news_item_disagree_qty=$news_item_disagree_qty+1
         	 											WHERE news_item_id = '$item'")
                  or die (mysql_error());
				}
		}
		//--------- update -----------
    if ((isset($_POST["hidden_field"]))&&($action=="add_item")) {
        $new_news_item_subject = addslashes($_POST['new_news_item_subject']); 
        $new_news_item_detail = addslashes($_POST['new_news_item_detail']); 
        $new_news_item_contact = addslashes($_POST['new_news_item_contact']); 
        $new_news_item_email = addslashes($_POST['new_news_item_email']); 
				if ($item==""){
            $new_news_item_status = ((!$moderator)&&($news_type_approve)) ? 1 : 0 ;
    				$sql = mysql_query("INSERT INTO ".NEWS_ITEMS." (news_item_type_id,
    						 	 										 						 news_item_subject,
        	 																 				 news_item_detail,
        																					 news_item_contact,
        																					 news_item_email,
        																					 news_item_cr_date,
    																							 news_item_status)
        												VALUES ('$req_n_type',
    																	  '$new_news_item_subject',
        															  '$new_news_item_detail',
        															  '$new_news_item_contact',
        																'$new_news_item_email',
        																'".now()."',
    																		'$new_news_item_status') ")
              or die (mysql_error());
				}else{
    				$sql = mysql_query("SELECT * FROM ".NEWS_ITEMS."
            		 	 							WHERE news_item_type_id = '$req_n_type' AND
																			news_item_id = '$item'")
              or die (mysql_error());
						if (mysql_numrows($sql)==1){
        				$sql = mysql_query("UPDATE ".NEWS_ITEMS." 
										 	 							SET news_item_type_id='$req_n_type',
       	 										 						news_item_subject='$new_news_item_subject',
																 				news_item_detail='$new_news_item_detail',
  																			news_item_contact='$new_news_item_contact',
  																			news_item_email='$new_news_item_email'
																		WHERE news_item_id='$item'")
                  or die (mysql_error());
						}
				}
?>
        <script language="JavaScript">
        function close_it() {
            window.opener.navigate(window.opener.document.location.href);
            window.close();
        }
        </script>
<?php 
    } elseif ((isset($_POST["hidden_field"]))&&($action=="com_add")) {
        $new_news_item_comment_text = addslashes($_POST['new_news_item_comment_text']); 
        $new_news_item_comment_by = addslashes($_POST['new_news_item_comment_by']); 
        $new_news_item_status = ((!$moderator)&&($news_type_approve)) ? 1 : 0 ;
				$sql = mysql_query("INSERT INTO ".NEWS_ITEM_COMMENTS." (news_item_comment_item_id,
						 	 										 						 news_item_comment_text,
    	 																 				 news_item_comment_by,
    																					 news_item_comment_date)
    												VALUES ('$item',
																	  '$new_news_item_comment_text',
    															  '$new_news_item_comment_by',
    																'".now()."' ) ")
              or die (mysql_error());
?>
        <script language="JavaScript">
        function close_it() {
            window.opener.navigate(window.opener.document.location.href);
            window.close();
        }
        </script>
<?php 
        print "<p class='sub_welcome'>Thank You!</p>";
        print "<p><input type=button name=CloseButton value=Close onclick=close_it()></p>";
    } elseif (($action=="add")||($action=="edit")){
        //------------------------------------------ popup ----------
       ?><body onLoad="document.form.elements[0].focus(); SetValidation();">
			   <script language="JavaScript">
        var objValidation = new Object();
        function SetValidation() {
        // for each field to be chcked, repeat the next block
        	objValidation.new_news_item_subject = new Object();
        	objValidation.new_news_item_subject.type = 'text';  //or 'email' or 'date' or 'number'
        	objValidation.new_news_item_subject.blank = false;	 //can it be blank
        	objValidation.new_news_item_subject.valtext = 'subject'; //displayed if error
        	objValidation.new_news_item_detail = new Object();
        	objValidation.new_news_item_detail.type = 'text';  //or 'email' or 'date' or 'number'
        	objValidation.new_news_item_detail.blank = false;	 //can it be blank
        	objValidation.new_news_item_detail.valtext = 'detail'; //displayed if error
        }
        // only allows submit if no errors
        function submit_it() {
        	if (Validate(document.form, objValidation))
        		document.form.submit();
        	else
        		return false;
        }
    		</script>
    		<?
				if ($action=="add"){
    				$news_item_subject="";
						$news_item_detail="";
						$news_item_email="";
						$name_text = ($_SESSION['in']=="Y") ? $_SESSION['sess_first_name']." ".$_SESSION['sess_last_name'] : "" ;
				} else {
    				$sql = mysql_query("SELECT * FROM ".NEWS_ITEMS."
            		 	 							WHERE news_item_type_id = '$req_n_type' AND
																			news_item_id = '$item'");
            $row = mysql_fetch_array($sql);
         		foreach( $row AS $key => $val ){
                    $$key = stripslashes( $val );
         		}
						$name_text = $news_item_contact;
				}
				$item_text = ($action=="edit") ?  "&item=$item" : "" ;
				print "<p class='sub_welcome'>Submit to $news_type_desc</p>\n";
        print "<form name='form' method='post' action='".$_SERVER['PHP_SELF']."?page_ref=$page_ref&action=add_item$item_text&pu=n'>\n";
        print "<table border='0' cellpadding='4' cellspacing='0'>\n";
        print " <tr><td class='small_text' align='right'>Subject</td>\n";
        print " 		<td class='reset' colspan='2'><input name='new_news_item_subject' type='text' class='text' maxlength='60' size='30' value='$news_item_subject'>\n";
        print "</td></tr>\n";
        
        print " <tr><td class='small_text' align='right'>Your Name (optional)</td>\n";
				print " 		<td class='reset' colspan='2'><input name='new_news_item_contact' type='text' class='text' maxlength='60' size='30' value='$name_text'>\n";
        print "</td></tr>\n";
        
        print " <tr><td class='small_text' align='right'>Email (optional)</td>\n";
        print " 		<td class='reset' colspan='2'><input name='new_news_item_email' type='text' class='text' maxlength='60' size='30' value='$news_item_email'>\n";
        print "</td></tr>\n";
        
        print "<tr><td class='small_text' align='right' valign='top'>Details";
        print "</td><td colspan=4 class='reset'><textarea class='area' name='new_news_item_detail' rows='15' cols='80'>$news_item_detail</textarea></td>\n";
        print "</tr>\n";
        
        print "<tr><td class='reset'><input type='hidden' name='hidden_field' value='entered'></td>\n";
        print "    <td class='reset' colspan='2'><input class='button' type='button' value='Update' onClick=\"submit_it();\">\n";
        print "    </td></tr></table></form>";
    } elseif ($action=="com"){//add comments to news items
        //------------------------------------------ popup ----------
       ?><body onLoad="document.form.elements[0].focus(); SetValidation();">
			   <script language="JavaScript">
        var objValidation = new Object();
        function SetValidation() {
        // for each field to be chcked, repeat the next block
        	objValidation.new_news_item_comment_text = new Object();
        	objValidation.new_news_item_comment_text.type = 'text';  //or 'email' or 'date' or 'number'
        	objValidation.new_news_item_comment_text.blank = false;	 //can it be blank
        	objValidation.new_news_item_comment_text.valtext = 'missing details'; //displayed if error
        }
        // only allows submit if no errors
        function submit_it() {
        	if (Validate(document.form, objValidation))
        		document.form.submit();
        	else
        		return false;
        }
    		</script>
    		<?
				$news_item_comment_text="";
    		$name_text = ($_SESSION['in']=="Y") ? $_SESSION['sess_first_name']." ".$_SESSION['sess_last_name'] : "" ;
        $sql = mysql_query("SELECT * FROM ".NEWS_ITEMS."
        		 	 							WHERE news_item_id = '$item'");
    	  print "<center><table border=0 cellpadding=2 cellspacing=0 width=100%>";
        print ($news_type_show_title) ? "<tr><th colspan='3' $title_bg_style>$news_type_desc</th></tr>\n" : "" ;
				$row = mysql_fetch_array($sql);
    		foreach( $row AS $key => $val ){
                $$key = stripslashes( $val );
    		}
				if ((($news_item_status)&&($moderator))||(!$news_item_status)){
 						$italic = ($news_item_status) ? "<i>" : "" ;
 						$italic_end = ($news_item_status) ? "</i>" : "" ;
         		print "<tr><td class='small_text' $subject_bg_style>$italic$news_item_subject$italic_end</td>\n";
         		print "<td class='small_text' colspan='2' $subject_bg_style align=right>";
						print ($news_type_show_date) ? $italic.date("d/m/y g:ia",strtotime($news_item_cr_date)).$italic_end : "" ;
						print "</td></tr>\n";
            print "<tr><td class='small_text' $detail_bg_style colspan='3'>$italic";
						print nl2br($news_item_detail);
         		print (($news_type_show_by)&&($news_item_contact>""))? "&nbsp;&nbsp;&nbsp;<i>...submitted by $news_item_contact</i>" : "" ;
         		print (($news_type_show_email)&&($news_item_email>""))? "&nbsp;&nbsp;&nbsp;<i>...contact $news_item_email</i>" : "" ;
 						print "$italic_end\n";
						print "</td></tr>\n";
				}
				print "</table><p class='sub_welcome'>$news_type_comment_text</p>\n";
        print "<form name='form' method='post' action='".$_SERVER['PHP_SELF']."?page_ref=$page_ref&item=$item&action=com_add&pu=n'>\n";
        print "<table border='0' cellpadding='4' cellspacing='0'>\n";
        
        print "<tr><td class='small_text' align='right'>Your Name (optional)</td>\n";
				print " 	<td class='reset' colspan='2'><input name='new_news_item_comment_by' type='text' class='text' maxlength='60' size='30' value='$name_text'></td>\n";
        print "</tr>\n";
        
        print "<tr><td class='small_text' align='right' valign='top'>Details</td>";
        print "<td colspan=4 class='reset'><textarea class='area' name='new_news_item_comment_text' rows='7' cols='55'>$news_item_comment_text</textarea></td>\n";
        print "</tr>\n";
        
        print "<tr><td class='reset'><input type='hidden' name='hidden_field' value='entered'></td>\n";
        print "    <td class='reset' colspan='2'><input class='button' type='button' value='Submit' onClick=\"submit_it();\"></td>\n";
        print "</tr></table></form>\n";
    } elseif ($action=="comview"){//view comments posted to news items
        //------------------------------------------ popup ----------
       ?><body onLoad="document.form.elements[0].focus(); SetValidation();">
			   <script language="JavaScript">
        var objValidation = new Object();
        function SetValidation() {
        // for each field to be chcked, repeat the next block
        	objValidation.new_news_item_comment_text = new Object();
        	objValidation.new_news_item_comment_text.type = 'text';  //or 'email' or 'date' or 'number'
        	objValidation.new_news_item_comment_text.blank = false;	 //can it be blank
        	objValidation.new_news_item_comment_text.valtext = 'missing details'; //displayed if error
        }
        // only allows submit if no errors
        function submit_it() {
        	if (Validate(document.form, objValidation))
        		document.form.submit();
        	else
        		return false;
        }
    		</script>
    		<?
        $sql = mysql_query("SELECT * FROM ".NEWS_ITEMS."
        		 	 							WHERE news_item_id = '$item'");
    	  print "<center><table border=0 cellpadding=2 cellspacing=0 width=100%>";
        print ($news_type_show_title) ? "<tr><th colspan='3' $title_bg_style>$news_type_desc</th></tr>\n" : "" ;
				$row = mysql_fetch_array($sql);
    		foreach( $row AS $key => $val ){
                $$key = stripslashes( $val );
    		}
				if ((($news_item_status)&&($moderator))||(!$news_item_status)){
 						$italic = ($news_item_status) ? "<i>" : "" ;
 						$italic_end = ($news_item_status) ? "</i>" : "" ;
         		print "<tr><td class='small_text' $subject_bg_style>$italic$news_item_subject$italic_end</td>\n";
         		print "<td class='small_text' colspan='2' $subject_bg_style align=right>";
						print ($news_type_show_date) ? $italic.date("d/m/y g:ia",strtotime($news_item_cr_date)).$italic_end : "" ;
						print "</td></tr>\n";
            print "<tr><td class='small_text' $detail_bg_style colspan='3'>$italic";
						print nl2br($news_item_detail);
         		print (($news_type_show_by)&&($news_item_contact>""))? "&nbsp;&nbsp;&nbsp;<i>...submitted by $news_item_contact</i>" : "" ;
         		print (($news_type_show_email)&&($news_item_email>""))? "&nbsp;&nbsp;&nbsp;<i>...contact $news_item_email</i>" : "" ;
 						print "$italic_end\n";
						print "</td></tr>\n";
				}
				print "</table>\n";
				
        $sql = mysql_query("SELECT * FROM ".NEWS_ITEM_COMMENTS."
        		 	 							WHERE news_item_comment_item_id = '$item'");
    	  print "<center><table border=0 cellpadding=2 cellspacing=0 width=100%>";
        print "<tr><th>Comments</th></tr>\n";
        while($row = mysql_fetch_array($sql)){
        		foreach( $row AS $key => $val ){
                    $$key = stripslashes( $val );
        		}
						print "<tr><td class='small_text'>Posted by $news_item_comment_by on ".date("d/m/Y",strtotime($news_item_comment_date))."</td></tr>\n";
						print "<tr><td class='small_text'>$news_item_comment_text</td></tr>\n";
						print "<tr><td class='sub_welcome'>&nbsp;</td></tr>\n";
				}
				print "</table>\n";
				$news_item_comment_text="";
    		$name_text = ($_SESSION['in']=="Y") ? $_SESSION['sess_first_name']." ".$_SESSION['sess_last_name'] : "" ;
				print "<p class='sub_welcome'>$news_type_comment_text</p>\n";
        print "<form name='form' method='post' action='".$_SERVER['PHP_SELF']."?page_ref=$page_ref&item=$item&action=com_add'>\n";
        print "<table border='0' cellpadding='4' cellspacing='0'>\n";
        
        print "<tr><td class='small_text' align='right'>Your Name (optional)</td>\n";
				print " 	<td class='reset' colspan='2'><input name='new_news_item_comment_by' type='text' class='text' maxlength='60' size='30' value='$name_text'></td>\n";
        print "</tr>\n";
        
        print "<tr><td class='small_text' align='right' valign='top'>Details</td>";
        print "<td colspan=4 class='reset'><textarea class='area' name='new_news_item_comment_text' rows='7' cols='50'></textarea></td>\n";
        print "</tr>\n";
        
        print "<tr><td class='reset'><input type='hidden' name='hidden_field' value='entered'></td>\n";
        print "    <td class='reset' colspan='2'><input class='button' type='button' value='Submit' onClick=\"submit_it();\"></td>\n";
        print "</tr></table></form>\n";
		} else {
				$new_offset = $offset + $news_type_items;
        $sql = mysql_query("SELECT * FROM ".NEWS_ITEMS."
        		 	 							WHERE news_item_type_id = '$req_n_type'
    												ORDER BY news_item_id DESC
														LIMIT $new_offset,$news_type_items");
				$more_items = (mysql_numrows($sql)>0) ? TRUE : FALSE ;
        $sql = mysql_query("SELECT * FROM ".NEWS_ITEMS."
        		 	 							WHERE news_item_type_id = '$req_n_type' AND
														(((news_item_status)AND('$moderator'))OR(!news_item_status))
    												ORDER BY news_item_id DESC
														LIMIT $offset,$news_type_items");
    	  print "<center><table border=0 cellpadding=2 cellspacing=0 width=100%>";
        print ($news_type_show_title) ? "<tr><th colspan='2' $title_bg_style>$news_type_desc</th><th $title_bg_style align='right'>\n" : "" ;
				print (($news_type_show_title)&&($news_type_rss)) ? "<a href='".WEBROOT."rss.php?feed=$news_type_id'><img src='".WEBROOT."images/site/rss.gif' border='0' /></a>" : "" ;
				print ($news_type_show_title) ? "</th></tr>\n" : "" ;
        while($row = mysql_fetch_array($sql)){
        		foreach( $row AS $key => $val ){
                    $$key = stripslashes( $val );
        		}
						if ((($news_item_status)&&($moderator))||(!$news_item_status)){
    						$italic = ($news_item_status) ? "<i>" : "" ;
    						$italic_end = ($news_item_status) ? "</i>" : "" ;
            		print "<tr><td class='small_text' $subject_bg_style>$italic<b>$news_item_subject</b>$italic_end";
								print ((!$news_type_show_detail)&&($item<>$news_item_id)) ? " <a href='".$_SERVER['PHP_SELF']."?page_ref=$page_ref&item=$news_item_id'>more info...</a>" : "" ;
								print "</td>\n";
            		print "<td class='small_text' $subject_bg_style>";
								print ($news_type_show_date) ? $italic.date("d/m/y",strtotime($news_item_cr_date)).$italic_end : "" ;
								print "</td>\n";
 								print "<td class='small_text' $subject_bg_style>\n";
            		if ($moderator) {
										print "<a href=\"javascript:Help(600,500,'".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=edit&item=$news_item_id&pu=y')\">Edit</a>\n";
										print ($news_item_status) ? "<a href='".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=app&item=$news_item_id'>Approve</a> " : "" ;
										print "<a href='".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=del&item=$news_item_id'>Delete</a>\n";
								}
								print "</td></tr><tr><td  style=\"line-height:1px;\">&nbsp;</td></tr>\n";
								if (($news_type_show_detail)||($item==$news_item_id)){
    								print "<tr><td class='small_text' $detail_bg_style colspan='3'>\n$italic";
										print nl2br($news_item_detail);
                		print (($news_type_show_by)&&($news_item_contact>""))? "&nbsp;&nbsp;&nbsp;<i>...submitted by $news_item_contact</i>" : "" ;
                		print (($news_type_show_email)&&($news_item_email>""))? "&nbsp;&nbsp;&nbsp;<i>...contact $news_item_email</i>" : "" ;
        						print "$italic_end\n";
    								print "</td></tr>";
    								if ($news_type_agree){
        								print "<tr><td colspan='3'>\n";
    										print "<table width=100% cellpadding=0 cellspacing=2>\n";
    										print "<tr><td class='small_text' align='right'>$news_type_agree_text</td>\n";
        								print "<td class='small_text'><a href='".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=yes&item=$news_item_id'><img src='".WEBROOT."images/site/yes.gif' border='0'></a>\n";
        								print ($news_type_disagree) ? "</td><td><a href='".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=no&item=$news_item_id'><img src='".WEBROOT."images/site/no.gif' border='0'></a></td>\n" : "" ;
         								$news_item_total_qty = $news_item_disagree_qty+$news_item_agree_qty;
        								print "<td class='small_text' width=34%>";
    										if ($news_item_total_qty>0){
            								print  "So far $news_item_agree_qty ";
            								print ($news_item_agree_qty==1) ? "person " : "people " ;
            								print ($news_item_disagree_qty>0) ? "out of $news_item_total_qty " : "" ;
            								print ($news_item_agree_qty==1) ? "has" : "have" ;
            								print " agreed. \n";
        								}
    										print "</td></tr></table></td></tr>\n";
    								}
    								if ($news_type_comment){
        								print "<tr><td colspan='3'>\n";
    										print "<table width=100% cellpadding=0 cellspacing=2>\n";
        								print "<tr><td class='small_text' align='right'>\n";
    										print "$news_type_comment_text <a href=\"javascript:Help(540,440,'".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=com&item=$news_item_id&pu=y')\" title=''>\n";
    										print "Click here</a></td>\n";
         								print "<td class='small_text' align='right' width=34%>\n";
                        $sql_comments = mysql_query("SELECT * FROM ".NEWS_ITEM_COMMENTS."
                        		 	 							WHERE news_item_comment_item_id = '$news_item_id'");
    										$qty_comments=mysql_numrows($sql_comments);
    										if ($qty_comments>0){
        										print "<a href=\"javascript:Help(540,440,'".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=comview&item=$news_item_id&pu=y')\" title=''>\n";
        										print "View comments so far...($qty_comments)</a></td>\n";
    										}
    										print "</td></tr></table></td></tr>\n";
    								}
								}
						}
    		}
				//decide if user can post new items
				$post=FALSE;
				if (($news_type_post_priv)&&($_SESSION['in']=="Y")){
            $sql_groups = mysql_query("SELECT * FROM ".NEWS_GROUPS."
            										WHERE news_groups_news_type_id='$req_n_type'");
     				if(mysql_numrows($sql_groups)>0){
            	  while($row = mysql_fetch_array($sql_groups)){
            		 		foreach( $row AS $key => $val ){
               					 		 $$key = stripslashes( $val );
            				}
                    $sql = mysql_query("SELECT * FROM ".USER_GROUPS."
                    										WHERE group_userid = '$_SESSION[sess_userid]' AND
																							user_group_id = '$news_groups_group_id' AND
    																					user_group_type = 'U' ");
             				if (mysql_numrows($sql)==1){
    										$post = TRUE;
										}
								}
						} else {
    						$post=TRUE;
						}
				} elseif (($news_type_post_pub)&&($_SESSION['in']=="N")){
    				$post= TRUE;
				}
				if (($more_items)||($offset>0)||($post)){
     				print "<tr><td class='small_text' $subject_bg_style>";
    				print ($more_items) ? "<a href='".$_SERVER['PHP_SELF']."?page_ref=$page_ref&offset=$new_offset'>View More</a>" : 
    														(($offset>0) ? "<a href='".$_SERVER['PHP_SELF']."?page_ref=$page_ref'>View Latest</a>" : "" );
    				print "</td>";
     				print "<td class='small_text' $subject_bg_style colspan='3'>";
            if ($post){
            		print "<a href=\"javascript:Help(600,500,'".$_SERVER['PHP_SELF']."?page_ref=$news_page_ref&action=add&pu=y')\" title=''>Submit New";
            		print "</a>";
    				}
        		print "</td></tr>\n";
				}
				print "</table></center>\n";
  	}
}
?>
Return current item: Communication Kit