Example #1
0
/**
 * This returns a parsed string called $body. That string can then
 * be displayed as the actual message in the HTML. It contains
 * everything needed, including HTML Tags, Attachments at the
 * bottom, etc.
 */
function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox = 'INBOX', $clean = false)
{
    /* This if statement checks for the entity to show as the
     * primary message. To add more of them, just put them in the
     * order that is their priority.
     */
    global $startMessage, $languages, $squirrelmail_language, $show_html_default, $sort, $has_unsafe_images, $passed_ent_id, $username, $key, $imapServerAddress, $imapPort, $download_and_unsafe_link;
    if (!sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET)) {
        $view_unsafe_images = false;
    }
    $body = '';
    $urlmailbox = urlencode($mailbox);
    $body_message = getEntity($message, $ent_num);
    if ($body_message->header->type0 == 'text' || $body_message->header->type0 == 'rfc822') {
        $body = mime_fetch_body($imap_stream, $id, $ent_num);
        $body = decodeBody($body, $body_message->header->encoding);
        if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
            if (mb_detect_encoding($body) != 'ASCII') {
                $body = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $body);
            }
        }
        $hookResults = do_hook("message_body", $body);
        $body = $hookResults[1];
        /* If there are other types that shouldn't be formatted, add
         * them here.
         */
        if ($body_message->header->type1 == 'html') {
            if ($show_html_default != 1) {
                $entity_conv = array('&nbsp;' => ' ', '<p>' => "\n", '<P>' => "\n", '<br>' => "\n", '<BR>' => "\n", '<br />' => "\n", '<BR />' => "\n", '&gt;' => '>', '&lt;' => '<');
                $body = strtr($body, $entity_conv);
                $body = strip_tags($body);
                $body = trim($body);
                translateText($body, $wrap_at, $body_message->header->getParameter('charset'));
            } else {
                $charset = $body_message->header->getParameter('charset');
                if (!empty($charset)) {
                    $body = charset_decode($charset, $body, false, true);
                }
                $body = magicHTML($body, $id, $message, $mailbox);
            }
        } else {
            translateText($body, $wrap_at, $body_message->header->getParameter('charset'));
        }
        // if this is the clean display (i.e. printer friendly), stop here.
        if ($clean) {
            return $body;
        }
        $download_and_unsafe_link = '';
        $link = 'passed_id=' . $id . '&amp;ent_id=' . $ent_num . '&amp;mailbox=' . $urlmailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
        if (isset($passed_ent_id)) {
            $link .= '&amp;passed_ent_id=' . $passed_ent_id;
        }
        $download_and_unsafe_link .= '&nbsp;|&nbsp;<a href="download.php?absolute_dl=true&amp;' . $link . '">' . _("Download this as a file") . '</a>';
        if ($view_unsafe_images) {
            $text = _("Hide Unsafe Images");
        } else {
            if (isset($has_unsafe_images) && $has_unsafe_images) {
                $link .= '&amp;view_unsafe_images=1';
                $text = _("View Unsafe Images");
            } else {
                $text = '';
            }
        }
        if ($text != '') {
            $download_and_unsafe_link .= '&nbsp;|&nbsp;<a href="read_body.php?' . $link . '">' . $text . '</a>';
        }
    }
    return $body;
}
Example #2
0
$body = decodeBody($body, $encoding);
if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
    if (mb_detect_encoding($body) != 'ASCII') {
        $body = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $body);
    }
}
if ($type1 == 'html' || isset($override_type1) && $override_type1 == 'html') {
    $ishtml = TRUE;
    // html attachment with character set information
    if (!empty($charset)) {
        $body = charset_decode($charset, $body, false, true);
    }
    $body = magicHTML($body, $passed_id, $message, $mailbox);
} else {
    $ishtml = FALSE;
    translateText($body, $wrap_at, $charset);
}
displayPageHeader($color, 'None');
?>
<br /><table width="100%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php 
echo $color[0];
?>
">
<b><center>
<?php 
echo _("Viewing a text attachment") . ' - ' . '<a href="' . $msg_url . '">' . _("View message") . '</a>';
?>
</b></td><tr><tr><td><center>
<?php 
if ($ishtml) {
    echo '<a href="' . $unsafe_url . '">' . _("View Unsafe Images") . '</a> | ';
function addRelation(&$relationsArr, $type, $subject, $verb, $object, $joinedPattern, $verbEngTranslation = "", $fullVerbQuranWord = "")
{
    global $WORDS_TRANSLATIONS_AR_EN;
    global $is_a_relation_name_en;
    if (empty($subject) || empty($object)) {
        return false;
    }
    // make shallow last resort, since it spoils words and lead to duplicate oncepts
    if (!isSimpleQuranWord($subject)) {
        //CONVERT UTHMANI TO SIMPLE
        $subjectSimple = getItemFromUthmaniToSimpleMappingTable($subject);
        // IF NOT CORRESPONDING SIMPLE WORD, CONVERT USING SHALLOW CONVERSION ALGORITHM
        if (empty($subjectSimple)) {
            $subjectSimple = shallowUthmaniToSimpleConversion($subject);
        }
    } else {
        $subjectSimple = $subject;
    }
    // SAME AS ABOVE BUT FOR OBJECT
    if (!isSimpleQuranWord($object)) {
        $objectSimple = getItemFromUthmaniToSimpleMappingTable($object);
        //object simple to avoid null in case when not in the mapping table
        if (empty($objectSimple)) {
            $objectSimple = shallowUthmaniToSimpleConversion($object);
        }
    } else {
        $objectSimple = $object;
    }
    $verbUthmani = $verb;
    $verbSimple = "";
    ///////// VERB TRANSLATION
    if (empty($verbEngTranslation)) {
        $verbEngTranslation = "";
        // SINGLE WORD VERB
        if (!isMultiWordStr($verb)) {
            $verb = trim($verb);
            $translatableVerb = $fullVerbQuranWord;
            // VERB IS SIMPLE
            if (isSimpleQuranWord($verb)) {
                $translatableVerb = getItemFromUthmaniToSimpleMappingTable($fullVerbQuranWord);
            } else {
                $verbSimple = getItemFromUthmaniToSimpleMappingTable($verb);
            }
            $verbEngTranslation = cleanEnglishTranslation($WORDS_TRANSLATIONS_AR_EN[$translatableVerb]);
            //IF NOT IN TRANSLATION TABLE - EX: ONE OF THE SEGMENTS TRIMMED
            if (empty($verbEngTranslation)) {
                // CHECK IF IS ALSO NOTO IN TRANSLATION ENTRY
                if (!isFoundInTranslationTable($translatableVerb, "VERB")) {
                    // TRANSLATE USING MICROSOFT API
                    $verbEngTranslation = translateText($translatableVerb, "ar", "en");
                    // ADD TO QA CUSTOM TRANSLATION TABLE
                    addTranslationEntry($verbEngTranslation, "VERB", $translatableVerb, "AR");
                    //no need
                    //persistTranslationTable();
                } else {
                    $customTranslationEntryArr = getTranlationEntryByEntryKeyword($translatableVerb);
                    $verbEngTranslation = $customTranslationEntryArr['EN_TEXT'];
                }
            }
        } else {
            //SPLIT PHRASE
            $verbPhraseArr = preg_split("/ /", $verb);
            foreach ($verbPhraseArr as $verbPart) {
                $translatableVerb = $verbPart;
                // IF SIMPLE
                if (isSimpleQuranWord($verbPart)) {
                    //GET UTHMANI WORD TO BE ABEL TO TRANSLATE
                    $translatableVerb = getItemFromUthmaniToSimpleMappingTable($verbPart);
                } else {
                    // GET SIMPLE WORD TO BE ADDED IN RELATION META
                    $simplePart = getItemFromUthmaniToSimpleMappingTable($verbPart);
                    //if not in translation table, use shalow conversion
                    if (empty($simplePart)) {
                        $simplePart = shallowUthmaniToSimpleConversion($verbPart);
                    }
                    $verbSimple = $verbSimple . " " . $simplePart;
                    // THIS VARIABLE NEEDED FOR TRANSLATION
                    $translatableVerb = $simplePart;
                }
                // TRANSLATE
                $verbPartTranslated = cleanEnglishTranslation($WORDS_TRANSLATIONS_AR_EN[$translatableVerb]);
                //IF NOT IN TRANSLATION TABLE - EX: ONE OF THE SEGMENTS TRIMMED
                if (empty($verbPartTranslated)) {
                    // CHECK IF IS ALSO NOTO IN TRANSLATION ENTRY
                    if (!isFoundInTranslationTable($verbPart, "VERB")) {
                        // TRANSLATE USING MICROSOFT API
                        $verbPartTranslated = translateText($verbPart, "ar", "en");
                        // ADD TO QA CUSTOM TRANSLATION TABLE
                        addTranslationEntry($verbPartTranslated, "VERB", $verbPart, "AR");
                        //persistTranslationTable();
                    } else {
                        $customTranslationEntryArr = getTranlationEntryByEntryKeyword($verbPart);
                        $verbPartTranslated = $customTranslationEntryArr['EN_TEXT'];
                    }
                }
                // TRANSLATION ACCUMILATION
                $verbEngTranslation = $verbEngTranslation . " " . $verbPartTranslated;
            }
        }
    }
    if ($verbEngTranslation != "is kind of" && $verbEngTranslation != "part of" && $verbEngTranslation != $is_a_relation_name_en) {
        //$verbEngTranslation = removeBasicEnglishStopwordsNoNegation($verbEngTranslation);
    }
    $verbSimple = trim($verbSimple);
    if (empty($verbSimple)) {
        $verbSimple = removeTashkeel(shallowUthmaniToSimpleConversion($verbUthmani));
    }
    return addNewRelation($relationsArr, $type, $subjectSimple, $verbSimple, $objectSimple, $joinedPattern, $verbEngTranslation, $verbUthmani);
}
Example #4
0
<?php

/**
 * Created by PhpStorm.
 * User: master
 * Date: 2016/3/25
 * Time: 14:11
 */
header('Content-Type:text/html;charset=utf-8');
require 'lib.php';
error_reporting(0);
$word = trim($_GET['q']);
echo translateText($word, 'en', 'zh');
Example #5
0
function getTranslateOnline($text)
{
    $arr = array('CHN' => translateText($text, 'auto', 'zh'), 'Eng' => translateText($text, 'auto', 'en'), 'De' => translateText($text, 'auto', 'de'));
    return $arr;
}
Example #6
0
/**
 * This returns a parsed string called $body. That string can then
 * be displayed as the actual message in the HTML. It contains
 * everything needed, including HTML Tags, Attachments at the
 * bottom, etc.
 *
 * Since 1.2.0 function uses message_body hook.
 * Till 1.3.0 function included output of formatAttachments().
 *
 * @param resource $imap_stream imap connection resource
 * @param object $message squirrelmail message object
 * @param array $color squirrelmail color theme array
 * @param integer $wrap_at number of characters per line
 * @param string $ent_num (since 1.3.0) message part id
 * @param integer $id (since 1.3.0) message id
 * @param string $mailbox (since 1.3.0) imap folder name
 * @return string html formated message text
 */
function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox = 'INBOX')
{
    /* This if statement checks for the entity to show as the
     * primary message. To add more of them, just put them in the
     * order that is their priority.
     */
    global $startMessage, $languages, $squirrelmail_language, $show_html_default, $sort, $has_unsafe_images, $passed_ent_id, $use_iframe, $iframe_height, $download_and_unsafe_link, $download_href, $unsafe_image_toggle_href, $unsafe_image_toggle_text, $oTemplate, $nbsp;
    // workaround for not updated config.php
    if (!isset($use_iframe)) {
        $use_iframe = false;
    }
    // If there's no "view_unsafe_images" variable in the URL, turn unsafe
    // images off by default.
    sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET, FALSE);
    $body = '';
    $urlmailbox = urlencode($mailbox);
    $body_message = getEntity($message, $ent_num);
    if ($body_message->header->type0 == 'text' || $body_message->header->type0 == 'rfc822') {
        $body = mime_fetch_body($imap_stream, $id, $ent_num);
        $body = decodeBody($body, $body_message->header->encoding);
        if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode')) {
            if (mb_detect_encoding($body) != 'ASCII') {
                $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode', $body);
            }
        }
        /* As of 1.5.2, $body is passed (and modified) by reference */
        do_hook('message_body', $body);
        /* If there are other types that shouldn't be formatted, add
         * them here.
         */
        if ($body_message->header->type1 == 'html') {
            if ($show_html_default != 1) {
                $entity_conv = array('&nbsp;' => ' ', '<p>' => "\n", '<P>' => "\n", '<br>' => "\n", '<BR>' => "\n", '<br />' => "\n", '<BR />' => "\n", '&gt;' => '>', '&lt;' => '<');
                $body = strtr($body, $entity_conv);
                $body = strip_tags($body);
                $body = trim($body);
                translateText($body, $wrap_at, $body_message->header->getParameter('charset'));
            } elseif ($use_iframe) {
                /**
                 * If we don't add html message between iframe tags,
                 * we must detect unsafe images and modify $has_unsafe_images.
                 */
                $html_body = magicHTML($body, $id, $message, $mailbox);
                // Convert character set in order to display html mails in different character set
                $html_body = charset_decode($body_message->header->getParameter('charset'), $html_body, false, true);
                // creating iframe url
                $iframeurl = sqm_baseuri() . 'src/view_html.php?' . 'mailbox=' . $urlmailbox . '&amp;passed_id=' . $id . '&amp;ent_id=' . $ent_num . '&amp;view_unsafe_images=' . (int) $view_unsafe_images;
                global $oTemplate;
                $oTemplate->assign('iframe_url', $iframeurl);
                $oTemplate->assign('iframe_height', $iframe_height);
                $oTemplate->assign('html_body', $html_body);
                $body = $oTemplate->fetch('read_html_iframe.tpl');
            } else {
                // old way of html rendering
                /**
                 * convert character set. charset_decode does not remove html special chars
                 * applied by magicHTML functions and does not sanitize them second time if
                 * fourth argument is true.
                 */
                $charset = $body_message->header->getParameter('charset');
                if (!empty($charset)) {
                    $body = charset_decode($charset, $body, false, true);
                }
                $body = magicHTML($body, $id, $message, $mailbox);
            }
        } else {
            translateText($body, $wrap_at, $body_message->header->getParameter('charset'));
        }
        /*
         * Previously the links for downloading and unsafe images were printed
         * under the mail. By putting the links in a global variable we can
         * print it in the toolbar where it belongs. Since the original code was
         * in this place it's left here. It might be possible to move it to some
         * other place if that makes sense. The possibility to do so has not
         * been evaluated yet.
         */
        // Initialize the global variable to an empty string.
        // FIXME: To have $download_and_unsafe_link as a global variable might not be needed since the use of separate variables ($download_href, $unsafe_image_toggle_href, and $unsafe_image_toggle_text) for the templates was introduced.
        $download_and_unsafe_link = '';
        // Prepare and build a link for downloading the mail.
        $link = 'passed_id=' . $id . '&amp;ent_id=' . $ent_num . '&amp;mailbox=' . $urlmailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
        if (isset($passed_ent_id)) {
            $link .= '&amp;passed_ent_id=' . $passed_ent_id;
        }
        $download_href = SM_PATH . 'src/download.php?absolute_dl=true&amp;' . $link;
        // Always add the link for downloading the mail as a file to the global
        // variable.
        $download_and_unsafe_link .= "{$nbsp}|{$nbsp}" . create_hyperlink($download_href, _("Download this as a file"));
        // Find out the right text to use in the link depending on the
        // circumstances. If the unsafe images are displayed the link should
        // hide them, if they aren't displayed the link should only appear if
        // the mail really contains unsafe images.
        if ($view_unsafe_images) {
            $text = _("Hide Unsafe Images");
        } else {
            if (isset($has_unsafe_images) && $has_unsafe_images) {
                $link .= '&amp;view_unsafe_images=1';
                $text = _("View Unsafe Images");
            } else {
                $text = '';
            }
        }
        // Only create a link for unsafe images if there's need for one. If so:
        // add it to the global variable.
        if ($text != '') {
            $unsafe_image_toggle_href = SM_PATH . 'src/read_body.php?' . $link;
            $unsafe_image_toggle_text = $text;
            $download_and_unsafe_link .= "{$nbsp}|{$nbsp}" . create_hyperlink($unsafe_image_toggle_href, $text);
        }
    }
    return $body;
}
Example #7
0
File: mime.php Project: jprice/EHCP
/**
 * This returns a parsed string called $body. That string can then
 * be displayed as the actual message in the HTML. It contains
 * everything needed, including HTML Tags, Attachments at the
 * bottom, etc.
 */
