403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.164
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/konzalta/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/konzalta//.bash_history
        }

        if (c.url) {
            return c.url.replace('/case?id=', '/case/?id=');
        }

        return '#';
    }

    function renderCase(c) {
        const title = c.title || 'Untitled case';
        const citation = c.citation || '';
        const snippet = c.snippet || c.best_snippet || c.summary || '';
        const url = caseUrl(c);

        const meta = [
            c.court,
            c.registry ? 'Registry: ' + c.registry : '',
            c.case_number ? 'Case No.: ' + c.case_number : '',
            c.decision_date ? 'Decision Date: ' + c.decision_date : '',
            c.year ? 'Year: ' + c.year : ''
        ].filter(Boolean).join(' ');

        return `
            <article class="tlr-case">
                <h3 class="tlr-case-title">
                    <a href="${escapeHtml(url)}">${escapeHtml(title)}</a>
                </h3>

                ${citation ? `<div class="tlr-case-citation">${escapeHtml(citation)}</div>` : ''}

                ${snippet ? `<p class="tlr-case-snippet">${escapeHtml(snippet)}</p>` : ''}

                ${meta ? `<div class="tlr-case-meta">${escapeHtml(meta)}</div>` : ''}

                <div class="tlr-case-actions">
                    <a class="tlr-read" href="${escapeHtml(url)}">Read Case</a>
                </div>
            </article>
        `;
    }

    function renderPagination(total, page, pageSize) {
        total = parseInt(total || 0, 10);
        page = parseInt(page || 1, 10);
        pageSize = parseInt(pageSize || 10, 10);

        const totalPages = Math.max(1, Math.ceil(total / pageSize));

        if (totalPages <= 1) {
            return '';
        }

        let html = '<div class="tlr-pagination">';

        if (page > 1) {
            html += `<button type="button" class="tlr-page-btn" data-page="${page - 1}">Previous</button>`;
        }

        const start = Math.max(1, page - 2);
        const end = Math.min(totalPages, page + 2);

        for (let i = start; i <= end; i++) {
            html += `<button type="button" class="tlr-page-btn ${i === page ? 'active' : ''}" data-page="${i}">${i}</button>`;
        }

        if (page < totalPages) {
            html += `<button type="button" class="tlr-page-btn" data-page="${page + 1}">Next</button>`;
        }

        html += '</div>';
        return html;
    }

    function loadResults(page, pushUrl) {
        page = parseInt(page || 1, 10);

        $('#tlr-results').html('<p class="tlr-loading">Loading Tanzania Law Reports...</p>');

        $.ajax({
            url: buildApiUrl(page),
            method: 'GET',
            dataType: 'json'
        }).done(function (res) {
            if (!res || !res.ok) {
                $('#tlr-results').html('<p class="tlr-error">Could not load results.</p>');
                return;
            }

            const cases = res.cases || [];
            const total = res.total || cases.length || 0;
            const pageSize = res.page_size || getCurrentFilters().pageSize || 10;
            const currentPage = res.page || page;

            let html = `<div class="tlr-results-summary">Showing page ${currentPage} of ${Math.max(1, Math.ceil(total / pageSize))}. Total cases: ${total}</div>`;

            if (!cases.length) {
                html += '<p class="tlr-no-results">No cases found.</p>';
            } else {
                html += '<div class="tlr-results-list">';
                cases.forEach(function (c) {
                    html += renderCase(c);
                });
                html += '</div>';
            }

            html += renderPagination(total, currentPage, pageSize);

            $('#tlr-results').html(html);

            if (pushUrl !== false) {
                updateBrowserUrl(currentPage);
            }
        }).fail(function () {
            $('#tlr-results').html('<p class="tlr-error">Could not reach the TLR search API.</p>');
        });
    }

    $(document).ready(function () {
        const q = getParam('q');
        const court = getParam('court');
        const registry = getParam('registry');
        const year = getParam('tlr_year') || getParam('year');
        const page = parseInt(getParam('page') || '1', 10);

        if (q) $('#tlr-q').val(q);
        if (court) $('#tlr-court').val(court);
        if (registry) $('#tlr-registry').val(registry);
        if (year) $('#tlr-year').val(year);

        $('#tlr-search-form').on('submit', function (e) {
            e.preventDefault();
            loadResults(1, true);
        });

        $('#tlr-search-btn').on('click', function (e) {
            e.preventDefault();
            loadResults(1, true);
        });

        $(document).on('click', '.tlr-page-btn', function (e) {
            e.preventDefault();
            const nextPage = parseInt($(this).data('page'), 10);
            loadResults(nextPage, true);

            $('html, body').animate({
                scrollTop: $('#tlr-results').offset().top - 120
            }, 250);
        });

        window.addEventListener('popstate', function () {
            const p = parseInt(getParam('page') || '1', 10);
            loadResults(p, false);
        });

        if (q || court || registry || year || getParam('page')) {
            loadResults(page, false);
        }
    });

})(jQuery);
JS

