17 include_once (
"VAULT/Class.VaultFile.php");
18 include_once (
"VAULT/Class.VaultEngine.php");
19 include_once (
"VAULT/Class.VaultDiskStorage.php");
23 static $FREEDOM_VAULT =
false;;
24 if (!$FREEDOM_VAULT) {
25 include_once (
"VAULT/Class.VaultFile.php");
29 return $FREEDOM_VAULT;
38 if ($urlindex ==
"") {
40 if ($au !=
"") $urlindex =
getParam(
"CORE_URLINDEX");
43 if ($scheme ==
"") $urlindex =
'/freedom/';
44 else $urlindex =
getParam(
"CORE_ABSURL");
47 $token = $action->user->getUserToken(3600 * 24,
true, $context);
48 if (strstr($urlindex,
'?')) $beg =
'&';
50 $openurl = $urlindex . $beg .
"authtype=open&privateid=$token";
66 if (($vidin > 0) && ($vidout > 0)) {
68 if ($tea !=
"yes" || !\Dcp\Autoloader::classExists(
'Dcp\TransformationEngine\Client'))
return '';
70 include_once (
"FDL/Class.TaskRequest.php");
73 if (!$of->isAffected())
return "no file $vidin";
75 $ofout->teng_state = \Dcp\TransformationEngine\Client::status_waiting;
79 $callback = $urlindex .
"&sole=Y&app=FDL&action=INSERTFILE&engine=$engine&vidin=$vidin&vidout=$vidout&isimage=$isimage&docid=$docid";
80 $ot = new \Dcp\TransformationEngine\Client(
getParam(
"TE_HOST") ,
getParam(
"TE_PORT"));
84 $tr->tid =
$info[
"tid"];
86 $tr->status =
$info[
"status"];
87 $tr->comment =
$info[
"comment"];
88 $tr->uid = $action->user->id;
89 $tr->uname = $action->user->firstname .
" " . $action->user->lastname;
97 $vf->Retrieve($vidout, $infofile);
100 $vf->rename($vidout, _(
"impossible conversion") .
".txt");
101 if (
$info[
"status"])
$vf->storage->teng_state =
$info[
"status"];
102 else $vf->storage->teng_state = \Dcp\TransformationEngine\Client::status_inprogress;
103 $vf->storage->modify();
118 $FREEDOM_VAULT->Show($idfile,
$info, $teng_name);
130 $FREEDOM_VAULT->Show($idfile,
$info, $teng_name);
135 $check = base_convert($mdate - $m2009, 10, 34);
136 $pos = strrpos(
$info->name,
'.');
139 $bpath = substr(
$info->name, 0, $pos);
140 $extpath = substr(
$info->name, $pos);
141 $othername = sprintf(
"%s{%s-%s}%s", $bpath,
$check,
$info->id_file, $extpath);
158 if ((
$err ==
"") && ($ftitle !=
"")) $FREEDOM_VAULT->rename($vid, $ftitle);
171 if ($v->isAffected()) {
172 $path = $v->getPath();
173 if (file_exists(
$path))
return file_get_contents(
$path);
183 if ((
$docid > 0) && ($vid > 0)) {
186 if ($tea !=
"yes" || !\Dcp\Autoloader::classExists(
'Dcp\TransformationEngine\Client'))
return '';
188 if ($tea !=
"yes")
return '';
191 include_once (
"FDL/Class.TaskRequest.php");
195 $callback = $urlindex .
"&sole=Y&app=FDL&action=SETTXTFILE&docid=$docid&attrid=" . $attrid .
"&index=$index";
196 $ot = new \Dcp\TransformationEngine\Client(
getParam(
"TE_HOST") ,
getParam(
"TE_PORT"));
200 $tr->tid =
$info[
"tid"];
202 $tr->status =
$info[
"status"];
203 $tr->comment =
$info[
"comment"];
204 $tr->uid = $action->user->id;
205 $tr->uname = $action->user->firstname .
" " . $action->user->lastname;
223 if (file_exists($infile) && ($engine !=
"")) {
225 if ($tea !=
"yes" || !\Dcp\Autoloader::classExists(
'Dcp\TransformationEngine\Client'))
return _(
"TE not activated");
227 $ot = new \Dcp\TransformationEngine\Client(
getParam(
"TE_HOST") ,
getParam(
"TE_PORT"));
229 $err = $ot->sendTransformation($engine, $vid, $infile, $callback,
$info);
231 include_once (
"FDL/Class.TaskRequest.php");
234 $tr->tid =
$info[
"tid"];
236 $tr->status =
$info[
"status"];
237 $tr->comment =
$info[
"comment"];
238 $tr->uid = $action->user->id;
239 $tr->uname = $action->user->firstname .
" " . $action->user->lastname;
245 if (
$tid == 0)
$err = _(
"no task identificator");
255 switch (
$info[
"status"]) {
257 $statusmsg = _(
"File:: Processing");
261 $statusmsg = _(
"File:: Waiting");
265 $statusmsg = _(
"File:: converted");
269 $statusmsg = _(
"File:: failed");
273 $statusmsg =
$info[
"status"];
280 include_once (
"FDL/insertfile.php");
285 $err = sprintf(_(
"file %s not found") , $infile);
convertFile($infile, $engine, $outfile, &$info)
vault_uniqname($idfile, $teng_name="")
vault_properties($idfile, $teng_name="")
iso8601DateToUnixTs($isodate, $utc=false)
sendTextTransformation($dbaccess, $docid, $attrid, $index, $vid)
getOpenTeUrl($context=array())
getParam($name, $def="")
must be in core or global type
vault_generate($dbaccess, $engine, $vidin, $vidout, $isimage=false, $docid= '')
vault_store($filename, &$vid, $ftitle="")
stringDateToUnixTs($isodate, $utc=false)
setMaxExecutionTimeTo($limit)
getTEFile($tid, $filename, &$info)
if($file) if($subject==""&&$file) if($subject=="") $err
vault_get_content($idfile)