@@ -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 | /** |
@@ -39,54 +39,54 @@ discard block |
||
| 39 | 39 | * de l'action sécurisée. |
| 40 | 40 | */ |
| 41 | 41 | function action_purger_dist($arg = null) { |
| 42 | - if (is_null($arg)) { |
|
| 43 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 44 | - $arg = $securiser_action(); |
|
| 45 | - } |
|
| 42 | + if (is_null($arg)) { |
|
| 43 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 44 | + $arg = $securiser_action(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - include_spip('inc/invalideur'); |
|
| 47 | + include_spip('inc/invalideur'); |
|
| 48 | 48 | |
| 49 | - spip_log("purger $arg"); |
|
| 49 | + spip_log("purger $arg"); |
|
| 50 | 50 | |
| 51 | - switch ($arg) { |
|
| 52 | - case 'inhibe_cache': |
|
| 53 | - // inhiber le cache pendant 24h |
|
| 54 | - ecrire_meta('cache_inhib', $_SERVER['REQUEST_TIME'] + 24 * 3600); |
|
| 55 | - break; |
|
| 56 | - case 'reactive_cache': |
|
| 57 | - effacer_meta('cache_inhib'); |
|
| 58 | - break; |
|
| 51 | + switch ($arg) { |
|
| 52 | + case 'inhibe_cache': |
|
| 53 | + // inhiber le cache pendant 24h |
|
| 54 | + ecrire_meta('cache_inhib', $_SERVER['REQUEST_TIME'] + 24 * 3600); |
|
| 55 | + break; |
|
| 56 | + case 'reactive_cache': |
|
| 57 | + effacer_meta('cache_inhib'); |
|
| 58 | + break; |
|
| 59 | 59 | |
| 60 | - case 'cache': |
|
| 61 | - supprime_invalideurs(); |
|
| 62 | - @spip_unlink(_CACHE_RUBRIQUES); |
|
| 63 | - @spip_unlink(_CACHE_CHEMIN); |
|
| 64 | - @spip_unlink(_DIR_TMP . "plugin_xml_cache.gz"); |
|
| 65 | - // on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3 |
|
| 66 | - // _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT |
|
| 67 | - // pour eviter des problemes de concurence |
|
| 68 | - // cf http://core.spip.net/issues/2989 |
|
| 69 | - //@spip_unlink(_CACHE_PIPELINES); |
|
| 70 | - //@spip_unlink(_CACHE_PLUGINS_PATH); |
|
| 71 | - //@spip_unlink(_CACHE_PLUGINS_FCT); |
|
| 72 | - @spip_unlink(_CACHE_PLUGINS_OPT); |
|
| 73 | - purger_repertoire(_DIR_CACHE, array('subdir' => true)); |
|
| 74 | - purger_repertoire(_DIR_AIDE); |
|
| 75 | - purger_repertoire(_DIR_VAR . 'cache-css'); |
|
| 76 | - purger_repertoire(_DIR_VAR . 'cache-js'); |
|
| 77 | - break; |
|
| 60 | + case 'cache': |
|
| 61 | + supprime_invalideurs(); |
|
| 62 | + @spip_unlink(_CACHE_RUBRIQUES); |
|
| 63 | + @spip_unlink(_CACHE_CHEMIN); |
|
| 64 | + @spip_unlink(_DIR_TMP . "plugin_xml_cache.gz"); |
|
| 65 | + // on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3 |
|
| 66 | + // _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT |
|
| 67 | + // pour eviter des problemes de concurence |
|
| 68 | + // cf http://core.spip.net/issues/2989 |
|
| 69 | + //@spip_unlink(_CACHE_PIPELINES); |
|
| 70 | + //@spip_unlink(_CACHE_PLUGINS_PATH); |
|
| 71 | + //@spip_unlink(_CACHE_PLUGINS_FCT); |
|
| 72 | + @spip_unlink(_CACHE_PLUGINS_OPT); |
|
| 73 | + purger_repertoire(_DIR_CACHE, array('subdir' => true)); |
|
| 74 | + purger_repertoire(_DIR_AIDE); |
|
| 75 | + purger_repertoire(_DIR_VAR . 'cache-css'); |
|
| 76 | + purger_repertoire(_DIR_VAR . 'cache-js'); |
|
| 77 | + break; |
|
| 78 | 78 | |
| 79 | - case 'squelettes': |
|
| 80 | - purger_repertoire(_DIR_SKELS); |
|
| 81 | - break; |
|
| 79 | + case 'squelettes': |
|
| 80 | + purger_repertoire(_DIR_SKELS); |
|
| 81 | + break; |
|
| 82 | 82 | |
| 83 | - case 'vignettes': |
|
| 84 | - purger_repertoire(_DIR_VAR, array('subdir' => true)); |
|
| 85 | - supprime_invalideurs(); |
|
| 86 | - purger_repertoire(_DIR_CACHE, array('subdir' => true)); |
|
| 87 | - break; |
|
| 88 | - } |
|
| 83 | + case 'vignettes': |
|
| 84 | + purger_repertoire(_DIR_VAR, array('subdir' => true)); |
|
| 85 | + supprime_invalideurs(); |
|
| 86 | + purger_repertoire(_DIR_CACHE, array('subdir' => true)); |
|
| 87 | + break; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - // le faire savoir aux plugins |
|
| 91 | - pipeline('trig_purger', $arg); |
|
| 90 | + // le faire savoir aux plugins |
|
| 91 | + pipeline('trig_purger', $arg); |
|
| 92 | 92 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/actions'); |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | function action_etre_webmestre_dist() { |
| 32 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 33 | - $time = $securiser_action(); |
|
| 34 | - |
|
| 35 | - if (time() - $time < 15 * 60 |
|
| 36 | - and $GLOBALS['visiteur_session']['statut'] == '0minirezo' |
|
| 37 | - and $GLOBALS['visiteur_session']['webmestre'] !== 'oui' |
|
| 38 | - ) { |
|
| 39 | - $action = _T('info_admin_etre_webmestre'); |
|
| 40 | - $admin = charger_fonction('admin', 'inc'); |
|
| 41 | - // lance la verif par ftp et l'appel |
|
| 42 | - // a base_etre_webmestre_dist quand c'est OK |
|
| 43 | - if ($r = $admin('etre_webmestre', $action)) { |
|
| 44 | - echo $r; |
|
| 45 | - exit; |
|
| 46 | - } |
|
| 47 | - } |
|
| 32 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 33 | + $time = $securiser_action(); |
|
| 34 | + |
|
| 35 | + if (time() - $time < 15 * 60 |
|
| 36 | + and $GLOBALS['visiteur_session']['statut'] == '0minirezo' |
|
| 37 | + and $GLOBALS['visiteur_session']['webmestre'] !== 'oui' |
|
| 38 | + ) { |
|
| 39 | + $action = _T('info_admin_etre_webmestre'); |
|
| 40 | + $admin = charger_fonction('admin', 'inc'); |
|
| 41 | + // lance la verif par ftp et l'appel |
|
| 42 | + // a base_etre_webmestre_dist quand c'est OK |
|
| 43 | + if ($r = $admin('etre_webmestre', $action)) { |
|
| 44 | + echo $r; |
|
| 45 | + exit; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | 56 | function base_etre_webmestre_dist() { |
| 57 | - if ($GLOBALS['visiteur_session']['statut'] == '0minirezo' and $GLOBALS['visiteur_session']['webmestre'] !== 'oui') { |
|
| 58 | - include_spip('action/editer_auteur'); |
|
| 59 | - instituer_auteur($GLOBALS['visiteur_session']['id_auteur'], array('webmestre' => 'oui'), true); |
|
| 60 | - } |
|
| 57 | + if ($GLOBALS['visiteur_session']['statut'] == '0minirezo' and $GLOBALS['visiteur_session']['webmestre'] !== 'oui') { |
|
| 58 | + include_spip('action/editer_auteur'); |
|
| 59 | + instituer_auteur($GLOBALS['visiteur_session']['id_auteur'], array('webmestre' => 'oui'), true); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -37,43 +37,43 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function action_editer_auteur_dist($arg = null) { |
| 39 | 39 | |
| 40 | - if (is_null($arg)) { |
|
| 41 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | - $arg = $securiser_action(); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - // si id_auteur n'est pas un nombre, c'est une creation |
|
| 47 | - if (!$id_auteur = intval($arg)) { |
|
| 48 | - |
|
| 49 | - if (($id_auteur = auteur_inserer()) > 0) { |
|
| 50 | - |
|
| 51 | - # cf. GROS HACK |
|
| 52 | - # recuperer l'eventuel logo charge avant la creation |
|
| 53 | - # ils ont un id = 0-id_auteur de la session |
|
| 54 | - $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
|
| 55 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 56 | - foreach (array('on', 'off') as $type) { |
|
| 57 | - if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) { |
|
| 58 | - if ($logo = reset($logo)) { |
|
| 59 | - rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - // Enregistre l'envoi dans la BD |
|
| 67 | - $err = ""; |
|
| 68 | - if ($id_auteur > 0) { |
|
| 69 | - $err = auteur_modifier($id_auteur); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - if ($err) { |
|
| 73 | - spip_log("echec editeur auteur: $err", _LOG_ERREUR); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return array($id_auteur, $err); |
|
| 40 | + if (is_null($arg)) { |
|
| 41 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | + $arg = $securiser_action(); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + // si id_auteur n'est pas un nombre, c'est une creation |
|
| 47 | + if (!$id_auteur = intval($arg)) { |
|
| 48 | + |
|
| 49 | + if (($id_auteur = auteur_inserer()) > 0) { |
|
| 50 | + |
|
| 51 | + # cf. GROS HACK |
|
| 52 | + # recuperer l'eventuel logo charge avant la creation |
|
| 53 | + # ils ont un id = 0-id_auteur de la session |
|
| 54 | + $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
|
| 55 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 56 | + foreach (array('on', 'off') as $type) { |
|
| 57 | + if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) { |
|
| 58 | + if ($logo = reset($logo)) { |
|
| 59 | + rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + // Enregistre l'envoi dans la BD |
|
| 67 | + $err = ""; |
|
| 68 | + if ($id_auteur > 0) { |
|
| 69 | + $err = auteur_modifier($id_auteur); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + if ($err) { |
|
| 73 | + spip_log("echec editeur auteur: $err", _LOG_ERREUR); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return array($id_auteur, $err); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -90,39 +90,39 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function auteur_inserer($source = null, $set = null) { |
| 92 | 92 | |
| 93 | - // Ce qu'on va demander comme modifications |
|
| 94 | - $champs = array(); |
|
| 95 | - $champs['source'] = $source ? $source : 'spip'; |
|
| 96 | - |
|
| 97 | - $champs['login'] = ''; |
|
| 98 | - $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 99 | - $champs['webmestre'] = 'non'; |
|
| 100 | - |
|
| 101 | - if ($set) { |
|
| 102 | - $champs = array_merge($champs, $set); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - // Envoyer aux plugins |
|
| 106 | - $champs = pipeline('pre_insertion', |
|
| 107 | - array( |
|
| 108 | - 'args' => array( |
|
| 109 | - 'table' => 'spip_auteurs', |
|
| 110 | - ), |
|
| 111 | - 'data' => $champs |
|
| 112 | - ) |
|
| 113 | - ); |
|
| 114 | - $id_auteur = sql_insertq("spip_auteurs", $champs); |
|
| 115 | - pipeline('post_insertion', |
|
| 116 | - array( |
|
| 117 | - 'args' => array( |
|
| 118 | - 'table' => 'spip_auteurs', |
|
| 119 | - 'id_objet' => $id_auteur |
|
| 120 | - ), |
|
| 121 | - 'data' => $champs |
|
| 122 | - ) |
|
| 123 | - ); |
|
| 124 | - |
|
| 125 | - return $id_auteur; |
|
| 93 | + // Ce qu'on va demander comme modifications |
|
| 94 | + $champs = array(); |
|
| 95 | + $champs['source'] = $source ? $source : 'spip'; |
|
| 96 | + |
|
| 97 | + $champs['login'] = ''; |
|
| 98 | + $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 99 | + $champs['webmestre'] = 'non'; |
|
| 100 | + |
|
| 101 | + if ($set) { |
|
| 102 | + $champs = array_merge($champs, $set); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + // Envoyer aux plugins |
|
| 106 | + $champs = pipeline('pre_insertion', |
|
| 107 | + array( |
|
| 108 | + 'args' => array( |
|
| 109 | + 'table' => 'spip_auteurs', |
|
| 110 | + ), |
|
| 111 | + 'data' => $champs |
|
| 112 | + ) |
|
| 113 | + ); |
|
| 114 | + $id_auteur = sql_insertq("spip_auteurs", $champs); |
|
| 115 | + pipeline('post_insertion', |
|
| 116 | + array( |
|
| 117 | + 'args' => array( |
|
| 118 | + 'table' => 'spip_auteurs', |
|
| 119 | + 'id_objet' => $id_auteur |
|
| 120 | + ), |
|
| 121 | + 'data' => $champs |
|
| 122 | + ) |
|
| 123 | + ); |
|
| 124 | + |
|
| 125 | + return $id_auteur; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -147,66 +147,66 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function auteur_modifier($id_auteur, $set = null, $force_update = false) { |
| 149 | 149 | |
| 150 | - include_spip('inc/modifier'); |
|
| 151 | - include_spip('inc/filtres'); |
|
| 152 | - $c = collecter_requests( |
|
| 153 | - // white list |
|
| 154 | - objet_info('auteur', 'champs_editables'), |
|
| 155 | - // black list |
|
| 156 | - $force_update ? array() : array('webmestre', 'pass', 'login'), |
|
| 157 | - // donnees eventuellement fournies |
|
| 158 | - $set |
|
| 159 | - ); |
|
| 160 | - |
|
| 161 | - if ($err = objet_modifier_champs('auteur', $id_auteur, |
|
| 162 | - array( |
|
| 163 | - 'data' => $set, |
|
| 164 | - 'nonvide' => array('nom' => _T('ecrire:item_nouvel_auteur')) |
|
| 165 | - ), |
|
| 166 | - $c) |
|
| 167 | - ) { |
|
| 168 | - return $err; |
|
| 169 | - } |
|
| 170 | - $session = $c; |
|
| 171 | - |
|
| 172 | - $err = ''; |
|
| 173 | - if (!$force_update) { |
|
| 174 | - // Modification de statut, changement de rubrique ? |
|
| 175 | - $c = collecter_requests( |
|
| 176 | - // white list |
|
| 177 | - array( |
|
| 178 | - 'statut', |
|
| 179 | - 'new_login', |
|
| 180 | - 'new_pass', |
|
| 181 | - 'login', |
|
| 182 | - 'pass', |
|
| 183 | - 'webmestre', |
|
| 184 | - 'restreintes', |
|
| 185 | - 'id_parent' |
|
| 186 | - ), |
|
| 187 | - // black list |
|
| 188 | - array(), |
|
| 189 | - // donnees eventuellement fournies |
|
| 190 | - $set |
|
| 191 | - ); |
|
| 192 | - if (isset($c['new_login']) and !isset($c['login'])) { |
|
| 193 | - $c['login'] = $c['new_login']; |
|
| 194 | - } |
|
| 195 | - if (isset($c['new_pass']) and !isset($c['pass'])) { |
|
| 196 | - $c['pass'] = $c['new_pass']; |
|
| 197 | - } |
|
| 198 | - $err = auteur_instituer($id_auteur, $c); |
|
| 199 | - $session = array_merge($session, $c); |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - // .. mettre a jour les sessions de cet auteur |
|
| 203 | - include_spip('inc/session'); |
|
| 204 | - $session['id_auteur'] = $id_auteur; |
|
| 205 | - unset($session['new_login']); |
|
| 206 | - unset($session['new_pass']); |
|
| 207 | - actualiser_sessions($session); |
|
| 208 | - |
|
| 209 | - return $err; |
|
| 150 | + include_spip('inc/modifier'); |
|
| 151 | + include_spip('inc/filtres'); |
|
| 152 | + $c = collecter_requests( |
|
| 153 | + // white list |
|
| 154 | + objet_info('auteur', 'champs_editables'), |
|
| 155 | + // black list |
|
| 156 | + $force_update ? array() : array('webmestre', 'pass', 'login'), |
|
| 157 | + // donnees eventuellement fournies |
|
| 158 | + $set |
|
| 159 | + ); |
|
| 160 | + |
|
| 161 | + if ($err = objet_modifier_champs('auteur', $id_auteur, |
|
| 162 | + array( |
|
| 163 | + 'data' => $set, |
|
| 164 | + 'nonvide' => array('nom' => _T('ecrire:item_nouvel_auteur')) |
|
| 165 | + ), |
|
| 166 | + $c) |
|
| 167 | + ) { |
|
| 168 | + return $err; |
|
| 169 | + } |
|
| 170 | + $session = $c; |
|
| 171 | + |
|
| 172 | + $err = ''; |
|
| 173 | + if (!$force_update) { |
|
| 174 | + // Modification de statut, changement de rubrique ? |
|
| 175 | + $c = collecter_requests( |
|
| 176 | + // white list |
|
| 177 | + array( |
|
| 178 | + 'statut', |
|
| 179 | + 'new_login', |
|
| 180 | + 'new_pass', |
|
| 181 | + 'login', |
|
| 182 | + 'pass', |
|
| 183 | + 'webmestre', |
|
| 184 | + 'restreintes', |
|
| 185 | + 'id_parent' |
|
| 186 | + ), |
|
| 187 | + // black list |
|
| 188 | + array(), |
|
| 189 | + // donnees eventuellement fournies |
|
| 190 | + $set |
|
| 191 | + ); |
|
| 192 | + if (isset($c['new_login']) and !isset($c['login'])) { |
|
| 193 | + $c['login'] = $c['new_login']; |
|
| 194 | + } |
|
| 195 | + if (isset($c['new_pass']) and !isset($c['pass'])) { |
|
| 196 | + $c['pass'] = $c['new_pass']; |
|
| 197 | + } |
|
| 198 | + $err = auteur_instituer($id_auteur, $c); |
|
| 199 | + $session = array_merge($session, $c); |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + // .. mettre a jour les sessions de cet auteur |
|
| 203 | + include_spip('inc/session'); |
|
| 204 | + $session['id_auteur'] = $id_auteur; |
|
| 205 | + unset($session['new_login']); |
|
| 206 | + unset($session['new_pass']); |
|
| 207 | + actualiser_sessions($session); |
|
| 208 | + |
|
| 209 | + return $err; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | * @return string |
| 228 | 228 | */ |
| 229 | 229 | function auteur_associer($id_auteur, $objets, $qualif = null) { |
| 230 | - include_spip('action/editer_liens'); |
|
| 230 | + include_spip('action/editer_liens'); |
|
| 231 | 231 | |
| 232 | - return objet_associer(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 232 | + return objet_associer(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @return string |
| 245 | 245 | */ |
| 246 | 246 | function auteur_referent($id_auteur, $c) { |
| 247 | - return auteur_associer($id_auteur, $c); |
|
| 247 | + return auteur_associer($id_auteur, $c); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | * @return string |
| 264 | 264 | */ |
| 265 | 265 | function auteur_dissocier($id_auteur, $objets) { |
| 266 | - include_spip('action/editer_liens'); |
|
| 266 | + include_spip('action/editer_liens'); |
|
| 267 | 267 | |
| 268 | - return objet_dissocier(array('auteur' => $id_auteur), $objets); |
|
| 268 | + return objet_dissocier(array('auteur' => $id_auteur), $objets); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | * @return bool|int |
| 287 | 287 | */ |
| 288 | 288 | function auteur_qualifier($id_auteur, $objets, $qualif) { |
| 289 | - include_spip('action/editer_liens'); |
|
| 289 | + include_spip('action/editer_liens'); |
|
| 290 | 290 | |
| 291 | - return objet_qualifier_liens(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 291 | + return objet_qualifier_liens(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
@@ -307,133 +307,133 @@ discard block |
||
| 307 | 307 | * @return bool|string |
| 308 | 308 | */ |
| 309 | 309 | function auteur_instituer($id_auteur, $c, $force_webmestre = false) { |
| 310 | - if (!$id_auteur = intval($id_auteur)) { |
|
| 311 | - return false; |
|
| 312 | - } |
|
| 313 | - $erreurs = array(); // contiendra les differentes erreurs a traduire par _T() |
|
| 314 | - $champs = array(); |
|
| 315 | - |
|
| 316 | - // les memoriser pour les faire passer dans le pipeline pre_edition |
|
| 317 | - if (isset($c['login']) and strlen($c['login'])) { |
|
| 318 | - $champs['login'] = $c['login']; |
|
| 319 | - } |
|
| 320 | - if (isset($c['pass']) and strlen($c['pass'])) { |
|
| 321 | - $champs['pass'] = $c['pass']; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 325 | - |
|
| 326 | - if (isset($c['statut']) |
|
| 327 | - and (autoriser('modifier', 'auteur', $id_auteur, null, array('statut' => $c['statut']))) |
|
| 328 | - ) { |
|
| 329 | - $statut = $champs['statut'] = $c['statut']; |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - // Restreindre avant de declarer l'auteur |
|
| 333 | - // (section critique sur les droits) |
|
| 334 | - if (isset($c['id_parent']) and $c['id_parent']) { |
|
| 335 | - if (is_array($c['restreintes'])) { |
|
| 336 | - $c['restreintes'][] = $c['id_parent']; |
|
| 337 | - } else { |
|
| 338 | - $c['restreintes'] = array($c['id_parent']); |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - if (isset($c['webmestre']) |
|
| 343 | - and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, array('webmestre' => '?'))) |
|
| 344 | - ) { |
|
| 345 | - $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non'; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - // si statut change et n'est pas 0minirezo, on force webmestre a non |
|
| 349 | - if (isset($c['statut']) and $c['statut'] !== '0minirezo') { |
|
| 350 | - $champs['webmestre'] = $c['webmestre'] = 'non'; |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - // Envoyer aux plugins |
|
| 354 | - $champs = pipeline('pre_edition', |
|
| 355 | - array( |
|
| 356 | - 'args' => array( |
|
| 357 | - 'table' => 'spip_auteurs', |
|
| 358 | - 'id_objet' => $id_auteur, |
|
| 359 | - 'action' => 'instituer', |
|
| 360 | - 'statut_ancien' => $statut_ancien, |
|
| 361 | - ), |
|
| 362 | - 'data' => $champs |
|
| 363 | - ) |
|
| 364 | - ); |
|
| 365 | - |
|
| 366 | - if (isset($c['restreintes']) and is_array($c['restreintes']) |
|
| 367 | - and autoriser('modifier', 'auteur', $id_auteur, null, array('restreint' => $c['restreintes'])) |
|
| 368 | - ) { |
|
| 369 | - $rubriques = array_map('intval', $c['restreintes']); |
|
| 370 | - $rubriques = array_unique($rubriques); |
|
| 371 | - $rubriques = array_diff($rubriques, array(0)); |
|
| 372 | - auteur_dissocier($id_auteur, array('rubrique' => '*')); |
|
| 373 | - auteur_associer($id_auteur, array('rubrique' => $rubriques)); |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - $flag_ecrire_acces = false; |
|
| 377 | - // commencer par traiter les cas particuliers des logins et pass |
|
| 378 | - // avant les autres ecritures en base |
|
| 379 | - if (isset($champs['login']) or isset($champs['pass'])) { |
|
| 380 | - $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 381 | - include_spip('inc/auth'); |
|
| 382 | - if (isset($champs['login']) and strlen($champs['login'])) { |
|
| 383 | - if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
|
| 384 | - $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
|
| 385 | - } |
|
| 386 | - } |
|
| 387 | - if (isset($champs['pass']) and strlen($champs['pass'])) { |
|
| 388 | - $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 389 | - if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 390 | - $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 391 | - } |
|
| 392 | - } |
|
| 393 | - unset($champs['login']); |
|
| 394 | - unset($champs['pass']); |
|
| 395 | - $flag_ecrire_acces = true; |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - if (!count($champs)) { |
|
| 399 | - return implode(' ', array_map('_T', $erreurs)); |
|
| 400 | - } |
|
| 401 | - sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 402 | - |
|
| 403 | - // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
|
| 404 | - if ($flag_ecrire_acces |
|
| 405 | - or isset($champs['statut']) |
|
| 406 | - ) { |
|
| 407 | - include_spip('inc/acces'); |
|
| 408 | - ecrire_acces(); |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - // Invalider les caches |
|
| 412 | - include_spip('inc/invalideur'); |
|
| 413 | - suivre_invalideur("id='auteur/$id_auteur'"); |
|
| 414 | - |
|
| 415 | - // Pipeline |
|
| 416 | - pipeline('post_edition', |
|
| 417 | - array( |
|
| 418 | - 'args' => array( |
|
| 419 | - 'table' => 'spip_auteurs', |
|
| 420 | - 'id_objet' => $id_auteur, |
|
| 421 | - 'action' => 'instituer', |
|
| 422 | - 'statut_ancien' => $statut_ancien, |
|
| 423 | - ), |
|
| 424 | - 'data' => $champs |
|
| 425 | - ) |
|
| 426 | - ); |
|
| 427 | - |
|
| 428 | - |
|
| 429 | - // Notifications |
|
| 430 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 431 | - $notifications('instituerauteur', $id_auteur, |
|
| 432 | - array('statut' => $statut, 'statut_ancien' => $statut_ancien) |
|
| 433 | - ); |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - return implode(' ', array_map('_T', $erreurs)); |
|
| 310 | + if (!$id_auteur = intval($id_auteur)) { |
|
| 311 | + return false; |
|
| 312 | + } |
|
| 313 | + $erreurs = array(); // contiendra les differentes erreurs a traduire par _T() |
|
| 314 | + $champs = array(); |
|
| 315 | + |
|
| 316 | + // les memoriser pour les faire passer dans le pipeline pre_edition |
|
| 317 | + if (isset($c['login']) and strlen($c['login'])) { |
|
| 318 | + $champs['login'] = $c['login']; |
|
| 319 | + } |
|
| 320 | + if (isset($c['pass']) and strlen($c['pass'])) { |
|
| 321 | + $champs['pass'] = $c['pass']; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 325 | + |
|
| 326 | + if (isset($c['statut']) |
|
| 327 | + and (autoriser('modifier', 'auteur', $id_auteur, null, array('statut' => $c['statut']))) |
|
| 328 | + ) { |
|
| 329 | + $statut = $champs['statut'] = $c['statut']; |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + // Restreindre avant de declarer l'auteur |
|
| 333 | + // (section critique sur les droits) |
|
| 334 | + if (isset($c['id_parent']) and $c['id_parent']) { |
|
| 335 | + if (is_array($c['restreintes'])) { |
|
| 336 | + $c['restreintes'][] = $c['id_parent']; |
|
| 337 | + } else { |
|
| 338 | + $c['restreintes'] = array($c['id_parent']); |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + if (isset($c['webmestre']) |
|
| 343 | + and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, array('webmestre' => '?'))) |
|
| 344 | + ) { |
|
| 345 | + $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non'; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + // si statut change et n'est pas 0minirezo, on force webmestre a non |
|
| 349 | + if (isset($c['statut']) and $c['statut'] !== '0minirezo') { |
|
| 350 | + $champs['webmestre'] = $c['webmestre'] = 'non'; |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + // Envoyer aux plugins |
|
| 354 | + $champs = pipeline('pre_edition', |
|
| 355 | + array( |
|
| 356 | + 'args' => array( |
|
| 357 | + 'table' => 'spip_auteurs', |
|
| 358 | + 'id_objet' => $id_auteur, |
|
| 359 | + 'action' => 'instituer', |
|
| 360 | + 'statut_ancien' => $statut_ancien, |
|
| 361 | + ), |
|
| 362 | + 'data' => $champs |
|
| 363 | + ) |
|
| 364 | + ); |
|
| 365 | + |
|
| 366 | + if (isset($c['restreintes']) and is_array($c['restreintes']) |
|
| 367 | + and autoriser('modifier', 'auteur', $id_auteur, null, array('restreint' => $c['restreintes'])) |
|
| 368 | + ) { |
|
| 369 | + $rubriques = array_map('intval', $c['restreintes']); |
|
| 370 | + $rubriques = array_unique($rubriques); |
|
| 371 | + $rubriques = array_diff($rubriques, array(0)); |
|
| 372 | + auteur_dissocier($id_auteur, array('rubrique' => '*')); |
|
| 373 | + auteur_associer($id_auteur, array('rubrique' => $rubriques)); |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + $flag_ecrire_acces = false; |
|
| 377 | + // commencer par traiter les cas particuliers des logins et pass |
|
| 378 | + // avant les autres ecritures en base |
|
| 379 | + if (isset($champs['login']) or isset($champs['pass'])) { |
|
| 380 | + $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 381 | + include_spip('inc/auth'); |
|
| 382 | + if (isset($champs['login']) and strlen($champs['login'])) { |
|
| 383 | + if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
|
| 384 | + $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | + if (isset($champs['pass']) and strlen($champs['pass'])) { |
|
| 388 | + $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 389 | + if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 390 | + $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 391 | + } |
|
| 392 | + } |
|
| 393 | + unset($champs['login']); |
|
| 394 | + unset($champs['pass']); |
|
| 395 | + $flag_ecrire_acces = true; |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + if (!count($champs)) { |
|
| 399 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 400 | + } |
|
| 401 | + sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 402 | + |
|
| 403 | + // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
|
| 404 | + if ($flag_ecrire_acces |
|
| 405 | + or isset($champs['statut']) |
|
| 406 | + ) { |
|
| 407 | + include_spip('inc/acces'); |
|
| 408 | + ecrire_acces(); |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + // Invalider les caches |
|
| 412 | + include_spip('inc/invalideur'); |
|
| 413 | + suivre_invalideur("id='auteur/$id_auteur'"); |
|
| 414 | + |
|
| 415 | + // Pipeline |
|
| 416 | + pipeline('post_edition', |
|
| 417 | + array( |
|
| 418 | + 'args' => array( |
|
| 419 | + 'table' => 'spip_auteurs', |
|
| 420 | + 'id_objet' => $id_auteur, |
|
| 421 | + 'action' => 'instituer', |
|
| 422 | + 'statut_ancien' => $statut_ancien, |
|
| 423 | + ), |
|
| 424 | + 'data' => $champs |
|
| 425 | + ) |
|
| 426 | + ); |
|
| 427 | + |
|
| 428 | + |
|
| 429 | + // Notifications |
|
| 430 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 431 | + $notifications('instituerauteur', $id_auteur, |
|
| 432 | + array('statut' => $statut, 'statut_ancien' => $statut_ancien) |
|
| 433 | + ); |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 437 | 437 | |
| 438 | 438 | } |
| 439 | 439 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * @return int |
| 453 | 453 | */ |
| 454 | 454 | function insert_auteur($source = null) { |
| 455 | - return auteur_inserer($source); |
|
| 455 | + return auteur_inserer($source); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @return string|null |
| 467 | 467 | */ |
| 468 | 468 | function auteurs_set($id_auteur, $set = null) { |
| 469 | - return auteur_modifier($id_auteur, $set); |
|
| 469 | + return auteur_modifier($id_auteur, $set); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | * @return bool|string |
| 482 | 482 | */ |
| 483 | 483 | function instituer_auteur($id_auteur, $c, $force_webmestre = false) { |
| 484 | - return auteur_instituer($id_auteur, $c, $force_webmestre); |
|
| 484 | + return auteur_instituer($id_auteur, $c, $force_webmestre); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | /** |
@@ -495,5 +495,5 @@ discard block |
||
| 495 | 495 | * @return string|null |
| 496 | 496 | */ |
| 497 | 497 | function revision_auteur($id_auteur, $c = false) { |
| 498 | - return auteur_modifier($id_auteur, $c); |
|
| 498 | + return auteur_modifier($id_auteur, $c); |
|
| 499 | 499 | } |
@@ -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 | |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | * `on` ou `off` |
| 31 | 31 | */ |
| 32 | 32 | function logo_supprimer($objet, $id_objet, $etat) { |
| 33 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 34 | - $objet = objet_type($objet); |
|
| 35 | - $primary = id_table_objet($objet); |
|
| 36 | - include_spip('inc/chercher_logo'); |
|
| 37 | - |
|
| 38 | - // existe-t-il deja un logo ? |
|
| 39 | - $logo = $chercher_logo($id_objet, $primary, $etat); |
|
| 40 | - if ($logo) { |
|
| 41 | - spip_unlink($logo[0]); |
|
| 42 | - } |
|
| 33 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 34 | + $objet = objet_type($objet); |
|
| 35 | + $primary = id_table_objet($objet); |
|
| 36 | + include_spip('inc/chercher_logo'); |
|
| 37 | + |
|
| 38 | + // existe-t-il deja un logo ? |
|
| 39 | + $logo = $chercher_logo($id_objet, $primary, $etat); |
|
| 40 | + if ($logo) { |
|
| 41 | + spip_unlink($logo[0]); |
|
| 42 | + } |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -56,132 +56,132 @@ discard block |
||
| 56 | 56 | * Erreur, sinon '' |
| 57 | 57 | */ |
| 58 | 58 | function logo_modifier($objet, $id_objet, $etat, $source) { |
| 59 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 60 | - $objet = objet_type($objet); |
|
| 61 | - $primary = id_table_objet($objet); |
|
| 62 | - include_spip('inc/chercher_logo'); |
|
| 63 | - $type = type_du_logo($primary); |
|
| 64 | - |
|
| 65 | - // nom du logo |
|
| 66 | - $nom = $type . $etat . $id_objet; |
|
| 67 | - |
|
| 68 | - // supprimer le logo eventueel existant |
|
| 69 | - logo_supprimer($objet, $id_objet, $etat); |
|
| 70 | - |
|
| 71 | - include_spip('inc/documents'); |
|
| 72 | - $erreur = ''; |
|
| 73 | - |
|
| 74 | - if (!$source) { |
|
| 75 | - spip_log('spip_image_ajouter : source inconnue'); |
|
| 76 | - $erreur = 'source inconnue'; |
|
| 77 | - |
|
| 78 | - return $erreur; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $file_tmp = _DIR_LOGOS . $nom . '.tmp'; |
|
| 82 | - |
|
| 83 | - $ok = false; |
|
| 84 | - // fichier dans upload/ |
|
| 85 | - if (is_string($source)) { |
|
| 86 | - if (file_exists($source)) { |
|
| 87 | - $ok = @copy($source, $file_tmp); |
|
| 88 | - } elseif (file_exists($f = determine_upload() . $source)) { |
|
| 89 | - $ok = @copy($f, $file_tmp); |
|
| 90 | - } |
|
| 91 | - } elseif (!$erreur = check_upload_error($source['error'], '', true)) { |
|
| 92 | - // Intercepter une erreur a l'envoi |
|
| 93 | - // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 94 | - // fichier envoye par le browser : pour les Macs c'est plus sur) |
|
| 95 | - $ok = deplacer_fichier_upload($source['tmp_name'], $file_tmp); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - if ($erreur) { |
|
| 99 | - return $erreur; |
|
| 100 | - } |
|
| 101 | - if (!$ok or !file_exists($file_tmp)) { |
|
| 102 | - spip_log($erreur = "probleme de copie pour $file_tmp "); |
|
| 103 | - |
|
| 104 | - return $erreur; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $size = @getimagesize($file_tmp); |
|
| 108 | - $extension = !$size ? '' : ($size[2] > 3 ? '' : $GLOBALS['formats_logos'][$size[2] - 1]); |
|
| 109 | - if ($extension) { |
|
| 110 | - @rename($file_tmp, $file_tmp . ".$extension"); |
|
| 111 | - $file_tmp = $file_tmp . ".$extension"; |
|
| 112 | - $poids = filesize($file_tmp); |
|
| 113 | - |
|
| 114 | - if (defined('_LOGO_MAX_WIDTH') or defined('_LOGO_MAX_HEIGHT')) { |
|
| 115 | - if ((defined('_LOGO_MAX_WIDTH') and _LOGO_MAX_WIDTH and $size[0] > _LOGO_MAX_WIDTH) |
|
| 116 | - or (defined('_LOGO_MAX_HEIGHT') and _LOGO_MAX_HEIGHT and $size[1] > _LOGO_MAX_HEIGHT) |
|
| 117 | - ) { |
|
| 118 | - $max_width = (defined('_LOGO_MAX_WIDTH') and _LOGO_MAX_WIDTH) ? _LOGO_MAX_WIDTH : '*'; |
|
| 119 | - $max_height = (defined('_LOGO_MAX_HEIGHT') and _LOGO_MAX_HEIGHT) ? _LOGO_MAX_HEIGHT : '*'; |
|
| 120 | - |
|
| 121 | - // pas la peine d'embeter le redacteur avec ca si on a active le calcul des miniatures |
|
| 122 | - // on met directement a la taille maxi a la volee |
|
| 123 | - if (isset($GLOBALS['meta']['creer_preview']) and $GLOBALS['meta']['creer_preview'] == 'oui') { |
|
| 124 | - include_spip('inc/filtres'); |
|
| 125 | - $img = filtrer('image_reduire', $file_tmp, $max_width, $max_height); |
|
| 126 | - $img = extraire_attribut($img, 'src'); |
|
| 127 | - $img = supprimer_timestamp($img); |
|
| 128 | - if (@file_exists($img) and $img !== $file_tmp) { |
|
| 129 | - spip_unlink($file_tmp); |
|
| 130 | - @rename($img, $file_tmp); |
|
| 131 | - $size = @getimagesize($file_tmp); |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - // verifier au cas ou image_reduire a echoue |
|
| 135 | - if ((defined('_LOGO_MAX_WIDTH') and _LOGO_MAX_WIDTH and $size[0] > _LOGO_MAX_WIDTH) |
|
| 136 | - or (defined('_LOGO_MAX_HEIGHT') and _LOGO_MAX_HEIGHT and $size[1] > _LOGO_MAX_HEIGHT) |
|
| 137 | - ) { |
|
| 138 | - spip_unlink($file_tmp); |
|
| 139 | - $erreur = _T( |
|
| 140 | - 'info_logo_max_poids', |
|
| 141 | - array( |
|
| 142 | - 'maxi' => |
|
| 143 | - _T( |
|
| 144 | - 'info_largeur_vignette', |
|
| 145 | - array( |
|
| 146 | - 'largeur_vignette' => $max_width, |
|
| 147 | - 'hauteur_vignette' => $max_height |
|
| 148 | - ) |
|
| 149 | - ), |
|
| 150 | - 'actuel' => |
|
| 151 | - _T( |
|
| 152 | - 'info_largeur_vignette', |
|
| 153 | - array( |
|
| 154 | - 'largeur_vignette' => $size[0], |
|
| 155 | - 'hauteur_vignette' => $size[1] |
|
| 156 | - ) |
|
| 157 | - ) |
|
| 158 | - ) |
|
| 159 | - ); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - if (!$erreur and defined('_LOGO_MAX_SIZE') and _LOGO_MAX_SIZE and $poids > _LOGO_MAX_SIZE * 1024) { |
|
| 165 | - spip_unlink($file_tmp); |
|
| 166 | - $erreur = _T( |
|
| 167 | - 'info_logo_max_poids', |
|
| 168 | - array( |
|
| 169 | - 'maxi' => taille_en_octets(_LOGO_MAX_SIZE * 1024), |
|
| 170 | - 'actuel' => taille_en_octets($poids) |
|
| 171 | - ) |
|
| 172 | - ); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - if (!$erreur) { |
|
| 176 | - @rename($file_tmp, _DIR_LOGOS . $nom . ".$extension"); |
|
| 177 | - } |
|
| 178 | - } else { |
|
| 179 | - spip_unlink($file_tmp); |
|
| 180 | - $erreur = _T( |
|
| 181 | - 'info_logo_format_interdit', |
|
| 182 | - array('formats' => join(', ', $GLOBALS['formats_logos'])) |
|
| 183 | - ); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - return $erreur; |
|
| 59 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 60 | + $objet = objet_type($objet); |
|
| 61 | + $primary = id_table_objet($objet); |
|
| 62 | + include_spip('inc/chercher_logo'); |
|
| 63 | + $type = type_du_logo($primary); |
|
| 64 | + |
|
| 65 | + // nom du logo |
|
| 66 | + $nom = $type . $etat . $id_objet; |
|
| 67 | + |
|
| 68 | + // supprimer le logo eventueel existant |
|
| 69 | + logo_supprimer($objet, $id_objet, $etat); |
|
| 70 | + |
|
| 71 | + include_spip('inc/documents'); |
|
| 72 | + $erreur = ''; |
|
| 73 | + |
|
| 74 | + if (!$source) { |
|
| 75 | + spip_log('spip_image_ajouter : source inconnue'); |
|
| 76 | + $erreur = 'source inconnue'; |
|
| 77 | + |
|
| 78 | + return $erreur; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $file_tmp = _DIR_LOGOS . $nom . '.tmp'; |
|
| 82 | + |
|
| 83 | + $ok = false; |
|
| 84 | + // fichier dans upload/ |
|
| 85 | + if (is_string($source)) { |
|
| 86 | + if (file_exists($source)) { |
|
| 87 | + $ok = @copy($source, $file_tmp); |
|
| 88 | + } elseif (file_exists($f = determine_upload() . $source)) { |
|
| 89 | + $ok = @copy($f, $file_tmp); |
|
| 90 | + } |
|
| 91 | + } elseif (!$erreur = check_upload_error($source['error'], '', true)) { |
|
| 92 | + // Intercepter une erreur a l'envoi |
|
| 93 | + // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 94 | + // fichier envoye par le browser : pour les Macs c'est plus sur) |
|
| 95 | + $ok = deplacer_fichier_upload($source['tmp_name'], $file_tmp); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + if ($erreur) { |
|
| 99 | + return $erreur; |
|
| 100 | + } |
|
| 101 | + if (!$ok or !file_exists($file_tmp)) { |
|
| 102 | + spip_log($erreur = "probleme de copie pour $file_tmp "); |
|
| 103 | + |
|
| 104 | + return $erreur; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $size = @getimagesize($file_tmp); |
|
| 108 | + $extension = !$size ? '' : ($size[2] > 3 ? '' : $GLOBALS['formats_logos'][$size[2] - 1]); |
|
| 109 | + if ($extension) { |
|
| 110 | + @rename($file_tmp, $file_tmp . ".$extension"); |
|
| 111 | + $file_tmp = $file_tmp . ".$extension"; |
|
| 112 | + $poids = filesize($file_tmp); |
|
| 113 | + |
|
| 114 | + if (defined('_LOGO_MAX_WIDTH') or defined('_LOGO_MAX_HEIGHT')) { |
|
| 115 | + if ((defined('_LOGO_MAX_WIDTH') and _LOGO_MAX_WIDTH and $size[0] > _LOGO_MAX_WIDTH) |
|
| 116 | + or (defined('_LOGO_MAX_HEIGHT') and _LOGO_MAX_HEIGHT and $size[1] > _LOGO_MAX_HEIGHT) |
|
| 117 | + ) { |
|
| 118 | + $max_width = (defined('_LOGO_MAX_WIDTH') and _LOGO_MAX_WIDTH) ? _LOGO_MAX_WIDTH : '*'; |
|
| 119 | + $max_height = (defined('_LOGO_MAX_HEIGHT') and _LOGO_MAX_HEIGHT) ? _LOGO_MAX_HEIGHT : '*'; |
|
| 120 | + |
|
| 121 | + // pas la peine d'embeter le redacteur avec ca si on a active le calcul des miniatures |
|
| 122 | + // on met directement a la taille maxi a la volee |
|
| 123 | + if (isset($GLOBALS['meta']['creer_preview']) and $GLOBALS['meta']['creer_preview'] == 'oui') { |
|
| 124 | + include_spip('inc/filtres'); |
|
| 125 | + $img = filtrer('image_reduire', $file_tmp, $max_width, $max_height); |
|
| 126 | + $img = extraire_attribut($img, 'src'); |
|
| 127 | + $img = supprimer_timestamp($img); |
|
| 128 | + if (@file_exists($img) and $img !== $file_tmp) { |
|
| 129 | + spip_unlink($file_tmp); |
|
| 130 | + @rename($img, $file_tmp); |
|
| 131 | + $size = @getimagesize($file_tmp); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + // verifier au cas ou image_reduire a echoue |
|
| 135 | + if ((defined('_LOGO_MAX_WIDTH') and _LOGO_MAX_WIDTH and $size[0] > _LOGO_MAX_WIDTH) |
|
| 136 | + or (defined('_LOGO_MAX_HEIGHT') and _LOGO_MAX_HEIGHT and $size[1] > _LOGO_MAX_HEIGHT) |
|
| 137 | + ) { |
|
| 138 | + spip_unlink($file_tmp); |
|
| 139 | + $erreur = _T( |
|
| 140 | + 'info_logo_max_poids', |
|
| 141 | + array( |
|
| 142 | + 'maxi' => |
|
| 143 | + _T( |
|
| 144 | + 'info_largeur_vignette', |
|
| 145 | + array( |
|
| 146 | + 'largeur_vignette' => $max_width, |
|
| 147 | + 'hauteur_vignette' => $max_height |
|
| 148 | + ) |
|
| 149 | + ), |
|
| 150 | + 'actuel' => |
|
| 151 | + _T( |
|
| 152 | + 'info_largeur_vignette', |
|
| 153 | + array( |
|
| 154 | + 'largeur_vignette' => $size[0], |
|
| 155 | + 'hauteur_vignette' => $size[1] |
|
| 156 | + ) |
|
| 157 | + ) |
|
| 158 | + ) |
|
| 159 | + ); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + if (!$erreur and defined('_LOGO_MAX_SIZE') and _LOGO_MAX_SIZE and $poids > _LOGO_MAX_SIZE * 1024) { |
|
| 165 | + spip_unlink($file_tmp); |
|
| 166 | + $erreur = _T( |
|
| 167 | + 'info_logo_max_poids', |
|
| 168 | + array( |
|
| 169 | + 'maxi' => taille_en_octets(_LOGO_MAX_SIZE * 1024), |
|
| 170 | + 'actuel' => taille_en_octets($poids) |
|
| 171 | + ) |
|
| 172 | + ); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + if (!$erreur) { |
|
| 176 | + @rename($file_tmp, _DIR_LOGOS . $nom . ".$extension"); |
|
| 177 | + } |
|
| 178 | + } else { |
|
| 179 | + spip_unlink($file_tmp); |
|
| 180 | + $erreur = _T( |
|
| 181 | + 'info_logo_format_interdit', |
|
| 182 | + array('formats' => join(', ', $GLOBALS['formats_logos'])) |
|
| 183 | + ); |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + return $erreur; |
|
| 187 | 187 | } |
@@ -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 | } |
@@ -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 | /** |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | function action_ajouter_lien_dist($arg = null) { |
| 37 | - if (is_null($arg)) { |
|
| 38 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | - $arg = $securiser_action(); |
|
| 40 | - } |
|
| 37 | + if (is_null($arg)) { |
|
| 38 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | + $arg = $securiser_action(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $arg = explode("-", $arg); |
|
| 43 | - list($objet_source, $ids, $objet_lie, $idl) = $arg; |
|
| 42 | + $arg = explode("-", $arg); |
|
| 43 | + list($objet_source, $ids, $objet_lie, $idl) = $arg; |
|
| 44 | 44 | |
| 45 | - include_spip('action/editer_liens'); |
|
| 46 | - objet_associer(array($objet_source => $ids), array($objet_lie => $idl)); |
|
| 45 | + include_spip('action/editer_liens'); |
|
| 46 | + objet_associer(array($objet_source => $ids), array($objet_lie => $idl)); |
|
| 47 | 47 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Rubriques\Edition |
| 17 | 17 | */ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/rubriques'); |
@@ -38,31 +38,31 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | function action_editer_rubrique_dist($arg = null) { |
| 40 | 40 | |
| 41 | - if (is_null($arg)) { |
|
| 42 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 43 | - $arg = $securiser_action(); |
|
| 44 | - } |
|
| 41 | + if (is_null($arg)) { |
|
| 42 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 43 | + $arg = $securiser_action(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - if (!$id_rubrique = intval($arg)) { |
|
| 47 | - if ($arg != 'oui') { |
|
| 48 | - include_spip('inc/headers'); |
|
| 49 | - redirige_url_ecrire(); |
|
| 50 | - } |
|
| 51 | - $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 52 | - } |
|
| 46 | + if (!$id_rubrique = intval($arg)) { |
|
| 47 | + if ($arg != 'oui') { |
|
| 48 | + include_spip('inc/headers'); |
|
| 49 | + redirige_url_ecrire(); |
|
| 50 | + } |
|
| 51 | + $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - $err = rubrique_modifier($id_rubrique); |
|
| 54 | + $err = rubrique_modifier($id_rubrique); |
|
| 55 | 55 | |
| 56 | - if (_request('redirect')) { |
|
| 57 | - $redirect = parametre_url( |
|
| 58 | - urldecode(_request('redirect')), |
|
| 59 | - 'id_rubrique', $id_rubrique, '&'); |
|
| 56 | + if (_request('redirect')) { |
|
| 57 | + $redirect = parametre_url( |
|
| 58 | + urldecode(_request('redirect')), |
|
| 59 | + 'id_rubrique', $id_rubrique, '&'); |
|
| 60 | 60 | |
| 61 | - include_spip('inc/headers'); |
|
| 62 | - redirige_par_entete($redirect); |
|
| 63 | - } |
|
| 61 | + include_spip('inc/headers'); |
|
| 62 | + redirige_par_entete($redirect); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - return array($id_rubrique, $err); |
|
| 65 | + return array($id_rubrique, $err); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -77,40 +77,40 @@ discard block |
||
| 77 | 77 | * Identifiant de la rubrique crée |
| 78 | 78 | */ |
| 79 | 79 | function rubrique_inserer($id_parent, $set = null) { |
| 80 | - $champs = array( |
|
| 81 | - 'titre' => _T('item_nouvelle_rubrique'), |
|
| 82 | - 'id_parent' => intval($id_parent), |
|
| 83 | - 'statut' => 'prepa' |
|
| 84 | - ); |
|
| 85 | - |
|
| 86 | - if ($set) { |
|
| 87 | - $champs = array_merge($champs, $set); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // Envoyer aux plugins |
|
| 91 | - $champs = pipeline('pre_insertion', |
|
| 92 | - array( |
|
| 93 | - 'args' => array( |
|
| 94 | - 'table' => 'spip_rubriques', |
|
| 95 | - ), |
|
| 96 | - 'data' => $champs |
|
| 97 | - ) |
|
| 98 | - ); |
|
| 99 | - |
|
| 100 | - $id_rubrique = sql_insertq("spip_rubriques", $champs); |
|
| 101 | - pipeline('post_insertion', |
|
| 102 | - array( |
|
| 103 | - 'args' => array( |
|
| 104 | - 'table' => 'spip_rubriques', |
|
| 105 | - 'id_objet' => $id_rubrique |
|
| 106 | - ), |
|
| 107 | - 'data' => $champs |
|
| 108 | - ) |
|
| 109 | - ); |
|
| 110 | - propager_les_secteurs(); |
|
| 111 | - calculer_langues_rubriques(); |
|
| 112 | - |
|
| 113 | - return $id_rubrique; |
|
| 80 | + $champs = array( |
|
| 81 | + 'titre' => _T('item_nouvelle_rubrique'), |
|
| 82 | + 'id_parent' => intval($id_parent), |
|
| 83 | + 'statut' => 'prepa' |
|
| 84 | + ); |
|
| 85 | + |
|
| 86 | + if ($set) { |
|
| 87 | + $champs = array_merge($champs, $set); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // Envoyer aux plugins |
|
| 91 | + $champs = pipeline('pre_insertion', |
|
| 92 | + array( |
|
| 93 | + 'args' => array( |
|
| 94 | + 'table' => 'spip_rubriques', |
|
| 95 | + ), |
|
| 96 | + 'data' => $champs |
|
| 97 | + ) |
|
| 98 | + ); |
|
| 99 | + |
|
| 100 | + $id_rubrique = sql_insertq("spip_rubriques", $champs); |
|
| 101 | + pipeline('post_insertion', |
|
| 102 | + array( |
|
| 103 | + 'args' => array( |
|
| 104 | + 'table' => 'spip_rubriques', |
|
| 105 | + 'id_objet' => $id_rubrique |
|
| 106 | + ), |
|
| 107 | + 'data' => $champs |
|
| 108 | + ) |
|
| 109 | + ); |
|
| 110 | + propager_les_secteurs(); |
|
| 111 | + calculer_langues_rubriques(); |
|
| 112 | + |
|
| 113 | + return $id_rubrique; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -126,42 +126,42 @@ discard block |
||
| 126 | 126 | * - chaîne : Texte d'un message d'erreur |
| 127 | 127 | */ |
| 128 | 128 | function rubrique_modifier($id_rubrique, $set = null) { |
| 129 | - include_spip('inc/autoriser'); |
|
| 130 | - include_spip('inc/filtres'); |
|
| 131 | - |
|
| 132 | - include_spip('inc/modifier'); |
|
| 133 | - $c = collecter_requests( |
|
| 134 | - // white list |
|
| 135 | - objet_info('rubrique', 'champs_editables'), |
|
| 136 | - // black list |
|
| 137 | - array('id_parent', 'confirme_deplace'), |
|
| 138 | - // donnees eventuellement fournies |
|
| 139 | - $set |
|
| 140 | - ); |
|
| 141 | - |
|
| 142 | - if ($err = objet_modifier_champs('rubrique', $id_rubrique, |
|
| 143 | - array( |
|
| 144 | - 'data' => $set, |
|
| 145 | - 'nonvide' => array('titre' => _T('titre_nouvelle_rubrique') . " " . _T('info_numero_abbreviation') . $id_rubrique) |
|
| 146 | - ), |
|
| 147 | - $c) |
|
| 148 | - ) { |
|
| 149 | - return $err; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - $c = collecter_requests(array('id_parent', 'confirme_deplace'), array(), $set); |
|
| 153 | - // Deplacer la rubrique |
|
| 154 | - if (isset($c['id_parent'])) { |
|
| 155 | - $err = rubrique_instituer($id_rubrique, $c); |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - // invalider les caches marques de cette rubrique |
|
| 159 | - include_spip('inc/invalideur'); |
|
| 160 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 161 | - // et celui de menu_rubriques |
|
| 162 | - effacer_meta("date_calcul_rubriques"); |
|
| 163 | - |
|
| 164 | - return $err; |
|
| 129 | + include_spip('inc/autoriser'); |
|
| 130 | + include_spip('inc/filtres'); |
|
| 131 | + |
|
| 132 | + include_spip('inc/modifier'); |
|
| 133 | + $c = collecter_requests( |
|
| 134 | + // white list |
|
| 135 | + objet_info('rubrique', 'champs_editables'), |
|
| 136 | + // black list |
|
| 137 | + array('id_parent', 'confirme_deplace'), |
|
| 138 | + // donnees eventuellement fournies |
|
| 139 | + $set |
|
| 140 | + ); |
|
| 141 | + |
|
| 142 | + if ($err = objet_modifier_champs('rubrique', $id_rubrique, |
|
| 143 | + array( |
|
| 144 | + 'data' => $set, |
|
| 145 | + 'nonvide' => array('titre' => _T('titre_nouvelle_rubrique') . " " . _T('info_numero_abbreviation') . $id_rubrique) |
|
| 146 | + ), |
|
| 147 | + $c) |
|
| 148 | + ) { |
|
| 149 | + return $err; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + $c = collecter_requests(array('id_parent', 'confirme_deplace'), array(), $set); |
|
| 153 | + // Deplacer la rubrique |
|
| 154 | + if (isset($c['id_parent'])) { |
|
| 155 | + $err = rubrique_instituer($id_rubrique, $c); |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + // invalider les caches marques de cette rubrique |
|
| 159 | + include_spip('inc/invalideur'); |
|
| 160 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 161 | + // et celui de menu_rubriques |
|
| 162 | + effacer_meta("date_calcul_rubriques"); |
|
| 163 | + |
|
| 164 | + return $err; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -184,21 +184,21 @@ discard block |
||
| 184 | 184 | * false si la confirmation du déplacement n'est pas présente |
| 185 | 185 | */ |
| 186 | 186 | function editer_rubrique_breves($id_rubrique, $id_parent, $c = array()) { |
| 187 | - if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 188 | - return true; |
|
| 189 | - } |
|
| 187 | + if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 188 | + return true; |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - if (empty($c['confirme_deplace']) or $c['confirme_deplace'] != 'oui') { |
|
| 192 | - return false; |
|
| 193 | - } |
|
| 191 | + if (empty($c['confirme_deplace']) or $c['confirme_deplace'] != 'oui') { |
|
| 192 | + return false; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - if ($id_secteur = sql_getfetsel("id_secteur", |
|
| 196 | - "spip_rubriques", "id_rubrique=$id_parent") |
|
| 197 | - ) { |
|
| 198 | - sql_updateq("spip_breves", array("id_rubrique" => $id_secteur), "id_rubrique=$id_rubrique"); |
|
| 199 | - } |
|
| 195 | + if ($id_secteur = sql_getfetsel("id_secteur", |
|
| 196 | + "spip_rubriques", "id_rubrique=$id_parent") |
|
| 197 | + ) { |
|
| 198 | + sql_updateq("spip_breves", array("id_rubrique" => $id_secteur), "id_rubrique=$id_rubrique"); |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - return true; |
|
| 201 | + return true; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -220,51 +220,51 @@ discard block |
||
| 220 | 220 | * Chaîne : Texte du message d'erreur |
| 221 | 221 | */ |
| 222 | 222 | function rubrique_instituer($id_rubrique, $c) { |
| 223 | - // traitement de la rubrique parente |
|
| 224 | - // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 225 | - // qu'on n'administre pas. |
|
| 226 | - |
|
| 227 | - if (null !== ($id_parent = $c['id_parent'])) { |
|
| 228 | - $id_parent = intval($id_parent); |
|
| 229 | - $filles = calcul_branche_in($id_rubrique); |
|
| 230 | - if (strpos(",$id_parent,", ",$filles,") !== false) { |
|
| 231 | - spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 232 | - } else { |
|
| 233 | - $s = sql_fetsel("id_parent, statut", "spip_rubriques", "id_rubrique=$id_rubrique"); |
|
| 234 | - $old_parent = $s['id_parent']; |
|
| 235 | - |
|
| 236 | - if (!($id_parent != $old_parent |
|
| 237 | - and autoriser('publierdans', 'rubrique', $id_parent) |
|
| 238 | - and autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 239 | - and autoriser('publierdans', 'rubrique', $old_parent) |
|
| 240 | - ) |
|
| 241 | - ) { |
|
| 242 | - if ($s['statut'] != 'new') { |
|
| 243 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 244 | - } |
|
| 245 | - } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 246 | - $statut_ancien = $s['statut']; |
|
| 247 | - sql_updateq('spip_rubriques', array('id_parent' => $id_parent), "id_rubrique=$id_rubrique"); |
|
| 248 | - |
|
| 249 | - |
|
| 250 | - propager_les_secteurs(); |
|
| 251 | - |
|
| 252 | - // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 253 | - if ($statut_ancien == 'publie') { |
|
| 254 | - calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
|
| 255 | - } |
|
| 256 | - // Creation ou deplacement d'une rubrique non publiee |
|
| 257 | - // invalider le cache de leur menu |
|
| 258 | - elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 259 | - effacer_meta("date_calcul_rubriques"); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - calculer_langues_rubriques(); |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - return ''; // pas d'erreur |
|
| 223 | + // traitement de la rubrique parente |
|
| 224 | + // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 225 | + // qu'on n'administre pas. |
|
| 226 | + |
|
| 227 | + if (null !== ($id_parent = $c['id_parent'])) { |
|
| 228 | + $id_parent = intval($id_parent); |
|
| 229 | + $filles = calcul_branche_in($id_rubrique); |
|
| 230 | + if (strpos(",$id_parent,", ",$filles,") !== false) { |
|
| 231 | + spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 232 | + } else { |
|
| 233 | + $s = sql_fetsel("id_parent, statut", "spip_rubriques", "id_rubrique=$id_rubrique"); |
|
| 234 | + $old_parent = $s['id_parent']; |
|
| 235 | + |
|
| 236 | + if (!($id_parent != $old_parent |
|
| 237 | + and autoriser('publierdans', 'rubrique', $id_parent) |
|
| 238 | + and autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 239 | + and autoriser('publierdans', 'rubrique', $old_parent) |
|
| 240 | + ) |
|
| 241 | + ) { |
|
| 242 | + if ($s['statut'] != 'new') { |
|
| 243 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 244 | + } |
|
| 245 | + } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 246 | + $statut_ancien = $s['statut']; |
|
| 247 | + sql_updateq('spip_rubriques', array('id_parent' => $id_parent), "id_rubrique=$id_rubrique"); |
|
| 248 | + |
|
| 249 | + |
|
| 250 | + propager_les_secteurs(); |
|
| 251 | + |
|
| 252 | + // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 253 | + if ($statut_ancien == 'publie') { |
|
| 254 | + calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
|
| 255 | + } |
|
| 256 | + // Creation ou deplacement d'une rubrique non publiee |
|
| 257 | + // invalider le cache de leur menu |
|
| 258 | + elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 259 | + effacer_meta("date_calcul_rubriques"); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + calculer_langues_rubriques(); |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + return ''; // pas d'erreur |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * Identifiant de la rubrique crée |
| 282 | 282 | **/ |
| 283 | 283 | function insert_rubrique($id_parent) { |
| 284 | - return rubrique_inserer($id_parent); |
|
| 284 | + return rubrique_inserer($id_parent); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * - chaîne : Texte d'un message d'erreur |
| 303 | 303 | **/ |
| 304 | 304 | function revisions_rubriques($id_rubrique, $set = null) { |
| 305 | - return rubrique_modifier($id_rubrique, $set); |
|
| 305 | + return rubrique_modifier($id_rubrique, $set); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -321,5 +321,5 @@ discard block |
||
| 321 | 321 | * Chaîne : Texte du message d'erreur |
| 322 | 322 | **/ |
| 323 | 323 | function instituer_rubrique($id_rubrique, $c) { |
| 324 | - return rubrique_instituer($id_rubrique, $c); |
|
| 324 | + return rubrique_instituer($id_rubrique, $c); |
|
| 325 | 325 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Queue |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | 27 | function action_purger_queue_dist() { |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $securiser_action(); |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $securiser_action(); |
|
| 30 | 30 | |
| 31 | - if (autoriser('purger', 'queue')) { |
|
| 32 | - include_spip('inc/queue'); |
|
| 33 | - queue_purger(); |
|
| 34 | - } |
|
| 31 | + if (autoriser('purger', 'queue')) { |
|
| 32 | + include_spip('inc/queue'); |
|
| 33 | + queue_purger(); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | } |