Harmonize JSON API error messages
This commit is contained in:
+9
-9
@@ -45,16 +45,16 @@ class Media extends PhpObject {
|
||||
}
|
||||
|
||||
public function setComment($sComment) {
|
||||
$sError = '';
|
||||
$sLangId = '';
|
||||
$asData = array();
|
||||
if($this->iMediaId > 0) {
|
||||
$bResult = $this->oDb->updateRow(self::MEDIA_TABLE, $this->iMediaId, array('comment'=>$sComment));
|
||||
if(!$bResult) $sError = 'error.commit_db';
|
||||
if(!$bResult) $sLangId = 'error.commit_db';
|
||||
else $asData = $this->getInfo();
|
||||
}
|
||||
else $sError = 'media.no_id';
|
||||
else $sLangId = 'media.no_id';
|
||||
|
||||
return Livetrail::getResult(($sError==''), $sError, $asData);
|
||||
return Livetrail::getResult(($sLangId==''), $sLangId, $asData);
|
||||
}
|
||||
|
||||
public function getMediasInfo($oMediaIds=null) {
|
||||
@@ -95,14 +95,14 @@ class Media extends PhpObject {
|
||||
}
|
||||
|
||||
public function addMedia($sMediaName, $sMethod='upload') {
|
||||
$sError = '';
|
||||
$sLangId = '';
|
||||
$asParams = array();
|
||||
if(!$this->isProjectEditable() && $sMethod!='sync') {
|
||||
$sError = 'upload.mode_archived';
|
||||
$sLangId = 'upload.mode_archived';
|
||||
$asParams[] = $this->oProject->getProjectCodeName();
|
||||
}
|
||||
elseif($this->oDb->pingValue(self::MEDIA_TABLE, array('filename'=>$sMediaName)) && $sMethod!='sync') {
|
||||
$sError = 'upload.media.exists';
|
||||
$sLangId = 'upload.media.exists';
|
||||
$asParams[] = $sMediaName;
|
||||
}
|
||||
else {
|
||||
@@ -128,14 +128,14 @@ class Media extends PhpObject {
|
||||
if($sMethod=='sync') $iMediaId = $this->oDb->insertUpdateRow(self::MEDIA_TABLE, $asDbInfo, array('filename'));
|
||||
else $iMediaId = $this->oDb->insertRow(self::MEDIA_TABLE, $asDbInfo);
|
||||
|
||||
if(!$iMediaId) $sError = 'error.commit_db';
|
||||
if(!$iMediaId) $sLangId = 'error.commit_db';
|
||||
else {
|
||||
$this->setMediaId($iMediaId);
|
||||
$asParams = $this->getInfo(); //Creates thumbnail
|
||||
}
|
||||
}
|
||||
|
||||
return Livetrail::getResult(($sError==''), $sError, $asParams);
|
||||
return Livetrail::getResult(($sLangId==''), $sLangId, $asParams);
|
||||
}
|
||||
|
||||
private function getMediaInfoFromFile($sMediaName)
|
||||
|
||||
Reference in New Issue
Block a user