diff --git a/www/admin/publi_settings.php b/www/admin/publi_settings.php deleted file mode 100644 index 6de2988c65..0000000000 --- a/www/admin/publi_settings.php +++ /dev/null @@ -1,58 +0,0 @@ -get_session(); -$registry = $appbox->get_registry(); -?> - - - - - - - - - -
-
- ajouter une preset de publication automatique : - - -
- - - -
- - - - diff --git a/www/api/api_utils.php b/www/api/api_utils.php deleted file mode 100644 index 1dae97e9bb..0000000000 --- a/www/api/api_utils.php +++ /dev/null @@ -1,71 +0,0 @@ -get_parms('p', 'ses_id', 'usr_id', 'debug'); - -if (!$parm['debug']) -{ - phrasea::headers(200, true, 'text/xml', 'UTF-8', false); -} - - - -$sxParms = simplexml_load_string($parm['p']); - - - -$action = (string) $sxParms['action']; - -$dom = new DOMDocument('1.0', 'UTF-8'); -$dom->preserveWhiteSpace = false; -$dom->formatOutput = true; -$result = $dom->appendChild($dom->createElement('result')); -$result->setAttribute('action', $action); - -$status = 'OK'; - -$f = '_' . mb_strtolower($action) . '.php'; -if (file_exists($f)) -{ - include($f); -} -else -{ - err('bad action'); -} - -$result->appendChild($dom->createElement('status'))->appendChild($dom->createTextNode($status)); - -if ($parm['debug']) - echo('
' . htmlentities($dom->saveXML()) . '
'); -else - echo $dom->saveXML(); - -function err($msg) -{ - global $dom, $result, $status; - $result->appendChild($dom->createElement('err_msg'))->appendChild($dom->createTextNode($msg)); - $status = 'ERR'; -} diff --git a/www/api/login/_open_session.php b/www/api/login/_open_session.php deleted file mode 100644 index cbe0662a8d..0000000000 --- a/www/api/login/_open_session.php +++ /dev/null @@ -1,67 +0,0 @@ -login); -$pwd = (string) ($sxParms->pwd); - -try -{ - $auth = new Session_Authentication_Native($appbox, $login, $pwd); - $lm = $appbox->get_session()->signOn($auth); -} -catch (Exception $e) -{ - err($lm['error']); -} -$sessid = $appbox->get_session()->get_ses_id(); -$usrid = $appbox->get_session()->get_usr_id(); - - -$result->appendChild($dom->createElement('ses_id'))->appendChild($dom->createTextNode((string) $sessid)); -$result->appendChild($dom->createElement('usr_id'))->appendChild($dom->createTextNode((string) $usrid)); -$xbases = $result->appendChild($dom->createElement('bases')); -foreach ($appbox->get_databoxes() as $databox) -{ - $xbase = $xbases->appendChild($dom->createElement('base')); - $xbase->appendChild($dom->createElement('name'))->appendChild($dom->createTextNode($databox->get_viewname())); - $xcolls = $xbase->appendChild($dom->createElement('collections')); - foreach ($databox->get_collections() as $collection) - { - $xcoll = $xcolls->appendChild($dom->createElement('collection')); - $xcoll->setAttribute('id', (string) $collection->get_base_id()); - $xcoll->appendChild($dom->createElement('name'))->appendChild($dom->createTextNode($collection->get_name())); - } - $xstats = $xbase->appendChild($dom->createElement('statusbits')); - - $status = $databox->get_statusbits(); - - foreach ($status as $bit => $datas) - { - $xstat = $xstats->appendChild($dom->createElement('statusbit')); - $xstat->setAttribute('name', $datas['name']); - $xstat->setAttribute('index', $bit); - $xstat0 = $xstat->appendChild($dom->createElement('label_0'))->appendChild($dom->createTextNode($datas['labeloff'])); - $xstat1 = $xstat->appendChild($dom->createElement('label_1'))->appendChild($dom->createTextNode($datas['labelon'])); - } -} diff --git a/www/api/login/login.php b/www/api/login/login.php deleted file mode 100644 index b282e2d81a..0000000000 --- a/www/api/login/login.php +++ /dev/null @@ -1,35 +0,0 @@ -get_parms('p', 'ses_id', 'usr_id', 'debug'); -// $sxParms = simplexml_load_string($parm['p']); -// $dom : domdocument for result -// $result : documentElement for result - -$registry = registry::get_instance(); -require($registry->get('GV_RootPath') . 'www/api/api_utils.php'); -?> diff --git a/www/api/test.php b/www/api/test.php deleted file mode 100644 index 15343453b9..0000000000 --- a/www/api/test.php +++ /dev/null @@ -1,181 +0,0 @@ -get_session(); - - -//SPECIAL ZINO -ini_set('display_errors', 'off'); -ini_set('display_startup_errors', 'off'); -ini_set('log_errors', 'off'); -//SPECIAL ZINO -?> - - - - - - - - - -

identification

- -
- ./login/login.php - debug -
- - -
- - - -

preparer un batch

- -
- ./upload/upload.php -    - ses_id : -    - usr_id : -    - debug
- - -
- - - -

envoi par form

- -
- ./upload/upload.php -    - ses_id : -    - usr_id : -    - debug
- file :
- - -
- - - -

envoi simulé par curl (size, md5,... calculés)

- -
- ./test_upl.php -    - ses_id : -    - usr_id : -
- upload_batch_id : -    - index : -    - debug
-testfiles/' . $f . '
'); - $nf++; - } - closedir($o); - } -?> - -
- - - -

finir un batch

- -
- ./upload/upload.php -    - ses_id : -    - usr_id : -    - debug
- - -
- - - - - - diff --git a/www/api/test_upl.php b/www/api/test_upl.php deleted file mode 100644 index a1005339ad..0000000000 --- a/www/api/test_upl.php +++ /dev/null @@ -1,85 +0,0 @@ -get_session(); -?> - - -
-get_parms('ses_id', 'usr_id', 'upload_batch_id', 'index', 'file', 'debug'); - -$fil = $parm['file']; - -$filesize = filesize($fil); -$filename = basename($fil); -$k = file_get_contents($fil); -$md5 = md5($k, false); -// $crc32 = crc32($k); - -$url = dirname($_SERVER["HTTP_REFERER"]) . '/upload/upload.php'; - -$post = array( - 'debug' => $parm['debug'], - 'file' => '@' . realpath($fil), - 'ses_id' => $parm['ses_id'], - 'usr_id' => $parm['usr_id'], - 'p' => ' - - ' . htmlentities($parm['upload_batch_id']) . ' - ' . htmlentities($parm['index']) . ' - ' . htmlentities($filename) . ' - ' . htmlentities($filesize) . ' - ' . htmlentities($md5) . ' -' -); -?> - - post to :
-
-
-      curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
-      $response = curl_exec($ch);
-
-      curl_close($ch);
-?>
-      
-
- reponse :
- - - diff --git a/www/api/testfiles/IMG_1585.jpg b/www/api/testfiles/IMG_1585.jpg deleted file mode 100644 index b40035d709..0000000000 Binary files a/www/api/testfiles/IMG_1585.jpg and /dev/null differ diff --git a/www/api/testfiles/test.jpg b/www/api/testfiles/test.jpg deleted file mode 100644 index b2ebd1ce67..0000000000 Binary files a/www/api/testfiles/test.jpg and /dev/null differ diff --git a/www/api/upload/_end_upload.php b/www/api/upload/_end_upload.php deleted file mode 100644 index e21feac38f..0000000000 --- a/www/api/upload/_end_upload.php +++ /dev/null @@ -1,100 +0,0 @@ -upload_batch_id); - - -// ------------------------------------------------------------------- -// check cnx & session -// ------------------------------------------------------------------- - -try -{ - $conn = connection::getPDOConnection(); -} -catch (Exception $e) -{ - err('bad conn'); - - return; -} - -if (!$ses_id || !$usr_id || !$upload_batch_id) -{ - err('missing ses_id, usr_id or upload_batch_id'); - - return; -} - -// ------------------------------------------------------------------- -// check batch -// ------------------------------------------------------------------- - -$sql = 'SELECT * FROM uplbatch WHERE uplbatch_id = :upload_id'; -$stmt = $conn->prepare($sql); -$stmt->execute(array('upload_id' => $upload_batch_id)); -$nr = $stmt->rowCount(); -$stmt->closeCursor(); - -if ($nr == 0) -{ - err('bad upload_batch_id'); - - return; -} - -try -{ - $sql = 'UPDATE uplbatch SET complete="1" WHERE uplbatch_id = :upload_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array('upload_id' => $upload_batch_id)); - $stmt->closeCursor(); -} -catch (Exception $e) -{ - err('could not finish uplbatch'); - - return; -} - -// ------------------------------------------------------------------- -// do the job -// ------------------------------------------------------------------- - -$result->appendChild($dom->createElement('upload_batch'))->setAttribute('id', $upload_batch_id); -$xfiles = $result->appendChild($dom->createElement('files')); - -$sql = 'SELECT * FROM uplfile WHERE uplbatch_id = :upload_id ORDER BY idx ASC'; -$stmt = $conn->prepare($sql); -$stmt->execute(array('upload_id' => $upload_batch_id)); -$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -$nr = $stmt->rowCount(); -$result->appendChild($dom->createElement('n_ok'))->appendChild($dom->createTextNode($nr)); -foreach ($rs as $row) -{ - $xfile = $xfiles->appendChild($dom->createElement('file')); - $xfile->setAttribute('index', $row['idx']); - $xfile->appendChild($dom->createElement('filename'))->appendChild($dom->createTextNode($row['filename'])); -} diff --git a/www/api/upload/_prepare_upload.php b/www/api/upload/_prepare_upload.php deleted file mode 100644 index bc9f9c4246..0000000000 --- a/www/api/upload/_prepare_upload.php +++ /dev/null @@ -1,66 +0,0 @@ -base_id); -$nfiles = (int) ($sxParms->nfiles); - -try -{ - $conn = connection::getPDOConnection(); -} -catch (Exception $e) -{ - err('bad conn'); - - return; -} - -if (!$ses_id || !$usr_id) -{ - err('!ses_id || !usr_id'); - - return; -} - -try -{ - $sql = 'INSERT INTO uplbatch (base_id, nfiles, usr_id) - VALUES (:base_id, :nfiles, :usr_id);'; - - $params = array( - ':base_id' => $base_id - , ':nfiles' => $nfiles - , ':usr_id' => $usr_id - ); - - $stmt = $conn->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - $uplbatch_id = $conn->lastInsertId(); - - $result->appendChild($dom->createElement('upload_batch_id'))->appendChild($dom->createTextNode((string) $uplbatch_id)); -} -catch (Exception $e) -{ - -} diff --git a/www/api/upload/_upload.php b/www/api/upload/_upload.php deleted file mode 100644 index e3d2f7a662..0000000000 --- a/www/api/upload/_upload.php +++ /dev/null @@ -1,179 +0,0 @@ -upload_batch_id); -$index = (int) ($sxParms->index); -$filename = (string) ($sxParms->filename); -$filesize = (int) ($sxParms->filesize); -$md5 = (string) ($sxParms->md5); -//$crc32 = (int)($sxParms->crc32); -// ------------------------------------------------------------------- -// check parms, size, name, md5 etc... -// between post and _FILE -// ------------------------------------------------------------------- - -if (count($_FILES) != 1 || !array_key_exists('file', $_FILES)) -{ - err('$_FILES[\'file\'] unknown'); - - return; -} -$fil = $_FILES['file']['tmp_name']; -$tmp_filesize = filesize($fil); -$tmp_filename = $_FILES['file']['name']; -$tmp_k = file_get_contents($fil); -$tmp_md5 = md5($tmp_k, false); -//$tmp_crc32 = crc32($tmp_k); - -if ($tmp_filename != $filename) -{ - err('filename : \'' . $tmp_filename . '\' != \'' . $filename . '\''); - - return; -} -if ($tmp_md5 != $md5) -{ - err('md5 : \'' . $tmp_md5 . '\' != \'' . $md5 . '\''); - - return; -} - -// ------------------------------------------------------------------- -// check cnx & session -// ------------------------------------------------------------------- - -try -{ - $conn = connection::getPDOConnection(); -} -catch (Exception $e) -{ - err('bad conn'); - - return; -} - -if (!$ses_id || !$usr_id || !$upload_batch_id) -{ - err('missing ses_id, usr_id or upload_batch_id'); - - return; -} - - -// ------------------------------------------------------------------- -// check batch -// ------------------------------------------------------------------- - -$batchok = false; -$batch_nfiles = false; - -$sql = 'SELECT * FROM uplbatch WHERE uplbatch_id = :upload_id'; - -$stmt = $conn->prepare($sql); -$stmt->execute(array('upload_id' => $upload_batch_id)); -$row = $stmt->fetch(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -if ($row) -{ - $batch_nfiles = $row['nfiles']; - $batchok = true; -} - -if (!$batchok) -{ - err('bad upload_batch_id'); - - return; -} - -if ($index > $batch_nfiles) -{ - err('index : ' . $index . ' > ' . $batch_nfiles); - - return; -} - -$registry = registry::get_instance(); - -$dir = $registry->get('GV_RootPath') . 'tmp/batches/' . $upload_batch_id . '/'; - -if (!is_dir($dir)) -{ - @mkdir($dir, 0777, true); -} - -//$tmp_k = file_get_contents($fil); -if (is_dir($dir)) -{ - if (!@move_uploaded_file($fil, $dir . $index)) - { - err('error moving file \'' . $fil . '\' to \'' . $dir . $index . '\''); - - return; - } -} -else -{ - err('error creating tmp folder \'' . $dir . '\''); - - return; -} - - -// ------------------------------------------------------------------- -// ok, add (or replace) the file to the batch -// ------------------------------------------------------------------- - -$sql = 'REPLACE INTO uplfile (uplbatch_id, idx, filename) - VALUES (:upload_id, :idx, :filename) '; - -$params = array( - ':upload_id' => $upload_batch_id - , ':idx' => $index - , ':filename' => $filename -); - -$stmt = $conn->prepare($sql); -$stmt->execute($params); -$affected = $stmt->rowCount(); -$stmt->closeCursor(); - -$xupload_batch = $result->appendChild($dom->createElement('upload_batch')); -$xupload_batch->setAttribute('id', $upload_batch_id); -$xupload_batch->appendChild($dom->createElement('nfiles'))->appendChild($dom->createTextNode($batch_nfiles)); - -$xindex = $result->appendChild($dom->createElement('index')); -$xindex->appendChild($dom->createTextNode((string) $index)); -if ($affected == 1) -{ - // inserted - $xindex->setAttribute('action', 'INSERTED'); -} -elseif ($affected == 2) -{ - // inserted - $xindex->setAttribute('action', 'REPLACED'); -} -?> diff --git a/www/api/upload/upload.php b/www/api/upload/upload.php deleted file mode 100644 index 3c17f0e4fe..0000000000 --- a/www/api/upload/upload.php +++ /dev/null @@ -1,34 +0,0 @@ -get_parms('p', 'ses_id', 'usr_id', 'debug'); -// $sxParms = simplexml_load_string($parm['p']); -// $dom : domdocument for result -// $result : documentElement for result -$registry = registry::get_instance(); -require($registry->get('GV_RootPath') . 'www/api/api_utils.php'); -?>