Fonction permettant d'archiver un ensemble de documents.

@param $fileB64
@param $fileName
@param $subject
@param $date2
@param $type
@param $author
@param $comment
@param $ref
@param $amount
@param $tagsLst
@return bool
967801
public function archive($fileB64, $fileName, $subject, $date2, $type, $author, $comment, $ref, $amount, $tagsLst)
    {
        $this->client = $this->setClientSoap($this->URL_WSDL_ARCHIVE);

        // Construction du tableau des paramètres
        $fileParam = array('content' => $fileB64,
                            'fileName' => $fileName,
                            'subject' => $subject,
                            'date1' => date(DATE_RFC2822),
                            'date2' => $date2,
                            'type' => $type,
                            'author' => $author,
                            'comment' => $comment,
                            'ref' => $ref,
                            'amount' => $amount,
                            'generic1' => 'gen1',
                            'generic2' => 'gen2',
                            'tag' => $tagsLst, );

        $params = array(
                'file' => $fileParam,
            );

        $result = $this->client->call('archive', $params, self::API_NAMESPACE, self::API_NAMESPACE, $this->createHeaders());

        if ($this->client->fault) {
            $this->errors[] = $this->client->faultstring;

            return false;
        } else {
            $err = $this->client->getError();
            if ($err) {
                $this->errors = $err;

                return false;
            } else {
                return $result;
            }
        }
    }
1220965
public function markAsRead()
	{
		if (!$this->get('id'))
		{
			$this->addError('Recipient record not found');
			return false;
		}

		$xseen = Seen::oneByMessageAndUser($this->get('mid'), $this->get('uid'));

		if ($xseen->get('whenseen') == ''
		 || $xseen->get('whenseen') == '0000-00-00 00:00:00'
		 || $xseen->get('whenseen') == null)
		{
			$dt = new Date('now');

			$xseen->set('mid', $this->get('mid'));
			$xseen->set('uid', $this->get('uid'));
			$xseen->set('whenseen', $dt->toSql());
			if (!$xseen->save())
			{
				$this->addError($xseen->getError());
				return false;
			}
		}

		return true;
	}
245387
function saveCSR($csr, $format = FILE_X509_FORMAT_PEM)
    {
        if (!is_array($csr) || !isset($csr['certificationRequestInfo'])) {
            return false;
        }

        switch (true) {
            case !($algorithm = $this->_subArray($csr, 'certificationRequestInfo/subjectPKInfo/algorithm/algorithm')):
            case is_object($csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']):
                break;
            default:
                switch ($algorithm) {
                    case 'rsaEncryption':
                        $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']
                            = base64_encode("\0" . base64_decode(preg_replace('#-.+-|[\r\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'])));
                        $csr['certificationRequestInfo']['subjectPKInfo']['algorithm']['parameters'] = null;
                        $csr['signatureAlgorithm']['parameters'] = null;
                        $csr['certificationRequestInfo']['signature']['parameters'] = null;
                }
        }

        $asn1 = new File_ASN1();

        $asn1->loadOIDs($this->oids);

        $filters = array();
        $filters['certificationRequestInfo']['subject']['rdnSequence']['value']
            = array('type' => FILE_ASN1_TYPE_UTF8_STRING);

        $asn1->loadFilters($filters);

        $this->_mapOutDNs($csr, 'certificationRequestInfo/subject/rdnSequence', $asn1);
        $this->_mapOutAttributes($csr, 'certificationRequestInfo/attributes', $asn1);
        $csr = $asn1->encodeDER($csr, $this->CertificationRequest);

        switch ($format) {
            case FILE_X509_FORMAT_DER:
                return $csr;
            // case FILE_X509_FORMAT_PEM:
            default:
                return "-----BEGIN CERTIFICATE REQUEST-----\r\n" . chunk_split(base64_encode($csr), 64) . '-----END CERTIFICATE REQUEST-----';
        }
    }