function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox = 'INBOX', $clean = false)
{
    /* This if statement checks for the entity to show as the
     * primary message. To add more of them, just put them in the
     * order that is their priority.
     */
    global $startMessage, $languages, $squirrelmail_language, $show_html_default, $sort, $has_unsafe_images, $passed_ent_id, $username, $key, $imapServerAddress, $imapPort, $download_and_unsafe_link;
    // If there's no "view_unsafe_images" variable in the URL, turn unsafe
    // images off by default.
    if (!sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET)) {
        $view_unsafe_images = false;
    }
    $body = '';
    $urlmailbox = urlencode($mailbox);
    $body_message = getEntity($message, $ent_num);
    if ($body_message->header->type0 == 'text' || $body_message->header->type0 == 'rfc822') {
        $body = mime_fetch_body($imap_stream, $id, $ent_num);
        $body = decodeBody($body, $body_message->header->encoding);
        if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
            if (mb_detect_encoding($body) != 'ASCII') {
                $body = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $body);
            }
        }
        $hookResults = do_hook("message_body", $body);
        $body = $hookResults[1];
        /* If there are other types that shouldn't be formatted, add
         * them here.
         */
        if ($body_message->header->type1 == 'html') {
            if ($show_html_default != 1) {
                $entity_conv = array('&nbsp;' => ' ', '<p>' => "\n", '<P>' => "\n", '<br>' => "\n", '<BR>' => "\n", '<br />' => "\n", '<BR />' => "\n", '&gt;' => '>', '&lt;' => '<');
                $body = strtr($body, $entity_conv);
                $body = strip_tags($body);
                $body = trim($body);
                translateText($body, $wrap_at, $body_message->header->getParameter('charset'));
            } else {
                $charset = $body_message->header->getParameter('charset');
                if (!empty($charset)) {
                    $body = charset_decode($charset, $body, false, true);
                }
                $body = magicHTML($body, $id, $message, $mailbox);
            }
        } else {
            translateText($body, $wrap_at, $body_message->header->getParameter('charset'));
        }
        // if this is the clean display (i.e. printer friendly), stop here.
        if ($clean) {
            return $body;
        }
        /*
         * Previously the links for downloading and unsafe images were printed
         * under the mail. By putting the links in a global variable we can
         * print it in the toolbar where it belongs. Since the original code was
         * in this place it's left here. It might be possible to move it to some
         * other place if that makes sense. The possibility to do so has not
         * been evaluated yet.
         */
        // Initialize the global variable to an empty string.
        $download_and_unsafe_link = '';
        // Prepare and build a link for downloading the mail.
        $link = 'passed_id=' . $id . '&amp;ent_id=' . $ent_num . '&amp;mailbox=' . $urlmailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
        if (isset($passed_ent_id)) {
            $link .= '&amp;passed_ent_id=' . $passed_ent_id;
        }
        // Always add the link for downloading the mail as a file to the global
        // variable.
        $download_and_unsafe_link .= '&nbsp;|&nbsp;<a href="download.php?absolute_dl=true&amp;' . $link . '">' . _("Download this as a file") . '</a>';
        // Find out the right text to use in the link depending on the
        // circumstances. If the unsafe images are displayed the link should
        // hide them, if they aren't displayed the link should only appear if
        // the mail really contains unsafe images.
        if ($view_unsafe_images) {
            $text = _("Hide Unsafe Images");
        } else {
            if (isset($has_unsafe_images) && $has_unsafe_images) {
                $link .= '&amp;view_unsafe_images=1';
                $text = _("View Unsafe Images");
            } else {
                $text = '';
            }
        }
        // Only create a link for unsafe images if there's need for one. If so:
        // add it to the global variable.
        if ($text != '') {
            $download_and_unsafe_link .= '&nbsp;|&nbsp;<a href="read_body.php?' . $link . '">' . $text . '</a>';
        }
    }
    return $body;
}
 // DIDN'T FIND NEITHER ARABIC OR ENGLISH CONCEPTS IN FINAL CONCEPTS LIST
 if (!isset($finalConcepts[$finalConceptName])) {
     $exPhase = "ENRICHMENT_WORDNET";
     //$parentConceptEN = ucfirst($parentConceptEN);
     $conceptType = "T-BOX";
     $res = addNewConcept($enrichedFinalConcepts, $finalConceptName, $conceptType, $exPhase, 1, $englishConceptName);
     if ($res == true) {
         $newConceptsAdded++;
         $newConceptsAddedArr[$finalConceptName] = 1;
     }
     $enrichedFinalConcepts[$finalConceptName]['EXTRA']['MEANING_EN']['WORDNET'] = $glossary;
     if (isFoundInTranslationTable($glossary, "DESC")) {
         $customTranslationEntry = getTranlationEntryByEntryKeyword($glossary);
         $glossaryAR = $customTranslationEntry['AR_TEXT'];
     } else {
         $tentitaveTranslation = translateText($glossary);
         /*	echoN($glossary);
         			echoN("==".("(plural) any group of human beings (men or women or children) collectively"==$glossary));
         			//showHiddenChars(removeUnacceptedChars(cleanAndTrim("(plural) any group of human beings (men or women or children) collectively")),"EN");
         			//showHiddenChars("someone who leads you to believe something that is not true","EN");
         			isFoundInTranslationTable($glossary,"DESC");
         			preprint_r($CUSTOM_TRANSLATION_TABLE_EN_AR["(plural) any group of human beings (men or women or children) collectively"]);
         			preprint_r($CUSTOM_TRANSLATION_TABLE_EN_AR);
         			exit;*/
         addTranslationEntry($glossary, "DESC", $tentitaveTranslation);
         $glossaryAR = $tentitaveTranslation;
     }
     $enrichedFinalConcepts[$finalConceptName]['EXTRA']['MEANING_AR']['WORDNET'] = $glossaryAR;
     foreach ($wordsArr as $synonym => $dummy) {
         if ($synonym != $parentConceptName) {
             $enrichedFinalConcepts[$finalConceptName]['EXTRA']['AKA']['EN']['WORDNET'] = cleanWordnetCollocation($synonym);
function sourceAnalyze($SOLVED_TEXT, $globals)
{
    $State = "app";
    $i = 0;
    $SearchStrings[$i++] = "~designroot~";
    // 0
    $SearchStrings[$i++] = "~sessionid~";
    // 1
    $SearchStrings[$i++] = "~main~";
    // 2
    $SearchStrings[$i++] = "~application~";
    // 3
    $SearchStrings[$i++] = "~/application~";
    // 4
    $SearchStrings[$i++] = "~ignore~";
    // 5
    $SearchStrings[$i++] = "~/ignore~";
    // 6
    $SearchStrings[$i++] = "~mainpage~";
    // 7
    $SearchStrings[$i++] = "~/mainpage~";
    // 8
    $SearchStrings[$i++] = "~domain~";
    // 9
    $SearchStrings[$i++] = "~function~";
    // 10
    $SearchStrings[$i++] = "~/function~";
    // 11
    $itemamount = 1;
    while ($itemamount > 0) {
        $IndexPage = $SOLVED_TEXT;
        unset($AllPositions);
        $AllPositions[0] = 0;
        $i = 1;
        for ($z = 0; $z < count($SearchStrings); $z++) {
            $LastPos = 0;
            while (strpos($IndexPage, $SearchStrings[$z], $LastPos) != "") {
                $AllPositions[$i] = strpos($IndexPage, $SearchStrings[$z], $LastPos);
                $LastPos = $AllPositions[$i] + 1;
                $i++;
            }
        }
        $AllPositions[count($AllPositions)] = strlen($IndexPage);
        // Sortieralgorithmus der gespeicherten Positionen
        sort($AllPositions);
        unset($Log);
        $zPos = 0;
        $z = 0;
        $Weiter = true;
        while ($Weiter) {
            $Item = substr($IndexPage, $AllPositions[$zPos], $AllPositions[$zPos + 1] - $AllPositions[$zPos]);
            for ($x = 0; $x < count($SearchStrings); $x++) {
                $XFnd = false;
                if (strpos(" " . $Item, $SearchStrings[$x]) > 0) {
                    $Log[$z++] = $SearchStrings[$x];
                    $Log[$z++] = str_replace($SearchStrings[$x], "", $Item);
                    $XFnd = true;
                    break;
                }
            }
            if (!$XFnd) {
                $Log[$z++] = $Item;
            }
            $zPos++;
            if ($zPos > count($AllPositions)) {
                $Weiter = false;
            }
        }
        // Sichere derzeitige GLOBAL
        if (!$globals) {
            $SECURE_stdOUT = $GLOBALS["stdOUT"];
        }
        // Wenn keine Keywords mehr vorhanden Schleife abbrechen
        // Wenn Wert auf false BLEIBT wird die Schleife abgebrochen
        // Wird er auf TRUE gesetzt, geht die Schleife weiter.
        // Wegen den Keywords IGNORE wird die Variable SOURCE_ROUND direkt
        // in der Schleife auf TRUE gesetzt.
        $SOLVED_TEXT = "";
        $LogAnz = 0;
        $itemamount = 0;
        while ($LogAnz < count($Log)) {
            $GLOBALS["stdOUT"] = "";
            if (!in_array($Log[$LogAnz], $SearchStrings) or $Log[$LogAnz] == $SearchStrings[15]) {
                if ($Log[$LogAnz] != $SearchStrings[15]) {
                    $GLOBALS["stdOUT"] .= $Log[$LogAnz];
                    $GLOBALS["stdOUT"] = translateText($GLOBALS["stdOUT"]);
                    $GLOBALS["stdOUT"] = cloakURL($GLOBALS["stdOUT"]);
                    // Mailadressen nur deformieren, wenn stdOUT gewandelt wird. (In Mails ist die JavaScript-Funktion nicht vorhanden)
                    if ($globals) {
                        $GLOBALS["stdOUT"] = deformateMail($GLOBALS["stdOUT"]);
                    }
                } else {
                    while ($Log[$LogAnz] != $SearchStrings[16]) {
                        $GLOBALS["stdOUT"] .= $Log[$LogAnz];
                        $LogAnz++;
                    }
                    $GLOBALS["stdOUT"] .= $Log[$LogAnz];
                }
            } else {
                $itemamount++;
                switch ($Log[$LogAnz]) {
                    case $SearchStrings[0]:
                        // designroot
                        $GLOBALS["stdOUT"] .= designroot;
                        break;
                    case $SearchStrings[1]:
                        // sessionid
                        $GLOBALS["stdOUT"] .= session_id();
                        break;
                    case $SearchStrings[2]:
                        // mainmodule
                        $GLOBALS["stdOUT"] .= "~mainpage~" . inc_main . "~/mainpage~";
                        break;
                    case $SearchStrings[3]:
                        // application
                        $orig = $State;
                        $State = "app";
                        if (strpos($Log[$LogAnz + 1], "=") > 0) {
                            $url = explode("&", $Log[$LogAnz + 1]);
                            for ($i = 0; $i < count($url); $i++) {
                                $va = explode("=", $url[$i]);
                                $_ORIGS[$va[0]] = $_POST[$va[0]];
                                $_POST[$va[0]] = $va[1];
                                if ($va[0] == "State") {
                                    $State = $va[1];
                                }
                            }
                            $app = $_POST["module"];
                        } else {
                            $app = $Log[$LogAnz + 1];
                        }
                        if (!(include $GLOBALS["_MODULES"][$app][1])) {
                            $GLOBALS["stdOUT"] .= "Fehler bei Aufruf der Seite '" . $GLOBALS["_MODULES"][$app][0] . "'<br>";
                        }
                        $State = $orig;
                        if (strpos($Log[$LogAnz + 1], "=") > 0) {
                            for ($i = 0; $i < count($url); $i++) {
                                $va = explode("=", $url[$i]);
                                $_POST[$va[0]] = $_ORIGS[$va[0]];
                            }
                            unset($_ORIGS);
                        }
                        $LogAnz = $LogAnz + 2;
                        break;
                    case $SearchStrings[7]:
                        // mainpage
                        $orig = $GLOBALS["State"];
                        $State = "main";
                        if (strpos($Log[$LogAnz + 1], "=") > 0) {
                            $url = explode("&", $Log[$LogAnz + 1]);
                            for ($i = 0; $i < count($url); $i++) {
                                $va = explode("=", $url[$i]);
                                $_ORIGS[$va[0]] = $_POST[$va[0]];
                                $_POST[$va[0]] = $va[1];
                                if ($va[0] == "State") {
                                    $State = $va[1];
                                }
                                if ($va[0] == "module") {
                                    $app = $va[1];
                                }
                            }
                        } else {
                            $app = $Log[$LogAnz + 1];
                        }
                        if (!(include $GLOBALS["_MODULES"][$app][1])) {
                            $GLOBALS["stdOUT"] .= "Fehler bei Aufruf der Seite '" . $GLOBALS["_MODULES"][$app][0] . "'<br>";
                        }
                        $GLOBALS["_PAGEAPP"] = $app != "" ? $app : "Default Module";
                        $GLOBALS["State"] = $orig;
                        if (count($_ORIGS) > 0) {
                            for ($i = 0; $i < count($url); $i++) {
                                $va = explode("=", $url[$i]);
                                $_POST[$va[0]] = $_ORIGS[$va[0]];
                            }
                            unset($_ORIGS);
                        }
                        $LogAnz = $LogAnz + 1;
                        break;
                    case $SearchStrings[9]:
                        // domain
                        $GLOBALS["stdOUT"] .= domain;
                        break;
                    case $SearchStrings[10]:
                        // function
                        $command = $Log[$LogAnz + 1];
                        $command = explode("|", $command);
                        eval("\$sol = " . $command[0] . "(" . $command[1] . ");");
                        append($sol);
                        $LogAnz = $LogAnz + 1;
                        break;
                }
                // Hier können Operationen an stdOUT erfolgen. (ist in diesem Fall nur zustzliches Item)
                // Hier ist ignoring false
                $GLOBALS["stdOUT"] = translateText($GLOBALS["stdOUT"]);
                $GLOBALS["stdOUT"] = cloakURL($GLOBALS["stdOUT"]);
                // Mailadressen nur deformieren, wenn stdOUT gewandelt wird. (In Mails ist die JavaScript-Funktion nicht vorhanden)
                if ($globals) {
                    $GLOBALS["stdOUT"] = deformateMail($GLOBALS["stdOUT"]);
                }
            }
            $SOLVED_TEXT .= $GLOBALS["stdOUT"];
            $LogAnz++;
        }
        if (RetrieveVar("CASCADE", "0111")) {
            echo "#" . $GLOBALS["CASC_AMNT"]++ . ":<hr>\n\n" . $SOLVED_TEXT . "<br>Itemcount: " . $itemamount . "<br>\n\n<hr>\n\n";
        }
    }
    // Backsave GLOBAL
    if (!$globals) {
        $GLOBALS["stdOUT"] = $SECURE_stdOUT;
    }
    return $SOLVED_TEXT;
}