<?php defined('BLUDIT') or die('Bludit CMS.');

/*
    Javascript global variables generated by PHP
*/

echo '<script charset="utf-8">'.PHP_EOL;
echo 'var HTML_PATH_ROOT = "'.HTML_PATH_ROOT.'";'.PHP_EOL;
echo 'var HTML_PATH_ADMIN_ROOT = "'.HTML_PATH_ADMIN_ROOT.'";'.PHP_EOL;
echo 'var HTML_PATH_ADMIN_THEME = "'.HTML_PATH_ADMIN_THEME.'";'.PHP_EOL;
echo 'var HTML_PATH_CORE_IMG = "'.HTML_PATH_CORE_IMG.'";'.PHP_EOL;
echo 'var HTML_PATH_UPLOADS = "'.HTML_PATH_UPLOADS.'";'.PHP_EOL;
echo 'var BLUDIT_VERSION = "'.BLUDIT_VERSION.'";'.PHP_EOL;
echo 'var BLUDIT_BUILD = "'.BLUDIT_BUILD.'";'.PHP_EOL;
echo 'var DOMAIN = "'.DOMAIN.'";'.PHP_EOL;
echo 'var DOMAIN_BASE = "'.DOMAIN_BASE.'";'.PHP_EOL;
echo 'var DOMAIN_PAGES = "'.DOMAIN_PAGES.'";'.PHP_EOL;
echo 'var DOMAIN_ADMIN = "'.DOMAIN_ADMIN.'";'.PHP_EOL;
echo 'var DOMAIN_CONTENT = "'.DOMAIN_CONTENT.'";'.PHP_EOL;
echo 'var DOMAIN_UPLOADS = "'.DOMAIN_UPLOADS.'";'.PHP_EOL;
echo 'var DOMAIN_UPLOADS_PAGES = "'.DOMAIN_UPLOADS_PAGES.'";'.PHP_EOL;
echo 'var DB_DATE_FORMAT = "'.DB_DATE_FORMAT.'";'.PHP_EOL;
echo 'var AUTOSAVE_INTERVAL = "'.AUTOSAVE_INTERVAL.'";'.PHP_EOL;
echo 'var PAGE_BREAK = "'.PAGE_BREAK.'";'.PHP_EOL;
echo 'var tokenCSRF = "'.$security->getTokenCSRF().'";'.PHP_EOL;
echo 'var ALLOWED_IMG_MIMETYPES = '.json_encode($GLOBALS['ALLOWED_IMG_MIMETYPES']).';'.PHP_EOL;
echo 'var ALLOWED_FILE_MIMETYPES = '.json_encode($GLOBALS['ALLOWED_FILE_MIMETYPES']).';'.PHP_EOL;
echo 'var UPLOAD_MAX_FILESIZE = '.Text::toBytes( ini_get('upload_max_filesize') ).';'.PHP_EOL;
echo 'var DEBUG_MODE = '.(DEBUG_MODE?'true':'false').';'.PHP_EOL;
echo 'var PASSWORD_LENGTH = '.PASSWORD_LENGTH.';'.PHP_EOL;
echo 'var api = new API("'.DOMAIN_BASE.'api/", "'.$plugins['all']['pluginAPI']->token().'", "'.$login->tokenAuth().'", tokenCSRF);'.PHP_EOL;
echo '</script>'.PHP_EOL;

?>