@@ -17,16 +17,16 @@ |
||
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | 19 | function action_forcer_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('forcer','job',$id_job) |
|
| 25 | - ){ |
|
| 26 | - include_spip('inc/queue'); |
|
| 27 | - include_spip('inc/genie'); |
|
| 28 | - queue_schedule(array($id_job)); |
|
| 29 | - } |
|
| 23 | + if ($id_job = intval($id_job) |
|
| 24 | + AND autoriser('forcer','job',$id_job) |
|
| 25 | + ){ |
|
| 26 | + include_spip('inc/queue'); |
|
| 27 | + include_spip('inc/genie'); |
|
| 28 | + queue_schedule(array($id_job)); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
@@ -17,18 +17,18 @@ |
||
| 17 | 17 | |
| 18 | 18 | function action_confirmer_email_dist() |
| 19 | 19 | { |
| 20 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | - $arg = $securiser_action(); |
|
| 22 | - |
|
| 23 | - include_spip('inc/filtres'); |
|
| 24 | - if ($GLOBALS['visiteur_session']['id_auteur'] AND email_valide($arg)){ |
|
| 25 | - include_spip('action/editer_auteur'); |
|
| 26 | - auteur_modifier($GLOBALS['visiteur_session']['id_auteur'],array('email'=>$arg)); |
|
| 27 | - } |
|
| 28 | - // verifier avant de rediriger pour invalider le message de confirmation |
|
| 29 | - // si ca n'a pas marche |
|
| 30 | - if ($redirect = _request('redirect') AND !$arg == sql_getfetsel('email', 'spip_auteurs', 'id_auteur='.intval($GLOBALS['visiteur_session']))) |
|
| 31 | - $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif',''); |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | + $arg = $securiser_action(); |
|
| 22 | + |
|
| 23 | + include_spip('inc/filtres'); |
|
| 24 | + if ($GLOBALS['visiteur_session']['id_auteur'] AND email_valide($arg)){ |
|
| 25 | + include_spip('action/editer_auteur'); |
|
| 26 | + auteur_modifier($GLOBALS['visiteur_session']['id_auteur'],array('email'=>$arg)); |
|
| 27 | + } |
|
| 28 | + // verifier avant de rediriger pour invalider le message de confirmation |
|
| 29 | + // si ca n'a pas marche |
|
| 30 | + if ($redirect = _request('redirect') AND !$arg == sql_getfetsel('email', 'spip_auteurs', 'id_auteur='.intval($GLOBALS['visiteur_session']))) |
|
| 31 | + $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif',''); |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
@@ -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 |
@@ -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 | |
@@ -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 | ?> |
@@ -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 | ?> |
@@ -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 | |
@@ -20,44 +20,44 @@ discard block |
||
| 20 | 20 | * @param string|null $arg |
| 21 | 21 | */ |
| 22 | 22 | function action_calculer_taille_cache_dist($arg=null){ |
| 23 | - if (is_null($arg)){ |
|
| 24 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 25 | - $arg = $securiser_action(); |
|
| 26 | - } |
|
| 27 | - include_spip('inc/filtres'); |
|
| 23 | + if (is_null($arg)){ |
|
| 24 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 25 | + $arg = $securiser_action(); |
|
| 26 | + } |
|
| 27 | + include_spip('inc/filtres'); |
|
| 28 | 28 | |
| 29 | - if ($arg=='images'){ |
|
| 30 | - $taille = calculer_taille_dossier(_DIR_VAR); |
|
| 31 | - $res = _T('ecrire:taille_cache_image', |
|
| 32 | - array( |
|
| 33 | - 'dir' => joli_repertoire(_DIR_VAR), |
|
| 34 | - 'taille' => "<b>".(taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet")."</b>" |
|
| 35 | - ) |
|
| 36 | - ); |
|
| 37 | - } |
|
| 38 | - else { |
|
| 39 | - include_spip('inc/invalideur'); |
|
| 40 | - $taille = |
|
| 41 | - calculer_taille_dossier(_DIR_CACHE_XML) |
|
| 42 | - +calculer_taille_dossier(_DIR_CACHE.'skel/') |
|
| 43 | - +calculer_taille_dossier(_DIR_CACHE.'wheels/') |
|
| 44 | - +calculer_taille_dossier(_DIR_CACHE.'contextes/') |
|
| 45 | - ; |
|
| 46 | - $taille += intval(taille_du_cache()); |
|
| 47 | - if ($taille<=150000){ |
|
| 48 | - $res = _T('taille_cache_vide'); |
|
| 49 | - } |
|
| 50 | - elseif ($taille<=1024*1024){ |
|
| 51 | - $res = _T('taille_cache_moins_de',array('octets'=>taille_en_octets(1024*1024))); |
|
| 52 | - } |
|
| 53 | - else { |
|
| 54 | - $res = _T('taille_cache_octets',array('octets'=>taille_en_octets($taille))); |
|
| 55 | - } |
|
| 56 | - $res = "<b>$res</b>"; |
|
| 57 | - } |
|
| 29 | + if ($arg=='images'){ |
|
| 30 | + $taille = calculer_taille_dossier(_DIR_VAR); |
|
| 31 | + $res = _T('ecrire:taille_cache_image', |
|
| 32 | + array( |
|
| 33 | + 'dir' => joli_repertoire(_DIR_VAR), |
|
| 34 | + 'taille' => "<b>".(taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet")."</b>" |
|
| 35 | + ) |
|
| 36 | + ); |
|
| 37 | + } |
|
| 38 | + else { |
|
| 39 | + include_spip('inc/invalideur'); |
|
| 40 | + $taille = |
|
| 41 | + calculer_taille_dossier(_DIR_CACHE_XML) |
|
| 42 | + +calculer_taille_dossier(_DIR_CACHE.'skel/') |
|
| 43 | + +calculer_taille_dossier(_DIR_CACHE.'wheels/') |
|
| 44 | + +calculer_taille_dossier(_DIR_CACHE.'contextes/') |
|
| 45 | + ; |
|
| 46 | + $taille += intval(taille_du_cache()); |
|
| 47 | + if ($taille<=150000){ |
|
| 48 | + $res = _T('taille_cache_vide'); |
|
| 49 | + } |
|
| 50 | + elseif ($taille<=1024*1024){ |
|
| 51 | + $res = _T('taille_cache_moins_de',array('octets'=>taille_en_octets(1024*1024))); |
|
| 52 | + } |
|
| 53 | + else { |
|
| 54 | + $res = _T('taille_cache_octets',array('octets'=>taille_en_octets($taille))); |
|
| 55 | + } |
|
| 56 | + $res = "<b>$res</b>"; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - $res = "<p>$res</p>"; |
|
| 60 | - ajax_retour($res); |
|
| 59 | + $res = "<p>$res</p>"; |
|
| 60 | + ajax_retour($res); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
@@ -70,20 +70,20 @@ discard block |
||
| 70 | 70 | * @return int |
| 71 | 71 | */ |
| 72 | 72 | function calculer_taille_dossier ($dir) { |
| 73 | - $handle = @opendir($dir); |
|
| 74 | - if (!$handle) return 0; |
|
| 75 | - $taille = 0; |
|
| 76 | - while (($fichier = @readdir($handle)) !== false) { |
|
| 77 | - // Eviter ".", "..", ".htaccess", etc. |
|
| 78 | - if ($fichier[0] == '.') continue; |
|
| 79 | - if (is_file($d = "$dir/$fichier")) { |
|
| 80 | - $taille += filesize($d); |
|
| 81 | - } |
|
| 82 | - else if (is_dir($d)) |
|
| 83 | - $taille += calculer_taille_dossier($d); |
|
| 84 | - } |
|
| 85 | - closedir($handle); |
|
| 86 | - return $taille; |
|
| 73 | + $handle = @opendir($dir); |
|
| 74 | + if (!$handle) return 0; |
|
| 75 | + $taille = 0; |
|
| 76 | + while (($fichier = @readdir($handle)) !== false) { |
|
| 77 | + // Eviter ".", "..", ".htaccess", etc. |
|
| 78 | + if ($fichier[0] == '.') continue; |
|
| 79 | + if (is_file($d = "$dir/$fichier")) { |
|
| 80 | + $taille += filesize($d); |
|
| 81 | + } |
|
| 82 | + else if (is_dir($d)) |
|
| 83 | + $taille += calculer_taille_dossier($d); |
|
| 84 | + } |
|
| 85 | + closedir($handle); |
|
| 86 | + return $taille; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | ?> |
| 90 | 90 | \ No newline at end of file |
@@ -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 |