Changeset 114177 in spip-zone
- Timestamp:
- Feb 28, 2019, 9:09:53 AM (2 years ago)
- Location:
- _dev_/univers_spip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_dev_/univers_spip/inc/univers_analyser.php
r112587 r114177 140 140 141 141 // check if the header says "Hey, i'm made with SPIP" 142 if (preg_match($regexp = ',Composed-By: (.*)( @ www.spip.net)( ?\+ ?(.*))?$,m', $header, $r)) { 142 $regexp_plugin_spip = ',Composed-By: (?:.*)\+ (?<plugins>spip\((?<spip>[^)]+)\)(.*)?)$,m'; 143 $regexp_generique = ',Composed-By: (?<spip>.*)( @ www.spip.net)( ?\+ ?(?<plugins>.*))?$,m'; 144 if ( 145 preg_match($regexp_plugin_spip, $header, $r) 146 or preg_match($regexp_generique, $header, $r) 147 ) { 143 148 // essayer de choper local/config.txt si il est la car plus complet si le header semble coupe 144 149 if (substr($header, -1)!==')') { … … 150 155 $config = univers_recuperer_lapage($url_config); 151 156 } 152 if ($config and preg_match($regexp, $config[1], $rc)) { 153 $r = $rc; 154 } 155 } 156 $res['spip'] = trim(preg_replace(',^[^0-9]*,', '', $r[1])); 157 if ($config) { 158 if ( 159 preg_match($regexp_plugin_spip, $config[1], $rc) 160 or preg_match($regexp_generique, $config[1], $rc) 161 ) { 162 $r = $rc; 163 } 164 } 165 } 166 $res['spip'] = trim(preg_replace(',^[^0-9]*,', '', $r['spip'])); 157 167 if (!$res['spip']) { 158 168 $res['spip'] = '?'; 159 169 } 160 170 $res['plugins'] = array(); 161 if ($p = array_filter(explode(',', $r[ 4]))) {171 if ($p = array_filter(explode(',', $r['plugins']))) { 162 172 foreach ($p as $plugin) { 163 173 $plugin = trim($plugin); … … 167 177 } 168 178 // else, find another clue 169 // if 'spip ' is in the html, there are some chance that it is a SPIP site179 // if 'spip_' is in the html, there are some chance that it is a SPIP site 170 180 if (!isset($res['spip'])) { 171 if (preg_match(',spip ,i', $page)) {172 $res['spip'] = ' ';181 if (preg_match(',spip_(in|out|logo),i', $page)) { 182 $res['spip'] = '?'; 173 183 } 174 184 } … … 176 186 // if maybe but not sure, try to get the login page 177 187 // it should have some information that says "SPIP" 178 if (isset($res['spip']) and (!$res['spip'] or $res['spip']=='?')) {188 if (isset($res['spip']) and $res['spip'] === '?') { 179 189 // recuperer la page de login 180 190 $login = preg_replace(',spip[.]php.*$,', '', $url).'ecrire/'; … … 192 202 // try to get the htaccess.txt delivered with SPIP, 193 203 // it has some extra informations 194 if (isset($res['spip']) and (!$res['spip'] or $res['spip']=='?')) {204 if (isset($res['spip']) and $res['spip'] === '?') { 195 205 // tenter de recup le htaccess.txt qui contient un numero de version 196 206 $ht = preg_replace(',spip[.]php.*$,', '', $url).'htaccess.txt'; … … 202 212 } 203 213 204 // if we did 'nt found a confirmation and there was only 'spip' in the html205 // maybe it's an old spip site, but whe mark it apart as it is suspect206 if ( !$res['spip']) {207 $res['spip'] = '<1.8?';214 // if we didn't found a confirmation and there was only 'spip' in the html 215 // maybe it's an old spip site, but it’s no more a SPIP now. 216 if ($res['spip'] === '?') { 217 unset($res['spip']); 208 218 } 209 219 } -
_dev_/univers_spip/plugin.xml
r113562 r114177 4 4 <licence>GPL</licence> 5 5 <etat>test</etat> 6 <version>0.2.3 1</version>6 <version>0.2.32</version> 7 7 <version_base>0.1.10</version_base> 8 8 <categorie>statistique</categorie>
Note: See TracChangeset
for help on using the changeset viewer.