Пример #1
0
     if ($tokenId) {
         $tokenArray->setTokenIdFilter($tokenId);
     }
     if ($tokenF) {
         $tokenArray->setTokenValueFilter($tokenF);
     }
     $propQuery = $PDO->prepare('SELECT name FROM properties WHERE document_id = ?');
     $propQuery->execute(array($docId));
     while ($prop = $propQuery->fetch(PDO::FETCH_COLUMN)) {
         $value = (string) filter_input(INPUT_GET, str_replace(' ', '_', $prop));
         if ($value !== '') {
             $tokenArray->addFilter($prop, $value);
         }
     }
     header('Content-Type: application/json');
     echo $tokenArray->getTokensOnly($docId, $userId, $pagesize ? $pagesize : 1000, $offset ? $offset : 0);
 } elseif ($docId != '') {
     // EXPORT
     try {
         $doc = new import\Document($PDO);
         $doc->loadDb($docId);
         $fileName = 'tmp/' . time() . rand();
         echo $doc->export((bool) filter_input(INPUT_GET, 'inPlace'), $fileName);
         header('Content-type: text/xml');
         header('Content-Length: ' . filesize($fileName));
         readfile($fileName);
         unlink($fileName);
     } catch (Exception $ex) {
         exit(json_encode(array('status' => 'ERROR', 'message' => $ex->getMessage())));
     }
 } else {