36775
protected function checkLastAnnotationTag(File $phpCsFile, int $docBlockStartIndex, int $docBlockEndIndex): void
    {
        $tokens = $phpCsFile->getTokens();

        $prevIndex = $phpCsFile->findPrevious([T_DOC_COMMENT_TAG, T_DOC_COMMENT_STRING], $docBlockEndIndex - 1, $docBlockStartIndex);
        if (!$prevIndex) {
            return;
        }

        $diff = $tokens[$docBlockEndIndex]['line'] - $tokens[$prevIndex]['line'];
        if ($diff < 2) {
            return;
        }

        $fix = $phpCsFile->addFixableError('Expected no extra blank line after tags, got ' . ($diff - 1), $prevIndex, 'NoExtraNewlineAfterTags');
        if (!$fix) {
            return;
        }

        $phpCsFile->fixer->beginChangeset();

        for ($i = $prevIndex; $i < $docBlockEndIndex; $i++) {
            if ($tokens[$i]['line'] <= $tokens[$prevIndex]['line'] || $tokens[$i]['line'] >= $tokens[$docBlockEndIndex]['line']) {
                continue;
            }
            $phpCsFile->fixer->replaceToken($i, '');
        }

        $phpCsFile->fixer->endChangeset();
    }
224439
public function loadFromFile($FileName)
    {
        if (! empty($FileName)) {
            $this->FileName = $FileName;
            $result = $this->_openSHPFile();
        } else {
            /* We operate on buffer emulated by readSHP / eofSHP */
            $result = true;
        }

        if ($result && ($this->_openDBFFile())) {
            if (! $this->_loadHeaders()) {
                $this->_closeSHPFile();
                $this->_closeDBFFile();

                return false;
            }
            if (! $this->_loadRecords()) {
                $this->_closeSHPFile();
                $this->_closeDBFFile();

                return false;
            }
            $this->_closeSHPFile();
            $this->_closeDBFFile();

            return true;
        }

        return false;
    }
846773
public function extract($file, $destination = false)
    {
        $archive = $this->getArchiver()->open($file);
        if ($archive) {
            $this->getArchiver()->extractTo($destination);
            return $this->getArchiver()->close();
        }
    }
318237
protected function hasCorrectContent(File $phpCsFile, int $docBlockEndPosition): bool
    {
        $tokens = $phpCsFile->getTokens();

        $docBlockStartPosition = $tokens[$docBlockEndPosition]['comment_opener'];

        $content = '';
        for ($i = $docBlockStartPosition + 1; $i < $docBlockEndPosition; $i++) {
            if ($tokens[$i]['type'] !== 'T_DOC_COMMENT_STRING') {
                continue;
            }
            $content .= $tokens[$i]['content'];
        }

        if ($content === static::EXPLANATION_CONSTANTS_INTERFACE) {
            return true;
        }

        return false;
    }
1017475
protected function hasBOM($filePointer, $encoding)
    {
        $hasBOM = false;

        $this->globalFunctionsHelper->rewind($filePointer);

        if (array_key_exists($encoding, $this->supportedEncodingsWithBom)) {
            $potentialBom = $this->supportedEncodingsWithBom[$encoding];
            $numBytesInBom = strlen($potentialBom);

            $hasBOM = ($this->globalFunctionsHelper->fgets($filePointer, $numBytesInBom + 1) === $potentialBom);
        }

        return $hasBOM;
    }
