Changeset 2014:d0613b4b66d5
- Timestamp:
- 09/22/13 18:04:25 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blog_pref.php
r1979 r2014 326 326 form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>'; 327 327 328 # Test URL of blog by testing it's ATOM feed 329 $file = $blog_url.$core->url->getURLFor('feed','atom'); 330 $path = ''; 331 $status = '404'; 332 $content = ''; 333 $client = netHttp::initClient($file,$path); 334 if ($client !== false) { 335 $client->setTimeout(4); 336 $client->setUserAgent($_SERVER['HTTP_USER_AGENT']); 337 $client->get($path); 338 $status = $client->getStatus(); 339 $content = $client->getContent(); 340 } 341 if ($status != '200') { 342 // Might be 404 (URL not found), 670 (blog not online), ... 343 echo 344 '<p class="form-note warn">'. 345 sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> return a <strong>%s</strong> status).'), 346 $file,$status). 347 '</p>'; 348 } else { 349 if (substr($content,0,6) != '<?xml ') { 350 // Not well formed XML feed 328 try 329 { 330 # Test URL of blog by testing it's ATOM feed 331 $file = $blog_url.$core->url->getURLFor('feed','atom'); 332 $path = ''; 333 $status = '404'; 334 $content = ''; 335 336 $client = netHttp::initClient($file,$path); 337 if ($client !== false) { 338 $client->setTimeout(4); 339 $client->setUserAgent($_SERVER['HTTP_USER_AGENT']); 340 $client->get($path); 341 $status = $client->getStatus(); 342 $content = $client->getContent(); 343 } 344 if ($status != '200') { 345 // Might be 404 (URL not found), 670 (blog not online), ... 351 346 echo 352 347 '<p class="form-note warn">'. 353 sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> does not return an ATOM feed).'),354 $file ).348 sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> return a <strong>%s</strong> status).'), 349 $file,$status). 355 350 '</p>'; 351 } else { 352 if (substr($content,0,6) != '<?xml ') { 353 // Not well formed XML feed 354 echo 355 '<p class="form-note warn">'. 356 sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> does not return an ATOM feed).'), 357 $file). 358 '</p>'; 359 } 356 360 } 357 361 } 358 362 catch (Exception $e) 363 { 364 $core->error->add($e->getMessage()); 365 } 359 366 echo 360 367 '<p><label for="blog_status">'.__('Blog status:').'</label>'.
Note: See TracChangeset
for help on using the changeset viewer.