Browse Source
- Remove ext/mime_magic, it was deprecated and it's only function is now part of
- Remove ext/mime_magic, it was deprecated and it's only function is now part of
ext/fileinfo.PECL
10 changed files with 0 additions and 2678 deletions
-
2ext/mime_magic/CREDITS
-
36ext/mime_magic/DEPRECATED
-
2ext/mime_magic/EXPERIMENTAL
-
37ext/mime_magic/config.m4
-
9ext/mime_magic/config.w32
-
2008ext/mime_magic/mime_magic.c
-
112ext/mime_magic/mime_magic.dsp
-
49ext/mime_magic/package.xml
-
43ext/mime_magic/php_mime_magic.h
-
380ext/mime_magic/phpmimemagic.h
@ -1,2 +0,0 @@ |
|||
mime_magic |
|||
Hartmut Holzgraefe |
|||
@ -1,36 +0,0 @@ |
|||
This extension is deprecated, please use the fileinfo extension |
|||
from PECL instead. |
|||
|
|||
Back when i implemented mime_magic there was no library interface |
|||
to the file utilities functionality. The only way to get the |
|||
functionality in place was to get the file sources and replace |
|||
the input and output routines within with code interfacing to |
|||
your own stuff. This work was originally done by the developers |
|||
of apache mod_magic, the mime_magic extension just replaced the |
|||
apache specific parts with their PHP counterparts. |
|||
|
|||
Now that the codebase of the file utilities is cleanly devided |
|||
into the libmagic library and the file utility built upon it |
|||
the original hack is no longer needed. Using libmagic and the |
|||
fileinfo extension does not only provide a cleaner interface |
|||
to files functionality but also additional functionality so |
|||
that theres no reason to keep around mime_magic anymore. |
|||
|
|||
To keep existing code originaly coded for mime_magic without |
|||
changes you may add the following compatibility wrapper function |
|||
to your codebase: |
|||
|
|||
function mime_content_type($file) { |
|||
static $finfo = false; |
|||
|
|||
if ($finfo === false) { |
|||
$finfo = finfo_open(MAGIC_MIME); |
|||
} |
|||
|
|||
if (is_resource($file)) { |
|||
$buf = fread($fp, 65536); |
|||
return finfo_buffer($buf); |
|||
} else { |
|||
return finfo_file($file); |
|||
} |
|||
} |
|||
@ -1,2 +0,0 @@ |
|||
this extension never left the "experimental" status |
|||
and is now superseded by PECL::fileinfo |
|||
@ -1,37 +0,0 @@ |
|||
dnl |
|||
dnl $Id$ |
|||
dnl |
|||
|
|||
PHP_ARG_WITH(mime-magic, whether to include mime_magic support, |
|||
[ --with-mime-magic[=FILE] |
|||
Include mime_magic support (DEPRECATED!!)]) |
|||
|
|||
if test "$PHP_MIME_MAGIC" != "no"; then |
|||
|
|||
PHP_NEW_EXTENSION(mime_magic, mime_magic.c, $ext_shared) |
|||
|
|||
PHP_MIME_MAGIC_FILE_PATH= |
|||
|
|||
dnl |
|||
dnl Try to see if we can find the path of the magic file in its default locations. |
|||
dnl |
|||
if test "$PHP_MIME_MAGIC" != "yes"; then |
|||
if test -f $PHP_MIME_MAGIC; then |
|||
PHP_MIME_MAGIC_FILE_PATH=$PHP_MIME_MAGIC |
|||
else |
|||
AC_MSG_ERROR([File '$PHP_MIME_MAGIC' not found!]) |
|||
fi |
|||
else |
|||
MAGIC_MIME_LOCATIONS="/usr/local/apache/conf/magic /usr/local/etc/apache/conf/magic /etc/apache/magic /etc/httpd/conf/magic /usr/share/magic.mime /usr/share/misc/magic.mime /etc/magic.mime" |
|||
|
|||
for i in $MAGIC_MIME_LOCATIONS; do |
|||
if test -f $i; then |
|||
PHP_MIME_MAGIC_FILE_PATH=$i |
|||
break |
|||
fi |
|||
done |
|||
fi |
|||
|
|||
AC_DEFINE_UNQUOTED(PHP_MIME_MAGIC_FILE_PATH,"$PHP_MIME_MAGIC_FILE_PATH",[magic file path]) |
|||
|
|||
fi |
|||
@ -1,9 +0,0 @@ |
|||
// $Id$ |
|||
// vim:ft=javascript |
|||
|
|||
ARG_WITH("mime-magic", "Mime Magic support", "no"); |
|||
|
|||
if (PHP_MIME_MAGIC != "no") { |
|||
EXTENSION('mime_magic', 'mime_magic.c'); |
|||
} |
|||
|
|||
2008
ext/mime_magic/mime_magic.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,112 +0,0 @@ |
|||
# Microsoft Developer Studio Project File - Name="mime_magic" - Package Owner=<4> |
|||
# Microsoft Developer Studio Generated Build File, Format Version 6.00 |
|||
# ** DO NOT EDIT ** |
|||
|
|||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 |
|||
|
|||
CFG=mime_magic - Win32 Debug_TS |
|||
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
|||
!MESSAGE use the Export Makefile command and run |
|||
!MESSAGE |
|||
!MESSAGE NMAKE /f "mime_magic.mak". |
|||
!MESSAGE |
|||
!MESSAGE You can specify a configuration when running NMAKE |
|||
!MESSAGE by defining the macro CFG on the command line. For example: |
|||
!MESSAGE |
|||
!MESSAGE NMAKE /f "mime_magic.mak" CFG="mime_magic - Win32 Debug_TS" |
|||
!MESSAGE |
|||
!MESSAGE Possible choices for configuration are: |
|||
!MESSAGE |
|||
!MESSAGE "mime_magic - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") |
|||
!MESSAGE "mime_magic - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") |
|||
!MESSAGE |
|||
|
|||
# Begin Project |
|||
# PROP AllowPerConfigDependencies 0 |
|||
# PROP Scc_ProjName "" |
|||
# PROP Scc_LocalPath "" |
|||
CPP=cl.exe |
|||
MTL=midl.exe |
|||
RSC=rc.exe |
|||
|
|||
!IF "$(CFG)" == "mime_magic - Win32 Release_TS" |
|||
|
|||
# PROP BASE Use_MFC 0 |
|||
# PROP BASE Use_Debug_Libraries 0 |
|||
# PROP BASE Output_Dir "Release_TS" |
|||
# PROP BASE Intermediate_Dir "Release_TS" |
|||
# PROP BASE Ignore_Export_Lib 0 |
|||
# PROP BASE Target_Dir "" |
|||
# PROP Use_MFC 0 |
|||
# PROP Use_Debug_Libraries 0 |
|||
# PROP Output_Dir "Release_TS" |
|||
# PROP Intermediate_Dir "Release_TS" |
|||
# PROP Ignore_Export_Lib 0 |
|||
# PROP Target_Dir "" |
|||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MIME_MAGIC_EXPORTS" /YX /FD /c |
|||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MIME_MAGIC" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MIME_MAGIC_EXPORTS" /D "HAVE_ZLIB" /FR /YX /FD /c |
|||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
|||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
|||
# ADD BASE RSC /l 0x407 /d "NDEBUG" |
|||
# ADD RSC /l 0x407 /d "NDEBUG" |
|||
BSC32=bscmake.exe |
|||
# ADD BASE BSC32 /nologo |
|||
# ADD BSC32 /nologo |
|||
LINK32=link.exe |
|||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 |
|||
# ADD LINK32 php5ts.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mime_magic.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release" |
|||
|
|||
!ELSEIF "$(CFG)" == "mime_magic - Win32 Debug_TS" |
|||
|
|||
# PROP BASE Use_MFC 0 |
|||
# PROP BASE Use_Debug_Libraries 1 |
|||
# PROP BASE Output_Dir "Debug_TS" |
|||
# PROP BASE Intermediate_Dir "Debug_TS" |
|||
# PROP BASE Target_Dir "" |
|||
# PROP Use_MFC 0 |
|||
# PROP Use_Debug_Libraries 1 |
|||
# PROP Output_Dir "Debug_TS" |
|||
# PROP Intermediate_Dir "Debug_TS" |
|||
# PROP Ignore_Export_Lib 0 |
|||
# PROP Target_Dir "" |
|||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MIME_MAGIC_EXPORTS" /YX /FD /GZ /c |
|||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MIME_MAGIC" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MIME_MAGIC_EXPORTS" /D "HAVE_ZLIB" /YX /FD /GZ /c |
|||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 |
|||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 |
|||
# ADD BASE RSC /l 0x407 /d "_DEBUG" |
|||
# ADD RSC /l 0x407 /d "_DEBUG" |
|||
BSC32=bscmake.exe |
|||
# ADD BASE BSC32 /nologo |
|||
# ADD BSC32 /nologo |
|||
LINK32=link.exe |
|||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept |
|||
# ADD LINK32 php5ts_debug.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mime_magic.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release" |
|||
|
|||
!ENDIF |
|||
|
|||
# Begin Target |
|||
|
|||
# Name "mime_magic - Win32 Release_TS" |
|||
# Name "mime_magic - Win32 Debug_TS" |
|||
# Begin Group "Source Files" |
|||
|
|||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" |
|||
# Begin Source File |
|||
|
|||
SOURCE=.\mime_magic.c |
|||
# End Source File |
|||
# End Group |
|||
# Begin Group "Header Files" |
|||
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl" |
|||
# Begin Source File |
|||
|
|||
SOURCE=.\php_mime_magic.h |
|||
# End Source File |
|||
# Begin Source File |
|||
|
|||
SOURCE=.\phpmimemagic.h |
|||
# End Source File |
|||
# End Group |
|||
# End Target |
|||
# End Project |
|||
@ -1,49 +0,0 @@ |
|||
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|||
<!DOCTYPE package SYSTEM "../pear/package.dtd"> |
|||
<package> |
|||
<name>mime_magic</name> |
|||
<summary>MIME type detection using magic numbers</summary> |
|||
<maintainers> |
|||
<maintainer> |
|||
<user>hholzgra</user> |
|||
<name>Hartmut Holzgraefe</name> |
|||
<email>hartmut@php.net</email> |
|||
<role>lead</role> |
|||
</maintainer> |
|||
</maintainers> |
|||
<description> |
|||
mime_magic tries to detect a files MIME type by testing certain |
|||
byte positions against known magic numbers collected in a data |
|||
file. It uses the same file format as the UNIX file program and |
|||
apache mod_magic. The actual code is based on detection code from |
|||
apache mod_magic which is itself an adaption of the original 'file' |
|||
code. |
|||
</description> |
|||
<license>PHP</license> |
|||
<release> |
|||
<state>beta</state> |
|||
<version>1.0rc1</version> |
|||
<date>2004-03-19</date> |
|||
<notes> |
|||
package.xml added to support installation using pear installer |
|||
</notes> |
|||
<configureoptions> |
|||
<configureoption name="with-mime-magic" default="autodetect" prompt="magic.mime data file?"/> |
|||
</configureoptions> |
|||
<filelist> |
|||
<file role="src" name="config.m4"/> |
|||
<file role="src" name="mime_magic.c"/> |
|||
<file role="src" name="php_mime_magic.h"/> |
|||
<file role="src" name="phpmimemagic.h"/> |
|||
<file role="doc" name="CREDITS"/> |
|||
<file role="doc" name="EXPERIMENTAL"/> |
|||
<file role="doc" name="TODO"/> |
|||
</filelist> |
|||
<deps> |
|||
<dep type="php" rel="ge" version="5" /> |
|||
</deps> |
|||
</release> |
|||
</package> |
|||
<!-- |
|||
vim:et:ts=1:sw=1 |
|||
--> |
|||
@ -1,43 +0,0 @@ |
|||
/* |
|||
+----------------------------------------------------------------------+ |
|||
| PHP Version 5 | |
|||
+----------------------------------------------------------------------+ |
|||
| Copyright (c) 1997-2008 The PHP Group | |
|||
+----------------------------------------------------------------------+ |
|||
| This source file is subject to version 3.01 of the PHP license, | |
|||
| that is bundled with this package in the file LICENSE, and is | |
|||
| available through the world-wide-web at the following url: | |
|||
| http://www.php.net/license/3_01.txt | |
|||
| If you did not receive a copy of the PHP license and are unable to | |
|||
| obtain it through the world-wide-web, please send a note to | |
|||
| license@php.net so we can mail you a copy immediately. | |
|||
+----------------------------------------------------------------------+ |
|||
| Author: | |
|||
+----------------------------------------------------------------------+ |
|||
|
|||
$Id$ |
|||
*/ |
|||
|
|||
#ifndef PHP_MIME_MAGIC_H |
|||
#define PHP_MIME_MAGIC_H |
|||
|
|||
extern zend_module_entry mime_magic_module_entry; |
|||
#define phpext_mime_magic_ptr &mime_magic_module_entry |
|||
|
|||
PHP_MINIT_FUNCTION(mime_magic); |
|||
PHP_MSHUTDOWN_FUNCTION(mime_magic); |
|||
PHP_RINIT_FUNCTION(mime_magic); |
|||
PHP_RSHUTDOWN_FUNCTION(mime_magic); |
|||
PHP_MINFO_FUNCTION(mime_magic); |
|||
|
|||
PHP_FUNCTION(mime_content_type); |
|||
|
|||
#endif /* PHP_MIME_MAGIC_H */ |
|||
|
|||
/* |
|||
* Local variables: |
|||
* tab-width: 4 |
|||
* c-basic-offset: 4 |
|||
* indent-tabs-mode: t |
|||
* End: |
|||
*/ |
|||
@ -1,380 +0,0 @@ |
|||
/* |
|||
+----------------------------------------------------------------------+ |
|||
| PHP Version 5 | |
|||
+----------------------------------------------------------------------+ |
|||
| Copyright (c) 1997-2008 The PHP Group | |
|||
+----------------------------------------------------------------------+ |
|||
| This source file is subject to version 3.01 of the PHP license, | |
|||
| that is bundled with this package in the file LICENSE, and is | |
|||
| available through the world-wide-web at the following url: | |
|||
| http://www.php.net/license/3_01.txt | |
|||
| If you did not receive a copy of the PHP license and are unable to | |
|||
| obtain it through the world-wide-web, please send a note to | |
|||
| license@php.net so we can mail you a copy immediately. | |
|||
+----------------------------------------------------------------------+ |
|||
| Author: | |
|||
+----------------------------------------------------------------------+ |
|||
|
|||
$Id$ |
|||
*/ |
|||
|
|||
#ifndef PHPMIMEMAGIC_H |
|||
#define PHPMIMEMAGIC_H |
|||
|
|||
#define MIME_MAGIC_DEBUG 0 |
|||
|
|||
#define MIME_BINARY_UNKNOWN "application/octet-stream" |
|||
#define MIME_TEXT_UNKNOWN "text/plain" |
|||
|
|||
#define MAXMIMESTRING 256 |
|||
|
|||
#define MIME_MAGIC_OK 0 |
|||
#define MIME_MAGIC_DECLINED -1 |
|||
#define MIME_MAGIC_DONE -2 |
|||
#define MIME_MAGIC_ERROR -3 |
|||
|
|||
#define DIR_MAGIC_TYPE "httpd/unix-directory" |
|||
|
|||
/* HOWMANY must be at least 4096 to make gzip -dcq work */ |
|||
#define HOWMANY 4096 |
|||
/* SMALL_HOWMANY limits how much work we do to figure out text files */ |
|||
#define SMALL_HOWMANY 1024 |
|||
#define MAXDESC 50 /* max leng of text description */ |
|||
#define MAXstring 64 /* max leng of "string" types */ |
|||
|
|||
struct magic { |
|||
struct magic *next; /* link to next entry */ |
|||
int lineno; /* line number from magic file */ |
|||
|
|||
short flag; |
|||
#define INDIR 1 /* if '>(...)' appears, */ |
|||
#define UNSIGNED 2 /* comparison is unsigned */ |
|||
short cont_level; /* level of ">" */ |
|||
struct { |
|||
char type; /* byte short long */ |
|||
long offset; /* offset from indirection */ |
|||
} in; |
|||
long offset; /* offset to magic number */ |
|||
unsigned char reln; /* relation (0=eq, '>'=gt, etc) */ |
|||
char type; /* int, short, long or string. */ |
|||
char vallen; /* length of string value, if any */ |
|||
union VALUETYPE { |
|||
unsigned char b; |
|||
unsigned short h; |
|||
unsigned long l; |
|||
char s[MAXstring]; |
|||
unsigned char hs[2]; /* 2 bytes of a fixed-endian "short" */ |
|||
unsigned char hl[4]; /* 2 bytes of a fixed-endian "long" */ |
|||
} value; /* either number or string */ |
|||
unsigned long mask; /* mask before comparison with value */ |
|||
char nospflag; /* supress space character */ |
|||
|
|||
/* NOTE: this string is suspected of overrunning - find it! */ |
|||
char desc[MAXDESC]; /* description */ |
|||
}; |
|||
|
|||
/* |
|||
* data structures for tar file recognition |
|||
* -------------------------------------------------------------------------- |
|||
* Header file for public domain tar (tape archive) program. |
|||
* |
|||
* @(#)tar.h 1.20 86/10/29 Public Domain. Created 25 August 1985 by John |
|||
* Gilmore, ihnp4!hoptoad!gnu. |
|||
* |
|||
* Header block on tape. |
|||
* |
|||
* I'm going to use traditional DP naming conventions here. A "block" is a big |
|||
* chunk of stuff that we do I/O on. A "record" is a piece of info that we |
|||
* care about. Typically many "record"s fit into a "block". |
|||
*/ |
|||
#define RECORDSIZE 512 |
|||
#define NAMSIZ 100 |
|||
#define TUNMLEN 32 |
|||
#define TGNMLEN 32 |
|||
|
|||
union record { |
|||
char charptr[RECORDSIZE]; |
|||
struct header { |
|||
char name[NAMSIZ]; |
|||
char mode[8]; |
|||
char uid[8]; |
|||
char gid[8]; |
|||
char size[12]; |
|||
char mtime[12]; |
|||
char chksum[8]; |
|||
char linkflag; |
|||
char linkname[NAMSIZ]; |
|||
char magic[8]; |
|||
char uname[TUNMLEN]; |
|||
char gname[TGNMLEN]; |
|||
char devmajor[8]; |
|||
char devminor[8]; |
|||
} header; |
|||
}; |
|||
|
|||
/* The magic field is filled with this if uname and gname are valid. */ |
|||
#define TMAGIC "ustar " /* 7 chars and a null */ |
|||
|
|||
/* |
|||
* file-function prototypes |
|||
*/ |
|||
/*TODO*/ |
|||
#define request_rec void |
|||
#define server_rec void |
|||
#define pool void |
|||
#define cmd_parms void |
|||
|
|||
/* |
|||
* includes for ASCII substring recognition formerly "names.h" in file |
|||
* command |
|||
* |
|||
* Original notes: names and types used by ascmagic in file(1). These tokens are |
|||
* here because they can appear anywhere in the first HOWMANY bytes, while |
|||
* tokens in /etc/magic must appear at fixed offsets into the file. Don't |
|||
* make HOWMANY too high unless you have a very fast CPU. |
|||
*/ |
|||
|
|||
/* these types are used to index the table 'types': keep em in sync! */ |
|||
/* HTML inserted in first because this is a web server module now */ |
|||
#define L_HTML 0 /* HTML */ |
|||
#define L_C 1 /* first and foremost on UNIX */ |
|||
#define L_FORT 2 /* the oldest one */ |
|||
#define L_MAKE 3 /* Makefiles */ |
|||
#define L_PLI 4 /* PL/1 */ |
|||
#define L_MACH 5 /* some kinda assembler */ |
|||
#define L_ENG 6 /* English */ |
|||
#define L_PAS 7 /* Pascal */ |
|||
#define L_MAIL 8 /* Electronic mail */ |
|||
#define L_NEWS 9 /* Usenet Netnews */ |
|||
|
|||
static char *types[] = |
|||
{ |
|||
"text/html", /* HTML */ |
|||
"text/plain", /* "c program text", */ |
|||
"text/plain", /* "fortran program text", */ |
|||
"text/plain", /* "make commands text", */ |
|||
"text/plain", /* "pl/1 program text", */ |
|||
"text/plain", /* "assembler program text", */ |
|||
"text/plain", /* "English text", */ |
|||
"text/plain", /* "pascal program text", */ |
|||
"message/rfc822", /* "mail text", */ |
|||
"message/news", /* "news text", */ |
|||
"application/binary", /* "can't happen error on names.h/types", */ |
|||
0 |
|||
}; |
|||
|
|||
static struct names { |
|||
char *name; |
|||
short type; |
|||
} names[] = { |
|||
|
|||
/* These must be sorted by eye for optimal hit rate */ |
|||
/* Add to this list only after substantial meditation */ |
|||
{ |
|||
"<html>", L_HTML |
|||
}, |
|||
{ |
|||
"<HTML>", L_HTML |
|||
}, |
|||
{ |
|||
"<head>", L_HTML |
|||
}, |
|||
{ |
|||
"<HEAD>", L_HTML |
|||
}, |
|||
{ |
|||
"<title>", L_HTML |
|||
}, |
|||
{ |
|||
"<TITLE>", L_HTML |
|||
}, |
|||
{ |
|||
"<h1>", L_HTML |
|||
}, |
|||
{ |
|||
"<H1>", L_HTML |
|||
}, |
|||
{ |
|||
"<!--", L_HTML |
|||
}, |
|||
{ |
|||
"<!DOCTYPE HTML", L_HTML |
|||
}, |
|||
{ |
|||
"/*", L_C |
|||
}, /* must precede "The", "the", etc. */ |
|||
{ |
|||
"#include", L_C |
|||
}, |
|||
{ |
|||
"char", L_C |
|||
}, |
|||
{ |
|||
"The", L_ENG |
|||
}, |
|||
{ |
|||
"the", L_ENG |
|||
}, |
|||
{ |
|||
"double", L_C |
|||
}, |
|||
{ |
|||
"extern", L_C |
|||
}, |
|||
{ |
|||
"float", L_C |
|||
}, |
|||
{ |
|||
"real", L_C |
|||
}, |
|||
{ |
|||
"struct", L_C |
|||
}, |
|||
{ |
|||
"union", L_C |
|||
}, |
|||
{ |
|||
"CFLAGS", L_MAKE |
|||
}, |
|||
{ |
|||
"LDFLAGS", L_MAKE |
|||
}, |
|||
{ |
|||
"all:", L_MAKE |
|||
}, |
|||
{ |
|||
".PRECIOUS", L_MAKE |
|||
}, |
|||
/* |
|||
* Too many files of text have these words in them. Find another way to |
|||
* recognize Fortrash. |
|||
*/ |
|||
#ifdef NOTDEF |
|||
{ |
|||
"subroutine", L_FORT |
|||
}, |
|||
{ |
|||
"function", L_FORT |
|||
}, |
|||
{ |
|||
"block", L_FORT |
|||
}, |
|||
{ |
|||
"common", L_FORT |
|||
}, |
|||
{ |
|||
"dimension", L_FORT |
|||
}, |
|||
{ |
|||
"integer", L_FORT |
|||
}, |
|||
{ |
|||
"data", L_FORT |
|||
}, |
|||
#endif /* NOTDEF */ |
|||
{ |
|||
".ascii", L_MACH |
|||
}, |
|||
{ |
|||
".asciiz", L_MACH |
|||
}, |
|||
{ |
|||
".byte", L_MACH |
|||
}, |
|||
{ |
|||
".even", L_MACH |
|||
}, |
|||
{ |
|||
".globl", L_MACH |
|||
}, |
|||
{ |
|||
"clr", L_MACH |
|||
}, |
|||
{ |
|||
"(input,", L_PAS |
|||
}, |
|||
{ |
|||
"dcl", L_PLI |
|||
}, |
|||
{ |
|||
"Received:", L_MAIL |
|||
}, |
|||
{ |
|||
">From", L_MAIL |
|||
}, |
|||
{ |
|||
"Return-Path:", L_MAIL |
|||
}, |
|||
{ |
|||
"Cc:", L_MAIL |
|||
}, |
|||
{ |
|||
"Newsgroups:", L_NEWS |
|||
}, |
|||
{ |
|||
"Path:", L_NEWS |
|||
}, |
|||
{ |
|||
"Organization:", L_NEWS |
|||
}, |
|||
{ |
|||
NULL, 0 |
|||
} |
|||
}; |
|||
|
|||
#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1) |
|||
|
|||
/* |
|||
* Result String List (RSL) |
|||
* |
|||
* The file(1) command prints its output. Instead, we store the various |
|||
* "printed" strings in a list (allocating memory as we go) and concatenate |
|||
* them at the end when we finally know how much space they'll need. |
|||
*/ |
|||
|
|||
typedef struct magic_rsl_s { |
|||
char *str; /* string, possibly a fragment */ |
|||
struct magic_rsl_s *next; /* pointer to next fragment */ |
|||
} magic_rsl; |
|||
|
|||
/* |
|||
* Apache module configuration structures |
|||
*/ |
|||
|
|||
/* per-server info */ |
|||
typedef struct { |
|||
struct magic *magic; /* head of magic config list */ |
|||
struct magic *last; |
|||
} magic_server_config_rec; |
|||
|
|||
/* per-request info */ |
|||
typedef struct { |
|||
magic_rsl *head; /* result string list */ |
|||
magic_rsl *tail; |
|||
unsigned suf_recursion; /* recursion depth in suffix check */ |
|||
} magic_req_rec; |
|||
|
|||
|
|||
/* Globals */ |
|||
ZEND_BEGIN_MODULE_GLOBALS(mime_magic) |
|||
char *magicfile; |
|||
magic_req_rec *req_dat; |
|||
int debug; /* shall magic file parser errors be shown? */ |
|||
char *status; /* status message for phpinfo() */ |
|||
ZEND_END_MODULE_GLOBALS(mime_magic) |
|||
|
|||
#ifdef ZTS |
|||
#define MIME_MAGIC_G(v) TSRMG(mime_magic_globals_id, zend_mime_magic_globals *, v) |
|||
#else |
|||
#define MIME_MAGIC_G(v) (mime_magic_globals.v) |
|||
#endif |
|||
|
|||
#endif /* PHPMIMEMAGIC_H */ |
|||
|
|||
/* |
|||
* Local variables: |
|||
* tab-width: 4 |
|||
* c-basic-offset: 4 |
|||
* indent-tabs-mode: t |
|||
* End: |
|||
*/ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue