11-08-2021, 01:18 PM
2
Capturas[img]Registrate o inicia tu sesión para ver este contenido[/img]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
Ejectar esta consulta
Código PHP: ( Seleccionar Todo )
CREATE TABLE IF NOT EXISTS `b_bugs` (
`bid` int(11) NOT NULL AUTO_INCREMENT,
`b_user` int(11) NOT NULL,
`b_nombre` varchar(60) NOT NULL,
`b_titulo` varchar(60) NOT NULL,
`b_cat` int(11) NOT NULL,
`b_cap` text NOT NULL,
`b_url` text NOT NULL,
`b_desc` text NOT NULL,
`b_estado` int(1) NOT NULL,
`b_fecha` int(10) NOT NULL,
PRIMARY KEY (`bid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
En admin.php --> inc --> php --> admin.php
Buscar:
Código PHP: ( Seleccionar Todo )
if($action == ''){
Arriba agregar:
Código PHP: ( Seleccionar Todo )
$totalBugs = db_exec('num_rows', db_exec(array(__FILE__, __LINE__), 'query', 'SELECT * FROM b_bugs WHERE b_estado = \'2\''));
$smarty->assign("totalBugs",$totalBugs);
Buscar:
Código PHP: ( Seleccionar Todo )
// ESTADÍSTICAS
Arriba agregar:
Código PHP: ( Seleccionar Todo )
// REPORTE DE BUGS
} elseif($action == 'bugs'){
$smarty->assign("tsBugs",$tsAdmin->getBugs());
En c.admin.php --> inc --> class --> c.admin.php
Buscar:
Código PHP: ( Seleccionar Todo )
/****************** ADMINISTRACIÓN DE POSTS ******************/
Arriba agregar:
Código PHP: ( Seleccionar Todo )
function getBugs() {
global $tsCore;
//
$max = 20;
$limit = $tsCore->setPageLimit($max, true);
//
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT * FROM b_bugs ORDER BY bid DESC LIMIT '.$limit);
$data['data'] = result_array($query);
// PAGINAS
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT COUNT(*) FROM b_bugs WHERE bid > \'0\'');
list($total) = db_exec('fetch_row', $query);
//
$data['pages'] = $tsCore->pageIndex($tsCore->settings['url']."/admin/bugs?", $_GET['s'], $total, $max);
//
$cat = array( 1 => 'Home', 'Muro', 'Perfil', 'Posts', 'Mp\'s', 'Registro', 'Otro');
if(count($data['data']) > 0) {
$i = 0;
foreach($data['data'] as $key => $val) {
$data['data'][$i]['b_cat'] = $cat[$data['data'][$i]['b_cat']];
$i++;
}
}
//
return $data;
}
En c.swat.php --> inc --> class --> c.swat.php
Antes de la última llave } agregar:
Código PHP: ( Seleccionar Todo )
function setBug() {
global $tsCore, $tsUser;
$dato = array(
'nombre' => $tsCore->setSecure($_POST['nombre']),
'titulo' => $tsCore->setSecure($_POST['titulo'])
);
// Obligatorios
foreach($dato as $key => $val){
$val = trim(preg_replace('/[^ A-Za-z0-9]/', '', $val));
$val = str_replace(' ', '', $val);
if(empty($val)) return '2: Completa los campos obligatorios.';
}
// Opcionales
$dato['cat'] = intval($_POST['cat']);
$dato['cap'] = $tsCore->setSecure($_POST['cap']);
$dato['url'] = $tsCore->setSecure($_POST['url']);
$dato['desc'] = $tsCore->setSecure($_POST['desc']);
if(db_exec(array(__FILE__, __LINE__), 'query', 'INSERT INTO b_bugs (b_user, b_nombre, b_titulo, b_cat, b_cap, b_url, b_desc, b_estado, b_fecha) VALUES (\''.$tsUser->uid.'\', \''.$dato['nombre'].'\', \''.$dato['titulo'].'\', \''.$dato['cat'].'\', \''.$dato['cap'].'\', \''.$dato['url'].'\', \''.$dato['desc'].'\', \'2\', \''.time().'\')')) {
return '1: Reporte enviado con éxito, gracias por ayudar a mejorar el sitio.';
} else return '0: Ocurrió un error al enviar el reporte, intentalo de nuevo.';
}
function bugEstado() {
global $tsCore;
$bid = $tsCore->setSecure($_POST['bid']);
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT bid, b_estado FROM b_bugs WHERE bid = \''.(int)$bid.'\' LIMIT 1');
$data = db_exec('fetch_assoc', $query);
if($data['bid'] > 0) {
$estado = $data['b_estado'] == 3 ? 1 : $data['b_estado']+1;
if(db_exec(array(__FILE__, __LINE__), 'query', 'UPDATE b_bugs SET b_estado = \''.(int)$estado.'\' WHERE bid = \''.(int)$bid.'\' LIMIT 1')) return '1: '.$estado;
else return '0: Intentalo de nuevo.';
} else return '0: El reporte no existe o fue eliminado.';
}
function bugBorrar() {
global $tsCore;
$bid = $tsCore->setSecure($_POST['bid']);
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT bid, b_estado FROM b_bugs WHERE bid = \''.(int)$bid.'\' LIMIT 1');
$data = db_exec('fetch_assoc', $query);
if($data['bid'] > 0) {
if(db_exec(array(__FILE__, __LINE__), 'query', 'DELETE FROM b_bugs WHERE bid = \''.(int)$bid.'\' LIMIT 1')) return '1: Reporte eliminado con exito.';
else return '0: Intentalo de nuevo.';
} else return '0: El reporte no existe o fue eliminado.';
}
En ajax.denuncia.php --> inc --> php --> ajax --> ajax.denuncia.php
Buscar:
Código PHP: ( Seleccionar Todo )
'denuncia-usuario' => array('n' => 2, 'p' => 'form'),
Debajo agregar:
Código PHP: ( Seleccionar Todo )
'denuncia-bug' => array('n' => 0, 'p' => ''),
'denuncia-bug_estado' => array('n' => 4, 'p' => ''),
'denuncia-bug_borrar' => array('n' => 4, 'p' => ''),
Después del último break; agregar:
Código PHP: ( Seleccionar Todo )
case 'denuncia-bug':
echo $tsSwat->setBug();
break;
case 'denuncia-bug_estado':
echo $tsSwat->bugEstado();
break;
case 'denuncia-bug_borrar':
echo $tsSwat->bugBorrar();
break;
En m.admin_sidemenu.tpl --> themes --> default --> templates --> admin_mods --> m.admin_sidemenu.tpl
Buscar:
Código PHP: ( Seleccionar Todo )
<li id="a_badwords"><span class="cat-title"><a href="{$tsConfig.url}/admin/badwords">Censuras</a></span></li>
Debajo agregar:
Código PHP: ( Seleccionar Todo )
<li id="a_badwords"><span class="cat-title"><a href="{$tsConfig.url}/admin/bugs">Reporte de bugs <strong class="floatR" style="color: red;">{$totalBugs}</strong></a></span></li>
En t.admin.tpl --> themes --> default --> templates --> t.admin.tpl
Buscar:
Código PHP: ( Seleccionar Todo )
{/if}
Arriba agregar:
Código PHP: ( Seleccionar Todo )
{elseif $tsAction == 'bugs'}
{include file='admin_mods/m.admin_bugs.tpl'}
En funciones.js --> themes --> default --> js --> funciones.js
Al final agregar:
Código PHP: ( Seleccionar Todo )
var bug = {
reportar: function() {
var html = '<input type="text" placeholder="Nombre" id="nombre" value="' + (global_data.user_key > 0 ? global_data.user_name : '') + '" size="60" class="require" /></br>';
html += '<input type="text" placeholder="Titulo" id="titulo" size="60" class="require" /></br>';
html += '<select id="cat" style="width: 330px;margin-bottom: 10px;"><option value="">Selecciona una categoría (Opcional)</option>';
html += '<option value="1">Home</option>';
html += '<option value="2">Muro</option>';
html += '<option value="3">Perfil</option>';
html += '<option value="4">Posts</option>';
html += '<option value="5">Mp\'s</option>';
html += '<option value="6">Registro</option>';
html += '<option value="7">Otro</option></select></br>';
html += '<input type="text" placeholder="URL de la imagen del problema" id="cap" size="60" class="require" /></br>';
html += '<input type="text" placeholder="URL asociado al bug (opcional)" id="url" size="60" /></br>';
html += '<textarea placeholder="Descripción (opcional)" id="desc" cols="42" rows="10"></textarea>';
mydialog.class_aux = 'RBugs';
mydialog.mask_close = false;
mydialog.close_button = true;
mydialog.show(true);
mydialog.title('Reporte de bugs');
mydialog.body(html);
mydialog.buttons(true, true, 'Aceptar', 'bug.verify()', true, true, true, 'Cancelar', 'close', true, false);
mydialog.center();
},
verify: function() {
var cont = false;
$('.require').each(function(){
if($(this).val() == '' || $(this).val() == 0 || $(this).length == 0) {
$(this).focus();
cont = false;
return false;
} else {
cont = true;
}
});
if(cont) bug.send();
else return false;
},
send: function() {
mydialog.procesando_inicio();
var nombre = $('.RBugs #nombre').val(),
titulo = $('.RBugs #titulo').val(),
cat = $('.RBugs #cat').val(),
cap = $('.RBugs #cap').val(),
url = $('.RBugs #url').val(),
desc = $('.RBugs #desc').val();
$.ajax({
type: 'POST',
url: global_data.url + '/denuncia-bug.php',
data: 'nombre='+nombre+'&titulo='+titulo+'&cat='+cat+'&cap='+cap+'&url='+url+'&desc='+desc,
success: function(h){
if(h.charAt(0) == '0') {
mydialog.alert('Error', h.substring(3));
} else if(h.charAt(0) == '1') {
mydialog.alert('Exito', h.substring(3));
} else if(h.charAt(0) == '2') {
alert('Completa los datos obligatorios.');
} else {
mydialog.alert('Error', h);
}
mydialog.procesando_fin();
}
});
},
ver: function(id) {
var titulo = $('#titulo_'+id).val(),
cap = $('#cap_'+id).val(),
url = $('#url_'+id).val(),
desc = '<p align="justify">',
text = $('#desc_'+id).val();
desc += '<a href="' + cap + '" target="_blank"><img src="' + cap + '" width="80" height="80" align="left" style="margin: 0 5px 5px 0;" /></a> '+text;
if(url.length > 0) {
desc += '</br></br><strong>URL:</strong> <a href="'+url+'" target="_blank">'+url+'</a>';
}
desc += '</p>';
mydialog.show(true);
mydialog.title(titulo);
mydialog.body(desc, 450);
mydialog.buttons(true, true, 'Aceptar', 'mydialog.close()', true, true);
mydialog.center();
},
estado: function(id) {
$('#loading').fadeIn(250);
$.ajax({
type: 'POST',
url: global_data.url + '/denuncia-bug_estado.php',
data: 'bid='+id,
success: function(h){
if(h.charAt(0) == '0') {
mydialog.alert('Error', h.substring(3));
} else if(h.charAt(0) == '1') {
switch(h.substring(3)) {
case '1': // Ignorado
result = '<font color="grey">Ignorado</font>';
break;
case '2': // Pendiente
result = '<font color="red">Pendiente</font>';
break;
case '3': // Solucionado
result = '<font color="green">Solucionado</font>';
break;
}
$('#estado_'+id).html(result);
} else {
mydialog.alert('Error', h);
}
$('#loading').fadeOut(250);
}
});
},
borrar: function(id) {
$('#loading').fadeIn(250);
$.ajax({
type: 'POST',
url: global_data.url + '/denuncia-bug_borrar.php',
data: 'bid='+id,
success: function(h){
if(h.charAt(0) == '0') {
mydialog.alert('Error', h.substring(3));
} else if(h.charAt(0) == '1') {
$('#bug_'+id).remove();
} else {
mydialog.alert('Error', h);
}
$('#loading').fadeOut(250);
}
});
},
}
En main_header.tpl --> themes --> default --> templates --> sections --> main_header.tpl
Buscar:
Código PHP: ( Seleccionar Todo )
user_key:'{$tsUser->uid}',
Debajo agregar:
Código PHP: ( Seleccionar Todo )
user_name:'{$tsUser->nick}',
En main_footer.tpl --> themes --> default --> templates --> sections --> main_footer.tpl
Buscar:
Código PHP: ( Seleccionar Todo )
<a href="{$tsConfig.url}/pages/protocolo/">Protocolo</a>
Debajo agregar:
Código PHP: ( Seleccionar Todo )
<a href="#" onclick="bug.reportar(); return false;" title="¿Encontraste un error en la web?">Reportar un bug</a>
Y subir esta carpeta
Mega
Debes agradecer para ver el contenido...
Google Drive
Debes agradecer para ver el contenido...
Mediafire
Debes agradecer para ver el contenido...
Creditos: Debes agradecer para ver el contenido...



Facebook
Twitter
Reddit
Digg
del.icio.us
Tumblr
Pinterest
Blogger
Fark
LinkedIn
Mix
Google