phpDocumentor lodel
[ class tree: lodel ] [ index: lodel ] [ all elements ]

Source for file fieldfunc.php

Documentation is available at fieldfunc.php

  1. <?php
  2. /**
  3.  * Fichier de définition des types de champs de Lodel
  4.  *
  5.  * PHP versions 4 et 5
  6.  *
  7.  * LODEL - Logiciel d'Edition ELectronique.
  8.  *
  9.  * Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos
  10.  * Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
  11.  * Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
  12.  * Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  13.  * Copyright (c) 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  14.  * Copyright (c) 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  15.  *
  16.  * Home page: http://www.lodel.org
  17.  *
  18.  * E-Mail: lodel@lodel.org
  19.  *
  20.  * All Rights Reserved
  21.  *
  22.  * This program is free software; you can redistribute it and/or modify
  23.  * it under the terms of the GNU General Public License as published by
  24.  * the Free Software Foundation; either version 2 of the License, or
  25.  * (at your option) any later version.
  26.  *
  27.  * This program is distributed in the hope that it will be useful,
  28.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  30.  * GNU General Public License for more details.
  31.  *
  32.  * You should have received a copy of the GNU General Public License
  33.  * along with this program; if not, write to the Free Software
  34.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  35.  *
  36.  * @author Ghislain Picard
  37.  * @author Jean Lamy
  38.  * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  39.  * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  40.  * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  41.  * @licence http://www.gnu.org/copyleft/gpl.html
  42.  * @version CVS:$Id:
  43.  * @package lodel
  44.  * @since Fichier ajouté depuis la version 0.8
  45.  */
  46.  
  47. //Gestion des champs génériques
  48.  
  49. // Champs génériques pour les types d'index
  50. $GLOBALS['g_entrytypes_fields'array ('DC.Subject''DC.Coverage''DC.Rights''oai.set');
  51. // Champs génériques pour les types d'index de personnes
  52. $GLOBALS['g_persontypes_fields'array('DC.Creator''DC.Contributor');
  53. //Champs génériques pour les entités
  54. $GLOBALS['g_entities_fields'array(
  55.                     // Champs Dublin Core
  56.                     'DC.Title',
  57.                     'DC.Description',
  58.                     'DC.Publisher',
  59.                     'DC.Date',
  60.                     'DC.Format',
  61.                     'DC.Identifier',
  62.                     'DC.Source',
  63.                     'DC.Type',
  64.                     'DC.Language',
  65.                     'DC.Relation',
  66.                     'DC.Coverage',
  67.                     'DC.Rights',
  68.                     'DC.Creator',
  69.                     'DCTERMS.accessRights',
  70.                     'DCTERMS.issued',
  71.                     'DCTERMS.available',
  72.                     'DCTERMS.bibliographicCitation',
  73.                     'DCTERMS.bibliographicCitation.volume',
  74.                     'DCTERMS.bibliographicCitation.issue',
  75.                     'DCTERMS.extent',
  76.                     'DCTERMS.isPartOf',
  77.                     'DCTERMS.alternative',
  78.                     'DCTERMS.abstract',
  79.                     'DCTERMS.ISSN',
  80.                     'DCTERMS.EISSN',
  81.                     'generic_icon');
  82. //Champs génériques pour les entrées d'index
  83. $GLOBALS['g_entries_fields'array('Index key');
  84. //Champs génériques pour les entrées d'index de personnes
  85. $GLOBALS['g_persons_fields'array('Firstname''Familyname''Title');
  86. //Champs génériques pour les champs liés aux personnes et aux entités
  87. $GLOBALS['g_entities_persons_fields'array('Title');
  88.  
  89.  
  90.  
  91.  
  92. // If you add a type in this list, please update the XML Schema template
  93.     $GLOBALS['lodelfieldtypes'
  94.         array ('tinytext' => array ('sql' => 'tinytext'),
  95.                     'text' => array ('sql' => 'text'),
  96.                     'mltext' => array ('sql' => 'text'),
  97.                     'image' => array ('sql' => 'tinytext''autostriptags' => true),
  98.                     'file' => array ('sql' => 'tinytext''autostriptags' => true),
  99.                      'url' => array ('sql' => 'text''autostriptags' => true),
  100.                     'email' => array ('sql' => 'text''autostriptags' => true),
  101.                     'color' => array ('sql' => 'char(10)''autostriptags' => true),
  102.                     'date' => array ('sql' => 'date''autostriptags' => true),
  103.                     'datetime' => array ('sql' => 'datetime''autostriptags' => true),
  104.                     'time' => array ('sql' => 'time''autostriptags' => true),
  105.                     'int' => array ('sql' => 'int''autostriptags' => true),
  106.                     'boolean' => array ('sql' => 'tinyint''autostriptags' => true),
  107.                     'number' => array ('sql' => 'double precision''autostriptags' => true),
  108.                     'lang' => array ('sql' => 'char(5)''autostriptags' => true),
  109.                     'longtext' => array ('sql' => 'longtext'),
  110.                     'passwd' => array ('sql' => 'tinytext',),
  111.                     'entities' => array ('autostriptags' => true),
  112.                     'list' => array ('sql' => 'text''autostriptags' => true),
  113.                     'username' => array ('sql' => 'tinytext''autostriptags' => true),
  114.                     'type' => array ()'class' => array (),
  115.                     'tablefield' => array ()
  116.                     'style' => array ()
  117.                     'mlstyle' => array ()
  118.                     'tplfile' => array ()
  119.                     'history' => array ('sql' => 'text'# history is a type of field which is automaticly set when used
  120.     );
  121.  
  122. // le style doit etre parfaitement valide
  123. /**
  124.  * Décode le style multilingue - détection de la langue
  125.  * @param string $style le ou les styles à décoder
  126.  * @return un tableau contenant la liste des styles décodés
  127.  */
  128. function decode_mlstyle($style)
  129. {
  130.     $styles preg_split("/[\n,]/"$style);
  131.     if (!$styles)    {
  132.         return array ();
  133.     }
  134.  
  135.     foreach ($styles as $style)    {
  136.         $ind strpos($style":");
  137.         if ($ind === FALSE)    {
  138.             $stylesassoc["--"trim($style);
  139.         }    else {
  140.             $lang trim(substr($style$ind +1));
  141.             $stylesassoc[$langtrim(substr($style0$ind));
  142.         }
  143.     }
  144.     return $stylesassoc;
  145. }
  146.  
  147. /**
  148.  * Indique si un mot est un mot réservé par Lodel
  149.  *
  150.  * @param string $name le mot
  151.  * @return boolean un booleen indiquant si le mot est reservé ou non
  152.  */
  153. function reservedword($name)
  154. {
  155.     static $reserved_words;
  156.     if (!$reserved_words{
  157.         $reserved_words array ('ADD''ALL''ALTER''ANALYZE''AND''AS''ASC''ASENSITIVE'
  158.                                                         'AUTO_INCREMENT''BDB''BEFORE''BERKELEYDB''BETWEEN''BIGINT'
  159.                                                         'BINARY''BLOB''BOTH''BTREE''BY''CALL''CASCADE''CASE'
  160.                                                         'CHANGE''CHAR''CHARACTER''CHECK''CLASSE''COLLATE''COLUMN'
  161.                                                         'COLUMNS''CONDITION''CONNECTION''CONSTRAINT''CREATE''CROSS''CURRENT_DATE'
  162.                                                         'CURRENT_TIME''CURRENT_TIMESTAMP''CURSOR''DATABASE''DATABASES'
  163.                                                         'DAY_HOUR''DAY_MICROSECOND''DAY_MINUTE''DAY_SECOND''DEC''DECIMAL'
  164.                                                         'DECLARE''DEFAULT''DELAYED''DELETE''DESC''DESCRIBE''DISTINCT'
  165.                                                         'DISTINCTROW''DIV''DOUBLE''DROP''ELSE''ELSEIF''ENCLOSED'
  166.                                                         'ERRORS''ESCAPED''EXISTS''EXPLAIN''FALSE''FIELDS''FLOAT'
  167.                                                         'FOR''FORCE''FOREIGN''FROM''FULLTEXT''GRANT''GROUP''GROUPE'
  168.                                                         'HASH''HAVING''HIGH_PRIORITY''HOUR_MICROSECOND''HOUR_MINUTE'
  169.                                                         'HOUR_SECOND''IF''IGNORE''IN''INDEX''INFILE''INNER''INNODB'
  170.                                                         'INOUT''INSENSITIVE''INSERT''INT''INTEGER''INTERVAL''INTO'
  171.                                                         'IO_THREAD''IS''ITERATE''JOIN''KEY''KEYS''KILL''LEADING'
  172.                                                         'LEAVE''LEFT''LIKE''LIMIT''LINES''LOAD''LOCALTIME'
  173.                                                         'LOCALTIMESTAMP''LOCK''LONG''LONGBLOB''LONGTEXT''LOOP'
  174.                                                         'LOW_PRIORITY''MAJ''MASTER_SERVER_ID''MATCH''MEDIUMBLOB'
  175.                                                         'MEDIUMINT''MEDIUMTEXT''MIDDLEINT''MINUTE_MICROSECOND'
  176.                                                         'MINUTE_SECOND''MOD''MRG_MYISAM''NATURAL''NAME''NOT'
  177.                                                         'NO_WRITE_TO_BINLOG''NULL''NUMERIC''ON''OPTIMIZE''OPTION'
  178.                                                         'OPTIONALLY''OR''ORDER''OUT''OUTER''OUTFILE''PRECISION'
  179.                                                         'PRIMARY''PRIVILEGES''PROCEDURE''PURGE''READ''REAL'
  180.                                                         'REFERENCES''REGEXP''RENAME''REPEAT''REPLACE''REQUIRE'
  181.                                                         'RESTRICT''RETURN''RETURNS''REVOKE''RIGHT''RLIKE'
  182.                                                         'RTREE''SECOND_MICROSECOND''SELECT''SENSITIVE''SEPARATOR''SET'
  183.                                                         'SHOW''SMALLINT''SOME''SONAME''SPATIAL''SPECIFIC'
  184.                                                         'SQL_BIG_RESULT''SQL_CALC_FOUND_ROWS''SQL_SMALL_RESULT''SSL'
  185.                                                         'STARTING''STRAIGHT_JOIN''STRIPED''TABLE''TABLES''TERMINATED'
  186.                                                         'THEN''TINYBLOB''TINYINT''TINYTEXT''TO''TRAILING''TRUE'
  187.                                                         'TYPE''TYPES''UNION''UNIQUE''UNLOCK''UNSIGNED''UNTIL'
  188.                                                         'UPDATE''USAGE''USE''USER_RESOURCES''USING''UTC_DATE'
  189.                                                         'UTC_TIME''UTC_TIMESTAMP''VALUES''VARBINARY''VARCHAR'
  190.                                                         'VARCHARACTER''VARYING''WARNINGS''WHEN''WHERE''WHILE'
  191.                                                         'WITH''WRITE''XOR''YEAR_MONTH''ZEROFILL',
  192.                                                         # reservé par LODEL
  193.                                                         'STATUS''RANK''CLASS''TYPE''ID''IDENTITY''IDRELATION''IDPARENT''IDTYPE''IDUSER''IDPERSON''IDENTRY''ERROR''TPL''TPLCREATION''TPLEDITION''EDIT',);
  194.     }
  195.     return (in_array(strtoupper($name)$reserved_words));
  196. }
  197. /**
  198.  * check if a string contain a word reserved by Lodel
  199.  *
  200.  * @param string $name the string to check
  201.  * @return boolean true if $name is contained in the reserved words array
  202.  */
  203. function reservedByLodel($name)
  204. {
  205.     static $reserved_lodel;
  206.     if (!$reserved_lodel{
  207.         $reserved_lodel array ('ENTITIES''ENTRIES''PERSONS''CHARACTERSTYLES''CLASSES'
  208.                                                         'ENTITYTYPES_ENTITYTYPES''ENTRYTYPES''INTERNALSTYLES''OBJECTS'
  209.                                                         'OPTIONGROUPS''OPTIONS''PERSONTYPES''RELATIONS''SEARCH_ENGINE'
  210.                                                         'SESSION''SITES''TABLEFIELDGROUPS''TABLEFIELDS''TASKS'
  211.                                                         'TRANSLATIONS''TYPES''TEXTS''URLSTACK''USERGROUPS''USERS'
  212.                                                         'USERS_USERGROUPS');
  213.     }
  214.     return (in_array(strtoupper($name)$reserved_lodel));
  215. }
  216. ?>

Documentation generated on Thu, 10 Jul 2008 05:07:31 +0200 by phpDocumentor 1.4.0a2