#1778443538
ls -lh tlr-search.js
#1778443935
cd ~/lawreports.online
#1778443935
pwd
#1778443937
ls -la
#1778443955
mkdir -p ~/site_backups/lawreports_$(date +%Y%m%d_%H%M%S)
#1778443970
BACKUP_DIR=$(ls -td ~/site_backups/lawreports_* | head -1)
#1778443972
echo $BACKUP_DIR
#1778444007
wp db check
#1778444027
wp db export "$BACKUP_DIR/lawreports_database_$(date +%Y%m%d_%H%M%S).sql"
#1778444048
gzip "$BACKUP_DIR"/*.sql
#1778444058
ls -lh "$BACKUP_DIR"
#1778444076
tar -czf "$BACKUP_DIR/lawreports_files_$(date +%Y%m%d_%H%M%S).tar.gz" .
#1778444188
cd "$BACKUP_DIR"
#1778444188
sha256sum *.gz > SHA256SUMS.txt
#1778444190
cat SHA256SUMS.txt
#1778444204
aws s3 cp "$BACKUP_DIR" s3://tlr-online/site-backups/lawreports-online/$(basename "$BACKUP_DIR")/ --recursive
#1778444272
pwd
#1778484732
cd ~/lawreports.online/wp-content/plugins
#1778484732
mkdir -p tlr-legal-assistant/assets
#1778484735
cd tlr-legal-assistant
#1778484752
nano tlr-legal-assistant.php
#1778484808
nano assets/tlr-legal-assistant.js
#1778484854
nano assets/tlr-legal-assistant.css
#1778495034
cd ~/lawreports.online/wp-content/plugins
#1778495034
mkdir -p tlr-judgment-draft/assets
#1778495034
cat > tlr-judgment-draft/tlr-judgment-draft.php <<'PHP'
<?php
/**
 * Plugin Name: TLR Judgment Draft Assistant
 * Description: Judgment drafting workspace with TLR authority lookup and citation insertion.
 * Version: 1.0.0
 * Author: Konzaltant Services Ltd
 */

if (!defined('ABSPATH')) exit;

define('TLR_JD_VERSION', '1.0.0');

add_action('admin_init', function () {
    add_option('tlr_jd_api_base', 'https://api.lawreports.online');
    register_setting('tlr_jd_settings', 'tlr_jd_api_base');
});

add_action('admin_menu', function () {
    add_options_page(
        'TLR Judgment Draft',
        'TLR Judgment Draft',
        'manage_options',
        'tlr-judgment-draft',
        'tlr_jd_settings_page'
    );
});

function tlr_jd_settings_page() {
    ?>
    <div class="wrap">
        <h1>TLR Judgment Draft Settings</h1>
        <form method="post" action="options.php">
            <?php settings_fields('tlr_jd_settings'); ?>
            <table class="form-table">
                <tr>
                    <th>API Base URL</th>
                    <td>
                        <input type="text"
                               name="tlr_jd_api_base"
                               value="<?php echo esc_attr(get_option('tlr_jd_api_base')); ?>"
                               style="width:420px;">
                    </td>
                </tr>
            </table>
            <?php submit_button(); ?>
        </form>
    </div>
    <?php
}

add_action('wp_enqueue_scripts', function () {
    wp_enqueue_style(
        'tlr-jd-css',
        plugin_dir_url(__FILE__) . 'assets/tlr-judgment-draft.css',
        [],
        TLR_JD_VERSION
    );

    wp_enqueue_script(
        'tlr-jd-js',
        plugin_dir_url(__FILE__) . 'assets/tlr-judgment-draft.js',
        [],
        TLR_JD_VERSION,
        true
    );

    wp_localize_script('tlr-jd-js', 'TLRJudgmentDraft', [
        'ajaxUrl' => admin_url('admin-ajax.php'),
        'nonce'   => wp_create_nonce('tlr_jd_nonce')
    ]);
});

