All pastes #213927 Raw Edit

Smith

public php v1 · immutable
#213927 ·published 2006-10-21 18:38 UTC
rendered paste body
<?php/***		CMS Faethon 1.3		Avalanche Comments System		  		Copyright (C) 2006  Jakub Slová&#269;ek		Contact - slovacek@cmsfaethon.com, http://cmsfaethon.com/	  		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.	@version: comments.php, ver 1.0, 2006/02/22***/$mainpath="./";/* nacteni zakladnich knihoven, konfiguracniho a jazykoveho souboru *//*require('lib/functions_SQL.php');require('lib/functions_DATE.php');require('config.php');require('lang/'.$cfg['lang'].'.inc');*//* urcteni zda se jedna o komentar pro clanek, aktualitu nebo info stranku *//*if(isset($_GET['article'])) {	$result=sql_query("SELECT article, title FROM ".$SQL_PREFIX."_articles WHERE article = '" . $_GET['article'] . "';");  $row = sql_fetch_object($result);  		$title = $row->title;	include($mainpart . 'data/header.php');		echo('<h3>'. $lang[comments_to_article] .': <a href="'. $mainpath . 'article.php?id='. $_GET['article'] .'">'. $row->title .'</a></h3>');    $id = $_GET['article'];  $suffix = 'articles';  $for = 'article';   }elseif(isset($_GET['news'])) {	$result=sql_query("SELECT id, title, item FROM ".$SQL_PREFIX."_news WHERE id = '" . $_GET['news'] . "';");  $row = sql_fetch_object($result);  		$title = $row->title;	include($mainpart . 'data/header.php');		echo('<h3>'. $lang[comments_to_news] .': <a href="'. $mainpath . 'news.php?item='. $row->item .'">'. $row->title .'</a></h3>');    $id = $_GET['news'];  $suffix = 'news';  $for = 'news';   }elseif(isset($_GET['info'])) {	}*/$id = $article->id;$suffix = 'articles';$for = 'article';echo('<a href="#new">'. $lang[new_comment] .'</a>');/* prehled komentaru *//*echo('<table id="comments-table" cellspacing="0">');echo('<tr><td id="subject">'. $lang[comment_subject] .'</td><td id="author">'. $lang[comment_author] .'</td><td id="date-time">'. $lang[comment_datetime] .'</td></tr>');	$lang_isnt_comments = $lang[isnt_comments];function exposeTree($tree) {global $level, $id,$SQL_PREFIX,$lang_isnt_comments,$date,$time,$suffix,$for;	$level=$level+1;	$space='';	for ($i=1;$i<$level;$i++) {  	$space.="&nbsp;&nbsp;&nbsp;";	}	$result=sql_query("SELECT id, reply, author, email, subject, time FROM ".$SQL_PREFIX."_comments_".$suffix." WHERE idw = '" . $id . "' and reply = '" . $tree . "';");	if ($result == 0) {		echo('<div style="text-align:center;">Error MySQL ' . mysql_errno() . ': ' . mysql_error() . '</div>');	} elseif (sql_num_rows($result) == 0) {		if($tree=='0') {echo('<tr><td colspan="3"><br /><div style="text-align:center;">'.$lang_isnt_comments.'</div><br /></td></tr>');} else {  }	} else {	for ($i=0;$i<sql_num_rows($result);$i++) {		$comment = sql_fetch_object($result);					$date = substr($comment->time, 0, 10);		$time = $comment->time;		$month = substr($comment->time, 5, 2);				DateFormat($date);		TimeFormat($time);					echo('<tr>');		if(strlen($comment->subject) < 30) {			echo('<td>'. $space .'<a href="#'.$comment->id.'">'. $comment->subject .'</a></td>'); 		} else {			echo('<td>'. $space . substr($comment->subject, 0, 29) .'...</td>');		}		if(strlen($comment->author) < 20) {			echo('<td>'. $comment->author .'</td>');		} else {			echo('<td>'. substr($comment->author, 0, 19) .'...</td>');		}		echo('<td>'. $date .'&nbsp;'. $time .'</td>');		echo('</tr>');		exposeTree($comment->id);	}}    $level=$level-1;}$level='0';exposeTree(0);echo('</table>');*//* vypis komentaru */echo('<br />');$lang_isnt_comments = $lang[isnt_comments];$lang_reply_comment = $lang[reply_comment];$cfg_server_url = $cfg['server_url'];function expose($tree) {	global $level,$id,$SQL_PREFIX,$lang_isnt_comments,$lang_reply_comment,$day,$month,$date,$time,$suffix,$for,$cfg_server_url;	$level=$level+1;	$space='';	for ($i=1;$i<$level;$i++) {	  $space.='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';	}	$result=sql_query("SELECT * FROM ".$SQL_PREFIX."_comments_".$suffix." WHERE idw = '" . $id . "' and reply = '" . $tree . "';");		if ($result == 0) {	   echo('<div style="text-align:center;">Error MYSQL ' . mysql_errno() . ': ' . mysql_error() . '</div>');	}	elseif (sql_num_rows($result) == 0) {		if($stromid=='0') {	  	echo('<div style="text-align:center;">'.$lang_isnt_comments .'</div>');		}	} else {			for ($i=0;$i<sql_num_rows($result);$i++) {			$comment = sql_fetch_object($result);						$year = substr($comment->time, 0, 4);			$month = substr($comment->time, 4, 2);			$day = substr($comment->time, 6, 2);					$date = $year.'-'.$month.'-'.$day;								$hour = substr($comment->time, 8, 2);			$min = substr($comment->time, 10, 2);			$sec = substr($comment->time, 12, 2);					$time = $hour.':'.$min.':'.$sec;						$fulldate = $date.' '.$time;			DateFormat($date);			TimeFormat($time);			$day = date('D', strtotime($fulldate));			NameDay($day);						if(!empty($comment->ip)) {				$host = gethostbyaddr($comment->ip);				if($host == $comment->ip) {					$ipExplode = explode('.',$comment->ip);					$ip = $ipExplode[0].'.'.$ipExplode[1].'.'.$ipExplode[2].'.'.'x'; 				} else {					$ip = $host;				}			}						                 			echo('<table class="comment"><tr><td>');			echo($space . '</td><td style="width:100%">');			echo('<div class="comment">');			echo('<div class="comment-title"><div class="comment-date">'. $day .', '. $date .'&nbsp;'. $time .'</div>');			echo('<a name="'. $comment->id .'" style="text-decoration:none;">Titulek: <strong>' . $comment->subject . '</strong></a><br />');			echo('Autor: <strong>' . $comment->author . "</strong>, "); 			if(!empty($comment->email)) {				echo($comment->email . ',&nbsp;');			}			echo($ip .'</div>');			echo('<div class="comment-text">'. $comment->text .'</div>'); 			echo('</div></td></tr>');			echo('<tr><td></td><td><div class="comment-reply"><a href="'. $cfg_server_url .'blog_comments-r.php?reply='. $comment->id . '&amp;'. $for .'=' . $id . '">'. $lang_reply_comment .'</a></div></td></tr>');			echo('</table><br />');						   			expose($comment->id);		}		} 		$level=$level-1;}$level='0';expose(0);/* Vlozeni noveho komentare */echo('<script type="text/javascript" src="'. $cfg['server_url'] .'js/edit-panel.js"></script>');echo('<div class="no-link"><h3><a name="new">'. $lang[new_comment] .'</a></h3></div><form method="post" action="'. $cfg['server_url'] .'blog_comments-r.php?');if($suffix == 'articles') {	echo('article');}elseif($suffix == 'news') {	echo('news');}elseif($suffix == 'info') {	echo('info');}echo('='. $id .'&amp;reply=0"><div>	<input type="hidden" name="idw" value="'. $id .'" />	<input type="hidden" name="reply" value="" />	<input type="hidden" name="sent" value="yes" />	<input type="hidden" name="staryprispevek" value="" />');if(isset($_SESSION['nickname'])) {	$user_name = $_SESSION['realname'];	$user_email = $_SESSION['user_email'];} else {	$user_name = $_COOKIE['f_comment_author'];	$user_email = $_COOKIE['f_comment_email'];}echo('<table><tr>	<td><strong>'. $lang[comment_name] .': </strong></td><td><input type="text" name="author" style="width:400px" value="'. $user_name .'" /></td></tr><tr>	<td><strong>'. $lang[comment_email] .': </strong></td><td><input type="text" name="email" style="width:400px" value="'. $user_email .'" /></td></tr><tr>	<td><strong>'. $lang[comment_subject] .': </strong></td><td><input type="text" name="subject" style="width:400px" /></td></tr></table><div class="button-board">	<a class="button" onclick="boldThis()" ><img src="'. $cfg['server_url'] .'data/images/edit-panel/button-strong.png" alt="" style="width:21px;height:20px"/></a>	<a class="button" onclick="italicThis()" ><img src="'. $cfg['server_url'] .'data/images/edit-panel/button-em.png" alt="" style="width:21px;height:20px"/></a>	<a class="button" onclick="underThis()" ><img src="'. $cfg['server_url'] .'data/images/edit-panel/button-u.png" alt="" style="width:21px;height:20px"/></a></div><textarea onkeyup="storeCaret(this); updPreview(\'body\');" onclick="storeCaret(this);" onselect="storeCaret(this);" name="comment" rows="10" cols="56"></textarea><br />');if($cfg['captcha'] == 1 && !isset($_SESSION['nickname'])) {	echo('<table>		<tr>		<td style="vertical-align: top;"><strong>Verification code: </strong></td><td><img src="'. $cfg['server_url'] .'includes/captcha.php" width="120" height="30" alt="Visual CAPTCHA" /></td>		<td style="vertical-align: top;padding-left: 20px;"><strong>Insert this code here: </strong><br /><input type="text" name="user_code" value="" /></td>		</tr>	</table><br />');}if(!isset($_SESSION['nickname'])) { echo('<input type="checkbox" name="remember" value="yes" /> '. $lang[store_name_email]); }echo('<input class="submit" type="submit" value="'. $lang[send_comment] .'" /></div></form>');//include('data/footer.php');?>