Location: PHPKode > projects > L-Forum > l-forum/admin/save_db.inc
<?

if(substr($nrelpath, -1, 1)!='/')
   $nrelpath .= '/'; 
   
if(substr($nrelpath, 0, 1)!='/')
   $nrelpath = '/'.$nrelpath;

$data = "<?\n".
"//   DO NOT EDIT THIS FILE - USE ADMINISTRATION INSTEAD\n\n".
"\$relpath		= '$nrelpath';\n".
"\$admin_name		= '$admin_name';\n".
"\$admin_pass		= '$admin_pass';\n".
"\$admin_res		= '$admin_res';\n".
"\$db_type		= '$ndb_type';\n".
"\$db_host		= '$ndb_host';\n".
"\$db_name		= '$ndb_name';\n".
"\$db_user		= '$ndb_user';\n".
"\$db_pass		= '$ndb_pass';\n".
"\$encoding               = '$encoding';\n".
"\$lang_d			= '$lang_d';\n";

while(list($k, $v) = each($langlist))
   $data .= "\$langlist['$k']		= '$v';\n";

$data .= "\$theme			= '$theme';\n";

while(list($k, $v) = each($themes))
   $data .= "\$themes['$k']	= '$v';\n";

$data .= "\$enable_html		= ".($enable_html?'true':'false').";\n".
"\$long_names		= ".($long_names?'true':'false').";\n".
"\$cite			= ".($cite?'true':'false').";\n".
"\$req_email		= ".($req_email?'true':'false').";\n".
"\$ext_mail		= ".($ext_mail?'true':'false').";\n".
"\$max_size             = $max_size;\n".
"\$wrapsize		= $wrapsize;\n".
"\$block_ip		= ".($block_ip?'true':'false').";\n".
"\$count_view		= ".($count_view?'true':'false').";\n".
"\$coll_thr		= ".($coll_thr?'true':'false').";\n".
"\$thrinmess		= ".($thrinmess?'true':'false').";\n".
"\n".
"//   FORUMS\n";

if(!empty($forum_array)){
   while(list($x, ) = each($forum_array)){
      if($x!=$f){
         $data .= "\$forum_array[$x] = Array(\n".
            "   'name' => '".addslashes($forum_array[$x]['name'])."',\n".
            "   'desc' => '".addslashes($forum_array[$x]['desc'])."',\n".
            "   'upload' => ".($forum_array[$x]['upload']?"true":"false").",\n".
            "   'moderation' => ".($forum_array[$x]['moderation']?"true":"false").",\n".
            "   'mod_pass' => '".addslashes($forum_array[$x]['mod_pass'])."',\n".
            "   'theme' => '".$forum_array[$x]['theme']."',\n".
            "   'tpp' => ".$forum_array[$x]['tpp'].",\n".
            "   'mpp' => ".$forum_array[$x]['mpp']."\n".
            ");\n";
      }
   }
}

$data .= "?>\n";

$fp=@fopen("../config.php", "w");

if(!$fp){
   error("Can't open configuration file. Check file permissions.");
}

fputs($fp, $data);
fclose($fp);

echo "Configuration saved.";

?>
Return current item: L-Forum