Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
martin 2011-08-31 15:14:44 -04:00
commit 0517bf0c82
8 changed files with 22 additions and 13 deletions

View file

@ -178,9 +178,10 @@ class LibraryController extends Zend_Controller_Action
{
$request = $this->getRequest();
$form = new Application_Form_EditAudioMD();
$file_id = $this->_getParam('id', null);
$file = StoredFile::Recall($file_id);
$form->populate($file->getDbColMetadata());
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
@ -196,7 +197,6 @@ class LibraryController extends Zend_Controller_Action
}
}
$form->populate($file->getDbColMetadata());
$this->view->form = $form;
}

View file

@ -29,21 +29,15 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add title field
$this->addElement('text', 'track_title', array(
'label' => 'Title:',
'required' => true,
'class' => 'input_text',
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
)
));
// Add artist field
$this->addElement('text', 'artist_name', array(
'label' => 'Artist:',
'required' => true,
'class' => 'input_text',
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
// Add album field

View file

@ -728,7 +728,7 @@ class StoredFile {
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
Logging::log(__FILE__.':uploadFile(): filename='.$fileName);
// Clean the fileName for security reasons
//this needs fixing for songs not in ascii.
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
@ -823,7 +823,7 @@ class StoredFile {
public static function copyFileToStor($p_targetDir, $fileName){
$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $fileName;
Logging::log('copyFileToStor: moving file '.$audio_file);
$md5 = md5_file($audio_file);
$duplicate = StoredFile::RecallByMd5($md5);
if ($duplicate) {
@ -844,6 +844,7 @@ class StoredFile {
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
$r = @copy($audio_file, $audio_stor);
//$r = @unlink($audio_file);
}
public static function getFileCount()