@@ -25,26 +25,26 @@ |
||
| 25 | 25 | * "* * * * * curl http://www.mondomaine.tld/spip.php?action=super_cron" |
| 26 | 26 | */ |
| 27 | 27 | function action_super_cron_dist(){ |
| 28 | - // Si fsockopen est possible, on lance le cron via un socket |
|
| 29 | - // en asynchrone |
|
| 30 | - if(function_exists('fsockopen')){ |
|
| 31 | - $url = generer_url_action('cron'); |
|
| 32 | - $parts=parse_url($url); |
|
| 33 | - $fp = fsockopen($parts['host'], |
|
| 34 | - isset($parts['port'])?$parts['port']:80, |
|
| 35 | - $errno, $errstr, 30); |
|
| 36 | - if ($fp) { |
|
| 37 | - $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n"; |
|
| 38 | - $out.= "Host: ".$parts['host']."\r\n"; |
|
| 39 | - $out.= "Connection: Close\r\n\r\n"; |
|
| 40 | - fwrite($fp, $out); |
|
| 41 | - fclose($fp); |
|
| 42 | - return; |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - // ici lancer le cron par un CURL asynchrone si CURL est présent |
|
| 46 | - // TBD |
|
| 28 | + // Si fsockopen est possible, on lance le cron via un socket |
|
| 29 | + // en asynchrone |
|
| 30 | + if(function_exists('fsockopen')){ |
|
| 31 | + $url = generer_url_action('cron'); |
|
| 32 | + $parts=parse_url($url); |
|
| 33 | + $fp = fsockopen($parts['host'], |
|
| 34 | + isset($parts['port'])?$parts['port']:80, |
|
| 35 | + $errno, $errstr, 30); |
|
| 36 | + if ($fp) { |
|
| 37 | + $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n"; |
|
| 38 | + $out.= "Host: ".$parts['host']."\r\n"; |
|
| 39 | + $out.= "Connection: Close\r\n\r\n"; |
|
| 40 | + fwrite($fp, $out); |
|
| 41 | + fclose($fp); |
|
| 42 | + return; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + // ici lancer le cron par un CURL asynchrone si CURL est présent |
|
| 46 | + // TBD |
|
| 47 | 47 | |
| 48 | - return; |
|
| 48 | + return; |
|
| 49 | 49 | } |
| 50 | 50 | ?> |
| 51 | 51 | \ No newline at end of file |
@@ -24,19 +24,19 @@ |
||
| 24 | 24 | * Exemple de tache cron Unix pour un appel toutes les minutes : |
| 25 | 25 | * "* * * * * curl http://www.mondomaine.tld/spip.php?action=super_cron" |
| 26 | 26 | */ |
| 27 | -function action_super_cron_dist(){ |
|
| 27 | +function action_super_cron_dist() { |
|
| 28 | 28 | // Si fsockopen est possible, on lance le cron via un socket |
| 29 | 29 | // en asynchrone |
| 30 | - if(function_exists('fsockopen')){ |
|
| 30 | + if (function_exists('fsockopen')) { |
|
| 31 | 31 | $url = generer_url_action('cron'); |
| 32 | - $parts=parse_url($url); |
|
| 32 | + $parts = parse_url($url); |
|
| 33 | 33 | $fp = fsockopen($parts['host'], |
| 34 | - isset($parts['port'])?$parts['port']:80, |
|
| 34 | + isset($parts['port']) ? $parts['port'] : 80, |
|
| 35 | 35 | $errno, $errstr, 30); |
| 36 | 36 | if ($fp) { |
| 37 | 37 | $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n"; |
| 38 | - $out.= "Host: ".$parts['host']."\r\n"; |
|
| 39 | - $out.= "Connection: Close\r\n\r\n"; |
|
| 38 | + $out .= "Host: ".$parts['host']."\r\n"; |
|
| 39 | + $out .= "Connection: Close\r\n\r\n"; |
|
| 40 | 40 | fwrite($fp, $out); |
| 41 | 41 | fclose($fp); |
| 42 | 42 | return; |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Url pour lancer le cron de manière asynchrone si le serveur |
@@ -17,28 +17,28 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | function action_auth_dist() { |
| 19 | 19 | |
| 20 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | - $arg = $securiser_action(); |
|
| 22 | - |
|
| 23 | - if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
|
| 24 | - spip_log("action_auth_dist $arg pas compris"); |
|
| 25 | - } |
|
| 26 | - else { |
|
| 27 | - $auth_methode = $r[1]; |
|
| 28 | - $login = $r[2]; |
|
| 29 | - include_spip('inc/auth'); |
|
| 30 | - $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 31 | - |
|
| 32 | - if (is_string($res)){ // Erreur |
|
| 33 | - $redirect = _request('redirect'); |
|
| 34 | - $redirect = parametre_url($redirect,'var_erreur',$res,'&'); |
|
| 35 | - include_spip('inc/headers'); |
|
| 36 | - redirige_par_entete($redirect); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 40 | - auth_loger($res); |
|
| 41 | - } |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | + $arg = $securiser_action(); |
|
| 22 | + |
|
| 23 | + if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
|
| 24 | + spip_log("action_auth_dist $arg pas compris"); |
|
| 25 | + } |
|
| 26 | + else { |
|
| 27 | + $auth_methode = $r[1]; |
|
| 28 | + $login = $r[2]; |
|
| 29 | + include_spip('inc/auth'); |
|
| 30 | + $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 31 | + |
|
| 32 | + if (is_string($res)){ // Erreur |
|
| 33 | + $redirect = _request('redirect'); |
|
| 34 | + $redirect = parametre_url($redirect,'var_erreur',$res,'&'); |
|
| 35 | + include_spip('inc/headers'); |
|
| 36 | + redirige_par_entete($redirect); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 40 | + auth_loger($res); |
|
| 41 | + } |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
@@ -29,9 +29,9 @@ |
||
| 29 | 29 | include_spip('inc/auth'); |
| 30 | 30 | $res = auth_terminer_identifier_login($auth_methode, $login); |
| 31 | 31 | |
| 32 | - if (is_string($res)){ // Erreur |
|
| 32 | + if (is_string($res)) { // Erreur |
|
| 33 | 33 | $redirect = _request('redirect'); |
| 34 | - $redirect = parametre_url($redirect,'var_erreur',$res,'&'); |
|
| 34 | + $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 35 | 35 | include_spip('inc/headers'); |
| 36 | 36 | redirige_par_entete($redirect); |
| 37 | 37 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Retour d'authentification pour les SSO |
@@ -22,8 +24,7 @@ discard block |
||
| 22 | 24 | |
| 23 | 25 | if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
| 24 | 26 | spip_log("action_auth_dist $arg pas compris"); |
| 25 | - } |
|
| 26 | - else { |
|
| 27 | + } else { |
|
| 27 | 28 | $auth_methode = $r[1]; |
| 28 | 29 | $login = $r[2]; |
| 29 | 30 | include_spip('inc/auth'); |
@@ -15,56 +15,56 @@ |
||
| 15 | 15 | // http://doc.spip.org/@action_purger_dist |
| 16 | 16 | function action_purger_dist($arg=null) |
| 17 | 17 | { |
| 18 | - if (is_null($arg)) { |
|
| 19 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 20 | - $arg = $securiser_action(); |
|
| 21 | - } |
|
| 18 | + if (is_null($arg)) { |
|
| 19 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 20 | + $arg = $securiser_action(); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - include_spip('inc/invalideur'); |
|
| 23 | + include_spip('inc/invalideur'); |
|
| 24 | 24 | |
| 25 | - spip_log("purger $arg"); |
|
| 25 | + spip_log("purger $arg"); |
|
| 26 | 26 | |
| 27 | - switch ($arg) { |
|
| 28 | - case 'inhibe_cache': |
|
| 29 | - // inhiber le cache pendant 24h |
|
| 30 | - ecrire_meta('cache_inhib',$_SERVER['REQUEST_TIME']+24*3600); |
|
| 31 | - break; |
|
| 32 | - case 'reactive_cache': |
|
| 33 | - effacer_meta('cache_inhib'); |
|
| 34 | - break; |
|
| 27 | + switch ($arg) { |
|
| 28 | + case 'inhibe_cache': |
|
| 29 | + // inhiber le cache pendant 24h |
|
| 30 | + ecrire_meta('cache_inhib',$_SERVER['REQUEST_TIME']+24*3600); |
|
| 31 | + break; |
|
| 32 | + case 'reactive_cache': |
|
| 33 | + effacer_meta('cache_inhib'); |
|
| 34 | + break; |
|
| 35 | 35 | |
| 36 | - case 'cache': |
|
| 37 | - supprime_invalideurs(); |
|
| 38 | - @spip_unlink(_CACHE_RUBRIQUES); |
|
| 39 | - @spip_unlink(_CACHE_CHEMIN); |
|
| 40 | - @spip_unlink(_DIR_TMP."plugin_xml_cache.gz"); |
|
| 41 | - // on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3 |
|
| 42 | - // _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT |
|
| 43 | - // pour eviter des problemes de concurence |
|
| 44 | - // cf http://core.spip.org/issues/2989 |
|
| 45 | - //@spip_unlink(_CACHE_PIPELINES); |
|
| 46 | - //@spip_unlink(_CACHE_PLUGINS_PATH); |
|
| 47 | - //@spip_unlink(_CACHE_PLUGINS_FCT); |
|
| 48 | - @spip_unlink(_CACHE_PLUGINS_OPT); |
|
| 49 | - purger_repertoire(_DIR_CACHE,array('subdir'=>true)); |
|
| 50 | - purger_repertoire(_DIR_AIDE); |
|
| 51 | - purger_repertoire(_DIR_VAR.'cache-css'); |
|
| 52 | - purger_repertoire(_DIR_VAR.'cache-js'); |
|
| 53 | - break; |
|
| 36 | + case 'cache': |
|
| 37 | + supprime_invalideurs(); |
|
| 38 | + @spip_unlink(_CACHE_RUBRIQUES); |
|
| 39 | + @spip_unlink(_CACHE_CHEMIN); |
|
| 40 | + @spip_unlink(_DIR_TMP."plugin_xml_cache.gz"); |
|
| 41 | + // on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3 |
|
| 42 | + // _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT |
|
| 43 | + // pour eviter des problemes de concurence |
|
| 44 | + // cf http://core.spip.org/issues/2989 |
|
| 45 | + //@spip_unlink(_CACHE_PIPELINES); |
|
| 46 | + //@spip_unlink(_CACHE_PLUGINS_PATH); |
|
| 47 | + //@spip_unlink(_CACHE_PLUGINS_FCT); |
|
| 48 | + @spip_unlink(_CACHE_PLUGINS_OPT); |
|
| 49 | + purger_repertoire(_DIR_CACHE,array('subdir'=>true)); |
|
| 50 | + purger_repertoire(_DIR_AIDE); |
|
| 51 | + purger_repertoire(_DIR_VAR.'cache-css'); |
|
| 52 | + purger_repertoire(_DIR_VAR.'cache-js'); |
|
| 53 | + break; |
|
| 54 | 54 | |
| 55 | - case 'squelettes': |
|
| 56 | - purger_repertoire(_DIR_SKELS); |
|
| 57 | - break; |
|
| 55 | + case 'squelettes': |
|
| 56 | + purger_repertoire(_DIR_SKELS); |
|
| 57 | + break; |
|
| 58 | 58 | |
| 59 | - case 'vignettes': |
|
| 60 | - purger_repertoire(_DIR_VAR,array('subdir'=>true)); |
|
| 61 | - supprime_invalideurs(); |
|
| 62 | - purger_repertoire(_DIR_CACHE); |
|
| 63 | - break; |
|
| 64 | - } |
|
| 59 | + case 'vignettes': |
|
| 60 | + purger_repertoire(_DIR_VAR,array('subdir'=>true)); |
|
| 61 | + supprime_invalideurs(); |
|
| 62 | + purger_repertoire(_DIR_CACHE); |
|
| 63 | + break; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - // le faire savoir aux plugins |
|
| 67 | - pipeline('trig_purger',$arg); |
|
| 66 | + // le faire savoir aux plugins |
|
| 67 | + pipeline('trig_purger',$arg); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | ?> |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | 15 | // http://doc.spip.org/@action_purger_dist |
| 16 | -function action_purger_dist($arg=null) |
|
| 16 | +function action_purger_dist($arg = null) |
|
| 17 | 17 | { |
| 18 | 18 | if (is_null($arg)) { |
| 19 | 19 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | switch ($arg) { |
| 28 | 28 | case 'inhibe_cache': |
| 29 | 29 | // inhiber le cache pendant 24h |
| 30 | - ecrire_meta('cache_inhib',$_SERVER['REQUEST_TIME']+24*3600); |
|
| 30 | + ecrire_meta('cache_inhib', $_SERVER['REQUEST_TIME'] + 24 * 3600); |
|
| 31 | 31 | break; |
| 32 | 32 | case 'reactive_cache': |
| 33 | 33 | effacer_meta('cache_inhib'); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | //@spip_unlink(_CACHE_PLUGINS_PATH); |
| 47 | 47 | //@spip_unlink(_CACHE_PLUGINS_FCT); |
| 48 | 48 | @spip_unlink(_CACHE_PLUGINS_OPT); |
| 49 | - purger_repertoire(_DIR_CACHE,array('subdir'=>true)); |
|
| 49 | + purger_repertoire(_DIR_CACHE, array('subdir'=>true)); |
|
| 50 | 50 | purger_repertoire(_DIR_AIDE); |
| 51 | 51 | purger_repertoire(_DIR_VAR.'cache-css'); |
| 52 | 52 | purger_repertoire(_DIR_VAR.'cache-js'); |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | break; |
| 58 | 58 | |
| 59 | 59 | case 'vignettes': |
| 60 | - purger_repertoire(_DIR_VAR,array('subdir'=>true)); |
|
| 60 | + purger_repertoire(_DIR_VAR, array('subdir'=>true)); |
|
| 61 | 61 | supprime_invalideurs(); |
| 62 | 62 | purger_repertoire(_DIR_CACHE); |
| 63 | 63 | break; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // le faire savoir aux plugins |
| 67 | - pipeline('trig_purger',$arg); |
|
| 67 | + pipeline('trig_purger', $arg); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | ?> |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // http://doc.spip.org/@action_purger_dist |
| 16 | 18 | function action_purger_dist($arg=null) |
@@ -18,30 +18,30 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function action_iconifier_dist() |
| 20 | 20 | { |
| 21 | - include_spip('inc/actions'); |
|
| 22 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 23 | - $arg = $securiser_action(); |
|
| 24 | - $iframe_redirect = _request('iframe_redirect'); |
|
| 21 | + include_spip('inc/actions'); |
|
| 22 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 23 | + $arg = $securiser_action(); |
|
| 24 | + $iframe_redirect = _request('iframe_redirect'); |
|
| 25 | 25 | |
| 26 | - $arg = rawurldecode($arg); |
|
| 26 | + $arg = rawurldecode($arg); |
|
| 27 | 27 | |
| 28 | - if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) |
|
| 29 | - spip_log("action iconifier: $arg pas compris"); |
|
| 30 | - elseif ($r[1] == '+') |
|
| 31 | - action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
|
| 32 | - else action_spip_image_effacer_dist($r[2]); |
|
| 28 | + if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) |
|
| 29 | + spip_log("action iconifier: $arg pas compris"); |
|
| 30 | + elseif ($r[1] == '+') |
|
| 31 | + action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
|
| 32 | + else action_spip_image_effacer_dist($r[2]); |
|
| 33 | 33 | |
| 34 | - if(_request("iframe") == 'iframe') { |
|
| 35 | - $redirect = urldecode($iframe_redirect)."&iframe=iframe"; |
|
| 36 | - redirige_par_entete(urldecode($redirect)); |
|
| 37 | - } |
|
| 34 | + if(_request("iframe") == 'iframe') { |
|
| 35 | + $redirect = urldecode($iframe_redirect)."&iframe=iframe"; |
|
| 36 | + redirige_par_entete(urldecode($redirect)); |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // http://doc.spip.org/@action_spip_image_effacer_dist |
| 41 | 41 | function action_spip_image_effacer_dist($arg) { |
| 42 | 42 | |
| 43 | - if (!strstr($arg, "..")) |
|
| 44 | - spip_unlink(_DIR_LOGOS . $arg); |
|
| 43 | + if (!strstr($arg, "..")) |
|
| 44 | + spip_unlink(_DIR_LOGOS . $arg); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // |
@@ -52,80 +52,80 @@ discard block |
||
| 52 | 52 | // $dest = arton12.xxx |
| 53 | 53 | // http://doc.spip.org/@action_spip_image_ajouter_dist |
| 54 | 54 | function action_spip_image_ajouter_dist($arg,$sousaction2,$source,$return=false) { |
| 55 | - global $formats_logos; |
|
| 55 | + global $formats_logos; |
|
| 56 | 56 | |
| 57 | - include_spip('inc/documents'); |
|
| 58 | - if (!$sousaction2) { |
|
| 59 | - if (!$_FILES) $_FILES = $GLOBALS['HTTP_POST_FILES']; |
|
| 60 | - $source = (is_array($_FILES) ? array_pop($_FILES) : ""); |
|
| 61 | - } |
|
| 62 | - $erreur = ""; |
|
| 63 | - if (!$source) |
|
| 64 | - spip_log("spip_image_ajouter : source inconnue"); |
|
| 65 | - else { |
|
| 66 | - $f =_DIR_LOGOS . $arg . '.tmp'; |
|
| 57 | + include_spip('inc/documents'); |
|
| 58 | + if (!$sousaction2) { |
|
| 59 | + if (!$_FILES) $_FILES = $GLOBALS['HTTP_POST_FILES']; |
|
| 60 | + $source = (is_array($_FILES) ? array_pop($_FILES) : ""); |
|
| 61 | + } |
|
| 62 | + $erreur = ""; |
|
| 63 | + if (!$source) |
|
| 64 | + spip_log("spip_image_ajouter : source inconnue"); |
|
| 65 | + else { |
|
| 66 | + $f =_DIR_LOGOS . $arg . '.tmp'; |
|
| 67 | 67 | |
| 68 | - if (!is_array($source)) |
|
| 69 | - // fichier dans upload/ |
|
| 70 | - $source = @copy(determine_upload() . $source, $f); |
|
| 71 | - else { |
|
| 72 | - // Intercepter une erreur a l'envoi |
|
| 73 | - if ($erreur = check_upload_error($source['error'],"",$return)) |
|
| 74 | - $source =""; |
|
| 75 | - else |
|
| 76 | - // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 77 | - // fichier envoye par le browser : pour les Macs c'est plus sur) |
|
| 68 | + if (!is_array($source)) |
|
| 69 | + // fichier dans upload/ |
|
| 70 | + $source = @copy(determine_upload() . $source, $f); |
|
| 71 | + else { |
|
| 72 | + // Intercepter une erreur a l'envoi |
|
| 73 | + if ($erreur = check_upload_error($source['error'],"",$return)) |
|
| 74 | + $source =""; |
|
| 75 | + else |
|
| 76 | + // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 77 | + // fichier envoye par le browser : pour les Macs c'est plus sur) |
|
| 78 | 78 | |
| 79 | - $source = deplacer_fichier_upload($source['tmp_name'], $f); |
|
| 80 | - } |
|
| 81 | - if (!$source) |
|
| 82 | - spip_log("pb de copie pour $f"); |
|
| 83 | - } |
|
| 84 | - if ($source AND $f) { |
|
| 85 | - $size = @getimagesize($f); |
|
| 86 | - $type = !$size ? '': ($size[2] > 3 ? '' : $formats_logos[$size[2]-1]); |
|
| 87 | - if ($type) { |
|
| 88 | - $poids = filesize($f); |
|
| 79 | + $source = deplacer_fichier_upload($source['tmp_name'], $f); |
|
| 80 | + } |
|
| 81 | + if (!$source) |
|
| 82 | + spip_log("pb de copie pour $f"); |
|
| 83 | + } |
|
| 84 | + if ($source AND $f) { |
|
| 85 | + $size = @getimagesize($f); |
|
| 86 | + $type = !$size ? '': ($size[2] > 3 ? '' : $formats_logos[$size[2]-1]); |
|
| 87 | + if ($type) { |
|
| 88 | + $poids = filesize($f); |
|
| 89 | 89 | |
| 90 | - if (_LOGO_MAX_SIZE > 0 |
|
| 91 | - AND $poids > _LOGO_MAX_SIZE*1024) { |
|
| 92 | - spip_unlink ($f); |
|
| 93 | - $erreur = _T('info_logo_max_poids', |
|
| 94 | - array('maxi' => taille_en_octets(_LOGO_MAX_SIZE*1024), |
|
| 95 | - 'actuel' => taille_en_octets($poids))); |
|
| 96 | - } |
|
| 90 | + if (_LOGO_MAX_SIZE > 0 |
|
| 91 | + AND $poids > _LOGO_MAX_SIZE*1024) { |
|
| 92 | + spip_unlink ($f); |
|
| 93 | + $erreur = _T('info_logo_max_poids', |
|
| 94 | + array('maxi' => taille_en_octets(_LOGO_MAX_SIZE*1024), |
|
| 95 | + 'actuel' => taille_en_octets($poids))); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
|
| 99 | - AND ($size[0] > _LOGO_MAX_WIDTH |
|
| 100 | - OR $size[1] > _LOGO_MAX_HEIGHT)) { |
|
| 101 | - spip_unlink ($f); |
|
| 102 | - $erreur = _T('info_logo_max_poids', |
|
| 103 | - array( |
|
| 104 | - 'maxi' => |
|
| 105 | - _T('info_largeur_vignette', |
|
| 106 | - array('largeur_vignette' => _LOGO_MAX_WIDTH, |
|
| 107 | - 'hauteur_vignette' => _LOGO_MAX_HEIGHT)), |
|
| 108 | - 'actuel' => |
|
| 109 | - _T('info_largeur_vignette', |
|
| 110 | - array('largeur_vignette' => $size[0], |
|
| 111 | - 'hauteur_vignette' => $size[1])) |
|
| 112 | - )); |
|
| 113 | - } |
|
| 114 | - else |
|
| 115 | - @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 116 | - } |
|
| 117 | - else { |
|
| 118 | - spip_unlink ($f); |
|
| 119 | - $erreur = _T('info_logo_format_interdit', |
|
| 120 | - array('formats' => join(', ', $formats_logos))); |
|
| 121 | - } |
|
| 98 | + elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
|
| 99 | + AND ($size[0] > _LOGO_MAX_WIDTH |
|
| 100 | + OR $size[1] > _LOGO_MAX_HEIGHT)) { |
|
| 101 | + spip_unlink ($f); |
|
| 102 | + $erreur = _T('info_logo_max_poids', |
|
| 103 | + array( |
|
| 104 | + 'maxi' => |
|
| 105 | + _T('info_largeur_vignette', |
|
| 106 | + array('largeur_vignette' => _LOGO_MAX_WIDTH, |
|
| 107 | + 'hauteur_vignette' => _LOGO_MAX_HEIGHT)), |
|
| 108 | + 'actuel' => |
|
| 109 | + _T('info_largeur_vignette', |
|
| 110 | + array('largeur_vignette' => $size[0], |
|
| 111 | + 'hauteur_vignette' => $size[1])) |
|
| 112 | + )); |
|
| 113 | + } |
|
| 114 | + else |
|
| 115 | + @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 116 | + } |
|
| 117 | + else { |
|
| 118 | + spip_unlink ($f); |
|
| 119 | + $erreur = _T('info_logo_format_interdit', |
|
| 120 | + array('formats' => join(', ', $formats_logos))); |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - } |
|
| 124 | - if ($erreur){ |
|
| 125 | - if ($return) |
|
| 126 | - return $erreur; |
|
| 127 | - else |
|
| 128 | - check_upload_error(6,$erreur); |
|
| 129 | - } |
|
| 123 | + } |
|
| 124 | + if ($erreur){ |
|
| 125 | + if ($return) |
|
| 126 | + return $erreur; |
|
| 127 | + else |
|
| 128 | + check_upload_error(6,$erreur); |
|
| 129 | + } |
|
| 130 | 130 | } |
| 131 | 131 | ?> |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $arg = rawurldecode($arg); |
| 27 | 27 | |
| 28 | - if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) |
|
| 28 | + if (!preg_match(',^-?\d*(\D)(.*)$,', $arg, $r)) |
|
| 29 | 29 | spip_log("action iconifier: $arg pas compris"); |
| 30 | 30 | elseif ($r[1] == '+') |
| 31 | 31 | action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
| 32 | 32 | else action_spip_image_effacer_dist($r[2]); |
| 33 | 33 | |
| 34 | - if(_request("iframe") == 'iframe') { |
|
| 34 | + if (_request("iframe") == 'iframe') { |
|
| 35 | 35 | $redirect = urldecode($iframe_redirect)."&iframe=iframe"; |
| 36 | 36 | redirige_par_entete(urldecode($redirect)); |
| 37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | function action_spip_image_effacer_dist($arg) { |
| 42 | 42 | |
| 43 | 43 | if (!strstr($arg, "..")) |
| 44 | - spip_unlink(_DIR_LOGOS . $arg); |
|
| 44 | + spip_unlink(_DIR_LOGOS.$arg); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | // $source = $_FILES[0] |
| 52 | 52 | // $dest = arton12.xxx |
| 53 | 53 | // http://doc.spip.org/@action_spip_image_ajouter_dist |
| 54 | -function action_spip_image_ajouter_dist($arg,$sousaction2,$source,$return=false) { |
|
| 54 | +function action_spip_image_ajouter_dist($arg, $sousaction2, $source, $return = false) { |
|
| 55 | 55 | global $formats_logos; |
| 56 | 56 | |
| 57 | 57 | include_spip('inc/documents'); |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | if (!$source) |
| 64 | 64 | spip_log("spip_image_ajouter : source inconnue"); |
| 65 | 65 | else { |
| 66 | - $f =_DIR_LOGOS . $arg . '.tmp'; |
|
| 66 | + $f = _DIR_LOGOS.$arg.'.tmp'; |
|
| 67 | 67 | |
| 68 | 68 | if (!is_array($source)) |
| 69 | 69 | // fichier dans upload/ |
| 70 | - $source = @copy(determine_upload() . $source, $f); |
|
| 70 | + $source = @copy(determine_upload().$source, $f); |
|
| 71 | 71 | else { |
| 72 | 72 | // Intercepter une erreur a l'envoi |
| 73 | - if ($erreur = check_upload_error($source['error'],"",$return)) |
|
| 74 | - $source =""; |
|
| 73 | + if ($erreur = check_upload_error($source['error'], "", $return)) |
|
| 74 | + $source = ""; |
|
| 75 | 75 | else |
| 76 | 76 | // analyse le type de l'image (on ne fait pas confiance au nom de |
| 77 | 77 | // fichier envoye par le browser : pour les Macs c'est plus sur) |
@@ -83,22 +83,22 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | if ($source AND $f) { |
| 85 | 85 | $size = @getimagesize($f); |
| 86 | - $type = !$size ? '': ($size[2] > 3 ? '' : $formats_logos[$size[2]-1]); |
|
| 86 | + $type = !$size ? '' : ($size[2] > 3 ? '' : $formats_logos[$size[2] - 1]); |
|
| 87 | 87 | if ($type) { |
| 88 | 88 | $poids = filesize($f); |
| 89 | 89 | |
| 90 | 90 | if (_LOGO_MAX_SIZE > 0 |
| 91 | - AND $poids > _LOGO_MAX_SIZE*1024) { |
|
| 92 | - spip_unlink ($f); |
|
| 91 | + AND $poids > _LOGO_MAX_SIZE * 1024) { |
|
| 92 | + spip_unlink($f); |
|
| 93 | 93 | $erreur = _T('info_logo_max_poids', |
| 94 | - array('maxi' => taille_en_octets(_LOGO_MAX_SIZE*1024), |
|
| 94 | + array('maxi' => taille_en_octets(_LOGO_MAX_SIZE * 1024), |
|
| 95 | 95 | 'actuel' => taille_en_octets($poids))); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
| 99 | 99 | AND ($size[0] > _LOGO_MAX_WIDTH |
| 100 | 100 | OR $size[1] > _LOGO_MAX_HEIGHT)) { |
| 101 | - spip_unlink ($f); |
|
| 101 | + spip_unlink($f); |
|
| 102 | 102 | $erreur = _T('info_logo_max_poids', |
| 103 | 103 | array( |
| 104 | 104 | 'maxi' => |
@@ -112,20 +112,20 @@ discard block |
||
| 112 | 112 | )); |
| 113 | 113 | } |
| 114 | 114 | else |
| 115 | - @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 115 | + @rename($f, _DIR_LOGOS.$arg.".$type"); |
|
| 116 | 116 | } |
| 117 | 117 | else { |
| 118 | - spip_unlink ($f); |
|
| 118 | + spip_unlink($f); |
|
| 119 | 119 | $erreur = _T('info_logo_format_interdit', |
| 120 | 120 | array('formats' => join(', ', $formats_logos))); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | } |
| 124 | - if ($erreur){ |
|
| 124 | + if ($erreur) { |
|
| 125 | 125 | if ($return) |
| 126 | 126 | return $erreur; |
| 127 | 127 | else |
| 128 | - check_upload_error(6,$erreur); |
|
| 128 | + check_upload_error(6, $erreur); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | ?> |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * L'entree par l'action ne sert plus qu'a une retro compat eventuelle |
@@ -25,11 +27,13 @@ discard block |
||
| 25 | 27 | |
| 26 | 28 | $arg = rawurldecode($arg); |
| 27 | 29 | |
| 28 | - if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) |
|
| 29 | - spip_log("action iconifier: $arg pas compris"); |
|
| 30 | - elseif ($r[1] == '+') |
|
| 31 | - action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
|
| 32 | - else action_spip_image_effacer_dist($r[2]); |
|
| 30 | + if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) { |
|
| 31 | + spip_log("action iconifier: $arg pas compris"); |
|
| 32 | + } elseif ($r[1] == '+') { |
|
| 33 | + action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
|
| 34 | + } else { |
|
| 35 | + action_spip_image_effacer_dist($r[2]); |
|
| 36 | + } |
|
| 33 | 37 | |
| 34 | 38 | if(_request("iframe") == 'iframe') { |
| 35 | 39 | $redirect = urldecode($iframe_redirect)."&iframe=iframe"; |
@@ -40,9 +44,10 @@ discard block |
||
| 40 | 44 | // http://doc.spip.org/@action_spip_image_effacer_dist |
| 41 | 45 | function action_spip_image_effacer_dist($arg) { |
| 42 | 46 | |
| 43 | - if (!strstr($arg, "..")) |
|
| 44 | - spip_unlink(_DIR_LOGOS . $arg); |
|
| 45 | -} |
|
| 47 | + if (!strstr($arg, "..")) { |
|
| 48 | + spip_unlink(_DIR_LOGOS . $arg); |
|
| 49 | + } |
|
| 50 | + } |
|
| 46 | 51 | |
| 47 | 52 | // |
| 48 | 53 | // Ajouter un logo |
@@ -56,30 +61,34 @@ discard block |
||
| 56 | 61 | |
| 57 | 62 | include_spip('inc/documents'); |
| 58 | 63 | if (!$sousaction2) { |
| 59 | - if (!$_FILES) $_FILES = $GLOBALS['HTTP_POST_FILES']; |
|
| 64 | + if (!$_FILES) { |
|
| 65 | + $_FILES = $GLOBALS['HTTP_POST_FILES']; |
|
| 66 | + } |
|
| 60 | 67 | $source = (is_array($_FILES) ? array_pop($_FILES) : ""); |
| 61 | 68 | } |
| 62 | 69 | $erreur = ""; |
| 63 | - if (!$source) |
|
| 64 | - spip_log("spip_image_ajouter : source inconnue"); |
|
| 65 | - else { |
|
| 70 | + if (!$source) { |
|
| 71 | + spip_log("spip_image_ajouter : source inconnue"); |
|
| 72 | + } else { |
|
| 66 | 73 | $f =_DIR_LOGOS . $arg . '.tmp'; |
| 67 | 74 | |
| 68 | - if (!is_array($source)) |
|
| 69 | - // fichier dans upload/ |
|
| 75 | + if (!is_array($source)) { |
|
| 76 | + // fichier dans upload/ |
|
| 70 | 77 | $source = @copy(determine_upload() . $source, $f); |
| 71 | - else { |
|
| 78 | + } else { |
|
| 72 | 79 | // Intercepter une erreur a l'envoi |
| 73 | - if ($erreur = check_upload_error($source['error'],"",$return)) |
|
| 74 | - $source =""; |
|
| 75 | - else |
|
| 76 | - // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 80 | + if ($erreur = check_upload_error($source['error'],"",$return)) { |
|
| 81 | + $source =""; |
|
| 82 | + } else { |
|
| 83 | + // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 77 | 84 | // fichier envoye par le browser : pour les Macs c'est plus sur) |
| 78 | 85 | |
| 79 | 86 | $source = deplacer_fichier_upload($source['tmp_name'], $f); |
| 87 | + } |
|
| 88 | + } |
|
| 89 | + if (!$source) { |
|
| 90 | + spip_log("pb de copie pour $f"); |
|
| 80 | 91 | } |
| 81 | - if (!$source) |
|
| 82 | - spip_log("pb de copie pour $f"); |
|
| 83 | 92 | } |
| 84 | 93 | if ($source AND $f) { |
| 85 | 94 | $size = @getimagesize($f); |
@@ -93,9 +102,7 @@ discard block |
||
| 93 | 102 | $erreur = _T('info_logo_max_poids', |
| 94 | 103 | array('maxi' => taille_en_octets(_LOGO_MAX_SIZE*1024), |
| 95 | 104 | 'actuel' => taille_en_octets($poids))); |
| 96 | - } |
|
| 97 | - |
|
| 98 | - elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
|
| 105 | + } elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
|
| 99 | 106 | AND ($size[0] > _LOGO_MAX_WIDTH |
| 100 | 107 | OR $size[1] > _LOGO_MAX_HEIGHT)) { |
| 101 | 108 | spip_unlink ($f); |
@@ -110,11 +117,10 @@ discard block |
||
| 110 | 117 | array('largeur_vignette' => $size[0], |
| 111 | 118 | 'hauteur_vignette' => $size[1])) |
| 112 | 119 | )); |
| 120 | + } else { |
|
| 121 | + @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 113 | 122 | } |
| 114 | - else |
|
| 115 | - @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 116 | - } |
|
| 117 | - else { |
|
| 123 | + } else { |
|
| 118 | 124 | spip_unlink ($f); |
| 119 | 125 | $erreur = _T('info_logo_format_interdit', |
| 120 | 126 | array('formats' => join(', ', $formats_logos))); |
@@ -122,10 +128,11 @@ discard block |
||
| 122 | 128 | |
| 123 | 129 | } |
| 124 | 130 | if ($erreur){ |
| 125 | - if ($return) |
|
| 126 | - return $erreur; |
|
| 127 | - else |
|
| 128 | - check_upload_error(6,$erreur); |
|
| 131 | + if ($return) { |
|
| 132 | + return $erreur; |
|
| 133 | + } else { |
|
| 134 | + check_upload_error(6,$erreur); |
|
| 135 | + } |
|
| 129 | 136 | } |
| 130 | 137 | } |
| 131 | 138 | ?> |
@@ -17,13 +17,13 @@ |
||
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | 19 | function action_purger_queue_dist(){ |
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 21 | - $securiser_action(); |
|
| 20 | + $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 21 | + $securiser_action(); |
|
| 22 | 22 | |
| 23 | - if (autoriser('purger','queue')){ |
|
| 24 | - include_spip('inc/queue'); |
|
| 25 | - queue_purger(); |
|
| 26 | - } |
|
| 23 | + if (autoriser('purger','queue')){ |
|
| 24 | + include_spip('inc/queue'); |
|
| 25 | + queue_purger(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | * Purger la liste des travaux en attente |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | -function action_purger_queue_dist(){ |
|
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 19 | +function action_purger_queue_dist() { |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | 21 | $securiser_action(); |
| 22 | 22 | |
| 23 | - if (autoriser('purger','queue')){ |
|
| 23 | + if (autoriser('purger', 'queue')) { |
|
| 24 | 24 | include_spip('inc/queue'); |
| 25 | 25 | queue_purger(); |
| 26 | 26 | } |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Purger la liste des travaux en attente |
@@ -17,14 +17,14 @@ |
||
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | 19 | function action_annuler_job_dist(){ |
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 21 | - $id_job = $securiser_action(); |
|
| 20 | + $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 21 | + $id_job = $securiser_action(); |
|
| 22 | 22 | |
| 23 | - if ($id_job = intval($id_job) |
|
| 24 | - AND autoriser('annuler','job',$id_job) |
|
| 25 | - ){ |
|
| 26 | - job_queue_remove($id_job); |
|
| 27 | - } |
|
| 23 | + if ($id_job = intval($id_job) |
|
| 24 | + AND autoriser('annuler','job',$id_job) |
|
| 25 | + ){ |
|
| 26 | + job_queue_remove($id_job); |
|
| 27 | + } |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | ?> |
| 31 | 31 | \ No newline at end of file |
@@ -16,13 +16,13 @@ |
||
| 16 | 16 | * Annuler un travail |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | -function action_annuler_job_dist(){ |
|
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 19 | +function action_annuler_job_dist() { |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | 21 | $id_job = $securiser_action(); |
| 22 | 22 | |
| 23 | 23 | if ($id_job = intval($id_job) |
| 24 | - AND autoriser('annuler','job',$id_job) |
|
| 25 | - ){ |
|
| 24 | + AND autoriser('annuler', 'job', $id_job) |
|
| 25 | + ) { |
|
| 26 | 26 | job_queue_remove($id_job); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Annuler un travail |
@@ -15,53 +15,53 @@ |
||
| 15 | 15 | // mise a jour des donnees si envoi via formulaire |
| 16 | 16 | // http://doc.spip.org/@enregistre_modif_plugin |
| 17 | 17 | function enregistre_modif_plugin(){ |
| 18 | - include_spip('inc/plugin'); |
|
| 19 | - // recuperer les plugins dans l'ordre des $_POST |
|
| 20 | - $test = array(); |
|
| 21 | - foreach(liste_plugin_files() as $file){ |
|
| 22 | - $test['s'.substr(md5(_DIR_PLUGINS.$file),0,16)] = $file; |
|
| 23 | - } |
|
| 24 | - if (defined('_DIR_PLUGINS_SUPPL')) |
|
| 25 | - foreach(liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file){ |
|
| 26 | - $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file),0,16)] = $file; |
|
| 27 | - } |
|
| 18 | + include_spip('inc/plugin'); |
|
| 19 | + // recuperer les plugins dans l'ordre des $_POST |
|
| 20 | + $test = array(); |
|
| 21 | + foreach(liste_plugin_files() as $file){ |
|
| 22 | + $test['s'.substr(md5(_DIR_PLUGINS.$file),0,16)] = $file; |
|
| 23 | + } |
|
| 24 | + if (defined('_DIR_PLUGINS_SUPPL')) |
|
| 25 | + foreach(liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file){ |
|
| 26 | + $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file),0,16)] = $file; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - $plugin=array(); |
|
| 29 | + $plugin=array(); |
|
| 30 | 30 | |
| 31 | - foreach($_POST as $choix=>$val){ |
|
| 32 | - if (isset($test[$choix])&&$val=='O') |
|
| 33 | - $plugin[]=$test[$choix]; |
|
| 34 | - } |
|
| 31 | + foreach($_POST as $choix=>$val){ |
|
| 32 | + if (isset($test[$choix])&&$val=='O') |
|
| 33 | + $plugin[]=$test[$choix]; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', $plugin)); |
|
| 37 | - ecrire_plugin_actifs($plugin); |
|
| 36 | + spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', $plugin)); |
|
| 37 | + ecrire_plugin_actifs($plugin); |
|
| 38 | 38 | |
| 39 | - // Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli. |
|
| 40 | - $plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']); |
|
| 41 | - if (!is_array($plugins_interessants)) |
|
| 42 | - $plugins_interessants = array(); |
|
| 39 | + // Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli. |
|
| 40 | + $plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']); |
|
| 41 | + if (!is_array($plugins_interessants)) |
|
| 42 | + $plugins_interessants = array(); |
|
| 43 | 43 | |
| 44 | - $plugins_interessants2 = array(); |
|
| 44 | + $plugins_interessants2 = array(); |
|
| 45 | 45 | |
| 46 | - foreach($plugins_interessants as $plug => $score) |
|
| 47 | - if ($score > 1) |
|
| 48 | - $plugins_interessants2[$plug] = $score-1; |
|
| 49 | - foreach ($plugin as $plug) |
|
| 50 | - $plugins_interessants2[$plug] = 10; // score initial |
|
| 51 | - ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
|
| 46 | + foreach($plugins_interessants as $plug => $score) |
|
| 47 | + if ($score > 1) |
|
| 48 | + $plugins_interessants2[$plug] = $score-1; |
|
| 49 | + foreach ($plugin as $plug) |
|
| 50 | + $plugins_interessants2[$plug] = 10; // score initial |
|
| 51 | + ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // http://doc.spip.org/@action_activer_plugins_dist |
| 55 | 55 | function action_activer_plugins_dist() { |
| 56 | 56 | |
| 57 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 58 | - $securiser_action(); |
|
| 57 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 58 | + $securiser_action(); |
|
| 59 | 59 | |
| 60 | - if (!autoriser('configurer', '_plugins')) |
|
| 61 | - die('erreur'); |
|
| 62 | - // forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin |
|
| 63 | - lire_metas(); |
|
| 64 | - enregistre_modif_plugin(); |
|
| 60 | + if (!autoriser('configurer', '_plugins')) |
|
| 61 | + die('erreur'); |
|
| 62 | + // forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin |
|
| 63 | + lire_metas(); |
|
| 64 | + enregistre_modif_plugin(); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | ?> |
@@ -14,26 +14,26 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // mise a jour des donnees si envoi via formulaire |
| 16 | 16 | // http://doc.spip.org/@enregistre_modif_plugin |
| 17 | -function enregistre_modif_plugin(){ |
|
| 17 | +function enregistre_modif_plugin() { |
|
| 18 | 18 | include_spip('inc/plugin'); |
| 19 | 19 | // recuperer les plugins dans l'ordre des $_POST |
| 20 | 20 | $test = array(); |
| 21 | - foreach(liste_plugin_files() as $file){ |
|
| 22 | - $test['s'.substr(md5(_DIR_PLUGINS.$file),0,16)] = $file; |
|
| 21 | + foreach (liste_plugin_files() as $file) { |
|
| 22 | + $test['s'.substr(md5(_DIR_PLUGINS.$file), 0, 16)] = $file; |
|
| 23 | 23 | } |
| 24 | 24 | if (defined('_DIR_PLUGINS_SUPPL')) |
| 25 | - foreach(liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file){ |
|
| 26 | - $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file),0,16)] = $file; |
|
| 25 | + foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) { |
|
| 26 | + $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file), 0, 16)] = $file; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $plugin=array(); |
|
| 29 | + $plugin = array(); |
|
| 30 | 30 | |
| 31 | - foreach($_POST as $choix=>$val){ |
|
| 32 | - if (isset($test[$choix])&&$val=='O') |
|
| 33 | - $plugin[]=$test[$choix]; |
|
| 31 | + foreach ($_POST as $choix=>$val) { |
|
| 32 | + if (isset($test[$choix]) && $val == 'O') |
|
| 33 | + $plugin[] = $test[$choix]; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', $plugin)); |
|
| 36 | + spip_log("Changement des plugins actifs par l'auteur ".$GLOBALS['visiteur_session']['id_auteur'].": ".join(',', $plugin)); |
|
| 37 | 37 | ecrire_plugin_actifs($plugin); |
| 38 | 38 | |
| 39 | 39 | // Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli. |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $plugins_interessants2 = array(); |
| 45 | 45 | |
| 46 | - foreach($plugins_interessants as $plug => $score) |
|
| 46 | + foreach ($plugins_interessants as $plug => $score) |
|
| 47 | 47 | if ($score > 1) |
| 48 | - $plugins_interessants2[$plug] = $score-1; |
|
| 48 | + $plugins_interessants2[$plug] = $score - 1; |
|
| 49 | 49 | foreach ($plugin as $plug) |
| 50 | 50 | $plugins_interessants2[$plug] = 10; // score initial |
| 51 | 51 | ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // mise a jour des donnees si envoi via formulaire |
| 16 | 18 | // http://doc.spip.org/@enregistre_modif_plugin |
@@ -21,16 +23,18 @@ discard block |
||
| 21 | 23 | foreach(liste_plugin_files() as $file){ |
| 22 | 24 | $test['s'.substr(md5(_DIR_PLUGINS.$file),0,16)] = $file; |
| 23 | 25 | } |
| 24 | - if (defined('_DIR_PLUGINS_SUPPL')) |
|
| 25 | - foreach(liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file){ |
|
| 26 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 27 | + foreach(liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file){ |
|
| 26 | 28 | $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file),0,16)] = $file; |
| 29 | + } |
|
| 27 | 30 | } |
| 28 | 31 | |
| 29 | 32 | $plugin=array(); |
| 30 | 33 | |
| 31 | 34 | foreach($_POST as $choix=>$val){ |
| 32 | - if (isset($test[$choix])&&$val=='O') |
|
| 33 | - $plugin[]=$test[$choix]; |
|
| 35 | + if (isset($test[$choix])&&$val=='O') { |
|
| 36 | + $plugin[]=$test[$choix]; |
|
| 37 | + } |
|
| 34 | 38 | } |
| 35 | 39 | |
| 36 | 40 | spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', $plugin)); |
@@ -38,16 +42,20 @@ discard block |
||
| 38 | 42 | |
| 39 | 43 | // Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli. |
| 40 | 44 | $plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']); |
| 41 | - if (!is_array($plugins_interessants)) |
|
| 42 | - $plugins_interessants = array(); |
|
| 45 | + if (!is_array($plugins_interessants)) { |
|
| 46 | + $plugins_interessants = array(); |
|
| 47 | + } |
|
| 43 | 48 | |
| 44 | 49 | $plugins_interessants2 = array(); |
| 45 | 50 | |
| 46 | - foreach($plugins_interessants as $plug => $score) |
|
| 47 | - if ($score > 1) |
|
| 51 | + foreach($plugins_interessants as $plug => $score) { |
|
| 52 | + if ($score > 1) |
|
| 48 | 53 | $plugins_interessants2[$plug] = $score-1; |
| 49 | - foreach ($plugin as $plug) |
|
| 50 | - $plugins_interessants2[$plug] = 10; // score initial |
|
| 54 | + } |
|
| 55 | + foreach ($plugin as $plug) { |
|
| 56 | + $plugins_interessants2[$plug] = 10; |
|
| 57 | + } |
|
| 58 | + // score initial |
|
| 51 | 59 | ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
| 52 | 60 | } |
| 53 | 61 | |
@@ -57,8 +65,9 @@ discard block |
||
| 57 | 65 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 58 | 66 | $securiser_action(); |
| 59 | 67 | |
| 60 | - if (!autoriser('configurer', '_plugins')) |
|
| 61 | - die('erreur'); |
|
| 68 | + if (!autoriser('configurer', '_plugins')) { |
|
| 69 | + die('erreur'); |
|
| 70 | + } |
|
| 62 | 71 | // forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin |
| 63 | 72 | lire_metas(); |
| 64 | 73 | enregistre_modif_plugin(); |
@@ -13,16 +13,16 @@ |
||
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | 15 | function action_ajouter_lien_dist($arg=null){ |
| 16 | - if (is_null($arg)){ |
|
| 17 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 18 | - $arg = $securiser_action(); |
|
| 19 | - } |
|
| 16 | + if (is_null($arg)){ |
|
| 17 | + $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 18 | + $arg = $securiser_action(); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - $arg = explode("-",$arg); |
|
| 22 | - list($objet_source,$ids,$objet_lie,$idl) = $arg; |
|
| 21 | + $arg = explode("-",$arg); |
|
| 22 | + list($objet_source,$ids,$objet_lie,$idl) = $arg; |
|
| 23 | 23 | |
| 24 | - include_spip('action/editer_liens'); |
|
| 25 | - objet_associer(array($objet_source=>$ids), array($objet_lie=>$idl)); |
|
| 24 | + include_spip('action/editer_liens'); |
|
| 25 | + objet_associer(array($objet_source=>$ids), array($objet_lie=>$idl)); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | -function action_ajouter_lien_dist($arg=null){ |
|
| 16 | - if (is_null($arg)){ |
|
| 17 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 15 | +function action_ajouter_lien_dist($arg = null) { |
|
| 16 | + if (is_null($arg)) { |
|
| 17 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 18 | 18 | $arg = $securiser_action(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - $arg = explode("-",$arg); |
|
| 22 | - list($objet_source,$ids,$objet_lie,$idl) = $arg; |
|
| 21 | + $arg = explode("-", $arg); |
|
| 22 | + list($objet_source, $ids, $objet_lie, $idl) = $arg; |
|
| 23 | 23 | |
| 24 | 24 | include_spip('action/editer_liens'); |
| 25 | 25 | objet_associer(array($objet_source=>$ids), array($objet_lie=>$idl)); |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | function action_ajouter_lien_dist($arg=null){ |
| 16 | 18 | if (is_null($arg)){ |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | // http://doc.spip.org/@_generer_url_page |
| 29 | 29 | function _generer_url_page($type,$id, $args='', $ancre='') { |
| 30 | 30 | |
| 31 | - if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
|
| 32 | - $url = $generer_url_externe($id, $args, $ancre); |
|
| 33 | - if (NULL != $url) return $url; |
|
| 34 | - } |
|
| 31 | + if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
|
| 32 | + $url = $generer_url_externe($id, $args, $ancre); |
|
| 33 | + if (NULL != $url) return $url; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 37 | - . $id . _terminaison_urls_page; |
|
| 36 | + $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 37 | + . $id . _terminaison_urls_page; |
|
| 38 | 38 | |
| 39 | - if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 40 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 39 | + if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 40 | + return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // retrouve le fond et les parametres d'une URL abregee |
@@ -45,51 +45,51 @@ discard block |
||
| 45 | 45 | // http://doc.spip.org/@urls_page_dist |
| 46 | 46 | function urls_page_dist($i, &$entite, $args='', $ancre='') |
| 47 | 47 | { |
| 48 | - if (is_numeric($i)) |
|
| 49 | - return _generer_url_page($entite, $i, $args, $ancre); |
|
| 48 | + if (is_numeric($i)) |
|
| 49 | + return _generer_url_page($entite, $i, $args, $ancre); |
|
| 50 | 50 | |
| 51 | - // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
|
| 52 | - if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
|
| 53 | - return array(array(),'404'); |
|
| 54 | - } |
|
| 51 | + // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
|
| 52 | + if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
|
| 53 | + return array(array(),'404'); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
|
| 57 | - if (is_array($args)) |
|
| 58 | - $contexte = $args; |
|
| 59 | - else |
|
| 60 | - parse_str($args,$contexte); |
|
| 61 | - include_spip('inc/urls'); |
|
| 62 | - $r = nettoyer_url_page($i, $contexte); |
|
| 63 | - if ($r) { |
|
| 64 | - array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici |
|
| 65 | - return $r; |
|
| 66 | - } |
|
| 56 | + // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
|
| 57 | + if (is_array($args)) |
|
| 58 | + $contexte = $args; |
|
| 59 | + else |
|
| 60 | + parse_str($args,$contexte); |
|
| 61 | + include_spip('inc/urls'); |
|
| 62 | + $r = nettoyer_url_page($i, $contexte); |
|
| 63 | + if ($r) { |
|
| 64 | + array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici |
|
| 65 | + return $r; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /* |
|
| 68 | + /* |
|
| 69 | 69 | * Le bloc qui suit sert a faciliter les transitions depuis |
| 70 | 70 | * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html' |
| 71 | 71 | * Il est inutile de le recopier si vous personnalisez vos URLs |
| 72 | 72 | * et votre .htaccess |
| 73 | 73 | */ |
| 74 | - // Si on est revenu en mode html, mais c'est une ancienne url_propre |
|
| 75 | - // on ne redirige pas, on assume le nouveau contexte (si possible) |
|
| 76 | - $url = $i; |
|
| 77 | - $url_propre = isset($url) |
|
| 78 | - ? $url |
|
| 79 | - : (isset($_SERVER['REDIRECT_url_propre']) |
|
| 80 | - ? $_SERVER['REDIRECT_url_propre'] |
|
| 81 | - : (isset($_ENV['url_propre']) |
|
| 82 | - ? $_ENV['url_propre'] |
|
| 83 | - : '' |
|
| 84 | - )); |
|
| 85 | - if ($url_propre) { |
|
| 86 | - if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | - $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 88 | - else |
|
| 89 | - $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 90 | - return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
|
| 91 | - } |
|
| 92 | - /* Fin du bloc compatibilite url-propres */ |
|
| 74 | + // Si on est revenu en mode html, mais c'est une ancienne url_propre |
|
| 75 | + // on ne redirige pas, on assume le nouveau contexte (si possible) |
|
| 76 | + $url = $i; |
|
| 77 | + $url_propre = isset($url) |
|
| 78 | + ? $url |
|
| 79 | + : (isset($_SERVER['REDIRECT_url_propre']) |
|
| 80 | + ? $_SERVER['REDIRECT_url_propre'] |
|
| 81 | + : (isset($_ENV['url_propre']) |
|
| 82 | + ? $_ENV['url_propre'] |
|
| 83 | + : '' |
|
| 84 | + )); |
|
| 85 | + if ($url_propre) { |
|
| 86 | + if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | + $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 88 | + else |
|
| 89 | + $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 90 | + return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
|
| 91 | + } |
|
| 92 | + /* Fin du bloc compatibilite url-propres */ |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | ?> |
@@ -16,48 +16,48 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | ####### modifications possibles dans ecrire/mes_options |
| 18 | 18 | # on peut indiquer '.html' pour faire joli |
| 19 | -define ('_terminaison_urls_page', ''); |
|
| 19 | +define('_terminaison_urls_page', ''); |
|
| 20 | 20 | # ci-dessous, ce qu'on veut ou presque (de preference pas de '/') |
| 21 | 21 | # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite |
| 22 | -define ('_separateur_urls_page', ''); |
|
| 22 | +define('_separateur_urls_page', ''); |
|
| 23 | 23 | # on peut indiquer '' si on a installe le .htaccess |
| 24 | -define ('_debut_urls_page', get_spip_script('./').'?'); |
|
| 24 | +define('_debut_urls_page', get_spip_script('./').'?'); |
|
| 25 | 25 | ####### |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | // http://doc.spip.org/@_generer_url_page |
| 29 | -function _generer_url_page($type,$id, $args='', $ancre='') { |
|
| 29 | +function _generer_url_page($type, $id, $args = '', $ancre = '') { |
|
| 30 | 30 | |
| 31 | - if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
|
| 31 | + if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) { |
|
| 32 | 32 | $url = $generer_url_externe($id, $args, $ancre); |
| 33 | 33 | if (NULL != $url) return $url; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 37 | - . $id . _terminaison_urls_page; |
|
| 36 | + $url = _debut_urls_page.$type._separateur_urls_page |
|
| 37 | + . $id._terminaison_urls_page; |
|
| 38 | 38 | |
| 39 | - if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 40 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 39 | + if ($args) $args = strpos($url, '?') ? "&$args" : "?$args"; |
|
| 40 | + return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : ''); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // retrouve le fond et les parametres d'une URL abregee |
| 44 | 44 | // le contexte deja existant est fourni dans args sous forme de tableau ou query string |
| 45 | 45 | // http://doc.spip.org/@urls_page_dist |
| 46 | -function urls_page_dist($i, &$entite, $args='', $ancre='') |
|
| 46 | +function urls_page_dist($i, &$entite, $args = '', $ancre = '') |
|
| 47 | 47 | { |
| 48 | 48 | if (is_numeric($i)) |
| 49 | 49 | return _generer_url_page($entite, $i, $args, $ancre); |
| 50 | 50 | |
| 51 | 51 | // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
| 52 | - if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
|
| 53 | - return array(array(),'404'); |
|
| 52 | + if ($GLOBALS['profondeur_url'] > 0 AND $entite == 'sommaire') { |
|
| 53 | + return array(array(), '404'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
| 57 | 57 | if (is_array($args)) |
| 58 | 58 | $contexte = $args; |
| 59 | 59 | else |
| 60 | - parse_str($args,$contexte); |
|
| 60 | + parse_str($args, $contexte); |
|
| 61 | 61 | include_spip('inc/urls'); |
| 62 | 62 | $r = nettoyer_url_page($i, $contexte); |
| 63 | 63 | if ($r) { |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | : '' |
| 84 | 84 | )); |
| 85 | 85 | if ($url_propre) { |
| 86 | - if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | - $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 86 | + if ($GLOBALS['profondeur_url'] <= 0) |
|
| 87 | + $urls_anciennes = charger_fonction('propres', 'urls', true); |
|
| 88 | 88 | else |
| 89 | - $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 90 | - return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
|
| 89 | + $urls_anciennes = charger_fonction('arbo', 'urls', true); |
|
| 90 | + return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : ''; |
|
| 91 | 91 | } |
| 92 | 92 | /* Fin du bloc compatibilite url-propres */ |
| 93 | 93 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | define('URLS_PAGE_EXEMPLE', 'spip.php?article12'); |
| 16 | 18 | |
@@ -30,13 +32,17 @@ discard block |
||
| 30 | 32 | |
| 31 | 33 | if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
| 32 | 34 | $url = $generer_url_externe($id, $args, $ancre); |
| 33 | - if (NULL != $url) return $url; |
|
| 35 | + if (NULL != $url) { |
|
| 36 | + return $url; |
|
| 37 | + } |
|
| 34 | 38 | } |
| 35 | 39 | |
| 36 | 40 | $url = _debut_urls_page . $type . _separateur_urls_page |
| 37 | 41 | . $id . _terminaison_urls_page; |
| 38 | 42 | |
| 39 | - if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 43 | + if ($args) { |
|
| 44 | + $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 45 | + } |
|
| 40 | 46 | return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
| 41 | 47 | } |
| 42 | 48 | |
@@ -45,8 +51,9 @@ discard block |
||
| 45 | 51 | // http://doc.spip.org/@urls_page_dist |
| 46 | 52 | function urls_page_dist($i, &$entite, $args='', $ancre='') |
| 47 | 53 | { |
| 48 | - if (is_numeric($i)) |
|
| 49 | - return _generer_url_page($entite, $i, $args, $ancre); |
|
| 54 | + if (is_numeric($i)) { |
|
| 55 | + return _generer_url_page($entite, $i, $args, $ancre); |
|
| 56 | + } |
|
| 50 | 57 | |
| 51 | 58 | // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
| 52 | 59 | if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
@@ -54,10 +61,11 @@ discard block |
||
| 54 | 61 | } |
| 55 | 62 | |
| 56 | 63 | // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
| 57 | - if (is_array($args)) |
|
| 58 | - $contexte = $args; |
|
| 59 | - else |
|
| 60 | - parse_str($args,$contexte); |
|
| 64 | + if (is_array($args)) { |
|
| 65 | + $contexte = $args; |
|
| 66 | + } else { |
|
| 67 | + parse_str($args,$contexte); |
|
| 68 | + } |
|
| 61 | 69 | include_spip('inc/urls'); |
| 62 | 70 | $r = nettoyer_url_page($i, $contexte); |
| 63 | 71 | if ($r) { |
@@ -83,10 +91,11 @@ discard block |
||
| 83 | 91 | : '' |
| 84 | 92 | )); |
| 85 | 93 | if ($url_propre) { |
| 86 | - if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | - $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 88 | - else |
|
| 89 | - $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 94 | + if ($GLOBALS['profondeur_url']<=0) { |
|
| 95 | + $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 96 | + } else { |
|
| 97 | + $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 98 | + } |
|
| 90 | 99 | return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
| 91 | 100 | } |
| 92 | 101 | /* Fin du bloc compatibilite url-propres */ |