HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/nyiet8349bzl/www/oldwebsite.sbsc.in/wp-content/plugins/Newnoticeboard/includes/functions.php
<?php

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}

// Get notices from uploads folder and their metadata
function enb_get_notices() {
    $upload_dir = plugin_dir_path(dirname(__FILE__)) . 'uploads/';
    $files = glob($upload_dir . '*.{pdf,jpg,jpeg,png}', GLOB_BRACE);
    $notices = [];

    foreach ($files as $file_path) {
        $file_name = basename($file_path);
        $base_name = pathinfo($file_name, PATHINFO_FILENAME);
        $meta_file = $upload_dir . $base_name . '.json';

        if (file_exists($meta_file)) {
            $meta = json_decode(file_get_contents($meta_file), true);
            if (is_array($meta)) {
                $meta['file'] = plugin_dir_url(dirname(__FILE__)) . 'uploads/' . $file_name;
                $notices[] = $meta;
            }
        }
    }

    return $notices;
}

// Display notices using shortcode
function enb_display_notices() {
    $notices = enb_get_notices();
    ob_start();

    echo '<div class="enb-notice-scroll-container">';
    echo '<ul class="enb-notice-list">';

    if (!empty($notices)) {
        foreach ($notices as $notice) {
            echo '<li>';
            echo '<a href="' . esc_url($notice['file']) . '" target="_blank">' . esc_html($notice['title']) . '</a>';
            echo '</li>';
        }
    } else {
        echo '<li>No notices available.</li>';
    }

    echo '</ul>';
    echo '</div>';

    return ob_get_clean();
}