@@ -18,22 +18,22 @@ |
||
| 18 | 18 | // annonce au compilo les "champs" disponibles |
| 19 | 19 | // |
| 20 | 20 | function iterateur_php_dist($b, $iteratorName) { |
| 21 | - $b->iterateur = $iteratorName; # designe la classe d'iterateur |
|
| 22 | - $b->show = array( |
|
| 23 | - 'field' => array( |
|
| 24 | - 'cle' => 'STRING', |
|
| 25 | - 'valeur' => 'STRING', |
|
| 26 | - ) |
|
| 27 | - ); |
|
| 28 | - foreach (get_class_methods($iteratorName) as $method) { |
|
| 29 | - $b->show['field'][ strtolower($method) ] = 'METHOD'; |
|
| 30 | - } |
|
| 31 | - /* |
|
| 21 | + $b->iterateur = $iteratorName; # designe la classe d'iterateur |
|
| 22 | + $b->show = array( |
|
| 23 | + 'field' => array( |
|
| 24 | + 'cle' => 'STRING', |
|
| 25 | + 'valeur' => 'STRING', |
|
| 26 | + ) |
|
| 27 | + ); |
|
| 28 | + foreach (get_class_methods($iteratorName) as $method) { |
|
| 29 | + $b->show['field'][ strtolower($method) ] = 'METHOD'; |
|
| 30 | + } |
|
| 31 | + /* |
|
| 32 | 32 | foreach (get_class_vars($iteratorName) as $property) { |
| 33 | 33 | $b->show['field'][ strtolower($property) ] = 'PROPERTY'; |
| 34 | 34 | } |
| 35 | 35 | */ |
| 36 | - return $b; |
|
| 36 | + return $b; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | ) |
| 27 | 27 | ); |
| 28 | 28 | foreach (get_class_methods($iteratorName) as $method) { |
| 29 | - $b->show['field'][ strtolower($method) ] = 'METHOD'; |
|
| 29 | + $b->show['field'][strtolower($method)] = 'METHOD'; |
|
| 30 | 30 | } |
| 31 | 31 | /* |
| 32 | 32 | foreach (get_class_vars($iteratorName) as $property) { |
@@ -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 |
@@ -21,13 +21,13 @@ |
||
| 21 | 21 | // annonce au compilo les "champs" disponibles |
| 22 | 22 | // |
| 23 | 23 | function iterateur_POUR_dist($b) { |
| 24 | - $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 25 | - $b->show = array( |
|
| 26 | - 'field' => array( |
|
| 27 | - 'cle' => 'STRING', |
|
| 28 | - 'valeur' => 'STRING', |
|
| 29 | - ) |
|
| 30 | - ); |
|
| 31 | - return $b; |
|
| 24 | + $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 25 | + $b->show = array( |
|
| 26 | + 'field' => array( |
|
| 27 | + 'cle' => 'STRING', |
|
| 28 | + 'valeur' => 'STRING', |
|
| 29 | + ) |
|
| 30 | + ); |
|
| 31 | + return $b; |
|
| 32 | 32 | } |
| 33 | 33 | |
@@ -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 | |
@@ -20,16 +20,16 @@ |
||
| 20 | 20 | // annonce au compilo les "champs" disponibles |
| 21 | 21 | // |
| 22 | 22 | function iterateur_CONDITION_dist($b) { |
| 23 | - $b->iterateur = 'CONDITION'; # designe la classe d'iterateur |
|
| 24 | - $b->show = array( |
|
| 25 | - 'field' => array() |
|
| 26 | - ); |
|
| 27 | - return $b; |
|
| 23 | + $b->iterateur = 'CONDITION'; # designe la classe d'iterateur |
|
| 24 | + $b->show = array( |
|
| 25 | + 'field' => array() |
|
| 26 | + ); |
|
| 27 | + return $b; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | class IterateurCONDITION extends IterateurData { |
| 32 | - protected function select($command) { |
|
| 33 | - $this->tableau = array(0=>1); |
|
| 34 | - } |
|
| 32 | + protected function select($command) { |
|
| 33 | + $this->tableau = array(0=>1); |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -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 | |
@@ -16,59 +16,59 @@ |
||
| 16 | 16 | // http://doc.spip.org/@genie_maintenance_dist |
| 17 | 17 | function genie_maintenance_dist ($t) { |
| 18 | 18 | |
| 19 | - // (re)mettre .htaccess avec deny from all |
|
| 20 | - // dans les deux repertoires dits inaccessibles par http |
|
| 21 | - include_spip('inc/acces'); |
|
| 22 | - verifier_htaccess(_DIR_ETC); |
|
| 23 | - verifier_htaccess(_DIR_TMP); |
|
| 19 | + // (re)mettre .htaccess avec deny from all |
|
| 20 | + // dans les deux repertoires dits inaccessibles par http |
|
| 21 | + include_spip('inc/acces'); |
|
| 22 | + verifier_htaccess(_DIR_ETC); |
|
| 23 | + verifier_htaccess(_DIR_TMP); |
|
| 24 | 24 | |
| 25 | - // Verifier qu'aucune table n'est crashee |
|
| 26 | - if (!_request('reinstall')) |
|
| 27 | - verifier_crash_tables(); |
|
| 25 | + // Verifier qu'aucune table n'est crashee |
|
| 26 | + if (!_request('reinstall')) |
|
| 27 | + verifier_crash_tables(); |
|
| 28 | 28 | |
| 29 | - return 1; |
|
| 29 | + return 1; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | // http://doc.spip.org/@verifier_crash_tables |
| 34 | 34 | function verifier_crash_tables() { |
| 35 | - if (spip_connect()) { |
|
| 36 | - include_spip('base/serial'); |
|
| 37 | - include_spip('base/auxiliaires'); |
|
| 38 | - $crash = array(); |
|
| 39 | - foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
|
| 40 | - foreach ($GLOBALS[$com] as $table => $desc) { |
|
| 41 | - if (!sql_select('*', $table,'','','', 1) |
|
| 42 | - AND !defined('spip_interdire_cache')) # cas "LOST CONNECTION" |
|
| 43 | - $crash[] = $table; |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - #$crash[] = 'test'; |
|
| 47 | - if ($crash) { |
|
| 48 | - ecrire_meta('message_crash_tables', serialize($crash)); |
|
| 49 | - spip_log('crash des tables', 'err'); |
|
| 50 | - spip_log($crash, 'err'); |
|
| 51 | - } else { |
|
| 52 | - effacer_meta('message_crash_tables'); |
|
| 53 | - } |
|
| 35 | + if (spip_connect()) { |
|
| 36 | + include_spip('base/serial'); |
|
| 37 | + include_spip('base/auxiliaires'); |
|
| 38 | + $crash = array(); |
|
| 39 | + foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
|
| 40 | + foreach ($GLOBALS[$com] as $table => $desc) { |
|
| 41 | + if (!sql_select('*', $table,'','','', 1) |
|
| 42 | + AND !defined('spip_interdire_cache')) # cas "LOST CONNECTION" |
|
| 43 | + $crash[] = $table; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + #$crash[] = 'test'; |
|
| 47 | + if ($crash) { |
|
| 48 | + ecrire_meta('message_crash_tables', serialize($crash)); |
|
| 49 | + spip_log('crash des tables', 'err'); |
|
| 50 | + spip_log($crash, 'err'); |
|
| 51 | + } else { |
|
| 52 | + effacer_meta('message_crash_tables'); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return $crash; |
|
| 56 | - } |
|
| 55 | + return $crash; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - return false; |
|
| 58 | + return false; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // http://doc.spip.org/@message_crash_tables |
| 62 | 62 | function message_crash_tables() { |
| 63 | - if ($crash = verifier_crash_tables()) { |
|
| 64 | - return |
|
| 65 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 66 | - . ' <tt>'.join(', ', $crash).'</tt><br />' |
|
| 67 | - . generer_form_ecrire('base_repair', |
|
| 68 | - _T('texte_crash_base'), '', |
|
| 69 | - _T('bouton_tenter_recuperation')) |
|
| 70 | - ; |
|
| 71 | - } |
|
| 63 | + if ($crash = verifier_crash_tables()) { |
|
| 64 | + return |
|
| 65 | + '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 66 | + . ' <tt>'.join(', ', $crash).'</tt><br />' |
|
| 67 | + . generer_form_ecrire('base_repair', |
|
| 68 | + _T('texte_crash_base'), '', |
|
| 69 | + _T('bouton_tenter_recuperation')) |
|
| 70 | + ; |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | ?> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // Diverses taches de maintenance |
| 16 | 16 | // http://doc.spip.org/@genie_maintenance_dist |
| 17 | -function genie_maintenance_dist ($t) { |
|
| 17 | +function genie_maintenance_dist($t) { |
|
| 18 | 18 | |
| 19 | 19 | // (re)mettre .htaccess avec deny from all |
| 20 | 20 | // dans les deux repertoires dits inaccessibles par http |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $crash = array(); |
| 39 | 39 | foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
| 40 | 40 | foreach ($GLOBALS[$com] as $table => $desc) { |
| 41 | - if (!sql_select('*', $table,'','','', 1) |
|
| 41 | + if (!sql_select('*', $table, '', '', '', 1) |
|
| 42 | 42 | AND !defined('spip_interdire_cache')) # cas "LOST CONNECTION" |
| 43 | 43 | $crash[] = $table; |
| 44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | function message_crash_tables() { |
| 63 | 63 | if ($crash = verifier_crash_tables()) { |
| 64 | 64 | return |
| 65 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 65 | + '<strong>'._T('texte_recuperer_base').'</strong><br />' |
|
| 66 | 66 | . ' <tt>'.join(', ', $crash).'</tt><br />' |
| 67 | 67 | . generer_form_ecrire('base_repair', |
| 68 | 68 | _T('texte_crash_base'), '', |
@@ -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'; |
@@ -25,31 +25,31 @@ |
||
| 25 | 25 | * @return int |
| 26 | 26 | */ |
| 27 | 27 | function genie_mail_dist($t) { |
| 28 | - $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 29 | - $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 30 | - |
|
| 31 | - $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 | - |
|
| 35 | - $page = recuperer_fond('nouveautes',array('date'=>$GLOBALS['meta']['dernier_envoi_neuf'],'jours_neuf'=>$jours_neuf),array('raw'=>true)); |
|
| 36 | - |
|
| 37 | - if (strlen(trim($page['texte']))){ |
|
| 38 | - // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 39 | - $headers = ""; |
|
| 40 | - if (isset($page['entetes']) AND count($page['entetes'])){ |
|
| 41 | - foreach ($page['entetes'] as $k => $v) |
|
| 42 | - $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - include_spip("inc/notifications"); |
|
| 46 | - notifications_envoyer_mails($adresse_neuf,$page['texte'],"","",$headers); |
|
| 47 | - ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now)); |
|
| 48 | - } |
|
| 49 | - else |
|
| 50 | - spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 51 | - |
|
| 52 | - return 1; |
|
| 28 | + $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 29 | + $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 30 | + |
|
| 31 | + $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 | + |
|
| 35 | + $page = recuperer_fond('nouveautes',array('date'=>$GLOBALS['meta']['dernier_envoi_neuf'],'jours_neuf'=>$jours_neuf),array('raw'=>true)); |
|
| 36 | + |
|
| 37 | + if (strlen(trim($page['texte']))){ |
|
| 38 | + // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 39 | + $headers = ""; |
|
| 40 | + if (isset($page['entetes']) AND count($page['entetes'])){ |
|
| 41 | + foreach ($page['entetes'] as $k => $v) |
|
| 42 | + $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + include_spip("inc/notifications"); |
|
| 46 | + notifications_envoyer_mails($adresse_neuf,$page['texte'],"","",$headers); |
|
| 47 | + ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now)); |
|
| 48 | + } |
|
| 49 | + else |
|
| 50 | + spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 51 | + |
|
| 52 | + return 1; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | ?> |
@@ -30,21 +30,21 @@ |
||
| 30 | 30 | |
| 31 | 31 | $now = time(); |
| 32 | 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))); |
|
| 33 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 34 | 34 | |
| 35 | - $page = recuperer_fond('nouveautes',array('date'=>$GLOBALS['meta']['dernier_envoi_neuf'],'jours_neuf'=>$jours_neuf),array('raw'=>true)); |
|
| 35 | + $page = recuperer_fond('nouveautes', array('date'=>$GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf'=>$jours_neuf), array('raw'=>true)); |
|
| 36 | 36 | |
| 37 | - if (strlen(trim($page['texte']))){ |
|
| 37 | + if (strlen(trim($page['texte']))) { |
|
| 38 | 38 | // recuperer les entetes envoyes par #HTTP_HEADER |
| 39 | 39 | $headers = ""; |
| 40 | - if (isset($page['entetes']) AND count($page['entetes'])){ |
|
| 40 | + if (isset($page['entetes']) AND count($page['entetes'])) { |
|
| 41 | 41 | foreach ($page['entetes'] as $k => $v) |
| 42 | - $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 42 | + $headers .= (strlen($v) ? "$k: $v" : $k)."\n"; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | include_spip("inc/notifications"); |
| 46 | - notifications_envoyer_mails($adresse_neuf,$page['texte'],"","",$headers); |
|
| 47 | - ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now)); |
|
| 46 | + notifications_envoyer_mails($adresse_neuf, $page['texte'], "", "", $headers); |
|
| 47 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 48 | 48 | } |
| 49 | 49 | else |
| 50 | 50 | spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
@@ -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 | } |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | // alors il faut blinder les variables d'URL |
| 32 | 32 | // |
| 33 | 33 | if (autoriser_sans_cookie($exec)) { |
| 34 | - if (!isset($reinstall)) $reinstall = 'non'; |
|
| 35 | - set_request('transformer_xml'); |
|
| 36 | - $var_auth = true; |
|
| 34 | + if (!isset($reinstall)) $reinstall = 'non'; |
|
| 35 | + set_request('transformer_xml'); |
|
| 36 | + $var_auth = true; |
|
| 37 | 37 | } else { |
| 38 | - // Authentification, redefinissable |
|
| 39 | - $auth = charger_fonction('auth', 'inc'); |
|
| 40 | - $var_auth = $auth(); |
|
| 41 | - if ($var_auth) { |
|
| 42 | - echo auth_echec($var_auth); |
|
| 43 | - exit; |
|
| 44 | - } |
|
| 45 | - } |
|
| 38 | + // Authentification, redefinissable |
|
| 39 | + $auth = charger_fonction('auth', 'inc'); |
|
| 40 | + $var_auth = $auth(); |
|
| 41 | + if ($var_auth) { |
|
| 42 | + echo auth_echec($var_auth); |
|
| 43 | + exit; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | // initialiser a la langue par defaut |
| 48 | 48 | include_spip('inc/lang'); |
@@ -52,25 +52,25 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | if (_request('action') OR _request('var_ajax') OR _request('formulaire_action')){ |
| 55 | - // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires |
|
| 56 | - include_spip('public/aiguiller'); |
|
| 57 | - if ( |
|
| 58 | - // cas des appels actions ?action=xxx |
|
| 59 | - traiter_appels_actions() |
|
| 60 | - OR |
|
| 61 | - // cas des hits ajax sur les inclusions ajax |
|
| 62 | - traiter_appels_inclusions_ajax() |
|
| 63 | - OR |
|
| 64 | - // cas des formulaires charger/verifier/traiter |
|
| 65 | - traiter_formulaires_dynamiques()) |
|
| 66 | - exit; // le hit est fini ! |
|
| 55 | + // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires |
|
| 56 | + include_spip('public/aiguiller'); |
|
| 57 | + if ( |
|
| 58 | + // cas des appels actions ?action=xxx |
|
| 59 | + traiter_appels_actions() |
|
| 60 | + OR |
|
| 61 | + // cas des hits ajax sur les inclusions ajax |
|
| 62 | + traiter_appels_inclusions_ajax() |
|
| 63 | + OR |
|
| 64 | + // cas des formulaires charger/verifier/traiter |
|
| 65 | + traiter_formulaires_dynamiques()) |
|
| 66 | + exit; // le hit est fini ! |
|
| 67 | 67 | } |
| 68 | 68 | // securiser les redirect du back-office |
| 69 | 69 | if (_request('redirect')) { |
| 70 | - if (!function_exists('securiser_redirect_action')){ |
|
| 71 | - include_spip('public/aiguiller'); |
|
| 72 | - } |
|
| 73 | - set_request('redirect',securiser_redirect_action(_request('redirect'))); |
|
| 70 | + if (!function_exists('securiser_redirect_action')){ |
|
| 71 | + include_spip('public/aiguiller'); |
|
| 72 | + } |
|
| 73 | + set_request('redirect',securiser_redirect_action(_request('redirect'))); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | AND !_AJAX |
| 84 | 84 | AND isset($GLOBALS['meta']['version_installee']) |
| 85 | 85 | AND ($GLOBALS['spip_version_base'] != (str_replace(',','.',$GLOBALS['meta']['version_installee'])))) |
| 86 | - $exec = 'demande_mise_a_jour'; |
|
| 86 | + $exec = 'demande_mise_a_jour'; |
|
| 87 | 87 | |
| 88 | 88 | // Quand une action d'administration est en cours (meta "admin"), |
| 89 | 89 | // refuser les connexions non-admin ou Ajax pour laisser la base intacte. |
@@ -92,42 +92,42 @@ discard block |
||
| 92 | 92 | // sinon c'est qu'elle a ete interrompue et il faut la reprendre |
| 93 | 93 | |
| 94 | 94 | elseif (isset($GLOBALS['meta']["admin"])) { |
| 95 | - if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']["admin"], $l)) |
|
| 96 | - list(,$var_f,$n) = $l; |
|
| 97 | - if (_AJAX |
|
| 98 | - OR !( |
|
| 99 | - isset($_COOKIE['spip_admin']) |
|
| 100 | - OR (isset($GLOBALS['visiteur_session']) AND $GLOBALS['visiteur_session']['statut']=='0minirezo') |
|
| 101 | - ) |
|
| 102 | - ) { |
|
| 103 | - spip_log("Quand la meta admin vaut " . |
|
| 104 | - $GLOBALS['meta']["admin"] . |
|
| 105 | - " seul un admin peut se connecter et sans AJAX." . |
|
| 106 | - " En cas de probleme, detruire cette meta."); |
|
| 107 | - die(_T('info_travaux_texte')); |
|
| 108 | - } |
|
| 109 | - if ($n) { |
|
| 110 | - list(,$var_f,$n) = $l; |
|
| 111 | - if (tester_url_ecrire("base_$var_f")) |
|
| 112 | - $var_f = "base_$var_f"; |
|
| 113 | - if ($var_f != $exec) { |
|
| 114 | - spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec"); |
|
| 115 | - $exec = $var_f; |
|
| 116 | - set_request('exec', $exec); |
|
| 117 | - } |
|
| 118 | - } |
|
| 95 | + if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']["admin"], $l)) |
|
| 96 | + list(,$var_f,$n) = $l; |
|
| 97 | + if (_AJAX |
|
| 98 | + OR !( |
|
| 99 | + isset($_COOKIE['spip_admin']) |
|
| 100 | + OR (isset($GLOBALS['visiteur_session']) AND $GLOBALS['visiteur_session']['statut']=='0minirezo') |
|
| 101 | + ) |
|
| 102 | + ) { |
|
| 103 | + spip_log("Quand la meta admin vaut " . |
|
| 104 | + $GLOBALS['meta']["admin"] . |
|
| 105 | + " seul un admin peut se connecter et sans AJAX." . |
|
| 106 | + " En cas de probleme, detruire cette meta."); |
|
| 107 | + die(_T('info_travaux_texte')); |
|
| 108 | + } |
|
| 109 | + if ($n) { |
|
| 110 | + list(,$var_f,$n) = $l; |
|
| 111 | + if (tester_url_ecrire("base_$var_f")) |
|
| 112 | + $var_f = "base_$var_f"; |
|
| 113 | + if ($var_f != $exec) { |
|
| 114 | + spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec"); |
|
| 115 | + $exec = $var_f; |
|
| 116 | + set_request('exec', $exec); |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | 119 | } |
| 120 | 120 | // si nom pas plausible, prendre le script par defaut |
| 121 | 121 | // attention aux deux cas 404/403 qui commencent par un 4 ! |
| 122 | 122 | elseif (!preg_match(',^[a-z4_][0-9a-z_-]*$,i', $exec)) { |
| 123 | - $exec = "accueil"; |
|
| 124 | - set_request('exec', $exec); |
|
| 123 | + $exec = "accueil"; |
|
| 124 | + set_request('exec', $exec); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // compatibilite ascendante : obsolete, ne plus utiliser |
| 128 | 128 | $GLOBALS['spip_display'] = isset($GLOBALS['visiteur_session']['prefs']['display']) |
| 129 | - ? $GLOBALS['visiteur_session']['prefs']['display'] |
|
| 130 | - : 0; |
|
| 129 | + ? $GLOBALS['visiteur_session']['prefs']['display'] |
|
| 130 | + : 0; |
|
| 131 | 131 | $GLOBALS['spip_ecran'] = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : "etroit"; |
| 132 | 132 | |
| 133 | 133 | // si la langue est specifiee par cookie et ne correspond pas |
@@ -136,26 +136,26 @@ discard block |
||
| 136 | 136 | // si le cookie n'est pas pose correctement dans l'action |
| 137 | 137 | if (!$var_auth AND isset($_COOKIE['spip_lang_ecrire']) |
| 138 | 138 | AND $_COOKIE['spip_lang_ecrire'] <> $GLOBALS['visiteur_session']['lang']) { |
| 139 | - include_spip('action/converser'); |
|
| 140 | - action_converser_post($GLOBALS['visiteur_session']['lang'],true); |
|
| 139 | + include_spip('action/converser'); |
|
| 140 | + action_converser_post($GLOBALS['visiteur_session']['lang'],true); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | // Passer la main aux outils XML a la demande (meme les redac s'ils veulent). |
| 145 | 145 | // mais seulement si on a bien ete auhentifie |
| 146 | 146 | if ($var_f = _request('transformer_xml')) { |
| 147 | - set_request('var_url', $exec); |
|
| 148 | - $exec = $var_f; |
|
| 147 | + set_request('var_url', $exec); |
|
| 148 | + $exec = $var_f; |
|
| 149 | 149 | } |
| 150 | 150 | if ($var_f = tester_url_ecrire($exec)) { |
| 151 | - $var_f = charger_fonction ($var_f); |
|
| 152 | - $var_f(); // at last |
|
| 151 | + $var_f = charger_fonction ($var_f); |
|
| 152 | + $var_f(); // at last |
|
| 153 | 153 | } |
| 154 | 154 | else { |
| 155 | - // Rien de connu: rerouter vers exec=404 au lieu d'echouer |
|
| 156 | - // ce qui permet de laisser la main a un plugin |
|
| 157 | - $var_f = charger_fonction('404'); |
|
| 158 | - $var_f($exec); |
|
| 155 | + // Rien de connu: rerouter vers exec=404 au lieu d'echouer |
|
| 156 | + // ce qui permet de laisser la main a un plugin |
|
| 157 | + $var_f = charger_fonction('404'); |
|
| 158 | + $var_f($exec); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | ?> |
@@ -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'); |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | // Determiner l'action demandee |
| 25 | 25 | // |
| 26 | 26 | |
| 27 | -$exec = (string)_request('exec'); |
|
| 28 | -$reinstall = (!is_null(_request('reinstall')))?_request('reinstall'):($exec=='install'?'oui':NULL); |
|
| 27 | +$exec = (string) _request('exec'); |
|
| 28 | +$reinstall = (!is_null(_request('reinstall'))) ?_request('reinstall') : ($exec == 'install' ? 'oui' : NULL); |
|
| 29 | 29 | // |
| 30 | 30 | // Les scripts d'insallation n'authentifient pas, forcement, |
| 31 | 31 | // alors il faut blinder les variables d'URL |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $forcer_lang = true; |
| 52 | 52 | |
| 53 | 53 | |
| 54 | -if (_request('action') OR _request('var_ajax') OR _request('formulaire_action')){ |
|
| 54 | +if (_request('action') OR _request('var_ajax') OR _request('formulaire_action')) { |
|
| 55 | 55 | // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires |
| 56 | 56 | include_spip('public/aiguiller'); |
| 57 | 57 | if ( |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | // securiser les redirect du back-office |
| 69 | 69 | if (_request('redirect')) { |
| 70 | - if (!function_exists('securiser_redirect_action')){ |
|
| 70 | + if (!function_exists('securiser_redirect_action')) { |
|
| 71 | 71 | include_spip('public/aiguiller'); |
| 72 | 72 | } |
| 73 | - set_request('redirect',securiser_redirect_action(_request('redirect'))); |
|
| 73 | + set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | // |
| 80 | 80 | |
| 81 | 81 | // Controle de la version, sauf si on est deja en train de s'en occuper |
| 82 | -if (!$reinstall=='oui' |
|
| 82 | +if (!$reinstall == 'oui' |
|
| 83 | 83 | AND !_AJAX |
| 84 | 84 | AND isset($GLOBALS['meta']['version_installee']) |
| 85 | -AND ($GLOBALS['spip_version_base'] != (str_replace(',','.',$GLOBALS['meta']['version_installee'])))) |
|
| 85 | +AND ($GLOBALS['spip_version_base'] != (str_replace(',', '.', $GLOBALS['meta']['version_installee'])))) |
|
| 86 | 86 | $exec = 'demande_mise_a_jour'; |
| 87 | 87 | |
| 88 | 88 | // Quand une action d'administration est en cours (meta "admin"), |
@@ -93,21 +93,21 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | elseif (isset($GLOBALS['meta']["admin"])) { |
| 95 | 95 | if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']["admin"], $l)) |
| 96 | - list(,$var_f,$n) = $l; |
|
| 96 | + list(,$var_f, $n) = $l; |
|
| 97 | 97 | if (_AJAX |
| 98 | 98 | OR !( |
| 99 | 99 | isset($_COOKIE['spip_admin']) |
| 100 | - OR (isset($GLOBALS['visiteur_session']) AND $GLOBALS['visiteur_session']['statut']=='0minirezo') |
|
| 100 | + OR (isset($GLOBALS['visiteur_session']) AND $GLOBALS['visiteur_session']['statut'] == '0minirezo') |
|
| 101 | 101 | ) |
| 102 | 102 | ) { |
| 103 | - spip_log("Quand la meta admin vaut " . |
|
| 104 | - $GLOBALS['meta']["admin"] . |
|
| 105 | - " seul un admin peut se connecter et sans AJAX." . |
|
| 103 | + spip_log("Quand la meta admin vaut ". |
|
| 104 | + $GLOBALS['meta']["admin"]. |
|
| 105 | + " seul un admin peut se connecter et sans AJAX.". |
|
| 106 | 106 | " En cas de probleme, detruire cette meta."); |
| 107 | 107 | die(_T('info_travaux_texte')); |
| 108 | 108 | } |
| 109 | 109 | if ($n) { |
| 110 | - list(,$var_f,$n) = $l; |
|
| 110 | + list(,$var_f, $n) = $l; |
|
| 111 | 111 | if (tester_url_ecrire("base_$var_f")) |
| 112 | 112 | $var_f = "base_$var_f"; |
| 113 | 113 | if ($var_f != $exec) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if (!$var_auth AND isset($_COOKIE['spip_lang_ecrire']) |
| 138 | 138 | AND $_COOKIE['spip_lang_ecrire'] <> $GLOBALS['visiteur_session']['lang']) { |
| 139 | 139 | include_spip('action/converser'); |
| 140 | - action_converser_post($GLOBALS['visiteur_session']['lang'],true); |
|
| 140 | + action_converser_post($GLOBALS['visiteur_session']['lang'], true); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $exec = $var_f; |
| 149 | 149 | } |
| 150 | 150 | if ($var_f = tester_url_ecrire($exec)) { |
| 151 | - $var_f = charger_fonction ($var_f); |
|
| 151 | + $var_f = charger_fonction($var_f); |
|
| 152 | 152 | $var_f(); // at last |
| 153 | 153 | } |
| 154 | 154 | else { |
@@ -16,31 +16,31 @@ |
||
| 16 | 16 | |
| 17 | 17 | function typographie_en_dist($letexte) { |
| 18 | 18 | |
| 19 | - // zouli apostrophe |
|
| 20 | - $letexte = str_replace("'", "’", $letexte); |
|
| 21 | - |
|
| 22 | - $cherche1 = array( |
|
| 23 | - '/ --?,/S' |
|
| 24 | - ); |
|
| 25 | - $remplace1 = array( |
|
| 26 | - '~\0' |
|
| 27 | - ); |
|
| 28 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 29 | - |
|
| 30 | - $letexte = str_replace(" ", "~", $letexte); |
|
| 31 | - $letexte = preg_replace("/ *~+ */", "~", $letexte); |
|
| 32 | - |
|
| 33 | - $cherche2 = array( |
|
| 34 | - '/([^-\n]|^)--([^-]|$)/', |
|
| 35 | - '/~/' |
|
| 36 | - ); |
|
| 37 | - $remplace2 = array( |
|
| 38 | - '\1—\2', |
|
| 39 | - ' ' |
|
| 40 | - ); |
|
| 41 | - |
|
| 42 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 43 | - |
|
| 44 | - return $letexte; |
|
| 19 | + // zouli apostrophe |
|
| 20 | + $letexte = str_replace("'", "’", $letexte); |
|
| 21 | + |
|
| 22 | + $cherche1 = array( |
|
| 23 | + '/ --?,/S' |
|
| 24 | + ); |
|
| 25 | + $remplace1 = array( |
|
| 26 | + '~\0' |
|
| 27 | + ); |
|
| 28 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 29 | + |
|
| 30 | + $letexte = str_replace(" ", "~", $letexte); |
|
| 31 | + $letexte = preg_replace("/ *~+ */", "~", $letexte); |
|
| 32 | + |
|
| 33 | + $cherche2 = array( |
|
| 34 | + '/([^-\n]|^)--([^-]|$)/', |
|
| 35 | + '/~/' |
|
| 36 | + ); |
|
| 37 | + $remplace2 = array( |
|
| 38 | + '\1—\2', |
|
| 39 | + ' ' |
|
| 40 | + ); |
|
| 41 | + |
|
| 42 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 43 | + |
|
| 44 | + return $letexte; |
|
| 45 | 45 | } |
| 46 | 46 | ?> |
@@ -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 | // rien sauf les "~" et "-," |
| 16 | 18 | |
@@ -16,58 +16,58 @@ |
||
| 16 | 16 | |
| 17 | 17 | function typographie_fr_dist($letexte) { |
| 18 | 18 | |
| 19 | - static $trans; |
|
| 19 | + static $trans; |
|
| 20 | 20 | |
| 21 | - // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 22 | - // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 23 | - if (!$trans) { |
|
| 24 | - $trans = array( |
|
| 25 | - "'" => "’", |
|
| 26 | - " " => "~", |
|
| 27 | - "»" => "»", |
|
| 28 | - "«" => "«", |
|
| 29 | - "”" => "”", |
|
| 30 | - "“" => "“", |
|
| 31 | - "°" => "°" |
|
| 32 | - ); |
|
| 33 | - $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
|
| 34 | - $chars_trans = array_keys($chars); |
|
| 35 | - $chars = array_values($chars); |
|
| 36 | - $chars_trans = implode(' ',array_map('chr',$chars_trans)); |
|
| 37 | - $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 38 | - $chars_trans = explode(" ",$chars_trans); |
|
| 39 | - foreach($chars as $k=>$r) |
|
| 40 | - $trans[$chars_trans[$k]] = $r; |
|
| 41 | - } |
|
| 21 | + // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 22 | + // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 23 | + if (!$trans) { |
|
| 24 | + $trans = array( |
|
| 25 | + "'" => "’", |
|
| 26 | + " " => "~", |
|
| 27 | + "»" => "»", |
|
| 28 | + "«" => "«", |
|
| 29 | + "”" => "”", |
|
| 30 | + "“" => "“", |
|
| 31 | + "°" => "°" |
|
| 32 | + ); |
|
| 33 | + $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
|
| 34 | + $chars_trans = array_keys($chars); |
|
| 35 | + $chars = array_values($chars); |
|
| 36 | + $chars_trans = implode(' ',array_map('chr',$chars_trans)); |
|
| 37 | + $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 38 | + $chars_trans = explode(" ",$chars_trans); |
|
| 39 | + foreach($chars as $k=>$r) |
|
| 40 | + $trans[$chars_trans[$k]] = $r; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $letexte = strtr($letexte, $trans); |
|
| 43 | + $letexte = strtr($letexte, $trans); |
|
| 44 | 44 | |
| 45 | - $cherche1 = array( |
|
| 46 | - /* 1 */ '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 47 | - /* 2 */ '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 48 | - /* 3 */ '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 49 | - /* 4 */ '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 50 | - ); |
|
| 51 | - $remplace1 = array( |
|
| 52 | - /* 1 */ '\1~;', |
|
| 53 | - /* 2 */ '~\0', |
|
| 54 | - /* 3 */ '\1~\2', |
|
| 55 | - /* 4 */ '\0~' |
|
| 56 | - ); |
|
| 57 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 58 | - $letexte = preg_replace("/ *~+ */S", "~", $letexte); |
|
| 45 | + $cherche1 = array( |
|
| 46 | + /* 1 */ '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 47 | + /* 2 */ '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 48 | + /* 3 */ '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 49 | + /* 4 */ '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 50 | + ); |
|
| 51 | + $remplace1 = array( |
|
| 52 | + /* 1 */ '\1~;', |
|
| 53 | + /* 2 */ '~\0', |
|
| 54 | + /* 3 */ '\1~\2', |
|
| 55 | + /* 4 */ '\0~' |
|
| 56 | + ); |
|
| 57 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 58 | + $letexte = preg_replace("/ *~+ */S", "~", $letexte); |
|
| 59 | 59 | |
| 60 | - $cherche2 = array( |
|
| 61 | - '/([^-\n]|^)--([^-]|$)/S', |
|
| 62 | - ',(' ._PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 63 | - '/~/' |
|
| 64 | - ); |
|
| 65 | - $remplace2 = array( |
|
| 66 | - '\1—\2', |
|
| 67 | - '\1\3\4', |
|
| 68 | - ' ' |
|
| 69 | - ); |
|
| 70 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 60 | + $cherche2 = array( |
|
| 61 | + '/([^-\n]|^)--([^-]|$)/S', |
|
| 62 | + ',(' ._PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 63 | + '/~/' |
|
| 64 | + ); |
|
| 65 | + $remplace2 = array( |
|
| 66 | + '\1—\2', |
|
| 67 | + '\1\3\4', |
|
| 68 | + ' ' |
|
| 69 | + ); |
|
| 70 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 71 | 71 | |
| 72 | - return $letexte; |
|
| 72 | + return $letexte; |
|
| 73 | 73 | } |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
| 34 | 34 | $chars_trans = array_keys($chars); |
| 35 | 35 | $chars = array_values($chars); |
| 36 | - $chars_trans = implode(' ',array_map('chr',$chars_trans)); |
|
| 36 | + $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 37 | 37 | $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
| 38 | - $chars_trans = explode(" ",$chars_trans); |
|
| 39 | - foreach($chars as $k=>$r) |
|
| 38 | + $chars_trans = explode(" ", $chars_trans); |
|
| 39 | + foreach ($chars as $k=>$r) |
|
| 40 | 40 | $trans[$chars_trans[$k]] = $r; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $cherche2 = array( |
| 61 | 61 | '/([^-\n]|^)--([^-]|$)/S', |
| 62 | - ',(' ._PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 62 | + ',('._PROTOCOLES_STD.')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 63 | 63 | '/~/' |
| 64 | 64 | ); |
| 65 | 65 | $remplace2 = array( |
@@ -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 | // Correction typographique francaise |
| 16 | 18 | |
@@ -36,8 +38,9 @@ discard block |
||
| 36 | 38 | $chars_trans = implode(' ',array_map('chr',$chars_trans)); |
| 37 | 39 | $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
| 38 | 40 | $chars_trans = explode(" ",$chars_trans); |
| 39 | - foreach($chars as $k=>$r) |
|
| 40 | - $trans[$chars_trans[$k]] = $r; |
|
| 41 | + foreach($chars as $k=>$r) { |
|
| 42 | + $trans[$chars_trans[$k]] = $r; |
|
| 43 | + } |
|
| 41 | 44 | } |
| 42 | 45 | |
| 43 | 46 | $letexte = strtr($letexte, $trans); |
@@ -13,42 +13,42 @@ |
||
| 13 | 13 | // http://doc.spip.org/@notifications_instituerarticle_dist |
| 14 | 14 | function notifications_instituerarticle_dist($quoi, $id_article, $options) { |
| 15 | 15 | |
| 16 | - // ne devrait jamais se produire |
|
| 17 | - if ($options['statut'] == $options['statut_ancien']) { |
|
| 18 | - spip_log("statut inchange",'notifications'); |
|
| 19 | - return; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - include_spip('inc/texte'); |
|
| 23 | - |
|
| 24 | - $modele = ""; |
|
| 25 | - if ($options['statut'] == 'publie') { |
|
| 26 | - if ($GLOBALS['meta']["post_dates"]=='non' |
|
| 27 | - AND strtotime($options['date'])>time()) |
|
| 28 | - $modele = "notifications/article_valide"; |
|
| 29 | - else |
|
| 30 | - $modele = "notifications/article_publie"; |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie') |
|
| 34 | - $modele = "notifications/article_propose"; |
|
| 35 | - |
|
| 36 | - if ($modele){ |
|
| 37 | - $destinataires = array(); |
|
| 38 | - if ($GLOBALS['meta']["suivi_edito"] == "oui") |
|
| 39 | - $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]); |
|
| 40 | - |
|
| 41 | - |
|
| 42 | - $destinataires = pipeline('notifications_destinataires', |
|
| 43 | - array( |
|
| 44 | - 'args'=>array('quoi'=>$quoi,'id'=>$id_article,'options'=>$options) |
|
| 45 | - , |
|
| 46 | - 'data'=>$destinataires) |
|
| 47 | - ); |
|
| 48 | - |
|
| 49 | - $texte = email_notification_article($id_article, $modele); |
|
| 50 | - notifications_envoyer_mails($destinataires, $texte); |
|
| 51 | - } |
|
| 16 | + // ne devrait jamais se produire |
|
| 17 | + if ($options['statut'] == $options['statut_ancien']) { |
|
| 18 | + spip_log("statut inchange",'notifications'); |
|
| 19 | + return; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + include_spip('inc/texte'); |
|
| 23 | + |
|
| 24 | + $modele = ""; |
|
| 25 | + if ($options['statut'] == 'publie') { |
|
| 26 | + if ($GLOBALS['meta']["post_dates"]=='non' |
|
| 27 | + AND strtotime($options['date'])>time()) |
|
| 28 | + $modele = "notifications/article_valide"; |
|
| 29 | + else |
|
| 30 | + $modele = "notifications/article_publie"; |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie') |
|
| 34 | + $modele = "notifications/article_propose"; |
|
| 35 | + |
|
| 36 | + if ($modele){ |
|
| 37 | + $destinataires = array(); |
|
| 38 | + if ($GLOBALS['meta']["suivi_edito"] == "oui") |
|
| 39 | + $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]); |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + $destinataires = pipeline('notifications_destinataires', |
|
| 43 | + array( |
|
| 44 | + 'args'=>array('quoi'=>$quoi,'id'=>$id_article,'options'=>$options) |
|
| 45 | + , |
|
| 46 | + 'data'=>$destinataires) |
|
| 47 | + ); |
|
| 48 | + |
|
| 49 | + $texte = email_notification_article($id_article, $modele); |
|
| 50 | + notifications_envoyer_mails($destinataires, $texte); |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | ?> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | // ne devrait jamais se produire |
| 17 | 17 | if ($options['statut'] == $options['statut_ancien']) { |
| 18 | - spip_log("statut inchange",'notifications'); |
|
| 18 | + spip_log("statut inchange", 'notifications'); |
|
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $modele = ""; |
| 25 | 25 | if ($options['statut'] == 'publie') { |
| 26 | - if ($GLOBALS['meta']["post_dates"]=='non' |
|
| 27 | - AND strtotime($options['date'])>time()) |
|
| 26 | + if ($GLOBALS['meta']["post_dates"] == 'non' |
|
| 27 | + AND strtotime($options['date']) > time()) |
|
| 28 | 28 | $modele = "notifications/article_valide"; |
| 29 | 29 | else |
| 30 | 30 | $modele = "notifications/article_publie"; |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie') |
| 34 | 34 | $modele = "notifications/article_propose"; |
| 35 | 35 | |
| 36 | - if ($modele){ |
|
| 36 | + if ($modele) { |
|
| 37 | 37 | $destinataires = array(); |
| 38 | 38 | if ($GLOBALS['meta']["suivi_edito"] == "oui") |
| 39 | - $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]); |
|
| 39 | + $destinataires = explode(',', $GLOBALS['meta']["adresse_suivi"]); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | $destinataires = pipeline('notifications_destinataires', |
| 43 | 43 | array( |
| 44 | - 'args'=>array('quoi'=>$quoi,'id'=>$id_article,'options'=>$options) |
|
| 44 | + 'args'=>array('quoi'=>$quoi, 'id'=>$id_article, 'options'=>$options) |
|
| 45 | 45 | , |
| 46 | 46 | 'data'=>$destinataires) |
| 47 | 47 | ); |
@@ -7,7 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 10 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 11 | + return; |
|
| 12 | +} |
|
| 11 | 13 | |
| 12 | 14 | // Fonction appelee par divers pipelines |
| 13 | 15 | // http://doc.spip.org/@notifications_instituerarticle_dist |
@@ -24,19 +26,22 @@ discard block |
||
| 24 | 26 | $modele = ""; |
| 25 | 27 | if ($options['statut'] == 'publie') { |
| 26 | 28 | if ($GLOBALS['meta']["post_dates"]=='non' |
| 27 | - AND strtotime($options['date'])>time()) |
|
| 28 | - $modele = "notifications/article_valide"; |
|
| 29 | - else |
|
| 30 | - $modele = "notifications/article_publie"; |
|
| 29 | + AND strtotime($options['date'])>time()) { |
|
| 30 | + $modele = "notifications/article_valide"; |
|
| 31 | + } else { |
|
| 32 | + $modele = "notifications/article_publie"; |
|
| 33 | + } |
|
| 31 | 34 | } |
| 32 | 35 | |
| 33 | - if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie') |
|
| 34 | - $modele = "notifications/article_propose"; |
|
| 36 | + if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie') { |
|
| 37 | + $modele = "notifications/article_propose"; |
|
| 38 | + } |
|
| 35 | 39 | |
| 36 | 40 | if ($modele){ |
| 37 | 41 | $destinataires = array(); |
| 38 | - if ($GLOBALS['meta']["suivi_edito"] == "oui") |
|
| 39 | - $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]); |
|
| 42 | + if ($GLOBALS['meta']["suivi_edito"] == "oui") { |
|
| 43 | + $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]); |
|
| 44 | + } |
|
| 40 | 45 | |
| 41 | 46 | |
| 42 | 47 | $destinataires = pipeline('notifications_destinataires', |