mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Enhancend some quarantine feature, duplicate image detection
This commit is contained in:
@@ -10,7 +10,7 @@ class lazaretFile
|
|||||||
if(!$conn)
|
if(!$conn)
|
||||||
throw new Exception ('Impossible detablir la connection a la base de donnee');
|
throw new Exception ('Impossible detablir la connection a la base de donnee');
|
||||||
|
|
||||||
$sql = 'SELECT filename, filepath, base_id, uuid, status, created_on, usr_id FROM lazaret WHERE id="'.$conn->escape_string($lazaret_id).'"';
|
$sql = 'SELECT filename, filepath, base_id, uuid, sha256, status, created_on, usr_id FROM lazaret WHERE id="'.$conn->escape_string($lazaret_id).'"';
|
||||||
|
|
||||||
$id = false;
|
$id = false;
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ class lazaretFile
|
|||||||
$this->status = $row['status'];
|
$this->status = $row['status'];
|
||||||
$this->base_id = $row['base_id'];
|
$this->base_id = $row['base_id'];
|
||||||
$this->uuid = $row['uuid'];
|
$this->uuid = $row['uuid'];
|
||||||
|
$this->sha256 = $row['sha256'];
|
||||||
$this->created_on = new DateTime($row['created_on']);
|
$this->created_on = new DateTime($row['created_on']);
|
||||||
$this->usr_id = $row['usr_id'];
|
$this->usr_id = $row['usr_id'];
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,7 @@ class lazaretFile
|
|||||||
|
|
||||||
$file = GV_RootPath.'tmp/lazaret/'.$this->filepath;
|
$file = GV_RootPath.'tmp/lazaret/'.$this->filepath;
|
||||||
|
|
||||||
if(($record_id = p4file::archiveFile($file, $this->base_id, false, $this->filename)) === false)
|
if(($record_id = p4file::archiveFile($file, $this->base_id, false, $this->filename, $this->sha256)) === false)
|
||||||
throw new Exception (_('Impossible dajouter le fichier a la base'));
|
throw new Exception (_('Impossible dajouter le fichier a la base'));
|
||||||
|
|
||||||
$sbas_id = phrasea::sbasFromBas($this->base_id);
|
$sbas_id = phrasea::sbasFromBas($this->base_id);
|
||||||
@@ -108,7 +109,7 @@ class lazaretFile
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function move_uploaded_to_lazaret($tmp_name, $base_id, $filename, $uuid, $errors='', $status=false)
|
public static function move_uploaded_to_lazaret($tmp_name, $base_id, $filename, $uuid, $sha256, $errors='', $status=false)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$system = p4utils::getSystem();
|
$system = p4utils::getSystem();
|
||||||
@@ -140,9 +141,10 @@ class lazaretFile
|
|||||||
rename($tmp_name, $pathfile);
|
rename($tmp_name, $pathfile);
|
||||||
p4::chmod($pathfile);
|
p4::chmod($pathfile);
|
||||||
|
|
||||||
$sql = 'INSERT INTO lazaret (id, filename, filepath, base_id, uuid, errors, status, created_on, usr_id)
|
$sql = 'INSERT INTO lazaret (id, filename, filepath, base_id, uuid, sha256, errors, status, created_on, usr_id)
|
||||||
VALUES (null, "'.$conn->escape_string($filename).'", "'.$conn->escape_string($tmp_filename).'"
|
VALUES (null, "'.$conn->escape_string($filename).'", "'.$conn->escape_string($tmp_filename).'"
|
||||||
, "'.$conn->escape_string($base_id).'", "'.$conn->escape_string($uuid).'", "'.$conn->escape_string($errors).'"
|
, "'.$conn->escape_string($base_id).'", "'.$conn->escape_string($uuid).'", "'.$conn->escape_string($sha256).'",
|
||||||
|
"'.$conn->escape_string($errors).'"
|
||||||
, '.$conn->escape_string('0b'.$status).', NOW(), '.($usr_id ? '"'.$conn->escape_string($usr_id).'"' : 'NULL').')';
|
, '.$conn->escape_string('0b'.$status).', NOW(), '.($usr_id ? '"'.$conn->escape_string($usr_id).'"' : 'NULL').')';
|
||||||
|
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@ class p4file
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function archiveFile($filename,$base_id,$delete=true,$name=false)
|
public static function archiveFile($filename,$base_id,$delete=true,$name=false,$sha256=false)
|
||||||
{
|
{
|
||||||
require_once GV_RootPath.'lib/index_utils2.php';
|
require_once GV_RootPath.'lib/index_utils2.php';
|
||||||
|
|
||||||
@@ -91,7 +91,8 @@ class p4file
|
|||||||
);
|
);
|
||||||
|
|
||||||
$go = false;
|
$go = false;
|
||||||
$sql = "SELECT base_id FROM basusr WHERE base_id='".$conn->escape_string($base_id)."' AND usr_id='".$conn->escape_string($session->usr_id)."' AND canaddrecord='1'";
|
$sql = "SELECT base_id FROM basusr WHERE base_id='".$conn->escape_string($base_id)."'
|
||||||
|
AND usr_id='".$conn->escape_string($session->usr_id)."' AND canaddrecord='1'";
|
||||||
if($rs = $conn->query($sql))
|
if($rs = $conn->query($sql))
|
||||||
{
|
{
|
||||||
if($row = $conn->fetch_assoc($rs))
|
if($row = $conn->fetch_assoc($rs))
|
||||||
@@ -110,7 +111,8 @@ class p4file
|
|||||||
$server_coll_id = $sbas_id = $server_coll_id = $xmlprefs = false;
|
$server_coll_id = $sbas_id = $server_coll_id = $xmlprefs = false;
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT server_coll_id, bas.sbas_id FROM (bas INNER JOIN sbas ON sbas.sbas_id=bas.sbas_id AND base_id=" . $conn->escape_string($base_id) . ")";
|
$sql = "SELECT server_coll_id, bas.sbas_id
|
||||||
|
FROM (bas INNER JOIN sbas ON sbas.sbas_id=bas.sbas_id AND base_id=" . $conn->escape_string($base_id) . ")";
|
||||||
|
|
||||||
if($rs = $conn->query($sql))
|
if($rs = $conn->query($sql))
|
||||||
{
|
{
|
||||||
@@ -129,7 +131,8 @@ class p4file
|
|||||||
echo "\n Erreur connection";
|
echo "\n Erreur connection";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$sql = "SELECT value AS baseprefs, prefs AS collprefs FROM pref p, coll c WHERE prop='structure' AND coll_id='" . $connbas->escape_string($server_coll_id)."'";
|
$sql = "SELECT value AS baseprefs, prefs AS collprefs FROM pref p, coll c
|
||||||
|
WHERE prop='structure' AND coll_id='" . $connbas->escape_string($server_coll_id)."'";
|
||||||
if($rs = $connbas->query($sql))
|
if($rs = $connbas->query($sql))
|
||||||
{
|
{
|
||||||
$xmlprefs = $connbas->fetch_assoc($rs);
|
$xmlprefs = $connbas->fetch_assoc($rs);
|
||||||
@@ -188,13 +191,17 @@ class p4file
|
|||||||
$status = (string)($collprefs->status);
|
$status = (string)($collprefs->status);
|
||||||
|
|
||||||
$file_uuid = new uuid($filename);
|
$file_uuid = new uuid($filename);
|
||||||
$uuid = $file_uuid->check_uuid();
|
$uuid = $file_uuid->read_uuid();
|
||||||
|
|
||||||
|
if(!$sha256)
|
||||||
|
{
|
||||||
|
$sha256 = hash_file('sha256',$filename);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = 'INSERT INTO record (coll_id, record_id, status, jeton, moddate, credate, xml, type, sha256, uuid)
|
$sql = 'INSERT INTO record (coll_id, record_id, status, jeton, moddate, credate, xml, type, sha256, uuid)
|
||||||
VALUES ("'.$connbas->escape_string($server_coll_id) . '", "' .$connbas->escape_string($record_id) . '",
|
VALUES ("'.$connbas->escape_string($server_coll_id) . '", "' .$connbas->escape_string($record_id) . '",
|
||||||
(' . $status . ' | 0x0F), 0x0, NOW(), NOW(), \'' . $connbas->escape_string($xml["xml"]->saveXML()) . '\',
|
(' . $status . ' | 0x0F), 0x0, NOW(), NOW(), \'' . $connbas->escape_string($xml["xml"]->saveXML()) . '\',
|
||||||
\''.$connbas->escape_string($tfile["type"]).'\', \''.$connbas->escape_string(hash_file('sha256',$filename)).'\',
|
\''.$connbas->escape_string($tfile["type"]).'\', \''.$connbas->escape_string($sha256).'\',
|
||||||
"'.$connbas->escape_string($uuid).'")';
|
"'.$connbas->escape_string($uuid).'")';
|
||||||
|
|
||||||
if(!$connbas->query($sql))
|
if(!$connbas->query($sql))
|
||||||
|
@@ -352,7 +352,7 @@ class p4publi
|
|||||||
|
|
||||||
|
|
||||||
if(count($publi) == 0 && count($unpubli) == 0)
|
if(count($publi) == 0 && count($unpubli) == 0)
|
||||||
p4string::jsonencode(array('status'=>'1'));
|
return p4string::jsonencode(array('status'=>'1'));
|
||||||
|
|
||||||
if($isOk)
|
if($isOk)
|
||||||
{
|
{
|
||||||
@@ -392,6 +392,7 @@ class p4publi
|
|||||||
|
|
||||||
public static function unpublish($ssel_id, $pub_id)
|
public static function unpublish($ssel_id, $pub_id)
|
||||||
{
|
{
|
||||||
|
$session = session::getInstance();
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if($pub_id == 'default')
|
if($pub_id == 'default')
|
||||||
@@ -401,8 +402,12 @@ class p4publi
|
|||||||
|
|
||||||
|
|
||||||
if($conn->query($sql))
|
if($conn->query($sql))
|
||||||
$ret = true;
|
{
|
||||||
|
$cache_basket = cache_basket::getInstance();
|
||||||
|
$cache_basket->delete($session->usr_id, $ssel_id);
|
||||||
|
|
||||||
|
$ret = true;
|
||||||
|
}
|
||||||
$sql = 'SELECT b.*, c.base_id, c.record_id FROM sselcont c, bas b WHERE c.ssel_id = "'.$conn->escape_string($ssel_id).'" AND c.base_id = b.base_id ORDER BY sbas_id ASC';
|
$sql = 'SELECT b.*, c.base_id, c.record_id FROM sselcont c, bas b WHERE c.ssel_id = "'.$conn->escape_string($ssel_id).'" AND c.base_id = b.base_id ORDER BY sbas_id ASC';
|
||||||
|
|
||||||
if($rs = $conn->query($sql))
|
if($rs = $conn->query($sql))
|
||||||
@@ -478,8 +483,12 @@ class p4publi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($conn->query($sql))
|
if($conn->query($sql))
|
||||||
$ret = '1';
|
{
|
||||||
|
$cache_basket = cache_basket::getInstance();
|
||||||
|
$cache_basket->delete($session->usr_id, $ssel_id);
|
||||||
|
|
||||||
|
$ret = '1';
|
||||||
|
}
|
||||||
$sql = 'SELECT b.*, c.base_id, c.record_id FROM sselcont c, bas b WHERE c.ssel_id = "'.$conn->escape_string($ssel_id).'" AND c.base_id = b.base_id ORDER BY sbas_id ASC';
|
$sql = 'SELECT b.*, c.base_id, c.record_id FROM sselcont c, bas b WHERE c.ssel_id = "'.$conn->escape_string($ssel_id).'" AND c.base_id = b.base_id ORDER BY sbas_id ASC';
|
||||||
|
|
||||||
if($rs = $conn->query($sql))
|
if($rs = $conn->query($sql))
|
||||||
|
@@ -1761,16 +1761,38 @@ class task_archive extends phraseatask
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lazaret = false;
|
$lazaret = false;
|
||||||
$uuid = false;
|
$uuid = $sha256 = false;
|
||||||
if($grp_rid == 0 && $captionFileName == NULL)
|
if($grp_rid == 0 && $captionFileName == NULL)
|
||||||
{
|
{
|
||||||
$this->log(sprintf(("Checkin for lazaret")));
|
$this->log(sprintf(("Checkin for lazaret")));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$file_uuid = new uuid($path.'/'.$file);
|
|
||||||
$uuid = $file_uuid->check_uuid();
|
|
||||||
$base_id = (int)($this->sxTaskSettings->base_id);
|
$base_id = (int)($this->sxTaskSettings->base_id);
|
||||||
$sbas_id = phrasea::sbasFromBas($base_id);
|
$sbas_id = phrasea::sbasFromBas($base_id);
|
||||||
|
|
||||||
|
$sha256 = hash_file('sha256',$path.'/'.$file);
|
||||||
|
|
||||||
|
$uuid = false;
|
||||||
|
$file_uuid = new uuid($path.'/'.$file);
|
||||||
|
if(!$file_uuid->has_uuid())
|
||||||
|
{
|
||||||
|
$connbas = connection::getInstance($sbas_id);
|
||||||
|
$sql = 'SELECT uuid FROM record WHERE sha256 = "'.$connbas->escape_string($sha256).'"';
|
||||||
|
if($rs = $connbas->query($sql))
|
||||||
|
{
|
||||||
|
if($row = $connbas->fetch_assoc($rs))
|
||||||
|
{
|
||||||
|
if(uuid::uuid_is_valid($row['uuid']))
|
||||||
|
$uuid = $row['uuid'];
|
||||||
|
}
|
||||||
|
$connbas->free_result($rs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$uuid = $file_uuid->write_uuid($uuid);
|
||||||
|
|
||||||
$error_file = p4file::check_file_error($path.'/'.$file, $sbas_id);
|
$error_file = p4file::check_file_error($path.'/'.$file, $sbas_id);
|
||||||
$status = status::or_operation($stat0, $stat1);
|
$status = status::or_operation($stat0, $stat1);
|
||||||
|
|
||||||
@@ -1780,7 +1802,7 @@ class task_archive extends phraseatask
|
|||||||
if(($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
if(($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
||||||
{
|
{
|
||||||
$this->log(sprintf(("Trying to move to lazaret")));
|
$this->log(sprintf(("Trying to move to lazaret")));
|
||||||
if(lazaretFile::move_uploaded_to_lazaret($path.'/'.$file, $base_id, $file, $uuid, implode("\n",$error_file), $status))
|
if(lazaretFile::move_uploaded_to_lazaret($path.'/'.$file, $base_id, $file, $uuid, $sha256, implode("\n",$error_file), $status))
|
||||||
{
|
{
|
||||||
$this->log("File %s moved to lazaret");
|
$this->log("File %s moved to lazaret");
|
||||||
$lazaret = true;
|
$lazaret = true;
|
||||||
@@ -1807,7 +1829,10 @@ class task_archive extends phraseatask
|
|||||||
// ... flag the record as 'to reindex' (status-bits 0 and 1 to 0) AND UNLOCK IT (status-bit 2 to 1)
|
// ... flag the record as 'to reindex' (status-bits 0 and 1 to 0) AND UNLOCK IT (status-bit 2 to 1)
|
||||||
// ... and flag it for subdef creation (jeton bit 0 to 1)
|
// ... and flag it for subdef creation (jeton bit 0 to 1)
|
||||||
$fl = 'coll_id, record_id, parent_record_id, status, jeton, moddate, credate, xml, type, sha256, uuid';
|
$fl = 'coll_id, record_id, parent_record_id, status, jeton, moddate, credate, xml, type, sha256, uuid';
|
||||||
$vl = $cid . ', ' .$rid . ', ' . '0' . ', (((' . $stat0 . ' | ' . $stat1 . ' | 0x' . $hexstat . ') & ~0x0F) | 0x0C), '.JETON_READ_META_DOC_MAKE_SUBDEF.', NOW(), NOW(), \'' . $this->connbas->escape_string($meta['xml']->saveXML()) . '\', \'' . $this->connbas->escape_string($propfile['type']) . '\', \''.hash_file('sha256',$propfile["hotfolderfile"]).'\', "'.$this->connbas->escape_string($uuid).'"' ;
|
$vl = $cid . ', ' .$rid . ', ' . '0' . ', (((' . $stat0 . ' | ' . $stat1 . ' | 0x' . $hexstat . ') & ~0x0F) | 0x0C),
|
||||||
|
'.JETON_READ_META_DOC_MAKE_SUBDEF.', NOW(), NOW(), \'' . $this->connbas->escape_string($meta['xml']->saveXML()) . '\',
|
||||||
|
\'' . $this->connbas->escape_string($propfile['type']) . '\', \''.$sha256.'\',
|
||||||
|
"'.$this->connbas->escape_string($uuid).'"' ;
|
||||||
$sql = 'INSERT INTO record ('.$fl.') VALUES ('.$vl.')';
|
$sql = 'INSERT INTO record ('.$fl.') VALUES ('.$vl.')';
|
||||||
|
|
||||||
//printf("sql:%s\n", $sql);
|
//printf("sql:%s\n", $sql);
|
||||||
|
@@ -258,13 +258,35 @@ class task_batchupload extends phraseatask
|
|||||||
|
|
||||||
$stat0 = $stat1 = '0';
|
$stat0 = $stat1 = '0';
|
||||||
|
|
||||||
|
|
||||||
|
$sha256 = hash_file('sha256',$path.'/'.$file);
|
||||||
|
|
||||||
|
$uuid = false;
|
||||||
$file_uuid = new uuid($path.'/'.$file);
|
$file_uuid = new uuid($path.'/'.$file);
|
||||||
$uuid = $file_uuid->check_uuid();
|
if(!$file_uuid->has_uuid())
|
||||||
|
{
|
||||||
|
$connbas = connection::getInstance($sbas_id);
|
||||||
|
$sql = 'SELECT uuid FROM record WHERE sha256 = "'.$connbas->escape_string($sha256).'"';
|
||||||
|
if($rs = $connbas->query($sql))
|
||||||
|
{
|
||||||
|
if($row = $connbas->fetch_assoc($rs))
|
||||||
|
{
|
||||||
|
if(uuid::uuid_is_valid($row['uuid']))
|
||||||
|
$uuid = $row['uuid'];
|
||||||
|
}
|
||||||
|
$connbas->free_result($rs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$uuid = $file_uuid->write_uuid($uuid);
|
||||||
|
|
||||||
// ... flag the record as 'to reindex' (status-bits 0 and 1 to 0) AND UNLOCK IT (status-bit 2 to 1)
|
// ... flag the record as 'to reindex' (status-bits 0 and 1 to 0) AND UNLOCK IT (status-bit 2 to 1)
|
||||||
// ... and flag it for subdef creation (jeton bit 0 to 1)
|
// ... and flag it for subdef creation (jeton bit 0 to 1)
|
||||||
$fl = 'coll_id, record_id, parent_record_id, status, jeton, moddate, credate, xml, type, sha256, uuid';
|
$fl = 'coll_id, record_id, parent_record_id, status, jeton, moddate, credate, xml, type, sha256, uuid';
|
||||||
$vl = $cid . ', ' .$rid . ', ' . '0' . ', (((' . $stat0 . ' | ' . $stat1 . ') & ~0x0F) | 0x0C), '.JETON_READ_META_DOC_MAKE_SUBDEF.', NOW(), NOW(), \'' . $connbas->escape_string($meta['xml']->saveXML()) . '\', \'' . $connbas->escape_string($propfile['type']) . '\', \''.hash_file('sha256',$propfile["hotfolderfile"]).'\', "'.$connbas->escape_string($uuid).'"';
|
$vl = $cid . ', ' .$rid . ', ' . '0' . ', (((' . $stat0 . ' | ' . $stat1 . ') & ~0x0F) | 0x0C),
|
||||||
|
'.JETON_READ_META_DOC_MAKE_SUBDEF.', NOW(), NOW(), \'' . $connbas->escape_string($meta['xml']->saveXML()) . '\',
|
||||||
|
\'' . $connbas->escape_string($propfile['type']) . '\', \''.$sha256.'\',
|
||||||
|
"'.$connbas->escape_string($uuid).'"';
|
||||||
$sql = 'INSERT INTO record ('.$fl.') VALUES ('.$vl.')';
|
$sql = 'INSERT INTO record ('.$fl.') VALUES ('.$vl.')';
|
||||||
|
|
||||||
if($connbas->query($sql))
|
if($connbas->query($sql))
|
||||||
|
@@ -103,7 +103,7 @@ class task_upgradetov31 extends phraseatask
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$uuid_file = new uuid($pathfile);
|
$uuid_file = new uuid($pathfile);
|
||||||
$uuid = $uuid_file->check_uuid();
|
$uuid = $uuid_file->write_uuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE record SET
|
$sql = 'UPDATE record SET
|
||||||
|
@@ -13,7 +13,13 @@ class uuid
|
|||||||
$this->filepath = $filepath;
|
$this->filepath = $filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check_uuid($write = true)
|
public function has_uuid()
|
||||||
|
{
|
||||||
|
$this->read_uuid();
|
||||||
|
return !!$this->uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function read_uuid()
|
||||||
{
|
{
|
||||||
require_once GV_RootPath.'lib/index_utils2.php';
|
require_once GV_RootPath.'lib/index_utils2.php';
|
||||||
$cmd = NULL;
|
$cmd = NULL;
|
||||||
@@ -47,13 +53,25 @@ class uuid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $this->uuid;
|
||||||
|
}
|
||||||
|
|
||||||
if($this->uuid === false)
|
public function write_uuid($uuid = false)
|
||||||
|
{
|
||||||
|
if($uuid && self::uuid_is_valid($uuid))
|
||||||
|
{
|
||||||
|
$this->uuid = $uuid;
|
||||||
|
}
|
||||||
|
elseif((($uuid = $this->read_uuid()) !== false) && self::uuid_is_valid($uuid))
|
||||||
|
{
|
||||||
|
$this->uuid = $uuid;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->uuid = self::generate_uuid();
|
$this->uuid = self::generate_uuid();
|
||||||
}
|
}
|
||||||
$this->write();
|
|
||||||
|
|
||||||
|
$this->write();
|
||||||
return $this->uuid;
|
return $this->uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,6 +99,8 @@ function getPreviewWindow($usr,$ses,$lng,$env,$pos,$contId,$roll)
|
|||||||
break;
|
break;
|
||||||
case "BASK":
|
case "BASK":
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
$basket = basket::getInstance($contId);
|
$basket = basket::getInstance($contId);
|
||||||
|
|
||||||
$posChu = 0;
|
$posChu = 0;
|
||||||
@@ -147,6 +149,11 @@ function getPreviewWindow($usr,$ses,$lng,$env,$pos,$contId,$roll)
|
|||||||
$title = $name.' ('.$posChu.'/'.$i.')';
|
$title = $name.' ('.$posChu.'/'.$i.')';
|
||||||
else
|
else
|
||||||
$title = $name.' ('.$posChu.'/'.$i.') ';
|
$title = $name.' ('.$posChu.'/'.$i.') ';
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -1294,6 +1294,15 @@
|
|||||||
<default></default>
|
<default></default>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
</field>
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>sha256</name>
|
||||||
|
<type>char(64)</type>
|
||||||
|
<null>YES</null>
|
||||||
|
<extra></extra>
|
||||||
|
<default></default>
|
||||||
|
<comment></comment>
|
||||||
|
<collation>ascii_bin</collation>
|
||||||
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>errors</name>
|
<name>errors</name>
|
||||||
<type>text</type>
|
<type>text</type>
|
||||||
|
@@ -621,7 +621,8 @@ function get_fields_from_jpg(&$baseprefs, &$propfile, &$tfields)
|
|||||||
|
|
||||||
$x = @$xptrdf->query('/rdf:RDF/rdf:Description/XMP-exif:ImageUniqueID');
|
$x = @$xptrdf->query('/rdf:RDF/rdf:Description/XMP-exif:ImageUniqueID');
|
||||||
|
|
||||||
if($x->length>0)
|
var_dump($x);
|
||||||
|
if($x && $x->length>0)
|
||||||
{
|
{
|
||||||
$x = $x->item(0);
|
$x = $x->item(0);
|
||||||
|
|
||||||
|
@@ -1011,7 +1011,7 @@ function saveiList($usr,$ses,$lng,$name,$token,$filters)
|
|||||||
}
|
}
|
||||||
$ilists->$label = $filters;
|
$ilists->$label = $filters;
|
||||||
|
|
||||||
$sql = 'UPDATE usr SET push_list="'.$conn->escape_string(p4string::jsonencode($ilists)).'"';
|
$sql = 'UPDATE usr SET push_list="'.$conn->escape_string(p4string::jsonencode($ilists)).'" WHERE usr_id="'.$conn->escape_string($usr).'"';
|
||||||
if($conn->query($sql))
|
if($conn->query($sql))
|
||||||
{
|
{
|
||||||
$ret = loadILists($usr,$ses,$lng,$label);
|
$ret = loadILists($usr,$ses,$lng,$label);
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
<?php
|
<?php
|
||||||
define('GV_version','3.1.5');
|
define('GV_version','3.1.6');
|
||||||
|
@@ -5,7 +5,7 @@ require_once(GV_RootPath.'lib/inscript.api.php');
|
|||||||
$session = session::getInstance();
|
$session = session::getInstance();
|
||||||
|
|
||||||
$request = httpRequest::getInstance();
|
$request = httpRequest::getInstance();
|
||||||
$parm = $request->get_post_datas('code');
|
$parm = $request->get_parms('code', 'token');
|
||||||
|
|
||||||
$lng = isset($session->locale)?$session->locale:GV_default_lng;
|
$lng = isset($session->locale)?$session->locale:GV_default_lng;
|
||||||
|
|
||||||
|
@@ -51,20 +51,6 @@ if( !isset($_FILES["newHD"]) || $_FILES["newHD"]["tmp_name"]=="" || $_FILES["ne
|
|||||||
die('</body></html>');
|
die('</body></html>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_uuid = new uuid($_FILES["newHD"]["tmp_name"]);
|
|
||||||
$uuid = $file_uuid->check_uuid();
|
|
||||||
|
|
||||||
if($uuid === false || $file_uuid->is_new_in_base(phrasea::sbasFromBas($parm['bid'])))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!lazaretFile::move_uploaded_to_lazaret($_FILES['newHD']["tmp_name"], $parm['bid'], $_FILES['newHD']["name"], $uuid))
|
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
p4file::substitute($parm['bid'], $parm['rid'], $_FILES["newHD"]["tmp_name"], $_FILES["newHD"]["name"], ($parm['ccfilename'] == '1'));
|
p4file::substitute($parm['bid'], $parm['rid'], $_FILES["newHD"]["tmp_name"], $_FILES["newHD"]["name"], ($parm['ccfilename'] == '1'));
|
||||||
}
|
}
|
||||||
|
@@ -115,14 +115,32 @@ if($sbas_id !== false && is_array($parm['status']))
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
$sha256 = hash_file('sha256',$newname);
|
||||||
|
|
||||||
|
$uuid = false;
|
||||||
$file_uuid = new uuid($newname);
|
$file_uuid = new uuid($newname);
|
||||||
$uuid = $file_uuid->check_uuid();
|
if(!$file_uuid->has_uuid())
|
||||||
|
{
|
||||||
|
$connbas = connection::getInstance($sbas_id);
|
||||||
|
$sql = 'SELECT uuid FROM record WHERE sha256 = "'.$connbas->escape_string($sha256).'"';
|
||||||
|
if($rs = $connbas->query($sql))
|
||||||
|
{
|
||||||
|
if($row = $connbas->fetch_assoc($rs))
|
||||||
|
{
|
||||||
|
if(uuid::uuid_is_valid($row['uuid']))
|
||||||
|
$uuid = $row['uuid'];
|
||||||
|
}
|
||||||
|
$connbas->free_result($rs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$uuid = $file_uuid->write_uuid($uuid);
|
||||||
|
|
||||||
$error_file = p4file::check_file_error($_FILES['Filedata']["tmp_name"], $sbas_id);
|
$error_file = p4file::check_file_error($_FILES['Filedata']["tmp_name"], $sbas_id);
|
||||||
$status_2 = status::and_operation($mask_oui,$mask_non);
|
$status_2 = status::and_operation($mask_oui,$mask_non);
|
||||||
if(($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
if(($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
||||||
{
|
{
|
||||||
if(!lazaretFile::move_uploaded_to_lazaret($_FILES['Filedata']["tmp_name"], $base_id, $_FILES['Filedata']["name"], $uuid, implode("\n",$error_file), $status_2))
|
if(!lazaretFile::move_uploaded_to_lazaret($_FILES['Filedata']["tmp_name"], $base_id, $_FILES['Filedata']["name"], $uuid, $sha256, implode("\n",$error_file), $status_2))
|
||||||
{
|
{
|
||||||
if(UPLOADER == 'FLASH')
|
if(UPLOADER == 'FLASH')
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
@@ -143,7 +161,7 @@ catch (Exception $e)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(($record_id = p4file::archiveFile($_FILES['Filedata']['tmp_name'],$base_id,true,$_FILES['Filedata']["name"])) === false)
|
if(($record_id = p4file::archiveFile($_FILES['Filedata']['tmp_name'],$base_id,true,$_FILES['Filedata']["name"],$sha256)) === false)
|
||||||
{
|
{
|
||||||
unlink($_FILES['Filedata']['tmp_name']);
|
unlink($_FILES['Filedata']['tmp_name']);
|
||||||
if(UPLOADER == 'FLASH')
|
if(UPLOADER == 'FLASH')
|
||||||
|
Reference in New Issue
Block a user