HEX
Server: LiteSpeed
System: Linux d8 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: wbwebdes (3015)
PHP: 8.1.31
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/wbwebdes/domains/mailing.wb-cloud.nl/private_html/admin/actions/generatetextpreview.php
<?php

/**
 * @brief Ajax handler for generating the message body preview line shown in some mail clients below the subject
 * @note based on generatetext.php
 */

verifyCsrfGetToken();

// generate text content
$msgid = sprintf('%d', $_GET['id']);
$messagedata = loadMessageData($msgid);
// shorten to 90 chars (max message preview length)

// If plaintext campaign content was separately saved, use that
if (!empty( $messagedata['textmessage'] ) ) {
    $previewText = $messagedata['textmessage'];
    
// Check if the campaign content is a 'send as a web page' url, and if so, convert that to text instead
} elseif (preg_match('/\[URL:(.+)\]/', $messagedata['message'], $regs)) {
    $content = fetchUrl($regs[1]);
    $previewText = HTML2Text($content);
} else {
    $previewText = HTML2Text($messagedata['message']);
}

$shortPreviewText = substr( $previewText, 0, 90);

// convert to visual preview
// FIXME this fails when the text is large, or contains £

// remove newlines
$shortPreviewText = str_replace("\r", "", $shortPreviewText);
$shortPreviewText = str_replace("\n", "", $shortPreviewText);

$shortPreviewText = trim($shortPreviewText);

// fix entities
$shortPreviewText = htmlentities($shortPreviewText, ENT_IGNORE, 'UTF-8', true);

// replace quotes
$shortPreviewText = str_replace('"', '&quot;', $shortPreviewText);

$status = 
'<script type="text/javascript">
    $("#messagepreview").val("' .$shortPreviewText.'");
</script>
';