Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
f84f611ab2
|
@ -39,7 +39,8 @@ class PluploadController extends Zend_Controller_Action
|
||||||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||||
$filename = $this->_getParam('name');
|
$filename = $this->_getParam('name');
|
||||||
$tempname = $this->_getParam('tempname');
|
$tempname = $this->_getParam('tempname');
|
||||||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $filename, $tempname);
|
$result = Application_Model_StoredFile::copyFileToStor($upload_dir,
|
||||||
|
$filename, $tempname);
|
||||||
if (!is_null($result))
|
if (!is_null($result))
|
||||||
die('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}');
|
die('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}');
|
||||||
|
|
||||||
|
|
|
@ -932,8 +932,14 @@ class Application_Model_StoredFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did all the checks for realz, now trying to copy
|
// Did all the checks for realz, now trying to copy
|
||||||
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
$audio_stor = Application_Common_OsPath::join($stor, "organize",
|
||||||
$uid = Application_Model_User::getCurrentUser()->getId();
|
$fileName);
|
||||||
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
if (is_null($user)) {
|
||||||
|
$uid = Application_Model_User::getFirstAdminId();
|
||||||
|
} else {
|
||||||
|
$uid = $user->getId();
|
||||||
|
}
|
||||||
$id_file = "$audio_stor.identifier";
|
$id_file = "$audio_stor.identifier";
|
||||||
if (file_put_contents($id_file,$uid) === false) {
|
if (file_put_contents($id_file,$uid) === false) {
|
||||||
Logging::info("Could not write file to identify user: '$uid'");
|
Logging::info("Could not write file to identify user: '$uid'");
|
||||||
|
|
|
@ -241,6 +241,15 @@ class Application_Model_User
|
||||||
public static function getUsersOfType($type) {
|
public static function getUsersOfType($type) {
|
||||||
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
||||||
}
|
}
|
||||||
|
public static function getFirstAdminId() {
|
||||||
|
$admins = Application_Model_User::getUsersOfType('A');
|
||||||
|
if (count($admins) > 0) { // found admin => pick first one
|
||||||
|
return $admins[0]->getDbId();
|
||||||
|
} else {
|
||||||
|
Logging::warn("Warning. no admins found in database");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
public static function getUsers(array $type, $search=null)
|
public static function getUsers(array $type, $search=null)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -342,7 +351,6 @@ class Application_Model_User
|
||||||
public static function getCurrentUser()
|
public static function getCurrentUser()
|
||||||
{
|
{
|
||||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
if (is_null($userinfo)) {
|
if (is_null($userinfo)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue