$retval[] = $button;
        }
    }
    return implode(',', $retval);
}
//===================================================================
// Main
//===================================================================
// Gets configuration from db
$A = TMCE_getConfig();
$theme = $A['theme'];
$toolbars = unserialize($A['buttons']);
list($useTinyBrowser, $plugins) = TMCE_checkPlugins($A['plugins']);
$enter_function = (int) $A['enter_function'];
// Decides locale
list($language, $directionality) = TMCE_getLocale();
// Decides mode
switch ($_TMCE_CONF['targets']) {
    case 'all':
        $mode = 'textareas';
        break;
    case 'css_class':
        $mode = 'specific_textareas';
        break;
    case 'css_id':
        $mode = 'none';
        break;
    case 'auto':
    default:
        $mode = 'specific_textareas';
        break;
// set script time out higher, to help with thumbnail generation
@set_time_limit(240);
require_once dirname(__FILE__) . '/../../../../../lib-common.php';
if (!in_array('tinymce', $_PLUGINS)) {
    die('No direct access!');
}
$tb_perms = TMCE_getConfig();
$tinybrowser = array();
// Session control and security check - to enable please uncomment
//if(isset($_GET['sessidpass'])) session_id($_GET['sessidpass']); // workaround for Flash session bug
//session_start();
//$tinybrowser['sessioncheck'] = 'authenticated_user'; //name of session variable to check
// Random string used to secure Flash upload if session control not enabled - be sure to change!
$tinybrowser['obfuscate'] = '5505a454fa748e311655fb50911b7614';
// Set default language (ISO 639-1 code)
list($tinybrowser['language'], $tinybrowser['directionality']) = TMCE_getLocale();
// Set the integration type (TinyMCE is default)
$tinybrowser['integration'] = 'tinymce';
// Possible values: 'tinymce', 'fckeditor'
// Default is rtrim($_SERVER['DOCUMENT_ROOT'],'/') (suitable when using absolute paths, but can be set to '' if using relative paths)
$tinybrowser['docroot'] = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
// Folder permissions for Unix servers only
$tinybrowser['unixpermissions'] = $_TMCE_CONF['tb_unixpermissions'];
// File upload paths (set to absolute by default)
$tinybrowser['path']['image'] = preg_replace("|^https?://[^/]+|", '', $_CONF['site_url'] . '/images/library/Image/');
// Image files location - also creates a '_thumbs' subdirectory within this path to hold the image thumbnails
$tinybrowser['path']['media'] = preg_replace("|^https?://[^/]+|", '', $_CONF['site_url'] . '/images/library/Media/');
// Media files location
$tinybrowser['path']['file'] = preg_replace("|^https?://[^/]+|", '', $_CONF['site_url'] . '/images/library/File/');
// Other files location
// File link paths - these are the paths that get passed back to TinyMCE or your application (set to equal the upload path by default)