1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

Fixes #1268 - Media Manager issue with audio file uploads.

This commit is contained in:
Cameron
2016-01-24 00:37:36 -08:00
parent e05e157341
commit 12febdb43c
2 changed files with 30 additions and 17 deletions

View File

@@ -723,7 +723,7 @@ class media_admin_ui extends e_admin_ui
'text' => e_MEDIA_FILE, 'text' => e_MEDIA_FILE,
'multipart' => e_MEDIA_FILE, 'multipart' => e_MEDIA_FILE,
'application' => e_MEDIA_FILE, 'application' => e_MEDIA_FILE,
// 'audio' => e_MEDIA_AUDIO, // 'audio' => e_MEDIA_FILE,
'image' => e_MEDIA_IMAGE, 'image' => e_MEDIA_IMAGE,
'video' => e_MEDIA_VIDEO, 'video' => e_MEDIA_VIDEO,
'other' => e_MEDIA_FILE 'other' => e_MEDIA_FILE
@@ -2282,6 +2282,10 @@ class media_admin_ui extends e_admin_ui
function getPath($mime) function getPath($mime)
{ {
return e107::getMedia()->getPath($mime);
/*
$mes = e107::getMessage(); $mes = e107::getMessage();
list($pmime,$tmp) = explode('/',$mime); list($pmime,$tmp) = explode('/',$mime);
@@ -2304,7 +2308,7 @@ class media_admin_ui extends e_admin_ui
return FALSE; return FALSE;
}; };
} }
return $dir; return $dir;*/
} }
function batchImportForm() function batchImportForm()
@@ -2386,10 +2390,12 @@ class media_admin_ui extends e_admin_ui
} }
$large = e107::getParser()->thumbUrl($f['path'].$f['fname'], 'w=800', true); $large = e107::getParser()->thumbUrl($f['path'].$f['fname'], 'w=800', true);
$checked = empty($_POST['batch_selected']) ? true : false;
$text .= " $text .= "
<tr> <tr>
<td class='center'>".$frm->checkbox("batch_selected[".$c."]",$f['fname'])."</td> <td class='center'>".$frm->checkbox("batch_selected[".$c."]",$f['fname'],$checked)."</td>
<td class='center'>".$this->preview($f)."</td> <td class='center'>".$this->preview($f)."</td>
<td><a class='e-dialog' href='".$large."'>".$f['fname']."</a></td> <td><a class='e-dialog' href='".$large."'>".$f['fname']."</a></td>
<td>".$frm->text('batch_import_name['.$c.']', ($_POST['batch_import_name'][$c] ? $_POST['batch_import_name'][$c] : $default['title']))."</td> <td>".$frm->text('batch_import_name['.$c.']', ($_POST['batch_import_name'][$c] ? $_POST['batch_import_name'][$c] : $default['title']))."</td>
@@ -2417,7 +2423,7 @@ class media_admin_ui extends e_admin_ui
$text .= " $text .= "
</tbody> </tbody>
</table> </table>
<div class='buttons-bar center'> <div class='buttons-bar center form-inline'>
".IMALAN_123." ".$frm->selectbox('batch_category',$this->cats, $_POST['batch_category']); ".IMALAN_123." ".$frm->selectbox('batch_category',$this->cats, $_POST['batch_category']);
// $waterMarkPath = e_THEME.e107::getPref('sitetheme')."/images/watermark.png"; // Now performed site-wide dynamically. // $waterMarkPath = e_THEME.e107::getPref('sitetheme')."/images/watermark.png"; // Now performed site-wide dynamically.
@@ -2587,7 +2593,12 @@ class media_admin_ui extends e_admin_ui
$f['mime'] = "other/file"; $f['mime'] = "other/file";
} }
$newpath = $this->checkDupe($oldpath,$this->getPath($f['mime']).'/'.$file); if(!$newDir = $this->getPath($f['mime']))
{
continue;
}
$newpath = $this->checkDupe($oldpath,$newDir.'/'.$file);
$newname = $tp->toDB($_POST['batch_import_name'][$key]); $newname = $tp->toDB($_POST['batch_import_name'][$key]);
$newdiz = $tp->toDB($_POST['batch_import_diz'][$key]); $newdiz = $tp->toDB($_POST['batch_import_diz'][$key]);
@@ -2624,7 +2635,7 @@ class media_admin_ui extends e_admin_ui
); );
if($sql->db_Insert("core_media",$insert)) if($sql->insert("core_media",$insert))
{ {
$mes->add(IMALAN_128." ".$f['fname'], E_MESSAGE_SUCCESS); $mes->add(IMALAN_128." ".$f['fname'], E_MESSAGE_SUCCESS);
$this->deleteFileXml($f['fname']); $this->deleteFileXml($f['fname']);

View File

@@ -16,9 +16,7 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
/**
* Subject of rewrite/rethinking after the pre-alpha
*/
class e_media class e_media
{ {
protected $imagelist = array(); protected $imagelist = array();
@@ -40,8 +38,9 @@ class e_media
if(E107_DEBUG_LEVEL > 0) if(E107_DEBUG_LEVEL > 0)
{ {
$this->logging = true; $this->logging = true;
} }
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_image.php');
} }
/** /**
* Import files from specified path into media database. * Import files from specified path into media database.
@@ -530,8 +529,8 @@ class e_media
$query .= " LIMIT ".$from." ,".$amount; $query .= " LIMIT ".$from." ,".$amount;
} }
e107::getDb()->db_Select_gen($query); e107::getDb()->gen($query);
while($row = e107::getDb()->db_Fetch(mySQL_ASSOC)) while($row = e107::getDb()->fetch(mySQL_ASSOC))
{ {
$id = $row['media_id']; $id = $row['media_id'];
$ret[$id] = $row; $ret[$id] = $row;
@@ -550,13 +549,13 @@ class e_media
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
$text .= "<div style='margin-left:500px;text-align:center; position:relative;z-index:1000;float:left;display:none' id='{$formid}'>"; $text = "<div style='margin-left:500px;text-align:center; position:relative;z-index:1000;float:left;display:none' id='{$formid}'>";
$text .="<div style='-moz-box-shadow: 3px 3px 3px #808080; $text .="<div style='-moz-box-shadow: 3px 3px 3px #808080;
-webkit-box-shadow: 3px 3px 3px #808080; -webkit-box-shadow: 3px 3px 3px #808080;
box-shadow: 3px 3px 3px #808080; box-shadow: 3px 3px 3px #808080;
background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>"; background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>";
$total = ($sql->db_Select_gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ")) ? TRUE : FALSE; $total = ($sql->gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ")) ? TRUE : FALSE;
$text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='Close' style='text-decoration:none;color:white' href='#' onclick=\"expandit('{$formid}'); return false;\" >x</a></div>"; $text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='Close' style='text-decoration:none;color:white' href='#' onclick=\"expandit('{$formid}'); return false;\" >x</a></div>";
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch())
@@ -941,7 +940,8 @@ class e_media
if(!vartrue($this->mimePaths[$pmime])) if(!vartrue($this->mimePaths[$pmime]))
{ {
$this->log("Couldn't detect mime-type ($mime)."); $this->log("Couldn't detect mime-type ($mime).");
$mes->add("Couldn't detect mime-type ($mime). Upload failed.", E_MESSAGE_ERROR); $text = $text = str_replace('[x]',$mime,IMALAN_111);
$mes->add($text, E_MESSAGE_ERROR);
return FALSE; return FALSE;
} }
@@ -951,8 +951,10 @@ class e_media
{ {
if(!mkdir($dir, 0755)) if(!mkdir($dir, 0755))
{ {
$this->log("Couldn't create folder ($dir)."); $this->log("Couldn't create folder ($dir).");
$mes->add("Couldn't create folder ($dir).", E_MESSAGE_ERROR); $text = str_replace('[x]',$dir,IMALAN_112);
$mes->add($text, E_MESSAGE_ERROR);
return FALSE; return FALSE;
}; };
} }