Riferimento: PRoblema news retro
uso xamp 1.7.1
--------------- AGGIUNTA AL POST ---------------
ekko qui tutto news.php
<?php
/*=========================================================+
|| # XdrCMS - Sistema de administración de contenido Habbo.
|+=========================================================+
|| # Copyright © 2011 Xdr. All rights reserved.
|| #
|+=========================================================+
|| # Lns 2011. The power of Proyects.
|| # Este es un Software de código libre, libre edición.
|+=========================================================+
|| # Todas las imagenes, scripts y temas
|| # Copyright (C) 2011 Sulake Ltd. All rights reserved.
|+=========================================================*/
$noads = true;
require_once('./includes/core.php');
$id = FilterText($_GET['id']);
$category = FilterText(textInJS($_GET['category']));
$archive = FilterText($_GET['archive']);
$pageid = FilterText($_GET['pageidber']);
if(!isset($_GET['pageidber']))
{
$pageid = 1;
}
if(!isset($id) || $id == "")
{
$id = mysql_result(mysql_query("SELECT MAX(id) AS count FROM cms_news WHERE type = 'article' LIMIT 1"),0,0);
}
$news_row = mysql_query("SELECT * FROM cms_news WHERE id = '".$id."' AND type = 'article' LIMIT 1");
$news_exist = mysql_num_rows($news_row);
if($news_exist > 0)
{
$news_row = mysql_fetch_assoc($news_row);
foreach ($news_row as &$value)
{
$value = FilterText($value, true);
}
}
if($_SESSION['news']['preview'] == true)
{
$news_exist = 1;
$news_row['title'] = $_SESSION['news']['title'];
$news_row['category'] = $_SESSION['news']['category'];
$news_row['short_story'] = $_SESSION['news']['short_story'];
$news_row['story'] = $_SESSION['news']['story'];
$news_row['author'] = $_SESSION['news']['name'];
$news_row['date'] = $date_name;
$only_preview = true;
}
$body_id = "news";
$pageid = "articles";
if($news_exist > 0)
{
$pagename = "Noticias - ".HoloText($news_row['title'], true);
}
else
{
$pagename = "Noticias - Artículo no encontrado";
}
if($news_exist > 0 && $only_preview !== true)
{
if(!empty($_POST['comment']))
{
$security_time = $_SESSION['comment_post'] + (10);
if(empty($_SESSION['comment_post']) || $security_time < time())
{
$comment = FilterText(SwitchWordFilter($_POST['comment']));
mysql_query("INSERT INTO cms_comments (userid,newid,comment,date) VALUES ('".$my_id."','".$id."','".$comment."','".$date_name."')") or die (mysql_error());
$msg = "Tu mensaje ha sido publicado con éxito.";
$_SESSION['comment_post'] = time();
} else {
$msg = "Has grabado tus datos demasiado rápido. Por favor, tómate un minuto para que podamos registrarlos correctamente.";
}
}
}
$id2 = $_GET['delete'];
if(is_numeric($id2))
{
$check = mysql_query("SELECT id FROM cms_comments WHERE id = '" . $id2 . "' LIMIT 1") or die(mysql_error());
$exists = mysql_num_rows($check);
if($exists > 0)
{
if($my_rank > 5)
{
mysql_query("DELETE FROM cms_comments WHERE id = '" . $id2 . "' LIMIT 1");
$msg = "El comentario ha sido eliminado con éxito.";
}
else
{
$msg = "No tienes suficiente rango.";
}
}
else
{
$msg = "No existe.";
}
}
require_once('templates/community_subheader.php');
?>
<div id="container">
<div id="content" style="position: relative" class="clearfix">
<div id="column1" class="column">
<div class="habblet-container ">
<div class="cbb clearfix default ">
<h2 class="title">Noticias
</h2>
<div id="article-archive">
<?php if(isset($_GET['archive']) && $archive = "true"){
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM cms_news WHERE type = 'article'"),0,0);
$pages = ceil($count / 20);
?>
<div id="article-paging" class="clearfix">
<?php if(($pageid + 1) <= $pages){ ?><a href="<?php echo PATH; ?>/articles/archive?pageidber=<?php echo $pageid + 1; ?>" class="older"><< Anterior</a><?php } ?>
<?php if(($pageid - 1) > 0){ ?><a href="<?php echo PATH; ?>/articles/archive?pageidber=<?php echo $pageid - 1; ?>" class="newer">Siguiente >></a><?php } ?>
</div>
<?php }
if((empty($archive) || $archive == "false") && empty($category)){
$time['stop'] = time() - 60*60*24;
$sql = mysql_query("SELECT * FROM cms_news WHERE time > ".$time['stop']." AND type = 'article' ORDER BY id DESC");
if(mysql_num_rows($sql) > 0){ ?>
<h2>Hoy</h2>
<ul>
<?php while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true); ?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php }
$time['start'] = time() - 60*60*24; $time['stop'] = time() - 60*60*24*2;
$sql = mysql_query("SELECT * FROM cms_news WHERE time < ".$time['start']." AND time > ".$time['stop']." AND type = 'article' ORDER BY id DESC");
if(mysql_num_rows($sql) > 0){ ?>
<h2>Ayer</h2>
<ul>
<?php while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true); ?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php }
$time['start'] = time() - 60*60*24*2; $time['stop'] = time() - 60*60*24*7;
$sql = mysql_query("SELECT * FROM cms_news WHERE time < ".$time['start']." AND time > ".$time['stop']." AND type = 'article' ORDER BY id DESC");
if(mysql_num_rows($sql) > 0){ ?>
<h2>Esta semana</h2>
<ul>
<?php while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true); ?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php }
$time['start'] = time() - 60*60*24*7; $time['stop'] = time() - 60*60*24*14;
$sql = mysql_query("SELECT * FROM cms_news WHERE time < ".$time['start']." AND time > ".$time['stop']." AND type = 'article' ORDER BY id DESC");
if(mysql_num_rows($sql) > 0){ ?>
<h2>La semana anterior</h2>
<ul>
<?php while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true); ?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php }
$time['start'] = time() - 60*60*24*14; $time['stop'] = time() - 60*60*24*30;
$sql = mysql_query("SELECT * FROM cms_news WHERE time < ".$time['start']." AND time > ".$time['stop']." AND type = 'article' ORDER BY id DESC");
if(mysql_num_rows($sql) > 0){ ?>
<h2>Este mes</h2>
<ul>
<?php while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true); ?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php }
} elseif(isset($_GET['archive']) && $archive = "true"){ ?>
<h2>Noticias</h2>
<ul>
<?php
$sql = "SELECT * FROM cms_news WHERE type = 'article' ORDER BY time DESC LIMIT 20";
if($pageid > 1){ $sql = $sql." OFFSET ".($pageid - 1) * 20; }
$sql = mysql_query($sql);
while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true);
?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/archive<?php if($pageid > 1){ echo $pageid; } ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php } elseif(isset($category)){ ?>
<h2><?php echo $category; ?></h2>
<ul>
<?php
$sql = mysql_query("SELECT * FROM cms_news WHERE category = '".$category."' AND type = 'article'");
while($row = mysql_fetch_assoc($sql)){ $row['title_safe'] = stringToURL(HoloText($row['title'],true),true,true); ?>
<li>
<a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/category/<?php echo $category; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a>
</li>
<?php } ?>
</ul>
<?php } ?>
<a href="<?php echo PATH; ?>/articles/archive">Más noticias »</a>
</div>
</div>
</div>
<script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
</div>
<div id="column2" class="column">
<?php
function FilterNew($str, $news_id)
{
$str = str_replace('<', '<', nl2br($str));
$str = str_replace('>', '>', nl2br($str));
$str = str_replace('p;', 'p', nl2br($str));
$str = str_replace('/p;', '/p', nl2br($str));
$str = str_replace('em;', 'em', nl2br($str));
$str = str_replace('/em;', '/em', nl2br($str));
$str = str_replace('"', '"', nl2br($str));
$str = str_replace('&nbsp', ' ', nl2br($str));
$str = str_replace('¿', '¿', nl2br($str));
$str = str_replace('&', '&', nl2br($str));
$str = str_replace('\r\n', '', nl2br($str));
$str = str_replace('\"', '"', nl2br($str));
$str = str_replace("\'", "'", nl2br($str));
$str = str_replace('%link_results%', ''.PATH.'/submitResults?id='.$news_id.'', nl2br($str));
$str = str_replace('”', '"', nl2br($str));
$str = str_replace('ola', 'hola', nl2br($str));
$str = str_replace('Ola', 'Hola', nl2br($str));
$str = str_replace('adios', 'adiós', nl2br($str));
$str = str_replace('hi', 'Buenas', nl2br($str));
return $str;
}
?>
<div class="habblet-container ">
<div class="cbb clearfix notitle ">
<div id="article-wrapper">
<?php if($news_exist > 0){ ?>
<h2><?php echo $news_row['title']; ?></h2>
<div class="article-meta">Publicado el <?php echo $news_row['date']; ?>
<a href="<?php echo PATH; ?>/articles/category/<?php echo $news_row['category']; ?>"><?php echo $news_row['category']; ?></a></div>
<p class="summary"><?php echo HoloText($news_row['short_story'], true); ?></p>
<div class="article-body">
<p><?php echo FilterNew($news_row['story'], $news_row['id']); ?></p>
<p><?php if(!empty($_SESSION['news_message'])) { ?><center><b><?php echo $_SESSION['news_message']; unset($_SESSION['news_message']); ?></b></center><?php } ?></p>
<div class="article-author"><?php echo HoloText($news_row['author'], true); ?></div>
<?php if($only_preview == true){ ?><p><br /><br /><h3><a href="<?php echo PATH; ?>/<?php echo $hpath; ?>/index?p=news_compose" class="button">Regresar a la edición del articulo -></a><br /><a href="<?php echo PATH; ?>/<?php echo $hpath; ?>/index?p=news_compose&do=cancel" class="button">Cancelar la edición del articulo -></a></h3></p><?php } ?>
<div class="article-images clearfix">
</div>
<div class="article-body"><!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&username=xa-4bb4df6b11e436c1"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Compartir" style="border:0;position:absolute;top:40px;left:627px;"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4bb4df6b11e436c1"></script>
<!-- AddThis Button END -->
<?php if($is_facebook == true){ ?>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo PATH; ?>articles/<?php echo $id; ?>-<?php echo stringToURL(HoloText($news_row['title'],true),true,true); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
<p style="font-size: 10px; color: #333333; padding: 2px 0px 2px 14px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;"><strong>También estamos en:</strong></p> <p style="padding: 2px 5px 0px 14px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;"> <a href="http://www.twitter.com/<?php echo getConfig("twitter_user"); ?>"><img src="<?php echo PATH; ?>/web-gallery/c_images/twitter_b.png" border="0" alt="Twitter"/></a></div>
<?php } else { ?>
<p style="font-size: 10px; color: #333333; padding: 2px 0px 2px 14px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;"><strong>Estamos en:</strong></p> <p style="padding: 2px 5px 0px 14px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;"> <a href="http://apps.facebook.com/<?php echo getRpx("facebook_app"); ?>"><img src="<?php echo PATH; ?>/web-gallery/c_images/facebook.png" border="0" alt="Facebook"/></a> <a href="http://www.twitter.com/<?php echo getConfig("twitter_user"); ?>"><img src="<?php echo PATH; ?>/web-gallery/c_images/twitter_b.png" border="0" alt="Twitter"/></a></div>
<?php } ?>
<script type="text/javascript" language="Javascript">
document.observe("dom:loaded", function() {
$$('.article-images a').each(function(a) {
Event.observe(a, 'click', function(e) {
Event.stop(e);
Overlay.lightbox(a.href, "Cargando imagen");
});
});
$$('a.article-<?php echo $news_row['id']; ?>').each(function(a) {
a.replace(a.innerHTML);
});
});
</script>
</div>
</div>
</div>
</div>
<style type="text/css">
input[type="text"], input[type="password"] {
background-color: #F1F1F1;
border: 1px solid #999999;
width: 175px;
padding: 5px;
font-family: verdana;
font-size: 10px;
color: #666666;
}
input[type="submit"] {
background-color: #F1F1F1;
border: 1px solid #999999;
padding: 5px;
font-family: verdana;
font-size: 10px;
}
textarea {
background-color: #F1F1F1;
border: 1px solid #999999;
padding: 5px;
width: 517px;
height: 70px;
font-family: verdana;
font-size: 10px;
color: #666666;
}
select {
background-color: #F1F1F1;
border: 1px solid #999999;
padding: 5px;
font-family: verdana;
font-size: 10px;
color: #666666;
}
</style>
<link rel="stylesheet" href="<?php echo $webgallery; ?>/styles/myhabbo/buttons.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $webgallery; ?>/styles/myhabbo/control.textarea.css" type="text/css" />
<script src="<?php echo $webgallery; ?>/static/js/homeview.js" type="text/javascript"></script>
<script src="<?php echo $webgallery; ?>/static/js/homeauth.js" type="text/javascript"></script>
<?php if(LOGGED_IN == TRUE && $only_preview !== true){ ?>
<div class="habblet-container ">
<div class="cbb clearfix notitle ">
<div id="article-wrapper"><h2>¡Comenta!</h2>
<div class="article-meta"></div>
<div class="article-body">
<br /><b><?php echo $msg; ?></b></br />
<form action="" method="post">
<textarea name="comment" maxlength="500" id="post-message"></textarea><br /><br />
<script type="text/javascript">
bbcodeToolbar = new Control.TextArea.ToolBar.BBCode("post-message");
bbcodeToolbar.toolbar.toolbar.id = "bbcode_toolbar";
var colors = { "red" : ["#d80000", "Rojo"],
"orange" : ["#fe6301", "Naranja"],
"yellow" : ["#ffce00", "Amarillo"],
"green" : ["#6cc800", "Verde"],
"cyan" : ["#00c6c4", "Cyan"],
"blue" : ["#0070d7", "Azul"],
"gray" : ["#828282", "Gris"],
"black" : ["#000000", "Negro"]
};
bbcodeToolbar.addColorSelect("Color", colors, false);
</script>
<input type="submit" name="post_comment" value="Publicar" />
</form>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if($only_preview !== true){ ?>
<?php
function FilterComment($str, $news_id)
{
$str = str_replace('[', '<', nl2br($str));
$str = str_replace(']', '>', nl2br($str));
$str = str_replace('color=', 'font color=', nl2br($str));
$str = str_replace('/color', '/font', nl2br($str));
$str = str_replace('url=', 'a title="w" href=', nl2br($str));
$str = str_replace('/url', '/a', nl2br($str));
return $str;
}
?>
<div class="habblet-container ">
<div class="cbb clearfix notitle ">
<div id="article-wrapper"><h2>Comentarios (<?php echo mysql_evaluate("SELECT COUNT(*) FROM cms_comments WHERE newid = '".$id."'"); ?>)</h2>
<div class="article-meta"></div>
<div class="article-body">
<table width="528px">
<?php
$get_comments = mysql_query("SELECT * FROM cms_comments WHERE newid = '".$id."' LIMIT 15");
if(mysql_num_rows($get_comments) > 0)
{
while($row = mysql_fetch_assoc($get_comments))
{
$urow = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE id = '".$row['userid']."' LIMIT 1"));
?>
<tr>
<td width="90px" valign="top">
<div style="float:left"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=<?php echo $urow['look']; ?>&size=s&direction=2&head_direction=3&gesture=sml&size=m"></div>
</td>
<td width="427px" valign="top">
<strong>RE: <?php echo HoloText($news_row['title'], true); ?></strong> <?php if($my_rank > 5){ ?><strong><a href="<?php echo PATH; ?><?php echo $row['id']; ?>"></a><?php } ?><br /><br /><?php echo FilterComment($row['comment'], true, true); ?>
</td>
</tr>
<tr>
<td width="90px" valign="top">
</td>
<td width="427px" align="right">
<i>Publicado por <strong><a href="<?php echo PATH; ?>/home/<?php echo $urow['username']; ?>"><?php echo $urow['username']; ?></a></strong> el <?php echo $row['date']; ?></i><br /><br />
</td>
</tr>
<?php } } else { ?>
No hay comentarios disponibles. ¡Publica uno!
<?php } ?>
</table>
</div>
</div>
</div>
</div>
<?php } ?>
<?php } else { ?>
<h2>Artículo no encontrado</h2>
<div class="article-meta" style="height: 1px"> </div>
El artículo que buscas no se ha encontrado. Por favor, pulsa en volver en tu navegador para retroceder a la página anterior.
</div>
</div>
</div>
<?php } ?>
<script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
</div>
</div>
<?php
include('templates/community_footer.php');
?>
@
Babbacheseitee