Deprecated: Function eregi() is deprecated in /home/linea/www/dl/dl.php on line 159

Notice: Undefined index: HTTP_REFERER in /home/linea/www/dl/dl.php on line 89

Notice: Undefined index: HTTP_REFERER in /home/linea/www/dl/dl.php on line 105
* @version $id SVN * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ ob_start(); @set_time_limit(0); error_reporting(E_ALL); // defines define('SITE_LINEA_URL', 'http://www.linea21.com'); define('USER_AGENT', 'Linea21 - Loader/0.2 (http://www.linea21.com)'); define('REFERER', $_SERVER["HTTP_HOST"].' Linea21 - Loader/0.2'); define('ZIP_FILE', '_tmp.zip'); define('BASE_PATH', dirname(__FILE__).'/'); define('END_LINE', "
"); define('PERFORM_TEST', true); // TARGET_URL is set later - do not uncomment the following line // U_L is defined later # localized input $lang = array( 'en' => array( 'already_installed' => 'Linea21 seems to be already installed.', 'pre-requisites' => 'pre-requisites', 'connection_failed' => 'Unable to connect to %s.', 'OK' => 'OK', 'not_OK' => 'not OK', 'php_version' => 'PHP version > 5', 'is_writable' => 'Folder is writable', 'simplexml_ext' => 'SimpleXML extension', 'curl_ext' => 'cURL extension', 'check_not_ok' => 'Sorry, settings do not allow the Loader to run correctly.', 'dl_latest' => 'Downloading latest stable version', 'dl_from' => 'Downloading from', 'curl_error_no' => 'cURL error number', 'curl_error_msg' => 'cURL error message', 'zip_extract' => 'Extracting %s to %s', 'del_msg' => 'Deleting %s', 'succeed' => 'succeed', 'failed' => 'failed', 'end_up' => ' The automatic installation ended up. Please, change current settings or download Linea21 manually.', 'delete_loader' => 'Do not forget to delete loader.php file.', 'go_on' => 'Téléchargement terminé, poursuivre l\'installation !' ), 'fr' => array( 'already_installed' => 'Linea21 semble déjà installé.', 'pre-requisites' => 'Pré-requis', 'connection_failed' => 'Connexion à %s impossible.', 'OK' => 'OK', 'not_OK' => 'non OK', 'php_version' => 'PHP version > 5', 'is_writable' => 'Permissions en écriture sur le dossier', 'simplexml_ext' => 'extension SimpleXML', 'curl_ext' => 'extension cURL', 'check_not_ok' => 'Desolé, la configuration actuelle ne permet pas de lançer le Loader.', 'dl_latest' => 'Téléchargement de la dernière version stable', 'dl_from' => 'Téléchargement depuis', 'curl_error_no' => 'erreur cURL numéro', 'curl_error_msg' => 'message d\'erreur cURL', 'zip_extract' => 'Extraction de %s vers %s', 'del_msg' => 'Suppression de %s', 'succeed' => 'succès', 'failed' => 'échec', 'end_up' => ' L\'installation automatique a été stoppée. Veuillez modifier vos paramètres ou installer Linea21 manuellement.', 'delete_loader' => 'N\'oubliez pas de supprimer le fichier loader.php.', 'go_on' => 'Téléchargement terminé, poursuivre l\'installation !' ) ); $language = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)); if(!in_array($language, array_keys($lang))) $language = 'en'; define('U_L', $language); $check = true; // display localized message function _t($var) { global $lang; return $lang[U_L][$var]; } // buffer flush function fl(){ @ob_end_flush(); @ob_flush(); @flush(); @ob_start(); } // check if given extension is loaded function check_ext($ext) { global $check; if (!extension_loaded($ext)) { $check = false; return _t('not_OK'); } else { return _t('OK'); } } // check PHP version function check_php() { global $check; if (version_compare(PHP_VERSION, '5.0.0', '>=')) { return _t('OK'). ' ('.PHP_VERSION.')'; } else { $check = false; return _t('not_OK'). ' ('.PHP_VERSION.')'; } } // check PHP version function check_writable() { global $check; if (!is_writable(__DIR__)) { $check = false; return _t('not_OK'); } else { return _t('OK'); } } /** * This method unzips a directory within a zip-archive * @author Florian Wolf * @license LGPL v2 or later */ function extractZip( $zipFile = '', $dirFromZip = '' ) { define(DIRECTORY_SEPARATOR, '/'); $zipDir = getcwd() . DIRECTORY_SEPARATOR; $zip = zip_open($zipDir.$zipFile); if ($zip) { while ($zip_entry = zip_read($zip)) { // $completePath = $zipDir . dirname(zip_entry_name($zip_entry)); // $completeName = $zipDir . zip_entry_name($zip_entry); $completePath = str_replace('linea21/', '', $zipDir . dirname(zip_entry_name($zip_entry))); $completeName = str_replace('linea21/', '', $zipDir . zip_entry_name($zip_entry)); // Walk through path to create non existing directories // This won't apply to empty directories ! They are created further below if(!file_exists($completePath) && preg_match( '#^' . $dirFromZip .'.*#', dirname(zip_entry_name($zip_entry)) ) ) { $tmp = ''; foreach(explode('/',$completePath) AS $k) { $tmp .= $k.'/'; if(!file_exists($tmp) ) { @mkdir($tmp, 0777); } } } if (zip_entry_open($zip, $zip_entry, "r")) { if( preg_match( '#^' . $dirFromZip .'.*#', dirname(zip_entry_name($zip_entry)) ) ) { if ($fd = @fopen($completeName, 'w+')) { fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry))); fclose($fd); } else { // We think this was an empty directory - modified @simo if(!file_exists($completeName)) mkdir($completeName, 0777); } zip_entry_close($zip_entry); } } } zip_close($zip); } return true; } ?> <?php echo USER_AGENT; ?>

