<?php
/************************************************************************
	UebiMiau is a GPL'ed software developed by 
	 - Aldoir Ventura - aldoir@users.sourceforge.net
	 - http://uebimiau.sourceforge.net São Paulo - Brasil
   		
	***********************************************************************
	Version 3.2.0 Upgrades and templates developed by
	 - Todd Henderson - Lead Developer - http://tdah.us 
	 - Dave Rodgers - Developer - http://www.manvel.net 
	 - Laurent (AdNovea) - Developer - http://adnovea.free.fr
	 
	***********************************************************************
	 - Special thanks to the developers at 
	codeworxtech.com, tinymce.moxiecode.com
	telaen.org, phptoys.com, winged.info, ngcoders.com
	without help this project wouldn't be possible 
	
	***********************************************************************
	- File:			install3.php
	- Developer: 	Todd Henderson / Mods by Laurent (AdNovea)
	- Date:			November 4, 2008
	- version:		(3.2.0) 1.0
	- Description:  Second stage in the installation

*************************************************************************/	
		require("./config.install.php");
	
	
	// This just converts global variables into local variables
	foreach($HTTP_POST_VARS as $postvar => $postval){ ${$postvar} = $postval; }
	foreach($HTTP_GET_VARS as $getvar => $getval){ ${$getvar} = $getval; }
?>     
	
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
		<tr>
			<td colspan="2"><div align="left" class="f8"><font color="#CCCCCC"><font color="#999999"><?php echo _STG5_CONFIG_EXP;?></font></font></div></td>
		</tr>

<?php


$out1 = sprintf("<?php
// This file has been automatically created during the installation


\$website = '%s';
\$absolute_path = '%s';
\$temporary_directory = '%s';
\$SMARTY_DIR = '%s';




?>" 
,$cwebsite,$cabsolute_path,$ctemporary_directory,$cSMARTY_DIR);

	// Save config.php file
	$write_error1 = false;
	$fp = fopen($cabsolute_path.CFG_PATHS,"w");
	if ($fp == null)  {
		$write_error1 = true;
	} else {
		fwrite($fp,$out1,strlen($out1));
		fclose($fp);
	}
	

   $dirname = ($ctemporary_directory);
   $path = ($cabsolute_path);     
   $filename = ($dirname);     
      
    if (file_exists($path.$filename)) {     
        echo "The directory {$dirname} already exists:\n\n";     
    } else {     
        mkdir($path.$dirname, 0777);     
        echo "The directory {$dirname} was successfully created:\n\n";     
    } 
    
     

   $dirname = ("cached_templates");
   $path = ($cabsolute_path.$ctemporary_directory);     
   $filename = ($dirname);     
      
    if (file_exists($path.$filename)) {     
        echo "The directory {$dirname} already exists:\n\n";  
    } else {     
        mkdir($path.$dirname, 0777);     
        {echo "The directory {$dirname} was successfully created:\n\n";}    
    }
    
      

   $dirname = ("system_admin");
   $path = ($cabsolute_path.$ctemporary_directory);     
   $filename = ($dirname);     
      
    if (file_exists($path.$filename)) {     
        echo "The directory {$dirname} exists:\n\n";      
    } else {     
        mkdir($path.$dirname, 0777);     
        echo "The directory {$dirname} was successfully created:\n\n";    
    }  

?>
	<!-- config.php writing result -->
		<tr>
			<td style="background-image: url('images/bar.gif'); width: 60%;"><?php echo _STG5_CONFIG_WRITE." <b>config.paths.php</b>";?></td>
			<td style="background-image: url('images/bar.gif'); width: 40%;">
<?php
		if(!$write_error1) { echo '<b><font color="green">'._STG5_SUCCESS.'</font></b>'; }
		else { echo  '<b><font color="red">'._STG5_CONFIG_ERROR.'</font></b>'; }
?>
	</td>
	</tr>
   <tr>
		  <td><?php echo _STG5_CONFIG_CONTENT.CFG_CONFIG;?>&nbsp;</td>
		  <td width="60%">
				<textarea name="textarea" cols="55" rows="18" style="width: 550px; height: 150px;"><?php echo $out1;?></textarea></td>
 		</tr>

	<!-- config.mail.php writing result -->
	<?php if ($cmail_server_type =='ONE-FOR-EACH') { ?>
		<tr>
			<td style="background-image: url('images/bar.gif'); width: 60%;"><?php echo _STG5_CONFIG_WRITE." ";?></td>
			<td style="background-image: url('images/bar.gif'); width: 40%;">
	<?php
		if(!$write_error2) { echo '<b><font color="green">'._STG5_SUCCESS.'</font></b>'; }
		else { echo  '<b><font color="red">'._STG5_CONFIG_ERROR2.'</font></b>'; }
	?>
			</td>
		</tr>
		<?php } ?>
	
		<tr><td align="left" colspan="2">&nbsp;<br></td>
		</tr>
		<tr>
			<td align="left" colspan="2">
						<div >
		   <?php if(isset( $error )) { 
		   echo '<b><font color="red">'._STG_ERROR.'</font></b>'; 
			} else {
			echo  '
				<center><br>
				<a class="menulink" href="index.php?stage=2&lid='.$lid.'" >'._STG_GO_GNU.'</a>&nbsp;'._STG_OR.'&nbsp;
				<a class="menulink" href="index.php?stage=4&lid='.$lid.'" class="menulink">'._STG_CONTINUE.'</a>
				</center>
			';
			}
		?>                                
			</div> 
			</td>
		</tr>
	</table>

