Permalink
Browse files

merged from 1.6 - enhancements and bugfixes, works now in Safari and …

…Konqueror
  • Loading branch information...
1 parent d4b912c commit 296ed48e99e6d38ad6e583a01fd9a1ba84b0472a urs_hunkler committed Jul 18, 2006
@@ -14,6 +14,11 @@ function ChameleonCSS($base, $perm, $temp) {
}
function update($file, $content = '') {
+ if (!is_writable($this->base . $this->$file)) {
+ $this->error = $this->$file . ' is not writeable, the file permissions are currently ' . $this->getfilepermissions($this->$file);
+ return false;
+ }
+
if (!$fp = fopen($this->base . $this->$file, 'w')) {
$this->error = 'couldn\'t open file';
return false;
@@ -22,16 +27,23 @@ function update($file, $content = '') {
fclose($fp);
return true;
}
+
+ function getfilepermissions($file) {
+ return substr(sprintf('%o', fileperms($this->base . $file)), -4);
+ }
function read() {
- $permcss = trim(file_get_contents($this->base . $this->perm));
- $tempcss = trim(file_get_contents($this->base . $this->temp));
+ $permcss = file_get_contents($this->base . $this->perm);
+ $tempcss = file_get_contents($this->base . $this->temp);
if ($permcss === false || $tempcss === false) {
- $this->error = 'couldn\'t read file';
+ $this->error = 'Couldn\'t read file';
return false;
}
+ $permcss = trim($permcss);
+ $tempcss = trim($tempcss);
+
if ($tempcss == '') {
return $permcss;
}
Oops, something went wrong.

0 comments on commit 296ed48

Please sign in to comment.