@@ -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 | |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | ?> |
@@ -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 | include_spip('inc/texte'); |
@@ -27,8 +29,9 @@ discard block |
||
| 27 | 29 | exit; |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | - if ($date = intval(_request('date'))) |
|
| 31 | - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $date)." GMT"); |
|
| 32 | + if ($date = intval(_request('date'))) { |
|
| 33 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $date)." GMT"); |
|
| 34 | + } |
|
| 32 | 35 | |
| 33 | 36 | $r = gen_liste_rubriques(); |
| 34 | 37 | if (!$r |
@@ -61,7 +64,9 @@ discard block |
||
| 61 | 64 | |
| 62 | 65 | if ($i > 0) { |
| 63 | 66 | $nb_col = min(8,ceil($total_lignes / 30)); |
| 64 | - if ($nb_col <= 1) $nb_col = ceil($total_lignes / 10); |
|
| 67 | + if ($nb_col <= 1) { |
|
| 68 | + $nb_col = ceil($total_lignes / 10); |
|
| 69 | + } |
|
| 65 | 70 | foreach( $arr_low as $id_rubrique => $titre_rubrique) { |
| 66 | 71 | if (autoriser('voir','rubrique',$id_rubrique)){ |
| 67 | 72 | $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i); |
@@ -72,9 +77,9 @@ discard block |
||
| 72 | 77 | $ret = "<ul class='cols_$nb_col'>" |
| 73 | 78 | . $ret |
| 74 | 79 | . "\n</ul>\n"; |
| 80 | + } else { |
|
| 81 | + $ret = "<ul class='cols_1'>$ret\n</ul>\n"; |
|
| 75 | 82 | } |
| 76 | - else |
|
| 77 | - $ret = "<ul class='cols_1'>$ret\n</ul>\n"; |
|
| 78 | 83 | |
| 79 | 84 | return $ret; |
| 80 | 85 | } |
@@ -134,7 +139,10 @@ discard block |
||
| 134 | 139 | $last = lire_config('date_calcul_rubriques', 0); |
| 135 | 140 | if (lire_fichier(_CACHE_RUBRIQUES, $cache)) { |
| 136 | 141 | list($date,$GLOBALS['db_art_cache']) = @unserialize($cache); |
| 137 | - if ($date == $last) return false; // c'etait en cache :-) |
|
| 142 | + if ($date == $last) { |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 145 | + // c'etait en cache :-) |
|
| 138 | 146 | } |
| 139 | 147 | // se restreindre aux rubriques utilisees recemment +secteurs |
| 140 | 148 | |
@@ -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'])){ |
@@ -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_editer_auteur_dist |
| 16 | 18 | function action_editer_auteur_dist($arg=null) { |
@@ -31,20 +33,24 @@ discard block |
||
| 31 | 33 | # ils ont un id = 0-id_auteur de la session |
| 32 | 34 | $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
| 33 | 35 | $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
| 34 | - if (list($logo) = $chercher_logo($id_hack, 'id_auteur', 'on')) |
|
| 35 | - rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 36 | - if (list($logo) = $chercher_logo($id_hack, 'id_auteur', 'off')) |
|
| 37 | - rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 36 | + if (list($logo) = $chercher_logo($id_hack, 'id_auteur', 'on')) { |
|
| 37 | + rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 38 | + } |
|
| 39 | + if (list($logo) = $chercher_logo($id_hack, 'id_auteur', 'off')) { |
|
| 40 | + rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 41 | + } |
|
| 38 | 42 | } |
| 39 | 43 | } |
| 40 | 44 | |
| 41 | 45 | // Enregistre l'envoi dans la BD |
| 42 | 46 | $err = ""; |
| 43 | - if ($id_auteur > 0) |
|
| 44 | - $err = auteur_modifier($id_auteur); |
|
| 47 | + if ($id_auteur > 0) { |
|
| 48 | + $err = auteur_modifier($id_auteur); |
|
| 49 | + } |
|
| 45 | 50 | |
| 46 | - if ($err) |
|
| 47 | - spip_log("echec editeur auteur: $err",_LOG_ERREUR); |
|
| 51 | + if ($err) { |
|
| 52 | + spip_log("echec editeur auteur: $err",_LOG_ERREUR); |
|
| 53 | + } |
|
| 48 | 54 | |
| 49 | 55 | return array($id_auteur,$err); |
| 50 | 56 | } |
@@ -115,8 +121,9 @@ discard block |
||
| 115 | 121 | 'data' => $set, |
| 116 | 122 | 'nonvide' => array('nom' => _T('ecrire:item_nouvel_auteur')) |
| 117 | 123 | ), |
| 118 | - $c)) |
|
| 119 | - return $err; |
|
| 124 | + $c)) { |
|
| 125 | + return $err; |
|
| 126 | + } |
|
| 120 | 127 | $session = $c; |
| 121 | 128 | |
| 122 | 129 | $err = ''; |
@@ -132,10 +139,12 @@ discard block |
||
| 132 | 139 | // donnees eventuellement fournies |
| 133 | 140 | $set |
| 134 | 141 | ); |
| 135 | - if (isset($c['new_login']) AND !isset($c['login'])) |
|
| 136 | - $c['login'] = $c['new_login']; |
|
| 137 | - if (isset($c['new_pass']) AND !isset($c['pass'])) |
|
| 138 | - $c['pass'] = $c['new_pass']; |
|
| 142 | + if (isset($c['new_login']) AND !isset($c['login'])) { |
|
| 143 | + $c['login'] = $c['new_login']; |
|
| 144 | + } |
|
| 145 | + if (isset($c['new_pass']) AND !isset($c['pass'])) { |
|
| 146 | + $c['pass'] = $c['new_pass']; |
|
| 147 | + } |
|
| 139 | 148 | $err = auteur_instituer($id_auteur, $c); |
| 140 | 149 | $session = array_merge($session,$c); |
| 141 | 150 | } |
@@ -224,35 +233,41 @@ discard block |
||
| 224 | 233 | * @return bool|string |
| 225 | 234 | */ |
| 226 | 235 | function auteur_instituer($id_auteur, $c, $force_webmestre = false) { |
| 227 | - if (!$id_auteur=intval($id_auteur)) |
|
| 228 | - return false; |
|
| 236 | + if (!$id_auteur=intval($id_auteur)) { |
|
| 237 | + return false; |
|
| 238 | + } |
|
| 229 | 239 | $erreurs = array(); // contiendra les differentes erreurs a traduire par _T() |
| 230 | 240 | $champs = array(); |
| 231 | 241 | |
| 232 | 242 | // les memoriser pour les faire passer dans le pipeline pre_edition |
| 233 | - if (isset($c['login']) AND strlen($c['login'])) |
|
| 234 | - $champs['login'] = $c['login']; |
|
| 235 | - if (isset($c['pass']) AND strlen($c['pass'])) |
|
| 236 | - $champs['pass'] = $c['pass']; |
|
| 243 | + if (isset($c['login']) AND strlen($c['login'])) { |
|
| 244 | + $champs['login'] = $c['login']; |
|
| 245 | + } |
|
| 246 | + if (isset($c['pass']) AND strlen($c['pass'])) { |
|
| 247 | + $champs['pass'] = $c['pass']; |
|
| 248 | + } |
|
| 237 | 249 | |
| 238 | 250 | $statut = $statut_ancien = sql_getfetsel('statut','spip_auteurs','id_auteur='.intval($id_auteur)); |
| 239 | 251 | |
| 240 | 252 | if (isset($c['statut']) |
| 241 | - AND (autoriser('modifier', 'auteur', $id_auteur,null, array('statut' => $c['statut'])))) |
|
| 242 | - $statut = $champs['statut'] = $c['statut']; |
|
| 253 | + AND (autoriser('modifier', 'auteur', $id_auteur,null, array('statut' => $c['statut'])))) { |
|
| 254 | + $statut = $champs['statut'] = $c['statut']; |
|
| 255 | + } |
|
| 243 | 256 | |
| 244 | 257 | // Restreindre avant de declarer l'auteur |
| 245 | 258 | // (section critique sur les droits) |
| 246 | 259 | if ($c['id_parent']) { |
| 247 | - if (is_array($c['restreintes'])) |
|
| 248 | - $c['restreintes'][] = $c['id_parent']; |
|
| 249 | - else |
|
| 250 | - $c['restreintes'] = array($c['id_parent']); |
|
| 260 | + if (is_array($c['restreintes'])) { |
|
| 261 | + $c['restreintes'][] = $c['id_parent']; |
|
| 262 | + } else { |
|
| 263 | + $c['restreintes'] = array($c['id_parent']); |
|
| 264 | + } |
|
| 251 | 265 | } |
| 252 | 266 | |
| 253 | 267 | if (isset($c['webmestre']) |
| 254 | - AND ($force_webmestre OR autoriser('modifier', 'auteur', $id_auteur,null, array('webmestre' => '?')))) |
|
| 255 | - $champs['webmestre'] = $c['webmestre']=='oui'?'oui':'non'; |
|
| 268 | + AND ($force_webmestre OR autoriser('modifier', 'auteur', $id_auteur,null, array('webmestre' => '?')))) { |
|
| 269 | + $champs['webmestre'] = $c['webmestre']=='oui'?'oui':'non'; |
|
| 270 | + } |
|
| 256 | 271 | |
| 257 | 272 | // Envoyer aux plugins |
| 258 | 273 | $champs = pipeline('pre_edition', |
@@ -282,20 +297,24 @@ discard block |
||
| 282 | 297 | if (isset($champs['login']) OR isset($champs['pass'])){ |
| 283 | 298 | $auth_methode = sql_getfetsel('source','spip_auteurs','id_auteur='.intval($id_auteur)); |
| 284 | 299 | include_spip('inc/auth'); |
| 285 | - if (isset($champs['login']) AND strlen($champs['login'])) |
|
| 286 | - if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) |
|
| 300 | + if (isset($champs['login']) AND strlen($champs['login'])) { |
|
| 301 | + if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) |
|
| 287 | 302 | $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
| 303 | + } |
|
| 288 | 304 | if (isset($champs['pass']) AND strlen($champs['pass'])){ |
| 289 | 305 | $champs['login'] = sql_getfetsel('login','spip_auteurs','id_auteur='.intval($id_auteur)); |
| 290 | - if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) |
|
| 291 | - $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 306 | + if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 307 | + $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 308 | + } |
|
| 292 | 309 | } |
| 293 | 310 | unset($champs['login']); |
| 294 | 311 | unset($champs['pass']); |
| 295 | 312 | $flag_ecrire_acces = true; |
| 296 | 313 | } |
| 297 | 314 | |
| 298 | - if (!count($champs)) return implode(' ', array_map('_T', $erreurs)); |
|
| 315 | + if (!count($champs)) { |
|
| 316 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 317 | + } |
|
| 299 | 318 | sql_updateq('spip_auteurs', $champs , 'id_auteur='.$id_auteur); |
| 300 | 319 | |
| 301 | 320 | // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
@@ -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 |