<?php
/**
 * For printing out all the panel error messages which then can be injected where required
 * @author Rihards Siliņš
 * @copyright MTC media Ltd
 */
$cms_root_path = "../../../";
require_once($cms_root_path."includes/compatibility_includer.php");

$content_manager_panel = new ContentManagerPanel();
$content_manager_panel->mergeSessionMessages();

foreach ($content_manager_panel->messages as $class => $messages) {
    if (empty($messages)) {
        continue;
    }
    ?>
    <div class="msg <?= clean_page($class) ?>">
        <?php
        $already_displayed_messages = array();
        foreach ($messages as $key => $message) {
            if (in_array($message, $already_displayed_messages)) {
                continue;
            }
            ?>
            <p>
                <?=clean_page($message)?>
            </p>
            <?php
            $already_displayed_messages[] = $message;
        }
        ?>
    </div>
    <?php
}