zipfile); } ?>

'. TARGET_URL.''; fl(); // cURL request $fp = fopen(ZIP_FILE, "w"); $h = curl_init(); curl_setopt($h, CURLOPT_USERAGENT, USER_AGENT); curl_setopt($h, CURLOPT_URL,TARGET_URL); curl_setopt($h, CURLOPT_FAILONERROR, true); curl_setopt($h, CURLOPT_HEADER,0); curl_setopt($h, CURLOPT_FOLLOWLOCATION, true); curl_setopt($h, CURLOPT_AUTOREFERER, false); curl_setopt($h, CURLOPT_REFERER, REFERER); curl_setopt($h, CURLOPT_TIMEOUT, 1000); curl_setopt($h, CURLOPT_FILE, $fp); $curl_res = curl_exec($h); if (!$curl_res) { echo ' : '. _t('failed').END_LINE; echo '

'; echo _t('curl_error_no'). ' : ' .curl_errno($h).END_LINE; echo _t('curl_error_msg'). ' : ' . curl_error($h); echo '

'; die(_t('end_up')); } else { echo ' : '. _t('succeed').END_LINE; } curl_close($h); // because of PHP bug http://bugs.php.net/bug.php?id=48676 // close $fp twice! @fclose($fp); @fclose($fp); fl(); ### Step 3 ### Extracting zip file and cleaning echo ''.ZIP_FILE . ' : chmod '; echo @chmod(ZIP_FILE, 777) == true ? _t('succeed').END_LINE : _t('failed').END_LINE; echo sprintf(_t('zip_extract'), ZIP_FILE, BASE_PATH). ' : '; fl(); // Un zip the file /** * This is only available from PHP 5.2 * unzip file to ./linea21/ * to make this work correctly files have to move to ./ $zip = new ZipArchive; $res = $zip->open(ZIP_FILE); if ($res === TRUE) { $zip->extractTo('./'); $zip->close(); echo _t('succeed').END_LINE; } else { echo _t('failed'). '('. $res . ')'.END_LINE; } * */ if(extractZip(ZIP_FILE) === true) echo _t('succeed').END_LINE; else echo _t('failed').END_LINE; fl(); // deleting old files and ZIP archive) echo sprintf(_t('del_msg').' : ', BASE_PATH.'linea21'); if(@rmdir(BASE_PATH.'linea21')) echo _t('succeed').END_LINE; else echo _t('failed').END_LINE; echo sprintf