'."\n";
}
function nextAction($label,$step,$more='')
{
echo
''."\n";
}
if (!defined('DC_LOADER_LANG'))
{
$lang['code'] = 'en';
$lang['direction'] = 'ltr';
// No traduction for this part because can't fetch!
openPage();
writeMessage('warning','Damnit!', array(
'Due to restrictions in your PHP configuration, NetInstall cannot get its job done.',
'Please see Piwigo documentation to perform a normal installation.',
'Really sorry for the inconvenience.'
));
closePage();
exit;
}
switch ($step)
{
case 1 :
{
openPage();
echo '';
closePage();
break;
}
case 2 :
{
if (!empty($_POST['submit']) && !$got_php5)
{
$got_php5 = initPHP5();
}
if ($got_php5)
{
header('Location: '.$_SERVER['SCRIPT_NAME'].'?step=1&language='.DC_LOADER_LANG);
}
else
{
openPage();
writeMessage('warning',l10n('Sorry!'),array(
l10n('NetInstall was not able to configure PHP 5.'),
l10n("You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."),
l10n('Hope to see you back soon.')
));
closePage();
}
break;
}
case 3 :
{
$msg = array(l10n('What are you doing here that way ?!'));
$text = '';
if (!empty($_POST['submit']) && isset($_POST['destination']))
{
$msg = array();
$dest = preg_replace('/[^A-Za-z0-9_\/-]/','',$_POST['destination']);
$dest = preg_replace('#/+#','/',$dest);
if (file_exists(dirname(__FILE__).'/./'.$dest.'/include/mysql.inc.php') || file_exists(dirname(__FILE__).'/./'.$dest.'/include/default_config.inc.php'))
{
$msg[] = l10n('It seems like a previous Piwigo installation is still sitting in that space.');
$msg[] = l10n('You need to rename or remove it before we can go further...');
}
elseif (grabFiles())
{
$lib_files = dirname(__FILE__).'/pwg_files.php';
$lib_unzip = dirname(__FILE__).'/pwg_unzip.php';
$dc_zip = dirname(__FILE__).'/piwigo-install.zip';
if (!file_exists($lib_files) || !file_exists($lib_unzip) || !file_exists($dc_zip))
{
$msg[] = l10n('Needed files are not present.');
}
require $lib_files;
require $lib_unzip;
$uz = new fileUnzip($dc_zip);
$files = $uz->getList();
if (!is_array($files) or count($files) == 0)
{
$msg[] = l10n('Invalid zip file.');
}
else
{
foreach ($files as $k => $v)
{
if ($v['is_dir'])
{
continue;
}
if (preg_match('#^[^/]*/_data#', $k))
{
continue;
}
$t = preg_replace('#^[^/]*/#','./'.$dest.'/',$k);
$uz->unzip($k,$t);
}
}
$uz->close;
unset($uz);
if (!is_dir(dirname(__FILE__).'/'.$dest))
{
$msg[] = l10n('It seems that the zip file was not extracted.');
}
else
{
# Remove files and self-destruction
cleanFiles();
unlink(__FILE__);
$redir = preg_replace('#/+#','/',str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])).'/'.$dest.'/install.php');
$text = '';
}
}
else
{
$msg[] = l10n('An error occurred while grabbing the necessary files to go on.');
}
}
openPage();
writeMessage('warning',l10n('Something went wrong...'),$msg);
echo $text;
closePage();
break;
}
}