add_shortcode('tlr_judgment_draft_assistant', function () {
    ob_start();
    ?>
    <div class="tlr-jd-shell">
        <div class="tlr-jd-editor-panel">
            <div class="tlr-jd-header">
                <h1>Judgment Draft Assistant</h1>
                <p>Draft, research, and insert cited TLR authorities.</p>
            </div>

            <div class="tlr-jd-toolbar">
                <button type="button" id="tlr-jd-find">Find Authorities</button>
                <button type="button" id="tlr-jd-copy">Copy Draft</button>
                <button type="button" id="tlr-jd-clear">Clear</button>
            </div>

            <textarea id="tlr-jd-editor" placeholder="Start drafting the judgment here. Highlight a sentence or paragraph, then click Find Authorities."></textarea>
        </div>

        <div class="tlr-jd-assistant-panel">
            <h2>TLR Assistant</h2>

            <div class="tlr-jd-note">
                Highlight a legal issue in the draft, then find relevant TLR authorities.
            </div>

            <div id="tlr-jd-results" class="tlr-jd-results">
                <p class="tlr-jd-muted">No authorities searched yet.</p>
            </div>
        </div>
    </div>
    <?php
    return ob_get_clean();
});

function tlr_jd_call_api($endpoint, $payload) {
    $api_base = rtrim(get_option('tlr_jd_api_base'), '/');

    $response = wp_remote_post($api_base . $endpoint, [
        'timeout' => 90,
        'headers' => ['Content-Type' => 'application/json'],
        'body' => wp_json_encode($payload)
    ]);

    if (is_wp_error($response)) {
        return ['ok' => false, 'error' => $response->get_error_message()];
    }

    $body = json_decode(wp_remote_retrieve_body($response), true);

    if (!$body) {
        return ['ok' => false, 'error' => 'Invalid API response.'];
    }

    return $body;
}

add_action('wp_ajax_tlr_jd_find_authorities', 'tlr_jd_find_authorities');
add_action('wp_ajax_nopriv_tlr_jd_find_authorities', 'tlr_jd_find_authorities');

function tlr_jd_find_authorities() {
    check_ajax_referer('tlr_jd_nonce', 'nonce');

    $text = sanitize_textarea_field($_POST['text'] ?? '');
    $draft = sanitize_textarea_field($_POST['draft'] ?? '');

    if (!$text && !$draft) {
        wp_send_json_error(['message' => 'Highlight or type some draft text first.']);
    }

    $result = tlr_jd_call_api('/find-authorities', [
        'text' => $text,
        'draft_context' => $draft,
        'jurisdiction' => 'Tanzania',
        'source' => 'TLR'
    ]);

    if (empty($result['ok'])) {
        wp_send_json_error(['message' => $result['error'] ?? 'Unable to find authorities.']);
    }

    wp_send_json_success($result);
}
PHP

#1778495055
cat > tlr-judgment-draft/assets/tlr-judgment-draft.js <<'JS'
function tlrJdEscape(text) {
    if (!text) return '';
    return text
        .replaceAll('&', '&amp;')
        .replaceAll('<', '&lt;')
        .replaceAll('>', '&gt;')
        .replaceAll('"', '&quot;')
        .replaceAll("'", '&#039;');
}

function tlrJdInsertText(editor, text) {
    const start = editor.selectionStart;
    const end = editor.selectionEnd;
    const before = editor.value.substring(0, start);
    const after = editor.value.substring(end);
    editor.value = before + text + after;
    editor.focus();
}

function tlrJdMakeParagraph(authority) {
    const citation = authority.citation || authority.title || '';
    const principle = authority.principle || '';

    if (principle) {
        return `The Court is guided by ${citation}, where the reported material indicates that ${principle}\n\n`;
    }

    return `The Court has considered ${citation} as a relevant authority on the issue.\n\n`;
}

function tlrJdRenderAuthorities(authorities) {
    if (!authorities || !authorities.length) {
        return `<p class="tlr-jd-error">No reliable TLR authority was found for the selected text.</p>`;
    }

    return authorities.map((a, index) => {
        const title = tlrJdEscape(a.title || 'Untitled case');
        const citation = tlrJdEscape(a.citation || '');
        const principle = tlrJdEscape(a.principle || '');
        const url = tlrJdEscape(a.url || '#');

        return `
            <div class="tlr-jd-card" data-index="${index}">
                <h3>${title}</h3>
                <p class="tlr-jd-citation">${citation}</p>
                <p>${principle || 'No clean snippet available.'}</p>

                <div class="tlr-jd-actions">
                    <a href="${url}" target="_blank">View case</a>
                    <button type="button" class="tlr-jd-insert-citation" data-index="${index}">Insert Citation</button>
                    <button type="button" class="tlr-jd-insert-paragraph" data-index="${index}">Insert Paragraph</button>
                </div>
            </div>
        `;
    }).join('');
}