638299
function initializeFromFile( $filename, $imageAltText = false, $originalFilename = false )
    {
        if ( !file_exists( $filename ) )
        {
            $contentObjectID = isset( $this->ContentObjectAttributeData['contentobject_id'] ) ? $this->ContentObjectAttributeData['contentobject_id'] : 0;
            $contentObjectAttributeID = isset( $this->ContentObjectAttributeData['id'] ) ? $this->ContentObjectAttributeData['id'] : 0;
            $version = isset( $this->ContentObjectAttributeData['version'] ) ? $this->ContentObjectAttributeData['version'] : 0;
            $contentObject = eZContentObject::fetch( $contentObjectID );
            $contentObjectAttribute = eZContentObjectAttribute::fetch( $contentObjectAttributeID, $version );
            $contentObjectAttributeName = '';
            $contentObjectName = '';

            if ( $contentObject instanceof eZContentObject )
                $contentObjectName = $contentObject->attribute('name');

            if ( $contentObjectAttribute instanceof eZContentObjectAttribute )
                $contentObjectAttributeName = $contentObjectAttribute->attribute( 'contentclass_attribute_name' );

            eZDebug::writeError( "The image '$filename' does not exist, cannot initialize image attribute: '$contentObjectAttributeName' (id: $contentObjectAttributeID) for content object: '$contentObjectName' (id: $contentObjectID)", __METHOD__ );
            return false;
        }

        $this->increaseImageSerialNumber();

        if ( !$originalFilename )
            $originalFilename = basename( $filename );
        $mimeData = eZMimeType::findByFileContents( $filename );
        if ( !$mimeData['is_valid'] and
             $originalFilename != $filename )
        {
            $mimeData = eZMimeType::findByFileContents( $originalFilename );
        }

        $this->removeAliases();
        $this->setOriginalAttributeDataValues( $this->ContentObjectAttributeData['id'],
                                               $this->ContentObjectAttributeData['version'],
                                               $this->ContentObjectAttributeData['language_code'] );
        $contentVersion = eZContentObjectVersion::fetchVersion( $this->ContentObjectAttributeData['version'],
                                                                $this->ContentObjectAttributeData['contentobject_id'] );
        $objectName = $this->imageName( $this->ContentObjectAttributeData, $contentVersion );
        $objectPathString = $this->imagePath( $this->ContentObjectAttributeData, $contentVersion, true );

        eZMimeType::changeBaseName( $mimeData, $objectName );
        eZMimeType::changeDirectoryPath( $mimeData, $objectPathString );
        if ( !file_exists( $mimeData['dirpath'] ) )
        {
            eZDir::mkdir( $mimeData['dirpath'], false, true );
        }

        eZFileHandler::copy( $filename, $mimeData['url'] );

        return $this->initialize( $mimeData, $originalFilename, $imageAltText );
    }
389945
public function setReadPreference($readPreference, array $tags = null)
    {
        if (isset($tags)) {
            return $this->mongoCollection->setReadPreference($readPreference, $tags);
        }

        return $this->mongoCollection->setReadPreference($readPreference);
    }
518559
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }

        $tmpFile = tempnam(TMP, 'TYPESCRIPT');
        $cmd = $this->_settings['typescript'] . " " . escapeshellarg($filename) . " --out " . $tmpFile;
        $this->_runCmd($cmd, null);
        $output = file_get_contents($tmpFile);
        unlink($tmpFile);
        return $output;
    }
1227733
public function queue($from, $to, $subject, $text, $priority = 0, $files = [], $bcc = null)
    {
        if (is_array($bcc)) {
            $bcc = implode(', ', $bcc);
        }

        $model = new Message();
        $model->from = $from;
        $model->to = $to;
        $model->subject = $subject;
        $model->text = $text;
        $model->priority = $priority;
        $model->files = $files;
        $model->bcc = $bcc;

        return $model->save();
    }
1171473
public function getFileContent($fileName)
    {
        if (!in_array($fileName, $this->files, true))
            return false;

        return $this->archive->getFileContent($fileName);
    }
289860
function doOpen( $filename, $mode )
    {
        $this->FileHandler = @fopen( $filename, $mode );
        return $this->FileHandler;
    }
51715
public static function filePutContents(string $filename, string $text, int $lockType = LOCK_EX): bool {
		if (!is_file($filename))
			static::recursiveMakeDirectory(dirname($filename)) && touch($filename);
		return file_put_contents($filename, $text, $lockType) === false ? false : true;
	}
1302382
public function setReadPreference($readPreference, array $tags = null)
    {
        $this->initialize();
        if (isset($tags)) {
            return $this->mongoClient->setReadPreference($readPreference, $tags);
        }

        return $this->mongoClient->setReadPreference($readPreference);
    }
778139
public function addFile($name, $label = '', $is_mandatory = true)
    {
        $e = new \FrenchFrogs\Form\Element\File($name, $label);
        $this->addElement($e);

        if ($is_mandatory) {
            $e->addRule('required');
        } else {
            $e->addFilter('nullable');
        }

        return $e;
    }