Location: PHPKode > projects > PSlash > pslash-0.70/html/article.php
<?

###############################################################################
# Copyright (C) 2000  Derek Leung
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# You may modify your copy or copies of this Program or any portion of it,
# but you must cause the modified files to carry prominent notices stating 
# that you changed the files and the date of any change.  And you are required 
# to keep a copy of this License along with this Program.
#
# You are not required to accept this License, since you have not signed it. 
# However, nothing else grants you permission to modify or distribute this 
# Program or its derivative works. These actions are prohibited by law if 
# you do not accept this License. Therefore, by modifying or distributing 
# this Program (or any work based on this Program), you indicate your 
# acceptance of this License to do so, and all its terms and conditions 
# for copying, distributing or modifying this Program or works based on it.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# See the GNU General Public License for more details.
# http://www.opensource.org/licenses/gpl-license.html
###############################################################################

require("mainfile.php");
global $config;

	// no $sid?  throw error mesg.
	if(!isset($sid)) { 
		errorPage("Error!!! No story is choosen!  Most likely you have a wrong URL!",$config[def_theme]);
	}

	// no topic choosen?  we try to find it by $sid
	if ($myTopic == "") {
		list($myTopic) = mysql_fetch_row($result = mysql_query("select topic from ps_stories where sid=$sid"));    
		mysql_free_result($result);
	}

	// trying to reply?  go to comments.php
	if ($op == "Reply") {
		Header("Location: comments.php?op=Reply&pid=0&sid=$sid&mode=$mode&order=$order&thold=$thold");
	}

	// now we get the story
	$result = mysql_query("select aid, time, title, full_text,ip FROM ps_stories where sid=$sid");
	
	list($aid, $datetime, $title, $fulltext,$ip ) = mysql_fetch_row($result);
	if ($result) {
		mysql_free_result($result);
	}
	// update counter hit on stories
	mysql_query("UPDATE ps_stories SET counter=counter+1 where sid=$sid");

	$title = check_words($title);
	$datetime = formatShortTimestamp($datetime);
	$alltext = $fulltext;
	$alltext = check_words($alltext);

	// show the title and include javascript in header
	$header[titlebar] = "$title";
	$header[js] = "true";
	
	ps_header("");

	// show the story
	themearticle($aid, $datetime, $title, myNl2Br($alltext),"","",$ip);
	
	// show reply link
	?>
	<p><font size=2>[ 
	<a href="comments.php?op=Reply&pid=0&sid=<? echo "$sid"; ?>&myTopic=<? echo "$myTopic"; ?>">
	<? echo translate("Reply to this"); ?></a> ]</font></p>
	<?

	// only way to get comments not to include mainfile.php again
	$come_from_article = true;
	include("comments.php");
	ps_footer("");

?>
Return current item: PSlash