@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Cache |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
@@ -31,40 +31,40 @@ discard block |
||
| 31 | 31 | * de l'action sécurisée. |
| 32 | 32 | */ |
| 33 | 33 | function action_calculer_taille_cache_dist($arg = null) { |
| 34 | - if (is_null($arg)) { |
|
| 35 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | - $arg = $securiser_action(); |
|
| 37 | - } |
|
| 38 | - include_spip('inc/filtres'); |
|
| 34 | + if (is_null($arg)) { |
|
| 35 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | + $arg = $securiser_action(); |
|
| 37 | + } |
|
| 38 | + include_spip('inc/filtres'); |
|
| 39 | 39 | |
| 40 | - if ($arg == 'images') { |
|
| 41 | - $taille = calculer_taille_dossier(_DIR_VAR); |
|
| 42 | - $res = _T('ecrire:taille_cache_image', |
|
| 43 | - array( |
|
| 44 | - 'dir' => joli_repertoire(_DIR_VAR), |
|
| 45 | - 'taille' => "<b>" . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet") . "</b>" |
|
| 46 | - ) |
|
| 47 | - ); |
|
| 48 | - } else { |
|
| 49 | - include_spip('inc/invalideur'); |
|
| 50 | - $taille = |
|
| 51 | - calculer_taille_dossier(_DIR_CACHE_XML) |
|
| 52 | - + calculer_taille_dossier(_DIR_CACHE . 'skel/') |
|
| 53 | - + calculer_taille_dossier(_DIR_CACHE . 'wheels/') |
|
| 54 | - + calculer_taille_dossier(_DIR_CACHE . 'contextes/'); |
|
| 55 | - $taille += intval(taille_du_cache()); |
|
| 56 | - if ($taille <= 150000) { |
|
| 57 | - $res = _T('taille_cache_vide'); |
|
| 58 | - } elseif ($taille <= 1024 * 1024) { |
|
| 59 | - $res = _T('taille_cache_moins_de', array('octets' => taille_en_octets(1024 * 1024))); |
|
| 60 | - } else { |
|
| 61 | - $res = _T('taille_cache_octets', array('octets' => taille_en_octets($taille))); |
|
| 62 | - } |
|
| 63 | - $res = "<b>$res</b>"; |
|
| 64 | - } |
|
| 40 | + if ($arg == 'images') { |
|
| 41 | + $taille = calculer_taille_dossier(_DIR_VAR); |
|
| 42 | + $res = _T('ecrire:taille_cache_image', |
|
| 43 | + array( |
|
| 44 | + 'dir' => joli_repertoire(_DIR_VAR), |
|
| 45 | + 'taille' => "<b>" . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet") . "</b>" |
|
| 46 | + ) |
|
| 47 | + ); |
|
| 48 | + } else { |
|
| 49 | + include_spip('inc/invalideur'); |
|
| 50 | + $taille = |
|
| 51 | + calculer_taille_dossier(_DIR_CACHE_XML) |
|
| 52 | + + calculer_taille_dossier(_DIR_CACHE . 'skel/') |
|
| 53 | + + calculer_taille_dossier(_DIR_CACHE . 'wheels/') |
|
| 54 | + + calculer_taille_dossier(_DIR_CACHE . 'contextes/'); |
|
| 55 | + $taille += intval(taille_du_cache()); |
|
| 56 | + if ($taille <= 150000) { |
|
| 57 | + $res = _T('taille_cache_vide'); |
|
| 58 | + } elseif ($taille <= 1024 * 1024) { |
|
| 59 | + $res = _T('taille_cache_moins_de', array('octets' => taille_en_octets(1024 * 1024))); |
|
| 60 | + } else { |
|
| 61 | + $res = _T('taille_cache_octets', array('octets' => taille_en_octets($taille))); |
|
| 62 | + } |
|
| 63 | + $res = "<b>$res</b>"; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - $res = "<p>$res</p>"; |
|
| 67 | - ajax_retour($res); |
|
| 66 | + $res = "<p>$res</p>"; |
|
| 67 | + ajax_retour($res); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -75,28 +75,28 @@ discard block |
||
| 75 | 75 | * @return int Taille en octets |
| 76 | 76 | */ |
| 77 | 77 | function calculer_taille_dossier($dir) { |
| 78 | - if (!is_dir($dir) or !is_readable($dir)) { |
|
| 79 | - return 0; |
|
| 80 | - } |
|
| 81 | - $handle = opendir($dir); |
|
| 82 | - if (!$handle) { |
|
| 83 | - return 0; |
|
| 84 | - } |
|
| 85 | - $taille = 0; |
|
| 86 | - while (($fichier = @readdir($handle)) !== false) { |
|
| 87 | - // Eviter ".", "..", ".htaccess", etc. |
|
| 88 | - if ($fichier[0] == '.') { |
|
| 89 | - continue; |
|
| 90 | - } |
|
| 91 | - if (is_file($d = "$dir/$fichier")) { |
|
| 92 | - $taille += filesize($d); |
|
| 93 | - } else { |
|
| 94 | - if (is_dir($d)) { |
|
| 95 | - $taille += calculer_taille_dossier($d); |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - closedir($handle); |
|
| 78 | + if (!is_dir($dir) or !is_readable($dir)) { |
|
| 79 | + return 0; |
|
| 80 | + } |
|
| 81 | + $handle = opendir($dir); |
|
| 82 | + if (!$handle) { |
|
| 83 | + return 0; |
|
| 84 | + } |
|
| 85 | + $taille = 0; |
|
| 86 | + while (($fichier = @readdir($handle)) !== false) { |
|
| 87 | + // Eviter ".", "..", ".htaccess", etc. |
|
| 88 | + if ($fichier[0] == '.') { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 91 | + if (is_file($d = "$dir/$fichier")) { |
|
| 92 | + $taille += filesize($d); |
|
| 93 | + } else { |
|
| 94 | + if (is_dir($d)) { |
|
| 95 | + $taille += calculer_taille_dossier($d); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + closedir($handle); |
|
| 100 | 100 | |
| 101 | - return $taille; |
|
| 101 | + return $taille; |
|
| 102 | 102 | } |
@@ -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 | include_spip('inc/headers'); |
| 24 | 24 | |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * Sortie du buffer |
| 36 | 36 | **/ |
| 37 | 37 | function action_tester_taille_error_handler($output) { |
| 38 | - // on est ici, donc echec lors de la creation de l'image |
|
| 39 | - if (!empty($GLOBALS['redirect'])) { |
|
| 40 | - return redirige_formulaire($GLOBALS['redirect']); |
|
| 41 | - } |
|
| 38 | + // on est ici, donc echec lors de la creation de l'image |
|
| 39 | + if (!empty($GLOBALS['redirect'])) { |
|
| 40 | + return redirige_formulaire($GLOBALS['redirect']); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - return $output; |
|
| 43 | + return $output; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -58,75 +58,75 @@ discard block |
||
| 58 | 58 | **/ |
| 59 | 59 | function action_tester_taille_dist() { |
| 60 | 60 | |
| 61 | - if (!autoriser('configurer')) { |
|
| 62 | - return; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - $taille = _request('arg'); |
|
| 66 | - $taille = explode('-', $taille); |
|
| 67 | - |
|
| 68 | - $GLOBALS['taille_max'] = end($taille); |
|
| 69 | - $GLOBALS['taille_min'] = 0; |
|
| 70 | - if (count($taille) > 1) { |
|
| 71 | - $GLOBALS['taille_min'] = reset($taille); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // si l'intervalle est assez petit, on garde la valeur min |
|
| 75 | - if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { |
|
| 76 | - $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']); |
|
| 77 | - if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) { |
|
| 78 | - $t = $t * 0.9; // marge de securite |
|
| 79 | - echo round($t / 1000000, 3) . ' Mpx'; |
|
| 80 | - } else { |
|
| 81 | - // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue" |
|
| 82 | - $t = 0; |
|
| 83 | - echo "∞"; |
|
| 84 | - } |
|
| 85 | - ecrire_meta('max_taille_vignettes', $t, 'non'); |
|
| 86 | - die(); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); |
|
| 90 | - |
|
| 91 | - include_spip('inc/filtres'); |
|
| 92 | - // des inclusions representatives d'un hit prive et/ou public pour la conso memoire |
|
| 93 | - include_spip('public/assembler'); |
|
| 94 | - include_spip('public/balises'); |
|
| 95 | - include_spip('public/boucles'); |
|
| 96 | - include_spip('public/cacher'); |
|
| 97 | - include_spip('public/compiler'); |
|
| 98 | - include_spip('public/composer'); |
|
| 99 | - include_spip('public/criteres'); |
|
| 100 | - include_spip('public/interfaces'); |
|
| 101 | - include_spip('public/parametrer'); |
|
| 102 | - include_spip('public/phraser_html'); |
|
| 103 | - include_spip('public/references'); |
|
| 104 | - |
|
| 105 | - include_spip('inc/presentation'); |
|
| 106 | - include_spip('inc/charsets'); |
|
| 107 | - include_spip('inc/documents'); |
|
| 108 | - include_spip('inc/header'); |
|
| 109 | - propre("<doc1>"); // charger propre avec le trairement d'un modele |
|
| 110 | - |
|
| 111 | - $i = _request('i') + 1; |
|
| 112 | - $image_source = chemin_image("test.png"); |
|
| 113 | - $GLOBALS['redirect'] = generer_url_action("tester_taille", |
|
| 114 | - "i=$i&arg=" . $GLOBALS['taille_min'] . "-" . $GLOBALS['taille_test']); |
|
| 115 | - |
|
| 116 | - ob_start('action_tester_taille_error_handler'); |
|
| 117 | - filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 118 | - $GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 119 | - |
|
| 120 | - // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee |
|
| 121 | - // si $GLOBALS['taille_min']==0 (car on est au premier coup) |
|
| 122 | - if ($GLOBALS['taille_min'] == 0) { |
|
| 123 | - $taille = $GLOBALS['taille_max']; |
|
| 124 | - filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 125 | - $GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 126 | - } |
|
| 127 | - ob_end_clean(); |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - // on est ici, donc pas de plantage |
|
| 131 | - echo redirige_formulaire($GLOBALS['redirect']); |
|
| 61 | + if (!autoriser('configurer')) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + $taille = _request('arg'); |
|
| 66 | + $taille = explode('-', $taille); |
|
| 67 | + |
|
| 68 | + $GLOBALS['taille_max'] = end($taille); |
|
| 69 | + $GLOBALS['taille_min'] = 0; |
|
| 70 | + if (count($taille) > 1) { |
|
| 71 | + $GLOBALS['taille_min'] = reset($taille); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // si l'intervalle est assez petit, on garde la valeur min |
|
| 75 | + if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { |
|
| 76 | + $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']); |
|
| 77 | + if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) { |
|
| 78 | + $t = $t * 0.9; // marge de securite |
|
| 79 | + echo round($t / 1000000, 3) . ' Mpx'; |
|
| 80 | + } else { |
|
| 81 | + // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue" |
|
| 82 | + $t = 0; |
|
| 83 | + echo "∞"; |
|
| 84 | + } |
|
| 85 | + ecrire_meta('max_taille_vignettes', $t, 'non'); |
|
| 86 | + die(); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); |
|
| 90 | + |
|
| 91 | + include_spip('inc/filtres'); |
|
| 92 | + // des inclusions representatives d'un hit prive et/ou public pour la conso memoire |
|
| 93 | + include_spip('public/assembler'); |
|
| 94 | + include_spip('public/balises'); |
|
| 95 | + include_spip('public/boucles'); |
|
| 96 | + include_spip('public/cacher'); |
|
| 97 | + include_spip('public/compiler'); |
|
| 98 | + include_spip('public/composer'); |
|
| 99 | + include_spip('public/criteres'); |
|
| 100 | + include_spip('public/interfaces'); |
|
| 101 | + include_spip('public/parametrer'); |
|
| 102 | + include_spip('public/phraser_html'); |
|
| 103 | + include_spip('public/references'); |
|
| 104 | + |
|
| 105 | + include_spip('inc/presentation'); |
|
| 106 | + include_spip('inc/charsets'); |
|
| 107 | + include_spip('inc/documents'); |
|
| 108 | + include_spip('inc/header'); |
|
| 109 | + propre("<doc1>"); // charger propre avec le trairement d'un modele |
|
| 110 | + |
|
| 111 | + $i = _request('i') + 1; |
|
| 112 | + $image_source = chemin_image("test.png"); |
|
| 113 | + $GLOBALS['redirect'] = generer_url_action("tester_taille", |
|
| 114 | + "i=$i&arg=" . $GLOBALS['taille_min'] . "-" . $GLOBALS['taille_test']); |
|
| 115 | + |
|
| 116 | + ob_start('action_tester_taille_error_handler'); |
|
| 117 | + filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 118 | + $GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 119 | + |
|
| 120 | + // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee |
|
| 121 | + // si $GLOBALS['taille_min']==0 (car on est au premier coup) |
|
| 122 | + if ($GLOBALS['taille_min'] == 0) { |
|
| 123 | + $taille = $GLOBALS['taille_max']; |
|
| 124 | + filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 125 | + $GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 126 | + } |
|
| 127 | + ob_end_clean(); |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + // on est ici, donc pas de plantage |
|
| 131 | + echo redirige_formulaire($GLOBALS['redirect']); |
|
| 132 | 132 | } |
@@ -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 | |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | 37 | function action_supprimer_lien_dist($arg = null) { |
| 38 | - if (is_null($arg)) { |
|
| 39 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 40 | - $arg = $securiser_action(); |
|
| 41 | - } |
|
| 38 | + if (is_null($arg)) { |
|
| 39 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 40 | + $arg = $securiser_action(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $arg = explode("-", $arg); |
|
| 44 | - list($objet_source, $ids, $objet_lie, $idl) = $arg; |
|
| 43 | + $arg = explode("-", $arg); |
|
| 44 | + list($objet_source, $ids, $objet_lie, $idl) = $arg; |
|
| 45 | 45 | |
| 46 | - include_spip('action/editer_liens'); |
|
| 47 | - objet_dissocier(array($objet_source => $ids), array($objet_lie => $idl)); |
|
| 46 | + include_spip('action/editer_liens'); |
|
| 47 | + objet_dissocier(array($objet_source => $ids), array($objet_lie => $idl)); |
|
| 48 | 48 | } |
@@ -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 | /** |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | * Envoyer en réponse : json contenant toutes les variables publiques de la session |
| 33 | 33 | **/ |
| 34 | 34 | function action_session_dist() { |
| 35 | - if ($var = _request('var') |
|
| 36 | - and preg_match(',^[a-z_0-9-]+$,i', $var) |
|
| 37 | - ) { |
|
| 38 | - if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 39 | - include_spip('inc/session'); |
|
| 40 | - session_set('session_' . $var, $val = _request('val')); |
|
| 41 | - #spip_log("autosave:$var:$val",'autosave'); |
|
| 42 | - } |
|
| 43 | - } |
|
| 35 | + if ($var = _request('var') |
|
| 36 | + and preg_match(',^[a-z_0-9-]+$,i', $var) |
|
| 37 | + ) { |
|
| 38 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 39 | + include_spip('inc/session'); |
|
| 40 | + session_set('session_' . $var, $val = _request('val')); |
|
| 41 | + #spip_log("autosave:$var:$val",'autosave'); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - # TODO: mode lecture de session ; n'afficher que ce qu'il faut |
|
| 46 | - #echo json_encode($GLOBALS['visiteur_session']); |
|
| 45 | + # TODO: mode lecture de session ; n'afficher que ce qu'il faut |
|
| 46 | + #echo json_encode($GLOBALS['visiteur_session']); |
|
| 47 | 47 | } |
@@ -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 | /** |
@@ -29,25 +29,25 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | function action_instituer_objet_dist($arg = null) { |
| 31 | 31 | |
| 32 | - if (is_null($arg)) { |
|
| 33 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 34 | - $arg = $securiser_action(); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - list($objet, $id_objet, $statut) = preg_split('/\W/', $arg); |
|
| 38 | - if (!$statut) { |
|
| 39 | - $statut = _request('statut_nouv'); |
|
| 40 | - } // cas POST |
|
| 41 | - if (!$statut) { |
|
| 42 | - return; |
|
| 43 | - } // impossible mais sait-on jamais |
|
| 44 | - |
|
| 45 | - if ($id_objet = intval($id_objet) |
|
| 46 | - and autoriser('instituer', $objet, $id_objet, '', array('statut' => $statut)) |
|
| 47 | - ) { |
|
| 48 | - |
|
| 49 | - include_spip('action/editer_objet'); |
|
| 50 | - objet_modifier($objet, $id_objet, array('statut' => $statut)); |
|
| 51 | - } |
|
| 32 | + if (is_null($arg)) { |
|
| 33 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 34 | + $arg = $securiser_action(); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + list($objet, $id_objet, $statut) = preg_split('/\W/', $arg); |
|
| 38 | + if (!$statut) { |
|
| 39 | + $statut = _request('statut_nouv'); |
|
| 40 | + } // cas POST |
|
| 41 | + if (!$statut) { |
|
| 42 | + return; |
|
| 43 | + } // impossible mais sait-on jamais |
|
| 44 | + |
|
| 45 | + if ($id_objet = intval($id_objet) |
|
| 46 | + and autoriser('instituer', $objet, $id_objet, '', array('statut' => $statut)) |
|
| 47 | + ) { |
|
| 48 | + |
|
| 49 | + include_spip('action/editer_objet'); |
|
| 50 | + objet_modifier($objet, $id_objet, array('statut' => $statut)); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | } |
@@ -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 | /** |
@@ -31,43 +31,43 @@ discard block |
||
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | 33 | function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur='') { |
| 34 | - if ($changer_lang) { |
|
| 35 | - $table_objet_sql = table_objet_sql($objet); |
|
| 36 | - $id_table_objet = id_table_objet($objet); |
|
| 37 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 38 | - $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 34 | + if ($changer_lang) { |
|
| 35 | + $table_objet_sql = table_objet_sql($objet); |
|
| 36 | + $id_table_objet = id_table_objet($objet); |
|
| 37 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 38 | + $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 39 | 39 | |
| 40 | - $set = array(); |
|
| 41 | - if (isset($desc['field']['langue_choisie'])){ |
|
| 42 | - $set['langue_choisie'] = 'oui'; |
|
| 43 | - } |
|
| 40 | + $set = array(); |
|
| 41 | + if (isset($desc['field']['langue_choisie'])){ |
|
| 42 | + $set['langue_choisie'] = 'oui'; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if ($changer_lang != "herit") { |
|
| 46 | - $set['lang'] = $changer_lang; |
|
| 47 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 48 | - include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 49 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 50 | - calculer_langues_rubriques(); |
|
| 51 | - } |
|
| 52 | - $langues = calculer_langues_utilisees($serveur); |
|
| 53 | - ecrire_meta('langues_utilisees', $langues); |
|
| 54 | - } else { |
|
| 55 | - $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 56 | - if (!$langue_parent) { |
|
| 57 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 58 | - } |
|
| 59 | - $changer_lang = $langue_parent; |
|
| 60 | - $set['lang'] = $changer_lang; |
|
| 61 | - if (isset($set['langue_choisie'])){ |
|
| 62 | - $set['langue_choisie'] = 'non'; |
|
| 63 | - } |
|
| 64 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 65 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 66 | - include_spip('inc/rubriques'); |
|
| 67 | - calculer_langues_rubriques(); |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - } |
|
| 45 | + if ($changer_lang != "herit") { |
|
| 46 | + $set['lang'] = $changer_lang; |
|
| 47 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 48 | + include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 49 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 50 | + calculer_langues_rubriques(); |
|
| 51 | + } |
|
| 52 | + $langues = calculer_langues_utilisees($serveur); |
|
| 53 | + ecrire_meta('langues_utilisees', $langues); |
|
| 54 | + } else { |
|
| 55 | + $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 56 | + if (!$langue_parent) { |
|
| 57 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 58 | + } |
|
| 59 | + $changer_lang = $langue_parent; |
|
| 60 | + $set['lang'] = $changer_lang; |
|
| 61 | + if (isset($set['langue_choisie'])){ |
|
| 62 | + $set['langue_choisie'] = 'non'; |
|
| 63 | + } |
|
| 64 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 65 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 66 | + include_spip('inc/rubriques'); |
|
| 67 | + calculer_langues_rubriques(); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return $changer_lang; |
|
| 72 | + return $changer_lang; |
|
| 73 | 73 | } |
@@ -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 | /** |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | 28 | function action_forcer_job_dist() { |
| 29 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | - $id_job = $securiser_action(); |
|
| 29 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | + $id_job = $securiser_action(); |
|
| 31 | 31 | |
| 32 | - if ($id_job = intval($id_job) |
|
| 33 | - and autoriser('forcer', 'job', $id_job) |
|
| 34 | - ) { |
|
| 35 | - include_spip('inc/queue'); |
|
| 36 | - include_spip('inc/genie'); |
|
| 37 | - queue_schedule(array($id_job)); |
|
| 38 | - } |
|
| 32 | + if ($id_job = intval($id_job) |
|
| 33 | + and autoriser('forcer', 'job', $id_job) |
|
| 34 | + ) { |
|
| 35 | + include_spip('inc/queue'); |
|
| 36 | + include_spip('inc/genie'); |
|
| 37 | + queue_schedule(array($id_job)); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
@@ -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 | /** |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | 28 | function action_annuler_job_dist() { |
| 29 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | - $id_job = $securiser_action(); |
|
| 29 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | + $id_job = $securiser_action(); |
|
| 31 | 31 | |
| 32 | - if ($id_job = intval($id_job) |
|
| 33 | - and autoriser('annuler', 'job', $id_job) |
|
| 34 | - ) { |
|
| 35 | - job_queue_remove($id_job); |
|
| 36 | - } |
|
| 32 | + if ($id_job = intval($id_job) |
|
| 33 | + and autoriser('annuler', 'job', $id_job) |
|
| 34 | + ) { |
|
| 35 | + job_queue_remove($id_job); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -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 | /** |
@@ -28,47 +28,47 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function enregistre_modif_plugin() { |
| 31 | - include_spip('inc/plugin'); |
|
| 32 | - // recuperer les plugins dans l'ordre des $_POST |
|
| 33 | - $test = array(); |
|
| 34 | - foreach (liste_plugin_files() as $file) { |
|
| 35 | - $test['s' . substr(md5(_DIR_PLUGINS . $file), 0, 16)] = $file; |
|
| 36 | - } |
|
| 37 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 38 | - foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) { |
|
| 39 | - $test['s' . substr(md5(_DIR_PLUGINS_SUPPL . $file), 0, 16)] = $file; |
|
| 40 | - } |
|
| 41 | - } |
|
| 31 | + include_spip('inc/plugin'); |
|
| 32 | + // recuperer les plugins dans l'ordre des $_POST |
|
| 33 | + $test = array(); |
|
| 34 | + foreach (liste_plugin_files() as $file) { |
|
| 35 | + $test['s' . substr(md5(_DIR_PLUGINS . $file), 0, 16)] = $file; |
|
| 36 | + } |
|
| 37 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 38 | + foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) { |
|
| 39 | + $test['s' . substr(md5(_DIR_PLUGINS_SUPPL . $file), 0, 16)] = $file; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $plugin = array(); |
|
| 43 | + $plugin = array(); |
|
| 44 | 44 | |
| 45 | - foreach ($_POST as $choix => $val) { |
|
| 46 | - if (isset($test[$choix]) && $val == 'O') { |
|
| 47 | - $plugin[] = $test[$choix]; |
|
| 48 | - } |
|
| 49 | - } |
|
| 45 | + foreach ($_POST as $choix => $val) { |
|
| 46 | + if (isset($test[$choix]) && $val == 'O') { |
|
| 47 | + $plugin[] = $test[$choix]; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', |
|
| 52 | - $plugin)); |
|
| 53 | - ecrire_plugin_actifs($plugin); |
|
| 51 | + spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', |
|
| 52 | + $plugin)); |
|
| 53 | + ecrire_plugin_actifs($plugin); |
|
| 54 | 54 | |
| 55 | - // 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. |
|
| 56 | - $plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']); |
|
| 57 | - if (!is_array($plugins_interessants)) { |
|
| 58 | - $plugins_interessants = array(); |
|
| 59 | - } |
|
| 55 | + // 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. |
|
| 56 | + $plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']); |
|
| 57 | + if (!is_array($plugins_interessants)) { |
|
| 58 | + $plugins_interessants = array(); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - $plugins_interessants2 = array(); |
|
| 61 | + $plugins_interessants2 = array(); |
|
| 62 | 62 | |
| 63 | - foreach ($plugins_interessants as $plug => $score) { |
|
| 64 | - if ($score > 1) { |
|
| 65 | - $plugins_interessants2[$plug] = $score - 1; |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - foreach ($plugin as $plug) { |
|
| 69 | - $plugins_interessants2[$plug] = 10; |
|
| 70 | - } // score initial |
|
| 71 | - ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
|
| 63 | + foreach ($plugins_interessants as $plug => $score) { |
|
| 64 | + if ($score > 1) { |
|
| 65 | + $plugins_interessants2[$plug] = $score - 1; |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + foreach ($plugin as $plug) { |
|
| 69 | + $plugins_interessants2[$plug] = 10; |
|
| 70 | + } // score initial |
|
| 71 | + ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | function action_activer_plugins_dist() { |
| 82 | 82 | |
| 83 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 84 | - $securiser_action(); |
|
| 83 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 84 | + $securiser_action(); |
|
| 85 | 85 | |
| 86 | - if (!autoriser('configurer', '_plugins')) { |
|
| 87 | - die('erreur'); |
|
| 88 | - } |
|
| 89 | - // forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin |
|
| 90 | - lire_metas(); |
|
| 91 | - enregistre_modif_plugin(); |
|
| 86 | + if (!autoriser('configurer', '_plugins')) { |
|
| 87 | + die('erreur'); |
|
| 88 | + } |
|
| 89 | + // forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin |
|
| 90 | + lire_metas(); |
|
| 91 | + enregistre_modif_plugin(); |
|
| 92 | 92 | } |