All pastes #175203 Raw Edit

Smith

public php v1 · immutable
·published 2006-09-18 16:10 UTC
rendered paste body
<?php /***	CMS Faethon 2.0	  	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.	See http://support.cmsfaethon.com/license.txt for more info.		$File: index.php	$Author: Jakub Slová&#269;ek	$Version: 4.1	$Date: 2005/03/03***/require('lib/functions_SQL.php');require('lib/functions_DATE.php');require('lib/class_pms.php');require('config.php');include('lang/'.$cfg['lang'].'.inc');$mainpath = "./";$title = $lang['mainpage'];include('templates/c_template.php');$template = new Template('./templates/template.ftl','INDEX');$template -> AddTag("NEWS_TITLE", $lang['news']);$main_result=sql_query("SELECT id, title, author, date, text FROM ".$SQL_PREFIX."_news WHERE published = 'yes' ORDER BY date DESC LIMIT 5");$total_result=sql_num_rows($main_result);$template -> AddRow("news");for($i=0;($i<(5)) && ($i<$total_result);$i++) {	$news = sql_fetch_object($main_result);          	$news->text=strip_tags($news->text);           	$text = substr($news->text, 0, 100);		      	$date = $news->date;		$time = $news->date;	      	DateFormat($date);     	TimeFormat($time);	                  	if(date(Y.'-'.m.'-'.d) == substr($news->date, 0, 10)) {		$template -> AddTag("NEWS_DATE", '<span style="font-weight:bold;color:red;">'.$lang[today].'</span>', "news");	} else {		$template -> AddTag("NEWS_DATE", $date . '&nbsp;' . $time, "news");	}		/* 		SEO URL	*/	if($cfg['url_rewrite'] == 1) {		$template -> AddTag("NEWS_LINK", 'news#'.$news->id, "news");	} else {		$template -> AddTag("NEWS_LINK", 'news.php#'.$news->id, "news");	}	$template -> AddTag("NEWS_TITLE", $news->title, "news");	$template -> AddTag("NEWS_TEXT", $text, "news");	$template -> ParseRow("news");}$template -> AddTag("ARTICLES_TITLE", $lang['articles']);$main_result=sql_query("SELECT article, title, type, authors, date_pub, date_update, annotation, img, part, column_, item, redir FROM ".$SQL_PREFIX."_articles WHERE part = '1' AND published = 'yes' ORDER BY date_update DESC ");$total_result=sql_num_rows($main_result);$template -> AddRow("articles");for($i=0;($i<(5)) && ($i<$total_result);$i++) {	$articles = sql_fetch_object($main_result);		$result=sql_query("SELECT title, address FROM ".$SQL_PREFIX."_articles_column WHERE id = '" . $articles->column_ . "';");	$column = sql_fetch_object($result);		/* Authors */	$articles->author = explode(';', $articles->authors);	for($j=0;$j<(count($articles->author)-1);$j++) 	{		$result = sql_query("SELECT name, item FROM ".$SQL_PREFIX."_authors WHERE id = '" . $articles->author[$j] . "';");		$author = sql_fetch_object($result);				if($j != (count($articles->author)-2)) 		{			if($cfg['url_rewrite'] == 1) 			{				$article_authors .= '<a href="'. $cfg['server_url'] .'author/'. $author->item .'">'. $author->name .'</a>, ';			}			else 			{				$article_authors .= '<a href="'. $cfg['server_url'] .'author.php?name='. $author->item .'">'. $author->name .'</a>, ';			}		} 		else 		{			if($cfg['url_rewrite'] == 1) 			{				$article_authors .= '<a href="'. $cfg['server_url'] .'author/'. $author->item .'">'. $author->name .'</a>';			}			else 			{				$article_authors .= '<a href="'. $cfg['server_url'] .'author.php?name='. $author->item .'">'. $author->name .'</a>';			}		}					}	        	$result=sql_query("SELECT id FROM ".$SQL_PREFIX."_comments_articles WHERE idw = '" . $articles->article . "';");	$post['count'] = sql_num_rows($result);			  	$result=sql_query("SELECT type FROM ".$SQL_PREFIX."_articles_types WHERE id = '" . $articles->type . "';");	$row_array = sql_fetch_row($result);		$type = $row_array[0];	        	include('lib/comments.php');		$date = $articles->date_pub;	$date_pub = DateFormat($date);	$date = $articles->date_update;	$date_update = DateFormat($date); 			/* Normal articles */if(empty($articles->redir)) {		if(!empty($articles->img)) 	{ 		$template -> AddTag("ARTICLE_IMG_P1", '<table class="article-index-table"><tr><td style="width:82px;">		<img src="data/stories/'.$articles->img.'" alt="'. $articles->title   . '"  width="80" height="80" /></td><td>', "articles");	}		/* 		SEO URL	*/	if($cfg['url_rewrite'] == 1) 	{		$template -> AddTag("ARTICLE_URL", $cfg['server_url'] .'article/'. $column->address .'/'. $articles->item, "articles");	} 	else 	{		$template -> AddTag("ARTICLE_URL", $cfg['server_url'] .'article.php?item='. $articles->item, "articles");	}		$template -> AddTag("ARTICLE_TITLE", $articles->title, "articles");	$template -> AddTag("ARTICLE_DATE_PUB", $date_pub, "articles");		if($articles->date_pub != $articles->date_update) 	{ 		$template -> AddTag("ARTICLE_DATE_UPDATE", ' <span style="color:#ff0000;font-weight:bold;">'. $lang[updated] .': '. $date_update .'</span>', "articles"); 	}		$template -> AddTag("ARTICLE_AUTHORS", ', '. $article_authors, "articles");	$template -> AddTag("ARTICLE_TYPE", ', '.$type, "articles");	$template -> AddTag("ARTICLE_COMMENTS", ', <a href="comments.php?article='.$articles->article .'">'. $post['count'] . ' ' . $post['name'] .'</a>', "articles");		$template -> AddTag("ARTICLE_ANNOTATION", $articles->annotation, "articles");	if(!empty($articles->img)) { $template -> AddTag("ARTICLE_IMG_P2", '</td></tr></table>', "articles"); }}/* Redirect articles *//*if(!empty($articles->redir)) {	echo('<div class="article-index">');	if(!empty($articles->img)) { echo('<table class="article-index-table"><tr><td style="width:82px;">');		echo('<img src="data/stories/'.$articles->img.'" alt="'. $articles->title   . '"  width="80" height="80" />');		echo('</td><td>'); 	}	echo('<h3><a href="redirect.php?url='. $articles->redir   . '">'. $articles->title   . '</a></h3>');	echo('<div class="info">'. $date . ', '.$type.'</div>');	echo('<div class="annotation">'. $articles->annotation .'</div>');	if(!empty($articles->img)) {echo('</td></tr></table>');}	echo('</div>');}*/		unset($article_authors);		$template -> ParseRow("articles");	}$template -> AddMainTemplate('main.php');echo($template -> Render());?>