Ejemplo n.º 1
0
$style_formats = FALSE;
$style_path = $_CONF['path_html'] . 'tinymce/js/style_formats.js';
clearstatcache();
if (is_readable($style_path)) {
    $style_formats = file_get_contents($style_path);
}
if ($style_formats === FALSE) {
    $style_formats = $_TMCE_CONF['default_styles'];
}
$element_format = (defined('XHTML') and XHTML === ' /') ? 'xhtml' : 'html';
// Builds a template list
$templates = TMCE_getTemplateList();
if (count($templates) > 0) {
    $temp = array();
    foreach ($templates as $template) {
        $temp[] = '{title: "' . TMCE_esc($template['title']) . '", src: "' . $template['src'] . '", description: "' . TMCE_esc($template['description']) . '"}';
    }
    $templates = implode(', ', $temp);
} else {
    $templates = '';
}
// Starts storing JavaScript code as a string
$js = <<<EOD
// +---------------------------------------------------------------------------+
// | TinyMCE Plugin for Geeklog - The Ultimate Weblog                          |
// +---------------------------------------------------------------------------+
// | public_html/tinymce/js/tinymce_loader.js.php                              |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2010 mystral-kk - geeklog AT mystral-kk DOT net             |
// +---------------------------------------------------------------------------+
// |                                                                           |
Ejemplo n.º 2
0
/**
* Returns config ediot
*
* @param   int     $cid  cid
* @return  string
*/
function TMCE_getAdminConfigEditor($cid)
{
    global $_CONF, $_TABLES, $_TMCE_CONF;
    $cid = (int) $cid;
    $sql = "SELECT * " . "FROM {$_TABLES['tinymce_configs']} " . "WHERE (cid = '" . addslashes($cid) . "') ";
    $result = DB_query($sql);
    if (!DB_error() and DB_numRows($result) == 1) {
        $A = DB_fetchArray($result, FALSE);
    } else {
        $A = $_TMCE_CONF['default_data'];
        $A['title'] = 'new';
    }
    $A['buttons'] = unserialize($A['buttons']);
    $T = new Template($_CONF['path'] . 'plugins/tinymce/templates');
    $T->set_file('editor', 'editor.thtml');
    $T->set_var('xhtml', XHTML);
    // Sets lang vars
    $langs = array('admin_title', 'admin_theme', 'admin_toolbars', 'admin_plugins', 'admin_grp_name', 'admin_submit', 'admin_delete', 'admin_confirm_delete', 'admin_avaiable_buttons', 'admin_disabled_buttons', 'admin_tb_perms', 'admin_tb_allow_upload', 'admin_tb_allow_edit', 'admin_tb_allow_delete', 'admin_tb_allow_folders', 'admin_enter_function');
    foreach ($langs as $lang) {
        $T->set_var('lang_' . $lang, TMCE_str($lang));
    }
    $T->set_var('action', $_CONF['site_admin_url'] . '/plugins/tinymce/index.php');
    $T->set_var('cid', TMCE_esc($A['cid']));
    $T->set_var('title', TMCE_esc($A['title']));
    $T->set_var('theme_options', TMCE_getThemeOptions($A['theme']));
    // Sets the path to "install.html"
    $lang = str_replace('_utf-8', '', COM_getLanguage());
    $docPath = $_CONF['path_html'] . 'admin/plugins/tinymce/docs/' . $lang . '/install.html';
    clearstatcache();
    if (!is_readable($docPath)) {
        $lang = 'english';
    }
    $docUrl = $_CONF['site_admin_url'] . '/plugins/tinymce/docs/' . $lang . '/install.html';
    $config_help = sprintf(TMCE_str('admin_config_help', TRUE), $docUrl);
    $T->set_var('config_help', $config_help);
    $palettes = TMCE_getPalette();
    $T->set_var('palette1', $palettes[0]);
    $T->set_var('palette2', $palettes[1]);
    $T->set_var('buttons1', $A['buttons']['buttons1']);
    $T->set_var('buttons2', $A['buttons']['buttons2']);
    $T->set_var('buttons3', $A['buttons']['buttons3']);
    $T->set_var('buttons4', $A['buttons']['buttons4']);
    $T->set_var('plugins', TMCE_unpackPlugins($A['plugins']));
    $T->set_var('tb_allow_upload_options', TMCE_getBooleanOptions($A['tb_allow_upload']));
    $T->set_var('tb_allow_edit_options', TMCE_getBooleanOptions($A['tb_allow_edit']));
    $T->set_var('tb_allow_delete_options', TMCE_getBooleanOptions($A['tb_allow_delete']));
    $T->set_var('tb_allow_folders_options', TMCE_getBooleanOptions($A['tb_allow_folders']));
    $T->set_var('enter_options', TMCE_getEnterOptions($A['enter_function']));
    $T->set_var('group_options', TMCE_getGroupOptions($A['group_id']));
    $T->set_var('token_name', CSRF_TOKEN);
    $T->set_var('token_value', SEC_createToken($_TMCE_CONF['token_expirary']));
    $T->set_var('visibility', $cid === 0 ? 'none' : '');
    $T->parse('output', 'editor');
    return $T->finish($T->get_var('output'));
}