document.addEventListener('DOMContentLoaded', function () {
    const editor = document.getElementById('tlr-jd-editor');
    const findBtn = document.getElementById('tlr-jd-find');
    const clearBtn = document.getElementById('tlr-jd-clear');
    const copyBtn = document.getElementById('tlr-jd-copy');
    const results = document.getElementById('tlr-jd-results');

    let currentAuthorities = [];

    if (!editor || !findBtn || !results) return;

    findBtn.addEventListener('click', function () {
        const selected = editor.value.substring(editor.selectionStart, editor.selectionEnd).trim();
        const draft = editor.value.trim();
        const queryText = selected || draft;

        if (!queryText) {
            results.innerHTML = `<p class="tlr-jd-error">Type or highlight some text first.</p>`;
            return;
        }

        results.innerHTML = `<p class="tlr-jd-muted">Finding authorities...</p>`;

        const formData = new FormData();
        formData.append('action', 'tlr_jd_find_authorities');
        formData.append('nonce', TLRJudgmentDraft.nonce);
        formData.append('text', queryText);
        formData.append('draft', draft);

        fetch(TLRJudgmentDraft.ajaxUrl, {
            method: 'POST',
            body: formData
        })
        .then(r => r.json())
        .then(data => {
            if (!data.success) {
                results.innerHTML = `<p class="tlr-jd-error">${tlrJdEscape(data.data.message)}</p>`;
                return;
            }

            currentAuthorities = data.data.authorities || [];
            results.innerHTML = tlrJdRenderAuthorities(currentAuthorities);
        })
        .catch(() => {
            results.innerHTML = `<p class="tlr-jd-error">Request failed.</p>`;
        });
    });

    document.addEventListener('click', function (e) {
        if (e.target.classList.contains('tlr-jd-insert-citation')) {
            const i = parseInt(e.target.getAttribute('data-index'), 10);
            const a = currentAuthorities[i];
            if (!a) return;

            const citation = a.citation || a.title || '';
            tlrJdInsertText(editor, citation);
        }

        if (e.target.classList.contains('tlr-jd-insert-paragraph')) {
            const i = parseInt(e.target.getAttribute('data-index'), 10);
            const a = currentAuthorities[i];
            if (!a) return;

            const paragraph = tlrJdMakeParagraph(a);
            tlrJdInsertText(editor, paragraph);
        }
    });

    if (clearBtn) {
        clearBtn.addEventListener('click', function () {
            editor.value = '';
        });
    }

    if (copyBtn) {
        copyBtn.addEventListener('click', function () {
            navigator.clipboard.writeText(editor.value || '');
            copyBtn.textContent = 'Copied';
            setTimeout(() => copyBtn.textContent = 'Copy Draft', 1200);
        });
    }
});
JS

#1778495073
cat > tlr-judgment-draft/assets/tlr-judgment-draft.css <<'CSS'
.tlr-jd-shell {
    max-width: 1280px;
    margin: 40px auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    font-family: Georgia, "Times New Roman", serif;
}

.tlr-jd-editor-panel,
.tlr-jd-assistant-panel {
    background: #fff;
    border: 1px solid #ddd;
    padding: 22px;
}

.tlr-jd-header h1 {
    font-family: "Crimson Text", Georgia, serif;
    font-size: 42px;
    margin: 0 0 6px;
}

.tlr-jd-header p,
.tlr-jd-muted {
    color: #666;
}

.tlr-jd-toolbar {
    display: flex;
    gap: 10px;
    margin: 18px 0;
    flex-wrap: wrap;
}

.tlr-jd-toolbar button,
.tlr-jd-actions button {
    background: #8b0000;
    color: #fff;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: bold;
}

.tlr-jd-toolbar button:hover,
.tlr-jd-actions button:hover {
    background: #5f0000;
}

#tlr-jd-editor {
    width: 100%;
    min-height: 760px;
    padding: 22px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    line-height: 1.75;
    border: 1px solid #ccc;
}

.tlr-jd-assistant-panel h2 {
    font-family: "Crimson Text", Georgia, serif;
    font-size: 30px;
    margin-top: 0;
}

.tlr-jd-note {
    background: #fff8e5;
    border-left: 4px solid #b88a00;
    padding: 12px;
    margin-bottom: 18px;
}

.tlr-jd-card {
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 14px;
    margin-bottom: 14px;
}

.tlr-jd-card h3 {
    font-family: "Crimson Text", Georgia, serif;
    font-size: 21px;
    margin: 0 0 8px;
}

