@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @return int |
| 28 | 28 | */ |
| 29 | 29 | function genie_mise_a_jour_dist($t) { |
| 30 | - include_spip('inc/meta'); |
|
| 31 | - $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
|
| 32 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : "", 'non'); |
|
| 30 | + include_spip('inc/meta'); |
|
| 31 | + $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
|
| 32 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : "", 'non'); |
|
| 33 | 33 | |
| 34 | - mise_a_jour_ecran_securite(); |
|
| 34 | + mise_a_jour_ecran_securite(); |
|
| 35 | 35 | |
| 36 | - spip_log("Verification version SPIP : " . ($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 36 | + spip_log("Verification version SPIP : " . ($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 37 | 37 | |
| 38 | - return 1; |
|
| 38 | + return 1; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // TODO : fournir une URL sur spip.net pour maitriser la diffusion d'une nouvelle version de l'ecran via l'update auto |
@@ -52,45 +52,45 @@ discard block |
||
| 52 | 52 | * ou de ne repondre une 304 que si le md5 est bon |
| 53 | 53 | */ |
| 54 | 54 | function mise_a_jour_ecran_securite() { |
| 55 | - // TODO : url https avec verification du certificat |
|
| 56 | - return; |
|
| 57 | - |
|
| 58 | - // si l'ecran n'est pas deja present ou pas updatable, sortir |
|
| 59 | - if (!_URL_ECRAN_SECURITE |
|
| 60 | - or !file_exists($filename = _DIR_ETC . "ecran_securite.php") |
|
| 61 | - or !is_writable($filename) |
|
| 62 | - or !$last_modified = filemtime($filename) |
|
| 63 | - or !$md5 = md5_file($filename) |
|
| 64 | - ) { |
|
| 65 | - return false; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - include_spip('inc/distant'); |
|
| 69 | - $tmp_file = _DIR_TMP . "ecran_securite.php"; |
|
| 70 | - $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5); |
|
| 71 | - $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']); |
|
| 72 | - $res = recuperer_url($url, array( |
|
| 73 | - 'if_modified_since' => $last_modified, |
|
| 74 | - 'file' => $tmp_file |
|
| 75 | - )); |
|
| 76 | - |
|
| 77 | - // si il y a une version plus recente que l'on a recu correctement |
|
| 78 | - if ($res['status'] == 200 |
|
| 79 | - and $res['length'] |
|
| 80 | - and $tmp_file = $res['file'] |
|
| 81 | - ) { |
|
| 82 | - |
|
| 83 | - if ($md5 !== md5_file($tmp_file)) { |
|
| 84 | - // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale |
|
| 85 | - include_once $tmp_file; |
|
| 86 | - // ok, on le copie a la place de l'ecran existant |
|
| 87 | - // en backupant l'ecran avant, au cas ou |
|
| 88 | - @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified)); |
|
| 89 | - @rename($tmp_file, $filename); |
|
| 90 | - } else { |
|
| 91 | - @unlink($tmp_file); |
|
| 92 | - } |
|
| 93 | - } |
|
| 55 | + // TODO : url https avec verification du certificat |
|
| 56 | + return; |
|
| 57 | + |
|
| 58 | + // si l'ecran n'est pas deja present ou pas updatable, sortir |
|
| 59 | + if (!_URL_ECRAN_SECURITE |
|
| 60 | + or !file_exists($filename = _DIR_ETC . "ecran_securite.php") |
|
| 61 | + or !is_writable($filename) |
|
| 62 | + or !$last_modified = filemtime($filename) |
|
| 63 | + or !$md5 = md5_file($filename) |
|
| 64 | + ) { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + include_spip('inc/distant'); |
|
| 69 | + $tmp_file = _DIR_TMP . "ecran_securite.php"; |
|
| 70 | + $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5); |
|
| 71 | + $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']); |
|
| 72 | + $res = recuperer_url($url, array( |
|
| 73 | + 'if_modified_since' => $last_modified, |
|
| 74 | + 'file' => $tmp_file |
|
| 75 | + )); |
|
| 76 | + |
|
| 77 | + // si il y a une version plus recente que l'on a recu correctement |
|
| 78 | + if ($res['status'] == 200 |
|
| 79 | + and $res['length'] |
|
| 80 | + and $tmp_file = $res['file'] |
|
| 81 | + ) { |
|
| 82 | + |
|
| 83 | + if ($md5 !== md5_file($tmp_file)) { |
|
| 84 | + // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale |
|
| 85 | + include_once $tmp_file; |
|
| 86 | + // ok, on le copie a la place de l'ecran existant |
|
| 87 | + // en backupant l'ecran avant, au cas ou |
|
| 88 | + @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified)); |
|
| 89 | + @rename($tmp_file, $filename); |
|
| 90 | + } else { |
|
| 91 | + @unlink($tmp_file); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -108,52 +108,52 @@ discard block |
||
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | 110 | function info_maj($dir, $file, $version) { |
| 111 | - include_spip('inc/plugin'); |
|
| 112 | - |
|
| 113 | - list($maj, $min, $rev) = preg_split('/\D+/', $version); |
|
| 114 | - |
|
| 115 | - $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 116 | - $page = !file_exists($nom) ? '' : file_get_contents($nom); |
|
| 117 | - $page = info_maj_cache($nom, $dir, $page); |
|
| 118 | - |
|
| 119 | - // reperer toutes les versions de numero majeur superieur ou egal |
|
| 120 | - // (a revoir quand on arrivera a SPIP V10 ...) |
|
| 121 | - $p = substr("0123456789", intval($maj)); |
|
| 122 | - $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | - preg_match_all($p, $page, $m, PREG_SET_ORDER); |
|
| 124 | - $page = $page_majeure = ''; |
|
| 125 | - |
|
| 126 | - // branche en cours d'utilisation |
|
| 127 | - $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2)); |
|
| 128 | - |
|
| 129 | - foreach ($m as $v) { |
|
| 130 | - $v = array_pad($v, 5, 0); |
|
| 131 | - list(, $maj2, $min2, , $rev2) = $v; |
|
| 132 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 133 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 134 | - // d'abord les mises à jour de la même branche |
|
| 135 | - if ((spip_version_compare($version, $version_maj, '<')) |
|
| 136 | - and (spip_version_compare($page, $version_maj, '<')) |
|
| 137 | - and spip_version_compare($branche, $branche_maj, '=') |
|
| 138 | - ) { |
|
| 139 | - $page = $version_maj; |
|
| 140 | - } |
|
| 141 | - // puis les mises à jours majeures |
|
| 142 | - if ((spip_version_compare($version, $version_maj, '<')) |
|
| 143 | - and (spip_version_compare($page, $version_maj, '<')) |
|
| 144 | - and spip_version_compare($branche, $branche_maj, '<') |
|
| 145 | - ) { |
|
| 146 | - $page_majeure = $version_maj; |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - if (!$page and !$page_majeure) { |
|
| 150 | - return ""; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - $message = $page ? _T('nouvelle_version_spip', array('version' => $page)) . ($page_majeure ? ' | ' : '') : ''; |
|
| 154 | - $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', array('version' => $page_majeure)) : ''; |
|
| 155 | - |
|
| 156 | - return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 111 | + include_spip('inc/plugin'); |
|
| 112 | + |
|
| 113 | + list($maj, $min, $rev) = preg_split('/\D+/', $version); |
|
| 114 | + |
|
| 115 | + $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 116 | + $page = !file_exists($nom) ? '' : file_get_contents($nom); |
|
| 117 | + $page = info_maj_cache($nom, $dir, $page); |
|
| 118 | + |
|
| 119 | + // reperer toutes les versions de numero majeur superieur ou egal |
|
| 120 | + // (a revoir quand on arrivera a SPIP V10 ...) |
|
| 121 | + $p = substr("0123456789", intval($maj)); |
|
| 122 | + $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | + preg_match_all($p, $page, $m, PREG_SET_ORDER); |
|
| 124 | + $page = $page_majeure = ''; |
|
| 125 | + |
|
| 126 | + // branche en cours d'utilisation |
|
| 127 | + $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2)); |
|
| 128 | + |
|
| 129 | + foreach ($m as $v) { |
|
| 130 | + $v = array_pad($v, 5, 0); |
|
| 131 | + list(, $maj2, $min2, , $rev2) = $v; |
|
| 132 | + $branche_maj = $maj2 . '.' . $min2; |
|
| 133 | + $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 134 | + // d'abord les mises à jour de la même branche |
|
| 135 | + if ((spip_version_compare($version, $version_maj, '<')) |
|
| 136 | + and (spip_version_compare($page, $version_maj, '<')) |
|
| 137 | + and spip_version_compare($branche, $branche_maj, '=') |
|
| 138 | + ) { |
|
| 139 | + $page = $version_maj; |
|
| 140 | + } |
|
| 141 | + // puis les mises à jours majeures |
|
| 142 | + if ((spip_version_compare($version, $version_maj, '<')) |
|
| 143 | + and (spip_version_compare($page, $version_maj, '<')) |
|
| 144 | + and spip_version_compare($branche, $branche_maj, '<') |
|
| 145 | + ) { |
|
| 146 | + $page_majeure = $version_maj; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + if (!$page and !$page_majeure) { |
|
| 150 | + return ""; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + $message = $page ? _T('nouvelle_version_spip', array('version' => $page)) . ($page_majeure ? ' | ' : '') : ''; |
|
| 154 | + $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', array('version' => $page_majeure)) : ''; |
|
| 155 | + |
|
| 156 | + return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -174,25 +174,25 @@ discard block |
||
| 174 | 174 | * Contenu du fichier de cache de l'info de maj de SPIP. |
| 175 | 175 | */ |
| 176 | 176 | function info_maj_cache($nom, $dir, $page = '') { |
| 177 | - include_spip('inc/acces'); |
|
| 178 | - $alea_ephemere = charger_aleas(); |
|
| 179 | - $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 180 | - if (preg_match("/$re/", $page)) { |
|
| 181 | - return $page; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 185 | - $a = file_exists($nom) ? filemtime($nom) : ''; |
|
| 186 | - include_spip('inc/distant'); |
|
| 187 | - $res = recuperer_url_cache($url, array('if_modified_since' => $a)); |
|
| 188 | - // Si rien de neuf (ou inaccessible), garder l'ancienne |
|
| 189 | - if ($res) { |
|
| 190 | - $page = $res['page'] ? $res['page'] : $page; |
|
| 191 | - } |
|
| 192 | - // Placer l'indicateur de fraicheur |
|
| 193 | - $page = preg_replace('/^<archives.*?>/', $re, $page); |
|
| 194 | - sous_repertoire(_DIR_CACHE_XML); |
|
| 195 | - ecrire_fichier($nom, $page); |
|
| 196 | - |
|
| 197 | - return $page; |
|
| 177 | + include_spip('inc/acces'); |
|
| 178 | + $alea_ephemere = charger_aleas(); |
|
| 179 | + $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 180 | + if (preg_match("/$re/", $page)) { |
|
| 181 | + return $page; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 185 | + $a = file_exists($nom) ? filemtime($nom) : ''; |
|
| 186 | + include_spip('inc/distant'); |
|
| 187 | + $res = recuperer_url_cache($url, array('if_modified_since' => $a)); |
|
| 188 | + // Si rien de neuf (ou inaccessible), garder l'ancienne |
|
| 189 | + if ($res) { |
|
| 190 | + $page = $res['page'] ? $res['page'] : $page; |
|
| 191 | + } |
|
| 192 | + // Placer l'indicateur de fraicheur |
|
| 193 | + $page = preg_replace('/^<archives.*?>/', $re, $page); |
|
| 194 | + sous_repertoire(_DIR_CACHE_XML); |
|
| 195 | + ecrire_fichier($nom, $page); |
|
| 196 | + |
|
| 197 | + return $page; |
|
| 198 | 198 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | function genie_mise_a_jour_dist($t) { |
| 30 | 30 | include_spip('inc/meta'); |
| 31 | 31 | $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
| 32 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : "", 'non'); |
|
| 32 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : "", 'non'); |
|
| 33 | 33 | |
| 34 | 34 | mise_a_jour_ecran_securite(); |
| 35 | 35 | |
| 36 | - spip_log("Verification version SPIP : " . ($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 36 | + spip_log("Verification version SPIP : ".($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 37 | 37 | |
| 38 | 38 | return 1; |
| 39 | 39 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // si l'ecran n'est pas deja present ou pas updatable, sortir |
| 59 | 59 | if (!_URL_ECRAN_SECURITE |
| 60 | - or !file_exists($filename = _DIR_ETC . "ecran_securite.php") |
|
| 60 | + or !file_exists($filename = _DIR_ETC."ecran_securite.php") |
|
| 61 | 61 | or !is_writable($filename) |
| 62 | 62 | or !$last_modified = filemtime($filename) |
| 63 | 63 | or !$md5 = md5_file($filename) |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | include_spip('inc/distant'); |
| 69 | - $tmp_file = _DIR_TMP . "ecran_securite.php"; |
|
| 69 | + $tmp_file = _DIR_TMP."ecran_securite.php"; |
|
| 70 | 70 | $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5); |
| 71 | 71 | $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']); |
| 72 | 72 | $res = recuperer_url($url, array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | include_once $tmp_file; |
| 86 | 86 | // ok, on le copie a la place de l'ecran existant |
| 87 | 87 | // en backupant l'ecran avant, au cas ou |
| 88 | - @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified)); |
|
| 88 | + @copy($filename, $filename."-bck-".date('Y-m-d-His', $last_modified)); |
|
| 89 | 89 | @rename($tmp_file, $filename); |
| 90 | 90 | } else { |
| 91 | 91 | @unlink($tmp_file); |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | list($maj, $min, $rev) = preg_split('/\D+/', $version); |
| 114 | 114 | |
| 115 | - $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 115 | + $nom = _DIR_CACHE_XML._VERSIONS_LISTE; |
|
| 116 | 116 | $page = !file_exists($nom) ? '' : file_get_contents($nom); |
| 117 | 117 | $page = info_maj_cache($nom, $dir, $page); |
| 118 | 118 | |
| 119 | 119 | // reperer toutes les versions de numero majeur superieur ou egal |
| 120 | 120 | // (a revoir quand on arrivera a SPIP V10 ...) |
| 121 | 121 | $p = substr("0123456789", intval($maj)); |
| 122 | - $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 122 | + $p = ',/'.$file.'\D+(['.$p.']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | 123 | preg_match_all($p, $page, $m, PREG_SET_ORDER); |
| 124 | 124 | $page = $page_majeure = ''; |
| 125 | 125 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | foreach ($m as $v) { |
| 130 | 130 | $v = array_pad($v, 5, 0); |
| 131 | - list(, $maj2, $min2, , $rev2) = $v; |
|
| 132 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 133 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 131 | + list(, $maj2, $min2,, $rev2) = $v; |
|
| 132 | + $branche_maj = $maj2.'.'.$min2; |
|
| 133 | + $version_maj = $maj2.'.'.$min2.'.'.$rev2; |
|
| 134 | 134 | // d'abord les mises à jour de la même branche |
| 135 | 135 | if ((spip_version_compare($version, $version_maj, '<')) |
| 136 | 136 | and (spip_version_compare($page, $version_maj, '<')) |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | return ""; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $message = $page ? _T('nouvelle_version_spip', array('version' => $page)) . ($page_majeure ? ' | ' : '') : ''; |
|
| 153 | + $message = $page ? _T('nouvelle_version_spip', array('version' => $page)).($page_majeure ? ' | ' : '') : ''; |
|
| 154 | 154 | $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', array('version' => $page_majeure)) : ''; |
| 155 | 155 | |
| 156 | - return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 156 | + return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>".$message.'</a>'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | function info_maj_cache($nom, $dir, $page = '') { |
| 177 | 177 | include_spip('inc/acces'); |
| 178 | 178 | $alea_ephemere = charger_aleas(); |
| 179 | - $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 179 | + $re = '<archives id="a'.$alea_ephemere.'">'; |
|
| 180 | 180 | if (preg_match("/$re/", $page)) { |
| 181 | 181 | return $page; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 184 | + $url = _VERSIONS_SERVEUR.$dir.'/'._VERSIONS_LISTE; |
|
| 185 | 185 | $a = file_exists($nom) ? filemtime($nom) : ''; |
| 186 | 186 | include_spip('inc/distant'); |
| 187 | 187 | $res = recuperer_url_cache($url, array('if_modified_since' => $a)); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -32,32 +32,32 @@ discard block |
||
| 32 | 32 | * @return int |
| 33 | 33 | */ |
| 34 | 34 | function genie_mail_dist($t) { |
| 35 | - $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 36 | - $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 37 | - |
|
| 38 | - $now = time(); |
|
| 39 | - if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 40 | - ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - $page = recuperer_fond('nouveautes', |
|
| 44 | - array('date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf), array('raw' => true)); |
|
| 45 | - |
|
| 46 | - if (strlen(trim($page['texte']))) { |
|
| 47 | - // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 48 | - $headers = ""; |
|
| 49 | - if (isset($page['entetes']) and count($page['entetes'])) { |
|
| 50 | - foreach ($page['entetes'] as $k => $v) { |
|
| 51 | - $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - include_spip("inc/notifications"); |
|
| 56 | - notifications_envoyer_mails($adresse_neuf, $page['texte'], "", "", $headers); |
|
| 57 | - ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 58 | - } else { |
|
| 59 | - spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - return 1; |
|
| 35 | + $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 36 | + $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 37 | + |
|
| 38 | + $now = time(); |
|
| 39 | + if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 40 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + $page = recuperer_fond('nouveautes', |
|
| 44 | + array('date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf), array('raw' => true)); |
|
| 45 | + |
|
| 46 | + if (strlen(trim($page['texte']))) { |
|
| 47 | + // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 48 | + $headers = ""; |
|
| 49 | + if (isset($page['entetes']) and count($page['entetes'])) { |
|
| 50 | + foreach ($page['entetes'] as $k => $v) { |
|
| 51 | + $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + include_spip("inc/notifications"); |
|
| 56 | + notifications_envoyer_mails($adresse_neuf, $page['texte'], "", "", $headers); |
|
| 57 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 58 | + } else { |
|
| 59 | + spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + return 1; |
|
| 63 | 63 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $headers = ""; |
| 49 | 49 | if (isset($page['entetes']) and count($page['entetes'])) { |
| 50 | 50 | foreach ($page['entetes'] as $k => $v) { |
| 51 | - $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 51 | + $headers .= (strlen($v) ? "$k: $v" : $k)."\n"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -11,74 +11,74 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Correction typographique francaise |
| 18 | 18 | |
| 19 | 19 | function typographie_fr_dist($letexte) { |
| 20 | 20 | |
| 21 | - static $trans; |
|
| 21 | + static $trans; |
|
| 22 | 22 | |
| 23 | - // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | - // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | - if (!$trans) { |
|
| 26 | - $trans = array( |
|
| 27 | - "'" => '’', |
|
| 28 | - ' ' => '~', |
|
| 29 | - '»' => '»', |
|
| 30 | - '«' => '«', |
|
| 31 | - '”' => '”', |
|
| 32 | - '“' => '“', |
|
| 33 | - '°' => '°' |
|
| 34 | - ); |
|
| 35 | - $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
|
| 36 | - $chars_trans = array_keys($chars); |
|
| 37 | - $chars = array_values($chars); |
|
| 38 | - $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | - $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | - $chars_trans = explode(' ', $chars_trans); |
|
| 41 | - foreach ($chars as $k => $r) { |
|
| 42 | - $trans[$chars_trans[$k]] = $r; |
|
| 43 | - } |
|
| 44 | - } |
|
| 23 | + // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | + // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | + if (!$trans) { |
|
| 26 | + $trans = array( |
|
| 27 | + "'" => '’', |
|
| 28 | + ' ' => '~', |
|
| 29 | + '»' => '»', |
|
| 30 | + '«' => '«', |
|
| 31 | + '”' => '”', |
|
| 32 | + '“' => '“', |
|
| 33 | + '°' => '°' |
|
| 34 | + ); |
|
| 35 | + $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
|
| 36 | + $chars_trans = array_keys($chars); |
|
| 37 | + $chars = array_values($chars); |
|
| 38 | + $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | + $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | + $chars_trans = explode(' ', $chars_trans); |
|
| 41 | + foreach ($chars as $k => $r) { |
|
| 42 | + $trans[$chars_trans[$k]] = $r; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $letexte = strtr($letexte, $trans); |
|
| 46 | + $letexte = strtr($letexte, $trans); |
|
| 47 | 47 | |
| 48 | - $cherche1 = array( |
|
| 49 | - /* 1 */ |
|
| 50 | - '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | - /* 2 */ |
|
| 52 | - '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | - /* 3 */ |
|
| 54 | - '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | - /* 4 */ |
|
| 56 | - '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | - ); |
|
| 58 | - $remplace1 = array( |
|
| 59 | - /* 1 */ |
|
| 60 | - '\1~;', |
|
| 61 | - /* 2 */ |
|
| 62 | - '~\0', |
|
| 63 | - /* 3 */ |
|
| 64 | - '\1~\2', |
|
| 65 | - /* 4 */ |
|
| 66 | - '\0~' |
|
| 67 | - ); |
|
| 68 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | - $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 48 | + $cherche1 = array( |
|
| 49 | + /* 1 */ |
|
| 50 | + '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | + /* 2 */ |
|
| 52 | + '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | + /* 3 */ |
|
| 54 | + '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | + /* 4 */ |
|
| 56 | + '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | + ); |
|
| 58 | + $remplace1 = array( |
|
| 59 | + /* 1 */ |
|
| 60 | + '\1~;', |
|
| 61 | + /* 2 */ |
|
| 62 | + '~\0', |
|
| 63 | + /* 3 */ |
|
| 64 | + '\1~\2', |
|
| 65 | + /* 4 */ |
|
| 66 | + '\0~' |
|
| 67 | + ); |
|
| 68 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | + $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 70 | 70 | |
| 71 | - $cherche2 = array( |
|
| 72 | - '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | - ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | - '/~/' |
|
| 75 | - ); |
|
| 76 | - $remplace2 = array( |
|
| 77 | - '\1—\2', |
|
| 78 | - '\1\3\4', |
|
| 79 | - ' ' |
|
| 80 | - ); |
|
| 81 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 71 | + $cherche2 = array( |
|
| 72 | + '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | + ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | + '/~/' |
|
| 75 | + ); |
|
| 76 | + $remplace2 = array( |
|
| 77 | + '\1—\2', |
|
| 78 | + '\1\3\4', |
|
| 79 | + ' ' |
|
| 80 | + ); |
|
| 81 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 82 | 82 | |
| 83 | - return $letexte; |
|
| 83 | + return $letexte; |
|
| 84 | 84 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | |
| 71 | 71 | $cherche2 = array( |
| 72 | 72 | '/([^-\n]|^)--([^-]|$)/S', |
| 73 | - ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 73 | + ',('._PROTOCOLES_STD.')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | 74 | '/~/' |
| 75 | 75 | ); |
| 76 | 76 | $remplace2 = array( |
@@ -11,37 +11,37 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // rien sauf les "~" et "-," |
| 18 | 18 | |
| 19 | 19 | function typographie_en_dist($letexte) { |
| 20 | 20 | |
| 21 | - // zouli apostrophe |
|
| 22 | - $letexte = str_replace("'", '’', $letexte); |
|
| 21 | + // zouli apostrophe |
|
| 22 | + $letexte = str_replace("'", '’', $letexte); |
|
| 23 | 23 | |
| 24 | - $cherche1 = array( |
|
| 25 | - '/ --?,/S' |
|
| 26 | - ); |
|
| 27 | - $remplace1 = array( |
|
| 28 | - '~\0' |
|
| 29 | - ); |
|
| 30 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 24 | + $cherche1 = array( |
|
| 25 | + '/ --?,/S' |
|
| 26 | + ); |
|
| 27 | + $remplace1 = array( |
|
| 28 | + '~\0' |
|
| 29 | + ); |
|
| 30 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 31 | 31 | |
| 32 | - $letexte = str_replace(' ', '~', $letexte); |
|
| 33 | - $letexte = preg_replace('/ *~+ */', '~', $letexte); |
|
| 32 | + $letexte = str_replace(' ', '~', $letexte); |
|
| 33 | + $letexte = preg_replace('/ *~+ */', '~', $letexte); |
|
| 34 | 34 | |
| 35 | - $cherche2 = array( |
|
| 36 | - '/([^-\n]|^)--([^-]|$)/', |
|
| 37 | - '/~/' |
|
| 38 | - ); |
|
| 39 | - $remplace2 = array( |
|
| 40 | - '\1—\2', |
|
| 41 | - ' ' |
|
| 42 | - ); |
|
| 35 | + $cherche2 = array( |
|
| 36 | + '/([^-\n]|^)--([^-]|$)/', |
|
| 37 | + '/~/' |
|
| 38 | + ); |
|
| 39 | + $remplace2 = array( |
|
| 40 | + '\1—\2', |
|
| 41 | + ' ' |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 44 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 45 | 45 | |
| 46 | - return $letexte; |
|
| 46 | + return $letexte; |
|
| 47 | 47 | } |
@@ -73,5 +73,5 @@ |
||
| 73 | 73 | return ''; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 76 | + return generer_url_action('logout', "logout=public&url=".rawurlencode($cible ? $cible : self('&'))); |
|
| 77 | 77 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Pile complétée du code compilé |
| 37 | 37 | **/ |
| 38 | 38 | function balise_URL_LOGOUT($p) { |
| 39 | - return calculer_balise_dynamique($p, 'URL_LOGOUT', array()); |
|
| 39 | + return calculer_balise_dynamique($p, 'URL_LOGOUT', array()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * Liste (url) des arguments collectés. |
| 53 | 53 | */ |
| 54 | 54 | function balise_URL_LOGOUT_stat($args, $context_compil) { |
| 55 | - $url = isset($args[0]) ? $args[0] : ''; |
|
| 55 | + $url = isset($args[0]) ? $args[0] : ''; |
|
| 56 | 56 | |
| 57 | - return array($url); |
|
| 57 | + return array($url); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | **/ |
| 70 | 70 | function balise_URL_LOGOUT_dyn($cible) { |
| 71 | 71 | |
| 72 | - if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) { |
|
| 73 | - return ''; |
|
| 74 | - } |
|
| 72 | + if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) { |
|
| 73 | + return ''; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 76 | + return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 77 | 77 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Pile complétée du code compilé |
| 38 | 38 | **/ |
| 39 | 39 | function balise_MENU_LANG_ECRIRE($p) { |
| 40 | - return calculer_balise_dynamique($p, 'MENU_LANG_ECRIRE', array('lang')); |
|
| 40 | + return calculer_balise_dynamique($p, 'MENU_LANG_ECRIRE', array('lang')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | * Liste (lang) des arguments collectés et fournis. |
| 56 | 56 | */ |
| 57 | 57 | function balise_MENU_LANG_ECRIRE_stat($args, $context_compil) { |
| 58 | - include_spip('inc/lang'); |
|
| 59 | - if (strpos($GLOBALS['meta']['langues_proposees'], ',') === false) { |
|
| 60 | - return ''; |
|
| 61 | - } |
|
| 58 | + include_spip('inc/lang'); |
|
| 59 | + if (strpos($GLOBALS['meta']['langues_proposees'], ',') === false) { |
|
| 60 | + return ''; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $args; |
|
| 63 | + return $args; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * Liste : Chemin du squelette, durée du cache, contexte |
| 77 | 77 | **/ |
| 78 | 78 | function balise_MENU_LANG_ECRIRE_dyn($opt) { |
| 79 | - return menu_lang_pour_tous('var_lang_ecrire', $opt); |
|
| 79 | + return menu_lang_pour_tous('var_lang_ecrire', $opt); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -96,30 +96,30 @@ discard block |
||
| 96 | 96 | * Liste : Chemin du squelette, durée du cache, contexte |
| 97 | 97 | **/ |
| 98 | 98 | function menu_lang_pour_tous($nom, $default) { |
| 99 | - include_spip('inc/lang'); |
|
| 99 | + include_spip('inc/lang'); |
|
| 100 | 100 | |
| 101 | - if ($GLOBALS['spip_lang'] <> $default) { |
|
| 102 | - $opt = lang_select($default); # et remplace |
|
| 103 | - if ($GLOBALS['spip_lang'] <> $default) { |
|
| 104 | - $default = ''; # annule tout choix par defaut |
|
| 105 | - if ($opt) { |
|
| 106 | - lang_select(); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - } |
|
| 101 | + if ($GLOBALS['spip_lang'] <> $default) { |
|
| 102 | + $opt = lang_select($default); # et remplace |
|
| 103 | + if ($GLOBALS['spip_lang'] <> $default) { |
|
| 104 | + $default = ''; # annule tout choix par defaut |
|
| 105 | + if ($opt) { |
|
| 106 | + lang_select(); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - # lien a partir de / |
|
| 112 | - $cible = parametre_url(self(), 'lang', '', '&'); |
|
| 113 | - $post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), '&'); |
|
| 111 | + # lien a partir de / |
|
| 112 | + $cible = parametre_url(self(), 'lang', '', '&'); |
|
| 113 | + $post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), '&'); |
|
| 114 | 114 | |
| 115 | - return array( |
|
| 116 | - 'formulaires/menu_lang', |
|
| 117 | - 3600, |
|
| 118 | - array( |
|
| 119 | - 'nom' => $nom, |
|
| 120 | - 'url' => $post, |
|
| 121 | - 'name' => $nom, |
|
| 122 | - 'default' => $default, |
|
| 123 | - ) |
|
| 124 | - ); |
|
| 115 | + return array( |
|
| 116 | + 'formulaires/menu_lang', |
|
| 117 | + 3600, |
|
| 118 | + array( |
|
| 119 | + 'nom' => $nom, |
|
| 120 | + 'url' => $post, |
|
| 121 | + 'name' => $nom, |
|
| 122 | + 'default' => $default, |
|
| 123 | + ) |
|
| 124 | + ); |
|
| 125 | 125 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | include_spip('inc/lang'); |
| 100 | 100 | |
| 101 | 101 | if ($GLOBALS['spip_lang'] <> $default) { |
| 102 | - $opt = lang_select($default); # et remplace |
|
| 102 | + $opt = lang_select($default); # et remplace |
|
| 103 | 103 | if ($GLOBALS['spip_lang'] <> $default) { |
| 104 | - $default = ''; # annule tout choix par defaut |
|
| 104 | + $default = ''; # annule tout choix par defaut |
|
| 105 | 105 | if ($opt) { |
| 106 | 106 | lang_select(); |
| 107 | 107 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | # lien a partir de / |
| 112 | 112 | $cible = parametre_url(self(), 'lang', '', '&'); |
| 113 | - $post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), '&'); |
|
| 113 | + $post = generer_url_action('converser', 'redirect='.rawurlencode($cible), '&'); |
|
| 114 | 114 | |
| 115 | 115 | return array( |
| 116 | 116 | 'formulaires/menu_lang', |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('base/abstract_sql'); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * Pile complétée du code compilé |
| 42 | 42 | **/ |
| 43 | 43 | function balise_FORMULAIRE_ECRIRE_AUTEUR($p) { |
| 44 | - return calculer_balise_dynamique($p, 'FORMULAIRE_ECRIRE_AUTEUR', array('id_auteur', 'id_article', 'email')); |
|
| 44 | + return calculer_balise_dynamique($p, 'FORMULAIRE_ECRIRE_AUTEUR', array('id_auteur', 'id_article', 'email')); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -59,42 +59,42 @@ discard block |
||
| 59 | 59 | * - chaîne vide sinon (erreur ou non affichage). |
| 60 | 60 | */ |
| 61 | 61 | function balise_FORMULAIRE_ECRIRE_AUTEUR_stat($args, $context_compil) { |
| 62 | - include_spip('inc/filtres'); |
|
| 63 | - // Pas d'id_auteur ni d'id_article ? Erreur de contexte |
|
| 64 | - $id = intval($args[1]); |
|
| 65 | - if (!$args[0] and !$id) { |
|
| 66 | - $msg = array( |
|
| 67 | - 'zbug_champ_hors_motif', |
|
| 68 | - array( |
|
| 69 | - 'champ' => 'FORMULAIRE_ECRIRE_AUTEUR', |
|
| 70 | - 'motif' => 'AUTEURS/ARTICLES' |
|
| 71 | - ) |
|
| 72 | - ); |
|
| 62 | + include_spip('inc/filtres'); |
|
| 63 | + // Pas d'id_auteur ni d'id_article ? Erreur de contexte |
|
| 64 | + $id = intval($args[1]); |
|
| 65 | + if (!$args[0] and !$id) { |
|
| 66 | + $msg = array( |
|
| 67 | + 'zbug_champ_hors_motif', |
|
| 68 | + array( |
|
| 69 | + 'champ' => 'FORMULAIRE_ECRIRE_AUTEUR', |
|
| 70 | + 'motif' => 'AUTEURS/ARTICLES' |
|
| 71 | + ) |
|
| 72 | + ); |
|
| 73 | 73 | |
| 74 | - erreur_squelette($msg, $context_compil); |
|
| 74 | + erreur_squelette($msg, $context_compil); |
|
| 75 | 75 | |
| 76 | - return ''; |
|
| 77 | - } |
|
| 78 | - // Si on est dans un contexte article, |
|
| 79 | - // sortir tous les mails des auteurs de l'article |
|
| 80 | - if (!$args[0] and $id) { |
|
| 81 | - $r = ''; |
|
| 82 | - $s = sql_allfetsel('email', |
|
| 83 | - 'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')', |
|
| 84 | - "A.email != '' AND L.id_objet=$id"); |
|
| 85 | - foreach ($s as $row) { |
|
| 86 | - if (email_valide($row['email'])) { |
|
| 87 | - $r .= ', ' . $row['email']; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - $args[2] = substr($r, 2); |
|
| 91 | - } |
|
| 76 | + return ''; |
|
| 77 | + } |
|
| 78 | + // Si on est dans un contexte article, |
|
| 79 | + // sortir tous les mails des auteurs de l'article |
|
| 80 | + if (!$args[0] and $id) { |
|
| 81 | + $r = ''; |
|
| 82 | + $s = sql_allfetsel('email', |
|
| 83 | + 'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')', |
|
| 84 | + "A.email != '' AND L.id_objet=$id"); |
|
| 85 | + foreach ($s as $row) { |
|
| 86 | + if (email_valide($row['email'])) { |
|
| 87 | + $r .= ', ' . $row['email']; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + $args[2] = substr($r, 2); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - // On ne peut pas ecrire a un auteur dont le mail n'est pas valide |
|
| 94 | - if (!$args[2] or !email_valide($args[2])) { |
|
| 95 | - return ''; |
|
| 96 | - } |
|
| 93 | + // On ne peut pas ecrire a un auteur dont le mail n'est pas valide |
|
| 94 | + if (!$args[2] or !email_valide($args[2])) { |
|
| 95 | + return ''; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - // OK |
|
| 99 | - return $args; |
|
| 98 | + // OK |
|
| 99 | + return $args; |
|
| 100 | 100 | } |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | "A.email != '' AND L.id_objet=$id"); |
| 85 | 85 | foreach ($s as $row) { |
| 86 | 86 | if (email_valide($row['email'])) { |
| 87 | - $r .= ', ' . $row['email']; |
|
| 87 | + $r .= ', '.$row['email']; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | $args[2] = substr($r, 2); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('base/abstract_sql'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * Pile complétée du code compilé |
| 44 | 44 | **/ |
| 45 | 45 | function balise_FORMULAIRE_INSCRIPTION($p) { |
| 46 | - return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', array()); |
|
| 46 | + return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', array()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | * - chaîne vide sinon. |
| 73 | 73 | */ |
| 74 | 74 | function balise_FORMULAIRE_INSCRIPTION_stat($args, $context_compil) { |
| 75 | - list($mode, $id, $retour) = array_pad($args, 3, null); |
|
| 76 | - include_spip('action/inscrire_auteur'); |
|
| 77 | - $mode = tester_statut_inscription($mode, $id); |
|
| 75 | + list($mode, $id, $retour) = array_pad($args, 3, null); |
|
| 76 | + include_spip('action/inscrire_auteur'); |
|
| 77 | + $mode = tester_statut_inscription($mode, $id); |
|
| 78 | 78 | |
| 79 | - return $mode ? array($mode, $id, $retour) : ''; |
|
| 79 | + return $mode ? array($mode, $id, $retour) : ''; |
|
| 80 | 80 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Pile complétée du code compilé |
| 38 | 38 | **/ |
| 39 | 39 | function balise_MENU_LANG($p) { |
| 40 | - return calculer_balise_dynamique($p, 'MENU_LANG', array('lang')); |
|
| 40 | + return calculer_balise_dynamique($p, 'MENU_LANG', array('lang')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | * Liste (lang) des arguments collectés et fournis. |
| 56 | 56 | */ |
| 57 | 57 | function balise_MENU_LANG_stat($args, $context_compil) { |
| 58 | - if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) { |
|
| 59 | - return ''; |
|
| 60 | - } |
|
| 58 | + if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) { |
|
| 59 | + return ''; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - return $args; |
|
| 62 | + return $args; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Liste : Chemin du squelette, durée du cache, contexte |
| 76 | 76 | **/ |
| 77 | 77 | function balise_MENU_LANG_dyn($opt) { |
| 78 | - include_spip('balise/menu_lang_ecrire'); |
|
| 78 | + include_spip('balise/menu_lang_ecrire'); |
|
| 79 | 79 | |
| 80 | - return menu_lang_pour_tous('var_lang', $opt); |
|
| 80 | + return menu_lang_pour_tous('var_lang', $opt); |
|
| 81 | 81 | } |