Código PHP:
<?php
break;
case 1:
$name = stripslashes($_POST['name']);
$mail = $_POST['email'];
$site = trim($_POST['site']);
$desc = trim($_POST['descr']);
$biog = trim($_POST['biogr']);
$face = trim($_POST['facebook']);
$yout = trim($_POST['youtube']);
$flic = trim($_POST['flickr']);
$twit = trim($_POST['twitter']);
$link = trim($_POST['linkedin']);
$last = trim($_POST['lastfm']);
$deli = trim($_POST['delicious']);
$grav = trim($_POST['gravatar']);
$vime = trim($_POST['vimeo']);
$goog = trim($_POST['google']);
$skyp = trim($_POST['skype']);
$gtal = trim($_POST['gtalk']);
$digg = trim($_POST['digg']);
$stum = trim($_POST['stupon']);
$mysp = trim($_POST['myspace']);
$post = trim($_POST['posterous']);
$tumb = trim($_POST['tumblr']);
$devi = trim($_POST['deviantart']);
$disq = trim($_POST['disqus']);
$inte = trim($_POST['idebate']);
foreach ($configFile as $line_num => $line) {
switch (substr($line,0,16)) {
case "define('USER_FB'":
$configFile[$line_num] = str_replace("username", $face, $line);
break;
case "define('USER_YT'":
$configFile[$line_num] = str_replace("username", $yout, $line);
break;
case "define('USER_FLICKR":
$configFile[$line_num] = str_replace("username", $flic, $line);
break;
case "define('USER_TWITTER'":
$configFile[$line_num] = str_replace("username", $twit, $line);
break;
case "define('USER_LINKEDIN'":
$configFile[$line_num] = str_replace('username', $link, $line);
break;
case "define('USER_LAST'":
$configFile[$line_num] = str_replace('username', $last, $line);
break;
case "define('USER_DELICIOUS'":
$configFile[$line_num] = str_replace('username', $deli, $line);
break;
case "define('USER_GRAVATAR'":
$configFile[$line_num] = str_replace('username', $grav, $line);
break;
case "define('USER_VIMEO'":
$configFile[$line_num] = str_replace('username', $vime, $line);
break;
case "define('USER_GOOGLE'":
$configFile[$line_num] = str_replace('username', $goog, $line);
break;
case "define('USER_SKYPE'":
$configFile[$line_num] = str_replace('username', $skyp, $line);
break;
case "define('USER_TALK'":
$configFile[$line_num] = str_replace('username', $gtal, $line);
break;
case "define('USER_DIGG'":
$configFile[$line_num] = str_replace('username', $digg, $line);
break;
case "define('USER_SU'":
$configFile[$line_num] = str_replace('username', $stum, $line);
break;
case "define('USER_MS'":
$configFile[$line_num] = str_replace('username', $mysp, $line);
break;
case "define('USER_POST'":
$configFile[$line_num] = str_replace('username', $post, $line);
break;
case "define('USER_TUMBLR'":
$configFile[$line_num] = str_replace('username', $tumb, $line);
break;
case "define('USER_ART'":
$configFile[$line_num] = str_replace('username', $devi, $line);
break;
case "define('USER_DISQUS'":
$configFile[$line_num] = str_replace('username', $disq, $line);
break;
case "define('USER_INDEB'":
$configFile[$line_num] = str_replace('username', $inte, $line);
break;
case "define('EMAIL'":
$configFile[$line_num] = str_replace("'[email protected]'", "$mail", $line);
break;
case "define('NAME'":
$configFile[$line_num] = str_replace("'tu_nombre'", "$name", $line);
break;
case "define('DESCR'":
$configFile[$line_num] = str_replace('descripcion_corta', $desc, $line);
break;
case "define('SITE'":
$configFile[$line_num] = str_replace('http://dominio.tld', $site, $line);
break;
case "define('BIO'":
$configFile[$line_num] = str_replace('descripcion_larga', $biog, $line);
break;
}
}
if ( !is_writable('../') ) :
?>
<p>Lo siento pero no se ha podido escribir en el fichero <code>config.php</code>.</p>
<p>Puedes crear manualmente el archivo <code>config.php</code> y pegar dentro el siguiente texto:</p>
<textarea cols="98" rows="15" class="code"><?php
foreach( $configFile as $line ) {
echo htmlentities($line, ENT_COMPAT, 'UTF-8');
}
?></textarea>
<p>Una vez hayas hecho esto haz clic en "Finalizar"</p>
<p class="step"><a href="../" class="button">Finalizar</a></p>
<?php
else :
$handle = fopen('../config.php', 'w');
foreach( $configFile as $line ) {
fwrite($handle, $line);
}
fclose($handle);
chmod('../config.php', 0666);
?>