Example #1
0
function template_tinymce()
{
    $ID = $_GET["tinymce"];
    if (isset($_POST["template_content_post"])) {
        $template_content = $_POST["template_content_{$_POST["template_content_post"]}"];
        $sql = "UPDATE emailing_templates SET template_datas='{$template_content}' WHERE ID={$ID}";
        $q = new mysql();
        $q->QUERY_SQL($sql, "artica_backup");
        if (!$q->ok) {
            $error = "<center><H1 style='color:red'>{$q->mysql_error}</H1></center>";
        }
    }
    $sql = "SELECT * FROM emailing_templates WHERE ID='{$ID}'";
    $q = new mysql();
    $page = CurrentPageName();
    $tpl = new templates();
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if ($ligne["ou"] != base64_decode($_GET["ou"])) {
        die;
    }
    //TinyMce();
    $html = "\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-gb\" lang=\"en-gb\">\n\t<head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n    <title>{$ligne["template_name"]}</title>\n  \t<script type=\"text/javascript\" language=\"javascript\" src=\"js/jquery-1.4.2.min.js\"></script>\n    <script language=\"javascript\" type=\"text/javascript\" src=\"js/tiny_mce/tiny_mce.js\"></script> \t\n  \t\n\t<script>\n\t\t//removed template\n\t\ttinyMCE.init({\n\t\tmode : \"textareas\",\n\t\ttheme : \"advanced\",\n\t\tskin : \"cirkuit\",\n\t\tlanguages : '" . $tpl->_detect_lang() . "',\n\t\t\n\t\tplugins : \"pdw,autoresize,safari,pagebreak,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups\",\n\t\ttheme_advanced_buttons1 : \"pdw_toggle,save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect\",\n\t\ttheme_advanced_buttons2 : \"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor\",\n\t\ttheme_advanced_buttons3 : \"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen\",\n\t\ttheme_advanced_buttons4 : \"insertlayer,moveforward,movebackward,absolute,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak\",\n\t\ttheme_advanced_toolbar_location : \"top\",\n\t\ttheme_advanced_toolbar_align : \"left\",\n\t\ttheme_advanced_statusbar_location : \"bottom\",\n\t\ttheme_advanced_resizing : true,\n\t\tpdw_toggle_on : 1,\n        pdw_toggle_toolbars : \"2,3,4\",\n\t\tcontent_css : \"{$page}?template-css={$ID}&bogus=\"+ new Date().getTime()+\"&ou={$_GET["ou"]}\",\n\t\ttheme_advanced_font_sizes: \"8px,9px,10px,12px,13px,14px,16px,18px,20px\",\n\t\tfont_size_style_values : \"8px,9px,10px,12px,13px,14px,16px,18px,20px\",\n\t\t\n\tstyle_formats : [\n\t\t{title : 'Bold text', inline : 'b'},\n\t\t{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},\n\t\t{title : 'Red h1', block : 'h1', styles : {color : '#ff0000'}},\n\t\t{title : 'Table styles'},\n\t\t{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}\n\t],\t\t\n\t\t\n\tformats : {\n\t\talignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'},\n\t\taligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'},\n\t\talignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'},\n\t\talignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'},\n\t\tbold : {inline : 'span', 'classes' : 'bold'},\n\t\titalic : {inline : 'span', 'classes' : 'italic'},\n\t\tunderline : {inline : 'span', 'classes' : 'underline', exact : true},\n\t\tstrikethrough : {inline : 'del'}\n\t\t\n\t}\t\t\n\t\t\n\t});\n\t</script>\n\t</head>\n\t<body style='margin:5px;padding:0px'>\n\t{$error}\n  \t<form name='FORM_{$ID}' method=POST action='{$page}'>\n  \t\n  \t<input type='hidden' name=ou id=ou value='{$_GET["ou"]}'>\n  \t<input type='hidden' name=template_content_post id=template_content_post value='{$ID}'>\n\t<textarea id=\"template_content_{$ID}\" name=\"template_content_{$ID}\" rows=\"40\" cols=\"80\" style=\"width:100%;overflow: scroll;\">{$ligne["template_datas"]}</textarea> \n  \t</form>\n\t</body>\n  \t</html>";
    echo $html;
}