Merge branch 'master' of git.neuf.no:inside

This commit is contained in:
Øyvind Bakkeli committed 2012-01-11 18:25:02 +01:00
commit 8f2775db32
2 files changed
+13 -13

No files matched your search

+3 -2
View File
@@ -142,8 +142,9 @@ class Concert {
$this->id = getNextId("program");
if($_FILES['userfile']['error'] != 4){
$temp_name = new_file($_FILES['userfile'], "program");
rename_file($temp_name, $this->id, "program");
$this->picture = $this->id.substr($temp_name, -4);
rename_file($temp_name, $this->id, "program");
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
$this->picture = $this->id . "." . $ext;
} else {
$this->picture = "0";
}
+10 -11
View File
@@ -449,22 +449,21 @@ function new_file($file, $dir) {
}
function rename_file($old_name, $id, $dir, $report = true) {
if ($dir == 'products') {
$dir = 'images/products/';
}else {
$dir = "../../public_html/bilder/$dir/";
}
if ($dir == 'products')
$dir = 'images/products/';
else
$dir = "../../public_html/bilder/$dir/";
$old_name = $dir.$old_name;
$new_name = $dir.$id.substr($old_name, -4);
$ext = strtolower( pathinfo($old_name, PATHINFO_EXTENSION) );
$old_name = $dir . $old_name;
$new_name = $dir . $id . "." . $ext;
deleteFile($new_name, false);
if (rename($old_name, $new_name)) {
if (rename($old_name, $new_name))
return true;
}
else {
if ($report == true) {
if ($report == true)
error("Could not rename file.");
}
return false;
}
}