Location: PHPKode > projects > PHPDug > adm/template_settings.php
<?php 
require_once("../includes/config.php");
require_once("../includes/functions/func.global.php");
require_once("../includes/functions/loggincheck.php");
require_once('../includes/lang/admin/lang_'.$config['lang'].'.php');
require_once("class.menu.php");

// Connect to database
db_connect($config);

IF(isset($_POST['tpl_name']))
{
	// Content that will be written to the config file
	$content = "<?php\n";
	$content.= "\$config['db']['host'] = '".addslashes($config['db']['host'])."';\n";
	$content.= "\$config['db']['name'] = '".addslashes($config['db']['name'])."';\n";
	$content.= "\$config['db']['user'] = '".addslashes($config['db']['user'])."';\n";
	$content.= "\$config['db']['pass'] = '".addslashes($config['db']['pass'])."';\n";
	$content.= "\$config['db']['pre'] = '".addslashes($config['db']['pre'])."';\n";
	$content.= "\n";
	$content.= "\$config['site_title'] = '".addslashes(stripslashes($config['site_title']))."';\n";
	$content.= "\$config['site_url'] = '".addslashes(stripslashes($config['site_url']))."';\n";
	$content.= "\$config['site_path'] = '".addslashes(stripslashes($config['site_path']))."';\n";
	$content.= "\$config['admin_email'] = '".addslashes(stripslashes($config['admin_email']))."';\n";
	$content.= "\$config['upcomtime'] = '".addslashes(stripslashes($config['upcomtime']))."';\n";
	$content.= "\$config['usedigg'] = '".addslashes(stripslashes($config['usedigg']))."';\n";
	$content.= "\$config['vidthumb'] = '".addslashes(stripslashes($config['vidthumb']))."';\n";
	$content.= "\$config['mod_rewrite'] = '".addslashes(stripslashes($config['mod_rewrite']))."';\n";
	$content.= "\$config['anounce_en'] = '".addslashes(stripslashes($config['anounce_en']))."';\n";
	$content.= "\$config['anounce_txt'] = '".addslashes(stripslashes($config['anounce_txt']))."';\n";
	$content.= "\$config['safe'] = '".addslashes(stripslashes($config['safe']))."';\n";
	$content.= "\$config['security'] = '".addslashes(stripslashes($config['security']))."';\n";
	$content.= "\$config['rating_mode'] = '".addslashes(stripslashes($config['rating_mode']))."';\n";
	$content.= "\$config['rating_digs'] = '".addslashes(stripslashes($config['rating_digs']))."';\n";
	$content.= "\$config['rating_days'] = '".addslashes(stripslashes($config['rating_days']))."';\n";
	$content.= "\$config['cron_type'] = '".addslashes(stripslashes($config['cron_type']))."';\n";
	$content.= "\$config['cron_time'] = '".addslashes(stripslashes($config['cron_time']))."';\n";
	$content.= "\$config['search_type'] = '".addslashes(stripslashes($config['search_type']))."';\n";
	$content.= "\$config['mailbox_en'] = '".addslashes(stripslashes($config['mailbox_en']))."';\n";
	$content.= "\$config['tags_en'] = '".addslashes(stripslashes($config['tags_en']))."';\n";
	$content.= "\$config['validation'] = '".addslashes(stripslashes($config['validation']))."';\n";
	$content.= "\n";
	$content.= "\$config['cookie_time'] = '".addslashes(stripslashes($config['cookie_time']))."';\n";
	$content.= "\$config['cookie_name'] = '".addslashes(stripslashes($config['cookie_name']))."';\n";
	$content.= "\n";
	$content.= "\$config['email']['type'] = '".addslashes(stripslashes($config['email']['type']))."';\n";
	$content.= "\$config['email']['smtp']['host'] = '".addslashes(stripslashes($config['email']['smtp']['host']))."';\n";
	$content.= "\$config['email']['smtp']['user'] = '".addslashes(stripslashes($config['email']['smtp']['user']))."';\n";
	$content.= "\$config['email']['smtp']['pass'] = '".addslashes(stripslashes($config['email']['smtp']['pass']))."';\n";
	$content.= "\n";
	$content.= "\$config['tpl_name'] = '".addslashes(stripslashes($_POST['tpl_name']))."';\n";
	$content.= "\$config['version'] = '".addslashes(stripslashes($config['version']))."';\n";
	$content.= "\$config['lang'] = '".addslashes(stripslashes($config['lang']))."';\n";
	$content.= "\$config['installed'] = '1';\n";
	$content.= "?>";

	// Open the includes/config.php for writting
	$handle = fopen('../includes/config.php', 'w');
	// Write the config file
	fwrite($handle, $content);
	// Close the file
	fclose($handle);
	
	header("Location: template_settings.php");
	exit;
}

