<?
/*
*
- * LODEL - Logiciel d'Edition ELectronique3.
+ * LODEL - Logiciel d'Edition ELectronique.
*
* Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos
* Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
+ * Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
*
* Home page: http://www.lodel.org
*
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/
+require_once 'unset_globals.php';
+
$GLOBALS[prefixregexp]="Pr\.|Dr\.";
//
global $home;
$localcontext=$context;
- //xml_parse_into_struct_ns($text,&$vals,&$index);
$result=mysql_query("SELECT $GLOBALS[tp]champs.nom,style,type,traitement FROM $GLOBALS[tp]champs,$GLOBALS[tp]groupesdechamps WHERE idgroupe=$GLOBALS[tp]groupesdechamps.id AND classe='$classe' AND $GLOBALS[tp]champs.statut>0 AND $GLOBALS[tp]groupesdechamps.statut>0 AND style!=''") or die (mysql_error());
$value=$result2[1];
// type speciaux
+ /* done in entitefunc.php
if ($type=="date") { // date
require_once($home."date.php");
$value=mysqldate(strip_tags($value));
}
-
+ */
+ #echo "traitement:$traitement";
if ($traitement) { // processing ?
$traitements=preg_split("/\|/",$traitement);
foreach ($traitements as $traitement) {
#echo "trait: $traitement";
- if (preg_match("/^([A-Za-z][A-Za-z_0-9]*)(?:\((.*?)\))?$/",$traitement,$result3)) {
- if ($result3[2]) $result3[2]=$result3[2].",";
- $func=create_function('$x','return '.$result3[1].'('.$result3[2].'$x);');
+ if (preg_match("/^([A-Za-z][A-Za-z_0-9]*)(?:\((.*)\))?$/",$traitement,$result3)) {
+ if ($result3[2]) $result3[2]=",".$result3[2]; // arguments
+ $func=create_function('$x','return '.$result3[1].'($x'.$result3[2].');');
$value=$func($value);
}
}
list($localcontext[idtype])=mysql_fetch_row($result);
}
- enregistre_personnes_from_xml(&$localcontext,$text);
- enregistre_entrees_from_xml(&$localcontext,$text);
+ enregistre_personnes_from_xml($localcontext,$text);
+ enregistre_entrees_from_xml($localcontext,$text);
# print_r($localcontext);
# print_r($localcontext);
- $id=enregistre_entite (&$localcontext,0,$classe,"",FALSE); // on ne genere pas d'erreur... Tant pis !
+ $id=enregistre_entite ($localcontext,0,$classe,"",FALSE); // on ne genere pas d'erreur... Tant pis !
- // ok, maintenant, il faut rechercher les images et corriger leur location.
+ // ok, now, search for the image, and place them in a safe place
function mv_image($imgfile,$ext,$count,$id) {
- $dir="docannexe/$id";
- if (!is_dir("../../".$dir)) mkdir("../../".$dir,0700);
+ $dir="docannexe/image/$id";
+ if (!is_dir(SITEROOT.$dir)) {
+ mkdir(SITEROOT.$dir,0777 & octdec($GLOBALS['filemask']));
+ @chmod(SITEROOT.$dir,0777 & octdec($GLOBALS['filemask']));
+ }
$newfile="$dir/img-$count.$ext";
- copy($imgfile,"../../".$newfile);
+ copy($imgfile,SITEROOT.$newfile);
@unlink($imgfile);
return $newfile;
}
return $id;
}
+function mystrip_tags($x,$y) { return strip_tags($y,$x); }
if ($nom) {
$prenom=str_replace($nom,"",$personne);
} else { // sinon coupe apres le premiere espace
- if (preg_match("/^\s*(.*?)\s+([^\s]+)\s*$/i",$personne,$result)) {
+ if (preg_match("/^(.*?)\s+([^\s]+)$/i",trim($personne),$result)) {
$prenom=$result[1]; $nom=$result[2];
} else $nom=$personne;
}
if (!$localcontext[idtype]) die("Internal ERROR: probleme in enregistre_personnes_from_xml");
- $result=mysql_query("SELECT id,style FROM $GLOBALS[tp]typeentrees,$GLOBALS[tp]typeentites_typeentrees WHERE statut>0 AND idtypeentree=id AND idtypeentree='$lodelcontext[idtype]'") or die (mysql_error());
+ $result=mysql_query("SELECT id,style FROM $GLOBALS[tp]typeentrees,$GLOBALS[tp]typeentites_typeentrees WHERE statut>0 AND idtypeentree=id AND idtypeentite='$localcontext[idtype]'") or die (mysql_error());
require_once($home."champfunc.php");
while (list($idtype,$style)=mysql_fetch_row($result)) {
// decode the multilingue style.
$styles=decode_mlstyle($style);
+# echo $idtype," ",$style,"<br/>";
+ $i=0;
foreach($styles as $lang => $style) { // foreach multilingue style
-
+# echo "=>$lang $style";
preg_match_all ("/<r2r:$style>\s*(.*?)\s*<\/r2r:$style>/si",$text,$results2,PREG_SET_ORDER);
- $i=0;
foreach ($results2 as $result2) {
$val=strip_tags($result2[1]);
$tags=preg_split ("/[,;]/",strip_tags($val));
}
}
}
+# print_r($localcontext);
}