$v) { $v = base64_decode($v); $fp = fopen($dest.$f,'w'); fwrite($fp,$v,strlen($v)); fclose($fp); chmod($dest.'/'.$f,fileperms($dest) & ~0111); } unlink($dest.$archive); } } return true; } } else { return false; } } #select the path where dotclear will be install function selectPath($directory) { $d = dir($directory); while($entry = $d->read()) { if ($entry != '.' && $entry != '..') { if (is_dir($directory.'/'.$entry) && is_writable($directory.'/'.$entry)) { $path = $directory.'/'.$entry; echo ''; selectPath($directory.'/'.$entry); } } } $d->close(); } #html header function prepend() { echo ''; echo ''; echo ''; echo 'Dotclear Networking Installation'; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '

Installation

'; echo '

Welcome on Dotclear Networking Installation v0.4a

'; } #html_footer function footer(){ echo '
'; echo ''; echo ''; } $step = isset($_REQUEST['step'])?$_REQUEST['step']:''; switch($step) { case 'step1': if(file_exists(dirname(__FILE__).'/conf/config.php')) { prepend(); echo '

DotClear seems to be present on your site '. 'You may want to upgrade. This operation will overwrite your files

'. '
'. '

'. ''. ''. '

'. '
'; footer(); } else { header('Location: '.$_SERVER['SCRIPT_URI'].'?step=step2&chemin='.urlencode($_REQUEST['chemin'])); } break; case 'step2': if (ereg('\.\.', $_REQUEST['chemin']) || ereg("[^a-zA-Z0-9\._\-\/]", $_REQUEST['chemin'])) { prepend(); echo "

You have choose a forbidden path

"; footer(); } else { if ($_REQUEST['chemin'] == '') $_REQUEST['chemin'] = '.'; if (substr($_REQUEST['chemin'], 0, 1) == '/') $mkChemin = substr_replace($_REQUEST['chemin'], $_SERVER['DOCUMENT_ROOT'], 0, 1); else $mkChemin = $_REQUEST['chemin']; if ($_REQUEST['chemin'] != '.') mkdirs($mkChemin); if (($err = install($mirroir, $mkChemin, $archive)) !== true) { prepend(); echo '

'.$err.'

'; footer(); } else { if (preg_match('/free.fr$/', $_SERVER['HTTP_HOST'])) { if (!file_exists($_SERVER['DOCUMENT_ROOT'].'/sessions')) { mkdir($_SERVER['DOCUMENT_ROOT'].'/sessions'); } } if (!isset($_REQUEST['upgrade'] )) header("Location: ".$_REQUEST['chemin'].'/install/index.php'); else header("Location: ".$_REQUEST['chemin'].'/install/'.$_REQUEST['upgrade']); } } break; default: prepend(); if (is_writable('.')) { echo '
'; echo '

You\'re about to download the Dotclear Installer. Please choose the location where you want to install dotclear.

'; echo '

'; echo dirname($_SERVER['SCRIPT_URI']); echo '

'; echo '

'; echo '
'; } else { echo "

Warning, the directory where you want to launch the net-installer is not writable! Please, change the permission on the directory

"; } footer(); break; } ?>