Changeset 28588


Ignore:
Timestamp:
06/02/14 11:09:43 (5 years ago)
Author:
mistic100
Message:

bug 3086: test curl_exec + ensure display error message when unable to download

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/netinstall/trunk/piwigo-netinstall.php

    r22589 r28588  
    8686 
    8787        // Try curl to read remote file 
    88         if (function_exists('curl_init')) 
     88        if (function_exists('curl_init') && function_exists('curl_exec')) 
    8989        { 
    9090                $ch = @curl_init();  
     
    112112                } 
    113113        } 
     114   
     115  if (!function_exists('fsockopen')) 
     116  { 
     117    return false; 
     118  } 
    114119 
    115120        // Try fsockopen to read remote file 
     
    244249        header('Content-Type: text/html; charset=UTF-8'); 
    245250        echo 
    246         '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 
    247         ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 
    248         '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.substr(DC_LOADER_LANG,0,2).'" lang="'.substr(DC_LOADER_LANG,0,2).'">'."\n". 
    249         '<html lang="'.l10n('code').'" dir="'.l10n('direction').'"'."\n". 
    250         "<head>\n". 
    251         ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 
     251        '<!DOCTYPE html>'."\n". 
     252        '<html lang="'.l10n('code').'" dir="'.l10n('direction').'">'."\n". 
     253        '<head>'."\n". 
     254        ' <meta charset="UTF-8" />'."\n". 
    252255        ' <title>'.l10n('Piwigo NetInstall').'</title>'."\n". 
    253256        ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 
     
    392395if (!defined('DC_LOADER_LANG')) 
    393396{ 
     397  $lang['code'] = 'en'; 
     398  $lang['direction'] = 'ltr'; 
     399 
    394400        // No traduction for this part because can't fetch! 
    395401        openPage(); 
    396         echo 
    397         '<h2>Piwigo NetInstall</h2>'."\n"; 
    398402        writeMessage('warning','Damnit!', array( 
    399403                'Due to restrictions in your PHP configuration, NetInstall cannot get its job done.', 
Note: See TracChangeset for help on using the changeset viewer.