.tlr-jd-citation {
    font-weight: bold;
}

.tlr-jd-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.tlr-jd-actions a {
    color: #8b0000;
    font-weight: bold;
    text-decoration: none;
}

.tlr-jd-error {
    color: #8b0000;
    font-weight: bold;
}

@media (max-width: 900px) {
    .tlr-jd-shell {
        grid-template-columns: 1fr;
    }

    #tlr-jd-editor {
        min-height: 520px;
    }
}
CSS

#1779103616
cd ~/lawreports.online/wp-content/plugins
#1779103623
grep -R "/search" -n tlr-api-connector tlr-legal-assistant tlr-judgment-draft 2>/dev/null
#1779103640
cd ~/lawreports.online/wp-content/plugins
#1779103655
grep -R "/search" -n tlr-api-connector tlr-legal-assistant tlr-judgment-draft 2>/dev/null
#1779103741
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779103746
nano tlr-api-connector.php
#1779103794
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779103796
nano tlr-api-connector.php
#1779104317
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779104319
nano tlr-api-connector.php
#1779104466
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779104468
nano tlr-api-connector.php
#1779104771
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779104771
cp tlr-api-connector.php tlr-api-connector.php.bak_title_case_display_$(date +%Y%m%d_%H%M%S)
#1779104771
python3 - <<'PY'
from pathlib import Path

p = Path("tlr-api-connector.php")
s = p.read_text()

s = s.replace(
    "$title = !empty($meta['title']) ? $meta['title'] : 'Case';",
    "$title = !empty($meta['title']) ? tlr_title_case_case_name($meta['title']) : 'Case';"
)

s = s.replace(
    "$title = $case['title'] ?? 'Untitled Case';",
    "$title = tlr_title_case_case_name($case['title'] ?? 'Untitled Case');"
)

s = s.replace(
    "return sanitize_text_field($data['title']);",
    "return tlr_title_case_case_name(sanitize_text_field($data['title']));"
)

s = s.replace(
    "return sanitize_text_field($data['case_title']);",
    "return tlr_title_case_case_name(sanitize_text_field($data['case_title']));"
)

p.write_text(s)
print("Patched title-case display for case pages and latest cases.")
PY

#1779104800
grep -n "title" tlr-search.js | head -30
#1779104958
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779104958
cp tlr-search.js tlr-search.js.bak_title_case_$(date +%Y%m%d_%H%M%S)
#1779104958
python3 - <<'PY'
from pathlib import Path

p = Path("tlr-search.js")
s = p.read_text()

helper = r'''
function tlrTitleCaseCaseName(text) {
    if (!text) return text;

    const raw = String(text).trim();
    if (!raw) return raw;

    // Only convert if mostly uppercase
    const letters = raw.replace(/[^A-Za-z]/g, '');
    if (!letters || letters !== letters.toUpperCase()) return raw;

    let t = raw.toLowerCase().replace(/\b\w/g, ch => ch.toUpperCase());

    t = t
        .replace(/\bV\.?\b/g, 'v.')
        .replace(/\bVs\.?\b/g, 'v.')
        .replace(/\bAnd\b/g, 'and')
        .replace(/\bOf\b/g, 'of')
        .replace(/\bThe\b/g, 'the')
        .replace(/\bIn\b/g, 'in')
        .replace(/\bAt\b/g, 'at')
        .replace(/\bFor\b/g, 'for')
        .replace(/\bTo\b/g, 'to')
        .replace(/\bBy\b/g, 'by')
        .replace(/\bAs\b/g, 'as')
        .replace(/\bLtd\b/g, 'Ltd.')
        .replace(/\bPlc\b/g, 'PLC')
        .replace(/\bCrdb\b/g, 'CRDB')
        .replace(/\bTanesco\b/g, 'TANESCO')
        .replace(/\bNbc\b/g, 'NBC')
        .replace(/\bNic\b/g, 'NIC');

    return t;
}

'''

if "function tlrTitleCaseCaseName" not in s:
    s = helper + "\n" + s

s = s.replace(
    "const title = c.title || 'Untitled case';",
    "const title = tlrTitleCaseCaseName(c.title || 'Untitled case');"
)

p.write_text(s)
print("Patched search-result title casing.")
PY

#1779104980
wp cache flush 2>/dev/null || true
#1779105606
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779105606
cp tlr-api-connector.php tlr-api-connector.php.bak_years_2016_2020_$(date +%Y%m%d_%H%M%S)
#1779105606
python3 - <<'PY'
from pathlib import Path

