Changeset 2869
- Timestamp:
- Nov 13, 2008, 11:03:28 PM (15 years ago)
- 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; 1 html, body { 2 min-height: 100%; 12 3 } 13 4 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; 17 9 } 18 #main { 19 padding:1em 2em; 20 border:1px #ccc solid; 21 -moz-border-radius:8px; 22 -webkit-border-radius:8px; 10 11 a { 12 border-width: 0; 13 text-decoration: none; 14 color: #FF7700; 15 } 16 17 body { 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; 23 56 } 24 57 25 58 #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; 29 63 } 30 64 65 h2 { 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 } 31 82 32 h1,h2 { 33 font-family: Arial,Helvetica,sans-serif; 83 h3 { 84 font-size: 15px; 85 font-weight: bold; 34 86 } 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 88 select, input { 89 border: 1px solid #666666; 90 background-color: #444444; 91 color: #999999; 92 font-size: 1em; 93 margin: 0; 43 94 } 44 h2 { 45 color: #f90; 95 96 input[type="submit"] { 97 text-align: center; 98 background-color: #222222; 99 border-color: #FF3363; 100 color: #FF3363; 46 101 } 47 h3 { 48 margin-top:0; 102 103 input[type="submit"]:hover { 104 cursor: pointer; 105 color: #999; 106 border-color: #666; 49 107 } 108 50 109 label { 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; 53 127 } 54 128 55 129 .msg { 56 padding:10px 10px 10px 42px; 57 -moz-border-radius:8px; 58 -webkit-border-radius:8px; 130 padding: 3px 35px; 59 131 } 132 133 .notice { 134 color: #f70; 135 } 136 60 137 .warning { 61 background: #ffc url(img/important.png) no-repeat 10px 10px;138 color: #f30; 62 139 } 63 .notice {64 background: #eef url(img/note.png) no-repeat 10px 10px;65 } -
extras/auto-install/trunk/piwigo-loader.php
r2860 r2869 11 11 # -- END LICENSE BLOCK ------------------------------------ 12 12 13 // +-----------------------------------------------------------------------+ 14 // | Configuration | 15 // +-----------------------------------------------------------------------+ 16 17 define('DC_LOADER_SERVICE','http://piwigo.free.fr/loader/'); 18 define('DC_LOADER_ARCHIVE','http://download.gna.org/phpwebgallery/release/2.0/candidate/phpwebgallery-2.0.0RC4.zip'); 19 20 // +-----------------------------------------------------------------------+ 21 13 22 error_reporting(E_ALL & ~E_NOTICE); 14 23 15 if (function_exists('date_default_timezone_set')) { 24 if (function_exists('date_default_timezone_set')) 25 { 16 26 date_default_timezone_set('UTC'); 17 } elseif (!ini_get('safe_mode') && function_exists('putenv')) { 27 } 28 elseif (!ini_get('safe_mode') && function_exists('putenv')) 29 { 18 30 putenv('TZ=UTC'); 19 31 } 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());26 32 27 33 $can_write = is_writable(dirname(__FILE__)); 28 34 $can_fetch = false; 29 if ((boolean)ini_get('allow_url_fopen')) { 35 if ((boolean)ini_get('allow_url_fopen')) 36 { 30 37 $can_fetch = true; 31 38 } 32 if (function_exists('curl_init')) { 39 if (function_exists('curl_init')) 40 { 33 41 $can_fetch = true; 34 42 define('DC_LOADER_CURL',true); 35 43 } 36 44 45 define('DC_LOADER_LANG', getLanguage()); 46 37 47 $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); 49 if (!$got_php5 && $step != 2) 50 { 40 51 $step = 1; 41 52 } 42 53 43 function __($str) 44 { 45 return $str; 54 function l10n($str) 55 { 56 global $lang; 57 58 return isset($lang[$str]) ? $lang[$str] : $str; 46 59 } 47 60 48 61 function fetchRemote($src,&$dest,$step=0) # Rudimentary HTTP client 49 62 { 50 if ($step > 3) { 63 if ($step > 3) 64 { 51 65 return false; 52 66 } … … 56 70 $path = $src['path']; 57 71 58 if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false) { 72 if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false) 73 { 59 74 return false; 60 75 } … … 74 89 $line = fgets($s,4096); 75 90 76 if (rtrim($line,"\r\n") == '' && !$in_content) { 91 if (rtrim($line,"\r\n") == '' && !$in_content) 92 { 77 93 $in_content = true; 78 94 $i++; … … 81 97 82 98 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 { 84 101 fclose($s); 85 102 return false; 86 103 } 87 104 $status = (integer) $m[2]; 88 if ($status < 200 || $status >= 400) { 105 if ($status < 200 || $status >= 400) 106 { 89 107 fclose($s); 90 108 return false; … … 94 112 if (!$in_content) 95 113 { 96 if (preg_match('/Location:\s+?(.+)$/',rtrim($line,"\r\n"),$m)) { 114 if (preg_match('/Location:\s+?(.+)$/',rtrim($line,"\r\n"),$m)) 115 { 97 116 fclose($s); 98 117 return fetchRemote(trim($m[1]),$dest,$step+1); … … 102 121 } 103 122 104 if (is_resource($dest)) { 123 if (is_resource($dest)) 124 { 105 125 fwrite($dest,$line); 106 } else { 126 } 127 else 128 { 107 129 $dest .= $line; 108 130 } … … 115 137 } 116 138 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; 139 function 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; 132 176 } 133 177 … … 163 207 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 164 208 ' "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". 166 210 "<head>\n". 167 ' 168 ' <title>'.__('Piwigo NetInstall').'</title>'."\n".169 ' 170 ' 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". 171 215 '</head>'."\n". 172 216 '<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"; 176 221 } 177 222 … … 180 225 echo 181 226 '</div>'."\n". 182 '</div>'."\n".183 227 '<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". 185 229 '</div>'."\n". 186 230 '</body>'."\n". … … 192 236 $htaccess = dirname(__FILE__).'/.htaccess'; 193 237 if (file_exists($htaccess)) { 194 if (!is_readable($htaccess) || !is_writable($htaccess)) { 238 if (!is_readable($htaccess) || !is_writable($htaccess)) 239 { 195 240 return false; 196 241 } 197 242 } 198 243 $rawdatas = ''; 199 if (!fetchRemote(DC_LOADER_SERVICE.'hosting.txt',$rawdatas)) { 244 if (!fetchRemote(DC_LOADER_SERVICE.'hosting.txt',$rawdatas)) 245 { 200 246 return false; 201 247 } 202 248 $rawdatas = explode("\n",$rawdatas); 203 if (!($my_hostname = @gethostbyaddr($_SERVER['SERVER_ADDR']))) { 249 if (!($my_hostname = @gethostbyaddr($_SERVER['SERVER_ADDR']))) 250 { 204 251 return false; 205 252 } … … 207 254 foreach ($rawdatas as $line) { 208 255 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 { 210 258 $found = $rule; 211 259 break; … … 213 261 } 214 262 if ($found) { 215 if (false !== ($fh = @fopen($htaccess,"ab"))) { 263 if (false !== ($fh = @fopen($htaccess,"ab"))) 264 { 216 265 fwrite($fh,"\n".$found); 217 266 fclose($fh); … … 224 273 function cleanFiles() 225 274 { 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'); 229 278 } 230 279 … … 236 285 $dc_zip = @fopen(dirname(__FILE__).'/piwigo-install.zip','wb'); 237 286 238 if (!$lib_files || !$lib_unzip || !$dc_zip) { 287 if (!$lib_files || !$lib_unzip || !$dc_zip) 288 { 239 289 return false; 240 290 } 241 291 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 { 245 298 $failed = false; 246 299 } … … 252 305 fclose($dc_zip); 253 306 254 if ($failed) { 307 if ($failed) 308 { 255 309 cleanFiles(); 256 310 return false; … … 261 315 function writeMessage($level,$title,$lines) 262 316 { 263 if (empty($lines)) { 317 if (empty($lines)) 318 { 264 319 return; 265 320 } 266 321 267 322 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"; 274 331 } 275 332 … … 277 334 { 278 335 echo 279 '<form action="'.$_SERVER['SCRIPT_NAME'].' " method="post">'.336 '<form action="'.$_SERVER['SCRIPT_NAME'].'?language='.DC_LOADER_LANG.'" method="post">'. 280 337 $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 345 if (!$can_fetch) 346 { 347 // No traduction for this part because can't fetch! 288 348 openPage(); 289 349 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.' 295 355 )); 296 356 closePage(); … … 298 358 } 299 359 300 switch ($step) { 360 switch ($step) 361 { 301 362 case 1 : { 302 363 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').' '."\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 303 381 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"; 307 384 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.') 312 390 )); 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.') 320 399 )); 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> '. 326 406 getLocation(). 327 ' <input type="text" id="destination" name="destination" '.407 ' <input type="text" id="destination" name="destination" '. 328 408 'value="piwigo" size="15" maxlength="100" /></p>' 329 409 ); … … 332 412 break; 333 413 } 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 { 337 420 header('Location: '.$_SERVER['SCRIPT_NAME'].'?step=1'); 338 421 } 339 422 } 340 elseif ($got_php5) { 423 elseif ($got_php5) 424 { 341 425 header('Location: '.$_SERVER['SCRIPT_NAME'].'?step=1'); 342 426 } 343 else { 427 else 428 { 344 429 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.') 349 434 )); 350 435 closePage(); … … 352 437 break; 353 438 } 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 ?!')); 356 442 $text = ''; 357 443 if (!empty($_POST['submit']) && isset($_POST['destination'])) … … 361 447 $dest = preg_replace('#/+#','/',$dest); 362 448 363 if (file_exists(dirname(__FILE__).'/./'.$dest.'/include/mysql.inc.php') || file_exists(dirname(__FILE__).'/./'.$dest.'/i clude/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...'); 367 453 } 368 454 elseif (grabFiles()) … … 370 456 $lib_files = dirname(__FILE__).'/pwg_files.php'; 371 457 $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.'); 375 462 } 376 463 … … 379 466 $uz = new fileUnzip($dc_zip); 380 467 $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.'); 383 471 } 384 472 385 473 foreach ($files as $k => $v) 386 474 { 387 if ($v['is_dir']) { 475 if ($v['is_dir']) 476 { 388 477 continue; 389 478 } 390 $t = preg_replace('#^ '.DC_LOADER_DIRECTORY.'/#','./'.$dest.'/',$k);479 $t = preg_replace('#^[^/]*/#','./'.$dest.'/',$k); 391 480 $uz->unzip($k,$t); 392 481 } 393 394 482 $uz->close; 483 unset($uz); 395 484 396 if (!is_dir(dirname(__FILE__).'/ ./'.$dest))485 if (!is_dir(dirname(__FILE__).'/'.$dest)) 397 486 { 398 $msg[] = __('It seems that the zip file was not extracted.');487 $msg[] = l10n('It seems that the zip file was not extracted.'); 399 488 } 400 489 else 401 490 { 402 # Remove files, create public directory, and self-destruction 403 files::makeDir('./'.$dest.'/public'); 491 # Remove files and self-destruction 404 492 cleanFiles(); 405 493 unlink(__FILE__); … … 407 495 $redir = preg_replace('#/+#','/',str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])).'/'.$dest.'/install.php'); 408 496 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>'; 414 503 } 415 504 } 416 505 else 417 506 { 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.'); 419 508 } 420 509 } 421 510 openPage(); 422 writeMessage('warning', __('Something went wrong...'),$msg);511 writeMessage('warning',l10n('Something went wrong...'),$msg); 423 512 echo $text; 424 513 closePage();
Note: See TracChangeset
for help on using the changeset viewer.