@@ -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 | define('URLS_PAGE_EXEMPLE', 'spip.php?article12'); |
| 16 | 18 | |
@@ -30,13 +32,17 @@ discard block |
||
| 30 | 32 | |
| 31 | 33 | if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
| 32 | 34 | $url = $generer_url_externe($id, $args, $ancre); |
| 33 | - if (NULL != $url) return $url; |
|
| 35 | + if (NULL != $url) { |
|
| 36 | + return $url; |
|
| 37 | + } |
|
| 34 | 38 | } |
| 35 | 39 | |
| 36 | 40 | $url = _debut_urls_page . $type . _separateur_urls_page |
| 37 | 41 | . $id . _terminaison_urls_page; |
| 38 | 42 | |
| 39 | - if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 43 | + if ($args) { |
|
| 44 | + $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 45 | + } |
|
| 40 | 46 | return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
| 41 | 47 | } |
| 42 | 48 | |
@@ -45,8 +51,9 @@ discard block |
||
| 45 | 51 | // http://doc.spip.org/@urls_page_dist |
| 46 | 52 | function urls_page_dist($i, &$entite, $args='', $ancre='') |
| 47 | 53 | { |
| 48 | - if (is_numeric($i)) |
|
| 49 | - return _generer_url_page($entite, $i, $args, $ancre); |
|
| 54 | + if (is_numeric($i)) { |
|
| 55 | + return _generer_url_page($entite, $i, $args, $ancre); |
|
| 56 | + } |
|
| 50 | 57 | |
| 51 | 58 | // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
| 52 | 59 | if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
@@ -54,10 +61,11 @@ discard block |
||
| 54 | 61 | } |
| 55 | 62 | |
| 56 | 63 | // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
| 57 | - if (is_array($args)) |
|
| 58 | - $contexte = $args; |
|
| 59 | - else |
|
| 60 | - parse_str($args,$contexte); |
|
| 64 | + if (is_array($args)) { |
|
| 65 | + $contexte = $args; |
|
| 66 | + } else { |
|
| 67 | + parse_str($args,$contexte); |
|
| 68 | + } |
|
| 61 | 69 | include_spip('inc/urls'); |
| 62 | 70 | $r = nettoyer_url_page($i, $contexte); |
| 63 | 71 | if ($r) { |
@@ -83,10 +91,11 @@ discard block |
||
| 83 | 91 | : '' |
| 84 | 92 | )); |
| 85 | 93 | if ($url_propre) { |
| 86 | - if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | - $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 88 | - else |
|
| 89 | - $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 94 | + if ($GLOBALS['profondeur_url']<=0) { |
|
| 95 | + $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 96 | + } else { |
|
| 97 | + $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 98 | + } |
|
| 90 | 99 | return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
| 91 | 100 | } |
| 92 | 101 | /* Fin du bloc compatibilite url-propres */ |
@@ -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 | /** |
@@ -88,10 +90,12 @@ discard block |
||
| 88 | 90 | * @return bool |
| 89 | 91 | */ |
| 90 | 92 | public function valid() { |
| 91 | - if ($this->err) |
|
| 92 | - return false; |
|
| 93 | - if (!$this->firstseek) |
|
| 94 | - $this->next(); |
|
| 93 | + if ($this->err) { |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + if (!$this->firstseek) { |
|
| 97 | + $this->next(); |
|
| 98 | + } |
|
| 95 | 99 | return is_array($this->row); |
| 96 | 100 | } |
| 97 | 101 | |
@@ -150,8 +154,9 @@ discard block |
||
| 150 | 154 | if ($this->valid()) { |
| 151 | 155 | $r = $this->current(); |
| 152 | 156 | $this->next(); |
| 153 | - } else |
|
| 154 | - $r = false; |
|
| 157 | + } else { |
|
| 158 | + $r = false; |
|
| 159 | + } |
|
| 155 | 160 | return $r; |
| 156 | 161 | } |
| 157 | 162 | |
@@ -160,7 +165,9 @@ discard block |
||
| 160 | 165 | * @return bool |
| 161 | 166 | */ |
| 162 | 167 | public function free(){ |
| 163 | - if (!$this->sqlresult) return true; |
|
| 168 | + if (!$this->sqlresult) { |
|
| 169 | + return true; |
|
| 170 | + } |
|
| 164 | 171 | $a = sql_free($this->sqlresult, $this->command['connect']); |
| 165 | 172 | $this->sqlresult = null; |
| 166 | 173 | return $a; |
@@ -180,8 +187,9 @@ discard block |
||
| 180 | 187 | $this->valid(); |
| 181 | 188 | $s = $this->current(); |
| 182 | 189 | $this->total = $s['count(*)']; |
| 183 | - } else |
|
| 184 | - $this->total = sql_count($this->sqlresult, $this->command['connect']); |
|
| 190 | + } else { |
|
| 191 | + $this->total = sql_count($this->sqlresult, $this->command['connect']); |
|
| 192 | + } |
|
| 185 | 193 | } |
| 186 | 194 | } |
| 187 | 195 | return $this->total; |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 12 | 12 | \***************************************************************************/ |
| 13 | 13 | |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | // |
| 17 | 19 | // creer une boucle sur un iterateur |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | include_spip('iterateur/data'); |
| 17 | 19 | |
@@ -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 | // Diverses taches de maintenance |
| 16 | 18 | // http://doc.spip.org/@genie_maintenance_dist |
@@ -23,8 +25,9 @@ discard block |
||
| 23 | 25 | verifier_htaccess(_DIR_TMP); |
| 24 | 26 | |
| 25 | 27 | // Verifier qu'aucune table n'est crashee |
| 26 | - if (!_request('reinstall')) |
|
| 27 | - verifier_crash_tables(); |
|
| 28 | + if (!_request('reinstall')) { |
|
| 29 | + verifier_crash_tables(); |
|
| 30 | + } |
|
| 28 | 31 | |
| 29 | 32 | return 1; |
| 30 | 33 | } |
@@ -39,8 +42,10 @@ discard block |
||
| 39 | 42 | foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
| 40 | 43 | foreach ($GLOBALS[$com] as $table => $desc) { |
| 41 | 44 | if (!sql_select('*', $table,'','','', 1) |
| 42 | - AND !defined('spip_interdire_cache')) # cas "LOST CONNECTION" |
|
| 45 | + AND !defined('spip_interdire_cache')) { |
|
| 46 | + # cas "LOST CONNECTION" |
|
| 43 | 47 | $crash[] = $table; |
| 48 | + } |
|
| 44 | 49 | } |
| 45 | 50 | } |
| 46 | 51 | #$crash[] = 'test'; |
@@ -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 | * Verifier si une mise a jour est disponible |
@@ -53,11 +55,14 @@ discard block |
||
| 53 | 55 | list(, $maj2, $min2,, $rev2) = $v; |
| 54 | 56 | $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
| 55 | 57 | if ((spip_version_compare($version, $version_maj, '<')) |
| 56 | - AND (spip_version_compare($page, $version_maj, '<'))) |
|
| 57 | - $page = $version_maj; |
|
| 58 | + AND (spip_version_compare($page, $version_maj, '<'))) { |
|
| 59 | + $page = $version_maj; |
|
| 60 | + } |
|
| 58 | 61 | } |
| 59 | 62 | |
| 60 | - if (!$page) return ""; |
|
| 63 | + if (!$page) { |
|
| 64 | + return ""; |
|
| 65 | + } |
|
| 61 | 66 | return "<a class='info_maj_spip' href='"._VERSIONS_SERVEUR."$dir' title='$page'>" . |
| 62 | 67 | _T('nouvelle_version_spip',array('version'=>$page)) . |
| 63 | 68 | '</a>'; |
@@ -71,14 +76,18 @@ discard block |
||
| 71 | 76 | function info_maj_cache($nom, $dir, $page='') |
| 72 | 77 | { |
| 73 | 78 | $re = '<archives id="a' . $GLOBALS['meta']["alea_ephemere"] . '">'; |
| 74 | - if (preg_match("/$re/", $page)) return $page; |
|
| 79 | + if (preg_match("/$re/", $page)) { |
|
| 80 | + return $page; |
|
| 81 | + } |
|
| 75 | 82 | |
| 76 | 83 | $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
| 77 | 84 | $a = file_exists($nom) ? filemtime($nom) : ''; |
| 78 | 85 | include_spip('inc/distant'); |
| 79 | 86 | $res = recuperer_lapage($url, false, 'GET', _COPIE_LOCALE_MAX_SIZE, '',false, $a); |
| 80 | 87 | // Si rien de neuf (ou inaccessible), garder l'ancienne |
| 81 | - if ($res) list(, $page) = $res; |
|
| 88 | + if ($res) { |
|
| 89 | + list(, $page) = $res; |
|
| 90 | + } |
|
| 82 | 91 | // Placer l'indicateur de fraicheur |
| 83 | 92 | $page = preg_replace('/^<archives.*?>/', $re, $page); |
| 84 | 93 | sous_repertoire(_DIR_CACHE_XML); |
@@ -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 | * Envoi du Mail des nouveautes |
@@ -29,8 +31,9 @@ discard block |
||
| 29 | 31 | $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
| 30 | 32 | |
| 31 | 33 | $now = time(); |
| 32 | - if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) |
|
| 33 | - ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now - (3600 * 24 * $jours_neuf))); |
|
| 34 | + if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 35 | + ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now - (3600 * 24 * $jours_neuf))); |
|
| 36 | + } |
|
| 34 | 37 | |
| 35 | 38 | $page = recuperer_fond('nouveautes',array('date'=>$GLOBALS['meta']['dernier_envoi_neuf'],'jours_neuf'=>$jours_neuf),array('raw'=>true)); |
| 36 | 39 | |
@@ -38,16 +41,17 @@ discard block |
||
| 38 | 41 | // recuperer les entetes envoyes par #HTTP_HEADER |
| 39 | 42 | $headers = ""; |
| 40 | 43 | if (isset($page['entetes']) AND count($page['entetes'])){ |
| 41 | - foreach ($page['entetes'] as $k => $v) |
|
| 42 | - $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 44 | + foreach ($page['entetes'] as $k => $v) { |
|
| 45 | + $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 46 | + } |
|
| 43 | 47 | } |
| 44 | 48 | |
| 45 | 49 | include_spip("inc/notifications"); |
| 46 | 50 | notifications_envoyer_mails($adresse_neuf,$page['texte'],"","",$headers); |
| 47 | 51 | ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now)); |
| 52 | + } else { |
|
| 53 | + spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 48 | 54 | } |
| 49 | - else |
|
| 50 | - spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 51 | 55 | |
| 52 | 56 | return 1; |
| 53 | 57 | } |
@@ -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('base/abstract_sql'); |
| 16 | 18 | |
@@ -43,17 +45,20 @@ discard block |
||
| 43 | 45 | // on n'optimise qu'une seule table a chaque fois, |
| 44 | 46 | // pour ne pas vautrer le systeme |
| 45 | 47 | // lire http://dev.mysql.com/doc/refman/5.0/fr/optimize-table.html |
| 46 | - while ($row = sql_fetch($result)) |
|
| 47 | - $tables[] = array_shift($row); |
|
| 48 | + while ($row = sql_fetch($result)) { |
|
| 49 | + $tables[] = array_shift($row); |
|
| 50 | + } |
|
| 48 | 51 | |
| 49 | 52 | if ($tables) { |
| 50 | 53 | $table_op = intval($GLOBALS['meta']['optimiser_table']+1) % sizeof($tables); |
| 51 | 54 | ecrire_meta('optimiser_table', $table_op); |
| 52 | 55 | $q = $tables[$table_op]; |
| 53 | 56 | spip_log("debut d'optimisation de la table $q"); |
| 54 | - if (sql_optimize($q)) |
|
| 55 | - spip_log("fin d'optimisation de la table $q"); |
|
| 56 | - else spip_log("Pas d'optimiseur necessaire"); |
|
| 57 | + if (sql_optimize($q)) { |
|
| 58 | + spip_log("fin d'optimisation de la table $q"); |
|
| 59 | + } else { |
|
| 60 | + spip_log("Pas d'optimiseur necessaire"); |
|
| 61 | + } |
|
| 57 | 62 | } |
| 58 | 63 | } |
| 59 | 64 | |
@@ -68,7 +73,9 @@ discard block |
||
| 68 | 73 | function optimiser_sansref($table, $id, $sel, $and="") |
| 69 | 74 | { |
| 70 | 75 | $in = array(); |
| 71 | - while ($row = sql_fetch($sel)) $in[$row['id']]=true; |
|
| 76 | + while ($row = sql_fetch($sel)) { |
|
| 77 | + $in[$row['id']]=true; |
|
| 78 | + } |
|
| 72 | 79 | sql_free($sel); |
| 73 | 80 | |
| 74 | 81 | if ($in) { |
@@ -143,6 +150,8 @@ discard block |
||
| 143 | 150 | 'data'=>$n |
| 144 | 151 | )); |
| 145 | 152 | |
| 146 | - if (!$n) spip_log("Optimisation des tables: aucun lien mort"); |
|
| 147 | -} |
|
| 153 | + if (!$n) { |
|
| 154 | + spip_log("Optimisation des tables: aucun lien mort"); |
|
| 155 | + } |
|
| 156 | + } |
|
| 148 | 157 | ?> |
@@ -11,12 +11,16 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | define('_ESPACE_PRIVE', true); |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) include 'inc_version.php'; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + include 'inc_version.php'; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | // Verification anti magic_quotes_sybase, pour qui addslashes("'") = "''" |
| 17 | 19 | // On prefere la faire ici plutot que dans inc_version, c'est moins souvent et |
| 18 | 20 | // si le reglage est modifie sur un site en prod, ca fait moins mal |
| 19 | -if (addslashes("'") !== "\\'") die('SPIP incompatible magic_quotes_sybase'); |
|
| 21 | +if (addslashes("'") !== "\\'") { |
|
| 22 | + die('SPIP incompatible magic_quotes_sybase'); |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | include_spip('inc/cookie'); |
| 22 | 26 | |
@@ -31,7 +35,9 @@ discard block |
||
| 31 | 35 | // alors il faut blinder les variables d'URL |
| 32 | 36 | // |
| 33 | 37 | if (autoriser_sans_cookie($exec)) { |
| 34 | - if (!isset($reinstall)) $reinstall = 'non'; |
|
| 38 | + if (!isset($reinstall)) { |
|
| 39 | + $reinstall = 'non'; |
|
| 40 | + } |
|
| 35 | 41 | set_request('transformer_xml'); |
| 36 | 42 | $var_auth = true; |
| 37 | 43 | } else { |
@@ -62,8 +68,10 @@ discard block |
||
| 62 | 68 | traiter_appels_inclusions_ajax() |
| 63 | 69 | OR |
| 64 | 70 | // cas des formulaires charger/verifier/traiter |
| 65 | - traiter_formulaires_dynamiques()) |
|
| 66 | - exit; // le hit est fini ! |
|
| 71 | + traiter_formulaires_dynamiques()) { |
|
| 72 | + exit; |
|
| 73 | + } |
|
| 74 | + // le hit est fini ! |
|
| 67 | 75 | } |
| 68 | 76 | // securiser les redirect du back-office |
| 69 | 77 | if (_request('redirect')) { |
@@ -82,8 +90,9 @@ discard block |
||
| 82 | 90 | if (!$reinstall=='oui' |
| 83 | 91 | AND !_AJAX |
| 84 | 92 | AND isset($GLOBALS['meta']['version_installee']) |
| 85 | -AND ($GLOBALS['spip_version_base'] != (str_replace(',','.',$GLOBALS['meta']['version_installee'])))) |
|
| 93 | +AND ($GLOBALS['spip_version_base'] != (str_replace(',','.',$GLOBALS['meta']['version_installee'])))) { |
|
| 86 | 94 | $exec = 'demande_mise_a_jour'; |
| 95 | +} |
|
| 87 | 96 | |
| 88 | 97 | // Quand une action d'administration est en cours (meta "admin"), |
| 89 | 98 | // refuser les connexions non-admin ou Ajax pour laisser la base intacte. |
@@ -92,8 +101,9 @@ discard block |
||
| 92 | 101 | // sinon c'est qu'elle a ete interrompue et il faut la reprendre |
| 93 | 102 | |
| 94 | 103 | elseif (isset($GLOBALS['meta']["admin"])) { |
| 95 | - if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']["admin"], $l)) |
|
| 96 | - list(,$var_f,$n) = $l; |
|
| 104 | + if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']["admin"], $l)) { |
|
| 105 | + list(,$var_f,$n) = $l; |
|
| 106 | + } |
|
| 97 | 107 | if (_AJAX |
| 98 | 108 | OR !( |
| 99 | 109 | isset($_COOKIE['spip_admin']) |
@@ -108,8 +118,9 @@ discard block |
||
| 108 | 118 | } |
| 109 | 119 | if ($n) { |
| 110 | 120 | list(,$var_f,$n) = $l; |
| 111 | - if (tester_url_ecrire("base_$var_f")) |
|
| 112 | - $var_f = "base_$var_f"; |
|
| 121 | + if (tester_url_ecrire("base_$var_f")) { |
|
| 122 | + $var_f = "base_$var_f"; |
|
| 123 | + } |
|
| 113 | 124 | if ($var_f != $exec) { |
| 114 | 125 | spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec"); |
| 115 | 126 | $exec = $var_f; |
@@ -150,8 +161,7 @@ discard block |
||
| 150 | 161 | if ($var_f = tester_url_ecrire($exec)) { |
| 151 | 162 | $var_f = charger_fonction ($var_f); |
| 152 | 163 | $var_f(); // at last |
| 153 | -} |
|
| 154 | -else { |
|
| 164 | +} else { |
|
| 155 | 165 | // Rien de connu: rerouter vers exec=404 au lieu d'echouer |
| 156 | 166 | // ce qui permet de laisser la main a un plugin |
| 157 | 167 | $var_f = charger_fonction('404'); |