includes/constants.php
changeset 1 fe660c52c48f
child 16 64e0d3d4cf14
equal deleted inserted replaced
0:902822492a68 1:fe660c52c48f
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
       
     5  * Version 1.0 (Banshee)
       
     6  * Copyright (C) 2006-2007 Dan Fuhry
       
     7  * constants.php - important defines used Enano-wide
       
     8  *
       
     9  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
       
    10  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
       
    11  *
       
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
       
    14  */
       
    15 
       
    16 // Ban types
       
    17 
       
    18 define('BAN_IP', 1);
       
    19 define('BAN_USER', 2);
       
    20 define('BAN_EMAIL', 3);
       
    21 
       
    22 // ACL permission types
       
    23 define('AUTH_ALLOW', 4);
       
    24 define('AUTH_WIKIMODE', 3); // User can do this if wiki mode is enabled
       
    25 define('AUTH_DISALLOW', 2);
       
    26 define('AUTH_DENY', 1);     // A Deny setting overrides *everything*
       
    27 
       
    28 define('ACL_TYPE_GROUP', 1);
       
    29 define('ACL_TYPE_USER', 2);
       
    30 define('ACL_TYPE_PRESET', 3);
       
    31 
       
    32 // System groups
       
    33 define('GROUP_ID_ADMIN', 2);
       
    34 define('GROUP_ID_MOD', 3);
       
    35 
       
    36 //
       
    37 // User types - don't touch these
       
    38 //
       
    39 
       
    40 // User can do absolutely everything
       
    41 define('USER_LEVEL_ADMIN', 9);
       
    42 
       
    43 // User can edit/[un]approve comments and do some basic administration
       
    44 define('USER_LEVEL_MOD', 5);
       
    45 
       
    46 // Default for members. When authed at this level, the user can change his/her password.
       
    47 define('USER_LEVEL_CHPREF', 3);
       
    48 
       
    49 // The level that you will be running at most of the time
       
    50 define('USER_LEVEL_MEMBER', 2);
       
    51 
       
    52 // Special level for guests
       
    53 define('USER_LEVEL_GUEST', 1);
       
    54 
       
    55 // Group status
       
    56 
       
    57 define('GROUP_CLOSED', 1);
       
    58 define('GROUP_REQUEST', 2);
       
    59 define('GROUP_HIDDEN', 3);
       
    60 define('GROUP_OPEN', 4);
       
    61 
       
    62 // Other stuff
       
    63 
       
    64 define('MAX_PMS_PER_BATCH', 7); // The maximum number of users that users can send PMs to in one go; restriction does not apply to users with mod_misc rights
       
    65 define('SEARCH_RESULTS_PER_PAGE', 10);
       
    66 define('MYSQL_MAX_PACKET_SIZE', 1048576); // 1MB; this is the default in MySQL 4.x I think
       
    67 define('SEARCH_MODE', 'FULLTEXT'); // Can be FULLTEXT or BUILTIN
       
    68 
       
    69 // Sidebar
       
    70 
       
    71 define('BLOCK_WIKIFORMAT', 0);
       
    72 define('BLOCK_TEMPLATEFORMAT', 1);
       
    73 define('BLOCK_HTML', 2);
       
    74 define('BLOCK_PHP', 3);
       
    75 define('BLOCK_PLUGIN', 4);
       
    76 define('SIDEBAR_LEFT', 1);
       
    77 define('SIDEBAR_RIGHT', 2);
       
    78 
       
    79 define('GENERAL_ERROR', 'General error');
       
    80 define('GENERAL_NOTICE', 'Information');
       
    81 define('CRITICAL_ERROR', 'Critical error');
       
    82 
       
    83 // You can un-comment the next line to require database backups to be encrypted using the site's unique key.
       
    84 // This keeps the file safe in transit, but also prevents any type of editing to the file. This is NOT
       
    85 // recommended except for tiny sites because encrypting an average of 2MB of data will take a while.
       
    86 // define('SQL_BACKUP_CRYPT', '');
       
    87 
       
    88 // Security
       
    89 
       
    90 define('AES_BITS', 192); // AES cipher strength - defaults to 192 and cannot be changed after installation
       
    91 
       
    92 // Define this to enable Mcrypt support which makes encryption work faster. This is only triggered if Mcrypt support is detected.
       
    93 // THIS IS DISABLED BECAUSE MCRYPT DOES NOT SEEM TO SUPPORT THE AES BLOCK SIZES THAT ENANO USES.
       
    94 //define('MCRYPT_ACCEL', '');
       
    95 
       
    96 //if(defined('MCRYPT_RIJNDAEL_' . AES_BITS))
       
    97 //{
       
    98 //  eval('$bs = MCRYPT_RIJNDAEL_' . AES_BITS . ';');
       
    99 //  $bs = mcrypt_module_get_algo_block_size($bs);
       
   100 //  $bs = $bs * 8;
       
   101 //  define('AES_BLOCKSIZE', $bs);
       
   102 //}
       
   103 // else
       
   104 // {
       
   105 //   define('AES_BLOCKSIZE', AES_BITS);
       
   106 // }
       
   107 
       
   108 define('AES_BLOCKSIZE', 128);
       
   109 
       
   110 /*
       
   111  * MIMETYPES
       
   112  *
       
   113  * This array defines the 166 known MIME types used by the Enano file-extension filter. Whether extensions are allowed or not is
       
   114  * determined by a bitfield in the config table.
       
   115  */
       
   116 
       
   117 global $mime_types, $mimetype_exps, $mimetype_extlist;
       
   118 
       
   119 // IMPORTANT: this array can NEVER have items removed from it or key indexes changed
       
   120 $mime_types = Array (
       
   121   'ai'      => 'application/postscript',
       
   122   'aif'     => 'audio/x-aiff',
       
   123   'aifc'    => 'audio/x-aiff',
       
   124   'aiff'    => 'audio/x-aiff',
       
   125   'au'      => 'audio/basic',
       
   126   'avi'     => 'video/x-msvideo',
       
   127   'bcpio'   => 'application/x-bcpio',
       
   128   'bin'     => 'application/octet-stream',
       
   129   'bmp'     => 'image/bmp',
       
   130   'bz2'     => 'application/x-bzip',
       
   131   'cdf'     => 'application/x-netcdf',
       
   132   'cgm'     => 'image/cgm',
       
   133   'class'   => 'application/octet-stream',
       
   134   'cpio'    => 'application/x-cpio',
       
   135   'cpt'     => 'application/mac-compactpro',
       
   136   'csh'     => 'application/x-csh',
       
   137   'css'     => 'text/css',
       
   138   'dcr'     => 'application/x-director',
       
   139   'dir'     => 'application/x-director',
       
   140   'djv'     => 'image/vnd.djvu',
       
   141   'djvu'    => 'image/vnd.djvu',
       
   142   'dll'     => 'application/octet-stream',
       
   143   'dms'     => 'application/octet-stream',
       
   144   'doc'     => 'application/msword',
       
   145   'dtd'     => 'application/xml-dtd',
       
   146   'dvi'     => 'application/x-dvi',
       
   147   'dxr'     => 'application/x-director',
       
   148   'eps'     => 'application/postscript',
       
   149   'etx'     => 'text/x-setext',
       
   150   'exe'     => 'application/octet-stream',
       
   151   'ez'      => 'application/andrew-inset',
       
   152   'gif'     => 'image/gif',
       
   153   'gram'    => 'application/srgs',
       
   154   'grxml'   => 'application/srgs+xml',
       
   155   'gtar'    => 'application/x-gtar',
       
   156   'gz'      => 'application/x-gzip',
       
   157   'hdf'     => 'application/x-hdf',
       
   158   'hqx'     => 'application/mac-binhex40',
       
   159   'htm'     => 'text/html',
       
   160   'html'    => 'text/html',
       
   161   'ice'     => 'x-conference/x-cooltalk',
       
   162   'ico'     => 'image/x-icon',
       
   163   'ics'     => 'text/calendar',
       
   164   'ief'     => 'image/ief',
       
   165   'ifb'     => 'text/calendar',
       
   166   'iges'    => 'model/iges',
       
   167   'igs'     => 'model/iges',
       
   168   'jar'     => 'application/zip',
       
   169   'jpe'     => 'image/jpeg',
       
   170   'jpeg'    => 'image/jpeg',
       
   171   'jpg'     => 'image/jpeg',
       
   172   'js'      => 'application/x-javascript',
       
   173   'kar'     => 'audio/midi',
       
   174   'latex'   => 'application/x-latex',
       
   175   'lha'     => 'application/octet-stream',
       
   176   'lzh'     => 'application/octet-stream',
       
   177   'm3u'     => 'audio/x-mpegurl',
       
   178   'man'     => 'application/x-troff-man',
       
   179   'mathml'  => 'application/mathml+xml',
       
   180   'me'      => 'application/x-troff-me',
       
   181   'mesh'    => 'model/mesh',
       
   182   'mid'     => 'audio/midi',
       
   183   'midi'    => 'audio/midi',
       
   184   'mif'     => 'application/vnd.mif',
       
   185   'mov'     => 'video/quicktime',
       
   186   'movie'   => 'video/x-sgi-movie',
       
   187   'mp2'     => 'audio/mpeg',
       
   188   'mp3'     => 'audio/mpeg',
       
   189   'mpe'     => 'video/mpeg',
       
   190   'mpeg'    => 'video/mpeg',
       
   191   'mpg'     => 'video/mpeg',
       
   192   'mpga'    => 'audio/mpeg',
       
   193   'ms'      => 'application/x-troff-ms',
       
   194   'msh'     => 'model/mesh',
       
   195   'mxu'     => 'video/vnd.mpegurl',
       
   196   'nc'      => 'application/x-netcdf',
       
   197   'oda'     => 'application/oda',
       
   198   'ogg'     => 'application/ogg',
       
   199   'ogm'     => 'application/ogg',
       
   200   'pbm'     => 'image/x-portable-bitmap',
       
   201   'pdb'     => 'chemical/x-pdb',
       
   202   'pdf'     => 'application/pdf',
       
   203   'pgm'     => 'image/x-portable-graymap',
       
   204   'pgn'     => 'application/x-chess-pgn',
       
   205   'png'     => 'image/png',
       
   206   'pnm'     => 'image/x-portable-anymap',
       
   207   'ppm'     => 'image/x-portable-pixmap',
       
   208   'ppt'     => 'application/vnd.ms-powerpoint',
       
   209   'ps'      => 'application/postscript',
       
   210   'psd'     => 'image/x-photoshop',
       
   211   'qt'      => 'video/quicktime',
       
   212   'ra'      => 'audio/x-realaudio',
       
   213   'ram'     => 'audio/x-pn-realaudio',
       
   214   'ras'     => 'image/x-cmu-raster',
       
   215   'rdf'     => 'text/xml',
       
   216   'rgb'     => 'image/x-rgb',
       
   217   'rm'      => 'audio/x-pn-realaudio',
       
   218   'roff'    => 'application/x-troff',
       
   219   'rpm'     => 'audio/x-pn-realaudio-plugin',
       
   220   'rss'     => 'text/xml',
       
   221   'rtf'     => 'text/rtf',
       
   222   'rtx'     => 'text/richtext',
       
   223   'sgm'     => 'text/sgml',
       
   224   'sgml'    => 'text/sgml',
       
   225   'sh'      => 'application/x-sh',
       
   226   'shar'    => 'application/x-shar',
       
   227   'silo'    => 'model/mesh',
       
   228   'sit'     => 'application/x-stuffit',
       
   229   'skd'     => 'application/x-koan',
       
   230   'skm'     => 'application/x-koan',
       
   231   'skp'     => 'application/x-koan',
       
   232   'skt'     => 'application/x-koan',
       
   233   'smi'     => 'application/smil',
       
   234   'smil'    => 'application/smil',
       
   235   'snd'     => 'audio/basic',
       
   236   'so'      => 'application/octet-stream',
       
   237   'spl'     => 'application/x-futuresplash',
       
   238   'src'     => 'application/x-wais-source',
       
   239   'stc'     => 'application/zip',
       
   240   'std'     => 'application/zip',
       
   241   'sti'     => 'application/zip',
       
   242   'stm'     => 'application/zip',
       
   243   'stw'     => 'application/zip',
       
   244   'sv4cpio' => 'application/x-sv4cpio',
       
   245   'sv4crc'  => 'application/x-sv4crc',
       
   246   'svg'     => 'image/svg+xml',
       
   247   'swf'     => 'application/x-shockwave-flash',
       
   248   'sxc'     => 'application/zip',
       
   249   'sxd'     => 'application/zip',
       
   250   'sxi'     => 'application/zip',
       
   251   'sxm'     => 'application/zip',
       
   252   'sxw'     => 'application/zip',
       
   253   't'       => 'application/x-troff',
       
   254   'tar'     => 'application/x-tar',
       
   255   'tcl'     => 'application/x-tcl',
       
   256   'tex'     => 'application/x-tex',
       
   257   'texi'    => 'application/x-texinfo',
       
   258   'texinfo' => 'application/x-texinfo',
       
   259   'tif'     => 'image/tiff',
       
   260   'tiff'    => 'image/tiff',
       
   261   'tr'      => 'application/x-troff',
       
   262   'tsv'     => 'text/tab-separated-values',
       
   263   'txt'     => 'text/plain',
       
   264   'ustar'   => 'application/x-ustar',
       
   265   'vcd'     => 'application/x-cdlink',
       
   266   'vrml'    => 'model/vrml',
       
   267   'vxml'    => 'application/voicexml+xml',
       
   268   'wav'     => 'audio/x-wav',
       
   269   'wbmp'    => 'image/vnd.wap.wbmp',
       
   270   'wbxml'   => 'application/vnd.wap.wbxml',
       
   271   'wml'     => 'text/vnd.wap.wml',
       
   272   'wmlc'    => 'application/vnd.wap.wmlc',
       
   273   'wmls'    => 'text/vnd.wap.wmlscript',
       
   274   'wmlsc'   => 'application/vnd.wap.wmlscriptc',
       
   275   'wrl'     => 'model/vrml',
       
   276   'xbm'     => 'image/x-xbitmap',
       
   277   'xcf'     => 'image/xcf',
       
   278   'xht'     => 'application/xhtml+xml',
       
   279   'xhtml'   => 'application/xhtml+xml',
       
   280   'xls'     => 'application/vnd.ms-excel',
       
   281   'xml'     => 'text/xml',
       
   282   'xpi'     => 'application/zip',
       
   283   'xpm'     => 'image/x-xpixmap',
       
   284   'xsl'     => 'text/xml',
       
   285   'xslt'    => 'text/xml',
       
   286   'xwd'     => 'image/x-xwindowdump',
       
   287   'xyz'     => 'chemical/x-xyz',
       
   288   'zip'     => 'application/zip',
       
   289 );
       
   290 
       
   291 $mimetype_extlist = Array(
       
   292   'application/andrew-inset'=>'ez',
       
   293   'application/mac-binhex40'=>'hqx',
       
   294   'application/mac-compactpro'=>'cpt',
       
   295   'application/mathml+xml'=>'mathml',
       
   296   'application/msword'=>'doc',
       
   297   'application/octet-stream'=>'bin dms lha lzh exe class so dll',
       
   298   'application/oda'=>'oda',
       
   299   'application/ogg'=>'ogg ogm',
       
   300   'application/pdf'=>'pdf',
       
   301   'application/postscript'=>'ai eps ps',
       
   302   'application/rdf+xml'=>'rdf',
       
   303   'application/smil'=>'smi smil',
       
   304   'application/srgs'=>'gram',
       
   305   'application/srgs+xml'=>'grxml',
       
   306   'application/vnd.mif'=>'mif',
       
   307   'application/vnd.ms-excel'=>'xls',
       
   308   'application/vnd.ms-powerpoint'=>'ppt',
       
   309   'application/vnd.wap.wbxml'=>'wbxml',
       
   310   'application/vnd.wap.wmlc'=>'wmlc',
       
   311   'application/vnd.wap.wmlscriptc'=>'wmlsc',
       
   312   'application/voicexml+xml'=>'vxml',
       
   313   'application/x-bcpio'=>'bcpio',
       
   314   'application/x-bzip'=>'gz bz2',
       
   315   'application/x-cdlink'=>'vcd',
       
   316   'application/x-chess-pgn'=>'pgn',
       
   317   'application/x-cpio'=>'cpio',
       
   318   'application/x-csh'=>'csh',
       
   319   'application/x-director'=>'dcr dir dxr',
       
   320   'application/x-dvi'=>'dvi',
       
   321   'application/x-futuresplash'=>'spl',
       
   322   'application/x-gtar'=>'gtar tar',
       
   323   'application/x-gzip'=>'gz',
       
   324   'application/x-hdf'=>'hdf',
       
   325   'application/x-jar'=>'jar',
       
   326   'application/x-javascript'=>'js',
       
   327   'application/x-koan'=>'skp skd skt skm',
       
   328   'application/x-latex'=>'latex',
       
   329   'application/x-netcdf'=>'nc cdf',
       
   330   'application/x-sh'=>'sh',
       
   331   'application/x-shar'=>'shar',
       
   332   'application/x-shockwave-flash'=>'swf',
       
   333   'application/x-stuffit'=>'sit',
       
   334   'application/x-sv4cpio'=>'sv4cpio',
       
   335   'application/x-sv4crc'=>'sv4crc',
       
   336   'application/x-tar'=>'tar',
       
   337   'application/x-tcl'=>'tcl',
       
   338   'application/x-tex'=>'tex',
       
   339   'application/x-texinfo'=>'texinfo texi',
       
   340   'application/x-troff'=>'t tr roff',
       
   341   'application/x-troff-man'=>'man',
       
   342   'application/x-troff-me'=>'me',
       
   343   'application/x-troff-ms'=>'ms',
       
   344   'application/x-ustar'=>'ustar',
       
   345   'application/x-wais-source'=>'src',
       
   346   'application/x-xpinstall'=>'xpi',
       
   347   'application/xhtml+xml'=>'xhtml xht',
       
   348   'application/xslt+xml'=>'xslt',
       
   349   'application/xml'=>'xml xsl',
       
   350   'application/xml-dtd'=>'dtd',
       
   351   'application/zip'=>'zip jar xpi  sxc stc  sxd std   sxi sti   sxm stm   sxw stw  ',
       
   352   'audio/basic'=>'au snd',
       
   353   'audio/midi'=>'mid midi kar',
       
   354   'audio/mpeg'=>'mpga mp2 mp3',
       
   355   'audio/ogg'=>'ogg ',
       
   356   'audio/x-aiff'=>'aif aiff aifc',
       
   357   'audio/x-mpegurl'=>'m3u',
       
   358   'audio/x-ogg'=>'ogg ',
       
   359   'audio/x-pn-realaudio'=>'ram rm',
       
   360   'audio/x-pn-realaudio-plugin'=>'rpm',
       
   361   'audio/x-realaudio'=>'ra',
       
   362   'audio/x-wav'=>'wav',
       
   363   'chemical/x-pdb'=>'pdb',
       
   364   'chemical/x-xyz'=>'xyz',
       
   365   'image/bmp'=>'bmp',
       
   366   'image/cgm'=>'cgm',
       
   367   'image/gif'=>'gif',
       
   368   'image/ief'=>'ief',
       
   369   'image/jpeg'=>'jpeg jpg jpe',
       
   370   'image/png'=>'png',
       
   371   'image/svg+xml'=>'svg',
       
   372   'image/tiff'=>'tiff tif',
       
   373   'image/vnd.djvu'=>'djvu djv',
       
   374   'image/vnd.wap.wbmp'=>'wbmp',
       
   375   'image/x-cmu-raster'=>'ras',
       
   376   'image/x-icon'=>'ico',
       
   377   'image/x-portable-anymap'=>'pnm',
       
   378   'image/x-portable-bitmap'=>'pbm',
       
   379   'image/x-portable-graymap'=>'pgm',
       
   380   'image/x-portable-pixmap'=>'ppm',
       
   381   'image/x-rgb'=>'rgb',
       
   382   'image/x-photoshop'=>'psd',
       
   383   'image/x-xbitmap'=>'xbm',
       
   384   'image/x-xpixmap'=>'xpm',
       
   385   'image/x-xwindowdump'=>'xwd',
       
   386   'model/iges'=>'igs iges',
       
   387   'model/mesh'=>'msh mesh silo',
       
   388   'model/vrml'=>'wrl vrml',
       
   389   'text/calendar'=>'ics ifb',
       
   390   'text/css'=>'css',
       
   391   'text/html'=>'html htm',
       
   392   'text/plain'=>'txt',
       
   393   'text/richtext'=>'rtx',
       
   394   'text/rtf'=>'rtf',
       
   395   'text/sgml'=>'sgml sgm',
       
   396   'text/tab-separated-values'=>'tsv',
       
   397   'text/vnd.wap.wml'=>'wml',
       
   398   'text/vnd.wap.wmlscript'=>'wmls',
       
   399   'text/xml'=>'xml xsl xslt rss rdf',
       
   400   'text/x-setext'=>'etx',
       
   401   'video/mpeg'=>'mpeg mpg mpe',
       
   402   'video/ogg'=>'ogm ogg',
       
   403   'video/quicktime'=>'qt mov',
       
   404   'video/vnd.mpegurl'=>'mxu',
       
   405   'video/x-msvideo'=>'avi',
       
   406   'video/x-ogg'=>'ogm ogg',
       
   407   'video/x-sgi-movie'=>'movie',
       
   408   'x-conference/x-cooltalk'=>'ice',
       
   409   // Added for Enano
       
   410   'image/xcf' => 'xcf xcfbz2 xcf.bz2',
       
   411 );
       
   412 
       
   413 $k = array_keys($mime_types);
       
   414 $mimetype_exps = Array();
       
   415 foreach($k as $s => $x)
       
   416 {
       
   417   $mimetype_exps[$x] = pow(2, $s);
       
   418 }
       
   419 
       
   420 unset($k, $s, $x);