Esempio n. 1
0
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
    return;
}
require dirname(__FILE__) . '/class.themeEditor.php';
$file_default = $file = array('c' => null, 'w' => false, 'type' => null, 'f' => null, 'default_file' => false);
# Loading themes
$core->themes = new dcThemes($core);
$core->themes->loadModules($core->blog->themes_path, null);
$T = $core->themes->getModules($core->blog->settings->theme);
$o = new dcThemeEditor($core);
try {
    try {
        if (!empty($_REQUEST['tpl'])) {
            $file = $o->getFileContent('tpl', $_REQUEST['tpl']);
        } elseif (!empty($_REQUEST['css'])) {
            $file = $o->getFileContent('css', $_REQUEST['css']);
        } elseif (!empty($_REQUEST['js'])) {
            $file = $o->getFileContent('js', $_REQUEST['js']);
        }
    } catch (Exception $e) {
        $file = $file_default;
        throw $e;
    }
    # Write file
    if (!empty($_POST['write'])) {
        $file['c'] = $_POST['file_content'];
        $o->writeFile($file['type'], $file['f'], $file['c']);
    }
} catch (Exception $e) {