projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes commit e3a55098b1cfd274d8965fc307a316d9f0c447a1 (Banana conversion to hruid).
[platal.git]
/
classes
/
plupload.php
diff --git
a/classes/plupload.php
b/classes/plupload.php
index
133b55d
..
ea192f0
100644
(file)
--- a/
classes/plupload.php
+++ b/
classes/plupload.php
@@
-49,7
+49,7
@@
class PlUpload
private function makeFilename($file_id)
{
global $globals;
private function makeFilename($file_id)
{
global $globals;
- $filename = $globals->spoolroot . '/spool/
uploads/te
mp/';
+ $filename = $globals->spoolroot . '/spool/
t
mp/';
if (!file_exists($filename)) {
if (!mkdir($filename)) {
trigger_error('can\'t create upload directory: ' . $filename, E_USER_ERROR);
if (!file_exists($filename)) {
if (!mkdir($filename)) {
trigger_error('can\'t create upload directory: ' . $filename, E_USER_ERROR);
@@
-66,6
+66,9
@@
class PlUpload
{
if ($this->exists()) {
$this->type = trim(mime_content_type($this->filename));
{
if ($this->exists()) {
$this->type = trim(mime_content_type($this->filename));
+ if ($this->type == 'text/plain') { // Workaround a bug of php 5.2.0+etch10 (mime_content_type fallback is 'text/plain')
+ $this->type = preg_replace('/;.*/', '', trim(shell_exec('file -bi ' . escapeshellarg($this->filename))));
+ }
}
}
}
}
@@
-159,7
+162,7
@@
class PlUpload
static public function listRawFiles($forlife = '*', $category = '*', $uniq = false, $basename = false)
{
global $globals;
static public function listRawFiles($forlife = '*', $category = '*', $uniq = false, $basename = false)
{
global $globals;
- $filename = $globals->spoolroot . '/spool/
uploads/te
mp/';
+ $filename = $globals->spoolroot . '/spool/
t
mp/';
$filename .= $forlife . '--' . $category;
if (!$uniq) {
$filename .= '--*';
$filename .= $forlife . '--' . $category;
if (!$uniq) {
$filename .= '--*';
@@
-228,6
+231,10
@@
class PlUpload
$array = getimagesize($this->filename);
$array[2] = @$map[$array[2]];
if (!$array[2]) {
$array = getimagesize($this->filename);
$array[2] = @$map[$array[2]];
if (!$array[2]) {
+ list($image, $type) = explode('/', $array['mime']);
+ $array[2] = $type;
+ }
+ if (!$array[2]) {
trigger_error('unknown image type', E_USER_NOTICE);
return null;
}
trigger_error('unknown image type', E_USER_NOTICE);
return null;
}