X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Fiterateur%2Fdata.php;h=4bd93c4789c3abce7cc558d4f387d44c7458a007;hp=aec48ae5f1b4b9a1b40c5d2cf8dbb8e4547482b9;hb=122c920eb07e3f665789f8734965b576e6c25515;hpb=226942065cd4f604eb464addf45a065c9e5bc916 diff --git a/www/ecrire/iterateur/data.php b/www/ecrire/iterateur/data.php index aec48ae5..4bd93c47 100644 --- a/www/ecrire/iterateur/data.php +++ b/www/ecrire/iterateur/data.php @@ -3,7 +3,7 @@ /***************************************************************************\ * SPIP, Systeme de publication pour l'internet * * * - * Copyright (c) 2001-2012 * + * Copyright (c) 2001-2014 * * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * * * * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * @@ -12,6 +12,7 @@ if (!defined('_ECRIRE_INC_VERSION')) return; +if (!defined('_DATA_SOURCE_MAX_SIZE')) define('_DATA_SOURCE_MAX_SIZE',2*1048576); /** @@ -267,7 +268,7 @@ class IterateurDATA implements Iterator { else { if (preg_match(',^https?://,', $src)) { include_spip('inc/distant'); - $u = recuperer_page($src); + $u = recuperer_page($src, false, false, _DATA_SOURCE_MAX_SIZE); if (!$u) throw new Exception("404"); if (!isset($ttl)) $ttl = 24*3600; @@ -385,7 +386,7 @@ class IterateurDATA implements Iterator { if (preg_match(',^\.?([/\w]+)( DESC)?$,iS', ltrim($tri, '/'), $r)) { // tri par cle if ($r[1] == 'cle'){ - if (isset($r2) and $r[2]) + if (isset($r[2]) and $r[2]) krsort($this->tableau); else ksort($this->tableau); @@ -620,6 +621,23 @@ function inc_glob_to_array_dist($u) { ); } +/** + * YAML -> tableau + * @param string $u + * @return bool|array + * @throws Exception + */ +function inc_yaml_to_array_dist($u){ + include_spip('inc/yaml-mini'); + if (!function_exists("yaml_decode")){ + throw new Exception('YAML: impossible de trouver la fonction yaml_decode'); + return false; + } + + return yaml_decode($u); +} + + /** * pregfiles -> tableau * lister des fichiers a partir d'un dossier de base et selon une regexp.