3 require_once('../../../config.php');
4 require_once('../config.php');
7 if (empty($THEME->chameleonenabled)) {
8 die('CHAMELEON_ERROR Editing this theme has been disabled');
12 $chameleon_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
13 if ($chameleon_id != 0 && !empty($CFG->allowcoursethemes) && !empty($THEME->chameleonteachereditenabled)) {
14 if (!isteacheredit($chameleon_id)) {
15 die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
17 } else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
18 die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
22 require_once('ChameleonCSS.class.php');
23 require_once('ChameleonFileBrowser.class.php');
27 if (isset($_GET['path'])) {
28 $fm = new ChameleonFileBrowser;
29 die($fm->readfiles());
32 $chameleon = new ChameleonCSS('../', 'user_styles.css', 'temp_user_styles.css');
34 if (isset($_POST['css'])) {
35 if (!isset($_GET['temp'])) {
36 if (!$chameleon->update('perm', $_POST['css'])) {
37 die('CHAMELEON_ERROR ' . $chameleon->error);
39 if (!$chameleon->update('temp')) {
40 die('CHAMELEON_ERROR ' . $chameleon->error);
43 if (!$chameleon->update('temp', $_POST['css'])) {
44 die('CHAMELEON_ERROR ' . $chameleon->error);
50 $css = $chameleon->read();
52 echo 'CHAMELEON_ERROR ' . $chameleon->error;