function print_content_page()
    {
        $this->caption = $GLOBALS["Lang"]["Content"];
        $fout = '<script type="text/javascript" src="/libs/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
    mode : "specific_textareas",
    editor_selector : "input",
    theme : "advanced",
    plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist,autosave,visualblocks",
    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fullscreen,code,",
    theme_advanced_buttons2 : "fontselect,fontsizeselect,visualchars,nonbreaking,pagebreak,restoredraft,visualblocks",
    theme_advanced_buttons3 : "search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo",
    theme_advanced_buttons4 : "link,unlink,anchor,image,cleanup,|,insertdate,inserttime,preview,|,forecolor,backcolor",
    theme_advanced_buttons5 : "tablecontrols,,,",
    theme_advanced_buttons6 : "hr,removeformat,visualaid,|,sub,sup,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl",
    theme_advanced_buttons7 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    content_css : "/libs/tiny_mce/css/content.css",
    template_external_list_url : "/libs/tiny_mce/lists/template_list.js",
    external_link_list_url : "/libs/tiny_mce/lists/link_list.js",
    external_image_list_url : "/libs/tiny_mce/lists/image_list.js",
    media_external_list_url : "/libs/tiny_mce/lists/media_list.js",
    template_replace_values : {
            username : "******",
            staffid : "991234"
    }
});
</script>
<style>
.mceToolbarRow1, .mceToolbarRow2, .mceToolbarRow3, .mceToolbarRow4, .mceToolbarRow5, .mceToolbarRow6{
float:left;
}
</style>
';
        if (!empty($_POST["caption"]) && !empty($_POST["text"])) {
            $caption = trim(htmlspecialchars($_POST["caption"]));
            $text = trim(mysql_real_escape_string($_POST["text"]));
            $img = $_POST["file1"];
            $visible = $_POST["visible"];
            if (empty($img)) {
                $img = $_POST["file0"];
            }
            if (!empty($_POST["url"])) {
                $url = trim(htmlspecialchars($_POST["url"]));
            } else {
                $url = engine::url_translit(engine::strtolower_utf8($caption));
            }
            if (!empty($_GET["id"])) {
                $imgs = array();
                for ($i = 0; $i < 10; $i++) {
                    if ($_POST["photo_" . $i] != "0") {
                        array_push($imgs, $_POST["photo_" . $i]);
                    }
                }
                $imgs = array_unique($imgs);
                $str = '';
                foreach ($imgs as $i) {
                    $str .= $i . ';';
                }
                // checking url before updating content
                $query = 'SELECT * FROM `nodes_content` WHERE `url` = "' . $url . '" AND `id` <> "' . $_GET["id"] . '"';
                $r = engine::mysql($query);
                $d = mysql_fetch_array($r);
                $i = 0;
                while (!empty($d)) {
                    $newurl = $url . "-" . ++$i;
                    $query = 'SELECT * FROM `nodes_content` WHERE `url` = "' . $newurl . '" AND `id` <> "' . $_GET["id"] . '"';
                    $r = engine::mysql($query);
                    $d = mysql_fetch_array($r);
                    if (empty($d)) {
                        $url = $newurl;
                    }
                }
                $query = 'UPDATE `nodes_content` SET `caption` = "' . $caption . '", `text` = "' . $text . '", `imgs` = "' . $str . '", `url` = "' . $url . '", `date` = "' . date("U") . '" WHERE `id` = "' . $_GET["id"] . '"';
                engine::mysql($query);
                if (!empty($img)) {
                    $query = 'UPDATE `nodes_content` SET `img` = "' . $img . '" WHERE `id` = "' . $_GET["id"] . '"';
                    engine::mysql($query);
                }
            } else {
                if (!empty($_GET["cat_id"])) {
                    if ($_GET["act"] == "edit") {
                        // checking url before updating catalog
                        $query = 'SELECT * FROM `nodes_catalog` WHERE `url` = "' . $url . '" AND `id` <> "' . $_GET["cat_id"] . '"';
                        $r = engine::mysql($query);
                        $d = mysql_fetch_array($r);
                        $i = 0;
                        while (!empty($d)) {
                            $newurl = $url . "-" . ++$i;
                            $query = 'SELECT * FROM `nodes_catalog` WHERE `url` = "' . $newurl . '" AND `id` <> "' . $_GET["cat_id"] . '"';
                            $r = engine::mysql($query);
                            $d = mysql_fetch_array($r);
                            if (empty($d)) {
                                $url = $newurl;
                            }
                        }
                        $query = 'UPDATE `nodes_catalog` SET `caption` = "' . $caption . '", `text` = "' . $text . '", `url` = "' . $url . '", `visible` = "' . $visible . '" WHERE `id` = "' . $_GET["cat_id"] . '"';
                        engine::mysql($query);
                        if ($_POST["noimg"]) {
                            $query = 'UPDATE `nodes_catalog` SET `img` = "" WHERE `id` = "' . $_GET["cat_id"] . '"';
                            engine::mysql($query);
                        }
                        if (!empty($img)) {
                            $query = 'UPDATE `nodes_catalog` SET `img` = "' . $img . '" WHERE `id` = "' . $_GET["cat_id"] . '"';
                            engine::mysql($query);
                        }
                    } else {
                        $imgs = array();
                        for ($i = 0; $i < 10; $i++) {
                            if ($_POST["photo_" . $i] != "0") {
                                array_push($imgs, $_POST["photo_" . $i]);
                            }
                        }
                        $imgs = array_unique($imgs);
                        $str = '';
                        foreach ($imgs as $i) {
                            $str .= $i . ';';
                        }
                        // checking url before adding content
                        $query = 'SELECT * FROM `nodes_content` WHERE `url` = "' . $url . '"';
                        $r = engine::mysql($query);
                        $d = mysql_fetch_array($r);
                        $i = 0;
                        while (!empty($d)) {
                            $newurl = $url . "-" . ++$i;
                            $query = 'SELECT * FROM `nodes_content` WHERE `url` = "' . $newurl . '"';
                            $r = engine::mysql($query);
                            $d = mysql_fetch_array($r);
                            if (empty($d)) {
                                $url = $newurl;
                            }
                        }
                        $query = 'INSERT INTO `nodes_content`(cat_id, url, caption, text, img, imgs, date) ' . 'VALUES("' . $_GET["cat_id"] . '", "' . $url . '", "' . $caption . '", "' . $text . '", "' . $img . '", "' . $str . '", "' . date("U") . '")';
                        engine::mysql($query);
                        $fout = '<script language="JavaScript" type="text/javascript">window.location = "/admin/mode=content&cat_id=' . $_GET["cat_id"] . '&act=list";</script>';
                        return $fout;
                    }
                } else {
                    // checking url before adding catalog
                    $query = 'SELECT * FROM `nodes_catalog` WHERE `url` = "' . $url . '"';
                    $r = engine::mysql($query);
                    $d = mysql_fetch_array($r);
                    $i = 0;
                    while (!empty($d)) {
                        $newurl = $url . "-" . ++$i;
                        $query = 'SELECT * FROM `nodes_catalog` WHERE `url` = "' . $newurl . '"';
                        $r = engine::mysql($query);
                        $d = mysql_fetch_array($r);
                        if (empty($d)) {
                            $url = $newurl;
                        }
                    }
                    $visible = $_POST["visible"];
                    if (!empty($img)) {
                        $query = 'INSERT INTO `nodes_catalog`(caption, text, url, img, visible) VALUES("' . $caption . '", "' . $text . '", "' . $url . '", "' . $img . '", "' . $visible . '")';
                    } else {
                        $query = 'INSERT INTO `nodes_catalog`(caption, text, url, visible) VALUES("' . $caption . '", "' . $text . '", "' . $url . '", "' . $visible . '")';
                    }
                    engine::mysql($query);
                }
            }
        }
        if (!empty($_GET["id"])) {
            if ($_GET["act"] == "remove") {
                $query = 'DELETE FROM `nodes_content` WHERE `id` = "' . $_GET["id"] . '"';
                engine::mysql($query);
                $fout = '<script language="JavaScript" type="text/javascript">window.location = "/admin/mode=content";</script>';
                return $fout;
            } else {
                $query = 'SELECT * FROM `nodes_content` WHERE `id` = "' . $_GET["id"] . '"';
                $res = engine::mysql($query);
                $data = mysql_fetch_array($res);
                $this->caption = $data["caption"];
                $fout .= '<form method="POST"  ENCTYPE="multipart/form-data">
<center><div style="width: 280px; text-align:left;">
<span><a href="/admin/mode=content&cat_id=' . $data["id"] . '&act=list" ><span>' . $data["caption"] . '</span></a> / ' . $GLOBALS["Lang"]["Edit article"] . '</span>
    <br/><br/>
<input type="text" class="input" name="caption" style="width: 100%;" placeHolder="' . $GLOBALS["Lang"]["Caption"] . '" value="' . $data["caption"] . '" /><br/><br/>
<input type="text" class="input" name="url" style="width: 100%;" placeHolder="URL" value="' . $data["url"] . '" /><br/><br/>

        ';
                if (!empty($_POST["file1"])) {
                    $fout .= '<img src="/img/data/thumb/' . $_POST["file1"] . '" /><input type="hidden" name="file0" value="' . $data["file1"] . '" /><br/>';
                }
                $uploading_count = 1;
                require_once "engine/functions/print_uploader.php";
                $fout .= print_uploder();
                $fout .= '<br/>

        <textarea class="input" name="text" style="width: 280px; height: 150px; margin-top: 3px; padding: 3px;">' . $data["text"] . '</textarea>
        <div style="clear:both; height: 10px;"></div>
        ';
                if (!empty($_POST["comment"])) {
                    $text = str_replace('"', "'", htmlspecialchars(strip_tags($_POST["comment"])));
                    $text = str_replace("\n", "<br/>", $text);
                    $query = 'SELECT * FROM `nodes_comments` WHERE `text` LIKE "' . $text . '" AND `url` LIKE "' . $data["url"] . '" AND `user_id` = "1"';
                    $res = engine::mysql($query);
                    $d = mysql_fetch_array($res);
                    if (empty($d)) {
                        $query = 'INSERT INTO `nodes_comments` (`url`, `reply`, `user_id`, `text`, `date`) ' . 'VALUES("' . $data["url"] . '", "' . intval($_POST["reply"]) . '", "1", "' . $text . '", "' . date("U") . '")';
                        engine::mysql($query);
                    }
                }
                if (!empty($_POST["delete_comment"])) {
                    $query = 'DELETE FROM `nodes_comment` WHERE `id` = "' . $_POST["delete_comment"] . '"';
                    engine::mysql($query);
                }
                $query = 'SELECT * FROM `nodes_comments` WHERE `url` = "/' . $data["url"] . '"';
                $res = engine::mysql($query);
                while ($d = mysql_fetch_array($res)) {
                    if (intval($d["id"]) > 0) {
                        $fout .= '<center><table width=100% align=center border=0 class="table" style="border: #c0c0c0 1px solid; border-spacing: 0px;">';
                        $fout .= $this->print_comment($d["id"]);
                        $fout .= '</table></center><br/><br/>';
                    }
                }
                $fout .= '<input type="submit" class="btn" value="' . $GLOBALS["Lang"]["Submit"] . '" style="width: 280px;" /><br/><br/>
        <a href="/admin/mode=content"><input type="submit" class="btn" value="Back to content" style="width: 280px;" /></a>
<br/>
</div>
</center>
</form>';
            }
        } else {
            if (!empty($_GET["cat_id"])) {
                if ($_GET["act"] == "remove") {
                    $query = 'DELETE FROM `nodes_catalog` WHERE `id` = "' . $_GET["cat_id"] . '"';
                    engine::mysql($query);
                    $fout = '<script language="JavaScript" type="text/javascript">window.location = "/admin/mode=content&cat_id=' . $_GET["cat_id"] . '&act=list";</script>';
                    return $fout;
                } else {
                    if ($_GET["act"] == "edit") {
                        $fout .= '<form method="POST" id="edit_form"  ENCTYPE="multipart/form-data"><center><div style="width: 100%; min-width: 280px; max-width: 400px; text-align:center;">';
                        $query = 'SELECT * FROM `nodes_catalog` WHERE `id` = "' . $_GET["cat_id"] . '"';
                        $res = engine::mysql($query);
                        $data = mysql_fetch_array($res);
                        $this->caption = $data["caption"];
                        $fout .= '
            <h2 style="font-size: 21px;">' . $GLOBALS["Lang"]["Edit directory"] . '</h2><br/>
        <input type="text" name="caption" style="width: 100%;" title="' . $GLOBALS["Lang"]["Caption"] . '" placeHolder="' . $GLOBALS["Lang"]["Caption"] . '" class="input" value="' . $data["caption"] . '" /><br/><br/>
        <input type="text" name="url" style="width: 100%;" class="input" value="' . $data["url"] . '" title="URL" placeHolder="URL" /><br/><br/>
        Show in navigation <select name="visible" class="input">';
                        if ($data["visible"]) {
                            $fout .= '<option value="0">No</option><option value="1" selected>Yes</option>';
                        } else {
                            $fout .= '<option value="0" selected>No</option><option value="1">Yes</option>';
                        }
                        $fout .= '</select><br/><br/>';
                        if (!empty($data["img"])) {
                            $fout .= '<img src="/img/data/thumb/' . $data["img"] . '" /><br/>' . '<input type="hidden" id="noimg" name="noimg" value="0" />' . '<input type="button" onClick=\'  document.getElementById("noimg").value="1"; ' . '                                 document.getElementById("edit_form").submit();\' ' . 'class="btn" style="width: 280px; margin-bottom: 3px;" value="Delete image" /><br/>';
                        }
                        $uploading_count = 1;
                        require_once "engine/functions/print_uploader.php";
                        $fout .= print_uploder();
                        $fout .= '<br/>
        <textarea class="input" name="text" style="width: 100%;">' . $data["text"] . '</textarea><br/>
        <input type="submit" class="btn" style="width: 280px;" value="Save changes" />
                </div></center></form>
                    ';
                        if (!empty($_POST["comment"])) {
                            $text = str_replace('"', "'", htmlspecialchars(strip_tags($_POST["comment"])));
                            $text = str_replace("\n", "<br/>", $text);
                            $query = 'SELECT * FROM `nodes_comments` WHERE `text` LIKE "' . $text . '" AND `url` LIKE "' . $url . '" AND `user_id` = "1"';
                            $res = engine::mysql($query);
                            $data = mysql_fetch_array($res);
                            if (empty($data)) {
                                $query = 'INSERT INTO `nodes_comments` (`url`, `reply`, `user_id`, `text`, `date`) ' . 'VALUES("' . $url . '", "' . intval($_POST["reply"]) . '", "1", "' . $text . '", "' . date("U") . '")';
                                engine::mysql($query);
                            }
                        }
                        $flag = 0;
                        $query = 'SELECT * FROM `nodes_comments` WHERE `url` = "' . $url . '"';
                        $res = engine::mysql($query);
                        while ($data = mysql_fetch_array($res)) {
                            if (intval($data["id"]) > 0) {
                                $fout .= '<center><table width=100% align=center border=0 class="table" style="border: #c0c0c0 1px solid; border-spacing: 0px;">';
                                $fout .= $this->print_comment($data["id"]);
                                $fout .= '</table></center>';
                                $flag = 1;
                            }
                        }
                    } else {
                        if ($_GET["act"] == "list") {
                            $query = 'SELECT * FROM `nodes_catalog` WHERE `id` = "' . $_GET["cat_id"] . '"';
                            $res = engine::mysql($query);
                            $data = mysql_fetch_array($res);
                            $this->caption = $data["caption"];
                            $fout .= '<center>
        <table width=100% align=center border=0 class="table" style="border: #c0c0c0 0px solid; border-spacing: 0px;">
        <tr><td align=left>
        ';
                            $query = 'SELECT * FROM `nodes_content` WHERE `cat_id` = "' . $_GET["cat_id"] . '"';
                            $res = engine::mysql($query);
                            $flag = 0;
                            while ($data = mysql_fetch_array($res)) {
                                $flag = 1;
                                $fout .= '<a href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $_GET["cat_id"] . '&id=' . $data["id"] . '&act=edit" title="' . $GLOBALS["Lang"]["Edit"] . '">' . $data["caption"] . '</a>&nbsp;
    <small style="color: #ff0000;">[<a style="color: #ff0000; font-size: 10px;" href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $_GET["cat_id"] . '&id=' . $data["id"] . '&act=remove">' . $GLOBALS["Lang"]["Delete"] . '</a>]</small><br/>';
                            }
                            if (!$flag) {
                                $fout .= '<center style="padding-top:50px; padding-top:50px;">There is no articles</center>';
                            }
                            $fout .= '</td></tr></table><br/>' . '<a href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $_GET["cat_id"] . '"><input type="button" class="btn" style="width: 280px;" value="' . $GLOBALS["Lang"]["Add new article"] . '" /></a></td></tr>';
                            $fout .= '</center>';
                        } else {
                            $query = 'SELECT * FROM `nodes_catalog` WHERE `id` = "' . $_GET["cat_id"] . '"';
                            $res = engine::mysql($query);
                            $data = mysql_fetch_array($res);
                            $this->caption = $data["caption"];
                            $fout .= '<form method="POST"  ENCTYPE="multipart/form-data">
<center><div style="width: 280px; text-align:left;">
<span><a href="/admin/mode=content&cat_id=' . $data["id"] . '&act=list" ><span>' . $data["caption"] . '</span></a> / ' . $GLOBALS["Lang"]["Add new article"] . '</span>
    <br/><br/>
<input type="text" class="input" name="caption" style="width: 100%;" placeHolder="' . $GLOBALS["Lang"]["Caption"] . '" value="' . $_POST["caption"] . '" /><br/><br/>
<input type="text" class="input" name="url" style="width: 100%;" placeHolder="URL" value="' . $_POST["url"] . '" /><br/><br/>

        ';
                            if (!empty($_POST["file1"])) {
                                $fout .= '<img src="/img/data/thumb/' . $_POST["file1"] . '" /><input type="hidden" name="file0" value="' . $_POST["file1"] . '" /><br/>';
                            }
                            $uploading_count = 1;
                            require_once "engine/functions/print_uploader.php";
                            $fout .= print_uploder();
                            $fout .= '<br/>

        <textarea class="input" name="text" style="width: 650px; height: 150px; margin-top: 3px; padding: 3px;">' . $_POST["text"] . '</textarea>
        <div style="clear:both; height: 10px;"></div>
        <input type="submit" class="btn" value="' . $GLOBALS["Lang"]["Submit"] . '" style="width: 280px;" /><br/><br/>
        <a href="/admin/mode=content"><input type="submit" class="btn" value="Back to content" style="width: 280px;" /></a>
<br/>
</div>
</center>
</form>';
                        }
                    }
                }
            } else {
                $fout .= '<form method="POST"><center><div style="width: 100%; min-width: 280px; max-width: 400px; text-align:center;"><ul style="line-height: 1.5; text-align:left;">';
                $query = 'SELECT * FROM `nodes_catalog`';
                $res = engine::mysql($query);
                while ($data = mysql_fetch_array($res)) {
                    $fout .= '<li><a href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $data["id"] . '&act=list">' . $data["caption"] . '</a>
&nbsp;<small style="color: #009900;">[<a style="color: #009900; font-size: 10px;" href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $data["id"] . '">' . $GLOBALS["Lang"]["Add"] . '</a>]</small>
<small style="color: #0000ff;">[<a style="color: #0000ff; font-size: 10px;" href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $data["id"] . '&act=edit">' . $GLOBALS["Lang"]["Edit"] . '</a>]</small>
<small style="color: #ff0000;">[<a style="color: #ff0000; font-size: 10px;" href="/admin/mode=' . $_GET["mode"] . '&cat_id=' . $data["id"] . '&act=remove">' . $GLOBALS["Lang"]["Delete"] . '</a>]</small>
</li>';
                }
                $fout .= '
                </ul><br/><br/>
                <input type="button" onClick=\'document.getElementById("new_directory").style.display="block"; this.style.display="none";\' value="' . $GLOBALS["Lang"]["Add a new directory"] . '" class="btn" style="width: 280px;" />
                <div id="new_directory" style="display:none;">
                <center><h2 style="font-size: 21px;">' . $GLOBALS["Lang"]["Add a new directory"] . '</h2></center><br/>
            <input required type="text" class="input" name="caption" style="width: 100%;" placeHolder="' . $GLOBALS["Lang"]["Caption"] . '" /><br/><br/>
            <input required type="text" class="input" name="url" style="width: 100%;" placeHolder="URL" /><br/><br/>
            Show in navigation <select name="visible" class="input"><option value="0">No</option><option value="1" selected>Yes</option></select><br/><br/>';
                $uploading_count = 1;
                require_once "engine/functions/print_uploader.php";
                $fout .= print_uploder();
                $fout .= '
            <br/>
        <textarea class="input" name="text" style="width: 100%;"></textarea>
        <br/>
        <input type="submit" value="Submit" class="btn" style="width: 280px;" />
        </div>
        </div></center></form>
                ';
            }
        }
        return $fout;
    }