25/09/2008, 02:34
|
| | Fecha de Ingreso: abril-2006
Mensajes: 34
Antigüedad: 18 años, 8 meses Puntos: 0 | |
Respuesta: Ayuda con modificación para PHPnews Continuación codigo:
Código:
/* Show Next Page Link? */
if($nextpage != 0)
{
echo '<span style="margin-left:5px;"><a href="' , $_SERVER['PHP_SELF'] , '?prevnext=' , $nextpage , '">' , $language['CONTENT_NEXT'] , '</a></span>';
echo "\n";
}
}
}
function fullNews()
{
global $Settings, $language, $_SERVER, $path, $showcomments, $db_prefix;
/* Get information about the News Post */
$SQL_query = mysql_query('SELECT n.id,n.posterid,n.postername,n.time,n.subject,n.titletext,n.maintext,n.catid,p.username,p.email,p.avatar,c.catname,c.caticon'
. ' FROM ' . $db_prefix . 'news AS n'
. ' LEFT JOIN ' . $db_prefix . 'posters AS p ON(n.posterid=p.id)'
. ' LEFT JOIN ' . $db_prefix . 'categories AS c ON(n.catid=c.id)'
. ' WHERE n.id = ' . $_GET['id'] . ''
. ' AND n.trusted = 1');
if (!$_GET['id'])
{
echo '<b>' , $language['CONTENT_ERROR'] , '</b>: ' , $language['CONTENT_GENERALERROR'];
}
else if (!mysql_numrows($SQL_query))
{
echo '<b>' , $language['CONTENT_ERROR'] , '</b>: ' , $language['CONTENT_NOTEXISTS'];
}
else
{
/* Prints JavaScript for Send to Friend Link */
if ($Settings['enablestf'] == 1)
{
?>
<script type="text/javascript">
<!--
function sendtof(desktopURL)
{
desktop = window.open(desktopURL, "SendToFriend", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=400,height=275,resizable=no");
}
// -->
</script>
<?
}
/* Put News Post Info into an Array */
$news = mysql_fetch_assoc($SQL_query);
/* Set the Variables */
$time = strftime($Settings['shorttimeformat'], $news['time']);
$subject = stripslashes($news['subject']);
$titletext = stripslashes($news['titletext']);
$maintext = stripslashes($news['maintext']);
/* Find out who made the post */
$username = $news['username'];
$email = $news['email'];
/* Print Comments if enabled */
if($Settings['enablecomments'] == 1)
{
$query2 = mysql_query('SELECT count(*) as total FROM ' . $db_prefix . 'comments WHERE mid = ' . $_GET['id'] . '');
$var = mysql_fetch_assoc($query2);
$comments = '<a href="' . $_SERVER['PHP_SELF'] . '?action=fullnews&showcomments=1&id=' . $_GET['id'] . '">' . $language['CONTENT_NEWSCOMMENTS'] . ' (' . $var['total'] . ')</a>';
}
/* If Categories are enabled... */
if ($Settings['enablecats'] == 1)
{
if ($news['catid'] != 0)
{
$category = '<a href="' . $_SERVER['PHP_SELF'] . '?action=showcat&catid=' . $news['catid'] . '">' . $news['catname'] . '</a>';
if ($cat['caticon'] != '' && is_array($cat))
{
$caticon = '<img src="' . $news['caticon'] . '" border="0" alt="' . $news['catname'] . '" />';
}
else
{
$caticon = '';
}
}
}
if($Settings['enableavatars'] == '1' && $row['avatar'] != '')
{
$avatar = '<img src="' . $row['avatar'] . '" border="0" alt="' . $username . '\'s avatar" />';
}
if(!$username)
{
$username = $news['postername'];
}
if($Settings['enablestf'] == 1)
{
$sendtofriend = '<a href="javascript:sendtof(\'' . $Settings['phpnewsurl'] . 'sendtofriend.php?mid=' . $_GET['id'] . '\')">' . $language['CONTENT_NEWSSTFLINK'] . '</a>';
}
/* Parse the code */
$maintext = parseCode($maintext);
$titletext = parseCode($titletext);
/* Include the Template */
include($path . 'templates/fullnews_temp.php');
/* Include the Comments */
if($_GET['showcomments'] == 1 && $Settings['enablecomments'] == 1)
{
comments();
}
}
}
function comments()
{
global $_SERVER, $Settings, $language, $path, $db_prefix;
/* Order comments */
if ($Settings['showoldcomfirst'] != 1)
{
$order = ' DESC';
}
/* Get the data for all the Comments */
$com_Query = mysql_query('SELECT time,name,message,email,website FROM ' . $db_prefix . 'comments WHERE mid = ' . $_GET['id'] . ' ORDER by id' . $order . '');
while ($comment = mysql_fetch_assoc($com_Query))
{
$time = strftime($Settings['shorttimeformat'], $comment['time']);
$message = $comment['message'];
if ($comment['website'] != '')
{
$link = '[<a href="' . $comment['website'] . '">' . $language['CONTENT_NEWSWEBSITE'] . '</a>]';
}
else
{
$link = '';
}
/* Censor comment if it is enabled */
if ($Settings['enablecensor'] == 1)
{
$comment['name'] = censor($comment['name']);
$message = censor($message);
}
if ($comment['email'] != '')
{
$name = '<a href="mailto:' . $comment['email'] . '">' . $comment['name'] . '</a>';
}
else
{
$name = $comment['name'];
}
/* Include Template for Added Comments */
include($path . 'templates/comments_temp.php');
}
/* Check if User is banned from making Comments */
$isBanned = checkUserIP($_SERVER['REMOTE_ADDR']);
/* If the person is banned, print warning message */
if ($isBanned == 1)
{
echo '<br /><b>' , $language['CONTENT_ERROR'] , '</b>: ' , $language['CONTENT_BANNED'];
}
else
{
/* Otherwise, print the form and include the template for adding comments */
echo '
<form action="' , $_SERVER['PHP_SELF'] , '?action=post" method="post">
<p style="margin:0px;">
<input type="hidden" name="mid" value="' , $_GET['id'] , '" />
</p>' , "\n";
include($path . 'templates/comment_temp.php');
echo '
</form>' , "\n";
}
}
function showCat()
{
global $Settings, $language, $_SERVER, $path, $db_prefix;
/* Display Category News if it's enabled */
if ($Settings['enablecats'] != 1)
{
echo '<b>' , $language['CONTENT_ERROR'] , '</b>: ' , $language['CONTENT_DISABLED'];
}
else
{
/* Prints JavaScript for Send to Friend Link */
if ($Settings['enablestf'] == 1)
{
?>
<script type="text/javascript">
<!--
function sendtof(desktopURL)
{
desktop = window.open(desktopURL, "SendToFriend", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=400,height=275,resizable=no");
}
// -->
</script>
<?
}
/* Set up Previous/Next links if enabled */
if ($Settings['enableprevnext'] == 1)
{
/* If we're on the first page set defaults */
if (!isset($_GET['prevnext']) || $_GET['prevnext'] == 0)
{
$_GET['prevnext'] = 0;
$nextpage = $_GET['prevnext'] + $Settings['numtoshowcat'];
$previouspage = $_GET['prevnext'];
/* Find total number of News Posts */
$numPosts = mysql_query('SELECT count(*) as total FROM ' . $db_prefix . 'news WHERE catid=' . $_GET['catid'] . '');
$var = mysql_fetch_assoc($numPosts);
/* Only Include Previous/Next links if there is another page! */
if ($var['total'] > $Settings['numtoshowcat'])
{
$include = 1;
}
}
/* Otherwise calculate prev/next links */
else if (isset($_GET['prevnext']) && is_Numeric($_GET['prevnext']))
{
$previouspage = $_GET['prevnext'] - $Settings['numtoshowcat'];
/* Find total number of News Posts */
$numPosts = mysql_query('SELECT count(*) as total FROM ' . $db_prefix . 'news WHERE catid=' . $_GET['catid'] . '');
$var = mysql_fetch_assoc($numPosts);
/* If the number of posts is greater, there's enough room for another page */
if ($var['total'] > ($_GET['prevnext'] + $Settings['numtoshowcat']))
{
$nextpage = $_GET['prevnext'] + $Settings['numtoshowcat'];
}
else
{
$nextpage = 0;
}
/* Include Previous/Next Template */
$include = 1;
}
}
else
{
$_GET['prevnext'] = 0;
}
$SQL_query = mysql_query('SELECT n.id,n.posterid,n.postername,n.time,n.subject,n.titletext,n.maintext,n.catid,p.username,p.email,p.avatar,c.catname,c.caticon'
. ' FROM ' . $db_prefix . 'news AS n'
. ' LEFT JOIN ' . $db_prefix . 'posters AS p ON(n.posterid=p.id)'
. ' LEFT JOIN ' . $db_prefix . 'categories AS c ON(n.catid=c.id)'
. ' WHERE n.catid = ' . $_GET['catid'] . ''
. ' AND n.trusted = 1'
. ' ORDER by n.id DESC'
. ' LIMIT ' . $_GET['prevnext'] . ', ' . $Settings['numtoshowcat'] . '');
while($news = mysql_fetch_assoc($SQL_query))
{
|