merged from 1.6 - some CSS changes
[moodle.git] / theme / chameleon / ui / css.php
CommitLineData
5452c725 1<?php
2
3require_once('../../../config.php');
4require_once('../config.php');
5
6
7if (empty($THEME->chameleonenabled)) {
8 die('CHAMELEON_ERROR Editing this theme has been disabled');
9}
10
11
12$chameleon_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
13if ($chameleon_id != 0 && !empty($CFG->allowcoursethemes) && !empty($THEME->chameleonteachereditenabled)) {
14 if (!isteacher($chameleon_id)) {
15 die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
16 }
17} else if (!isadmin()) {
18 die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
19}
20
21
22require_once('ChameleonCSS.class.php');
23require_once('ChameleonFileBrowser.class.php');
24
25
26
27if (isset($_GET['path'])) {
28 $fm = new ChameleonFileBrowser;
29 die($fm->readfiles());
30}
31
32$chameleon = new ChameleonCSS('../', 'user_styles.css', 'temp_user_styles.css');
33if (isset($_POST['css'])) {
34 if (!isset($_GET['temp'])) {
35 $chameleon->update('perm', $_POST['css']);
36 $chameleon->update('temp');
37 } else {
38 $chameleon->update('temp', $_POST['css']);
39 }
40
41} else {
42
43 $css = $chameleon->read();
44 if ($css === false) {
45 echo 'CHAMELEON_ERROR ' . $chameleon->error;
46 } else {
47 echo $css;
48 }
49}
50
51
b1cdbbf9 52?>