@@ -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 | /** |
@@ -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 | } |
@@ -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 | /** |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function action_auth_dist() { |
| 27 | 27 | |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $arg = $securiser_action(); |
|
| 30 | - |
|
| 31 | - if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
|
| 32 | - spip_log("action_auth_dist $arg pas compris"); |
|
| 33 | - } else { |
|
| 34 | - $auth_methode = $r[1]; |
|
| 35 | - $login = $r[2]; |
|
| 36 | - include_spip('inc/auth'); |
|
| 37 | - $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 38 | - |
|
| 39 | - if (is_string($res)) { // Erreur |
|
| 40 | - $redirect = _request('redirect'); |
|
| 41 | - $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 42 | - include_spip('inc/headers'); |
|
| 43 | - redirige_par_entete($redirect); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 47 | - auth_loger($res); |
|
| 48 | - } |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $arg = $securiser_action(); |
|
| 30 | + |
|
| 31 | + if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
|
| 32 | + spip_log("action_auth_dist $arg pas compris"); |
|
| 33 | + } else { |
|
| 34 | + $auth_methode = $r[1]; |
|
| 35 | + $login = $r[2]; |
|
| 36 | + include_spip('inc/auth'); |
|
| 37 | + $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 38 | + |
|
| 39 | + if (is_string($res)) { // Erreur |
|
| 40 | + $redirect = _request('redirect'); |
|
| 41 | + $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 42 | + include_spip('inc/headers'); |
|
| 43 | + redirige_par_entete($redirect); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 47 | + auth_loger($res); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -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,28 +32,28 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function action_desinstaller_plugin_dist() { |
| 34 | 34 | |
| 35 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | - $arg = $securiser_action(); |
|
| 37 | - list($dir_plugins, $plugin) = explode("::", $arg); |
|
| 38 | - $dir_type = "_DIR_PLUGINS"; |
|
| 39 | - if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) { |
|
| 40 | - $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 41 | - } |
|
| 42 | - $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 43 | - $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 44 | - if ($infos and !$infos['install_test'][0]) { |
|
| 45 | - include_spip('inc/plugin'); |
|
| 46 | - ecrire_plugin_actifs(array($plugin), false, 'enleve'); |
|
| 47 | - $erreur = ''; |
|
| 48 | - } else { |
|
| 49 | - $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 50 | - } |
|
| 51 | - if ($redirect = _request('redirect')) { |
|
| 52 | - include_spip('inc/headers'); |
|
| 53 | - if ($erreur) { |
|
| 54 | - $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 55 | - } |
|
| 56 | - $redirect = str_replace('&', '&', $redirect); |
|
| 57 | - redirige_par_entete($redirect); |
|
| 58 | - } |
|
| 35 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | + $arg = $securiser_action(); |
|
| 37 | + list($dir_plugins, $plugin) = explode("::", $arg); |
|
| 38 | + $dir_type = "_DIR_PLUGINS"; |
|
| 39 | + if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) { |
|
| 40 | + $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 41 | + } |
|
| 42 | + $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 43 | + $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 44 | + if ($infos and !$infos['install_test'][0]) { |
|
| 45 | + include_spip('inc/plugin'); |
|
| 46 | + ecrire_plugin_actifs(array($plugin), false, 'enleve'); |
|
| 47 | + $erreur = ''; |
|
| 48 | + } else { |
|
| 49 | + $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 50 | + } |
|
| 51 | + if ($redirect = _request('redirect')) { |
|
| 52 | + include_spip('inc/headers'); |
|
| 53 | + if ($erreur) { |
|
| 54 | + $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 55 | + } |
|
| 56 | + $redirect = str_replace('&', '&', $redirect); |
|
| 57 | + redirige_par_entete($redirect); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -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'); |
@@ -33,84 +33,84 @@ discard block |
||
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | 35 | function action_cookie_dist($set_cookie_admin = null, $change_session = null) { |
| 36 | - $redirect_echec = $redirect = null; |
|
| 37 | - $test_echec_cookie = null; |
|
| 38 | - $url = ""; |
|
| 39 | - if (is_null($set_cookie_admin)) { |
|
| 40 | - $set_cookie_admin = _request('cookie_admin'); |
|
| 41 | - $change_session = _request('change_session'); |
|
| 42 | - $test_echec_cookie = _request('test_echec_cookie'); |
|
| 36 | + $redirect_echec = $redirect = null; |
|
| 37 | + $test_echec_cookie = null; |
|
| 38 | + $url = ""; |
|
| 39 | + if (is_null($set_cookie_admin)) { |
|
| 40 | + $set_cookie_admin = _request('cookie_admin'); |
|
| 41 | + $change_session = _request('change_session'); |
|
| 42 | + $test_echec_cookie = _request('test_echec_cookie'); |
|
| 43 | 43 | |
| 44 | - // La cible de notre operation de connexion |
|
| 45 | - $url = securiser_redirect_action(_request('url')); |
|
| 46 | - $redirect = $url ? $url : generer_url_ecrire('accueil'); |
|
| 47 | - $redirect_echec = _request('url_echec'); |
|
| 48 | - if (!isset($redirect_echec)) { |
|
| 49 | - if (strpos($redirect, _DIR_RESTREINT_ABS) !== false) { |
|
| 50 | - $redirect_echec = generer_url_public('login', '', true); |
|
| 51 | - } else { |
|
| 52 | - $redirect_echec = $redirect; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - } |
|
| 44 | + // La cible de notre operation de connexion |
|
| 45 | + $url = securiser_redirect_action(_request('url')); |
|
| 46 | + $redirect = $url ? $url : generer_url_ecrire('accueil'); |
|
| 47 | + $redirect_echec = _request('url_echec'); |
|
| 48 | + if (!isset($redirect_echec)) { |
|
| 49 | + if (strpos($redirect, _DIR_RESTREINT_ABS) !== false) { |
|
| 50 | + $redirect_echec = generer_url_public('login', '', true); |
|
| 51 | + } else { |
|
| 52 | + $redirect_echec = $redirect; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - // rejoue le cookie pour renouveler spip_session |
|
| 59 | - if ($change_session == 'oui') { |
|
| 60 | - $session = charger_fonction('session', 'inc'); |
|
| 61 | - $session(true); |
|
| 62 | - spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 63 | - http_status(204); // No Content |
|
| 64 | - return; |
|
| 65 | - } |
|
| 58 | + // rejoue le cookie pour renouveler spip_session |
|
| 59 | + if ($change_session == 'oui') { |
|
| 60 | + $session = charger_fonction('session', 'inc'); |
|
| 61 | + $session(true); |
|
| 62 | + spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 63 | + http_status(204); // No Content |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - // tentative de connexion en auth_http |
|
| 68 | - if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) { |
|
| 69 | - include_spip('inc/auth'); |
|
| 70 | - if (@$_SERVER['PHP_AUTH_USER'] |
|
| 71 | - and @$_SERVER['PHP_AUTH_PW'] |
|
| 72 | - and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) |
|
| 73 | - ) { |
|
| 74 | - auth_loger($auteur); |
|
| 75 | - redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 76 | - } else { |
|
| 77 | - ask_php_auth(_T('info_connexion_refusee'), |
|
| 78 | - _T('login_login_pass_incorrect'), |
|
| 79 | - _T('login_retour_site'), |
|
| 80 | - "url=" . rawurlencode($redirect), |
|
| 81 | - _T('login_nouvelle_tentative'), |
|
| 82 | - (strpos($url, _DIR_RESTREINT_ABS) !== false)); |
|
| 83 | - } |
|
| 84 | - } else { |
|
| 67 | + // tentative de connexion en auth_http |
|
| 68 | + if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) { |
|
| 69 | + include_spip('inc/auth'); |
|
| 70 | + if (@$_SERVER['PHP_AUTH_USER'] |
|
| 71 | + and @$_SERVER['PHP_AUTH_PW'] |
|
| 72 | + and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) |
|
| 73 | + ) { |
|
| 74 | + auth_loger($auteur); |
|
| 75 | + redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 76 | + } else { |
|
| 77 | + ask_php_auth(_T('info_connexion_refusee'), |
|
| 78 | + _T('login_login_pass_incorrect'), |
|
| 79 | + _T('login_retour_site'), |
|
| 80 | + "url=" . rawurlencode($redirect), |
|
| 81 | + _T('login_nouvelle_tentative'), |
|
| 82 | + (strpos($url, _DIR_RESTREINT_ABS) !== false)); |
|
| 83 | + } |
|
| 84 | + } else { |
|
| 85 | 85 | |
| 86 | - // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 87 | - // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 88 | - // le cas echeant. |
|
| 89 | - if ($test_echec_cookie == 'oui') { |
|
| 90 | - spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 91 | - if ($redirect) { |
|
| 92 | - $redirect = parametre_url(parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), 'url', |
|
| 93 | - rawurlencode($redirect), '&'); |
|
| 94 | - } |
|
| 95 | - } else { |
|
| 86 | + // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 87 | + // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 88 | + // le cas echeant. |
|
| 89 | + if ($test_echec_cookie == 'oui') { |
|
| 90 | + spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 91 | + if ($redirect) { |
|
| 92 | + $redirect = parametre_url(parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), 'url', |
|
| 93 | + rawurlencode($redirect), '&'); |
|
| 94 | + } |
|
| 95 | + } else { |
|
| 96 | 96 | |
| 97 | - $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
|
| 98 | - // Suppression cookie d'admin ? |
|
| 99 | - if ($set_cookie_admin == "non") { |
|
| 100 | - if ($cook) { |
|
| 101 | - spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 102 | - } |
|
| 103 | - } // Ajout de cookie d'admin |
|
| 104 | - else { |
|
| 105 | - if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) { |
|
| 106 | - spip_setcookie('spip_admin', $set_cookie_admin, time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - } |
|
| 97 | + $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
|
| 98 | + // Suppression cookie d'admin ? |
|
| 99 | + if ($set_cookie_admin == "non") { |
|
| 100 | + if ($cook) { |
|
| 101 | + spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 102 | + } |
|
| 103 | + } // Ajout de cookie d'admin |
|
| 104 | + else { |
|
| 105 | + if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) { |
|
| 106 | + spip_setcookie('spip_admin', $set_cookie_admin, time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - // Redirection finale |
|
| 113 | - if ($redirect) { |
|
| 114 | - redirige_par_entete($redirect, true); |
|
| 115 | - } |
|
| 112 | + // Redirection finale |
|
| 113 | + if ($redirect) { |
|
| 114 | + redirige_par_entete($redirect, true); |
|
| 115 | + } |
|
| 116 | 116 | } |