cc-4301: Fixed bug where owner_id would be null whenever show is recorded.
This commit is contained in:
parent
583d3837be
commit
7f66bdbb66
|
@ -39,7 +39,8 @@ class PluploadController extends Zend_Controller_Action
|
|||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||
$filename = $this->_getParam('name');
|
||||
$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))
|
||||
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
|
||||
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
||||
$uid = Application_Model_User::getCurrentUser()->getId();
|
||||
$audio_stor = Application_Common_OsPath::join($stor, "organize",
|
||||
$fileName);
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if (is_null($user)) {
|
||||
$uid = Application_Model_User::getFirstAdminId();
|
||||
} else {
|
||||
$uid = $user->getId();
|
||||
}
|
||||
$id_file = "$audio_stor.identifier";
|
||||
if (file_put_contents($id_file,$uid) === false) {
|
||||
Logging::info("Could not write file to identify user: '$uid'");
|
||||
|
|
|
@ -241,6 +241,15 @@ class Application_Model_User
|
|||
public static function getUsersOfType($type) {
|
||||
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)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
@ -342,7 +351,6 @@ class Application_Model_User
|
|||
public static function getCurrentUser()
|
||||
{
|
||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
if (is_null($userinfo)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue