403Webshell
Server IP : 104.21.84.107  /  Your IP : 104.23.243.196
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.4.5
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/idiomas/media/idiomas/tramites/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/idiomas/media/idiomas/tramites/feed.php
<?php
declare(strict_types=1);

header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');

$mysqli = new mysqli('127.0.0.1', 'root', '', 'plantillajoomla5_3');

if ($mysqli->connect_error) {
    http_response_code(500);
    echo json_encode(['error' => 'database']);
    exit;
}

$mysqli->set_charset('utf8mb4');

$scriptName = str_replace('\\', '/', $_SERVER['SCRIPT_NAME'] ?? '');
$basePath = preg_replace('#/media/idiomas/tramites/feed\.php$#', '', $scriptName);

$assetUrl = static function (string $path) use ($basePath): string {
    $path = trim($path);
    if ($path === '' || preg_match('#^(https?:)?//#', $path) || str_starts_with($path, '/')) {
        return $path;
    }

    return $basePath . '/' . ltrim($path, '/');
};

$sql = "SELECT id, title, alias, introtext, metadesc, images, attribs, publish_up, created
        FROM jnx5e_content
        WHERE state = 1 AND note = 'tramite-centro'
        ORDER BY COALESCE(NULLIF(publish_up, '0000-00-00 00:00:00'), created) DESC, id DESC";

$result = $mysqli->query($sql);
$items = [];

if ($result) {
    while ($row = $result->fetch_assoc()) {
        $images = json_decode((string) $row['images'], true) ?: [];
        $attrs = json_decode((string) $row['attribs'], true) ?: [];
        $date = substr((string) ($attrs['news_date'] ?? $row['publish_up'] ?? $row['created']), 0, 10);
        if (!$date || $date === '0000-00-00') {
            $date = substr((string) $row['created'], 0, 10);
        }

        $summary = trim((string) $row['metadesc']);
        if ($summary === '') {
            $summary = trim(mb_substr(preg_replace('/\s+/', ' ', strip_tags((string) $row['introtext'])), 0, 180));
        }

        $items[] = [
            'id' => (int) $row['id'],
            'title' => $row['title'],
            'category' => $attrs['news_type'] ?? 'Tramite',
            'date' => $date,
            'summary' => $summary,
            'image' => $assetUrl($images['image_intro'] ?? ($images['image_fulltext'] ?? '')),
            'bannerImage' => $assetUrl($images['image_fulltext'] ?? ($images['image_intro'] ?? '')),
            'href' => $basePath . '/index.php?option=com_content&view=article&id=' . (int) $row['id'] . '&Itemid=219',
        ];
    }
}

echo json_encode([
    'generatedAt' => date('c'),
    'items' => $items,
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

Youez - 2016 - github.com/yon3zu
LinuXploit