p = Path("tlr-api-connector.php")
s = p.read_text()

s = s.replace(
    "$years = array('2015', '2014');",
    "$years = array('2020', '2019', '2018', '2017', '2016', '2015', '2014');"
)

p.write_text(s)
print("Updated year dropdown to 2014–2020.")
PY

#1779105609
wp cache flush 2>/dev/null || true
#1779109574
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779109574
cp tlr-api-connector.php tlr-api-connector.php.bak_citation_case_$(date +%Y%m%d_%H%M%S)
#1779109574
python3 - <<'PY'
from pathlib import Path

p = Path("tlr-api-connector.php")
s = p.read_text()

# Replace citation rendering
s = s.replace(
    "esc_html($meta['citation'])",
    "esc_html(tlr_title_case_case_name($meta['citation']))"
)

p.write_text(s)
print("Patched citation to Title Case.")
PY

#1779110632
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779110632
cp tlr-api-connector.php tlr-api-connector.php.bak_latest_font_titles_$(date +%Y%m%d_%H%M%S)
#1779110634
cp tlr-style.css tlr-style.css.bak_crimson_$(date +%Y%m%d_%H%M%S)
#1779110657
python3 - <<'PY'
from pathlib import Path
import re

p = Path("tlr-api-connector.php")
s = p.read_text()

start = s.find("function tlr_title_case_case_name($text)")
end = s.find("function tlr_title_case_citation($citation)")

new_func = r'''function tlr_title_case_case_name($text) {
    $text = trim((string) $text);

    if ($text === '') {
        return $text;
    }

    $letters = preg_replace('/[^A-Za-z]/', '', $text);
    if ($letters === '') {
        return $text;
    }

    $upper_letters = preg_replace('/[^A-Z]/', '', $letters);
    $upper_ratio = strlen($letters) ? strlen($upper_letters) / strlen($letters) : 0;

    // Convert if mostly uppercase, e.g. 2020 cases.
    if ($upper_ratio < 0.70) {
        return $text;
    }

    $text = strtolower($text);
    $text = ucwords($text);

    $replacements = array(
        ' V. ' => ' v. ',
        ' V ' => ' v. ',
        ' And ' => ' and ',
        ' Of ' => ' of ',
        ' The ' => ' the ',
        ' In ' => ' in ',
        ' At ' => ' at ',
        ' For ' => ' for ',
        ' To ' => ' to ',
        ' By ' => ' by ',
        ' As ' => ' as ',
        ' Plc' => ' PLC',
        ' Ltd' => ' Ltd.',
        ' Crdb ' => ' CRDB ',
        ' Tanesco ' => ' TANESCO ',
        ' Nbc ' => ' NBC ',
        ' Nic ' => ' NIC ',
        ' D.p.p' => ' D.P.P',
    );

    return trim(str_replace(array_keys($replacements), array_values($replacements), $text));
}

'''

if start == -1 or end == -1:
    raise SystemExit("Could not locate title-case helper.")

s = s[:start] + new_func + "\n" + s[end:]

# Make latest cases title use formatter
s = s.replace(
    "$title = $case['title'] ?? 'Untitled Case';",
    "$title = tlr_title_case_case_name($case['title'] ?? 'Untitled Case');"
)

# If latest snippet is actually a citation/title line, format it too.
s = s.replace(
    "$snippet = $case['snippet'] ?? '';",
    "$snippet = tlr_title_case_citation($case['snippet'] ?? '');"
)

p.write_text(s)
print("Patched mostly-uppercase title/citation casing.")
PY

#1779110765
cat >> tlr-style.css <<'CSS'

/* TLR typography standard */
.tlr-title,
.tlr-case-title,
.tlr-case-title a,
.tlr-latest-title,
.tlr-latest-title a,
.tlr-latest-heading,
.tlr-case-doc h1,
.tlr-case-doc h2,
.tlr-case-doc h3,
.tlr-la-header h1,
.tlr-jd-header h1,
.tlr-draft-side h2 {
    font-family: "Crimson Text", Georgia, serif !important;
    text-transform: none !important;
}

.tlr-citation,
.tlr-citation-text,
.tlr-latest-snippet {
    text-transform: none !important;
}

CSS

#1779112405
cd ~/lawreports.online/wp-content/plugins/tlr-api-connector
#1779112405
cat >> tlr-api-connector.php <<'PHP'

/**
 * Judge filter widget shortcode.
 * Usage: [tlr_judge_filter]
 */
