PHP Att Codec

By Stéphane Degré and Renaud Hager in March 2004

Introduction :

PHP att_codec is a module (or an extension) for PHP4 written in C language.
It is the PHP version of the C-library UUDeview (http://www.fpx.de/fp/Software/UUDeview/).
Indeed, this extension provides a lot of functions that are able to code/decode large mails attachments.
These functions support the following formats : Base64, UUEncoding, XXEncoding and Yenc.

Requirements :

Windows requirements :

If you don't want to compile the extension, directly go to the section "Installation without compilation".
If you want to compile the extension, a compliable and working version of PHP4 is required. Moreover, this extension requires the C-uudeview library to be installed. Grab the latest version for Windows from http://www.miken.com/uud/developer/source.htm#dll. Unzip the sources on your local disk C. You have now two new directories : "Vc" and "VC16". Go to "Vc\uudeview" and open the workspace "uudeview.dsw" with Microsoft Visual C++. Open up Project > Settings. On the C/C++ tab, Code Generation Category, change Use run-time Library to "Multithreaded DLL". Then build the project. Copy the resulting file "Release\uudeview.dll" to your "C:\Windows" directory. Note that the "uudeview.lib" file was also created.

Unix requirements :

You have to compile the extension, that's why a compliable version of PHP4 is required. Moreover, this extension requires the C-uudeview library to be installed. Grab the latest version for UNIX from http://www.fpx.de/fp/Software/UUDeview/ and compile it (See the documentation of UUDeview for more details).
We are now on the last step of the requirements :
Go to the "uudeviewxxx/uulib" directory and copy the "config.h", "uudeview.h" and "crc32.h" files into "/usr/local/include/". Additionally when you compiled UUDeview, a file named libuu.a was created. Also put this in the "/usr/local/lib/" directory.
This last step is optionnal, it can be replaced by indicating the installation path of UUDeview when you compile the extension (see below).

Installation :

On Windows systems :

With compilation :

Without compilation :

For both :

In the php.ini file (C:\Windows\php.ini) :

On UNIX systems :

Resource Types, Object Types and Predefined Constants

The resources, objects and constants below are defined by this extension, and will only be available when the extension has been dynamically loaded at runtime.

Predefined Constants for Message CallBack

UUMSG_MESSAGE (integer)
UUMSG_NOTE (integer)
UUMSG_WARNING (integer)
UUMSG_ERROR (integer)
UUMSG_FATAL (integer)
UUMSG_PANIC (integer)

Predefined Object for Busy CallBack

This extension defines an object corresponding to the C structure uuprogress. This object has the following members :

Predefined Constants for Busy CallBack

UUACT_IDLE (integer)
UUACT_SCANNING (integer)
UUACT_DECODING (integer)
UUACT_COPYING (integer)
UUACT_ENCODING (integer)

Predefined Resource and Object for File List

This extension defines an object and a resource corresponding to the C structure uulist. The object has the following members :

Predefined Constants for File List

UUFILE_MISPART (integer)
UUFILE_NOBEGIN (integer)
UUFILE_NOEND (integer)
UUFILE_NODATA (integer)
UUFILE_OK (integer)
UUFILE_ERROR (integer)
UUFILE_DECODED (integer)
UUFILE_TMPFILE (integer)
UU_ENCODED (integer)
B64ENCODED (integer)
XX_ENCODED (integer)
BH_ENCODED (integer)
PT_ENCODED (integer)
QT_ENCODED (integer)
YENC_ENCODED (integer)

Predefined Constants for Return Values

UURET_OK (integer)
UURET_IOERR (integer)
UURET_NOMEM (integer)
UURET_ILLVAL (integer)
UURET_NODATA (integer)
UURET_NOEND (integer)
UURET_UNSUP (integer)
UURET_EXISTS (integer)
UURET_CONT (integer)
UURET_CANCEL (integer)

Predefined Constants for Options

UUOPT_VERSION (integer)
UUOPT_FAST (integer)
UUOPT_DUMBNESS (integer)
UUOPT_BRACKPOL (integer)
UUOPT_VERBOSE (integer)
UUOPT_DESPERATE (integer)
UUOPT_IGNREPLY (integer)
UUOPT_OVERWRITE (integer)
UUOPT_SAVEPATH (integer)
UUOPT_IGNMODE (integer)
UUOPT_DEBUG (integer)
UUOPT_ERRNO (integer)
UUOPT_PROGRESS (integer)
UUOPT_USETEXT (integer)
UUOPT_PREAMB (integer)
UUOPT_TINYB64 (integer)
UUOPT_ENCEXT (integer)
UUOPT_REMOVE (integer)
UUOPT_MOREMIME (integer)

Table of Contents

General functions :

php_uuinitialize -- Initializes the library.
php_uucleanup -- Cleans up all resources that have been allocated.
php_uugetoption -- Returns the value of an option.
php_uusetoption -- Sets a value to an option.
php_uustrerror -- Returns a string representation of an error code.
php_uusetmsgcallback -- Sets the Message Callback function.
php_uusetbusycallback -- Sets the Busy Callback function.
php_uusetfnamefilter -- Sets the Filename Filter function.
php_uufnamefilter -- Returns the string returned by the Filename Filter.

Decoding functions :

php_uuloadfile -- Scans a file for encoded data and inserts the result into the file list.
php_uugetfilelistitem -- Returns a uulist resource from the file list.
php_uulistitemtoobject -- Converts a uulist resource into an object.
php_uurenamefile -- Renames one item of the file list.
php_uudecodetotemp -- Decodes a uulist resource into a temporary file.
php_uuremovetemp -- Erases a temporary file.
php_uudecodefile -- Decodes a file and copies it to its final location.
php_quick_uudecode -- Decodes all the multi-parts or single-part files given.
php_uuinfofile -- Calls a user function with one information line of a file.
php_uusmerge -- Attempts a "Smart Merge" of parts that seem to belong to different files but which could belong to the same.

Encoding functions -- Common parameters for the encoding functions :

php_uuencodemulti -- Encodes data into a subpart of a MIME-"multipart" message.
php_uuencodepartial -- Encodes data as the body of a MIME-"message/partial" message.
php_uuencodetostream -- Encodes the input data and sends the plain output without any headers to the output stream.
php_uuencodetofile -- Encodes the input data and writes the output into one or more output files on the local disk.
php_quick_uuencode -- Encodes the input data and writes the output into one or more output files on the local disk.
php_uue_prepsingle -- Produces a complete MIME-formatted message including all necessary headers.
php_uue_preppartial -- Produces a complete MIME-formatted "message/partial" message including all necessary headers.

Examples

FAQ

Performances

Alarme piscine