$obj = new Menu();
$nav = $obj->get_js_menu(0,$config,$lang);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>PHPDug Admin - <?php echo $lang['TEMPSET']; ?></title>
<link rel="stylesheet" type="text/css" href="images/style.css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/JSCookMenu.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<style type="text/css">
<!--
.style2 {	color: #FFFFFF;
	font-size: 12px;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style5 {font-size: 12px; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
<?php
	echo '<SCRIPT LANGUAGE="JavaScript">';
	echo "\n";
	echo '  var img=new Array();';
	echo "\n";
	if ($handle = opendir('../templates/')) {
	   while (false !== ($file = readdir($handle))) { 
		   if ($file != "." && $file != "..") { 
				echo 'img["' . $file . '"]="../templates/' . $file . '/images/sshot.gif";';
				echo "\n";
		   } 
	   }
	   closedir($handle); 
	}
?>
	
	function swap(type){
	document.getElementById("imgMain").src=img[type];
	var sel=document.shoeFrm.shoeSel;
	for(i=0;i<sel.length;i++){if(sel.options[i].text==type){sel.selectedIndex=i;}}
	}
</script>
</head>
<body onLoad="init()">
<!--Start top-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" height="42" align="left" background="images/bg_top.gif"><a href="index.php"><img src="images/logo.gif" width="127" height="37" hspace="10" border="0"></a></td>
  </tr>
  <tr>
    <td><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<!--End top-->
<!--Start topmenu-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#F0F0F0" height="25" style="padding-left:20px;" id="menu"><SCRIPT language="JavaScript" type="text/javascript">
			var myMenu =
				
			// Start the menu
[
<?php echo $nav; ?>
];				

			// Output the menu
			cmDraw ('menu', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice');
			</SCRIPT></td>
  </tr>
  <tr>
    <td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<br>
<!--End topmenu-->
<!--Start heading page-->
<table width="850" cellpadding="0" cellspacing="0" border="0" align="center">
  <tr>
    <td class="heading"><img src="images/icons/icon_settingtemplate.gif" width="23" height="22" alt="" align="absmiddle" hspace="5"><?php echo $lang['TEMPSET']; ?></td>
  </tr>
  <tr>
    <td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<br>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #CCCCCC;">
<tr>
<td align="center" bgcolor="#F6F6F6" style="padding:15px;"><div align="right">
  <form action="template_settings.php" method="post" name="f1" id="f1">
          <div align="center"><br>
      <table width="100%"  border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td><br>
              <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td><img src="../templates/<?php echo $config['tpl_name'];?>/images/sshot.gif" name="imgMain" width="500" height="250" border="1" id="imgMain"></td>
                </tr>
                <tr>
                  <td height="40"><select name="tpl_name" id="tpl_name" style="width:347px;" onChange="swap(this.options[selectedIndex].text);">
                      <?php
if ($handle = opendir('../templates/')) 
{
   while (false !== ($file = readdir($handle))) {
    
       if ($file != "." && $file != "..") 
	   { 
	   		if($file == $config['tpl_name'])
			{
				echo "<option selected>" . $file . "</option>"; 
			}
			else
			{
				echo "<option>" . $file . "</option>"; 
			}
       } 
   }
   closedir($handle); 
}
?>
                    </select>
                      <input name="Submit2" type="submit" class="button" style="width:150px;" value="Activate"></td>
                </tr>
              </table></td>
          </tr>
        </table>
        <br>
</div>
          <div align="left">      </div>
  </form>
</div></td>
</tr>
</table>
<br>
<br>
<!--End form-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
  <tr>
    <td style="padding:15px;" align="center"><span class="copyright">Copyright &copy; 2008 <a href="http://www.kubelabs.com/phpdug/" class="copyright" target="_blank">Kubelabs.com</a> All Rights Reserved.</span></td>
  </tr>
</table>
<!--End bottom-->
</body>
</html>
Return current item: PHPDug