<?

function textcontent_show( $sitepart_id ) {
    $query  = "SELECT * FROM textcontent_header WHERE id = '" . $sitepart_id . "' LIMIT 1";
    $result = @mysqli_query($GLOBALS['mysql_con'], $query);
    if (@mysqli_num_rows($result) == 1) {
        $textcontent = @mysqli_fetch_array($result);

        $ckeditorString = "";
        if ($GLOBALS["live_edit_mode"] === TRUE) {
            $ckeditorString = 'id="textcontent_editor_' . $sitepart_id . '" contenteditable="true" data-textcontentid="' . $sitepart_id . '"';
        }

        echo "\n<div class=\"textcontent\" " . $ckeditorString . ">\n";

        $host_pattern = '/{contact}/i';
        $host_content = $GLOBALS["main_contact"]["name"];
        $textcontent['content'] = preg_replace($host_pattern, $host_content, $textcontent['content']);

        echo $textcontent["content"] . "\n";
        echo "</div>\n";
    }
}

function textcontent_edit() {
    require('edit_textcontent.inc.php');
}