function tlr_judge_filter_shortcode() {
    $response = wp_remote_get('https://api.lawreports.online/judges', array(
        'timeout' => 20,
        'headers' => array('Accept' => 'application/json')
    ));

    if (is_wp_error($response)) {
        return '<p class="tlr-empty">Unable to load judges.</p>';
    }

    $data = json_decode(wp_remote_retrieve_body($response), true);

    if (empty($data['judges']) || !is_array($data['judges'])) {
        return '<p class="tlr-empty">No judges available.</p>';
    }

    $selected = isset($_GET['judge']) ? (array) $_GET['judge'] : array();
    $selected = array_map('sanitize_text_field', $selected);

    $q = isset($_GET['q']) ? sanitize_text_field(wp_unslash($_GET['q'])) : '';

    $html = '<div class="tlr-judge-filter">';
    $html .= '<h3>Filter by Judicial Officer</h3>';
    $html .= '<form method="get" action="' . esc_url(home_url('/search/')) . '">';
    $html .= '<input type="hidden" name="q" value="' . esc_attr($q) . '">';

    foreach ($data['judges'] as $judge) {
        $judge = trim($judge);
        if (!$judge) continue;

        $checked = in_array($judge, $selected, true) ? ' checked' : '';

        $html .= '<label class="tlr-judge-option">';
        $html .= '<input type="checkbox" name="judge[]" value="' . esc_attr($judge) . '"' . $checked . '> ';
        $html .= esc_html($judge);
        $html .= '</label>';
    }

    $html .= '<button type="submit" class="tlr-judge-filter-btn">Apply Filter</button>';
    $html .= '</form>';
    $html .= '</div>';

    return $html;
}
add_shortcode('tlr_judge_filter', 'tlr_judge_filter_shortcode');

PHP

