Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Ignore whitespace Rev 262 → Rev 261

/trunk/applications/jrest/services/OdsEvenement.php
69,7 → 69,7
$evenements_pour_espece = $this->executerRequete($requete_evenements_pour_espece);
$evenements_pour_espece = $evenements_pour_espece[0]['oe_ce_evenements'];
$tableau_evenements_espece = explode(',',$evenements_pour_espece);
$tableau_evenements_espece = split(',',$evenements_pour_espece);
foreach($tableau_evenements_espece as &$evenement_espece) {
$evenement_espece = $this->proteger($evenement_espece);
}
/trunk/applications/jrest/services/OdsObservation.php
208,7 → 208,7
private function renvoyerIdEvenementSiChampDeFormulaireObservation($champ) {
$tab_champ = explode('observation_',$champ);
$tab_champ = split('observation_',$champ);
if(count($tab_champ) > 1 && is_numeric($tab_champ[1])) {
return $tab_champ[1];
230,7 → 230,7
$pattern_date_simple = str_replace($recherche, $remplacement, $format);
$date_tab = explode('/', $date);
$date_tab = split('/', $date);
$time = mktime(0,0,0,$date_tab[1],$date_tab[0],$date_tab[2]);
if($this->estUneDateInvalide($date_tab[1],$date_tab[0],$date_tab[2])) {
/trunk/applications/jrest/services/OdsTriple.php
89,7 → 89,7
protected function renvoyerInformationStadeAPartirChaineTriple($stade_observation_complet) {
$infos_stades = explode('_',$stade_observation_complet);
$infos_stades = split('_',$stade_observation_complet);
$titre_numero_stade = array('nom','abreviation','numero');
if($this->estUnEvenementAvecDesSousStades($stade_observation_complet)) {
119,7 → 119,7
protected function estUnEvenementAvecDesSousStades($evenement) {
$infos_stades = explode('_',$evenement);
$infos_stades = split('_',$evenement);
if(count($infos_stades) <= 3) {
return false;
/trunk/applications/jrest/services/OdsSyndicationObservation.php
370,7 → 370,7
private function estUneDateSqlInvalide($date) {
$date_tab = explode('-', $date);
$date_tab = split('-', $date);
return ($date_tab[2] == '00' || $date_tab[1] == '00' || $date_tab[0] == '0000');
}
/trunk/applications/jrest/services/OdsMarqueur.php
11,7 → 11,7
public function getElement() {
if(isset($_GET['couleurs'])) {
$couleurs = explode(',',$_GET['couleurs']);
$couleurs = split(',',$_GET['couleurs']);
}
$taille = 15;
/trunk/applications/jrest/services/JRestService.php
334,7 → 334,7
public function isAdmin($id) {
$admins = $this->config['jrest_admin']['admin'];
$admin_tab = explode(',',$admins);
$admin_tab = split(',',$admins);
 
if (in_array($id,$admin_tab)) {
return true;
/trunk/applications/jrest/services/OdsImageEspece.php
165,7 → 165,7
if(isset($this->config['appli']['format_'.$format])) {
$format_largeur_hauteur = explode('_', $this->config['appli']['format_'.$format]);
$format_largeur_hauteur = split('_', $this->config['appli']['format_'.$format]);
$dimensions['largeur'] = $format_largeur_hauteur[0];
$dimensions['hauteur'] = $format_largeur_hauteur[1];
/trunk/applications/jrest/lib/JrestService.php
New file
0,0 → 1,128
<?php
/**
* PHP Version 5
*
* @category PHP
* @package jrest
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2009 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version $$id$$
* @link /doc/jrest/
*/
 
class JrestService {
 
protected $config;
protected $script_time;
protected $max_exec_time;
 
public function JrestService($config) {
$this->config = config;
$this->script_time = microtime(true);
$this->max_exec_time = ini_get('max_execution_time');
}
 
public function isAdmin($id) {
$admins = $this->config['jrest_admin']['admin'];
$admin_tab = split(',',$admins);
 
if (in_array($id,$admin_tab)) {
return true;
} else {
return false;
}
}
 
public function controleUtilisateur($id) {
if ($_SESSION['user']['name'] == '') {
//cas de la session temporaire, on ne fait rien de particulier
} else {
if (!$this->isAdmin($_SESSION['user']['name']) && $_SESSION['user']['name'] != $id) {
// cas d'usurpation d'identité
print 'Accès interdit';
exit();
}
}
}
 
public function logger($index,$chaine) {
if(!class_exists('Log')) {
include_once('Log.php');
Log::getInstance();
}
 
Log::setCheminLog($this->config['log']['cheminlog']);
Log::setTimeZone($this->config['log']['timezone']);
Log::setTailleMax($this->config['log']['taillemax']);
 
Log::ajouterEntree($index,$chaine);
}
 
public function verifierOuRelancerExecution() {
 
if((microtime(true) - $this->script_time) > ($this->max_exec_time - 5)*100) {
set_time_limit(2);
$this->logger('JRestService','Durée du script augmentée :'.microtime(true).' - '.$this->script_time.'.) > ('.$this->max_exec_time.' - 5)*1000000');
return true;
}
return false;
}
/**
* Méthode prenant en paramètre un chemin de fichier squelette et un tableau associatif de données,
* en extrait les variables, charge le squelette et retourne le résultat des deux combinés.
*
* @param String $fichier le chemin du fichier du squelette
* @param Array $donnees un tableau associatif contenant les variables a injecter dans le squelette.
*
* @return boolean false si le squelette n'existe pas, sinon la chaine résultat.
*/
public static function traiterSquelettePhp($fichier, Array $donnees = array()) {
$sortie = false;
if (file_exists($fichier)) {
// Extraction des variables du tableau de données
extract($donnees);
// Démarage de la bufferisation de sortie
ob_start();
// Si les tags courts sont activés
if ((bool) @ini_get('short_open_tag') === true) {
// Simple inclusion du squelette
include $fichier;
} else {
// Sinon, remplacement des tags courts par la syntaxe classique avec echo
$html_et_code_php = self::traiterTagsCourts($fichier);
// Pour évaluer du php mélangé dans du html il est nécessaire de fermer la balise php ouverte par eval
$html_et_code_php = '?>'.$html_et_code_php;
// Interprétation du html et du php dans le buffer
echo eval($html_et_code_php);
}
// Récupèration du contenu du buffer
$sortie = ob_get_contents();
// Suppression du buffer
@ob_end_clean();
} else {
$msg = "Le fichier du squelette '$fichier' n'existe pas.";
trigger_error($msg, E_USER_WARNING);
}
// Retourne le contenu
return $sortie;
}
/**
* Fonction chargeant le contenu du squelette et remplaçant les tags court php (<?= ...) par un tag long avec echo.
*
* @param String $chemin_squelette le chemin du fichier du squelette
*
* @return string le contenu du fichier du squelette php avec les tags courts remplacés.
*/
private static function traiterTagsCourts($chemin_squelette) {
$contenu = file_get_contents($chemin_squelette);
// Remplacement de tags courts par un tag long avec echo
$contenu = str_replace('<?=', '<?php echo ', $contenu);
// Ajout systématique d'un point virgule avant la fermeture php
$contenu = preg_replace("/;*\s*\?>/", "; ?>", $contenu);
return $contenu;
}
}
?>
/trunk/applications/jrest/lib/WdHTMLParser.php
31,7 → 31,7
// i+2 => the markup it self, without the '<' '>'
//
// note that i+2 might end with a '/' indicating an auto-closing markup
$this->matches = preg_explode('#<(/?)' . $namespace . '([^>]*)>#', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
$this->matches = preg_split('#<(/?)' . $namespace . '([^>]*)>#', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
// the flat representation is now ready, we can create our tree
$tree = $this->buildTree();
/trunk/applications/jrest/lib/Spreadsheet/Excel/Writer/Worksheet.php
1187,7 → 1187,7
$row = $match[2];
// Convert base26 column string to number
$chars = explode('', $col);
$chars = split('', $col);
$expn = 0;
$col = 0;
1217,7 → 1217,7
$i = 1; // char position
// split the plain text password in its component characters
$chars = preg_explode('//', $plaintext, -1, PREG_SPLIT_NO_EMPTY);
$chars = preg_split('//', $plaintext, -1, PREG_SPLIT_NO_EMPTY);
foreach($chars as $char)
{
$value = ord($char) << $i; // shifted ASCII value
1685,7 → 1685,7
$options = pack("V", 0x03);
// Convert URL to a null terminated wchar string
$url = join("\0", preg_explode("''", $url, -1, PREG_SPLIT_NO_EMPTY));
$url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY));
$url = $url . "\0\0\0";
// Pack the length of the URL
1747,7 → 1747,7
$options = pack("V", 0x08);
// Convert the URL type and to a null terminated wchar string
$url = join("\0", preg_explode("''", $url, -1, PREG_SPLIT_NO_EMPTY));
$url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY));
$url = $url . "\0\0\0";
// Pack the length of the URL as chars (not wchars)
1830,13 → 1830,13
// Determine if the link contains a sheet reference and change some of the
// parameters accordingly.
// Split the dir name and sheet name (if it exists)
list($dir_long , $sheet) = explode('/\#/', $url);
list($dir_long , $sheet) = split('/\#/', $url);
$link_type = 0x01 | $absolute;
if (isset($sheet)) {
$link_type |= 0x08;
$sheet_len = pack("V", strlen($sheet) + 0x01);
$sheet = join("\0", explode('', $sheet));
$sheet = join("\0", split('', $sheet));
$sheet .= "\0\0\0";
}
else {
1855,7 → 1855,7
$dir_short = preg_replace('/\.\.\\/', '', $dir_long) . "\0";
// Store the long dir name as a wchar string (non-null terminated)
$dir_long = join("\0", explode('', $dir_long));
$dir_long = join("\0", split('', $dir_long));
$dir_long = $dir_long . "\0";
// Pack the lengths of the dir strings
/trunk/applications/jrest/lib/Spreadsheet/Excel/Writer/Parser.php
646,10 → 646,10
// Split the range into 2 cell refs
if(preg_match("/^([A-I]?[A-Z])(\d+)\:([A-I]?[A-Z])(\d+)$/",$range)) {
list($cell1, $cell2) = explode(':', $range);
list($cell1, $cell2) = split(':', $range);
}
elseif(preg_match("/^([A-I]?[A-Z])(\d+)\.\.([A-I]?[A-Z])(\d+)$/",$range)) {
list($cell1, $cell2) = explode('\.\.', $range);
list($cell1, $cell2) = split('\.\.', $range);
}
else {
698,7 → 698,7
$class = 2; // as far as I know, this is magick.
// Split the ref at the ! symbol
list($ext_ref, $range) = explode('!', $token);
list($ext_ref, $range) = split('!', $token);
// Convert the external reference part
$ext_ref = $this->_packExtRef($ext_ref);
707,7 → 707,7
}
// Split the range into 2 cell refs
list($cell1, $cell2) = explode(':', $range);
list($cell1, $cell2) = split(':', $range);
// Convert the cell references
if (preg_match("/^(\$)?[A-I]?[A-Z](\$)?(\d+)$/", $cell1))
796,7 → 796,7
$class = 2; // as far as I know, this is magick.
// Split the ref at the ! symbol
list($ext_ref, $cell) = explode('!', $cell);
list($ext_ref, $cell) = split('!', $cell);
// Convert the external reference part
$ext_ref = $this->_packExtRef($ext_ref);
840,7 → 840,7
// Check if there is a sheet range eg., Sheet1:Sheet2.
if (preg_match("/:/", $ext_ref))
{
list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
list($sheet_name1, $sheet_name2) = split(':', $ext_ref);
$sheet1 = $this->_getSheetIndex($sheet_name1);
if ($sheet1 == -1) {
1430,7 → 1430,7
}
else {
return new PEAR_Error("Sintactic error: coma expected in ".
"function $function, {$num_args}� arg");
"function $function, {$num_args}º arg");
}
$result2 = $this->_condition();
if($this->isError($result2)) {
/trunk/applications/jrest/lib/DB/common.php
777,7 → 777,7
*/
function prepare($query)
{
$tokens = preg_explode('/((?<!\\\)[&?!])/', $query, -1,
$tokens = preg_split('/((?<!\\\)[&?!])/', $query, -1,
PREG_SPLIT_DELIM_CAPTURE);
$token = 0;
$types = array();
/trunk/applications/rendu/squelettes/js/commun.js
299,7 → 299,7
$.get(getUrlBaseJrest()+'OdsExport/ExportObservationJson/'+requete, function(data) {
infos_observations = data;
infos_observations = jQuery.parseJSON(data);
if(tableau_marqueurs.length > 0) {
viderMarqueurs();
/trunk/applications/saisie/controleurs/Observation.php
152,7 → 152,7
private function renvoyerIdEvenementSiChampDeFormulaireObservation($champ) {
$tab_champ = explode('observation_',$champ);
$tab_champ = split('observation_',$champ);
if(count($tab_champ) > 1 && is_numeric($tab_champ[1])) {
return $tab_champ[1];