@@ -29,36 +29,36 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | function format_inclure_html($file, $args, $prof) { |
| 31 | 31 | if (strpos($file, '#') === false) { |
| 32 | - $t = $file ? ("(" . $file . ")") : ""; |
|
| 32 | + $t = $file ? ("(".$file.")") : ""; |
|
| 33 | 33 | } else { |
| 34 | - $t = "{fond=" . $file . '}'; |
|
| 34 | + $t = "{fond=".$file.'}'; |
|
| 35 | 35 | } |
| 36 | - $args = !$args ? '' : ("{" . join(", ", $args) . "}"); |
|
| 36 | + $args = !$args ? '' : ("{".join(", ", $args)."}"); |
|
| 37 | 37 | |
| 38 | - return ("<INCLURE" . $t . $args . ">"); |
|
| 38 | + return ("<INCLURE".$t.$args.">"); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function format_polyglotte_html($args, $prof) { |
| 42 | 42 | $contenu = array(); |
| 43 | 43 | foreach ($args as $l => $t) { |
| 44 | - $contenu[] = ($l ? "[$l]" : '') . $t; |
|
| 44 | + $contenu[] = ($l ? "[$l]" : '').$t; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - return ("<multi>" . join(" ", $contenu) . "</multi>"); |
|
| 47 | + return ("<multi>".join(" ", $contenu)."</multi>"); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | function format_idiome_html($nom, $module, $args, $filtres, $prof) { |
| 51 | 51 | foreach ($args as $k => $v) { |
| 52 | 52 | $args[$k] = "$k=$v"; |
| 53 | 53 | } |
| 54 | - $args = (!$args ? '' : ('{' . join(',', $args) . '}')); |
|
| 54 | + $args = (!$args ? '' : ('{'.join(',', $args).'}')); |
|
| 55 | 55 | |
| 56 | - return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>"); |
|
| 56 | + return ("<:".($module ? "$module:" : "").$nom.$args.$filtres.":>"); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | function format_champ_html($nom, $boucle, $etoile, $avant, $apres, $args, $filtres, $prof) { |
| 60 | 60 | $nom = "#" |
| 61 | - . ($boucle ? ($boucle . ":") : "") |
|
| 61 | + . ($boucle ? ($boucle.":") : "") |
|
| 62 | 62 | . $nom |
| 63 | 63 | . $etoile |
| 64 | 64 | . $args |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | $critere[$k] = $crit_s; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return (!$critere ? "" : ("{" . join(",", $critere) . "}")); |
|
| 91 | + return (!$critere ? "" : ("{".join(",", $critere)."}")); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | function format_liste_html($fonc, $args, $prof) { |
| 95 | 95 | return ((($fonc !== '') ? "|$fonc" : $fonc) |
| 96 | - . (!$args ? "" : ("{" . join(",", $args) . "}"))); |
|
| 96 | + . (!$args ? "" : ("{".join(",", $args)."}"))); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Concatenation sans separateur: verifier qu'on ne cree pas de faux lexemes |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | // si un texte se termine par ( et est suivi d'un champ |
| 110 | 110 | // ou assimiles, forcer la notation pleine |
| 111 | 111 | if ($c1 == '(' and substr($texte2, 0, 1) == '#') { |
| 112 | - $args[$i + 1][0] = '[(' . $texte2 . ')]'; |
|
| 112 | + $args[$i + 1][0] = '[('.$texte2.')]'; |
|
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | 115 | if ($type == 'texte') { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|') |
| 122 | 122 | or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2)) |
| 123 | 123 | ) { |
| 124 | - $args[$i][0] = '[(' . $texte . ')]'; |
|
| 124 | + $args[$i][0] = '[('.$texte.')]'; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -11,126 +11,126 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function format_boucle_html($preaff, $avant, $nom, $type, $crit, $corps, $apres, $altern, $postaff, $prof) { |
| 18 | - $preaff = $preaff ? "<BB$nom>$preaff" : ""; |
|
| 19 | - $avant = $avant ? "<B$nom>$avant" : ""; |
|
| 20 | - $apres = $apres ? "$apres</B$nom>" : ""; |
|
| 21 | - $altern = $altern ? "$altern<//B$nom>" : ""; |
|
| 22 | - $postaff = $postaff ? "$postaff</BB$nom>" : ""; |
|
| 23 | - if (!$corps) { |
|
| 24 | - $corps = " />"; |
|
| 25 | - } else { |
|
| 26 | - $corps = ">$corps</BOUCLE$nom>"; |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - return "$preaff$avant<BOUCLE$nom($type)$crit$corps$apres$altern$postaff"; |
|
| 18 | + $preaff = $preaff ? "<BB$nom>$preaff" : ""; |
|
| 19 | + $avant = $avant ? "<B$nom>$avant" : ""; |
|
| 20 | + $apres = $apres ? "$apres</B$nom>" : ""; |
|
| 21 | + $altern = $altern ? "$altern<//B$nom>" : ""; |
|
| 22 | + $postaff = $postaff ? "$postaff</BB$nom>" : ""; |
|
| 23 | + if (!$corps) { |
|
| 24 | + $corps = " />"; |
|
| 25 | + } else { |
|
| 26 | + $corps = ">$corps</BOUCLE$nom>"; |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + return "$preaff$avant<BOUCLE$nom($type)$crit$corps$apres$altern$postaff"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | function format_inclure_html($file, $args, $prof) { |
| 33 | - if (strpos($file, '#') === false) { |
|
| 34 | - $t = $file ? ("(" . $file . ")") : ""; |
|
| 35 | - } else { |
|
| 36 | - $t = "{fond=" . $file . '}'; |
|
| 37 | - } |
|
| 38 | - $args = !$args ? '' : ("{" . join(", ", $args) . "}"); |
|
| 39 | - |
|
| 40 | - return ("<INCLURE" . $t . $args . ">"); |
|
| 33 | + if (strpos($file, '#') === false) { |
|
| 34 | + $t = $file ? ("(" . $file . ")") : ""; |
|
| 35 | + } else { |
|
| 36 | + $t = "{fond=" . $file . '}'; |
|
| 37 | + } |
|
| 38 | + $args = !$args ? '' : ("{" . join(", ", $args) . "}"); |
|
| 39 | + |
|
| 40 | + return ("<INCLURE" . $t . $args . ">"); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | function format_polyglotte_html($args, $prof) { |
| 44 | - $contenu = array(); |
|
| 45 | - foreach ($args as $l => $t) { |
|
| 46 | - $contenu[] = ($l ? "[$l]" : '') . $t; |
|
| 47 | - } |
|
| 44 | + $contenu = array(); |
|
| 45 | + foreach ($args as $l => $t) { |
|
| 46 | + $contenu[] = ($l ? "[$l]" : '') . $t; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - return ("<multi>" . join(" ", $contenu) . "</multi>"); |
|
| 49 | + return ("<multi>" . join(" ", $contenu) . "</multi>"); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | function format_idiome_html($nom, $module, $args, $filtres, $prof) { |
| 53 | - foreach ($args as $k => $v) { |
|
| 54 | - $args[$k] = "$k=$v"; |
|
| 55 | - } |
|
| 56 | - $args = (!$args ? '' : ('{' . join(',', $args) . '}')); |
|
| 53 | + foreach ($args as $k => $v) { |
|
| 54 | + $args[$k] = "$k=$v"; |
|
| 55 | + } |
|
| 56 | + $args = (!$args ? '' : ('{' . join(',', $args) . '}')); |
|
| 57 | 57 | |
| 58 | - return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>"); |
|
| 58 | + return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>"); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | function format_champ_html($nom, $boucle, $etoile, $avant, $apres, $args, $filtres, $prof) { |
| 62 | - $nom = "#" |
|
| 63 | - . ($boucle ? ($boucle . ":") : "") |
|
| 64 | - . $nom |
|
| 65 | - . $etoile |
|
| 66 | - . $args |
|
| 67 | - . $filtres; |
|
| 62 | + $nom = "#" |
|
| 63 | + . ($boucle ? ($boucle . ":") : "") |
|
| 64 | + . $nom |
|
| 65 | + . $etoile |
|
| 66 | + . $args |
|
| 67 | + . $filtres; |
|
| 68 | 68 | |
| 69 | - // Determiner si c'est un champ etendu, |
|
| 69 | + // Determiner si c'est un champ etendu, |
|
| 70 | 70 | |
| 71 | - $s = ($avant or $apres or $filtres |
|
| 72 | - or (strpos($args, '(#') !== false)); |
|
| 71 | + $s = ($avant or $apres or $filtres |
|
| 72 | + or (strpos($args, '(#') !== false)); |
|
| 73 | 73 | |
| 74 | - return ($s ? "[$avant($nom)$apres]" : $nom); |
|
| 74 | + return ($s ? "[$avant($nom)$apres]" : $nom); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | function format_critere_html($critere) { |
| 78 | - foreach ($critere as $k => $crit) { |
|
| 79 | - $crit_s = ''; |
|
| 80 | - foreach ($crit as $operande) { |
|
| 81 | - list($type, $valeur) = $operande; |
|
| 82 | - if ($type == 'champ' and $valeur[0] == '[') { |
|
| 83 | - $valeur = substr($valeur, 1, -1); |
|
| 84 | - if (preg_match(',^[(](#[^|]*)[)]$,sS', $valeur)) { |
|
| 85 | - $valeur = substr($valeur, 1, -1); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - $crit_s .= $valeur; |
|
| 89 | - } |
|
| 90 | - $critere[$k] = $crit_s; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - return (!$critere ? "" : ("{" . join(",", $critere) . "}")); |
|
| 78 | + foreach ($critere as $k => $crit) { |
|
| 79 | + $crit_s = ''; |
|
| 80 | + foreach ($crit as $operande) { |
|
| 81 | + list($type, $valeur) = $operande; |
|
| 82 | + if ($type == 'champ' and $valeur[0] == '[') { |
|
| 83 | + $valeur = substr($valeur, 1, -1); |
|
| 84 | + if (preg_match(',^[(](#[^|]*)[)]$,sS', $valeur)) { |
|
| 85 | + $valeur = substr($valeur, 1, -1); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + $crit_s .= $valeur; |
|
| 89 | + } |
|
| 90 | + $critere[$k] = $crit_s; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + return (!$critere ? "" : ("{" . join(",", $critere) . "}")); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | function format_liste_html($fonc, $args, $prof) { |
| 97 | - return ((($fonc !== '') ? "|$fonc" : $fonc) |
|
| 98 | - . (!$args ? "" : ("{" . join(",", $args) . "}"))); |
|
| 97 | + return ((($fonc !== '') ? "|$fonc" : $fonc) |
|
| 98 | + . (!$args ? "" : ("{" . join(",", $args) . "}"))); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Concatenation sans separateur: verifier qu'on ne cree pas de faux lexemes |
| 102 | 102 | function format_suite_html($args) { |
| 103 | - for ($i = 0; $i < count($args) - 1; $i++) { |
|
| 104 | - list($texte, $type) = $args[$i]; |
|
| 105 | - list($texte2, $type2) = $args[$i + 1]; |
|
| 106 | - if (!$texte or !$texte2) { |
|
| 107 | - continue; |
|
| 108 | - } |
|
| 109 | - $c1 = substr($texte, -1); |
|
| 110 | - if ($type2 !== 'texte') { |
|
| 111 | - // si un texte se termine par ( et est suivi d'un champ |
|
| 112 | - // ou assimiles, forcer la notation pleine |
|
| 113 | - if ($c1 == '(' and substr($texte2, 0, 1) == '#') { |
|
| 114 | - $args[$i + 1][0] = '[(' . $texte2 . ')]'; |
|
| 115 | - } |
|
| 116 | - } else { |
|
| 117 | - if ($type == 'texte') { |
|
| 118 | - continue; |
|
| 119 | - } |
|
| 120 | - // si un champ ou assimiles est suivi d'un texte |
|
| 121 | - // et si celui-ci commence par un caractere de champ |
|
| 122 | - // forcer la notation pleine |
|
| 123 | - if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|') |
|
| 124 | - or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2)) |
|
| 125 | - ) { |
|
| 126 | - $args[$i][0] = '[(' . $texte . ')]'; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - return join("", array_map(function($arg) { return reset($arg); }, $args)); |
|
| 103 | + for ($i = 0; $i < count($args) - 1; $i++) { |
|
| 104 | + list($texte, $type) = $args[$i]; |
|
| 105 | + list($texte2, $type2) = $args[$i + 1]; |
|
| 106 | + if (!$texte or !$texte2) { |
|
| 107 | + continue; |
|
| 108 | + } |
|
| 109 | + $c1 = substr($texte, -1); |
|
| 110 | + if ($type2 !== 'texte') { |
|
| 111 | + // si un texte se termine par ( et est suivi d'un champ |
|
| 112 | + // ou assimiles, forcer la notation pleine |
|
| 113 | + if ($c1 == '(' and substr($texte2, 0, 1) == '#') { |
|
| 114 | + $args[$i + 1][0] = '[(' . $texte2 . ')]'; |
|
| 115 | + } |
|
| 116 | + } else { |
|
| 117 | + if ($type == 'texte') { |
|
| 118 | + continue; |
|
| 119 | + } |
|
| 120 | + // si un champ ou assimiles est suivi d'un texte |
|
| 121 | + // et si celui-ci commence par un caractere de champ |
|
| 122 | + // forcer la notation pleine |
|
| 123 | + if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|') |
|
| 124 | + or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2)) |
|
| 125 | + ) { |
|
| 126 | + $args[$i][0] = '[(' . $texte . ')]'; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + return join("", array_map(function($arg) { return reset($arg); }, $args)); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | function format_texte_html($texte) { |
| 135 | - return $texte; |
|
| 135 | + return $texte; |
|
| 136 | 136 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * Code PHP compilé de la boucle |
| 34 | 34 | **/ |
| 35 | 35 | function boucle_DEFAUT_dist($id_boucle, &$boucles) { |
| 36 | - return calculer_boucle($id_boucle, $boucles); |
|
| 36 | + return calculer_boucle($id_boucle, $boucles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * Code PHP compilé de la boucle |
| 53 | 53 | **/ |
| 54 | 54 | function boucle_BOUCLE_dist($id_boucle, &$boucles) { |
| 55 | - return calculer_boucle($id_boucle, $boucles); |
|
| 55 | + return calculer_boucle($id_boucle, $boucles); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -82,30 +82,30 @@ discard block |
||
| 82 | 82 | * Code PHP compilé de la boucle |
| 83 | 83 | **/ |
| 84 | 84 | function boucle_HIERARCHIE_dist($id_boucle, &$boucles) { |
| 85 | - $boucle = &$boucles[$id_boucle]; |
|
| 86 | - $id_table = $boucle->id_table . ".id_rubrique"; |
|
| 85 | + $boucle = &$boucles[$id_boucle]; |
|
| 86 | + $id_table = $boucle->id_table . ".id_rubrique"; |
|
| 87 | 87 | |
| 88 | - // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
|
| 89 | - // sauf en presence du critere {tout} (vu par phraser_html) |
|
| 90 | - // ou {id_article} qui positionne aussi le {tout} |
|
| 88 | + // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
|
| 89 | + // sauf en presence du critere {tout} (vu par phraser_html) |
|
| 90 | + // ou {id_article} qui positionne aussi le {tout} |
|
| 91 | 91 | |
| 92 | - $boucle->hierarchie = 'if (!($id_rubrique = intval(' |
|
| 93 | - . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) |
|
| 94 | - . ")))\n\t\treturn '';\n\t" |
|
| 95 | - . "include_spip('inc/rubriques');\n\t" |
|
| 96 | - . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
|
| 97 | - . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
|
| 98 | - . ");\n\t" |
|
| 99 | - . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 92 | + $boucle->hierarchie = 'if (!($id_rubrique = intval(' |
|
| 93 | + . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) |
|
| 94 | + . ")))\n\t\treturn '';\n\t" |
|
| 95 | + . "include_spip('inc/rubriques');\n\t" |
|
| 96 | + . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
|
| 97 | + . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
|
| 98 | + . ");\n\t" |
|
| 99 | + . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 100 | 100 | |
| 101 | - $boucle->where[] = array("'IN'", "'$id_table'", '"($hierarchie)"'); |
|
| 101 | + $boucle->where[] = array("'IN'", "'$id_table'", '"($hierarchie)"'); |
|
| 102 | 102 | |
| 103 | - $order = "FIELD($id_table, \$hierarchie)"; |
|
| 104 | - if (!isset($boucle->default_order[0]) or $boucle->default_order[0] != " DESC") { |
|
| 105 | - $boucle->default_order[] = "\"$order\""; |
|
| 106 | - } else { |
|
| 107 | - $boucle->default_order[0] = "\"$order DESC\""; |
|
| 108 | - } |
|
| 103 | + $order = "FIELD($id_table, \$hierarchie)"; |
|
| 104 | + if (!isset($boucle->default_order[0]) or $boucle->default_order[0] != " DESC") { |
|
| 105 | + $boucle->default_order[] = "\"$order\""; |
|
| 106 | + } else { |
|
| 107 | + $boucle->default_order[0] = "\"$order DESC\""; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - return calculer_boucle($id_boucle, $boucles); |
|
| 110 | + return calculer_boucle($id_boucle, $boucles); |
|
| 111 | 111 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | **/ |
| 84 | 84 | function boucle_HIERARCHIE_dist($id_boucle, &$boucles) { |
| 85 | 85 | $boucle = &$boucles[$id_boucle]; |
| 86 | - $id_table = $boucle->id_table . ".id_rubrique"; |
|
| 86 | + $id_table = $boucle->id_table.".id_rubrique"; |
|
| 87 | 87 | |
| 88 | 88 | // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
| 89 | 89 | // sauf en presence du critere {tout} (vu par phraser_html) |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
| 97 | 97 | . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
| 98 | 98 | . ");\n\t" |
| 99 | - . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 99 | + . 'if (!$hierarchie) return "";'."\n\t"; |
|
| 100 | 100 | |
| 101 | 101 | $boucle->where[] = array("'IN'", "'$id_table'", '"($hierarchie)"'); |
| 102 | 102 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/presentation'); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @return string Code HTML |
| 33 | 33 | **/ |
| 34 | 34 | function exec_puce_statut_dist() { |
| 35 | - exec_puce_statut_args(_request('id'), _request('type')); |
|
| 35 | + exec_puce_statut_args(_request('id'), _request('type')); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,25 +52,25 @@ discard block |
||
| 52 | 52 | * @return string Code HTML |
| 53 | 53 | **/ |
| 54 | 54 | function exec_puce_statut_args($id, $type) { |
| 55 | - $id = intval($id); |
|
| 56 | - if ($table_objet_sql = table_objet_sql($type) |
|
| 57 | - and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 58 | - and isset($d['statut_textes_instituer']) |
|
| 59 | - and $d['statut_textes_instituer'] |
|
| 60 | - ) { |
|
| 61 | - $prim = id_table_objet($type); |
|
| 62 | - if (isset($d['field']['id_rubrique'])) { |
|
| 63 | - $select = "id_rubrique,statut"; |
|
| 64 | - } else { |
|
| 65 | - $select = "0 as id_rubrique,statut"; |
|
| 66 | - } |
|
| 67 | - $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 68 | - $statut = $r['statut']; |
|
| 69 | - $id_rubrique = $r['id_rubrique']; |
|
| 70 | - } else { |
|
| 71 | - $id_rubrique = $id; |
|
| 72 | - $statut = 'prop'; // arbitraire |
|
| 73 | - } |
|
| 74 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 75 | - ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 55 | + $id = intval($id); |
|
| 56 | + if ($table_objet_sql = table_objet_sql($type) |
|
| 57 | + and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 58 | + and isset($d['statut_textes_instituer']) |
|
| 59 | + and $d['statut_textes_instituer'] |
|
| 60 | + ) { |
|
| 61 | + $prim = id_table_objet($type); |
|
| 62 | + if (isset($d['field']['id_rubrique'])) { |
|
| 63 | + $select = "id_rubrique,statut"; |
|
| 64 | + } else { |
|
| 65 | + $select = "0 as id_rubrique,statut"; |
|
| 66 | + } |
|
| 67 | + $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 68 | + $statut = $r['statut']; |
|
| 69 | + $id_rubrique = $r['id_rubrique']; |
|
| 70 | + } else { |
|
| 71 | + $id_rubrique = $id; |
|
| 72 | + $statut = 'prop'; // arbitraire |
|
| 73 | + } |
|
| 74 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 75 | + ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 76 | 76 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/minipres'); |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | **/ |
| 44 | 44 | function exec_install_dist() { |
| 45 | - $etape = _request('etape'); |
|
| 46 | - $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
|
| 45 | + $etape = _request('etape'); |
|
| 46 | + $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
|
| 47 | 47 | |
| 48 | - // Si deja installe, on n'a plus le droit qu'a l'etape chmod |
|
| 49 | - // pour chgt post-install ou aux etapes supplementaires |
|
| 50 | - // de declaration de base externes. |
|
| 51 | - // Mais alors il faut authentifier car ecrire/index.php l'a omis |
|
| 48 | + // Si deja installe, on n'a plus le droit qu'a l'etape chmod |
|
| 49 | + // pour chgt post-install ou aux etapes supplementaires |
|
| 50 | + // de declaration de base externes. |
|
| 51 | + // Mais alors il faut authentifier car ecrire/index.php l'a omis |
|
| 52 | 52 | |
| 53 | - if ($deja and in_array($etape, array('chmod', 'sup1', 'sup2'))) { |
|
| 53 | + if ($deja and in_array($etape, array('chmod', 'sup1', 'sup2'))) { |
|
| 54 | 54 | |
| 55 | - $auth = charger_fonction('auth', 'inc'); |
|
| 56 | - if (!$auth()) { |
|
| 57 | - verifier_visiteur(); |
|
| 58 | - $deja = (!autoriser('configurer')); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - if ($deja) { |
|
| 62 | - // Rien a faire ici |
|
| 63 | - echo minipres(); |
|
| 64 | - } else { |
|
| 65 | - include_spip('base/create'); |
|
| 66 | - $fonc = charger_fonction("etape_$etape", 'install'); |
|
| 67 | - $fonc(); |
|
| 68 | - } |
|
| 55 | + $auth = charger_fonction('auth', 'inc'); |
|
| 56 | + if (!$auth()) { |
|
| 57 | + verifier_visiteur(); |
|
| 58 | + $deja = (!autoriser('configurer')); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + if ($deja) { |
|
| 62 | + // Rien a faire ici |
|
| 63 | + echo minipres(); |
|
| 64 | + } else { |
|
| 65 | + include_spip('base/create'); |
|
| 66 | + $fonc = charger_fonction("etape_$etape", 'install'); |
|
| 67 | + $fonc(); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function exec_404_dist() { |
| 27 | 27 | |
| 28 | - $exec = _request('exec'); |
|
| 28 | + $exec = _request('exec'); |
|
| 29 | 29 | |
| 30 | - $titre = "exec_$exec"; |
|
| 31 | - $navigation = ''; |
|
| 32 | - $extra = ''; |
|
| 30 | + $titre = "exec_$exec"; |
|
| 31 | + $navigation = ''; |
|
| 32 | + $extra = ''; |
|
| 33 | 33 | |
| 34 | - include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini |
|
| 35 | - $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 36 | - echo $commencer_page($titre); |
|
| 34 | + include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini |
|
| 35 | + $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 36 | + echo $commencer_page($titre); |
|
| 37 | 37 | |
| 38 | - echo debut_gauche("404_$exec", true); |
|
| 39 | - echo pipeline('affiche_gauche', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 38 | + echo debut_gauche("404_$exec", true); |
|
| 39 | + echo pipeline('affiche_gauche', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 40 | 40 | |
| 41 | - echo creer_colonne_droite('404', true); |
|
| 42 | - echo pipeline('affiche_droite', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 41 | + echo creer_colonne_droite('404', true); |
|
| 42 | + echo pipeline('affiche_droite', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 43 | 43 | |
| 44 | - echo debut_droite('404', true); |
|
| 45 | - echo "<h1 class='grostitre'>" . _T('fichier_introuvable', array('fichier' => $exec)) . '</h1>'; |
|
| 46 | - echo pipeline('affiche_milieu', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 44 | + echo debut_droite('404', true); |
|
| 45 | + echo "<h1 class='grostitre'>" . _T('fichier_introuvable', array('fichier' => $exec)) . '</h1>'; |
|
| 46 | + echo pipeline('affiche_milieu', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
|
| 47 | 47 | |
| 48 | - echo fin_gauche(), fin_page(); |
|
| 48 | + echo fin_gauche(), fin_page(); |
|
| 49 | 49 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | echo pipeline('affiche_droite', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
| 43 | 43 | |
| 44 | 44 | echo debut_droite('404', true); |
| 45 | - echo "<h1 class='grostitre'>" . _T('fichier_introuvable', array('fichier' => $exec)) . '</h1>'; |
|
| 45 | + echo "<h1 class='grostitre'>"._T('fichier_introuvable', array('fichier' => $exec)).'</h1>'; |
|
| 46 | 46 | echo pipeline('affiche_milieu', array('args' => array('exec' => '404', 'exec_erreur' => $exec), 'data' => '')); |
| 47 | 47 | |
| 48 | 48 | echo fin_gauche(), fin_page(); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -27,23 +27,23 @@ discard block |
||
| 27 | 27 | * @uses ajax_retour() |
| 28 | 28 | **/ |
| 29 | 29 | function exec_plonger_dist() { |
| 30 | - include_spip('inc/actions'); |
|
| 30 | + include_spip('inc/actions'); |
|
| 31 | 31 | |
| 32 | - $rac = preg_replace(',[^\w\,/#&;-]+,', ' ', _request('rac')); |
|
| 33 | - $id = intval(_request('id')); |
|
| 34 | - $exclus = intval(_request('exclus')); |
|
| 35 | - $col = intval(_request('col')); |
|
| 36 | - $do = _request('do'); |
|
| 37 | - if (preg_match('/^\w*$/', $do)) { |
|
| 38 | - if (!$do) { |
|
| 39 | - $do = 'aff'; |
|
| 40 | - } |
|
| 32 | + $rac = preg_replace(',[^\w\,/#&;-]+,', ' ', _request('rac')); |
|
| 33 | + $id = intval(_request('id')); |
|
| 34 | + $exclus = intval(_request('exclus')); |
|
| 35 | + $col = intval(_request('col')); |
|
| 36 | + $do = _request('do'); |
|
| 37 | + if (preg_match('/^\w*$/', $do)) { |
|
| 38 | + if (!$do) { |
|
| 39 | + $do = 'aff'; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $plonger = charger_fonction('plonger', 'inc'); |
|
| 43 | - $r = $plonger($id, spip_htmlentities($rac), array(), $col, $exclus, $do); |
|
| 44 | - } else { |
|
| 45 | - $r = ''; |
|
| 46 | - } |
|
| 42 | + $plonger = charger_fonction('plonger', 'inc'); |
|
| 43 | + $r = $plonger($id, spip_htmlentities($rac), array(), $col, $exclus, $do); |
|
| 44 | + } else { |
|
| 45 | + $r = ''; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - ajax_retour($r); |
|
| 48 | + ajax_retour($r); |
|
| 49 | 49 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 10 | - return; |
|
| 10 | + return; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | include_spip('inc/actions'); |
@@ -21,23 +21,23 @@ discard block |
||
| 21 | 21 | * @uses ajax_retour() |
| 22 | 22 | */ |
| 23 | 23 | function exec_info_plugin_dist() { |
| 24 | - if (!autoriser('configurer', '_plugins')) { |
|
| 25 | - include_spip('inc/minipres'); |
|
| 26 | - echo minipres(); |
|
| 27 | - } else { |
|
| 28 | - $plug = _DIR_RACINE . htmlspecialchars(_request('plugin')); |
|
| 29 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | - $dir = ""; |
|
| 31 | - if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) { |
|
| 32 | - $dir = _DIR_PLUGINS; |
|
| 33 | - } elseif (strncmp($plug, _DIR_PLUGINS_DIST, strlen(_DIR_PLUGINS_DIST)) == 0) { |
|
| 34 | - $dir = _DIR_PLUGINS_DIST; |
|
| 35 | - } |
|
| 36 | - if ($dir) { |
|
| 37 | - $plug = substr($plug, strlen($dir)); |
|
| 38 | - } |
|
| 39 | - $info = $get_infos($plug, false, $dir); |
|
| 40 | - $afficher_plugin = charger_fonction("afficher_plugin", "plugins"); |
|
| 41 | - ajax_retour(affiche_bloc_plugin($plug, $info, $dir)); |
|
| 42 | - } |
|
| 24 | + if (!autoriser('configurer', '_plugins')) { |
|
| 25 | + include_spip('inc/minipres'); |
|
| 26 | + echo minipres(); |
|
| 27 | + } else { |
|
| 28 | + $plug = _DIR_RACINE . htmlspecialchars(_request('plugin')); |
|
| 29 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | + $dir = ""; |
|
| 31 | + if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) { |
|
| 32 | + $dir = _DIR_PLUGINS; |
|
| 33 | + } elseif (strncmp($plug, _DIR_PLUGINS_DIST, strlen(_DIR_PLUGINS_DIST)) == 0) { |
|
| 34 | + $dir = _DIR_PLUGINS_DIST; |
|
| 35 | + } |
|
| 36 | + if ($dir) { |
|
| 37 | + $plug = substr($plug, strlen($dir)); |
|
| 38 | + } |
|
| 39 | + $info = $get_infos($plug, false, $dir); |
|
| 40 | + $afficher_plugin = charger_fonction("afficher_plugin", "plugins"); |
|
| 41 | + ajax_retour(affiche_bloc_plugin($plug, $info, $dir)); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | include_spip('inc/minipres'); |
| 26 | 26 | echo minipres(); |
| 27 | 27 | } else { |
| 28 | - $plug = _DIR_RACINE . htmlspecialchars(_request('plugin')); |
|
| 28 | + $plug = _DIR_RACINE.htmlspecialchars(_request('plugin')); |
|
| 29 | 29 | $get_infos = charger_fonction('get_infos', 'plugins'); |
| 30 | 30 | $dir = ""; |
| 31 | 31 | if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) { |
@@ -17,38 +17,38 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Exec de la page de destruction des tables de SPIP |
| 25 | 25 | **/ |
| 26 | 26 | function exec_base_delete_all_dist() { |
| 27 | - include_spip('inc/autoriser'); |
|
| 28 | - if (!autoriser('detruire')) { |
|
| 29 | - include_spip('inc/minipres'); |
|
| 30 | - echo minipres(); |
|
| 31 | - } else { |
|
| 32 | - include_spip('base/dump'); |
|
| 33 | - $res = base_lister_toutes_tables('', array(), array(), true); |
|
| 34 | - if (!$res) { |
|
| 35 | - include_spip('inc/minipres'); |
|
| 36 | - spip_log("Erreur base de donnees"); |
|
| 37 | - echo minipres(_T('info_travaux_titre'), |
|
| 38 | - _T('titre_probleme_technique') . "<p><tt>" . sql_errno() . " " . sql_error() . "</tt></p>"); |
|
| 39 | - } else { |
|
| 40 | - $res = base_saisie_tables('delete', $res); |
|
| 41 | - include_spip('inc/headers'); |
|
| 42 | - $res = "\n<ol style='text-align:left'><li>\n" . |
|
| 43 | - join("</li>\n<li>", $res) . |
|
| 44 | - '</li></ol>'; |
|
| 45 | - $admin = charger_fonction('admin', 'inc'); |
|
| 46 | - $res = $admin('delete_all', _T('titre_page_delete_all'), $res); |
|
| 47 | - if (!$res) { |
|
| 48 | - redirige_url_ecrire('install', ''); |
|
| 49 | - } else { |
|
| 50 | - echo $res; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 27 | + include_spip('inc/autoriser'); |
|
| 28 | + if (!autoriser('detruire')) { |
|
| 29 | + include_spip('inc/minipres'); |
|
| 30 | + echo minipres(); |
|
| 31 | + } else { |
|
| 32 | + include_spip('base/dump'); |
|
| 33 | + $res = base_lister_toutes_tables('', array(), array(), true); |
|
| 34 | + if (!$res) { |
|
| 35 | + include_spip('inc/minipres'); |
|
| 36 | + spip_log("Erreur base de donnees"); |
|
| 37 | + echo minipres(_T('info_travaux_titre'), |
|
| 38 | + _T('titre_probleme_technique') . "<p><tt>" . sql_errno() . " " . sql_error() . "</tt></p>"); |
|
| 39 | + } else { |
|
| 40 | + $res = base_saisie_tables('delete', $res); |
|
| 41 | + include_spip('inc/headers'); |
|
| 42 | + $res = "\n<ol style='text-align:left'><li>\n" . |
|
| 43 | + join("</li>\n<li>", $res) . |
|
| 44 | + '</li></ol>'; |
|
| 45 | + $admin = charger_fonction('admin', 'inc'); |
|
| 46 | + $res = $admin('delete_all', _T('titre_page_delete_all'), $res); |
|
| 47 | + if (!$res) { |
|
| 48 | + redirige_url_ecrire('install', ''); |
|
| 49 | + } else { |
|
| 50 | + echo $res; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | include_spip('inc/minipres'); |
| 36 | 36 | spip_log("Erreur base de donnees"); |
| 37 | 37 | echo minipres(_T('info_travaux_titre'), |
| 38 | - _T('titre_probleme_technique') . "<p><tt>" . sql_errno() . " " . sql_error() . "</tt></p>"); |
|
| 38 | + _T('titre_probleme_technique')."<p><tt>".sql_errno()." ".sql_error()."</tt></p>"); |
|
| 39 | 39 | } else { |
| 40 | 40 | $res = base_saisie_tables('delete', $res); |
| 41 | 41 | include_spip('inc/headers'); |
| 42 | - $res = "\n<ol style='text-align:left'><li>\n" . |
|
| 43 | - join("</li>\n<li>", $res) . |
|
| 42 | + $res = "\n<ol style='text-align:left'><li>\n". |
|
| 43 | + join("</li>\n<li>", $res). |
|
| 44 | 44 | '</li></ol>'; |
| 45 | 45 | $admin = charger_fonction('admin', 'inc'); |
| 46 | 46 | $res = $admin('delete_all', _T('titre_page_delete_all'), $res); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Rubriques |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/actions'); |
@@ -28,21 +28,21 @@ discard block |
||
| 28 | 28 | * @uses ajax_retour() |
| 29 | 29 | **/ |
| 30 | 30 | function exec_selectionner_dist() { |
| 31 | - $id = intval(_request('id')); |
|
| 32 | - $exclus = intval(_request('exclus')); |
|
| 33 | - $type = _request('type'); |
|
| 34 | - $rac = _request('racine'); |
|
| 35 | - $do = _request('do'); |
|
| 36 | - if (preg_match('/^\w*$/', $do)) { |
|
| 37 | - if (!$do) { |
|
| 38 | - $do = 'aff'; |
|
| 39 | - } |
|
| 31 | + $id = intval(_request('id')); |
|
| 32 | + $exclus = intval(_request('exclus')); |
|
| 33 | + $type = _request('type'); |
|
| 34 | + $rac = _request('racine'); |
|
| 35 | + $do = _request('do'); |
|
| 36 | + if (preg_match('/^\w*$/', $do)) { |
|
| 37 | + if (!$do) { |
|
| 38 | + $do = 'aff'; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $selectionner = charger_fonction('selectionner', 'inc'); |
|
| 41 | + $selectionner = charger_fonction('selectionner', 'inc'); |
|
| 42 | 42 | |
| 43 | - $r = $selectionner($id, "choix_parent", $exclus, $rac, $type != 'breve', $do); |
|
| 44 | - } else { |
|
| 45 | - $r = ''; |
|
| 46 | - } |
|
| 47 | - ajax_retour($r); |
|
| 43 | + $r = $selectionner($id, "choix_parent", $exclus, $rac, $type != 'breve', $do); |
|
| 44 | + } else { |
|
| 45 | + $r = ''; |
|
| 46 | + } |
|
| 47 | + ajax_retour($r); |
|
| 48 | 48 | } |