ALTER TABLE p_posts ADD post_destacados VARCHAR( 180 ) NOT NULL;
/*
getPreview()
*/
function getPreview(){
global $tsCore;
//
$titulo = $tsCore->setSecure($_POST['titulo'], true);
$cuerpo = $tsCore->setSecure($_POST['cuerpo'], true);
//
return array('titulo' => $titulo, 'cuerpo' => $tsCore->parseBadWords($tsCore->parseBBCode($cuerpo), true));
}
/*
getPreview()
*/
function getPreview(){
global $tsCore;
//
$titulo = $tsCore->setSecure($_POST['titulo'], true);
$destacados = $tsCore->setSecure($_POST['imagen'], true);
$cuerpo = $tsCore->setSecure($_POST['cuerpo'], true);
//
return array('titulo' => $titulo, 'destacados' => $destacados, 'cuerpo' => $tsCore->parseBadWords($tsCore->parseBBCode($cuerpo), true));
}
'title' => $tsCore->parseBadWords($tsCore->setSecure($_POST['titulo'], true)),2,
'destacados' => $tsCore->setSecure($_POST['destacados']),
// INSERTAMOS
$_SERVER['REMOTE_ADDR'] = $_SERVER['X_FORWARDED_FOR'] ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
if(!filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP)) { die('0: Su ip no se pudo validar.'); }
if(db_exec(array(__FILE__, __LINE__), 'query', 'INSERT INTO `p_posts` (post_user, post_category, post_title, post_body, post_date, post_tags, post_ip, post_private, post_block_comments, post_sponsored, post_sticky, post_smileys, post_visitantes, post_status) VALUES (\''.$tsUser->uid.'\', \''.(int)$postData['category'].'\', \''.$postData['title'].'\', \''.$postData['body'].'\', \''.$postData['date'].'\', \''.$postData['tags'].'\', \''.$_SERVER['REMOTE_ADDR'].'\', \''.(int)$postData['private'].'\', \''.(int)$postData['block_comments'].'\', \''.(int)$postData['sponsored'].'\', \''.(int)$postData['sticky'].'\', \''.(int)$postData['smileys'].'\', \''.(int)$postData['visitantes'].'\', '.(!$tsUser->is_admod && ($tsCore->settings['c_desapprove_post'] == 1 || $tsUser->permisos['gorpap'] == true) ? '\'3\'' : '\'0\'').')')) {
$postID = db_exec('insert_id');
// INSERTAMOS
$_SERVER['REMOTE_ADDR'] = $_SERVER['X_FORWARDED_FOR'] ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
if(!filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP)) { die('0: Su ip no se pudo validar.'); }
if(db_exec(array(__FILE__, __LINE__), 'query', 'INSERT INTO `p_posts` (post_user, post_category, post_title, post_body, post_date, post_tags, post_ip, post_private, post_block_comments, post_sponsored, post_sticky, post_smileys, post_visitantes, post_status, post_destacados) VALUES (\''.$tsUser->uid.'\', \''.(int)$postData['category'].'\', \''.$postData['title'].'\', \''.$postData['body'].'\', \''.$postData['date'].'\', \''.$postData['tags'].'\', \''.$postData['destacados'].'\', \''.$_SERVER['REMOTE_ADDR'].'\', \''.(int)$postData['private'].'\', \''.(int)$postData['block_comments'].'\', \''.(int)$postData['sponsored'].'\', \''.(int)$postData['sticky'].'\', \''.(int)$postData['smileys'].'\', \''.(int)$postData['visitantes'].'\', '.(!$tsUser->is_admod && ($tsCore->settings['c_desapprove_post'] == 1 || $tsUser->permisos['gorpap'] == true) ? '\'3\'' : '\'0\'').')')) {
$postID = db_exec('insert_id');
, post_destacados
\''.$postData['destacados'].'\',
'title' => $tsCore->parseBadWords($_POST['titulo'], true),
'destacados' => $tsCore->setSecure($_POST['destacados'], true),
// ACTUALIZAMOS
if($tsUser->uid == $data['post_user'] || !empty($tsUser->is_admod) || !empty($tsUser->permisos['moedpo'])){
if(db_exec(array(__FILE__, __LINE__), 'query', 'UPDATE p_posts SET post_title = \''.$postData['title'].'\', post_body = \''.$postData['body'].'\', post_tags = \''.$tsCore->setSecure($postData['tags']).'\', post_category = \''.(int)$postData['category'].'\', post_private = \''.$postData['private'].'\', post_block_comments = \''.$postData['block_comments'].'\', post_sponsored = \''.$postData['sponsored'].'\', post_smileys = \''.$postData['smileys'].'\', post_visitantes = \''.$postData['visitantes'].'\', post_sticky = \''.$postData['sticky'].'\' WHERE post_id = \''.(int)$post_id.'\'') or exit( show_error('Error al ejecutar la consulta de la línea '.__LINE__.' de '.__FILE__.'.', 'db') )) {
// ACTUALIZAMOS
if($tsUser->uid == $data['post_user'] || !empty($tsUser->is_admod) || !empty($tsUser->permisos['moedpo'])){
if(db_exec(array(__FILE__, __LINE__), 'query', 'UPDATE p_posts SET post_title = \''.$postData['title'].'\', post_destacados = \''.$postData['destacados'].'\', post_body = \''.$postData['body'].'\', post_tags = \''.$tsCore->setSecure($postData['tags']).'\', post_category = \''.(int)$postData['category'].'\', post_private = \''.$postData['private'].'\', post_block_comments = \''.$postData['block_comments'].'\', post_sponsored = \''.$postData['sponsored'].'\', post_smileys = \''.$postData['smileys'].'\', post_visitantes = \''.$postData['visitantes'].'\', post_sticky = \''.$postData['sticky'].'\' WHERE post_id = \''.(int)$post_id.'\'') or exit( show_error('Error al ejecutar la consulta de la línea '.__LINE__.' de '.__FILE__.'.', 'db') )) {
, post_destacados = \''.$postData['destacados'].'\'
/*********/
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT p.post_id, p.post_user, p.post_category, p.post_title, p.post_date, p.post_comments, p.post_puntos, p.post_private, p.post_sponsored, p.post_status, p.post_sticky, u.user_id, u.user_name, u.user_activo, u.user_baneado, c.c_nombre, c.c_seo, c.c_img FROM p_posts AS p LEFT JOIN u_miembros AS u ON p.post_user = u.user_id '.($tsUser->is_admod && $tsCore->settings['c_see_mod'] == 1 ? '' : ' && u.user_activo = \'1\' && u.user_baneado = \'0\'').' LEFT JOIN p_categorias AS c ON c.cid = p.post_category WHERE '.($tsUser->is_admod && $tsCore->settings['c_see_mod'] == 1 ? 'p.post_id > 0' : 'p.post_status = \'0\' && u.user_activo = \'1\' && u.user_baneado = \'0\'').' '.$c_where.' '.$s_where.' GROUP BY p.post_id ORDER BY '.$s_order.' DESC LIMIT '.$start);
$lastPosts['data'] = result_array($query);
/*********/
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT p.post_id, p.post_user, p.post_category, p.post_title, p.post_destacados, p.post_date, p.post_comments, p.post_puntos, p.post_private, p.post_sponsored, p.post_status, p.post_sticky, u.user_id, u.user_name, u.user_activo, u.user_baneado, c.c_nombre, c.c_seo, c.c_img FROM p_posts AS p LEFT JOIN u_miembros AS u ON p.post_user = u.user_id '.($tsUser->is_admod && $tsCore->settings['c_see_mod'] == 1 ? '' : ' && u.user_activo = \'1\' && u.user_baneado = \'0\'').' LEFT JOIN p_categorias AS c ON c.cid = p.post_category WHERE '.($tsUser->is_admod && $tsCore->settings['c_see_mod'] == 1 ? 'p.post_id > 0' : 'p.post_status = \'0\' && u.user_activo = \'1\' && u.user_baneado = \'0\'').' '.$c_where.' '.$s_where.' GROUP BY p.post_id ORDER BY '.$s_order.' DESC LIMIT '.$start);
$lastPosts['data'] = result_array($query);
/*
getComentarios()
*/
/*
Destacados
*/
function getLastDestacados(){
global $tsCore;
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT post_id, post_user, post_category, post_title, post_date, post_puntos, post_comments, post_private, post_status, post_destacados, c_nombre, c_seo, c_img FROM p_posts AS p LEFT JOIN p_categorias AS c ON c.cid = post_category WHERE post_status = 0 ORDER BY post_puntos < 60 || 80 && post_comments < 15 DESC LIMIT 10');
$data = result_array($query);
//
return $data;
}
// AFILIADOS
$smarty->assign("tsAfiliados",$tsAfiliado->getAfiliados());
// DESTACADOS
$smarty->assign("tsDestacados",$tsPosts->getLastDestacados());
<li>
<label>Tags</label>
<span style="display: none;" class="errormsg"></span>
<input type="text" tabindex="4" name="tags" maxlength="128" class="text-inp required" value="{$tsDraft.b_tags}"/>
Una lista separada por comas, que describa el contenido. Ejemplo: <b>gol, ingleses, Copa Oro, futbol, Chicharito, México</b>
</li>
<li class="Thumbnail">
<label>Thumbnail</label>
<span style="display: none;" class="errormsg"></span>
<input type="text" tabindex="4" name="destacados" maxlength="500" class="text-inp required" value="{$tsDraft.b_destacados}"/>
<span class="toup-ta">
<b>Agrega la url de una imagen para agregar el Thumbnail. </b>
</span>
<div class="thumb-control">
<img src="{$tsDraft.b_destacados}" class="thumbnail-preview">
</li>
<div id="derecha">
{include file='modules/m.home_destacados.tpl'}
.destacate{width:200px;height:70px;border-bottom:solid 1px #e0e0e0;display:block;background-color:#f8f8f8;margin-bottom:3px}.destacate a{color:#006595;background:0 0;border:none;font-size:11px;text-decoration:none;font-weight:700;cursor:pointer;width:100px;margin:-9px}.post-cat{color:#adadad;font-size:9px;line-height:14px;display:block;padding:0 5px;text-transform:uppercase}.post-image{float:left;/*! margin-right: 10px; */width:90px;height:68px;background:#eee}.post-title{color:#006595;font-size:13px;line-height:16px;font-weight:700;display:block;max-height:48px;overflow:hidden}.view-more-list{color:#006595;text-decoration:none;font-weight:700;cursor:pointer;padding:3px;border-top:1px solid #cfe9f4;border-radius:0 0 5px 5px;text-align:center;background:#eff9fd}.Thumbnail{padding:10px;background:#ddd;border-right:solid 30px #eee;position:relative;min-height:220px;margin-bottom:15px;width:320px}.Thumbnail>input{width:300px!important}.Thumbnail .thumbnail-preview{width:154px;height:116px;background:url(images/camera-big.png) #eee no-repeat center;margin:20px auto 10px;display:block;border:solid 4px #fff;outline:solid 1px #CCC}.Thumbnail label{color:#333;font-size:18px;text-shadow:1px 1px 0 #fff;padding:2px;text-align:left;margin-right:5px}#lastDestacado .wMod-h{background:url(images/icons/posts.png) no-repeat left center}.destacados-data{padding:0;text-align:center;position:relative;height:auto;overflow:hidden}