@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | **/ |
| 20 | 20 | |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | * Code compilé |
| 38 | 38 | **/ |
| 39 | 39 | function generer_generer_url($type, $p) { |
| 40 | - $_id = interprete_argument_balise(1, $p); |
|
| 40 | + $_id = interprete_argument_balise(1, $p); |
|
| 41 | 41 | |
| 42 | - if (!$_id) { |
|
| 43 | - $primary = id_table_objet($type); |
|
| 44 | - $_id = champ_sql($primary, $p); |
|
| 45 | - } |
|
| 42 | + if (!$_id) { |
|
| 43 | + $primary = id_table_objet($type); |
|
| 44 | + $_id = champ_sql($primary, $p); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return generer_generer_url_arg($type, $p, $_id); |
|
| 47 | + return generer_generer_url_arg($type, $p, $_id); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -73,29 +73,29 @@ discard block |
||
| 73 | 73 | * Code compilé |
| 74 | 74 | **/ |
| 75 | 75 | function generer_generer_url_arg($type, $p, $_id) { |
| 76 | - if ($s = trouver_nom_serveur_distant($p)) { |
|
| 77 | - |
|
| 78 | - // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
|
| 79 | - if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 80 | - return $f($type, $_id, $s); |
|
| 81 | - } |
|
| 82 | - if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) { |
|
| 83 | - return null; |
|
| 84 | - } |
|
| 85 | - $s = _q($s); |
|
| 86 | - # exception des urls de documents sur un serveur distant... |
|
| 87 | - if ($type == 'document') { |
|
| 88 | - return |
|
| 89 | - "quete_meta('adresse_site', $s) . '/' .\n\t" . |
|
| 90 | - "quete_meta('dir_img', $s) . \n\t" . |
|
| 91 | - "quete_fichier($_id,$s)"; |
|
| 92 | - } |
|
| 93 | - $s = ", '', '', $s, quete_meta('type_urls', $s)"; |
|
| 94 | - } else { |
|
| 95 | - $s = ", '', '', true"; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - return "urlencode_1738(generer_url_entite($_id, '$type'$s))"; |
|
| 76 | + if ($s = trouver_nom_serveur_distant($p)) { |
|
| 77 | + |
|
| 78 | + // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
|
| 79 | + if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 80 | + return $f($type, $_id, $s); |
|
| 81 | + } |
|
| 82 | + if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) { |
|
| 83 | + return null; |
|
| 84 | + } |
|
| 85 | + $s = _q($s); |
|
| 86 | + # exception des urls de documents sur un serveur distant... |
|
| 87 | + if ($type == 'document') { |
|
| 88 | + return |
|
| 89 | + "quete_meta('adresse_site', $s) . '/' .\n\t" . |
|
| 90 | + "quete_meta('dir_img', $s) . \n\t" . |
|
| 91 | + "quete_fichier($_id,$s)"; |
|
| 92 | + } |
|
| 93 | + $s = ", '', '', $s, quete_meta('type_urls', $s)"; |
|
| 94 | + } else { |
|
| 95 | + $s = ", '', '', true"; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + return "urlencode_1738(generer_url_entite($_id, '$type'$s))"; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -120,27 +120,27 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | function balise_URL__dist($p) { |
| 122 | 122 | |
| 123 | - $nom = $p->nom_champ; |
|
| 124 | - if ($nom === 'URL_') { |
|
| 125 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' URL_')); |
|
| 126 | - erreur_squelette($msg, $p); |
|
| 127 | - $p->interdire_scripts = false; |
|
| 128 | - |
|
| 129 | - return $p; |
|
| 130 | - } elseif ($f = charger_fonction($nom, 'balise', true)) { |
|
| 131 | - return $f($p); |
|
| 132 | - } else { |
|
| 133 | - $nom = strtolower($nom); |
|
| 134 | - $code = generer_generer_url(substr($nom, 4), $p); |
|
| 135 | - $code = champ_sql($nom, $p, $code); |
|
| 136 | - $p->code = $code; |
|
| 137 | - if (!$p->etoile) { |
|
| 138 | - $p->code = "vider_url($code)"; |
|
| 139 | - } |
|
| 140 | - $p->interdire_scripts = false; |
|
| 141 | - |
|
| 142 | - return $p; |
|
| 143 | - } |
|
| 123 | + $nom = $p->nom_champ; |
|
| 124 | + if ($nom === 'URL_') { |
|
| 125 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' URL_')); |
|
| 126 | + erreur_squelette($msg, $p); |
|
| 127 | + $p->interdire_scripts = false; |
|
| 128 | + |
|
| 129 | + return $p; |
|
| 130 | + } elseif ($f = charger_fonction($nom, 'balise', true)) { |
|
| 131 | + return $f($p); |
|
| 132 | + } else { |
|
| 133 | + $nom = strtolower($nom); |
|
| 134 | + $code = generer_generer_url(substr($nom, 4), $p); |
|
| 135 | + $code = champ_sql($nom, $p, $code); |
|
| 136 | + $p->code = $code; |
|
| 137 | + if (!$p->etoile) { |
|
| 138 | + $p->code = "vider_url($code)"; |
|
| 139 | + } |
|
| 140 | + $p->interdire_scripts = false; |
|
| 141 | + |
|
| 142 | + return $p; |
|
| 143 | + } |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -164,20 +164,20 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | function balise_URL_ARTICLE_dist($p) { |
| 166 | 166 | |
| 167 | - // Cas particulier des boucles (SYNDIC_ARTICLES) |
|
| 168 | - if ($p->type_requete == 'syndic_articles') { |
|
| 169 | - $code = champ_sql('url', $p); |
|
| 170 | - } else { |
|
| 171 | - $code = generer_generer_url('article', $p); |
|
| 172 | - } |
|
| 167 | + // Cas particulier des boucles (SYNDIC_ARTICLES) |
|
| 168 | + if ($p->type_requete == 'syndic_articles') { |
|
| 169 | + $code = champ_sql('url', $p); |
|
| 170 | + } else { |
|
| 171 | + $code = generer_generer_url('article', $p); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - $p->code = $code; |
|
| 175 | - if (!$p->etoile) { |
|
| 176 | - $p->code = "vider_url($code)"; |
|
| 177 | - } |
|
| 178 | - $p->interdire_scripts = false; |
|
| 174 | + $p->code = $code; |
|
| 175 | + if (!$p->etoile) { |
|
| 176 | + $p->code = "vider_url($code)"; |
|
| 177 | + } |
|
| 178 | + $p->interdire_scripts = false; |
|
| 179 | 179 | |
| 180 | - return $p; |
|
| 180 | + return $p; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -197,21 +197,21 @@ discard block |
||
| 197 | 197 | * Pile complétée par le code à générer |
| 198 | 198 | */ |
| 199 | 199 | function balise_URL_SITE_dist($p) { |
| 200 | - $code = champ_sql('url_site', $p); |
|
| 201 | - if (strpos($code, '@$Pile[0]') !== false) { |
|
| 202 | - $code = generer_generer_url('site', $p); |
|
| 203 | - if ($code === null) { |
|
| 204 | - return null; |
|
| 205 | - } |
|
| 206 | - } else { |
|
| 207 | - if (!$p->etoile) { |
|
| 208 | - $code = "calculer_url($code,'','url', \$connect)"; |
|
| 209 | - } |
|
| 210 | - } |
|
| 211 | - $p->code = $code; |
|
| 212 | - $p->interdire_scripts = false; |
|
| 213 | - |
|
| 214 | - return $p; |
|
| 200 | + $code = champ_sql('url_site', $p); |
|
| 201 | + if (strpos($code, '@$Pile[0]') !== false) { |
|
| 202 | + $code = generer_generer_url('site', $p); |
|
| 203 | + if ($code === null) { |
|
| 204 | + return null; |
|
| 205 | + } |
|
| 206 | + } else { |
|
| 207 | + if (!$p->etoile) { |
|
| 208 | + $code = "calculer_url($code,'','url', \$connect)"; |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | + $p->code = $code; |
|
| 212 | + $p->interdire_scripts = false; |
|
| 213 | + |
|
| 214 | + return $p; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Autres balises URL_*, qui ne concernent pas une table |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | * Pile complétée par le code à générer |
| 231 | 231 | */ |
| 232 | 232 | function balise_URL_SITE_SPIP_dist($p) { |
| 233 | - $p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')"; |
|
| 234 | - $p->code = "spip_htmlspecialchars(" . $p->code . ")"; |
|
| 235 | - $p->interdire_scripts = false; |
|
| 233 | + $p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')"; |
|
| 234 | + $p->code = "spip_htmlspecialchars(" . $p->code . ")"; |
|
| 235 | + $p->interdire_scripts = false; |
|
| 236 | 236 | |
| 237 | - return $p; |
|
| 237 | + return $p; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -263,42 +263,42 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | function balise_URL_PAGE_dist($p) { |
| 265 | 265 | |
| 266 | - $code = interprete_argument_balise(1, $p); |
|
| 267 | - $args = interprete_argument_balise(2, $p); |
|
| 268 | - if ($args == null) { |
|
| 269 | - $args = "''"; |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - if ($s = trouver_nom_serveur_distant($p)) { |
|
| 273 | - // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
|
| 274 | - // elle devra aussi traiter le cas derogatoire type=page |
|
| 275 | - if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 276 | - if ($args and $args !== "''") { |
|
| 277 | - $code .= ", $args"; |
|
| 278 | - } |
|
| 279 | - $code = $f('page', $code, $s); |
|
| 280 | - |
|
| 281 | - return $p; |
|
| 282 | - } |
|
| 283 | - $s = 'connect=' . addslashes($s); |
|
| 284 | - $args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'"); |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - if (!$code) { |
|
| 288 | - $noentities = $p->etoile ? "'&'" : ''; |
|
| 289 | - $code = "url_de_base() . preg_replace(',^./,', '', self($noentities))"; |
|
| 290 | - } else { |
|
| 291 | - if (!$args) { |
|
| 292 | - $args = "''"; |
|
| 293 | - } |
|
| 294 | - $noentities = $p->etoile ? ", true" : ''; |
|
| 295 | - $code = "generer_url_public($code, $args$noentities)"; |
|
| 296 | - } |
|
| 297 | - $p->code = $code; |
|
| 298 | - spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO); |
|
| 299 | - |
|
| 300 | - #$p->interdire_scripts = true; |
|
| 301 | - return $p; |
|
| 266 | + $code = interprete_argument_balise(1, $p); |
|
| 267 | + $args = interprete_argument_balise(2, $p); |
|
| 268 | + if ($args == null) { |
|
| 269 | + $args = "''"; |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + if ($s = trouver_nom_serveur_distant($p)) { |
|
| 273 | + // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
|
| 274 | + // elle devra aussi traiter le cas derogatoire type=page |
|
| 275 | + if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 276 | + if ($args and $args !== "''") { |
|
| 277 | + $code .= ", $args"; |
|
| 278 | + } |
|
| 279 | + $code = $f('page', $code, $s); |
|
| 280 | + |
|
| 281 | + return $p; |
|
| 282 | + } |
|
| 283 | + $s = 'connect=' . addslashes($s); |
|
| 284 | + $args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'"); |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + if (!$code) { |
|
| 288 | + $noentities = $p->etoile ? "'&'" : ''; |
|
| 289 | + $code = "url_de_base() . preg_replace(',^./,', '', self($noentities))"; |
|
| 290 | + } else { |
|
| 291 | + if (!$args) { |
|
| 292 | + $args = "''"; |
|
| 293 | + } |
|
| 294 | + $noentities = $p->etoile ? ", true" : ''; |
|
| 295 | + $code = "generer_url_public($code, $args$noentities)"; |
|
| 296 | + } |
|
| 297 | + $p->code = $code; |
|
| 298 | + spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO); |
|
| 299 | + |
|
| 300 | + #$p->interdire_scripts = true; |
|
| 301 | + return $p; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | |
@@ -325,24 +325,24 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | function balise_URL_ECRIRE_dist($p) { |
| 327 | 327 | |
| 328 | - $code = interprete_argument_balise(1, $p); |
|
| 329 | - if (!$code) { |
|
| 330 | - $fonc = "''"; |
|
| 331 | - } else { |
|
| 332 | - $fonc = $code; |
|
| 333 | - $args = interprete_argument_balise(2, $p); |
|
| 334 | - if ($args === null) { |
|
| 335 | - $args = "''"; |
|
| 336 | - } |
|
| 337 | - $noentities = $p->etoile ? ", true" : ''; |
|
| 338 | - if (($args != "''") or $noentities) { |
|
| 339 | - $fonc .= ",$args$noentities"; |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - $p->code = 'generer_url_ecrire(' . $fonc . ')'; |
|
| 343 | - $p->interdire_scripts = false; |
|
| 344 | - |
|
| 345 | - return $p; |
|
| 328 | + $code = interprete_argument_balise(1, $p); |
|
| 329 | + if (!$code) { |
|
| 330 | + $fonc = "''"; |
|
| 331 | + } else { |
|
| 332 | + $fonc = $code; |
|
| 333 | + $args = interprete_argument_balise(2, $p); |
|
| 334 | + if ($args === null) { |
|
| 335 | + $args = "''"; |
|
| 336 | + } |
|
| 337 | + $noentities = $p->etoile ? ", true" : ''; |
|
| 338 | + if (($args != "''") or $noentities) { |
|
| 339 | + $fonc .= ",$args$noentities"; |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + $p->code = 'generer_url_ecrire(' . $fonc . ')'; |
|
| 343 | + $p->interdire_scripts = false; |
|
| 344 | + |
|
| 345 | + return $p; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | |
@@ -368,23 +368,23 @@ discard block |
||
| 368 | 368 | * Pile complétée par le code à générer |
| 369 | 369 | */ |
| 370 | 370 | function balise_URL_ACTION_AUTEUR_dist($p) { |
| 371 | - $p->descr['session'] = true; |
|
| 372 | - |
|
| 373 | - $p->code = interprete_argument_balise(1, $p); |
|
| 374 | - $args = interprete_argument_balise(2, $p); |
|
| 375 | - if ($args != "''" && $args !== null) { |
|
| 376 | - $p->code .= "," . $args; |
|
| 377 | - } |
|
| 378 | - $redirect = interprete_argument_balise(3, $p); |
|
| 379 | - if ($redirect != "''" && $redirect !== null) { |
|
| 380 | - if ($args == "''" || $args === null) { |
|
| 381 | - $p->code .= ",''"; |
|
| 382 | - } |
|
| 383 | - $p->code .= "," . $redirect; |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - $p->code = "generer_action_auteur(" . $p->code . ")"; |
|
| 387 | - $p->interdire_scripts = false; |
|
| 388 | - |
|
| 389 | - return $p; |
|
| 371 | + $p->descr['session'] = true; |
|
| 372 | + |
|
| 373 | + $p->code = interprete_argument_balise(1, $p); |
|
| 374 | + $args = interprete_argument_balise(2, $p); |
|
| 375 | + if ($args != "''" && $args !== null) { |
|
| 376 | + $p->code .= "," . $args; |
|
| 377 | + } |
|
| 378 | + $redirect = interprete_argument_balise(3, $p); |
|
| 379 | + if ($redirect != "''" && $redirect !== null) { |
|
| 380 | + if ($args == "''" || $args === null) { |
|
| 381 | + $p->code .= ",''"; |
|
| 382 | + } |
|
| 383 | + $p->code .= "," . $redirect; |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + $p->code = "generer_action_auteur(" . $p->code . ")"; |
|
| 387 | + $p->interdire_scripts = false; |
|
| 388 | + |
|
| 389 | + return $p; |
|
| 390 | 390 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if ($s = trouver_nom_serveur_distant($p)) { |
| 77 | 77 | |
| 78 | 78 | // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
| 79 | - if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 79 | + if (function_exists($f = 'generer_generer_url_'.$s)) { |
|
| 80 | 80 | return $f($type, $_id, $s); |
| 81 | 81 | } |
| 82 | 82 | if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) { |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | # exception des urls de documents sur un serveur distant... |
| 87 | 87 | if ($type == 'document') { |
| 88 | 88 | return |
| 89 | - "quete_meta('adresse_site', $s) . '/' .\n\t" . |
|
| 90 | - "quete_meta('dir_img', $s) . \n\t" . |
|
| 89 | + "quete_meta('adresse_site', $s) . '/' .\n\t". |
|
| 90 | + "quete_meta('dir_img', $s) . \n\t". |
|
| 91 | 91 | "quete_fichier($_id,$s)"; |
| 92 | 92 | } |
| 93 | 93 | $s = ", '', '', $s, quete_meta('type_urls', $s)"; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | function balise_URL_SITE_SPIP_dist($p) { |
| 233 | 233 | $p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')"; |
| 234 | - $p->code = "spip_htmlspecialchars(" . $p->code . ")"; |
|
| 234 | + $p->code = "spip_htmlspecialchars(".$p->code.")"; |
|
| 235 | 235 | $p->interdire_scripts = false; |
| 236 | 236 | |
| 237 | 237 | return $p; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | if ($s = trouver_nom_serveur_distant($p)) { |
| 273 | 273 | // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
| 274 | 274 | // elle devra aussi traiter le cas derogatoire type=page |
| 275 | - if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 275 | + if (function_exists($f = 'generer_generer_url_'.$s)) { |
|
| 276 | 276 | if ($args and $args !== "''") { |
| 277 | 277 | $code .= ", $args"; |
| 278 | 278 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | return $p; |
| 282 | 282 | } |
| 283 | - $s = 'connect=' . addslashes($s); |
|
| 283 | + $s = 'connect='.addslashes($s); |
|
| 284 | 284 | $args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'"); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $code = "generer_url_public($code, $args$noentities)"; |
| 296 | 296 | } |
| 297 | 297 | $p->code = $code; |
| 298 | - spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO); |
|
| 298 | + spip_log("Calcul url page : connect vaut $s ca donne :".$p->code." args $args", _LOG_INFO); |
|
| 299 | 299 | |
| 300 | 300 | #$p->interdire_scripts = true; |
| 301 | 301 | return $p; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $fonc .= ",$args$noentities"; |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | - $p->code = 'generer_url_ecrire(' . $fonc . ')'; |
|
| 342 | + $p->code = 'generer_url_ecrire('.$fonc.')'; |
|
| 343 | 343 | $p->interdire_scripts = false; |
| 344 | 344 | |
| 345 | 345 | return $p; |
@@ -373,17 +373,17 @@ discard block |
||
| 373 | 373 | $p->code = interprete_argument_balise(1, $p); |
| 374 | 374 | $args = interprete_argument_balise(2, $p); |
| 375 | 375 | if ($args != "''" && $args !== null) { |
| 376 | - $p->code .= "," . $args; |
|
| 376 | + $p->code .= ",".$args; |
|
| 377 | 377 | } |
| 378 | 378 | $redirect = interprete_argument_balise(3, $p); |
| 379 | 379 | if ($redirect != "''" && $redirect !== null) { |
| 380 | 380 | if ($args == "''" || $args === null) { |
| 381 | 381 | $p->code .= ",''"; |
| 382 | 382 | } |
| 383 | - $p->code .= "," . $redirect; |
|
| 383 | + $p->code .= ",".$redirect; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - $p->code = "generer_action_auteur(" . $p->code . ")"; |
|
| 386 | + $p->code = "generer_action_auteur(".$p->code.")"; |
|
| 387 | 387 | $p->interdire_scripts = false; |
| 388 | 388 | |
| 389 | 389 | return $p; |
@@ -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 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Pile complétée du code compilé |
| 38 | 38 | **/ |
| 39 | 39 | function balise_MENU_LANG($p) { |
| 40 | - return calculer_balise_dynamique($p, 'MENU_LANG', array('lang')); |
|
| 40 | + return calculer_balise_dynamique($p, 'MENU_LANG', array('lang')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | * Liste (lang) des arguments collectés et fournis. |
| 56 | 56 | */ |
| 57 | 57 | function balise_MENU_LANG_stat($args, $context_compil) { |
| 58 | - if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) { |
|
| 59 | - return ''; |
|
| 60 | - } |
|
| 58 | + if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) { |
|
| 59 | + return ''; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - return $args; |
|
| 62 | + return $args; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Liste : Chemin du squelette, durée du cache, contexte |
| 76 | 76 | **/ |
| 77 | 77 | function balise_MENU_LANG_dyn($opt) { |
| 78 | - include_spip('balise/menu_lang_ecrire'); |
|
| 78 | + include_spip('balise/menu_lang_ecrire'); |
|
| 79 | 79 | |
| 80 | - return menu_lang_pour_tous('var_lang', $opt); |
|
| 80 | + return menu_lang_pour_tous('var_lang', $opt); |
|
| 81 | 81 | } |
@@ -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 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * Pile complétée du code compilé |
| 43 | 43 | **/ |
| 44 | 44 | function balise_FORMULAIRE_ADMIN($p) { |
| 45 | - return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', array()); |
|
| 45 | + return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', array()); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * - chaîne vide sinon. |
| 60 | 60 | */ |
| 61 | 61 | function balise_FORMULAIRE_ADMIN_stat($args, $context_compil) { |
| 62 | - return $args; |
|
| 62 | + return $args; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -84,66 +84,66 @@ discard block |
||
| 84 | 84 | **/ |
| 85 | 85 | function balise_FORMULAIRE_ADMIN_dyn($float = '', $debug = '') { |
| 86 | 86 | |
| 87 | - static $dejafait = false; |
|
| 87 | + static $dejafait = false; |
|
| 88 | 88 | |
| 89 | - if (!@$_COOKIE['spip_admin']) { |
|
| 90 | - return ''; |
|
| 91 | - } |
|
| 89 | + if (!@$_COOKIE['spip_admin']) { |
|
| 90 | + return ''; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - if (!is_array($debug)) { |
|
| 94 | - if ($dejafait) { |
|
| 95 | - return ''; |
|
| 96 | - } |
|
| 97 | - } else { |
|
| 98 | - if ($dejafait) { |
|
| 99 | - if (empty($debug['sourcefile'])) { |
|
| 100 | - return ''; |
|
| 101 | - } |
|
| 102 | - foreach ($debug['sourcefile'] as $k => $v) { |
|
| 103 | - if (strpos($v, 'administration.') !== false) { |
|
| 104 | - if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | - return $debug['resultat'][$k . 'tout']; |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - } |
|
| 93 | + if (!is_array($debug)) { |
|
| 94 | + if ($dejafait) { |
|
| 95 | + return ''; |
|
| 96 | + } |
|
| 97 | + } else { |
|
| 98 | + if ($dejafait) { |
|
| 99 | + if (empty($debug['sourcefile'])) { |
|
| 100 | + return ''; |
|
| 101 | + } |
|
| 102 | + foreach ($debug['sourcefile'] as $k => $v) { |
|
| 103 | + if (strpos($v, 'administration.') !== false) { |
|
| 104 | + if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | + return $debug['resultat'][$k . 'tout']; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - return ''; |
|
| 111 | - } |
|
| 112 | - } |
|
| 110 | + return ''; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - include_spip('inc/autoriser'); |
|
| 115 | - include_spip('base/abstract_sql'); |
|
| 114 | + include_spip('inc/autoriser'); |
|
| 115 | + include_spip('base/abstract_sql'); |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | - $dejafait = true; |
|
| 118 | + $dejafait = true; |
|
| 119 | 119 | |
| 120 | - // Preparer le #ENV des boutons |
|
| 120 | + // Preparer le #ENV des boutons |
|
| 121 | 121 | |
| 122 | - $env = admin_objet(); |
|
| 122 | + $env = admin_objet(); |
|
| 123 | 123 | |
| 124 | - // Pas de "modifier ce..." ? -> donner "acces a l'espace prive" |
|
| 125 | - if (!$env) { |
|
| 126 | - $env['ecrire'] = _DIR_RESTREINT_ABS; |
|
| 127 | - } |
|
| 124 | + // Pas de "modifier ce..." ? -> donner "acces a l'espace prive" |
|
| 125 | + if (!$env) { |
|
| 126 | + $env['ecrire'] = _DIR_RESTREINT_ABS; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - $env['divclass'] = $float; |
|
| 130 | - $env['lang'] = admin_lang(); |
|
| 131 | - $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul'); |
|
| 132 | - $env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? "" : admin_debug()); |
|
| 133 | - $env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider(); |
|
| 134 | - $env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : ''); |
|
| 129 | + $env['divclass'] = $float; |
|
| 130 | + $env['lang'] = admin_lang(); |
|
| 131 | + $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul'); |
|
| 132 | + $env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? "" : admin_debug()); |
|
| 133 | + $env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider(); |
|
| 134 | + $env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : ''); |
|
| 135 | 135 | |
| 136 | - if (!$GLOBALS['use_cache']) { |
|
| 137 | - $env['use_cache'] = ' *'; |
|
| 138 | - } |
|
| 136 | + if (!$GLOBALS['use_cache']) { |
|
| 137 | + $env['use_cache'] = ' *'; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - if (isset($debug['validation'])) { |
|
| 141 | - $env['xhtml_error'] = $debug['validation']; |
|
| 142 | - } |
|
| 140 | + if (isset($debug['validation'])) { |
|
| 141 | + $env['xhtml_error'] = $debug['validation']; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - $env['_pipelines']['formulaire_admin'] = array(); |
|
| 144 | + $env['_pipelines']['formulaire_admin'] = array(); |
|
| 145 | 145 | |
| 146 | - return array('formulaires/administration', 0, $env); |
|
| 146 | + return array('formulaires/administration', 0, $env); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -161,45 +161,45 @@ discard block |
||
| 161 | 161 | * Tableau de l'environnement calculé |
| 162 | 162 | **/ |
| 163 | 163 | function admin_objet() { |
| 164 | - include_spip('inc/urls'); |
|
| 165 | - $env = array(); |
|
| 166 | - |
|
| 167 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 168 | - $objets = urls_liste_objets(false); |
|
| 169 | - $objets = array_diff($objets, array('rubrique')); |
|
| 170 | - $objets = array_reverse($objets); |
|
| 171 | - array_unshift($objets, 'rubrique'); |
|
| 172 | - foreach ($objets as $obj) { |
|
| 173 | - $type = $obj; |
|
| 174 | - if ($type == objet_type($type, false) |
|
| 175 | - and $_id_type = id_table_objet($type) |
|
| 176 | - and isset($GLOBALS['contexte'][$_id_type]) |
|
| 177 | - and $id = $GLOBALS['contexte'][$_id_type] |
|
| 178 | - and !is_array($id) |
|
| 179 | - and $id = intval($id) |
|
| 180 | - ) { |
|
| 181 | - $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 182 | - if ($id) { |
|
| 183 | - $env[$_id_type] = $id; |
|
| 184 | - $env['objet'] = $type; |
|
| 185 | - $env['id_objet'] = $id; |
|
| 186 | - $env['voir_' . $obj] = |
|
| 187 | - str_replace('&', '&', generer_url_entite($id, $obj, '', '', false)); |
|
| 188 | - if ($desc = $trouver_table(table_objet_sql($type)) |
|
| 189 | - and isset($desc['field']['id_rubrique']) |
|
| 190 | - and $type != 'rubrique' |
|
| 191 | - ) { |
|
| 192 | - unset($env['id_rubrique']); |
|
| 193 | - unset($env['voir_rubrique']); |
|
| 194 | - if (admin_preview($type, $id, $desc)) { |
|
| 195 | - $env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&'); |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - return $env; |
|
| 164 | + include_spip('inc/urls'); |
|
| 165 | + $env = array(); |
|
| 166 | + |
|
| 167 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 168 | + $objets = urls_liste_objets(false); |
|
| 169 | + $objets = array_diff($objets, array('rubrique')); |
|
| 170 | + $objets = array_reverse($objets); |
|
| 171 | + array_unshift($objets, 'rubrique'); |
|
| 172 | + foreach ($objets as $obj) { |
|
| 173 | + $type = $obj; |
|
| 174 | + if ($type == objet_type($type, false) |
|
| 175 | + and $_id_type = id_table_objet($type) |
|
| 176 | + and isset($GLOBALS['contexte'][$_id_type]) |
|
| 177 | + and $id = $GLOBALS['contexte'][$_id_type] |
|
| 178 | + and !is_array($id) |
|
| 179 | + and $id = intval($id) |
|
| 180 | + ) { |
|
| 181 | + $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 182 | + if ($id) { |
|
| 183 | + $env[$_id_type] = $id; |
|
| 184 | + $env['objet'] = $type; |
|
| 185 | + $env['id_objet'] = $id; |
|
| 186 | + $env['voir_' . $obj] = |
|
| 187 | + str_replace('&', '&', generer_url_entite($id, $obj, '', '', false)); |
|
| 188 | + if ($desc = $trouver_table(table_objet_sql($type)) |
|
| 189 | + and isset($desc['field']['id_rubrique']) |
|
| 190 | + and $type != 'rubrique' |
|
| 191 | + ) { |
|
| 192 | + unset($env['id_rubrique']); |
|
| 193 | + unset($env['voir_rubrique']); |
|
| 194 | + if (admin_preview($type, $id, $desc)) { |
|
| 195 | + $env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&'); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + return $env; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
@@ -217,30 +217,30 @@ discard block |
||
| 217 | 217 | * - Tableau d'un élément sinon. |
| 218 | 218 | **/ |
| 219 | 219 | function admin_preview($type, $id, $desc = null) { |
| 220 | - if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) { |
|
| 221 | - return ''; |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - if (!$desc) { |
|
| 225 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 226 | - $desc = $trouver_table(table_objet_sql($type)); |
|
| 227 | - } |
|
| 228 | - if (!$desc or !isset($desc['field']['statut'])) { |
|
| 229 | - return ''; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - include_spip('inc/autoriser'); |
|
| 233 | - if (!autoriser('previsualiser')) { |
|
| 234 | - return ''; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - $notpub = sql_in("statut", array('prop', 'prive')); |
|
| 238 | - |
|
| 239 | - if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
|
| 240 | - $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ")"; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . "=" . $id . " AND ($notpub)"); |
|
| 220 | + if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) { |
|
| 221 | + return ''; |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + if (!$desc) { |
|
| 225 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 226 | + $desc = $trouver_table(table_objet_sql($type)); |
|
| 227 | + } |
|
| 228 | + if (!$desc or !isset($desc['field']['statut'])) { |
|
| 229 | + return ''; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + include_spip('inc/autoriser'); |
|
| 233 | + if (!autoriser('previsualiser')) { |
|
| 234 | + return ''; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + $notpub = sql_in("statut", array('prop', 'prive')); |
|
| 238 | + |
|
| 239 | + if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
|
| 240 | + $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ")"; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . "=" . $id . " AND ($notpub)"); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -251,19 +251,19 @@ discard block |
||
| 251 | 251 | * Code de langue |
| 252 | 252 | **/ |
| 253 | 253 | function admin_lang() { |
| 254 | - $alang = sql_getfetsel('lang', 'spip_auteurs', |
|
| 255 | - "login=" . sql_quote(preg_replace(',^@,', '', @$_COOKIE['spip_admin']))); |
|
| 256 | - if (!$alang) { |
|
| 257 | - return ''; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - $l = lang_select($alang); |
|
| 261 | - $alang = $GLOBALS['spip_lang']; |
|
| 262 | - if ($l) { |
|
| 263 | - lang_select(); |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - return $alang; |
|
| 254 | + $alang = sql_getfetsel('lang', 'spip_auteurs', |
|
| 255 | + "login=" . sql_quote(preg_replace(',^@,', '', @$_COOKIE['spip_admin']))); |
|
| 256 | + if (!$alang) { |
|
| 257 | + return ''; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + $l = lang_select($alang); |
|
| 261 | + $alang = $GLOBALS['spip_lang']; |
|
| 262 | + if ($l) { |
|
| 263 | + lang_select(); |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + return $alang; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | **/ |
| 274 | 274 | function admin_valider() { |
| 275 | 275 | |
| 276 | - return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
|
| 277 | - (parametre_url(self(), 'var_mode', 'debug', '&') |
|
| 278 | - . '&var_mode_affiche=validation') : |
|
| 279 | - ('http://validator.w3.org/check?uri=' |
|
| 280 | - . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 276 | + return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
|
| 277 | + (parametre_url(self(), 'var_mode', 'debug', '&') |
|
| 278 | + . '&var_mode_affiche=validation') : |
|
| 279 | + ('http://validator.w3.org/check?uri=' |
|
| 280 | + . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -286,14 +286,14 @@ discard block |
||
| 286 | 286 | * @return string |
| 287 | 287 | **/ |
| 288 | 288 | function admin_debug() { |
| 289 | - return (( |
|
| 290 | - (isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug']) |
|
| 291 | - or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug']) |
|
| 292 | - or ( |
|
| 293 | - defined('_VAR_MODE') and _VAR_MODE == 'debug' |
|
| 294 | - and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug'] |
|
| 295 | - ) |
|
| 296 | - ) and autoriser('debug') |
|
| 297 | - ) |
|
| 298 | - ? parametre_url(self(), 'var_mode', 'debug', '&') : ''; |
|
| 289 | + return (( |
|
| 290 | + (isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug']) |
|
| 291 | + or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug']) |
|
| 292 | + or ( |
|
| 293 | + defined('_VAR_MODE') and _VAR_MODE == 'debug' |
|
| 294 | + and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug'] |
|
| 295 | + ) |
|
| 296 | + ) and autoriser('debug') |
|
| 297 | + ) |
|
| 298 | + ? parametre_url(self(), 'var_mode', 'debug', '&') : ''; |
|
| 299 | 299 | } |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | foreach ($debug['sourcefile'] as $k => $v) { |
| 103 | 103 | if (strpos($v, 'administration.') !== false) { |
| 104 | - if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | - return $debug['resultat'][$k . 'tout']; |
|
| 104 | + if (isset($debug['resultat'][$k.'tout'])) { |
|
| 105 | + return $debug['resultat'][$k.'tout']; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | and !is_array($id) |
| 179 | 179 | and $id = intval($id) |
| 180 | 180 | ) { |
| 181 | - $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 181 | + $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=".intval($id)); |
|
| 182 | 182 | if ($id) { |
| 183 | 183 | $env[$_id_type] = $id; |
| 184 | 184 | $env['objet'] = $type; |
| 185 | 185 | $env['id_objet'] = $id; |
| 186 | - $env['voir_' . $obj] = |
|
| 186 | + $env['voir_'.$obj] = |
|
| 187 | 187 | str_replace('&', '&', generer_url_entite($id, $obj, '', '', false)); |
| 188 | 188 | if ($desc = $trouver_table(table_objet_sql($type)) |
| 189 | 189 | and isset($desc['field']['id_rubrique']) |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | $notpub = sql_in("statut", array('prop', 'prive')); |
| 238 | 238 | |
| 239 | 239 | if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
| 240 | - $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ")"; |
|
| 240 | + $notpub .= " OR (statut='publie' AND date>".sql_quote(date('Y-m-d H:i:s')).")"; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . "=" . $id . " AND ($notpub)"); |
|
| 243 | + return sql_fetsel('1', table_objet_sql($type), id_table_objet($type)."=".$id." AND ($notpub)"); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | **/ |
| 253 | 253 | function admin_lang() { |
| 254 | 254 | $alang = sql_getfetsel('lang', 'spip_auteurs', |
| 255 | - "login=" . sql_quote(preg_replace(',^@,', '', @$_COOKIE['spip_admin']))); |
|
| 255 | + "login=".sql_quote(preg_replace(',^@,', '', @$_COOKIE['spip_admin']))); |
|
| 256 | 256 | if (!$alang) { |
| 257 | 257 | return ''; |
| 258 | 258 | } |
@@ -275,9 +275,8 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
| 277 | 277 | (parametre_url(self(), 'var_mode', 'debug', '&') |
| 278 | - . '&var_mode_affiche=validation') : |
|
| 279 | - ('http://validator.w3.org/check?uri=' |
|
| 280 | - . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 278 | + . '&var_mode_affiche=validation') : ('http://validator.w3.org/check?uri=' |
|
| 279 | + . rawurlencode("http://".$_SERVER['HTTP_HOST'].nettoyer_uri()))); |
|
| 281 | 280 | } |
| 282 | 281 | |
| 283 | 282 | /** |
@@ -8,53 +8,53 @@ |
||
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 11 | - return; |
|
| 11 | + return; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // Fonction appelee par divers pipelines |
| 15 | 15 | // http://code.spip.net/@notifications_instituerarticle_dist |
| 16 | 16 | function notifications_instituerarticle_dist($quoi, $id_article, $options) { |
| 17 | 17 | |
| 18 | - // ne devrait jamais se produire |
|
| 19 | - if ($options['statut'] == $options['statut_ancien']) { |
|
| 20 | - spip_log('statut inchange', 'notifications'); |
|
| 21 | - |
|
| 22 | - return; |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - include_spip('inc/texte'); |
|
| 26 | - |
|
| 27 | - $modele = ''; |
|
| 28 | - if ($options['statut'] == 'publie') { |
|
| 29 | - if ($GLOBALS['meta']['post_dates'] == 'non' |
|
| 30 | - and strtotime($options['date']) > time() |
|
| 31 | - ) { |
|
| 32 | - $modele = 'notifications/article_valide'; |
|
| 33 | - } else { |
|
| 34 | - $modele = 'notifications/article_publie'; |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - if ($options['statut'] == 'prop' and $options['statut_ancien'] != 'publie') { |
|
| 39 | - $modele = 'notifications/article_propose'; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - if ($modele) { |
|
| 43 | - $destinataires = array(); |
|
| 44 | - if ($GLOBALS['meta']['suivi_edito'] == 'oui') { |
|
| 45 | - $destinataires = explode(',', $GLOBALS['meta']['adresse_suivi']); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - |
|
| 49 | - $destinataires = pipeline( |
|
| 50 | - 'notifications_destinataires', |
|
| 51 | - array( |
|
| 52 | - 'args' => array('quoi' => $quoi, 'id' => $id_article, 'options' => $options), |
|
| 53 | - 'data' => $destinataires |
|
| 54 | - ) |
|
| 55 | - ); |
|
| 56 | - |
|
| 57 | - $texte = email_notification_article($id_article, $modele); |
|
| 58 | - notifications_envoyer_mails($destinataires, $texte); |
|
| 59 | - } |
|
| 18 | + // ne devrait jamais se produire |
|
| 19 | + if ($options['statut'] == $options['statut_ancien']) { |
|
| 20 | + spip_log('statut inchange', 'notifications'); |
|
| 21 | + |
|
| 22 | + return; |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + include_spip('inc/texte'); |
|
| 26 | + |
|
| 27 | + $modele = ''; |
|
| 28 | + if ($options['statut'] == 'publie') { |
|
| 29 | + if ($GLOBALS['meta']['post_dates'] == 'non' |
|
| 30 | + and strtotime($options['date']) > time() |
|
| 31 | + ) { |
|
| 32 | + $modele = 'notifications/article_valide'; |
|
| 33 | + } else { |
|
| 34 | + $modele = 'notifications/article_publie'; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + if ($options['statut'] == 'prop' and $options['statut_ancien'] != 'publie') { |
|
| 39 | + $modele = 'notifications/article_propose'; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + if ($modele) { |
|
| 43 | + $destinataires = array(); |
|
| 44 | + if ($GLOBALS['meta']['suivi_edito'] == 'oui') { |
|
| 45 | + $destinataires = explode(',', $GLOBALS['meta']['adresse_suivi']); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + |
|
| 49 | + $destinataires = pipeline( |
|
| 50 | + 'notifications_destinataires', |
|
| 51 | + array( |
|
| 52 | + 'args' => array('quoi' => $quoi, 'id' => $id_article, 'options' => $options), |
|
| 53 | + 'data' => $destinataires |
|
| 54 | + ) |
|
| 55 | + ); |
|
| 56 | + |
|
| 57 | + $texte = email_notification_article($id_article, $modele); |
|
| 58 | + notifications_envoyer_mails($destinataires, $texte); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -20,18 +20,18 @@ |
||
| 20 | 20 | $var_auth = $auth(); |
| 21 | 21 | |
| 22 | 22 | if ($var_auth !== '') { |
| 23 | - if (!is_int($var_auth)) { |
|
| 24 | - // si l'authentifie' n'a pas acces a l'espace de redac |
|
| 25 | - // c'est qu'on voulait forcer sa reconnaissance en tant que visiteur. |
|
| 26 | - // On reexecute pour deboucher sur le include public. |
|
| 27 | - // autrement on insiste |
|
| 28 | - if (is_array($var_auth)) { |
|
| 29 | - $var_auth = '../?' . $_SERVER['QUERY_STRING']; |
|
| 30 | - spip_setcookie('spip_session', $_COOKIE['spip_session'], time() + 3600 * 24 * 14); |
|
| 31 | - } |
|
| 32 | - include_spip('inc/headers'); |
|
| 33 | - redirige_formulaire($var_auth); |
|
| 34 | - } |
|
| 23 | + if (!is_int($var_auth)) { |
|
| 24 | + // si l'authentifie' n'a pas acces a l'espace de redac |
|
| 25 | + // c'est qu'on voulait forcer sa reconnaissance en tant que visiteur. |
|
| 26 | + // On reexecute pour deboucher sur le include public. |
|
| 27 | + // autrement on insiste |
|
| 28 | + if (is_array($var_auth)) { |
|
| 29 | + $var_auth = '../?' . $_SERVER['QUERY_STRING']; |
|
| 30 | + spip_setcookie('spip_session', $_COOKIE['spip_session'], time() + 3600 * 24 * 14); |
|
| 31 | + } |
|
| 32 | + include_spip('inc/headers'); |
|
| 33 | + redirige_formulaire($var_auth); |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // En somme, est prive' ce qui est publiquement nomme'... |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | // On reexecute pour deboucher sur le include public. |
| 27 | 27 | // autrement on insiste |
| 28 | 28 | if (is_array($var_auth)) { |
| 29 | - $var_auth = '../?' . $_SERVER['QUERY_STRING']; |
|
| 29 | + $var_auth = '../?'.$_SERVER['QUERY_STRING']; |
|
| 30 | 30 | spip_setcookie('spip_session', $_COOKIE['spip_session'], time() + 3600 * 24 * 14); |
| 31 | 31 | } |
| 32 | 32 | include_spip('inc/headers'); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/charsets'); |
| 17 | 17 | include_spip('inc/texte'); |
@@ -19,54 +19,54 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // http://code.spip.net/@ligne_plug |
| 21 | 21 | function plugins_afficher_nom_plugin_dist( |
| 22 | - $url_page, |
|
| 23 | - $plug_file, |
|
| 24 | - $checked, |
|
| 25 | - $actif, |
|
| 26 | - $expose = false, |
|
| 27 | - $class_li = "item", |
|
| 28 | - $dir_plugins = _DIR_PLUGINS |
|
| 22 | + $url_page, |
|
| 23 | + $plug_file, |
|
| 24 | + $checked, |
|
| 25 | + $actif, |
|
| 26 | + $expose = false, |
|
| 27 | + $class_li = "item", |
|
| 28 | + $dir_plugins = _DIR_PLUGINS |
|
| 29 | 29 | ) { |
| 30 | - static $id_input = 0; |
|
| 31 | - static $versions = array(); |
|
| 30 | + static $id_input = 0; |
|
| 31 | + static $versions = array(); |
|
| 32 | 32 | |
| 33 | - $erreur = false; |
|
| 34 | - $s = ""; |
|
| 33 | + $erreur = false; |
|
| 34 | + $s = ""; |
|
| 35 | 35 | |
| 36 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | - $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 36 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | + $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 38 | 38 | |
| 39 | - // numerotons les occurences d'un meme prefix |
|
| 40 | - $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 41 | - $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 39 | + // numerotons les occurences d'un meme prefix |
|
| 40 | + $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 41 | + $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 42 | 42 | |
| 43 | - $class = $class_li; |
|
| 44 | - $class .= $actif ? " actif" : ""; |
|
| 45 | - $class .= $expose ? " on" : ""; |
|
| 46 | - $erreur = isset($info['erreur']); |
|
| 47 | - if ($erreur) { |
|
| 48 | - $class .= " error"; |
|
| 49 | - } |
|
| 50 | - $s .= "<li id='$id' class='$class'>"; |
|
| 43 | + $class = $class_li; |
|
| 44 | + $class .= $actif ? " actif" : ""; |
|
| 45 | + $class .= $expose ? " on" : ""; |
|
| 46 | + $erreur = isset($info['erreur']); |
|
| 47 | + if ($erreur) { |
|
| 48 | + $class .= " error"; |
|
| 49 | + } |
|
| 50 | + $s .= "<li id='$id' class='$class'>"; |
|
| 51 | 51 | |
| 52 | - // Cartouche Resume |
|
| 53 | - $s .= "<div class='resume'>"; |
|
| 52 | + // Cartouche Resume |
|
| 53 | + $s .= "<div class='resume'>"; |
|
| 54 | 54 | |
| 55 | - $prefix = $info['prefix']; |
|
| 56 | - $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 57 | - $desc = plugin_propre($info['description'], $dir); |
|
| 58 | - $url_stat = parametre_url($url_page, "plugin", $dir_plugins . $plug_file); |
|
| 55 | + $prefix = $info['prefix']; |
|
| 56 | + $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 57 | + $desc = plugin_propre($info['description'], $dir); |
|
| 58 | + $url_stat = parametre_url($url_page, "plugin", $dir_plugins . $plug_file); |
|
| 59 | 59 | |
| 60 | - $s .= "<strong class='nom'>" . typo($info['nom']) . "</strong>"; |
|
| 61 | - $s .= " <span class='version'>" . $info['version'] . "</span>"; |
|
| 62 | - $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . "</span>"; |
|
| 63 | - $s .= "</div>"; |
|
| 60 | + $s .= "<strong class='nom'>" . typo($info['nom']) . "</strong>"; |
|
| 61 | + $s .= " <span class='version'>" . $info['version'] . "</span>"; |
|
| 62 | + $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . "</span>"; |
|
| 63 | + $s .= "</div>"; |
|
| 64 | 64 | |
| 65 | - if ($erreur) { |
|
| 66 | - $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 67 | - } |
|
| 65 | + if ($erreur) { |
|
| 66 | + $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $s .= "</li>"; |
|
| 69 | + $s .= "</li>"; |
|
| 70 | 70 | |
| 71 | - return $s; |
|
| 71 | + return $s; |
|
| 72 | 72 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // numerotons les occurences d'un meme prefix |
| 40 | 40 | $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
| 41 | - $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 41 | + $id = $info['prefix'].$versions[$info['prefix']]; |
|
| 42 | 42 | |
| 43 | 43 | $class = $class_li; |
| 44 | 44 | $class .= $actif ? " actif" : ""; |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | $prefix = $info['prefix']; |
| 56 | 56 | $dir = "$dir_plugins$plug_file/lang/$prefix"; |
| 57 | 57 | $desc = plugin_propre($info['description'], $dir); |
| 58 | - $url_stat = parametre_url($url_page, "plugin", $dir_plugins . $plug_file); |
|
| 58 | + $url_stat = parametre_url($url_page, "plugin", $dir_plugins.$plug_file); |
|
| 59 | 59 | |
| 60 | - $s .= "<strong class='nom'>" . typo($info['nom']) . "</strong>"; |
|
| 61 | - $s .= " <span class='version'>" . $info['version'] . "</span>"; |
|
| 62 | - $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . "</span>"; |
|
| 60 | + $s .= "<strong class='nom'>".typo($info['nom'])."</strong>"; |
|
| 61 | + $s .= " <span class='version'>".$info['version']."</span>"; |
|
| 62 | + $s .= " <span class='etat'> - ".plugin_etat_en_clair($info['etat'])."</span>"; |
|
| 63 | 63 | $s .= "</div>"; |
| 64 | 64 | |
| 65 | 65 | if ($erreur) { |
| 66 | - $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 66 | + $s .= "<div class='erreur'>".join('<br >', $info['erreur'])."</div>"; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $s .= "</li>"; |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | $dir = constant($dir); |
| 67 | 67 | foreach ($infos['install'] as $file) { |
| 68 | - $file = $dir . $plug . "/" . trim($file); |
|
| 68 | + $file = $dir.$plug."/".trim($file); |
|
| 69 | 69 | if (file_exists($file)) { |
| 70 | 70 | include_once($file); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | $version = isset($infos['schema']) ? $infos['schema'] : ''; |
| 74 | 74 | $arg = $infos; |
| 75 | - $f = $infos['prefix'] . "_install"; |
|
| 75 | + $f = $infos['prefix']."_install"; |
|
| 76 | 76 | if (!function_exists($f)) { |
| 77 | 77 | $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
| 78 | 78 | } else { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return true; |
| 95 | 95 | } |
| 96 | 96 | // Si install et que l'on a la meta d'installation, c'est un upgrade |
| 97 | - if ($action == 'install' && !is_null(lire_meta($infos['prefix'] . '_base_version'))) { |
|
| 97 | + if ($action == 'install' && !is_null(lire_meta($infos['prefix'].'_base_version'))) { |
|
| 98 | 98 | $infos['upgrade'] = true; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if (isset($infos['meta']) and (($table = $infos['meta']) !== 'meta')) { |
| 121 | 121 | $nom_meta = "base_version"; |
| 122 | 122 | } else { |
| 123 | - $nom_meta = $prefix . "_base_version"; |
|
| 123 | + $nom_meta = $prefix."_base_version"; |
|
| 124 | 124 | $table = 'meta'; |
| 125 | 125 | } |
| 126 | 126 | switch ($action) { |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
| 131 | 131 | break; |
| 132 | 132 | case 'install': |
| 133 | - if (function_exists($upgrade = $prefix . "_upgrade")) { |
|
| 133 | + if (function_exists($upgrade = $prefix."_upgrade")) { |
|
| 134 | 134 | $upgrade($nom_meta, $version_cible, $table); |
| 135 | 135 | } |
| 136 | 136 | break; |
| 137 | 137 | case 'uninstall': |
| 138 | - if (function_exists($vider_tables = $prefix . "_vider_tables")) { |
|
| 138 | + if (function_exists($vider_tables = $prefix."_vider_tables")) { |
|
| 139 | 139 | $vider_tables($nom_meta, $table); |
| 140 | 140 | } |
| 141 | 141 | break; |
@@ -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 | /** |
@@ -53,93 +53,93 @@ discard block |
||
| 53 | 53 | * - le tableau de get_infos sinon |
| 54 | 54 | */ |
| 55 | 55 | function plugins_installer_dist($plug, $action, $dir_type = '_DIR_PLUGINS') { |
| 56 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 57 | - $infos = $get_infos($plug, false, constant($dir_type)); |
|
| 58 | - if (!isset($infos['install']) or !$infos['install']) { |
|
| 59 | - return false; |
|
| 60 | - } |
|
| 61 | - // passer en chemin absolu si possible, c'est plus efficace |
|
| 62 | - $dir = str_replace('_DIR_', '_ROOT_', $dir_type); |
|
| 63 | - if (!defined($dir)) { |
|
| 64 | - $dir = $dir_type; |
|
| 65 | - } |
|
| 66 | - $dir = constant($dir); |
|
| 67 | - foreach ($infos['install'] as $file) { |
|
| 68 | - $file = $dir . $plug . "/" . trim($file); |
|
| 69 | - if (file_exists($file)) { |
|
| 70 | - include_once($file); |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - $version = isset($infos['schema']) ? $infos['schema'] : ''; |
|
| 74 | - $arg = $infos; |
|
| 75 | - $f = $infos['prefix'] . "_install"; |
|
| 76 | - if (!function_exists($f)) { |
|
| 77 | - $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
|
| 78 | - } else { |
|
| 79 | - $arg = $infos['prefix']; |
|
| 80 | - } // stupide: info deja dans le nom |
|
| 81 | - |
|
| 82 | - if (!$f) { |
|
| 83 | - // installation sans operation particuliere |
|
| 84 | - $infos['install_test'] = array(true, ''); |
|
| 85 | - |
|
| 86 | - return $infos; |
|
| 87 | - } |
|
| 88 | - $test = $f('test', $arg, $version); |
|
| 89 | - if ($action == 'uninstall') { |
|
| 90 | - $test = !$test; |
|
| 91 | - } |
|
| 92 | - // Si deja fait, on ne dit rien |
|
| 93 | - if ($test) { |
|
| 94 | - return true; |
|
| 95 | - } |
|
| 96 | - // Si install et que l'on a la meta d'installation, c'est un upgrade |
|
| 97 | - if ($action == 'install' && !is_null(lire_meta($infos['prefix'] . '_base_version'))) { |
|
| 98 | - $infos['upgrade'] = true; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - // executer l'installation ou l'inverse |
|
| 102 | - // et renvoyer la trace (mais il faudrait passer en AJAX plutot) |
|
| 103 | - ob_start(); |
|
| 104 | - $f($action, $arg, $version); |
|
| 105 | - $aff = ob_get_contents(); |
|
| 106 | - ob_end_clean(); |
|
| 107 | - // vider le cache des descriptions de tables a chaque (de)installation |
|
| 108 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 109 | - $trouver_table(''); |
|
| 110 | - $infos['install_test'] = array($f('test', $arg, $version), $aff); |
|
| 111 | - |
|
| 112 | - return $infos; |
|
| 56 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 57 | + $infos = $get_infos($plug, false, constant($dir_type)); |
|
| 58 | + if (!isset($infos['install']) or !$infos['install']) { |
|
| 59 | + return false; |
|
| 60 | + } |
|
| 61 | + // passer en chemin absolu si possible, c'est plus efficace |
|
| 62 | + $dir = str_replace('_DIR_', '_ROOT_', $dir_type); |
|
| 63 | + if (!defined($dir)) { |
|
| 64 | + $dir = $dir_type; |
|
| 65 | + } |
|
| 66 | + $dir = constant($dir); |
|
| 67 | + foreach ($infos['install'] as $file) { |
|
| 68 | + $file = $dir . $plug . "/" . trim($file); |
|
| 69 | + if (file_exists($file)) { |
|
| 70 | + include_once($file); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + $version = isset($infos['schema']) ? $infos['schema'] : ''; |
|
| 74 | + $arg = $infos; |
|
| 75 | + $f = $infos['prefix'] . "_install"; |
|
| 76 | + if (!function_exists($f)) { |
|
| 77 | + $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
|
| 78 | + } else { |
|
| 79 | + $arg = $infos['prefix']; |
|
| 80 | + } // stupide: info deja dans le nom |
|
| 81 | + |
|
| 82 | + if (!$f) { |
|
| 83 | + // installation sans operation particuliere |
|
| 84 | + $infos['install_test'] = array(true, ''); |
|
| 85 | + |
|
| 86 | + return $infos; |
|
| 87 | + } |
|
| 88 | + $test = $f('test', $arg, $version); |
|
| 89 | + if ($action == 'uninstall') { |
|
| 90 | + $test = !$test; |
|
| 91 | + } |
|
| 92 | + // Si deja fait, on ne dit rien |
|
| 93 | + if ($test) { |
|
| 94 | + return true; |
|
| 95 | + } |
|
| 96 | + // Si install et que l'on a la meta d'installation, c'est un upgrade |
|
| 97 | + if ($action == 'install' && !is_null(lire_meta($infos['prefix'] . '_base_version'))) { |
|
| 98 | + $infos['upgrade'] = true; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + // executer l'installation ou l'inverse |
|
| 102 | + // et renvoyer la trace (mais il faudrait passer en AJAX plutot) |
|
| 103 | + ob_start(); |
|
| 104 | + $f($action, $arg, $version); |
|
| 105 | + $aff = ob_get_contents(); |
|
| 106 | + ob_end_clean(); |
|
| 107 | + // vider le cache des descriptions de tables a chaque (de)installation |
|
| 108 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 109 | + $trouver_table(''); |
|
| 110 | + $infos['install_test'] = array($f('test', $arg, $version), $aff); |
|
| 111 | + |
|
| 112 | + return $infos; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Fonction par defaut pour install/desinstall |
| 116 | 116 | |
| 117 | 117 | // http://code.spip.net/@spip_plugin_install |
| 118 | 118 | function spip_plugin_install($action, $infos, $version_cible) { |
| 119 | - $prefix = $infos['prefix']; |
|
| 120 | - if (isset($infos['meta']) and (($table = $infos['meta']) !== 'meta')) { |
|
| 121 | - $nom_meta = "base_version"; |
|
| 122 | - } else { |
|
| 123 | - $nom_meta = $prefix . "_base_version"; |
|
| 124 | - $table = 'meta'; |
|
| 125 | - } |
|
| 126 | - switch ($action) { |
|
| 127 | - case 'test': |
|
| 128 | - return (isset($GLOBALS[$table]) |
|
| 129 | - and isset($GLOBALS[$table][$nom_meta]) |
|
| 130 | - and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
|
| 131 | - break; |
|
| 132 | - case 'install': |
|
| 133 | - if (function_exists($upgrade = $prefix . "_upgrade")) { |
|
| 134 | - $upgrade($nom_meta, $version_cible, $table); |
|
| 135 | - } |
|
| 136 | - break; |
|
| 137 | - case 'uninstall': |
|
| 138 | - if (function_exists($vider_tables = $prefix . "_vider_tables")) { |
|
| 139 | - $vider_tables($nom_meta, $table); |
|
| 140 | - } |
|
| 141 | - break; |
|
| 142 | - } |
|
| 119 | + $prefix = $infos['prefix']; |
|
| 120 | + if (isset($infos['meta']) and (($table = $infos['meta']) !== 'meta')) { |
|
| 121 | + $nom_meta = "base_version"; |
|
| 122 | + } else { |
|
| 123 | + $nom_meta = $prefix . "_base_version"; |
|
| 124 | + $table = 'meta'; |
|
| 125 | + } |
|
| 126 | + switch ($action) { |
|
| 127 | + case 'test': |
|
| 128 | + return (isset($GLOBALS[$table]) |
|
| 129 | + and isset($GLOBALS[$table][$nom_meta]) |
|
| 130 | + and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
|
| 131 | + break; |
|
| 132 | + case 'install': |
|
| 133 | + if (function_exists($upgrade = $prefix . "_upgrade")) { |
|
| 134 | + $upgrade($nom_meta, $version_cible, $table); |
|
| 135 | + } |
|
| 136 | + break; |
|
| 137 | + case 'uninstall': |
|
| 138 | + if (function_exists($vider_tables = $prefix . "_vider_tables")) { |
|
| 139 | + $vider_tables($nom_meta, $table); |
|
| 140 | + } |
|
| 141 | + break; |
|
| 142 | + } |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
@@ -164,34 +164,34 @@ discard block |
||
| 164 | 164 | * Avec operateur : bool. |
| 165 | 165 | **/ |
| 166 | 166 | function spip_version_compare($v1, $v2, $op = null) { |
| 167 | - $v1 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v1)); |
|
| 168 | - $v2 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v2)); |
|
| 169 | - $v1 = str_replace('rc', 'RC', $v1); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 170 | - $v2 = str_replace('rc', 'RC', $v2); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 171 | - |
|
| 172 | - $v1 = explode('.', $v1); |
|
| 173 | - $v2 = explode('.', $v2); |
|
| 174 | - // $v1 est toujours une version, donc sans etoile |
|
| 175 | - while (count($v1) < count($v2)) { |
|
| 176 | - $v1[] = '0'; |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - // $v2 peut etre une borne, donc accepte l'etoile |
|
| 180 | - $etoile = false; |
|
| 181 | - foreach ($v1 as $k => $v) { |
|
| 182 | - if (!isset($v2[$k])) { |
|
| 183 | - $v2[] = ($etoile and (is_numeric($v) or $v == 'pl' or $v == 'p')) ? $v : '0'; |
|
| 184 | - } else { |
|
| 185 | - if ($v2[$k] == '*') { |
|
| 186 | - $etoile = true; |
|
| 187 | - $v2[$k] = $v; |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - $v1 = implode('.', $v1); |
|
| 192 | - $v2 = implode('.', $v2); |
|
| 193 | - |
|
| 194 | - return $op ? version_compare($v1, $v2, $op) : version_compare($v1, $v2); |
|
| 167 | + $v1 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v1)); |
|
| 168 | + $v2 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v2)); |
|
| 169 | + $v1 = str_replace('rc', 'RC', $v1); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 170 | + $v2 = str_replace('rc', 'RC', $v2); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 171 | + |
|
| 172 | + $v1 = explode('.', $v1); |
|
| 173 | + $v2 = explode('.', $v2); |
|
| 174 | + // $v1 est toujours une version, donc sans etoile |
|
| 175 | + while (count($v1) < count($v2)) { |
|
| 176 | + $v1[] = '0'; |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + // $v2 peut etre une borne, donc accepte l'etoile |
|
| 180 | + $etoile = false; |
|
| 181 | + foreach ($v1 as $k => $v) { |
|
| 182 | + if (!isset($v2[$k])) { |
|
| 183 | + $v2[] = ($etoile and (is_numeric($v) or $v == 'pl' or $v == 'p')) ? $v : '0'; |
|
| 184 | + } else { |
|
| 185 | + if ($v2[$k] == '*') { |
|
| 186 | + $etoile = true; |
|
| 187 | + $v2[$k] = $v; |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + $v1 = implode('.', $v1); |
|
| 192 | + $v2 = implode('.', $v2); |
|
| 193 | + |
|
| 194 | + return $op ? version_compare($v1, $v2, $op) : version_compare($v1, $v2); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -209,29 +209,29 @@ discard block |
||
| 209 | 209 | * @return array Tableau des plugins actifs |
| 210 | 210 | **/ |
| 211 | 211 | function liste_plugin_actifs() { |
| 212 | - $liste = isset($GLOBALS['meta']['plugin']) ? $GLOBALS['meta']['plugin'] : ''; |
|
| 213 | - if (!$liste) { |
|
| 214 | - return array(); |
|
| 215 | - } |
|
| 216 | - if (!is_array($liste = unserialize($liste))) { |
|
| 217 | - // compatibilite pre 1.9.2, mettre a jour la meta |
|
| 218 | - spip_log("MAJ meta plugin vieille version : $liste", "plugin"); |
|
| 219 | - $new = true; |
|
| 220 | - list(, $liste) = liste_plugin_valides(explode(",", $liste)); |
|
| 221 | - } else { |
|
| 222 | - $new = false; |
|
| 223 | - // compat au moment d'une migration depuis version anterieure |
|
| 224 | - // si pas de dir_type, alors c'est _DIR_PLUGINS |
|
| 225 | - foreach ($liste as $prefix => $infos) { |
|
| 226 | - if (!isset($infos['dir_type'])) { |
|
| 227 | - $liste[$prefix]['dir_type'] = "_DIR_PLUGINS"; |
|
| 228 | - $new = true; |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - } |
|
| 232 | - if ($new) { |
|
| 233 | - ecrire_meta('plugin', serialize($liste)); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - return $liste; |
|
| 212 | + $liste = isset($GLOBALS['meta']['plugin']) ? $GLOBALS['meta']['plugin'] : ''; |
|
| 213 | + if (!$liste) { |
|
| 214 | + return array(); |
|
| 215 | + } |
|
| 216 | + if (!is_array($liste = unserialize($liste))) { |
|
| 217 | + // compatibilite pre 1.9.2, mettre a jour la meta |
|
| 218 | + spip_log("MAJ meta plugin vieille version : $liste", "plugin"); |
|
| 219 | + $new = true; |
|
| 220 | + list(, $liste) = liste_plugin_valides(explode(",", $liste)); |
|
| 221 | + } else { |
|
| 222 | + $new = false; |
|
| 223 | + // compat au moment d'une migration depuis version anterieure |
|
| 224 | + // si pas de dir_type, alors c'est _DIR_PLUGINS |
|
| 225 | + foreach ($liste as $prefix => $infos) { |
|
| 226 | + if (!isset($infos['dir_type'])) { |
|
| 227 | + $liste[$prefix]['dir_type'] = "_DIR_PLUGINS"; |
|
| 228 | + $new = true; |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + } |
|
| 232 | + if ($new) { |
|
| 233 | + ecrire_meta('plugin', serialize($liste)); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + return $liste; |
|
| 237 | 237 | } |
@@ -17,116 +17,116 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // lecture d'un texte ecrit en pseudo-xml issu d'un fichier plugin.xml |
| 24 | 24 | // et conversion approximative en tableau PHP. |
| 25 | 25 | function plugins_infos_plugin($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) { |
| 26 | - include_spip('inc/xml'); |
|
| 27 | - $arbre = spip_xml_parse($desc); |
|
| 28 | - |
|
| 29 | - $verifie_conformite = charger_fonction('verifie_conformite', 'plugins'); |
|
| 30 | - $verifie_conformite($plug, $arbre, $dir_plugins); |
|
| 31 | - |
|
| 32 | - include_spip('inc/charsets'); |
|
| 33 | - |
|
| 34 | - // On renvoie la DTD utilisee |
|
| 35 | - $ret['dtd'] = "plugin"; |
|
| 36 | - |
|
| 37 | - if (isset($arbre['categorie'])) { |
|
| 38 | - $ret['categorie'] = trim(spip_xml_aplatit($arbre['categorie'])); |
|
| 39 | - } |
|
| 40 | - if (isset($arbre['nom'])) { |
|
| 41 | - $ret['nom'] = charset2unicode(spip_xml_aplatit($arbre['nom'])); |
|
| 42 | - } |
|
| 43 | - if (isset($arbre['icon'])) { |
|
| 44 | - $ret['logo'] = trim(spip_xml_aplatit($arbre['icon'])); |
|
| 45 | - } |
|
| 46 | - if (isset($arbre['auteur'])) { |
|
| 47 | - $ret['auteur'][] = trim(spip_xml_aplatit($arbre['auteur'])); |
|
| 48 | - } // garder le 1er niveau en tableau mais traiter le multi possible |
|
| 49 | - if (isset($arbre['licence'])) { |
|
| 50 | - $ret['licence'][] = trim(spip_xml_aplatit($arbre['licence'])); |
|
| 51 | - } |
|
| 52 | - if (isset($arbre['version'])) { |
|
| 53 | - $ret['version'] = trim(spip_xml_aplatit($arbre['version'])); |
|
| 54 | - } |
|
| 55 | - if (isset($arbre['version_base'])) { |
|
| 56 | - $ret['schema'] = trim(spip_xml_aplatit($arbre['version_base'])); |
|
| 57 | - } |
|
| 58 | - if (isset($arbre['etat'])) { |
|
| 59 | - $ret['etat'] = trim(spip_xml_aplatit($arbre['etat'])); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - $ret['description'] = $ret['slogan'] = ""; |
|
| 63 | - if (isset($arbre['slogan'])) { |
|
| 64 | - $ret['slogan'] = trim(spip_xml_aplatit($arbre['slogan'])); |
|
| 65 | - } |
|
| 66 | - if (isset($arbre['description'])) { |
|
| 67 | - $ret['description'] = trim(spip_xml_aplatit($arbre['description'])); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (isset($arbre['lien'])) { |
|
| 71 | - $ret['documentation'] = trim(join(' ', $arbre['lien'])); |
|
| 72 | - if ($ret['documentation']) { |
|
| 73 | - // le lien de doc doit etre une url et c'est tout |
|
| 74 | - if (!tester_url_absolue($ret['documentation'])) { |
|
| 75 | - $ret['documentation'] = ""; |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - if (isset($arbre['options'])) { |
|
| 81 | - $ret['options'] = $arbre['options']; |
|
| 82 | - } |
|
| 83 | - if (isset($arbre['fonctions'])) { |
|
| 84 | - $ret['fonctions'] = $arbre['fonctions']; |
|
| 85 | - } |
|
| 86 | - if (isset($arbre['prefix'][0])) { |
|
| 87 | - $ret['prefix'] = trim(array_pop($arbre['prefix'])); |
|
| 88 | - } |
|
| 89 | - if (isset($arbre['install'])) { |
|
| 90 | - $ret['install'] = $arbre['install']; |
|
| 91 | - } |
|
| 92 | - if (isset($arbre['meta'])) { |
|
| 93 | - $ret['meta'] = trim(spip_xml_aplatit($arbre['meta'])); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $necessite = info_plugin_normalise_necessite(isset($arbre['necessite']) ? $arbre['necessite'] : ''); |
|
| 97 | - $ret['compatibilite'] = isset($necessite['compatible']) ? $necessite['compatible'] : ''; |
|
| 98 | - $ret['necessite'] = $necessite['necessite']; |
|
| 99 | - $ret['lib'] = $necessite['lib']; |
|
| 100 | - $ret['utilise'] = info_plugin_normalise_utilise(isset($arbre['utilise']) ? $arbre['utilise'] : ''); |
|
| 101 | - $ret['procure'] = info_plugin_normalise_procure(isset($arbre['procure']) ? $arbre['procure'] : ''); |
|
| 102 | - $ret['chemin'] = info_plugin_normalise_chemin(isset($arbre['path']) ? $arbre['path'] : ''); |
|
| 103 | - |
|
| 104 | - if (isset($arbre['pipeline'])) { |
|
| 105 | - $ret['pipeline'] = $arbre['pipeline']; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - $extraire_boutons = charger_fonction('extraire_boutons', 'plugins'); |
|
| 109 | - $les_boutons = $extraire_boutons($arbre); |
|
| 110 | - $ret['menu'] = $les_boutons['bouton']; |
|
| 111 | - $ret['onglet'] = $les_boutons['onglet']; |
|
| 112 | - |
|
| 113 | - $ret['traduire'] = isset($arbre['traduire']) ? $arbre['traduire'] : ''; |
|
| 114 | - |
|
| 115 | - if (isset($arbre['config'])) { |
|
| 116 | - $ret['config'] = spip_xml_aplatit($arbre['config']); |
|
| 117 | - } |
|
| 118 | - if (isset($arbre['noisette'])) { |
|
| 119 | - $ret['noisette'] = $arbre['noisette']; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - if (isset($arbre['erreur'])) { |
|
| 123 | - $ret['erreur'] = $arbre['erreur']; |
|
| 124 | - if ($plug) { |
|
| 125 | - spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur'])); |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - return $ret; |
|
| 26 | + include_spip('inc/xml'); |
|
| 27 | + $arbre = spip_xml_parse($desc); |
|
| 28 | + |
|
| 29 | + $verifie_conformite = charger_fonction('verifie_conformite', 'plugins'); |
|
| 30 | + $verifie_conformite($plug, $arbre, $dir_plugins); |
|
| 31 | + |
|
| 32 | + include_spip('inc/charsets'); |
|
| 33 | + |
|
| 34 | + // On renvoie la DTD utilisee |
|
| 35 | + $ret['dtd'] = "plugin"; |
|
| 36 | + |
|
| 37 | + if (isset($arbre['categorie'])) { |
|
| 38 | + $ret['categorie'] = trim(spip_xml_aplatit($arbre['categorie'])); |
|
| 39 | + } |
|
| 40 | + if (isset($arbre['nom'])) { |
|
| 41 | + $ret['nom'] = charset2unicode(spip_xml_aplatit($arbre['nom'])); |
|
| 42 | + } |
|
| 43 | + if (isset($arbre['icon'])) { |
|
| 44 | + $ret['logo'] = trim(spip_xml_aplatit($arbre['icon'])); |
|
| 45 | + } |
|
| 46 | + if (isset($arbre['auteur'])) { |
|
| 47 | + $ret['auteur'][] = trim(spip_xml_aplatit($arbre['auteur'])); |
|
| 48 | + } // garder le 1er niveau en tableau mais traiter le multi possible |
|
| 49 | + if (isset($arbre['licence'])) { |
|
| 50 | + $ret['licence'][] = trim(spip_xml_aplatit($arbre['licence'])); |
|
| 51 | + } |
|
| 52 | + if (isset($arbre['version'])) { |
|
| 53 | + $ret['version'] = trim(spip_xml_aplatit($arbre['version'])); |
|
| 54 | + } |
|
| 55 | + if (isset($arbre['version_base'])) { |
|
| 56 | + $ret['schema'] = trim(spip_xml_aplatit($arbre['version_base'])); |
|
| 57 | + } |
|
| 58 | + if (isset($arbre['etat'])) { |
|
| 59 | + $ret['etat'] = trim(spip_xml_aplatit($arbre['etat'])); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + $ret['description'] = $ret['slogan'] = ""; |
|
| 63 | + if (isset($arbre['slogan'])) { |
|
| 64 | + $ret['slogan'] = trim(spip_xml_aplatit($arbre['slogan'])); |
|
| 65 | + } |
|
| 66 | + if (isset($arbre['description'])) { |
|
| 67 | + $ret['description'] = trim(spip_xml_aplatit($arbre['description'])); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (isset($arbre['lien'])) { |
|
| 71 | + $ret['documentation'] = trim(join(' ', $arbre['lien'])); |
|
| 72 | + if ($ret['documentation']) { |
|
| 73 | + // le lien de doc doit etre une url et c'est tout |
|
| 74 | + if (!tester_url_absolue($ret['documentation'])) { |
|
| 75 | + $ret['documentation'] = ""; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + if (isset($arbre['options'])) { |
|
| 81 | + $ret['options'] = $arbre['options']; |
|
| 82 | + } |
|
| 83 | + if (isset($arbre['fonctions'])) { |
|
| 84 | + $ret['fonctions'] = $arbre['fonctions']; |
|
| 85 | + } |
|
| 86 | + if (isset($arbre['prefix'][0])) { |
|
| 87 | + $ret['prefix'] = trim(array_pop($arbre['prefix'])); |
|
| 88 | + } |
|
| 89 | + if (isset($arbre['install'])) { |
|
| 90 | + $ret['install'] = $arbre['install']; |
|
| 91 | + } |
|
| 92 | + if (isset($arbre['meta'])) { |
|
| 93 | + $ret['meta'] = trim(spip_xml_aplatit($arbre['meta'])); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $necessite = info_plugin_normalise_necessite(isset($arbre['necessite']) ? $arbre['necessite'] : ''); |
|
| 97 | + $ret['compatibilite'] = isset($necessite['compatible']) ? $necessite['compatible'] : ''; |
|
| 98 | + $ret['necessite'] = $necessite['necessite']; |
|
| 99 | + $ret['lib'] = $necessite['lib']; |
|
| 100 | + $ret['utilise'] = info_plugin_normalise_utilise(isset($arbre['utilise']) ? $arbre['utilise'] : ''); |
|
| 101 | + $ret['procure'] = info_plugin_normalise_procure(isset($arbre['procure']) ? $arbre['procure'] : ''); |
|
| 102 | + $ret['chemin'] = info_plugin_normalise_chemin(isset($arbre['path']) ? $arbre['path'] : ''); |
|
| 103 | + |
|
| 104 | + if (isset($arbre['pipeline'])) { |
|
| 105 | + $ret['pipeline'] = $arbre['pipeline']; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + $extraire_boutons = charger_fonction('extraire_boutons', 'plugins'); |
|
| 109 | + $les_boutons = $extraire_boutons($arbre); |
|
| 110 | + $ret['menu'] = $les_boutons['bouton']; |
|
| 111 | + $ret['onglet'] = $les_boutons['onglet']; |
|
| 112 | + |
|
| 113 | + $ret['traduire'] = isset($arbre['traduire']) ? $arbre['traduire'] : ''; |
|
| 114 | + |
|
| 115 | + if (isset($arbre['config'])) { |
|
| 116 | + $ret['config'] = spip_xml_aplatit($arbre['config']); |
|
| 117 | + } |
|
| 118 | + if (isset($arbre['noisette'])) { |
|
| 119 | + $ret['noisette'] = $arbre['noisette']; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + if (isset($arbre['erreur'])) { |
|
| 123 | + $ret['erreur'] = $arbre['erreur']; |
|
| 124 | + if ($plug) { |
|
| 125 | + spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur'])); |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + return $ret; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
@@ -153,27 +153,27 @@ discard block |
||
| 153 | 153 | * Liste des necessite modifiés. |
| 154 | 154 | */ |
| 155 | 155 | function info_plugin_normalise_necessite($necessite) { |
| 156 | - $res = array('necessite' => array(), 'lib' => array()); |
|
| 157 | - |
|
| 158 | - if (is_array($necessite)) { |
|
| 159 | - foreach ($necessite as $need) { |
|
| 160 | - $id = $need['id']; |
|
| 161 | - $v = isset($need['version']) ? $need['version'] : ''; |
|
| 162 | - |
|
| 163 | - // Necessite SPIP version x ? |
|
| 164 | - if (strtoupper($id) == 'SPIP') { |
|
| 165 | - $res['compatible'] = $v; |
|
| 166 | - } else { |
|
| 167 | - if (preg_match(',^lib:\s*([^\s]*),i', $id, $r)) { |
|
| 168 | - $res['lib'][] = array('nom' => $r[1], 'id' => $r[1], 'lien' => $need['src']); |
|
| 169 | - } else { |
|
| 170 | - $res['necessite'][] = array('id' => $id, 'nom' => $id, 'version' => $v, 'compatibilite' => $v); |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - return $res; |
|
| 156 | + $res = array('necessite' => array(), 'lib' => array()); |
|
| 157 | + |
|
| 158 | + if (is_array($necessite)) { |
|
| 159 | + foreach ($necessite as $need) { |
|
| 160 | + $id = $need['id']; |
|
| 161 | + $v = isset($need['version']) ? $need['version'] : ''; |
|
| 162 | + |
|
| 163 | + // Necessite SPIP version x ? |
|
| 164 | + if (strtoupper($id) == 'SPIP') { |
|
| 165 | + $res['compatible'] = $v; |
|
| 166 | + } else { |
|
| 167 | + if (preg_match(',^lib:\s*([^\s]*),i', $id, $r)) { |
|
| 168 | + $res['lib'][] = array('nom' => $r[1], 'id' => $r[1], 'lien' => $need['src']); |
|
| 169 | + } else { |
|
| 170 | + $res['necessite'][] = array('id' => $id, 'nom' => $id, 'version' => $v, 'compatibilite' => $v); |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + return $res; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | * Liste des utilise modifiés. |
| 190 | 190 | */ |
| 191 | 191 | function info_plugin_normalise_utilise($utilise) { |
| 192 | - $res = array(); |
|
| 192 | + $res = array(); |
|
| 193 | 193 | |
| 194 | - if (is_array($utilise)) { |
|
| 195 | - foreach ($utilise as $need) { |
|
| 196 | - $id = $need['id']; |
|
| 197 | - $v = isset($need['version']) ? $need['version'] : ''; |
|
| 198 | - $res[] = array('nom' => $id, 'id' => $id, 'version' => $v, 'compatibilite' => $v); |
|
| 199 | - } |
|
| 200 | - } |
|
| 194 | + if (is_array($utilise)) { |
|
| 195 | + foreach ($utilise as $need) { |
|
| 196 | + $id = $need['id']; |
|
| 197 | + $v = isset($need['version']) ? $need['version'] : ''; |
|
| 198 | + $res[] = array('nom' => $id, 'id' => $id, 'version' => $v, 'compatibilite' => $v); |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - return $res; |
|
| 202 | + return $res; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -213,17 +213,17 @@ discard block |
||
| 213 | 213 | * Liste des procure modifiés. |
| 214 | 214 | */ |
| 215 | 215 | function info_plugin_normalise_procure($procure) { |
| 216 | - $res = array(); |
|
| 216 | + $res = array(); |
|
| 217 | 217 | |
| 218 | - if (is_array($procure)) { |
|
| 219 | - foreach ($procure as $need) { |
|
| 220 | - $id = $need['id']; |
|
| 221 | - $v = $need['version']; |
|
| 222 | - $res[] = array('nom' => $id, 'id' => $id, 'version' => $v); |
|
| 223 | - } |
|
| 224 | - } |
|
| 218 | + if (is_array($procure)) { |
|
| 219 | + foreach ($procure as $need) { |
|
| 220 | + $id = $need['id']; |
|
| 221 | + $v = $need['version']; |
|
| 222 | + $res[] = array('nom' => $id, 'id' => $id, 'version' => $v); |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - return $res; |
|
| 226 | + return $res; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -237,14 +237,14 @@ discard block |
||
| 237 | 237 | * Liste des chemins modifiés. |
| 238 | 238 | */ |
| 239 | 239 | function info_plugin_normalise_chemin($chemins) { |
| 240 | - $res = array(); |
|
| 240 | + $res = array(); |
|
| 241 | 241 | |
| 242 | - if (is_array($chemins)) { |
|
| 243 | - foreach ($chemins as $c) { |
|
| 244 | - $c['path'] = $c['dir']; |
|
| 245 | - $res[] = $c; |
|
| 246 | - } |
|
| 247 | - } |
|
| 242 | + if (is_array($chemins)) { |
|
| 243 | + foreach ($chemins as $c) { |
|
| 244 | + $c['path'] = $c['dir']; |
|
| 245 | + $res[] = $c; |
|
| 246 | + } |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - return $res; |
|
| 249 | + return $res; |
|
| 250 | 250 | } |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | if (isset($arbre['erreur'])) { |
| 123 | 123 | $ret['erreur'] = $arbre['erreur']; |
| 124 | 124 | if ($plug) { |
| 125 | - spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur'])); |
|
| 125 | + spip_log("infos_plugin $plug ".@join(' ', $arbre['erreur'])); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
@@ -21,26 +21,26 @@ discard block |
||
| 21 | 21 | * @param array $arbre |
| 22 | 22 | */ |
| 23 | 23 | function plugins_extraire_pipelines_dist(&$arbre) { |
| 24 | - $pipeline = array(); |
|
| 25 | - if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 26 | - foreach ($pipes as $tag => $p) { |
|
| 27 | - if (!is_array($p[0])) { |
|
| 28 | - list($tag, $att) = spip_xml_decompose_tag($tag); |
|
| 29 | - $pipeline[] = $att; |
|
| 30 | - } else { |
|
| 31 | - foreach ($p as $pipe) { |
|
| 32 | - $att = array(); |
|
| 33 | - if (is_array($pipe)) { |
|
| 34 | - foreach ($pipe as $k => $t) { |
|
| 35 | - $att[$k] = trim(end($t)); |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - $pipeline[] = $att; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - unset($arbre[$tag]); |
|
| 43 | - } |
|
| 24 | + $pipeline = array(); |
|
| 25 | + if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 26 | + foreach ($pipes as $tag => $p) { |
|
| 27 | + if (!is_array($p[0])) { |
|
| 28 | + list($tag, $att) = spip_xml_decompose_tag($tag); |
|
| 29 | + $pipeline[] = $att; |
|
| 30 | + } else { |
|
| 31 | + foreach ($p as $pipe) { |
|
| 32 | + $att = array(); |
|
| 33 | + if (is_array($pipe)) { |
|
| 34 | + foreach ($pipe as $k => $t) { |
|
| 35 | + $att[$k] = trim(end($t)); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + $pipeline[] = $att; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + unset($arbre[$tag]); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return $pipeline; |
|
| 45 | + return $pipeline; |
|
| 46 | 46 | } |