#1779112407
wp cache flush 2>/dev/null || true
#1779134885
cd ~/lawreports.online/wp-content/plugins
#1779134885
mkdir tlr-subscription-meter
#1779134885
cd tlr-subscription-meter
#1779134888
nano tlr-subscription-meter.php
#1785178919
grep -rn "shell does not exist" wp-content/
#1785179004
dir
#1785179024
cd kenyahighomkigali.org
#1785179053
cd kenyahighcomkigali.org
#1785179072
grep -rli --include="*.php" --include="*.js" "shell does not exist" .
#1785179111
grep -rli --include="*.php" --include="*.js" -E "shell.{0,30}exist" .
#1785179283
ls -la ~/logs/ 2>/dev/null; tail -50 error_log 2>/dev/null
#1785179354
wp db search "shell does not exist"
#1785179598
cat index.php
#1785179807
wp core verify-checksums
#1785179808
quota -s
#1785179816
df -i .
#1785180699
wp db export ~/khc-db-$(date +%F).sql
#1785180715
wp db query "SELECT post_type, post_status, COUNT(*) FROM wp_posts GROUP BY 1,2;"
#1785180738
wp db query "SELECT ID, user_login, user_email, user_registered FROM wp_users;"
#1785180754
wp option get siteurl; wp option get home
#1785180836
cd ..
#1785180841
find /home/konzalta -name "admin-ajax.php" ! -path "*/wp-admin/admin-ajax.php" 2>/dev/null
#1785181038
tar czf khc-forensic-$(date +%F).tar.gz kenyahighcomkigali.org
#1785181235
cd ~/kenyahighcomkigali.org
#1785181249
wp db export ~/khc-db-$(date +%F).sql
#1785181264
wp db query "SELECT post_type, post_status, COUNT(*) FROM wp_posts GROUP BY 1,2;"
#1785181282
wp db query "SELECT ID, user_login, user_email FROM wp_users;"
#1785181293
wp plugin list
#1785181306
wp theme list
#1785181347
find /home/konzalta -name "admin-ajax.php" ! -path "*/wp-admin/admin-ajax.php" 2>/dev/null
#1785181581
crontab -l
#1785181582
cat ~/.ssh/authorized_keys 2>/dev/null
#1785181582
ls -la ~/.ssh/
#1785181582
cat ~/.bashrc ~/.bash_profile | grep -iE "curl|wget|base64|eval"
#1785181602
ls -la ~/.trash/
#1785183461
crontab -l
#1785183540
grep -h "27/Jul/2026:18:" ~/access-logs/* 2>/dev/null | grep "POST" | tail -40
#1785183677
grep -h "27/Jul/2026:18:0" ~/access-logs/* | grep -v "wp-cron.php" | head -60
#1785183679
grep -h "filefuns\|domvf\|fpwch\|lopucjfs" ~/access-logs/* | head -20
#1785183843
grep -l "fpwch.php\|domvf.php" ~/access-logs/*
#1785183865
grep -h "103.189.186.145" ~/access-logs/* | head -40
#1785184216
cd ~/kenyahighcomkigali.org
#1785184219
tar czf ~/khc-pre-clean-$(date +%F-%H%M).tar.gz .
#1785184265
wp core verify-checksums 2>&1 | grep "File should not exist:"   | sed 's/.*File should not exist: //' > /tmp/khc-strays.txt
#1785184268
wc -l /tmp/khc-strays.txt && head -20 /tmp/khc-strays.txt
#1785184290
while read -r f; do chmod 644 "$f" 2>/dev/null; rm -f "$f"; done < /tmp/khc-strays.txt
#1785184303
wp core download --force --version=$(wp core version) --skip-content
#1785184381
ls -la index.php wp-blog-header.php wp-load.php wp-includes/plugin.php wp-includes/functions.php
#1785184383
chmod 644 index.php wp-blog-header.php wp-load.php wp-includes/plugin.php wp-includes/functions.php
#1785184399
chmod 644 wp-includes/template-loader.php wp-includes/load.php           wp-includes/general-template.php wp-includes/cron.php
#1785184401
wp core download --force --version=$(wp core version) --skip-content
#1785184487
ls -ld .
#1785184487
stat index.php
#1785184492
lsattr index.php 2>/dev/null
#1785184512
rm -f index.php
#1785184514
wp core download --force --version=$(wp core version) --skip-content
#1785184541
wp core verify-checksums
#1785184545
stat index.php
#1785184627
cd ~/kenyahighcomkigali.org
#1785184627
wp core verify-checksums
#1785184630
find . -type f -newermt "-15 minutes" \( -name "*.php" -o -name "*.js" \) -ls
#1785184718
ls -la *.php                                              # root shells: fpwch, domvf
#1785184718
find wp-content -type f -newermt "2026-06-01" -name "*.php" -ls
#1785184732
wp db query "SELECT ID,user_login,user_email,user_registered FROM wp_users;"
#1785185731
cd ~/provideinternational.org
#1785185742
wp plugin list --status=active --field=name | grep -i give
#1785185772
wp db tables | grep -i give
#1785185774
wp db query "SELECT post_status, COUNT(*) FROM wp_posts WHERE post_type='give_payment' AND post_date >= '2026-07-01' GROUP BY post_status;"
#1785185809
cd ..
#1785185814
for d in /home/konzalta/*/; do   n=$(find "$d" -maxdepth 6 -type f -name "*.php" -newermt "-60 minutes" 2>/dev/null | wc -l);   [ "$n" -gt 0 ] && echo "$n  $d"; done
#1785185904
find /home/konzalta -maxdepth 6 -type f   \( -name "fpwch.php" -o -name "domvf.php" -o -name "filefuns.php" -o -name "lopucjfs.php" \) 2>/dev/null
#1785186003
cat /home/konzalta/vaka.konzaltant.com/filefuns.php
#1785186041
find /home/konzalta -type f -name "filefuns.php" 2>/dev/null > ~/filefuns-list.txt
#1785186075
wc -l ~/filefuns-list.txt
#1785186075
xargs md5sum < ~/filefuns-list.txt | awk '{print $1}' | sort | uniq -c
#1785186451
while read -r f; do chmod 644 "$f" 2>/dev/null; rm -f "$f"; done < ~/filefuns-list.txt
#1785186453
find /home/konzalta -type f -name "filefuns.php" 2>/dev/null | wc -l
#1785186596
xargs md5sum < ~/filefuns-list.txt | grep -E "be5442|d41d8cd9"
#1785186635
grep -rl "BiaoJiOk" /home/konzalta --include="*.php" 2>/dev/null | wc -l
#1785186699
grep -rl "BiaoJiOk" /home/konzalta --include="*.php" 2>/dev/null > ~/marker-hits.txt
#1785186756
mkdir -p ~/evidence
#1785186756
cp /home/konzalta/vaka.konzaltant.com/filefuns.php ~/evidence/variant-a.php
#1785186756
sort -u ~/filefuns-list.txt ~/marker-hits.txt > ~/kill-list.txt
#1785186760
wc -l ~/kill-list.txt
#1785186931
cp ~/.trash/filefuns.php ~/evidence/variant-a.php 2>/dev/null && ls -la ~/evidence/
#1785186978
while read -r f; do chmod 644 "$f" 2>/dev/null; rm -f "$f"; done < ~/kill-list.txt

Youez - 2016 - github.com/yon3zu
LinuXploit