@@ -15,25 +15,25 @@ |
||
| 15 | 15 | // http://doc.spip.org/@action_desinstaller_plugin_dist |
| 16 | 16 | function action_desinstaller_plugin_dist() { |
| 17 | 17 | |
| 18 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 19 | - $arg = $securiser_action(); |
|
| 20 | - list($dir_plugins,$plugin) = explode("::",$arg); |
|
| 21 | - $dir_type = "_DIR_PLUGINS"; |
|
| 22 | - if (defined('_DIR_PLUGINS_SUPPL') AND $dir_plugins==_DIR_PLUGINS_SUPPL) |
|
| 23 | - $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 24 | - $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 25 | - $infos = $installer_plugins($plugin, 'uninstall',$dir_type); |
|
| 26 | - if ($infos AND !$infos['install_test'][0]) { |
|
| 27 | - include_spip('inc/plugin'); |
|
| 28 | - ecrire_plugin_actifs(array($plugin),false,'enleve'); |
|
| 29 | - $erreur = ''; |
|
| 30 | - } else $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 31 | - if ($redirect = _request('redirect')){ |
|
| 32 | - include_spip('inc/headers'); |
|
| 33 | - if ($erreur) |
|
| 34 | - $redirect = parametre_url($redirect, 'erreur',$erreur); |
|
| 35 | - $redirect = str_replace('&','&',$redirect); |
|
| 36 | - redirige_par_entete($redirect); |
|
| 37 | - } |
|
| 18 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 19 | + $arg = $securiser_action(); |
|
| 20 | + list($dir_plugins,$plugin) = explode("::",$arg); |
|
| 21 | + $dir_type = "_DIR_PLUGINS"; |
|
| 22 | + if (defined('_DIR_PLUGINS_SUPPL') AND $dir_plugins==_DIR_PLUGINS_SUPPL) |
|
| 23 | + $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 24 | + $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 25 | + $infos = $installer_plugins($plugin, 'uninstall',$dir_type); |
|
| 26 | + if ($infos AND !$infos['install_test'][0]) { |
|
| 27 | + include_spip('inc/plugin'); |
|
| 28 | + ecrire_plugin_actifs(array($plugin),false,'enleve'); |
|
| 29 | + $erreur = ''; |
|
| 30 | + } else $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 31 | + if ($redirect = _request('redirect')){ |
|
| 32 | + include_spip('inc/headers'); |
|
| 33 | + if ($erreur) |
|
| 34 | + $redirect = parametre_url($redirect, 'erreur',$erreur); |
|
| 35 | + $redirect = str_replace('&','&',$redirect); |
|
| 36 | + redirige_par_entete($redirect); |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | ?> |
@@ -17,22 +17,22 @@ |
||
| 17 | 17 | |
| 18 | 18 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 19 | 19 | $arg = $securiser_action(); |
| 20 | - list($dir_plugins,$plugin) = explode("::",$arg); |
|
| 20 | + list($dir_plugins, $plugin) = explode("::", $arg); |
|
| 21 | 21 | $dir_type = "_DIR_PLUGINS"; |
| 22 | - if (defined('_DIR_PLUGINS_SUPPL') AND $dir_plugins==_DIR_PLUGINS_SUPPL) |
|
| 22 | + if (defined('_DIR_PLUGINS_SUPPL') AND $dir_plugins == _DIR_PLUGINS_SUPPL) |
|
| 23 | 23 | $dir_type = "_DIR_PLUGINS_SUPPL"; |
| 24 | 24 | $installer_plugins = charger_fonction('installer', 'plugins'); |
| 25 | - $infos = $installer_plugins($plugin, 'uninstall',$dir_type); |
|
| 25 | + $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 26 | 26 | if ($infos AND !$infos['install_test'][0]) { |
| 27 | 27 | include_spip('inc/plugin'); |
| 28 | - ecrire_plugin_actifs(array($plugin),false,'enleve'); |
|
| 28 | + ecrire_plugin_actifs(array($plugin), false, 'enleve'); |
|
| 29 | 29 | $erreur = ''; |
| 30 | 30 | } else $erreur = 'erreur_plugin_desinstalation_echouee'; |
| 31 | - if ($redirect = _request('redirect')){ |
|
| 31 | + if ($redirect = _request('redirect')) { |
|
| 32 | 32 | include_spip('inc/headers'); |
| 33 | 33 | if ($erreur) |
| 34 | - $redirect = parametre_url($redirect, 'erreur',$erreur); |
|
| 35 | - $redirect = str_replace('&','&',$redirect); |
|
| 34 | + $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 35 | + $redirect = str_replace('&', '&', $redirect); |
|
| 36 | 36 | redirige_par_entete($redirect); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // http://doc.spip.org/@action_desinstaller_plugin_dist |
| 16 | 18 | function action_desinstaller_plugin_dist() { |
@@ -19,19 +21,23 @@ discard block |
||
| 19 | 21 | $arg = $securiser_action(); |
| 20 | 22 | list($dir_plugins,$plugin) = explode("::",$arg); |
| 21 | 23 | $dir_type = "_DIR_PLUGINS"; |
| 22 | - if (defined('_DIR_PLUGINS_SUPPL') AND $dir_plugins==_DIR_PLUGINS_SUPPL) |
|
| 23 | - $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 24 | + if (defined('_DIR_PLUGINS_SUPPL') AND $dir_plugins==_DIR_PLUGINS_SUPPL) { |
|
| 25 | + $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 26 | + } |
|
| 24 | 27 | $installer_plugins = charger_fonction('installer', 'plugins'); |
| 25 | 28 | $infos = $installer_plugins($plugin, 'uninstall',$dir_type); |
| 26 | 29 | if ($infos AND !$infos['install_test'][0]) { |
| 27 | 30 | include_spip('inc/plugin'); |
| 28 | 31 | ecrire_plugin_actifs(array($plugin),false,'enleve'); |
| 29 | 32 | $erreur = ''; |
| 30 | - } else $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 33 | + } else { |
|
| 34 | + $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 35 | + } |
|
| 31 | 36 | if ($redirect = _request('redirect')){ |
| 32 | 37 | include_spip('inc/headers'); |
| 33 | - if ($erreur) |
|
| 34 | - $redirect = parametre_url($redirect, 'erreur',$erreur); |
|
| 38 | + if ($erreur) { |
|
| 39 | + $redirect = parametre_url($redirect, 'erreur',$erreur); |
|
| 40 | + } |
|
| 35 | 41 | $redirect = str_replace('&','&',$redirect); |
| 36 | 42 | redirige_par_entete($redirect); |
| 37 | 43 | } |
@@ -15,32 +15,32 @@ |
||
| 15 | 15 | // http://doc.spip.org/@action_instituer_langue_rubrique_dist |
| 16 | 16 | function action_instituer_langue_rubrique_dist() { |
| 17 | 17 | |
| 18 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 19 | - $arg = $securiser_action(); |
|
| 20 | - $changer_lang = _request('changer_lang'); |
|
| 18 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 19 | + $arg = $securiser_action(); |
|
| 20 | + $changer_lang = _request('changer_lang'); |
|
| 21 | 21 | |
| 22 | - list($id_rubrique, $id_parent) = preg_split('/\W/', $arg); |
|
| 22 | + list($id_rubrique, $id_parent) = preg_split('/\W/', $arg); |
|
| 23 | 23 | |
| 24 | - if ($changer_lang |
|
| 25 | - AND $id_rubrique>0 |
|
| 26 | - AND $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 27 | - AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0)) { |
|
| 28 | - if ($changer_lang != "herit") |
|
| 29 | - sql_updateq('spip_rubriques', array('lang'=>$changer_lang, 'langue_choisie'=>'oui'), "id_rubrique=$id_rubrique"); |
|
| 30 | - else { |
|
| 31 | - if ($id_parent == 0) |
|
| 32 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 33 | - else { |
|
| 34 | - $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent"); |
|
| 35 | - } |
|
| 36 | - sql_updateq('spip_rubriques', array('lang'=>$langue_parent, 'langue_choisie'=>'non'), "id_rubrique=$id_rubrique"); |
|
| 37 | - } |
|
| 38 | - include_spip('inc/rubriques'); |
|
| 39 | - calculer_langues_rubriques(); |
|
| 24 | + if ($changer_lang |
|
| 25 | + AND $id_rubrique>0 |
|
| 26 | + AND $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 27 | + AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0)) { |
|
| 28 | + if ($changer_lang != "herit") |
|
| 29 | + sql_updateq('spip_rubriques', array('lang'=>$changer_lang, 'langue_choisie'=>'oui'), "id_rubrique=$id_rubrique"); |
|
| 30 | + else { |
|
| 31 | + if ($id_parent == 0) |
|
| 32 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 33 | + else { |
|
| 34 | + $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent"); |
|
| 35 | + } |
|
| 36 | + sql_updateq('spip_rubriques', array('lang'=>$langue_parent, 'langue_choisie'=>'non'), "id_rubrique=$id_rubrique"); |
|
| 37 | + } |
|
| 38 | + include_spip('inc/rubriques'); |
|
| 39 | + calculer_langues_rubriques(); |
|
| 40 | 40 | |
| 41 | - // invalider les caches marques de cette rubrique |
|
| 42 | - include_spip('inc/invalideur'); |
|
| 43 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 44 | - } |
|
| 41 | + // invalider les caches marques de cette rubrique |
|
| 42 | + include_spip('inc/invalideur'); |
|
| 43 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | ?> |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | list($id_rubrique, $id_parent) = preg_split('/\W/', $arg); |
| 23 | 23 | |
| 24 | 24 | if ($changer_lang |
| 25 | - AND $id_rubrique>0 |
|
| 25 | + AND $id_rubrique > 0 |
|
| 26 | 26 | AND $GLOBALS['meta']['multi_rubriques'] == 'oui' |
| 27 | 27 | AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0)) { |
| 28 | 28 | if ($changer_lang != "herit") |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // http://doc.spip.org/@action_instituer_langue_rubrique_dist |
| 16 | 18 | function action_instituer_langue_rubrique_dist() { |
@@ -25,12 +27,12 @@ discard block |
||
| 25 | 27 | AND $id_rubrique>0 |
| 26 | 28 | AND $GLOBALS['meta']['multi_rubriques'] == 'oui' |
| 27 | 29 | AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0)) { |
| 28 | - if ($changer_lang != "herit") |
|
| 29 | - sql_updateq('spip_rubriques', array('lang'=>$changer_lang, 'langue_choisie'=>'oui'), "id_rubrique=$id_rubrique"); |
|
| 30 | - else { |
|
| 31 | - if ($id_parent == 0) |
|
| 32 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 33 | - else { |
|
| 30 | + if ($changer_lang != "herit") { |
|
| 31 | + sql_updateq('spip_rubriques', array('lang'=>$changer_lang, 'langue_choisie'=>'oui'), "id_rubrique=$id_rubrique"); |
|
| 32 | + } else { |
|
| 33 | + if ($id_parent == 0) { |
|
| 34 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 35 | + } else { |
|
| 34 | 36 | $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent"); |
| 35 | 37 | } |
| 36 | 38 | sql_updateq('spip_rubriques', array('lang'=>$langue_parent, 'langue_choisie'=>'non'), "id_rubrique=$id_rubrique"); |
@@ -36,31 +36,31 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function action_editer_rubrique_dist($arg=null) { |
| 38 | 38 | |
| 39 | - if (is_null($arg)){ |
|
| 40 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 41 | - $arg = $securiser_action(); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - if (!$id_rubrique = intval($arg)) { |
|
| 45 | - if ($arg != 'oui') { |
|
| 46 | - include_spip('inc/headers'); |
|
| 47 | - redirige_url_ecrire(); |
|
| 48 | - } |
|
| 49 | - $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - $err = rubrique_modifier($id_rubrique); |
|
| 53 | - |
|
| 54 | - if (_request('redirect')) { |
|
| 55 | - $redirect = parametre_url( |
|
| 56 | - urldecode(_request('redirect')), |
|
| 57 | - 'id_rubrique', $id_rubrique, '&'); |
|
| 39 | + if (is_null($arg)){ |
|
| 40 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 41 | + $arg = $securiser_action(); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + if (!$id_rubrique = intval($arg)) { |
|
| 45 | + if ($arg != 'oui') { |
|
| 46 | + include_spip('inc/headers'); |
|
| 47 | + redirige_url_ecrire(); |
|
| 48 | + } |
|
| 49 | + $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + $err = rubrique_modifier($id_rubrique); |
|
| 53 | + |
|
| 54 | + if (_request('redirect')) { |
|
| 55 | + $redirect = parametre_url( |
|
| 56 | + urldecode(_request('redirect')), |
|
| 57 | + 'id_rubrique', $id_rubrique, '&'); |
|
| 58 | 58 | |
| 59 | - include_spip('inc/headers'); |
|
| 60 | - redirige_par_entete($redirect); |
|
| 61 | - } |
|
| 59 | + include_spip('inc/headers'); |
|
| 60 | + redirige_par_entete($redirect); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return array($id_rubrique,$err); |
|
| 63 | + return array($id_rubrique,$err); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -74,34 +74,34 @@ discard block |
||
| 74 | 74 | * Identifiant de la rubrique crée |
| 75 | 75 | */ |
| 76 | 76 | function rubrique_inserer($id_parent) { |
| 77 | - $champs = array( |
|
| 78 | - 'titre' => _T('item_nouvelle_rubrique'), |
|
| 79 | - 'id_parent' => intval($id_parent), |
|
| 80 | - 'statut' => 'new'); |
|
| 77 | + $champs = array( |
|
| 78 | + 'titre' => _T('item_nouvelle_rubrique'), |
|
| 79 | + 'id_parent' => intval($id_parent), |
|
| 80 | + 'statut' => 'new'); |
|
| 81 | 81 | |
| 82 | - // Envoyer aux plugins |
|
| 83 | - $champs = pipeline('pre_insertion', |
|
| 84 | - array( |
|
| 85 | - 'args' => array( |
|
| 86 | - 'table' => 'spip_rubriques', |
|
| 87 | - ), |
|
| 88 | - 'data' => $champs |
|
| 89 | - ) |
|
| 90 | - ); |
|
| 82 | + // Envoyer aux plugins |
|
| 83 | + $champs = pipeline('pre_insertion', |
|
| 84 | + array( |
|
| 85 | + 'args' => array( |
|
| 86 | + 'table' => 'spip_rubriques', |
|
| 87 | + ), |
|
| 88 | + 'data' => $champs |
|
| 89 | + ) |
|
| 90 | + ); |
|
| 91 | 91 | |
| 92 | - $id_rubrique = sql_insertq("spip_rubriques", $champs); |
|
| 93 | - pipeline('post_insertion', |
|
| 94 | - array( |
|
| 95 | - 'args' => array( |
|
| 96 | - 'table' => 'spip_rubriques', |
|
| 97 | - 'id_objet' => $id_rubrique |
|
| 98 | - ), |
|
| 99 | - 'data' => $champs |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - propager_les_secteurs(); |
|
| 103 | - calculer_langues_rubriques(); |
|
| 104 | - return $id_rubrique; |
|
| 92 | + $id_rubrique = sql_insertq("spip_rubriques", $champs); |
|
| 93 | + pipeline('post_insertion', |
|
| 94 | + array( |
|
| 95 | + 'args' => array( |
|
| 96 | + 'table' => 'spip_rubriques', |
|
| 97 | + 'id_objet' => $id_rubrique |
|
| 98 | + ), |
|
| 99 | + 'data' => $champs |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + propager_les_secteurs(); |
|
| 103 | + calculer_langues_rubriques(); |
|
| 104 | + return $id_rubrique; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -117,39 +117,39 @@ discard block |
||
| 117 | 117 | * - chaîne : Texte d'un message d'erreur |
| 118 | 118 | */ |
| 119 | 119 | function rubrique_modifier($id_rubrique, $set=null) { |
| 120 | - include_spip('inc/autoriser'); |
|
| 121 | - include_spip('inc/filtres'); |
|
| 122 | - |
|
| 123 | - include_spip('inc/modifier'); |
|
| 124 | - $c = collecter_requests( |
|
| 125 | - // white list |
|
| 126 | - objet_info('rubrique','champs_editables'), |
|
| 127 | - // black list |
|
| 128 | - array('id_parent', 'confirme_deplace'), |
|
| 129 | - // donnees eventuellement fournies |
|
| 130 | - $set |
|
| 131 | - ); |
|
| 132 | - |
|
| 133 | - if ($err = objet_modifier_champs('rubrique', $id_rubrique, |
|
| 134 | - array( |
|
| 135 | - 'data' => $set, |
|
| 136 | - 'nonvide' => array('titre' => _T('titre_nouvelle_rubrique')." "._T('info_numero_abbreviation').$id_rubrique) |
|
| 137 | - ), |
|
| 138 | - $c)) |
|
| 139 | - return $err; |
|
| 140 | - |
|
| 141 | - $c = collecter_requests(array('id_parent', 'confirme_deplace'),array(),$set); |
|
| 142 | - // Deplacer la rubrique |
|
| 143 | - if (isset($c['id_parent'])) { |
|
| 144 | - $err = rubrique_instituer($id_rubrique, $c); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // invalider les caches marques de cette rubrique |
|
| 148 | - include_spip('inc/invalideur'); |
|
| 149 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 150 | - // et celui de menu_rubriques |
|
| 151 | - effacer_meta("date_calcul_rubriques"); |
|
| 152 | - return $err; |
|
| 120 | + include_spip('inc/autoriser'); |
|
| 121 | + include_spip('inc/filtres'); |
|
| 122 | + |
|
| 123 | + include_spip('inc/modifier'); |
|
| 124 | + $c = collecter_requests( |
|
| 125 | + // white list |
|
| 126 | + objet_info('rubrique','champs_editables'), |
|
| 127 | + // black list |
|
| 128 | + array('id_parent', 'confirme_deplace'), |
|
| 129 | + // donnees eventuellement fournies |
|
| 130 | + $set |
|
| 131 | + ); |
|
| 132 | + |
|
| 133 | + if ($err = objet_modifier_champs('rubrique', $id_rubrique, |
|
| 134 | + array( |
|
| 135 | + 'data' => $set, |
|
| 136 | + 'nonvide' => array('titre' => _T('titre_nouvelle_rubrique')." "._T('info_numero_abbreviation').$id_rubrique) |
|
| 137 | + ), |
|
| 138 | + $c)) |
|
| 139 | + return $err; |
|
| 140 | + |
|
| 141 | + $c = collecter_requests(array('id_parent', 'confirme_deplace'),array(),$set); |
|
| 142 | + // Deplacer la rubrique |
|
| 143 | + if (isset($c['id_parent'])) { |
|
| 144 | + $err = rubrique_instituer($id_rubrique, $c); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // invalider les caches marques de cette rubrique |
|
| 148 | + include_spip('inc/invalideur'); |
|
| 149 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 150 | + // et celui de menu_rubriques |
|
| 151 | + effacer_meta("date_calcul_rubriques"); |
|
| 152 | + return $err; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -173,17 +173,17 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function editer_rubrique_breves($id_rubrique, $id_parent, $c=array()) |
| 175 | 175 | { |
| 176 | - if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) |
|
| 177 | - return true; |
|
| 176 | + if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) |
|
| 177 | + return true; |
|
| 178 | 178 | |
| 179 | - if ($c['confirme_deplace'] != 'oui') |
|
| 180 | - return false; |
|
| 179 | + if ($c['confirme_deplace'] != 'oui') |
|
| 180 | + return false; |
|
| 181 | 181 | |
| 182 | - if ($id_secteur = sql_getfetsel("id_secteur", |
|
| 183 | - "spip_rubriques", "id_rubrique=$id_parent")) |
|
| 184 | - sql_updateq("spip_breves", array("id_rubrique" => $id_secteur), "id_rubrique=$id_rubrique"); |
|
| 182 | + if ($id_secteur = sql_getfetsel("id_secteur", |
|
| 183 | + "spip_rubriques", "id_rubrique=$id_parent")) |
|
| 184 | + sql_updateq("spip_breves", array("id_rubrique" => $id_secteur), "id_rubrique=$id_rubrique"); |
|
| 185 | 185 | |
| 186 | - return true; |
|
| 186 | + return true; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | |
@@ -204,78 +204,78 @@ discard block |
||
| 204 | 204 | * Chaîne : Texte du message d'erreur |
| 205 | 205 | */ |
| 206 | 206 | function rubrique_instituer($id_rubrique, $c) { |
| 207 | - // traitement de la rubrique parente |
|
| 208 | - // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 209 | - // qu'on n'administre pas. |
|
| 210 | - |
|
| 211 | - if (NULL !== ($id_parent = $c['id_parent'])) { |
|
| 212 | - $id_parent = intval($id_parent); |
|
| 213 | - $filles = calcul_branche_in($id_rubrique); |
|
| 214 | - if (strpos(",$id_parent,", ",$filles,") !== false) |
|
| 215 | - spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 216 | - else { |
|
| 217 | - $s = sql_fetsel("id_parent, statut", "spip_rubriques", "id_rubrique=$id_rubrique"); |
|
| 218 | - $old_parent = $s['id_parent']; |
|
| 219 | - |
|
| 220 | - if (!($id_parent != $old_parent |
|
| 221 | - AND autoriser('publierdans', 'rubrique', $id_parent) |
|
| 222 | - AND autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 223 | - AND autoriser('publierdans', 'rubrique', $old_parent) |
|
| 224 | - )) { |
|
| 225 | - if ($s['statut'] != 'new') { |
|
| 226 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' '. $GLOBALS['visiteur_session']['statut']); |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 230 | - |
|
| 231 | - $champs = array('id_parent' => $id_parent); |
|
| 232 | - $statut_ancien = $s['statut']; |
|
| 233 | - |
|
| 234 | - // Envoyer aux plugins |
|
| 235 | - $champs = pipeline('pre_edition', |
|
| 236 | - array( |
|
| 237 | - 'args' => array( |
|
| 238 | - 'table' => 'spip_rubriques', |
|
| 239 | - 'id_objet' => $id_rubrique, |
|
| 240 | - 'action'=>'instituer', |
|
| 241 | - 'statut_ancien' => $statut_ancien, |
|
| 242 | - ), |
|
| 243 | - 'data' => $champs |
|
| 244 | - ) |
|
| 245 | - ); |
|
| 246 | - |
|
| 247 | - if (!count($champs)) return ''; |
|
| 248 | - |
|
| 249 | - sql_updateq('spip_rubriques', $champs, "id_rubrique=$id_rubrique"); |
|
| 250 | - |
|
| 251 | - propager_les_secteurs(); |
|
| 252 | - |
|
| 253 | - // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 254 | - if ($statut_ancien == 'publie') |
|
| 255 | - calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
|
| 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 | - calculer_langues_rubriques(); |
|
| 262 | - |
|
| 263 | - // Pipeline |
|
| 264 | - pipeline('post_edition', |
|
| 265 | - array( |
|
| 266 | - 'args' => array( |
|
| 267 | - 'table' => 'spip_rubriques', |
|
| 268 | - 'id_objet' => $id_rubrique, |
|
| 269 | - 'action'=>'instituer', |
|
| 270 | - 'statut_ancien' => $statut_ancien, |
|
| 271 | - ), |
|
| 272 | - 'data' => $champs |
|
| 273 | - ) |
|
| 274 | - ); |
|
| 275 | - } |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - return ''; // pas d'erreur |
|
| 207 | + // traitement de la rubrique parente |
|
| 208 | + // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 209 | + // qu'on n'administre pas. |
|
| 210 | + |
|
| 211 | + if (NULL !== ($id_parent = $c['id_parent'])) { |
|
| 212 | + $id_parent = intval($id_parent); |
|
| 213 | + $filles = calcul_branche_in($id_rubrique); |
|
| 214 | + if (strpos(",$id_parent,", ",$filles,") !== false) |
|
| 215 | + spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 216 | + else { |
|
| 217 | + $s = sql_fetsel("id_parent, statut", "spip_rubriques", "id_rubrique=$id_rubrique"); |
|
| 218 | + $old_parent = $s['id_parent']; |
|
| 219 | + |
|
| 220 | + if (!($id_parent != $old_parent |
|
| 221 | + AND autoriser('publierdans', 'rubrique', $id_parent) |
|
| 222 | + AND autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 223 | + AND autoriser('publierdans', 'rubrique', $old_parent) |
|
| 224 | + )) { |
|
| 225 | + if ($s['statut'] != 'new') { |
|
| 226 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' '. $GLOBALS['visiteur_session']['statut']); |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 230 | + |
|
| 231 | + $champs = array('id_parent' => $id_parent); |
|
| 232 | + $statut_ancien = $s['statut']; |
|
| 233 | + |
|
| 234 | + // Envoyer aux plugins |
|
| 235 | + $champs = pipeline('pre_edition', |
|
| 236 | + array( |
|
| 237 | + 'args' => array( |
|
| 238 | + 'table' => 'spip_rubriques', |
|
| 239 | + 'id_objet' => $id_rubrique, |
|
| 240 | + 'action'=>'instituer', |
|
| 241 | + 'statut_ancien' => $statut_ancien, |
|
| 242 | + ), |
|
| 243 | + 'data' => $champs |
|
| 244 | + ) |
|
| 245 | + ); |
|
| 246 | + |
|
| 247 | + if (!count($champs)) return ''; |
|
| 248 | + |
|
| 249 | + sql_updateq('spip_rubriques', $champs, "id_rubrique=$id_rubrique"); |
|
| 250 | + |
|
| 251 | + propager_les_secteurs(); |
|
| 252 | + |
|
| 253 | + // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 254 | + if ($statut_ancien == 'publie') |
|
| 255 | + calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
|
| 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 | + calculer_langues_rubriques(); |
|
| 262 | + |
|
| 263 | + // Pipeline |
|
| 264 | + pipeline('post_edition', |
|
| 265 | + array( |
|
| 266 | + 'args' => array( |
|
| 267 | + 'table' => 'spip_rubriques', |
|
| 268 | + 'id_objet' => $id_rubrique, |
|
| 269 | + 'action'=>'instituer', |
|
| 270 | + 'statut_ancien' => $statut_ancien, |
|
| 271 | + ), |
|
| 272 | + 'data' => $champs |
|
| 273 | + ) |
|
| 274 | + ); |
|
| 275 | + } |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + return ''; // pas d'erreur |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * Identifiant de la rubrique crée |
| 293 | 293 | **/ |
| 294 | 294 | function insert_rubrique($id_parent) { |
| 295 | - return rubrique_inserer($id_parent); |
|
| 295 | + return rubrique_inserer($id_parent); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * - chaîne : Texte d'un message d'erreur |
| 314 | 314 | **/ |
| 315 | 315 | function revisions_rubriques($id_rubrique, $set=null) { |
| 316 | - return rubrique_modifier($id_rubrique,$set); |
|
| 316 | + return rubrique_modifier($id_rubrique,$set); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -332,5 +332,5 @@ discard block |
||
| 332 | 332 | * Chaîne : Texte du message d'erreur |
| 333 | 333 | **/ |
| 334 | 334 | function instituer_rubrique($id_rubrique, $c) { |
| 335 | - return rubrique_instituer($id_rubrique, $c); |
|
| 335 | + return rubrique_instituer($id_rubrique, $c); |
|
| 336 | 336 | } |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | * Liste : identifiant de la rubrique, message d'erreur éventuel. |
| 35 | 35 | * |
| 36 | 36 | */ |
| 37 | -function action_editer_rubrique_dist($arg=null) { |
|
| 37 | +function action_editer_rubrique_dist($arg = null) { |
|
| 38 | 38 | |
| 39 | - if (is_null($arg)){ |
|
| 39 | + if (is_null($arg)) { |
|
| 40 | 40 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 41 | 41 | $arg = $securiser_action(); |
| 42 | 42 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | redirige_par_entete($redirect); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - return array($id_rubrique,$err); |
|
| 63 | + return array($id_rubrique, $err); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | * - chaîne vide : Vide si tout s'est bien passé |
| 117 | 117 | * - chaîne : Texte d'un message d'erreur |
| 118 | 118 | */ |
| 119 | -function rubrique_modifier($id_rubrique, $set=null) { |
|
| 119 | +function rubrique_modifier($id_rubrique, $set = null) { |
|
| 120 | 120 | include_spip('inc/autoriser'); |
| 121 | 121 | include_spip('inc/filtres'); |
| 122 | 122 | |
| 123 | 123 | include_spip('inc/modifier'); |
| 124 | 124 | $c = collecter_requests( |
| 125 | 125 | // white list |
| 126 | - objet_info('rubrique','champs_editables'), |
|
| 126 | + objet_info('rubrique', 'champs_editables'), |
|
| 127 | 127 | // black list |
| 128 | 128 | array('id_parent', 'confirme_deplace'), |
| 129 | 129 | // donnees eventuellement fournies |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $c)) |
| 139 | 139 | return $err; |
| 140 | 140 | |
| 141 | - $c = collecter_requests(array('id_parent', 'confirme_deplace'),array(),$set); |
|
| 141 | + $c = collecter_requests(array('id_parent', 'confirme_deplace'), array(), $set); |
|
| 142 | 142 | // Deplacer la rubrique |
| 143 | 143 | if (isset($c['id_parent'])) { |
| 144 | 144 | $err = rubrique_instituer($id_rubrique, $c); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * true si le déplacement est fait ou s'il n'y a rien à faire |
| 172 | 172 | * false si la confirmation du déplacement n'est pas présente |
| 173 | 173 | */ |
| 174 | -function editer_rubrique_breves($id_rubrique, $id_parent, $c=array()) |
|
| 174 | +function editer_rubrique_breves($id_rubrique, $id_parent, $c = array()) |
|
| 175 | 175 | { |
| 176 | 176 | if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) |
| 177 | 177 | return true; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | AND autoriser('publierdans', 'rubrique', $old_parent) |
| 224 | 224 | )) { |
| 225 | 225 | if ($s['statut'] != 'new') { |
| 226 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' '. $GLOBALS['visiteur_session']['statut']); |
|
| 226 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a ".$GLOBALS['visiteur_session']['id_auteur'].' '.$GLOBALS['visiteur_session']['statut']); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
| 256 | 256 | // Creation ou deplacement d'une rubrique non publiee |
| 257 | 257 | // invalider le cache de leur menu |
| 258 | - elseif (!$statut_ancien || $old_parent!=$id_parent) |
|
| 258 | + elseif (!$statut_ancien || $old_parent != $id_parent) |
|
| 259 | 259 | effacer_meta("date_calcul_rubriques"); |
| 260 | 260 | |
| 261 | 261 | calculer_langues_rubriques(); |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | * - chaîne vide : Vide si tout s'est bien passé |
| 313 | 313 | * - chaîne : Texte d'un message d'erreur |
| 314 | 314 | **/ |
| 315 | -function revisions_rubriques($id_rubrique, $set=null) { |
|
| 316 | - return rubrique_modifier($id_rubrique,$set); |
|
| 315 | +function revisions_rubriques($id_rubrique, $set = null) { |
|
| 316 | + return rubrique_modifier($id_rubrique, $set); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @package SPIP\Rubriques\Modifications |
| 17 | 17 | */ |
| 18 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 18 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 19 | + return; |
|
| 20 | +} |
|
| 19 | 21 | |
| 20 | 22 | include_spip('inc/rubriques'); |
| 21 | 23 | |
@@ -135,8 +137,9 @@ discard block |
||
| 135 | 137 | 'data' => $set, |
| 136 | 138 | 'nonvide' => array('titre' => _T('titre_nouvelle_rubrique')." "._T('info_numero_abbreviation').$id_rubrique) |
| 137 | 139 | ), |
| 138 | - $c)) |
|
| 139 | - return $err; |
|
| 140 | + $c)) { |
|
| 141 | + return $err; |
|
| 142 | + } |
|
| 140 | 143 | |
| 141 | 144 | $c = collecter_requests(array('id_parent', 'confirme_deplace'),array(),$set); |
| 142 | 145 | // Deplacer la rubrique |
@@ -173,15 +176,18 @@ discard block |
||
| 173 | 176 | */ |
| 174 | 177 | function editer_rubrique_breves($id_rubrique, $id_parent, $c=array()) |
| 175 | 178 | { |
| 176 | - if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) |
|
| 177 | - return true; |
|
| 179 | + if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 178 | 182 | |
| 179 | - if ($c['confirme_deplace'] != 'oui') |
|
| 180 | - return false; |
|
| 183 | + if ($c['confirme_deplace'] != 'oui') { |
|
| 184 | + return false; |
|
| 185 | + } |
|
| 181 | 186 | |
| 182 | 187 | if ($id_secteur = sql_getfetsel("id_secteur", |
| 183 | - "spip_rubriques", "id_rubrique=$id_parent")) |
|
| 184 | - sql_updateq("spip_breves", array("id_rubrique" => $id_secteur), "id_rubrique=$id_rubrique"); |
|
| 188 | + "spip_rubriques", "id_rubrique=$id_parent")) { |
|
| 189 | + sql_updateq("spip_breves", array("id_rubrique" => $id_secteur), "id_rubrique=$id_rubrique"); |
|
| 190 | + } |
|
| 185 | 191 | |
| 186 | 192 | return true; |
| 187 | 193 | } |
@@ -211,9 +217,9 @@ discard block |
||
| 211 | 217 | if (NULL !== ($id_parent = $c['id_parent'])) { |
| 212 | 218 | $id_parent = intval($id_parent); |
| 213 | 219 | $filles = calcul_branche_in($id_rubrique); |
| 214 | - if (strpos(",$id_parent,", ",$filles,") !== false) |
|
| 215 | - spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 216 | - else { |
|
| 220 | + if (strpos(",$id_parent,", ",$filles,") !== false) { |
|
| 221 | + spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 222 | + } else { |
|
| 217 | 223 | $s = sql_fetsel("id_parent, statut", "spip_rubriques", "id_rubrique=$id_rubrique"); |
| 218 | 224 | $old_parent = $s['id_parent']; |
| 219 | 225 | |
@@ -225,8 +231,7 @@ discard block |
||
| 225 | 231 | if ($s['statut'] != 'new') { |
| 226 | 232 | spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' '. $GLOBALS['visiteur_session']['statut']); |
| 227 | 233 | } |
| 228 | - } |
|
| 229 | - elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 234 | + } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 230 | 235 | |
| 231 | 236 | $champs = array('id_parent' => $id_parent); |
| 232 | 237 | $statut_ancien = $s['statut']; |
@@ -244,19 +249,23 @@ discard block |
||
| 244 | 249 | ) |
| 245 | 250 | ); |
| 246 | 251 | |
| 247 | - if (!count($champs)) return ''; |
|
| 252 | + if (!count($champs)) { |
|
| 253 | + return ''; |
|
| 254 | + } |
|
| 248 | 255 | |
| 249 | 256 | sql_updateq('spip_rubriques', $champs, "id_rubrique=$id_rubrique"); |
| 250 | 257 | |
| 251 | 258 | propager_les_secteurs(); |
| 252 | 259 | |
| 253 | 260 | // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
| 254 | - if ($statut_ancien == 'publie') |
|
| 255 | - calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
|
| 261 | + if ($statut_ancien == 'publie') { |
|
| 262 | + calculer_rubriques_if($old_parent, array('id_rubrique' => $id_parent), $statut_ancien); |
|
| 263 | + } |
|
| 256 | 264 | // Creation ou deplacement d'une rubrique non publiee |
| 257 | 265 | // invalider le cache de leur menu |
| 258 | - elseif (!$statut_ancien || $old_parent!=$id_parent) |
|
| 259 | - effacer_meta("date_calcul_rubriques"); |
|
| 266 | + elseif (!$statut_ancien || $old_parent!=$id_parent) { |
|
| 267 | + effacer_meta("date_calcul_rubriques"); |
|
| 268 | + } |
|
| 260 | 269 | |
| 261 | 270 | calculer_langues_rubriques(); |
| 262 | 271 | |
@@ -17,49 +17,49 @@ |
||
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | 19 | function action_confirmer_inscription_dist() { |
| 20 | - $jeton = _request('jeton'); |
|
| 21 | - $email = _request('email'); |
|
| 20 | + $jeton = _request('jeton'); |
|
| 21 | + $email = _request('email'); |
|
| 22 | 22 | |
| 23 | - include_spip('action/inscrire_auteur'); |
|
| 24 | - if ($auteur = auteur_verifier_jeton($jeton) |
|
| 25 | - AND $auteur['email']==$email |
|
| 26 | - AND $auteur['statut']=='nouveau'){ |
|
| 23 | + include_spip('action/inscrire_auteur'); |
|
| 24 | + if ($auteur = auteur_verifier_jeton($jeton) |
|
| 25 | + AND $auteur['email']==$email |
|
| 26 | + AND $auteur['statut']=='nouveau'){ |
|
| 27 | 27 | |
| 28 | - // OK c'est un nouvel inscrit qui confirme : |
|
| 29 | - // on le loge => ca va confirmer son statut et c'est plus sympa |
|
| 30 | - include_spip('inc/auth'); |
|
| 31 | - auth_loger($auteur); |
|
| 28 | + // OK c'est un nouvel inscrit qui confirme : |
|
| 29 | + // on le loge => ca va confirmer son statut et c'est plus sympa |
|
| 30 | + include_spip('inc/auth'); |
|
| 31 | + auth_loger($auteur); |
|
| 32 | 32 | |
| 33 | - // et on efface son jeton |
|
| 34 | - auteur_effacer_jeton($auteur['id_auteur']); |
|
| 33 | + // et on efface son jeton |
|
| 34 | + auteur_effacer_jeton($auteur['id_auteur']); |
|
| 35 | 35 | |
| 36 | - // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur |
|
| 37 | - // TODO: ne semble pas marcher si inscrit non visiteur, a debug |
|
| 38 | - if (!_request('redirect')){ |
|
| 39 | - // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 40 | - if (autoriser('ecrire','','',$auteur['id_auteur'])){ |
|
| 41 | - // poser un cookie admin aussi |
|
| 42 | - $cookie = charger_fonction('cookie','action'); |
|
| 43 | - $cookie("@".$GLOBALS['visiteur_session']['login']); |
|
| 44 | - $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 45 | - } |
|
| 46 | - else |
|
| 47 | - $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - else { |
|
| 51 | - // lien perime : |
|
| 52 | - if ($GLOBALS['visiteur_session']['id_auteur']){ |
|
| 53 | - // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 54 | - if (autoriser('ecrire','','',$GLOBALS['visiteur_session']['id_auteur'])) |
|
| 55 | - $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 56 | - else |
|
| 57 | - $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 58 | - } |
|
| 59 | - else |
|
| 60 | - // rediriger vers la page de login si pas encore loge |
|
| 61 | - $GLOBALS['redirect'] = parametre_url(generer_url_public('login','',false),'url',_request('redirect')); |
|
| 62 | - } |
|
| 36 | + // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur |
|
| 37 | + // TODO: ne semble pas marcher si inscrit non visiteur, a debug |
|
| 38 | + if (!_request('redirect')){ |
|
| 39 | + // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 40 | + if (autoriser('ecrire','','',$auteur['id_auteur'])){ |
|
| 41 | + // poser un cookie admin aussi |
|
| 42 | + $cookie = charger_fonction('cookie','action'); |
|
| 43 | + $cookie("@".$GLOBALS['visiteur_session']['login']); |
|
| 44 | + $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 45 | + } |
|
| 46 | + else |
|
| 47 | + $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + else { |
|
| 51 | + // lien perime : |
|
| 52 | + if ($GLOBALS['visiteur_session']['id_auteur']){ |
|
| 53 | + // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 54 | + if (autoriser('ecrire','','',$GLOBALS['visiteur_session']['id_auteur'])) |
|
| 55 | + $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 56 | + else |
|
| 57 | + $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 58 | + } |
|
| 59 | + else |
|
| 60 | + // rediriger vers la page de login si pas encore loge |
|
| 61 | + $GLOBALS['redirect'] = parametre_url(generer_url_public('login','',false),'url',_request('redirect')); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | include_spip('action/inscrire_auteur'); |
| 24 | 24 | if ($auteur = auteur_verifier_jeton($jeton) |
| 25 | - AND $auteur['email']==$email |
|
| 26 | - AND $auteur['statut']=='nouveau'){ |
|
| 25 | + AND $auteur['email'] == $email |
|
| 26 | + AND $auteur['statut'] == 'nouveau') { |
|
| 27 | 27 | |
| 28 | 28 | // OK c'est un nouvel inscrit qui confirme : |
| 29 | 29 | // on le loge => ca va confirmer son statut et c'est plus sympa |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur |
| 37 | 37 | // TODO: ne semble pas marcher si inscrit non visiteur, a debug |
| 38 | - if (!_request('redirect')){ |
|
| 38 | + if (!_request('redirect')) { |
|
| 39 | 39 | // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
| 40 | - if (autoriser('ecrire','','',$auteur['id_auteur'])){ |
|
| 40 | + if (autoriser('ecrire', '', '', $auteur['id_auteur'])) { |
|
| 41 | 41 | // poser un cookie admin aussi |
| 42 | - $cookie = charger_fonction('cookie','action'); |
|
| 42 | + $cookie = charger_fonction('cookie', 'action'); |
|
| 43 | 43 | $cookie("@".$GLOBALS['visiteur_session']['login']); |
| 44 | 44 | $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
| 45 | 45 | } |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | else { |
| 51 | 51 | // lien perime : |
| 52 | - if ($GLOBALS['visiteur_session']['id_auteur']){ |
|
| 52 | + if ($GLOBALS['visiteur_session']['id_auteur']) { |
|
| 53 | 53 | // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
| 54 | - if (autoriser('ecrire','','',$GLOBALS['visiteur_session']['id_auteur'])) |
|
| 54 | + if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) |
|
| 55 | 55 | $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
| 56 | 56 | else |
| 57 | 57 | $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
| 58 | 58 | } |
| 59 | 59 | else |
| 60 | 60 | // rediriger vers la page de login si pas encore loge |
| 61 | - $GLOBALS['redirect'] = parametre_url(generer_url_public('login','',false),'url',_request('redirect')); |
|
| 61 | + $GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect')); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Cette action permet de confirmer une inscription |
@@ -42,23 +44,23 @@ discard block |
||
| 42 | 44 | $cookie = charger_fonction('cookie','action'); |
| 43 | 45 | $cookie("@".$GLOBALS['visiteur_session']['login']); |
| 44 | 46 | $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
| 47 | + } else { |
|
| 48 | + $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 45 | 49 | } |
| 46 | - else |
|
| 47 | - $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 48 | 50 | } |
| 49 | - } |
|
| 50 | - else { |
|
| 51 | + } else { |
|
| 51 | 52 | // lien perime : |
| 52 | 53 | if ($GLOBALS['visiteur_session']['id_auteur']){ |
| 53 | 54 | // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
| 54 | - if (autoriser('ecrire','','',$GLOBALS['visiteur_session']['id_auteur'])) |
|
| 55 | - $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 56 | - else |
|
| 57 | - $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 58 | - } |
|
| 59 | - else |
|
| 60 | - // rediriger vers la page de login si pas encore loge |
|
| 55 | + if (autoriser('ecrire','','',$GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 56 | + $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 57 | + } else { |
|
| 58 | + $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 59 | + } |
|
| 60 | + } else { |
|
| 61 | + // rediriger vers la page de login si pas encore loge |
|
| 61 | 62 | $GLOBALS['redirect'] = parametre_url(generer_url_public('login','',false),'url',_request('redirect')); |
| 63 | + } |
|
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | } |
@@ -15,47 +15,47 @@ |
||
| 15 | 15 | |
| 16 | 16 | // http://doc.spip.org/@action_preferer_dist |
| 17 | 17 | function action_preferer_dist() { |
| 18 | - // |
|
| 19 | - // Preferences de presentation de l'espace prive |
|
| 20 | - // |
|
| 21 | - if ($_GET['arg'] !== 'display:4') { |
|
| 22 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 23 | - $arg = $securiser_action(); |
|
| 24 | - } else $arg = $_GET['arg']; |
|
| 25 | - |
|
| 26 | - if (!preg_match(",^(.+):(.*)$,", $arg, $r)) |
|
| 27 | - spip_log("action_preferer_dist: $arg pas compris"); |
|
| 28 | - else { |
|
| 29 | - $prefs_mod = false; |
|
| 30 | - |
|
| 31 | - list(, $op, $val) = $r; |
|
| 32 | - if ($op == 'couleur') { |
|
| 33 | - $GLOBALS['visiteur_session']['prefs']['couleur'] = $val; |
|
| 34 | - $prefs_mod = true; |
|
| 35 | - } |
|
| 36 | - elseif ($op == 'display') { |
|
| 37 | - $GLOBALS['visiteur_session']['prefs']['display'] = $val; |
|
| 38 | - $prefs_mod = true; |
|
| 39 | - } |
|
| 40 | - elseif ($op == 'display_outils') { |
|
| 41 | - $GLOBALS['visiteur_session']['prefs']['display_outils'] = $val; |
|
| 42 | - $prefs_mod = true; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if ($prefs_mod AND intval($GLOBALS['visiteur_session']['id_auteur'])) |
|
| 46 | - sql_updateq('spip_auteurs', array('prefs' => serialize($GLOBALS['visiteur_session']['prefs'])), "id_auteur=" .intval($GLOBALS['visiteur_session']['id_auteur'])); |
|
| 18 | + // |
|
| 19 | + // Preferences de presentation de l'espace prive |
|
| 20 | + // |
|
| 21 | + if ($_GET['arg'] !== 'display:4') { |
|
| 22 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 23 | + $arg = $securiser_action(); |
|
| 24 | + } else $arg = $_GET['arg']; |
|
| 25 | + |
|
| 26 | + if (!preg_match(",^(.+):(.*)$,", $arg, $r)) |
|
| 27 | + spip_log("action_preferer_dist: $arg pas compris"); |
|
| 28 | + else { |
|
| 29 | + $prefs_mod = false; |
|
| 30 | + |
|
| 31 | + list(, $op, $val) = $r; |
|
| 32 | + if ($op == 'couleur') { |
|
| 33 | + $GLOBALS['visiteur_session']['prefs']['couleur'] = $val; |
|
| 34 | + $prefs_mod = true; |
|
| 35 | + } |
|
| 36 | + elseif ($op == 'display') { |
|
| 37 | + $GLOBALS['visiteur_session']['prefs']['display'] = $val; |
|
| 38 | + $prefs_mod = true; |
|
| 39 | + } |
|
| 40 | + elseif ($op == 'display_outils') { |
|
| 41 | + $GLOBALS['visiteur_session']['prefs']['display_outils'] = $val; |
|
| 42 | + $prefs_mod = true; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if ($prefs_mod AND intval($GLOBALS['visiteur_session']['id_auteur'])) |
|
| 46 | + sql_updateq('spip_auteurs', array('prefs' => serialize($GLOBALS['visiteur_session']['prefs'])), "id_auteur=" .intval($GLOBALS['visiteur_session']['id_auteur'])); |
|
| 47 | 47 | |
| 48 | - if ($op == 'spip_ecran') { |
|
| 49 | - // Poser un cookie, |
|
| 50 | - // car ce reglage depend plus du navigateur que de l'utilisateur |
|
| 51 | - $GLOBALS['spip_ecran'] = $val; |
|
| 52 | - include_spip('inc/cookie'); |
|
| 53 | - spip_setcookie('spip_ecran', $val, time() + 365 * 24 * 3600); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - // Si modif des couleurs en ajax, redirect inutile on a change de CSS |
|
| 57 | - if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') exit; |
|
| 58 | - |
|
| 59 | - } |
|
| 48 | + if ($op == 'spip_ecran') { |
|
| 49 | + // Poser un cookie, |
|
| 50 | + // car ce reglage depend plus du navigateur que de l'utilisateur |
|
| 51 | + $GLOBALS['spip_ecran'] = $val; |
|
| 52 | + include_spip('inc/cookie'); |
|
| 53 | + spip_setcookie('spip_ecran', $val, time() + 365 * 24 * 3600); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + // Si modif des couleurs en ajax, redirect inutile on a change de CSS |
|
| 57 | + if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') exit; |
|
| 58 | + |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | ?> |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if ($prefs_mod AND intval($GLOBALS['visiteur_session']['id_auteur'])) |
| 46 | - sql_updateq('spip_auteurs', array('prefs' => serialize($GLOBALS['visiteur_session']['prefs'])), "id_auteur=" .intval($GLOBALS['visiteur_session']['id_auteur'])); |
|
| 46 | + sql_updateq('spip_auteurs', array('prefs' => serialize($GLOBALS['visiteur_session']['prefs'])), "id_auteur=".intval($GLOBALS['visiteur_session']['id_auteur'])); |
|
| 47 | 47 | |
| 48 | 48 | if ($op == 'spip_ecran') { |
| 49 | 49 | // Poser un cookie, |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | // http://doc.spip.org/@action_preferer_dist |
@@ -21,29 +23,30 @@ discard block |
||
| 21 | 23 | if ($_GET['arg'] !== 'display:4') { |
| 22 | 24 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 23 | 25 | $arg = $securiser_action(); |
| 24 | - } else $arg = $_GET['arg']; |
|
| 26 | + } else { |
|
| 27 | + $arg = $_GET['arg']; |
|
| 28 | + } |
|
| 25 | 29 | |
| 26 | - if (!preg_match(",^(.+):(.*)$,", $arg, $r)) |
|
| 27 | - spip_log("action_preferer_dist: $arg pas compris"); |
|
| 28 | - else { |
|
| 30 | + if (!preg_match(",^(.+):(.*)$,", $arg, $r)) { |
|
| 31 | + spip_log("action_preferer_dist: $arg pas compris"); |
|
| 32 | + } else { |
|
| 29 | 33 | $prefs_mod = false; |
| 30 | 34 | |
| 31 | 35 | list(, $op, $val) = $r; |
| 32 | 36 | if ($op == 'couleur') { |
| 33 | 37 | $GLOBALS['visiteur_session']['prefs']['couleur'] = $val; |
| 34 | 38 | $prefs_mod = true; |
| 35 | - } |
|
| 36 | - elseif ($op == 'display') { |
|
| 39 | + } elseif ($op == 'display') { |
|
| 37 | 40 | $GLOBALS['visiteur_session']['prefs']['display'] = $val; |
| 38 | 41 | $prefs_mod = true; |
| 39 | - } |
|
| 40 | - elseif ($op == 'display_outils') { |
|
| 42 | + } elseif ($op == 'display_outils') { |
|
| 41 | 43 | $GLOBALS['visiteur_session']['prefs']['display_outils'] = $val; |
| 42 | 44 | $prefs_mod = true; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | - if ($prefs_mod AND intval($GLOBALS['visiteur_session']['id_auteur'])) |
|
| 46 | - sql_updateq('spip_auteurs', array('prefs' => serialize($GLOBALS['visiteur_session']['prefs'])), "id_auteur=" .intval($GLOBALS['visiteur_session']['id_auteur'])); |
|
| 47 | + if ($prefs_mod AND intval($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 48 | + sql_updateq('spip_auteurs', array('prefs' => serialize($GLOBALS['visiteur_session']['prefs'])), "id_auteur=" .intval($GLOBALS['visiteur_session']['id_auteur'])); |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | if ($op == 'spip_ecran') { |
| 49 | 52 | // Poser un cookie, |
@@ -54,7 +57,9 @@ discard block |
||
| 54 | 57 | } |
| 55 | 58 | |
| 56 | 59 | // Si modif des couleurs en ajax, redirect inutile on a change de CSS |
| 57 | - if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') exit; |
|
| 60 | + if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { |
|
| 61 | + exit; |
|
| 62 | + } |
|
| 58 | 63 | |
| 59 | 64 | } |
| 60 | 65 | } |
@@ -16,75 +16,75 @@ |
||
| 16 | 16 | |
| 17 | 17 | // http://doc.spip.org/@gerer_deplacements |
| 18 | 18 | function gerer_deplacements($deplacements){ |
| 19 | - foreach(explode("\n",$deplacements) as $dep){ |
|
| 20 | - $mouvement=explode(":",$dep); |
|
| 21 | - list($quoi,$id_quoi) = explode("-",$mouvement[0]); |
|
| 22 | - list($cible, $id_cible) =explode("-",$mouvement[1]); |
|
| 23 | - $f = 'reorganiser_' . $quoi . '_' . $cible; |
|
| 24 | - if (function_exists($f)) |
|
| 25 | - $f(intval($id_quoi), intval($id_cible)); |
|
| 26 | - else spip_log("reorganiser $dep: incompris"); |
|
| 27 | - } |
|
| 19 | + foreach(explode("\n",$deplacements) as $dep){ |
|
| 20 | + $mouvement=explode(":",$dep); |
|
| 21 | + list($quoi,$id_quoi) = explode("-",$mouvement[0]); |
|
| 22 | + list($cible, $id_cible) =explode("-",$mouvement[1]); |
|
| 23 | + $f = 'reorganiser_' . $quoi . '_' . $cible; |
|
| 24 | + if (function_exists($f)) |
|
| 25 | + $f(intval($id_quoi), intval($id_cible)); |
|
| 26 | + else spip_log("reorganiser $dep: incompris"); |
|
| 27 | + } |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // http://doc.spip.org/@reorganiser_article_rubrique |
| 31 | 31 | function reorganiser_article_rubrique($id_article, $id_rubrique) |
| 32 | 32 | { |
| 33 | - if ($id_rubrique |
|
| 34 | - AND autoriser('modifier','rubrique',$id_rubrique) |
|
| 35 | - AND autoriser('modifier','article',$id_article)) { |
|
| 36 | - |
|
| 37 | - include_spip('action/editer_article'); |
|
| 38 | - include_spip('inc/rubriques'); |
|
| 39 | - $s = sql_fetsel("statut, id_rubrique", "spip_articles", "id_article=$id_article"); |
|
| 40 | - editer_article_heritage($id_article, |
|
| 41 | - $s['id_rubrique'], |
|
| 42 | - $s['statut'], |
|
| 43 | - array('id_rubrique' => $id_rubrique)); |
|
| 44 | - } |
|
| 33 | + if ($id_rubrique |
|
| 34 | + AND autoriser('modifier','rubrique',$id_rubrique) |
|
| 35 | + AND autoriser('modifier','article',$id_article)) { |
|
| 36 | + |
|
| 37 | + include_spip('action/editer_article'); |
|
| 38 | + include_spip('inc/rubriques'); |
|
| 39 | + $s = sql_fetsel("statut, id_rubrique", "spip_articles", "id_article=$id_article"); |
|
| 40 | + editer_article_heritage($id_article, |
|
| 41 | + $s['id_rubrique'], |
|
| 42 | + $s['statut'], |
|
| 43 | + array('id_rubrique' => $id_rubrique)); |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // http://doc.spip.org/@reorganiser_rubrique_rubrique |
| 48 | 48 | function reorganiser_rubrique_rubrique($id_quoi, $id_cible) |
| 49 | 49 | { |
| 50 | - if (($id_quoi != $id_cible) |
|
| 51 | - AND autoriser('modifier','rubrique',$id_cible) |
|
| 52 | - AND autoriser('modifier','rubrique',$id_quoi)) { |
|
| 53 | - if (!$id_cible) |
|
| 54 | - $id_secteur = $id_quoi; |
|
| 55 | - else { |
|
| 56 | - $id_secteur = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=$id_cible"); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - $s = sql_fetsel("statut, id_parent, id_secteur", "spip_rubriques", "id_rubrique=".intval($id_quoi)); |
|
| 60 | - |
|
| 61 | - sql_updateq('spip_rubriques', array('id_parent' => $id_cible, 'id_secteur'=>$id_secteur), "id_rubrique=".intval($id_quoi)); |
|
| 62 | - |
|
| 63 | - include_spip('inc/rubriques'); |
|
| 64 | - // propager les secteurs si besoin |
|
| 65 | - if ($s['id_secteur']!=$id_secteur) |
|
| 66 | - propager_les_secteurs(); |
|
| 67 | - // changer le statut de la rubrique source |
|
| 68 | - if ($s['statut'] == 'publie') |
|
| 69 | - calculer_rubriques_if($s['id_parent'], |
|
| 70 | - array('id_rubrique' => $id_cible), |
|
| 71 | - 'publie'); |
|
| 72 | - } |
|
| 50 | + if (($id_quoi != $id_cible) |
|
| 51 | + AND autoriser('modifier','rubrique',$id_cible) |
|
| 52 | + AND autoriser('modifier','rubrique',$id_quoi)) { |
|
| 53 | + if (!$id_cible) |
|
| 54 | + $id_secteur = $id_quoi; |
|
| 55 | + else { |
|
| 56 | + $id_secteur = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=$id_cible"); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + $s = sql_fetsel("statut, id_parent, id_secteur", "spip_rubriques", "id_rubrique=".intval($id_quoi)); |
|
| 60 | + |
|
| 61 | + sql_updateq('spip_rubriques', array('id_parent' => $id_cible, 'id_secteur'=>$id_secteur), "id_rubrique=".intval($id_quoi)); |
|
| 62 | + |
|
| 63 | + include_spip('inc/rubriques'); |
|
| 64 | + // propager les secteurs si besoin |
|
| 65 | + if ($s['id_secteur']!=$id_secteur) |
|
| 66 | + propager_les_secteurs(); |
|
| 67 | + // changer le statut de la rubrique source |
|
| 68 | + if ($s['statut'] == 'publie') |
|
| 69 | + calculer_rubriques_if($s['id_parent'], |
|
| 70 | + array('id_rubrique' => $id_cible), |
|
| 71 | + 'publie'); |
|
| 72 | + } |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // http://doc.spip.org/@action_reorganiser_dist |
| 76 | 76 | function action_reorganiser_dist(){ |
| 77 | 77 | |
| 78 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 79 | - $securiser_action(); |
|
| 78 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 79 | + $securiser_action(); |
|
| 80 | 80 | |
| 81 | - if (_request('deplacements')!==NULL) |
|
| 82 | - gerer_deplacements(_request('deplacements')); |
|
| 81 | + if (_request('deplacements')!==NULL) |
|
| 82 | + gerer_deplacements(_request('deplacements')); |
|
| 83 | 83 | |
| 84 | - $redirect = _request('redirect'); |
|
| 85 | - if ($redirect==NULL) $redirect=""; |
|
| 84 | + $redirect = _request('redirect'); |
|
| 85 | + if ($redirect==NULL) $redirect=""; |
|
| 86 | 86 | |
| 87 | - redirige_par_entete(str_replace("&","&",urldecode($redirect))); |
|
| 87 | + redirige_par_entete(str_replace("&","&",urldecode($redirect))); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | include_spip('inc/autoriser'); |
| 16 | 16 | |
| 17 | 17 | // http://doc.spip.org/@gerer_deplacements |
| 18 | -function gerer_deplacements($deplacements){ |
|
| 19 | - foreach(explode("\n",$deplacements) as $dep){ |
|
| 20 | - $mouvement=explode(":",$dep); |
|
| 21 | - list($quoi,$id_quoi) = explode("-",$mouvement[0]); |
|
| 22 | - list($cible, $id_cible) =explode("-",$mouvement[1]); |
|
| 23 | - $f = 'reorganiser_' . $quoi . '_' . $cible; |
|
| 18 | +function gerer_deplacements($deplacements) { |
|
| 19 | + foreach (explode("\n", $deplacements) as $dep) { |
|
| 20 | + $mouvement = explode(":", $dep); |
|
| 21 | + list($quoi, $id_quoi) = explode("-", $mouvement[0]); |
|
| 22 | + list($cible, $id_cible) = explode("-", $mouvement[1]); |
|
| 23 | + $f = 'reorganiser_'.$quoi.'_'.$cible; |
|
| 24 | 24 | if (function_exists($f)) |
| 25 | 25 | $f(intval($id_quoi), intval($id_cible)); |
| 26 | 26 | else spip_log("reorganiser $dep: incompris"); |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | function reorganiser_article_rubrique($id_article, $id_rubrique) |
| 32 | 32 | { |
| 33 | 33 | if ($id_rubrique |
| 34 | - AND autoriser('modifier','rubrique',$id_rubrique) |
|
| 35 | - AND autoriser('modifier','article',$id_article)) { |
|
| 34 | + AND autoriser('modifier', 'rubrique', $id_rubrique) |
|
| 35 | + AND autoriser('modifier', 'article', $id_article)) { |
|
| 36 | 36 | |
| 37 | 37 | include_spip('action/editer_article'); |
| 38 | 38 | include_spip('inc/rubriques'); |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | function reorganiser_rubrique_rubrique($id_quoi, $id_cible) |
| 49 | 49 | { |
| 50 | 50 | if (($id_quoi != $id_cible) |
| 51 | - AND autoriser('modifier','rubrique',$id_cible) |
|
| 52 | - AND autoriser('modifier','rubrique',$id_quoi)) { |
|
| 51 | + AND autoriser('modifier', 'rubrique', $id_cible) |
|
| 52 | + AND autoriser('modifier', 'rubrique', $id_quoi)) { |
|
| 53 | 53 | if (!$id_cible) |
| 54 | 54 | $id_secteur = $id_quoi; |
| 55 | 55 | else { |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $s = sql_fetsel("statut, id_parent, id_secteur", "spip_rubriques", "id_rubrique=".intval($id_quoi)); |
| 60 | 60 | |
| 61 | - sql_updateq('spip_rubriques', array('id_parent' => $id_cible, 'id_secteur'=>$id_secteur), "id_rubrique=".intval($id_quoi)); |
|
| 61 | + sql_updateq('spip_rubriques', array('id_parent' => $id_cible, 'id_secteur'=>$id_secteur), "id_rubrique=".intval($id_quoi)); |
|
| 62 | 62 | |
| 63 | 63 | include_spip('inc/rubriques'); |
| 64 | 64 | // propager les secteurs si besoin |
| 65 | - if ($s['id_secteur']!=$id_secteur) |
|
| 65 | + if ($s['id_secteur'] != $id_secteur) |
|
| 66 | 66 | propager_les_secteurs(); |
| 67 | 67 | // changer le statut de la rubrique source |
| 68 | 68 | if ($s['statut'] == 'publie') |
@@ -73,18 +73,18 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // http://doc.spip.org/@action_reorganiser_dist |
| 76 | -function action_reorganiser_dist(){ |
|
| 76 | +function action_reorganiser_dist() { |
|
| 77 | 77 | |
| 78 | 78 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 79 | 79 | $securiser_action(); |
| 80 | 80 | |
| 81 | - if (_request('deplacements')!==NULL) |
|
| 81 | + if (_request('deplacements') !== NULL) |
|
| 82 | 82 | gerer_deplacements(_request('deplacements')); |
| 83 | 83 | |
| 84 | 84 | $redirect = _request('redirect'); |
| 85 | - if ($redirect==NULL) $redirect=""; |
|
| 85 | + if ($redirect == NULL) $redirect = ""; |
|
| 86 | 86 | |
| 87 | - redirige_par_entete(str_replace("&","&",urldecode($redirect))); |
|
| 87 | + redirige_par_entete(str_replace("&", "&", urldecode($redirect))); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | include_spip('inc/autoriser'); |
| 16 | 18 | |
@@ -21,9 +23,11 @@ discard block |
||
| 21 | 23 | list($quoi,$id_quoi) = explode("-",$mouvement[0]); |
| 22 | 24 | list($cible, $id_cible) =explode("-",$mouvement[1]); |
| 23 | 25 | $f = 'reorganiser_' . $quoi . '_' . $cible; |
| 24 | - if (function_exists($f)) |
|
| 25 | - $f(intval($id_quoi), intval($id_cible)); |
|
| 26 | - else spip_log("reorganiser $dep: incompris"); |
|
| 26 | + if (function_exists($f)) { |
|
| 27 | + $f(intval($id_quoi), intval($id_cible)); |
|
| 28 | + } else { |
|
| 29 | + spip_log("reorganiser $dep: incompris"); |
|
| 30 | + } |
|
| 27 | 31 | } |
| 28 | 32 | } |
| 29 | 33 | |
@@ -50,9 +54,9 @@ discard block |
||
| 50 | 54 | if (($id_quoi != $id_cible) |
| 51 | 55 | AND autoriser('modifier','rubrique',$id_cible) |
| 52 | 56 | AND autoriser('modifier','rubrique',$id_quoi)) { |
| 53 | - if (!$id_cible) |
|
| 54 | - $id_secteur = $id_quoi; |
|
| 55 | - else { |
|
| 57 | + if (!$id_cible) { |
|
| 58 | + $id_secteur = $id_quoi; |
|
| 59 | + } else { |
|
| 56 | 60 | $id_secteur = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=$id_cible"); |
| 57 | 61 | } |
| 58 | 62 | |
@@ -62,13 +66,15 @@ discard block |
||
| 62 | 66 | |
| 63 | 67 | include_spip('inc/rubriques'); |
| 64 | 68 | // propager les secteurs si besoin |
| 65 | - if ($s['id_secteur']!=$id_secteur) |
|
| 66 | - propager_les_secteurs(); |
|
| 69 | + if ($s['id_secteur']!=$id_secteur) { |
|
| 70 | + propager_les_secteurs(); |
|
| 71 | + } |
|
| 67 | 72 | // changer le statut de la rubrique source |
| 68 | - if ($s['statut'] == 'publie') |
|
| 69 | - calculer_rubriques_if($s['id_parent'], |
|
| 73 | + if ($s['statut'] == 'publie') { |
|
| 74 | + calculer_rubriques_if($s['id_parent'], |
|
| 70 | 75 | array('id_rubrique' => $id_cible), |
| 71 | 76 | 'publie'); |
| 77 | + } |
|
| 72 | 78 | } |
| 73 | 79 | } |
| 74 | 80 | |
@@ -78,11 +84,14 @@ discard block |
||
| 78 | 84 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 79 | 85 | $securiser_action(); |
| 80 | 86 | |
| 81 | - if (_request('deplacements')!==NULL) |
|
| 82 | - gerer_deplacements(_request('deplacements')); |
|
| 87 | + if (_request('deplacements')!==NULL) { |
|
| 88 | + gerer_deplacements(_request('deplacements')); |
|
| 89 | + } |
|
| 83 | 90 | |
| 84 | 91 | $redirect = _request('redirect'); |
| 85 | - if ($redirect==NULL) $redirect=""; |
|
| 92 | + if ($redirect==NULL) { |
|
| 93 | + $redirect=""; |
|
| 94 | + } |
|
| 86 | 95 | |
| 87 | 96 | redirige_par_entete(str_replace("&","&",urldecode($redirect))); |
| 88 | 97 | } |
@@ -17,83 +17,83 @@ |
||
| 17 | 17 | |
| 18 | 18 | // http://doc.spip.org/@action_cookie_dist |
| 19 | 19 | function action_cookie_dist($set_cookie_admin=null, $change_session = null) { |
| 20 | - $redirect_echec = $redirect = null; |
|
| 21 | - $test_echec_cookie = null; |
|
| 22 | - $url = ""; |
|
| 23 | - if (is_null($set_cookie_admin)){ |
|
| 24 | - $set_cookie_admin = _request('cookie_admin'); |
|
| 25 | - $change_session = _request('change_session'); |
|
| 26 | - $test_echec_cookie = _request('test_echec_cookie'); |
|
| 20 | + $redirect_echec = $redirect = null; |
|
| 21 | + $test_echec_cookie = null; |
|
| 22 | + $url = ""; |
|
| 23 | + if (is_null($set_cookie_admin)){ |
|
| 24 | + $set_cookie_admin = _request('cookie_admin'); |
|
| 25 | + $change_session = _request('change_session'); |
|
| 26 | + $test_echec_cookie = _request('test_echec_cookie'); |
|
| 27 | 27 | |
| 28 | - // La cible de notre operation de connexion |
|
| 29 | - $url = securiser_redirect_action(_request('url')); |
|
| 30 | - $redirect = $url ? $url : generer_url_ecrire('accueil'); |
|
| 31 | - $redirect_echec = _request('url_echec'); |
|
| 32 | - if (!isset($redirect_echec)) { |
|
| 33 | - if (strpos($redirect,_DIR_RESTREINT_ABS)!==false) |
|
| 34 | - $redirect_echec = generer_url_public('login','',true); |
|
| 35 | - else |
|
| 36 | - $redirect_echec = $redirect; |
|
| 37 | - } |
|
| 38 | - } |
|
| 28 | + // La cible de notre operation de connexion |
|
| 29 | + $url = securiser_redirect_action(_request('url')); |
|
| 30 | + $redirect = $url ? $url : generer_url_ecrire('accueil'); |
|
| 31 | + $redirect_echec = _request('url_echec'); |
|
| 32 | + if (!isset($redirect_echec)) { |
|
| 33 | + if (strpos($redirect,_DIR_RESTREINT_ABS)!==false) |
|
| 34 | + $redirect_echec = generer_url_public('login','',true); |
|
| 35 | + else |
|
| 36 | + $redirect_echec = $redirect; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - // rejoue le cookie pour renouveler spip_session |
|
| 42 | - if ($change_session == 'oui') { |
|
| 43 | - $session = charger_fonction('session', 'inc'); |
|
| 44 | - $session(true); |
|
| 45 | - spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 46 | - http_status(204); // No Content |
|
| 47 | - return; |
|
| 48 | - } |
|
| 41 | + // rejoue le cookie pour renouveler spip_session |
|
| 42 | + if ($change_session == 'oui') { |
|
| 43 | + $session = charger_fonction('session', 'inc'); |
|
| 44 | + $session(true); |
|
| 45 | + spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 46 | + http_status(204); // No Content |
|
| 47 | + return; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - // tentative de connexion en auth_http |
|
| 51 | - if (_request('essai_auth_http') AND !$GLOBALS['ignore_auth_http']) { |
|
| 52 | - include_spip('inc/auth'); |
|
| 53 | - if (@$_SERVER['PHP_AUTH_USER'] |
|
| 54 | - AND @$_SERVER['PHP_AUTH_PW'] |
|
| 55 | - AND $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])){ |
|
| 56 | - auth_loger($auteur); |
|
| 57 | - redirige_par_entete(parametre_url($redirect,'t',time(),'&')); |
|
| 58 | - } |
|
| 59 | - else { |
|
| 60 | - ask_php_auth(_T('info_connexion_refusee'), |
|
| 61 | - _T('login_login_pass_incorrect'), |
|
| 62 | - _T('login_retour_site'), |
|
| 63 | - "url=".rawurlencode($redirect), |
|
| 64 | - _T('login_nouvelle_tentative'), |
|
| 65 | - (strpos($url,_DIR_RESTREINT_ABS)!==false)); |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - else { |
|
| 50 | + // tentative de connexion en auth_http |
|
| 51 | + if (_request('essai_auth_http') AND !$GLOBALS['ignore_auth_http']) { |
|
| 52 | + include_spip('inc/auth'); |
|
| 53 | + if (@$_SERVER['PHP_AUTH_USER'] |
|
| 54 | + AND @$_SERVER['PHP_AUTH_PW'] |
|
| 55 | + AND $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])){ |
|
| 56 | + auth_loger($auteur); |
|
| 57 | + redirige_par_entete(parametre_url($redirect,'t',time(),'&')); |
|
| 58 | + } |
|
| 59 | + else { |
|
| 60 | + ask_php_auth(_T('info_connexion_refusee'), |
|
| 61 | + _T('login_login_pass_incorrect'), |
|
| 62 | + _T('login_retour_site'), |
|
| 63 | + "url=".rawurlencode($redirect), |
|
| 64 | + _T('login_nouvelle_tentative'), |
|
| 65 | + (strpos($url,_DIR_RESTREINT_ABS)!==false)); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + else { |
|
| 69 | 69 | |
| 70 | - // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 71 | - // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 72 | - // le cas echeant. |
|
| 73 | - if ($test_echec_cookie == 'oui') { |
|
| 74 | - spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 75 | - if ($redirect) |
|
| 76 | - $redirect = parametre_url(parametre_url($redirect_echec,'var_echec_cookie','oui','&'),'url',rawurlencode($redirect),'&'); |
|
| 77 | - } |
|
| 78 | - else { |
|
| 70 | + // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 71 | + // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 72 | + // le cas echeant. |
|
| 73 | + if ($test_echec_cookie == 'oui') { |
|
| 74 | + spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 75 | + if ($redirect) |
|
| 76 | + $redirect = parametre_url(parametre_url($redirect_echec,'var_echec_cookie','oui','&'),'url',rawurlencode($redirect),'&'); |
|
| 77 | + } |
|
| 78 | + else { |
|
| 79 | 79 | |
| 80 | - $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
|
| 81 | - // Suppression cookie d'admin ? |
|
| 82 | - if ($set_cookie_admin == "non") { |
|
| 83 | - if ($cook) |
|
| 84 | - spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 85 | - } |
|
| 86 | - // Ajout de cookie d'admin |
|
| 87 | - else if ($set_cookie_admin) { |
|
| 88 | - spip_setcookie('spip_admin', $set_cookie_admin, |
|
| 89 | - time() + 14 * 24 * 3600); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - } |
|
| 80 | + $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
|
| 81 | + // Suppression cookie d'admin ? |
|
| 82 | + if ($set_cookie_admin == "non") { |
|
| 83 | + if ($cook) |
|
| 84 | + spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 85 | + } |
|
| 86 | + // Ajout de cookie d'admin |
|
| 87 | + else if ($set_cookie_admin) { |
|
| 88 | + spip_setcookie('spip_admin', $set_cookie_admin, |
|
| 89 | + time() + 14 * 24 * 3600); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - // Redirection finale |
|
| 95 | - if ($redirect) |
|
| 96 | - redirige_par_entete($redirect, true); |
|
| 94 | + // Redirection finale |
|
| 95 | + if ($redirect) |
|
| 96 | + redirige_par_entete($redirect, true); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | ?> |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | include_spip('inc/cookie'); |
| 17 | 17 | |
| 18 | 18 | // http://doc.spip.org/@action_cookie_dist |
| 19 | -function action_cookie_dist($set_cookie_admin=null, $change_session = null) { |
|
| 19 | +function action_cookie_dist($set_cookie_admin = null, $change_session = null) { |
|
| 20 | 20 | $redirect_echec = $redirect = null; |
| 21 | 21 | $test_echec_cookie = null; |
| 22 | 22 | $url = ""; |
| 23 | - if (is_null($set_cookie_admin)){ |
|
| 23 | + if (is_null($set_cookie_admin)) { |
|
| 24 | 24 | $set_cookie_admin = _request('cookie_admin'); |
| 25 | 25 | $change_session = _request('change_session'); |
| 26 | 26 | $test_echec_cookie = _request('test_echec_cookie'); |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | $redirect = $url ? $url : generer_url_ecrire('accueil'); |
| 31 | 31 | $redirect_echec = _request('url_echec'); |
| 32 | 32 | if (!isset($redirect_echec)) { |
| 33 | - if (strpos($redirect,_DIR_RESTREINT_ABS)!==false) |
|
| 34 | - $redirect_echec = generer_url_public('login','',true); |
|
| 33 | + if (strpos($redirect, _DIR_RESTREINT_ABS) !== false) |
|
| 34 | + $redirect_echec = generer_url_public('login', '', true); |
|
| 35 | 35 | else |
| 36 | 36 | $redirect_echec = $redirect; |
| 37 | 37 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if ($change_session == 'oui') { |
| 43 | 43 | $session = charger_fonction('session', 'inc'); |
| 44 | 44 | $session(true); |
| 45 | - spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 45 | + spip_log("statut 204 pour ".$_SERVER['REQUEST_URI']); |
|
| 46 | 46 | http_status(204); // No Content |
| 47 | 47 | return; |
| 48 | 48 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | include_spip('inc/auth'); |
| 53 | 53 | if (@$_SERVER['PHP_AUTH_USER'] |
| 54 | 54 | AND @$_SERVER['PHP_AUTH_PW'] |
| 55 | - AND $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])){ |
|
| 55 | + AND $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { |
|
| 56 | 56 | auth_loger($auteur); |
| 57 | - redirige_par_entete(parametre_url($redirect,'t',time(),'&')); |
|
| 57 | + redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 58 | 58 | } |
| 59 | 59 | else { |
| 60 | 60 | ask_php_auth(_T('info_connexion_refusee'), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | _T('login_retour_site'), |
| 63 | 63 | "url=".rawurlencode($redirect), |
| 64 | 64 | _T('login_nouvelle_tentative'), |
| 65 | - (strpos($url,_DIR_RESTREINT_ABS)!==false)); |
|
| 65 | + (strpos($url, _DIR_RESTREINT_ABS) !== false)); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | else { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($test_echec_cookie == 'oui') { |
| 74 | 74 | spip_setcookie('spip_session', 'test_echec_cookie'); |
| 75 | 75 | if ($redirect) |
| 76 | - $redirect = parametre_url(parametre_url($redirect_echec,'var_echec_cookie','oui','&'),'url',rawurlencode($redirect),'&'); |
|
| 76 | + $redirect = parametre_url(parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), 'url', rawurlencode($redirect), '&'); |
|
| 77 | 77 | } |
| 78 | 78 | else { |
| 79 | 79 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | include_spip('inc/actions'); |
| 16 | 18 | include_spip('inc/cookie'); |
@@ -30,10 +32,11 @@ discard block |
||
| 30 | 32 | $redirect = $url ? $url : generer_url_ecrire('accueil'); |
| 31 | 33 | $redirect_echec = _request('url_echec'); |
| 32 | 34 | if (!isset($redirect_echec)) { |
| 33 | - if (strpos($redirect,_DIR_RESTREINT_ABS)!==false) |
|
| 34 | - $redirect_echec = generer_url_public('login','',true); |
|
| 35 | - else |
|
| 36 | - $redirect_echec = $redirect; |
|
| 35 | + if (strpos($redirect,_DIR_RESTREINT_ABS)!==false) { |
|
| 36 | + $redirect_echec = generer_url_public('login','',true); |
|
| 37 | + } else { |
|
| 38 | + $redirect_echec = $redirect; |
|
| 39 | + } |
|
| 37 | 40 | } |
| 38 | 41 | } |
| 39 | 42 | |
@@ -55,8 +58,7 @@ discard block |
||
| 55 | 58 | AND $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])){ |
| 56 | 59 | auth_loger($auteur); |
| 57 | 60 | redirige_par_entete(parametre_url($redirect,'t',time(),'&')); |
| 58 | - } |
|
| 59 | - else { |
|
| 61 | + } else { |
|
| 60 | 62 | ask_php_auth(_T('info_connexion_refusee'), |
| 61 | 63 | _T('login_login_pass_incorrect'), |
| 62 | 64 | _T('login_retour_site'), |
@@ -64,24 +66,24 @@ discard block |
||
| 64 | 66 | _T('login_nouvelle_tentative'), |
| 65 | 67 | (strpos($url,_DIR_RESTREINT_ABS)!==false)); |
| 66 | 68 | } |
| 67 | - } |
|
| 68 | - else { |
|
| 69 | + } else { |
|
| 69 | 70 | |
| 70 | 71 | // en cas de login sur bonjour=oui, on tente de poser un cookie |
| 71 | 72 | // puis de passer au login qui diagnostiquera l'echec de cookie |
| 72 | 73 | // le cas echeant. |
| 73 | 74 | if ($test_echec_cookie == 'oui') { |
| 74 | 75 | spip_setcookie('spip_session', 'test_echec_cookie'); |
| 75 | - if ($redirect) |
|
| 76 | - $redirect = parametre_url(parametre_url($redirect_echec,'var_echec_cookie','oui','&'),'url',rawurlencode($redirect),'&'); |
|
| 77 | - } |
|
| 78 | - else { |
|
| 76 | + if ($redirect) { |
|
| 77 | + $redirect = parametre_url(parametre_url($redirect_echec,'var_echec_cookie','oui','&'),'url',rawurlencode($redirect),'&'); |
|
| 78 | + } |
|
| 79 | + } else { |
|
| 79 | 80 | |
| 80 | 81 | $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
| 81 | 82 | // Suppression cookie d'admin ? |
| 82 | 83 | if ($set_cookie_admin == "non") { |
| 83 | - if ($cook) |
|
| 84 | - spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 84 | + if ($cook) { |
|
| 85 | + spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 86 | + } |
|
| 85 | 87 | } |
| 86 | 88 | // Ajout de cookie d'admin |
| 87 | 89 | else if ($set_cookie_admin) { |
@@ -92,8 +94,9 @@ discard block |
||
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | // Redirection finale |
| 95 | - if ($redirect) |
|
| 96 | - redirige_par_entete($redirect, true); |
|
| 97 | -} |
|
| 97 | + if ($redirect) { |
|
| 98 | + redirige_par_entete($redirect, true); |
|
| 99 | + } |
|
| 100 | + } |
|
| 98 | 101 | |
| 99 | 102 | ?> |
@@ -22,42 +22,42 @@ |
||
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | 24 | function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur='') { |
| 25 | - if ($changer_lang) { |
|
| 26 | - $table_objet_sql = table_objet_sql($objet); |
|
| 27 | - $id_table_objet = id_table_objet($objet); |
|
| 28 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 29 | - $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 25 | + if ($changer_lang) { |
|
| 26 | + $table_objet_sql = table_objet_sql($objet); |
|
| 27 | + $id_table_objet = id_table_objet($objet); |
|
| 28 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 29 | + $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 30 | 30 | |
| 31 | - $set = array(); |
|
| 32 | - if (isset($desc['field']['langue_choisie'])){ |
|
| 33 | - $set['langue_choisie'] = 'oui'; |
|
| 34 | - } |
|
| 31 | + $set = array(); |
|
| 32 | + if (isset($desc['field']['langue_choisie'])){ |
|
| 33 | + $set['langue_choisie'] = 'oui'; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - if ($changer_lang != "herit") { |
|
| 37 | - $set['lang'] = $changer_lang; |
|
| 38 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 39 | - include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 40 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 41 | - calculer_langues_rubriques(); |
|
| 42 | - } |
|
| 43 | - $langues = calculer_langues_utilisees($serveur); |
|
| 44 | - ecrire_meta('langues_utilisees', $langues); |
|
| 45 | - } |
|
| 46 | - else { |
|
| 47 | - $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 48 | - if (!$langue_parent) |
|
| 49 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 50 | - $changer_lang = $langue_parent; |
|
| 51 | - $set['lang'] = $changer_lang; |
|
| 52 | - if (isset($set['langue_choisie'])){ |
|
| 53 | - $set['langue_choisie'] = 'non'; |
|
| 54 | - } |
|
| 55 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 56 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 57 | - include_spip('inc/rubriques'); |
|
| 58 | - calculer_langues_rubriques(); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - return $changer_lang; |
|
| 36 | + if ($changer_lang != "herit") { |
|
| 37 | + $set['lang'] = $changer_lang; |
|
| 38 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 39 | + include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 40 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 41 | + calculer_langues_rubriques(); |
|
| 42 | + } |
|
| 43 | + $langues = calculer_langues_utilisees($serveur); |
|
| 44 | + ecrire_meta('langues_utilisees', $langues); |
|
| 45 | + } |
|
| 46 | + else { |
|
| 47 | + $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 48 | + if (!$langue_parent) |
|
| 49 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 50 | + $changer_lang = $langue_parent; |
|
| 51 | + $set['lang'] = $changer_lang; |
|
| 52 | + if (isset($set['langue_choisie'])){ |
|
| 53 | + $set['langue_choisie'] = 'non'; |
|
| 54 | + } |
|
| 55 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 56 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 57 | + include_spip('inc/rubriques'); |
|
| 58 | + calculer_langues_rubriques(); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + return $changer_lang; |
|
| 63 | 63 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param string $serveur |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur='') { |
|
| 24 | +function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur = '') { |
|
| 25 | 25 | if ($changer_lang) { |
| 26 | 26 | $table_objet_sql = table_objet_sql($objet); |
| 27 | 27 | $id_table_objet = id_table_objet($objet); |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | $desc = $trouver_table($table_objet_sql, $serveur); |
| 30 | 30 | |
| 31 | 31 | $set = array(); |
| 32 | - if (isset($desc['field']['langue_choisie'])){ |
|
| 32 | + if (isset($desc['field']['langue_choisie'])) { |
|
| 33 | 33 | $set['langue_choisie'] = 'oui'; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | if ($changer_lang != "herit") { |
| 37 | 37 | $set['lang'] = $changer_lang; |
| 38 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 38 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=".intval($id), '', $serveur); |
|
| 39 | 39 | include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
| 40 | 40 | if ($table_objet_sql == 'spip_rubriques') { |
| 41 | 41 | calculer_langues_rubriques(); |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | ecrire_meta('langues_utilisees', $langues); |
| 45 | 45 | } |
| 46 | 46 | else { |
| 47 | - $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
|
| 47 | + $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=".intval($id_rubrique)); |
|
| 48 | 48 | if (!$langue_parent) |
| 49 | 49 | $langue_parent = $GLOBALS['meta']['langue_site']; |
| 50 | 50 | $changer_lang = $langue_parent; |
| 51 | 51 | $set['lang'] = $changer_lang; |
| 52 | - if (isset($set['langue_choisie'])){ |
|
| 52 | + if (isset($set['langue_choisie'])) { |
|
| 53 | 53 | $set['langue_choisie'] = 'non'; |
| 54 | 54 | } |
| 55 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur); |
|
| 55 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=".intval($id), '', $serveur); |
|
| 56 | 56 | if ($table_objet_sql == 'spip_rubriques') { |
| 57 | 57 | include_spip('inc/rubriques'); |
| 58 | 58 | calculer_langues_rubriques(); |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Modifier la langue d'un objet |
@@ -42,11 +44,11 @@ discard block |
||
| 42 | 44 | } |
| 43 | 45 | $langues = calculer_langues_utilisees($serveur); |
| 44 | 46 | ecrire_meta('langues_utilisees', $langues); |
| 45 | - } |
|
| 46 | - else { |
|
| 47 | + } else { |
|
| 47 | 48 | $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique)); |
| 48 | - if (!$langue_parent) |
|
| 49 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 49 | + if (!$langue_parent) { |
|
| 50 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 51 | + } |
|
| 50 | 52 | $changer_lang = $langue_parent; |
| 51 | 53 | $set['lang'] = $changer_lang; |
| 52 | 54 | if (isset($set['langue_choisie'])){ |
@@ -17,16 +17,16 @@ |
||
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | 19 | function action_forcer_job_dist(){ |
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 21 | - $id_job = $securiser_action(); |
|
| 20 | + $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 21 | + $id_job = $securiser_action(); |
|
| 22 | 22 | |
| 23 | - if ($id_job = intval($id_job) |
|
| 24 | - AND autoriser('forcer','job',$id_job) |
|
| 25 | - ){ |
|
| 26 | - include_spip('inc/queue'); |
|
| 27 | - include_spip('inc/genie'); |
|
| 28 | - queue_schedule(array($id_job)); |
|
| 29 | - } |
|
| 23 | + if ($id_job = intval($id_job) |
|
| 24 | + AND autoriser('forcer','job',$id_job) |
|
| 25 | + ){ |
|
| 26 | + include_spip('inc/queue'); |
|
| 27 | + include_spip('inc/genie'); |
|
| 28 | + queue_schedule(array($id_job)); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
@@ -16,13 +16,13 @@ |
||
| 16 | 16 | * Executer un travaille immediatement |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | -function action_forcer_job_dist(){ |
|
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 19 | +function action_forcer_job_dist() { |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | 21 | $id_job = $securiser_action(); |
| 22 | 22 | |
| 23 | 23 | if ($id_job = intval($id_job) |
| 24 | - AND autoriser('forcer','job',$id_job) |
|
| 25 | - ){ |
|
| 24 | + AND autoriser('forcer', 'job', $id_job) |
|
| 25 | + ) { |
|
| 26 | 26 | include_spip('inc/queue'); |
| 27 | 27 | include_spip('inc/genie'); |
| 28 | 28 | queue_schedule(array($id_job)); |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Executer un travaille immediatement |