Changeset 2869


Ignore:
Timestamp:
Nov 13, 2008, 11:03:28 PM (15 years ago)
Author:
patdenice
Message:
  • add multi-language support to auto-install script.
  • Add roma theme to piwigo-loader.
Location:
extras/auto-install/trunk
Files:
25 added
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • extras/auto-install/trunk/loader.css

    r2852 r2869  
    1 /*
    2         loader.css
    3         Simple CSS rules for NetInstall
    4        
    5         (c) 2008 - Piwigo - All rights reserved.
    6         Please see http://phpwebgallery.net/ for more details.
    7 */
    8 body {
    9         font: 0.8em "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;
    10         color: #000;
    11         background-color: #fff;
     1html, body {
     2  min-height: 100%;
    123}
    134
    14 #page {
    15         width:500px;
    16         margin:1em auto;
     5*, :focus, :active, input:active, a:active, input:focus, a:focus {
     6  outline-color: -moz-use-text-color;
     7  outline-style: none;
     8  outline-width: 0;
    179}
    18 #main {
    19         padding:1em 2em;
    20         border:1px #ccc solid;
    21         -moz-border-radius:8px;
    22         -webkit-border-radius:8px;
     10
     11a {
     12  border-width: 0;
     13  text-decoration: none;
     14  color: #FF7700;
     15}
     16
     17body {
     18  background: #111111 url(images/bottom-left-bg.png) no-repeat fixed left bottom;
     19  color: #666666;
     20  margin: 0;
     21  padding: 0;
     22  min-width: 60em;
     23  font-family: Univers,Helvetica,Optima,"Bitstream Vera Sans",sans-serif;
     24  font-size: 0.8em;
     25  text-align: center;
     26}
     27
     28#headbranch {
     29  background: transparent url(images/top-left-bg.png) no-repeat scroll left top;
     30  height: 240px;
     31  left: 0;
     32  margin: 0;
     33  padding: 0;
     34  position: absolute;
     35  top: 0;
     36  width: 233px;
     37  z-index: 0;
     38}
     39
     40#theHeader {
     41  background: transparent url(images/piwigo_logo_sombre_214x100.png) no-repeat scroll 245px top;
     42  margin: 0;
     43  min-height: 105px;
     44  padding: 0;
     45}
     46
     47#content {
     48  background: #222222 url(images/fillet.png) repeat-x scroll left top;
     49  margin: auto;
     50  margin-top: 9px;
     51  text-align: left;
     52  width: 800px;
     53  padding: 25px;
     54  z-index: 99;
     55  color: #666666;
    2356}
    2457
    2558#footer {
    26         text-align:right;
    27         width:500px;
    28         margin:1em auto;
     59  width: 800px;
     60  margin: auto;
     61  text-align: right;
     62  margin-top: 15px;
    2963}
    3064
     65h2 {
     66  color: #666666;
     67  font-weight: bold;
     68  letter-spacing: 2px;
     69  text-align: right;
     70  text-transform: none;
     71  width: 54%;
     72  display: block;
     73  font-size: 28px;
     74  height: 104px;
     75  margin: 0 20px;
     76  overflow: hidden;
     77  padding: 0;
     78  position: absolute;
     79  right: 0;
     80  top: 0;
     81}
    3182
    32 h1,h2 {
    33         font-family: Arial,Helvetica,sans-serif;
     83h3 {
     84  font-size: 15px;
     85  font-weight: bold;
    3486}
    35 h1 {
    36         background: url(img/w-logo.png) no-repeat top center;
    37         font-size:1.8em;
    38         font-weight:normal;
    39         text-align:center;
    40         color: #666;
    41         padding-top: 70px;
    42         margin: 0 0 0.75em 0;
     87
     88select, input {
     89  border: 1px solid #666666;
     90  background-color: #444444;
     91  color: #999999;
     92  font-size: 1em;
     93  margin: 0;
    4394}
    44 h2 {
    45         color: #f90;
     95
     96input[type="submit"] {
     97  text-align: center;
     98  background-color: #222222;
     99  border-color: #FF3363;
     100  color: #FF3363;
    46101}
    47 h3 {
    48         margin-top:0;
     102
     103input[type="submit"]:hover {
     104  cursor: pointer;
     105  color: #999;
     106  border-color: #666;
    49107}
     108
    50109label {
    51         font-weight: bold;
    52         color: #555;
     110  color: #ff3363
     111}
     112
     113.destination {
     114  text-align: center;
     115  margin-top: 2em;
     116  font-weight: bold;
     117}
     118
     119.language {
     120  margin-left: 1.5em;
     121  margin-bottom: 2em;
     122}
     123
     124.button {
     125  text-align: center;
     126  margin-top: 2em;
    53127}
    54128
    55129.msg {
    56         padding:10px 10px 10px 42px;
    57         -moz-border-radius:8px;
    58         -webkit-border-radius:8px;
     130  padding: 3px 35px;
    59131}
     132
     133.notice {
     134  color: #f70;
     135}
     136
    60137.warning {
    61         background: #ffc url(img/important.png) no-repeat 10px 10px;
     138  color: #f30;
    62139}
    63 .notice {
    64         background: #eef url(img/note.png) no-repeat 10px 10px;
    65 }
  • extras/auto-install/trunk/piwigo-loader.php

    r2860 r2869  
    1111# -- END LICENSE BLOCK ------------------------------------
    1212
     13// +-----------------------------------------------------------------------+
     14// |                                                                                                                     Configuration                                                                                                   |
     15// +-----------------------------------------------------------------------+
     16
     17define('DC_LOADER_SERVICE','http://piwigo.free.fr/loader/');
     18define('DC_LOADER_ARCHIVE','http://download.gna.org/phpwebgallery/release/2.0/candidate/phpwebgallery-2.0.0RC4.zip');
     19
     20// +-----------------------------------------------------------------------+
     21
    1322error_reporting(E_ALL & ~E_NOTICE);
    1423
    15 if (function_exists('date_default_timezone_set')) {
     24if (function_exists('date_default_timezone_set'))
     25{
    1626        date_default_timezone_set('UTC');
    17 } elseif (!ini_get('safe_mode') && function_exists('putenv')) {
     27}
     28elseif (!ini_get('safe_mode') && function_exists('putenv'))
     29{
    1830        putenv('TZ=UTC');
    1931}
    20 
    21 define('DC_LOADER_VERSION','0.8');
    22 define('DC_LOADER_SERVICE','http://piwigo.duretz.net/');
    23 define('DC_LOADER_ARCHIVE','http://piwigo.duretz.net/latest.zip');
    24 define('DC_LOADER_DIRECTORY','phpwebgallery-1.7.3');
    25 define('DC_LOADER_LANG', getLanguage());
    2632
    2733$can_write = is_writable(dirname(__FILE__));
    2834$can_fetch = false;
    29 if ((boolean)ini_get('allow_url_fopen')) {
     35if ((boolean)ini_get('allow_url_fopen'))
     36{
    3037        $can_fetch = true;
    3138}
    32 if (function_exists('curl_init')) {
     39if (function_exists('curl_init'))
     40{
    3341        $can_fetch = true;
    3442        define('DC_LOADER_CURL',true);
    3543}
    3644
     45define('DC_LOADER_LANG', getLanguage());
     46
    3747$step = !empty($_REQUEST['step']) ? (integer)$_REQUEST['step'] : 1;
    38 $got_php5  = (strpos(PHP_VERSION,'5') === 0);
    39 if (!$got_php5 && $step != 2) {
     48$got_php5       = (strpos(PHP_VERSION,'5') === 0);
     49if (!$got_php5 && $step != 2)
     50{
    4051        $step = 1;
    4152}
    4253
    43 function __($str)
    44 {
    45         return $str;
     54function l10n($str)
     55{
     56        global $lang;
     57
     58        return isset($lang[$str]) ? $lang[$str] : $str;
    4659}
    4760
    4861function fetchRemote($src,&$dest,$step=0) # Rudimentary HTTP client
    4962{
    50         if ($step > 3) {
     63        if ($step > 3)
     64        {
    5165                return false;
    5266        }
     
    5670        $path = $src['path'];
    5771       
    58         if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false) {
     72        if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false)
     73        {
    5974                return false;
    6075        }
     
    7489                $line = fgets($s,4096);
    7590               
    76                 if (rtrim($line,"\r\n") == '' && !$in_content) {
     91                if (rtrim($line,"\r\n") == '' && !$in_content)
     92                {
    7793                        $in_content = true;
    7894                        $i++;
     
    8197               
    8298                if ($i == 0) {
    83                         if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/',rtrim($line,"\r\n"), $m)) {
     99                        if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/',rtrim($line,"\r\n"), $m))
     100                        {
    84101                                fclose($s);
    85102                                return false;
    86103                        }
    87104                        $status = (integer) $m[2];
    88                         if ($status < 200 || $status >= 400) {
     105                        if ($status < 200 || $status >= 400)
     106                        {
    89107                                fclose($s);
    90108                                return false;
     
    94112                if (!$in_content)
    95113                {
    96                         if (preg_match('/Location:\s+?(.+)$/',rtrim($line,"\r\n"),$m)) {
     114                        if (preg_match('/Location:\s+?(.+)$/',rtrim($line,"\r\n"),$m))
     115                        {
    97116                                fclose($s);
    98117                                return fetchRemote(trim($m[1]),$dest,$step+1);
     
    102121                }
    103122               
    104                 if (is_resource($dest)) {
     123                if (is_resource($dest))
     124                {
    105125                        fwrite($dest,$line);
    106                 } else {
     126                }
     127                else
     128                {
    107129                        $dest .= $line;
    108130                }
     
    115137}
    116138
    117 function getLanguage($default = 'en')
    118 {
    119         $supported = array('fr','en');
    120         if (!empty($_REQUEST['lang']) && in_array($_REQUEST['lang'],$supported)) {
    121                 return $_REQUEST['lang'];
    122         }
    123         if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
    124                 $languages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
    125                 $l = explode(';',$languages[0]);
    126                 $dlang = substr(trim($l[0]),0,2);
    127                 if (in_array($dlang, $supported)) {
    128                         return $dlang;
    129                 }
    130         }
    131         return $default;
     139function getLanguage()
     140{
     141        global $can_fetch, $lang, $available_languages;
     142
     143        $language = 'en_UK';
     144        $available_languages = array();
     145
     146        // Rertrieve available languages
     147        if ($can_fetch and fetchRemote(DC_LOADER_SERVICE.'get_language.php', $str))
     148        {
     149                $available_languages = @unserialize($str);
     150        }
     151
     152        if (isset($_GET['language']))
     153        {
     154                $language = strip_tags($_GET['language']);
     155        }
     156        else
     157        {
     158                // Try to get browser language
     159                foreach ($available_languages as $language_code => $language_name)
     160                {
     161                        if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2))
     162                        {
     163                                $language = $language_code;
     164                                break;
     165                        }
     166                }
     167        }
     168
     169        // Retrieve traductions
     170        if ($can_fetch and fetchRemote(DC_LOADER_SERVICE.'language/'.$language.'/loader.lang.txt', $code))
     171        {
     172                @eval($code);
     173        }
     174
     175        return $language;
    132176}
    133177
     
    163207        '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.
    164208        ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
    165         '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.DC_LOADER_LANG.'" lang="'.DC_LOADER_LANG.'">'."\n".
     209        '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.substr(DC_LOADER_LANG,0,2).'" lang="'.substr(DC_LOADER_LANG,0,2).'">'."\n".
    166210        "<head>\n".
    167         '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n".
    168         '  <title>'.__('Piwigo NetInstall').'</title>'."\n".
    169         '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n".
    170         '  <link rel="stylesheet" type="text/css" media="screen" href="'.DC_LOADER_SERVICE.'loader.css" />'."\n".
     211        ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n".
     212        ' <title>'.l10n('Piwigo NetInstall').'</title>'."\n".
     213        ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n".
     214        ' <link rel="stylesheet" type="text/css" media="screen" href="'.DC_LOADER_SERVICE.'loader.css" />'."\n".
    171215        '</head>'."\n".
    172216        '<body>'."\n".
    173         '<div id="page">'."\n".
    174         '<h1>'.__('Piwigo NetInstall').'</h1>'."\n".
    175         '<div id="main">'."\n";
     217        '<div id="headbranch"></div>'."\n".
     218        '<div id="theHeader"></div>'."\n".
     219        '<div id="content">'."\n".
     220        '<h2>'.l10n('Piwigo NetInstall').'</h2>'."\n";
    176221}
    177222
     
    180225        echo
    181226        '</div>'."\n".
    182         '</div>'."\n".
    183227        '<div id="footer">'."\n".
    184     '<p>This loader was initialy coded for <a href="http://www.dotclear.net" title="Dotclear">Dotclear</a>. Thanks !</p>'.
     228        l10n('This loader was initialy coded for <a href="http://www.dotclear.net" title="Dotclear">Dotclear</a>. Thanks!')."\n".
    185229        '</div>'."\n".
    186230        '</body>'."\n".
     
    192236        $htaccess = dirname(__FILE__).'/.htaccess';
    193237        if (file_exists($htaccess)) {
    194                 if (!is_readable($htaccess) || !is_writable($htaccess)) {
     238                if (!is_readable($htaccess) || !is_writable($htaccess))
     239                {
    195240                        return false;
    196241                }
    197242        }
    198243        $rawdatas = '';
    199         if (!fetchRemote(DC_LOADER_SERVICE.'hosting.txt',$rawdatas)) {
     244        if (!fetchRemote(DC_LOADER_SERVICE.'hosting.txt',$rawdatas))
     245        {
    200246                return false;
    201247        }
    202248        $rawdatas = explode("\n",$rawdatas);
    203         if (!($my_hostname = @gethostbyaddr($_SERVER['SERVER_ADDR']))) {
     249        if (!($my_hostname = @gethostbyaddr($_SERVER['SERVER_ADDR'])))
     250        {
    204251                return false;
    205252        }
     
    207254        foreach ($rawdatas as $line) {
    208255                list($name,$hostname,$rule) = explode('|',trim($line));
    209                 if (preg_match('!'.preg_quote($hostname).'$!',$my_hostname)) {
     256                if (preg_match('!'.preg_quote($hostname).'$!',$my_hostname))
     257                {
    210258                        $found = $rule;
    211259                        break;
     
    213261        }
    214262        if ($found) {
    215                 if (false !== ($fh = @fopen($htaccess,"ab"))) {
     263                if (false !== ($fh = @fopen($htaccess,"ab")))
     264                {
    216265                        fwrite($fh,"\n".$found);
    217266                        fclose($fh);
     
    224273function cleanFiles()
    225274{
    226         unlink(dirname(__FILE__).'/pwg_files.php');
    227         unlink(dirname(__FILE__).'/pwg_unzip.php');
    228         unlink(dirname(__FILE__).'/piwigo-install.zip');
     275        @unlink(dirname(__FILE__).'/pwg_files.php');
     276        @unlink(dirname(__FILE__).'/pwg_unzip.php');
     277        @unlink(dirname(__FILE__).'/piwigo-install.zip');
    229278}
    230279
     
    236285        $dc_zip    = @fopen(dirname(__FILE__).'/piwigo-install.zip','wb');
    237286       
    238         if (!$lib_files || !$lib_unzip || !$dc_zip) {
     287        if (!$lib_files || !$lib_unzip || !$dc_zip)
     288        {
    239289                return false;
    240290        }
    241291       
    242         if (fetchRemote(DC_LOADER_SERVICE.'lib.files.php.txt',$lib_files)) {
    243                 if (fetchRemote(DC_LOADER_SERVICE.'class.unzip.php.txt',$lib_unzip)) {
    244                         if (fetchRemote(DC_LOADER_ARCHIVE.'',$dc_zip)) {
     292        if (fetchRemote(DC_LOADER_SERVICE.'lib.files.txt',$lib_files))
     293        {
     294                if (fetchRemote(DC_LOADER_SERVICE.'class.unzip.txt',$lib_unzip))
     295                {
     296                        if (fetchRemote(DC_LOADER_ARCHIVE.'',$dc_zip))
     297                        {
    245298                                $failed = false;
    246299                        }
     
    252305        fclose($dc_zip);
    253306       
    254         if ($failed) {
     307        if ($failed)
     308        {
    255309                cleanFiles();
    256310                return false;
     
    261315function writeMessage($level,$title,$lines)
    262316{
    263         if (empty($lines)) {
     317        if (empty($lines))
     318        {
    264319                return;
    265320        }
    266321       
    267322        echo
    268         '<div class="msg '.$level.'">'.
    269         '<h3>'.$title.'</h3>';
    270         foreach ($lines as $line) {
    271                 echo '<p>'.$line.'</p>';
    272         }
    273         echo '</div>';
     323        '<div class="msg '.$level.'">'."\n".
     324        '<h3>'.$title.'</h3>'."\n".
     325        '<p>'."\n";
     326        foreach ($lines as $line)
     327        {
     328                echo $line.'<br />'."\n";
     329        }
     330        echo '</p></div>'."\n";
    274331}
    275332
     
    277334{
    278335        echo
    279         '<form action="'.$_SERVER['SCRIPT_NAME'].'" method="post">'.
     336        '<form action="'.$_SERVER['SCRIPT_NAME'].'?language='.DC_LOADER_LANG.'" method="post">'.
    280337        $more.
    281         '<p><input type="hidden" name="step" value="'.$step.'" />'.
    282         '<input type="hidden" name="lang" value="'.DC_LOADER_LANG.'" />'.
    283         '<input type="submit" name="submit" value="'.$label.'" />'.
    284         '</p></form>';
    285 }
    286 
    287 if (!$can_fetch) {
     338        '<p class="button"><input type="hidden" name="step" value="'.$step.'" />'."\n".
     339        '<input type="hidden" name="lang" value="'.DC_LOADER_LANG.'" />'."\n".
     340        '<input type="submit" name="submit" value="'.$label.'"/>'."\n".
     341        '</p></form>'."\n";
     342}
     343
     344
     345if (!$can_fetch)
     346{
     347        // No traduction for this part because can't fetch!
    288348        openPage();
    289349        echo
    290         '<h2>'.__('NetInstall').'</h2>'."\n";
    291         writeMessage('warning',__('Damnit !'), array(
    292                 __('Due to restrictions in your PHP configuration, NetInstall cannot get its job done.'),
    293                 __('Please see Piwigo documentation to perform a normal installation.'),
    294                 __('Really sorry for the inconvenience.')
     350        '<h2>Piwigo NetInstall</h2>'."\n";
     351        writeMessage('warning','Damnit!', array(
     352                'Due to restrictions in your PHP configuration, NetInstall cannot get its job done.',
     353                'Please see Piwigo documentation to perform a normal installation.',
     354                'Really sorry for the inconvenience.'
    295355        ));
    296356        closePage();
     
    298358}
    299359
    300 switch ($step) {
     360switch ($step)
     361{
    301362        case 1 : {
    302363                openPage();
     364                echo '<h3>'.l10n('Welcome to NetInstall!').'</h3>'."\n";
     365
     366                // Show available languages
     367                if (!empty($available_languages))
     368                {
     369                        echo
     370                        '<p class="language">'.l10n('Language').' &nbsp;'."\n".
     371                        '<select name="language" onchange="document.location = \''.basename(__FILE__).'?language=\'+this.options[this.selectedIndex].value;">'."\n";
     372
     373                        foreach ($available_languages as $language_code => $language_name)
     374                        {
     375                                echo '<option label="'.$language_name.'" value="'.$language_code.'" '.($language_code == DC_LOADER_LANG ? 'selected="selected"' : '').'>'.$language_name.'</option>'."\n";
     376                        }
     377                        echo '</select>'."\n".
     378                        '</p>'."\n";
     379                }
     380
    303381                echo
    304                 '<h2>'.__('Welcome to NetInstall').'</h2>'."\n".
    305                 '<p>'.__('This tool is meant to retrieve the latest Piwigo archive and unzip it in your webspace.').'</p>'.
    306                 '<p>'.__('Right after then, you will be redirect to the Piwigo Setup Wizard.').'</p>';
     382                '<p>'.l10n('This tool is meant to retrieve the latest Piwigo archive and unzip it in your webspace.').'<br />'."\n".
     383                l10n('Right after then, you will be redirect to the Piwigo Setup Wizard.').'</p>'."\n";
    307384               
    308                 if (!$can_write) {
    309                         writeMessage('warning',__('Write access is needed'), array(
    310                                 __('It looks like NetInstall wont be able to write in the current directory, and this is required to follow on.'),
    311                                 __('Please try to change the permissions to allow write access, then reload this page by hitting the Refresh button.')
     385                if (!$can_write)
     386                {
     387                        writeMessage('warning',l10n('Write access is needed'), array(
     388                                l10n('It looks like NetInstall wont be able to write in the current directory, and this is required to follow on.'),
     389                                l10n('Please try to change the permissions to allow write access, then reload this page by hitting the Refresh button.')
    312390                        ));
    313                         nextAction(__('Refresh'),1);
    314                 }
    315                 elseif (!$got_php5) {
    316                         writeMessage('notice',__('PHP 5 is required'), array(
    317                                 sprintf(__('It appears your webhost is currently running PHP %s.'), PHP_VERSION),
    318                                 __('NetInstall may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'),
    319                                 __('Note you can change your configuration by yourself and restart NetInstall after that.')
     391                        nextAction(l10n('Refresh'),1);
     392                }
     393                elseif (!$got_php5)
     394                {
     395                        writeMessage('notice',l10n('PHP 5 is required'), array(
     396                                sprintf(l10n('It appears your webhost is currently running PHP %s.'), PHP_VERSION),
     397                                l10n('NetInstall may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'),
     398                                l10n('Note you can change your configuration by yourself and restart NetInstall after that.')
    320399                        ));
    321                         nextAction(__('Try to configure PHP 5'),2);
    322                 }
    323                 else {
    324                         nextAction(__('Retrieve and unzip Piwigo'),3,
    325                                 '<p><label for="destination">'.__('Destination:').'</label> '.
     400                        nextAction(l10n('Try to configure PHP 5'),2);
     401                }
     402                else
     403                {
     404                        nextAction(l10n('Retrieve and unzip Piwigo'),3,
     405                                '<p class="destination"><label for="destination">'.l10n('Destination:').'</label> '.
    326406                                getLocation().
    327                                 '<input type="text" id="destination" name="destination" '.
     407                                ' <input type="text" id="destination" name="destination" '.
    328408                                'value="piwigo" size="15" maxlength="100" /></p>'
    329409                        );
     
    332412                break;
    333413        }
    334         case 2 : {
    335                 if (!empty($_POST['submit']) && !$got_php5) {
    336                         if (($got_php5 = initPHP5())) {
     414        case 2 :
     415        {
     416                if (!empty($_POST['submit']) && !$got_php5)
     417                {
     418                        if (($got_php5 = initPHP5()))
     419                        {
    337420                                header('Location: '.$_SERVER['SCRIPT_NAME'].'?step=1');
    338421                        }
    339422                }
    340                 elseif ($got_php5) {
     423                elseif ($got_php5)
     424                {
    341425                        header('Location: '.$_SERVER['SCRIPT_NAME'].'?step=1');
    342426                }
    343                 else {
     427                else
     428                {
    344429                        openPage();
    345                         writeMessage('warning',__('OMG !'),array(
    346                                 __('NetInstall was not able to configure PHP 5.'),
    347                                 __("You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."),
    348                                 __('Hope to see you back soon.')
     430                        writeMessage('warning',l10n('Sorry!'),array(
     431                                l10n('NetInstall was not able to configure PHP 5.'),
     432                                l10n("You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."),
     433                                l10n('Hope to see you back soon.')
    349434                        ));
    350435                        closePage();
     
    352437                break;
    353438        }
    354         case 3 : {
    355                 $msg = array(__('WTF are you doing here that way ?!'));
     439        case 3 :
     440        {
     441                $msg = array(l10n('What are you doing here that way ?!'));
    356442                $text = '';
    357443                if (!empty($_POST['submit']) && isset($_POST['destination']))
     
    361447                        $dest = preg_replace('#/+#','/',$dest);
    362448                       
    363                         if (file_exists(dirname(__FILE__).'/./'.$dest.'/include/mysql.inc.php') || file_exists(dirname(__FILE__).'/./'.$dest.'/iclude/default_config.inc.php'))
    364                         {
    365                                 $msg[] = __('It seems like a previous Piwigo installation is still sitting in that space.');
    366                                 $msg[] = __('You need to rename or remove it before we can go further...');
     449                        if (file_exists(dirname(__FILE__).'/./'.$dest.'/include/mysql.inc.php') || file_exists(dirname(__FILE__).'/./'.$dest.'/include/default_config.inc.php'))
     450                        {
     451                                $msg[] = l10n('It seems like a previous Piwigo installation is still sitting in that space.');
     452                                $msg[] = l10n('You need to rename or remove it before we can go further...');
    367453                        }
    368454                        elseif (grabFiles())
     
    370456                                $lib_files = dirname(__FILE__).'/pwg_files.php';
    371457                                $lib_unzip = dirname(__FILE__).'/pwg_unzip.php';
    372                                 $dc_zip    = dirname(__FILE__).'/piwigo-install.zip';
    373                                 if (!file_exists($lib_files) || !file_exists($lib_unzip) || !file_exists($dc_zip)) {
    374                                         $msg[] = __('Needed files are not present.');
     458                                $dc_zip         = dirname(__FILE__).'/piwigo-install.zip';
     459                                if (!file_exists($lib_files) || !file_exists($lib_unzip) || !file_exists($dc_zip))
     460                                {
     461                                        $msg[] = l10n('Needed files are not present.');
    375462                                }
    376463                               
     
    379466                                $uz = new fileUnzip($dc_zip);
    380467                                $files = $uz->getList();
    381                                 if (count($files) == 0) {
    382                                         $msg[] = __('Invalid zip file.');
     468                                if (count($files) == 0)
     469                                {
     470                                        $msg[] = l10n('Invalid zip file.');
    383471                                }
    384472                               
    385473                                foreach ($files as $k => $v)
    386474                                {
    387                                         if ($v['is_dir']) {
     475                                        if ($v['is_dir'])
     476                                        {
    388477                                                continue;
    389478                                        }
    390                                         $t = preg_replace('#^'.DC_LOADER_DIRECTORY.'/#','./'.$dest.'/',$k);
     479                                        $t = preg_replace('#^[^/]*/#','./'.$dest.'/',$k);
    391480                                        $uz->unzip($k,$t);
    392481                                }
    393                 $uz->close;
    394                 unset($uz);
     482                                $uz->close;
     483                                unset($uz);
    395484                               
    396                                 if (!is_dir(dirname(__FILE__).'/./'.$dest))
     485                                if (!is_dir(dirname(__FILE__).'/'.$dest))
    397486                                {
    398                                         $msg[] = __('It seems that the zip file was not extracted.');
     487                                        $msg[] = l10n('It seems that the zip file was not extracted.');
    399488                                }
    400489                                else
    401490                                {
    402                                         # Remove files, create public directory, and self-destruction
    403                                         files::makeDir('./'.$dest.'/public');
     491                                        # Remove files and self-destruction
    404492                                        cleanFiles();
    405493                                        unlink(__FILE__);
     
    407495                                        $redir = preg_replace('#/+#','/',str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])).'/'.$dest.'/install.php');
    408496                                       
    409                                         $text = '<h2>'.__('Congratulations!').'</h2>'
    410                                         .'<p>'.__('Everything went fine. You are now ready to start the installation procedure.').'</p>'
    411                                         .'<form action="'.$redir.'" method="get">'
    412                                         .'<p><input type="submit" value="'.__('Install now').'" /></p>'
    413                                         .'</form>';
     497                                        $text = '<h2>'.l10n('Congratulations!').'</h2>'
     498                                        .'<p>'.l10n('Everything went fine. You are now ready to start the installation procedure.').'</p>'
     499                                        .'<form action="'.$redir.'" method="get"><p class="button">'
     500                                        . '<input type="hidden" name="language" value="'.DC_LOADER_LANG.'">'
     501                                        . '<input type="submit" value="'.l10n('Install Piwigo now').'" />'
     502                                        . '</p></form>';
    414503                                }
    415504                        }
    416505                        else
    417506                        {
    418                                 $msg[] = __('An error occurred while grabbing the necessary files to go on.');
     507                                $msg[] = l10n('An error occurred while grabbing the necessary files to go on.');
    419508                        }
    420509                }
    421510                openPage();
    422                 writeMessage('warning',__('Something went wrong ...'),$msg);
     511                writeMessage('warning',l10n('Something went wrong...'),$msg);
    423512                echo $text;
    424513                closePage();
Note: See TracChangeset for help on using the changeset viewer.