diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php index 05f989fdb560b0201861229ada5c5819eff83f5a..5c82c070af4c121ed8f39709af51e609976a6fd8 100644 --- a/ecrire/inc/distant.php +++ b/ecrire/inc/distant.php @@ -312,10 +312,11 @@ function fichier_copie_locale($source) { } // Ping pour voir si son extension est connue et autorisee $path_parts = recuperer_infos_distantes($source,0,false) ; - $ext = $path_part ? $path_parts['extension'] : ''; + $ext = $path_parts ? $path_parts['extension'] : ''; if ($ext AND sql_getfetsel("extension", "spip_types_documents", "extension=".sql_quote($ext))) { return nom_fichier_copie_locale($source, $ext); } + spip_log("pas de copie locale pour $source"); } diff --git a/ecrire/public/boucles.php b/ecrire/public/boucles.php index a07c76658243ee706c23bc726072695ded5b032a..e8bb2cbb11c0eca2a76ef618d4940d0fd62330ed 100644 --- a/ecrire/public/boucles.php +++ b/ecrire/public/boucles.php @@ -178,10 +178,9 @@ function boucle_DOCUMENTS_dist($id_boucle, &$boucles) { AND !$boucle->modificateur['criteres']['id_rubrique'] AND !$boucle->modificateur['criteres']['id_document'] ) { - # pallier un defaut du compilo sur le AS qui se met a la fin - unset($boucle->from[$id_table]); - $boucle->from[] = "spip_documents AS `${id_table}` - LEFT JOIN spip_documents_articles AS a + # Espace avant LEFT JOIN indispensable pour insertion de AS + # a refaire plus proprement + $boucle->from[$id_table] = "spip_documents LEFT JOIN spip_documents_articles AS a ON `$id_table`.id_document=a.id_document LEFT JOIN spip_articles AS aa ON a.id_article=aa.id_article diff --git a/ecrire/public/composer.php b/ecrire/public/composer.php index a18d5331eb03764b2d20e04f247195b36d07316e..65a7a18ec2a6d012b3b6119da4e777f269818a62 100644 --- a/ecrire/public/composer.php +++ b/ecrire/public/composer.php @@ -518,6 +518,7 @@ function calculer_select ($select = array(), $from = array(), reset($from); $e = '/\b(' . "$t\\." . join("|" . $t . '\.', $equiv) . ')\b/'; if (!( count($equiv) <> 1 OR // a faire sauter un jour + strpos($t, ' ') OR // jointure des le depart cf boucle_doc calculer_jointnul($t, $select, $e) OR calculer_jointnul($t, $join, $e) OR calculer_jointnul($t, $where, $e) OR @@ -533,7 +534,6 @@ function calculer_select ($select = array(), $from = array(), $where = remplacer_jointnul($t, $where, $e); $having = remplacer_jointnul($t, $having, $e); } - $from[-1] = $sfrom; } diff --git a/ecrire/req/mysql.php b/ecrire/req/mysql.php index 4cfaad3a2defe6e1865c96c383f11af981406bf2..740f9252511a474a03f9f54368de2fae9aa0e7e5 100644 --- a/ecrire/req/mysql.php +++ b/ecrire/req/mysql.php @@ -239,8 +239,14 @@ function spip_mysql_select_as($args) } else $join =''; $res = ''; foreach($args as $k => $v) { - $res .= ', ' . $v . (is_numeric($k) ? '' : " AS `$k`") . $join; - $join = ''; + if (!is_numeric($k)) { + $p = strpos($v, " "); + if ($p) + $v = substr($v,0,$p) . " AS `$k`" . substr($v,$p); + else $v .= " AS `$k`"; + } + + $res .= ', ' . $v ; } return substr($res,2) . $join; } diff --git a/ecrire/req/pg.php b/ecrire/req/pg.php index 760877c431ffb69eb0b4a9639d72f614f5bf7e43..2a7b2a73bcb88dcb2e734f98a4da619ddece603b 100644 --- a/ecrire/req/pg.php +++ b/ecrire/req/pg.php @@ -488,11 +488,18 @@ function spip_pg_select_as($args) $argsas = ""; foreach($args as $k => $v) { $as = ''; + spip_log("$k : $v"); if (!is_numeric($k)) { if (preg_match('/\.(.*)$/', $k, $r)) $v = $k; - elseif ($v != $k) $as = " AS $k"; + elseif ($v != $k) { + $p = strpos($v, " "); + if ($p) + $v = substr($v,0,$p) . " AS $k" . substr($v,$p); + else $as = " AS $k"; + } } + spip_log("subs $k : $v avec $as"); if (strpos($v, 'JOIN') === false) $argsas .= ', '; $argsas .= $v . $as; }