mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
--HG-- branch : trunk rename : opt/cleanup/tab2spaces.sh => contrib/cleanup/tab2spaces.sh rename : opt/cleanup/whitespace.sh => contrib/cleanup/whitespace.sh rename : opt/conf_merge/README => contrib/conf_merge/README rename : opt/conf_merge/index.php => contrib/conf_merge/index.php rename : opt/conf_merge/merge.php => contrib/conf_merge/merge.php rename : doc/AuctionHouseBot.txt => docs/AuctionHouseBot.txt rename : doc/DocStructure.dox => docs/DocStructure.dox rename : doc/Doxyfile.in => docs/Doxyfile.in rename : doc/EventAI.txt => docs/EventAI.txt rename : doc/HowToScript.txt => docs/HowToScript.txt rename : doc/TextTables.txt => docs/TextTables.txt rename : doc/UnixInstall.txt => docs/UnixInstall.txt rename : externals/jemalloc/include/internal/arena.h => externals/jemalloc/jemalloc/internal/arena.h rename : externals/jemalloc/include/internal/base.h => externals/jemalloc/jemalloc/internal/base.h rename : externals/jemalloc/include/internal/chunk.h => externals/jemalloc/jemalloc/internal/chunk.h rename : externals/jemalloc/include/internal/chunk_dss.h => externals/jemalloc/jemalloc/internal/chunk_dss.h rename : externals/jemalloc/include/internal/chunk_mmap.h => externals/jemalloc/jemalloc/internal/chunk_mmap.h rename : externals/jemalloc/include/internal/chunk_swap.h => externals/jemalloc/jemalloc/internal/chunk_swap.h rename : externals/jemalloc/include/internal/ckh.h => externals/jemalloc/jemalloc/internal/ckh.h rename : externals/jemalloc/include/internal/ctl.h => externals/jemalloc/jemalloc/internal/ctl.h rename : externals/jemalloc/include/internal/extent.h => externals/jemalloc/jemalloc/internal/extent.h rename : externals/jemalloc/include/internal/hash.h => externals/jemalloc/jemalloc/internal/hash.h rename : externals/jemalloc/include/internal/huge.h => externals/jemalloc/jemalloc/internal/huge.h rename : externals/jemalloc/include/internal/jemalloc_internal.h => externals/jemalloc/jemalloc/internal/jemalloc_internal.h rename : externals/jemalloc/include/internal/jemalloc_internal.h.in => externals/jemalloc/jemalloc/internal/jemalloc_internal.h.in rename : externals/jemalloc/include/internal/mb.h => externals/jemalloc/jemalloc/internal/mb.h rename : externals/jemalloc/include/internal/mutex.h => externals/jemalloc/jemalloc/internal/mutex.h rename : externals/jemalloc/include/internal/prof.h => externals/jemalloc/jemalloc/internal/prof.h rename : externals/jemalloc/include/internal/ql.h => externals/jemalloc/jemalloc/internal/ql.h rename : externals/jemalloc/include/internal/qr.h => externals/jemalloc/jemalloc/internal/qr.h rename : externals/jemalloc/include/internal/rb.h => externals/jemalloc/jemalloc/internal/rb.h rename : externals/jemalloc/include/internal/stats.h => externals/jemalloc/jemalloc/internal/stats.h rename : externals/jemalloc/include/internal/tcache.h => externals/jemalloc/jemalloc/internal/tcache.h rename : externals/jemalloc/include/internal/totally_not_p_r_n.h => externals/jemalloc/jemalloc/internal/totally_not_p_r_n.h rename : externals/jemalloc/include/jemalloc.h => externals/jemalloc/jemalloc/jemalloc.h rename : externals/jemalloc/include/jemalloc.h.in => externals/jemalloc/jemalloc/jemalloc.h.in rename : externals/jemalloc/include/jemalloc_defs.h => externals/jemalloc/jemalloc/jemalloc_defs.h rename : externals/jemalloc/include/jemalloc_defs.h.in => externals/jemalloc/jemalloc/jemalloc_defs.h.in
160 lines
4.9 KiB
PHP
160 lines
4.9 KiB
PHP
<?php
|
|
/*
|
|
* Project Name: Config File Merge For Mangos/Trinity Server
|
|
* Date: 01.01.2010 inital version (0.0.1a)
|
|
* Author: Paradox
|
|
* Copyright: Paradox
|
|
* Email: iamparadox@netscape.net (paypal email)
|
|
* License: GNU General Public License v2(GPL)
|
|
*/
|
|
if (!empty($_FILES['File1']) && !empty($_FILES['File2']))
|
|
{
|
|
session_id();
|
|
session_start();
|
|
$basedir = "merge";
|
|
$eol = "\r\n";
|
|
if ($_POST['eol'])
|
|
$eol = "\n";
|
|
else
|
|
$eol = "\r\n";
|
|
if (!file_exists($basedir))
|
|
mkdir($basedir);
|
|
if (!file_exists($basedir."/".session_id()))
|
|
mkdir($basedir."/".session_id());
|
|
$upload1 = $basedir."/".session_id()."/".basename($_FILES['File1']['name']);
|
|
$upload2 = $basedir."/".session_id()."/".basename($_FILES['File2']['name']);
|
|
$newconfig = $basedir."/".session_id()."/trinitycore.conf.merged";
|
|
$out_file = fopen($newconfig, w);
|
|
$success = false;
|
|
if (move_uploaded_file($_FILES['File1']['tmp_name'], $upload1))
|
|
{
|
|
$success = true;
|
|
}
|
|
else
|
|
{
|
|
$success = false;
|
|
}
|
|
if (move_uploaded_file($_FILES['File2']['tmp_name'], $upload2))
|
|
{
|
|
$success = true;
|
|
}
|
|
else
|
|
{
|
|
$success = false;
|
|
}
|
|
|
|
if ($success)
|
|
{
|
|
$custom_found = false;
|
|
$in_file1 = fopen($upload1,r);
|
|
$in_file2 = fopen($upload2,r);
|
|
$array1 = array();
|
|
$array2 = array();
|
|
$line = trim(fgets($in_file1));
|
|
while (!feof($in_file1))
|
|
{
|
|
if ((substr($line,0,1) != '#' && substr($line,0,1) != ''))
|
|
{
|
|
list($key, $val) = explode("=",$line);
|
|
$key = trim($key);
|
|
$val = trim($val);
|
|
$array1[$key] = $val;
|
|
}
|
|
$line = trim(fgets($in_file1));
|
|
}
|
|
$line = trim(fgets($in_file2));
|
|
while (!feof($in_file2) && !$custom_found)
|
|
{
|
|
if (substr($line,0,1) != '#' && substr($line,0,1) != '')
|
|
{
|
|
list($key, $val) = explode("=",$line);
|
|
$key = trim($key);
|
|
$val = trim($val);
|
|
$array2[$key] = $val;
|
|
}
|
|
if (strtolower($line) == "# custom")
|
|
$custom_found = true;
|
|
else
|
|
$line = trim(fgets($in_file2));
|
|
}
|
|
fclose($in_file1);
|
|
foreach($array2 as $k => $v)
|
|
{
|
|
if (array_key_exists($k, $array1))
|
|
{
|
|
$array1[$k] = $v;
|
|
unset($array2[$k]);
|
|
}
|
|
}
|
|
$in_file1 = fopen($upload1,r);
|
|
$line = trim(fgets($in_file1));
|
|
while (!feof($in_file1))
|
|
{
|
|
if (substr($line,0,1) != '#' && substr($line,0,1) != '')
|
|
{
|
|
$array = array();
|
|
while (substr($line,0,1) != '#' && substr($line,0,1) != '')
|
|
{
|
|
list($key, $val) = explode("=",$line);
|
|
$key = trim($key);
|
|
$val = trim($val);
|
|
$array[$key] = $val;
|
|
$line = trim(fgets($in_file1));
|
|
}
|
|
foreach($array as $k => $v)
|
|
{
|
|
if (array_key_exists($k, $array1))
|
|
fwrite($out_file, $k."=".$array1[$k].$eol);
|
|
else
|
|
continue;
|
|
}
|
|
unset($array);
|
|
if (!feof($in_file1))
|
|
fwrite($out_file, $line.$eol);
|
|
}
|
|
else
|
|
fwrite($out_file, $line.$eol);
|
|
$line = trim(fgets($in_file1));
|
|
}
|
|
if ($custom_found)
|
|
{
|
|
fwrite($out_file, $eol);
|
|
fwrite($out_file, "###############################################################################".$eol);
|
|
fwrite($out_file, "# Custom".$eol);
|
|
$line = trim(fgets($in_file2));
|
|
while (!feof($in_file2))
|
|
{
|
|
fwrite($out_file, $line.$eol);
|
|
$line = trim(fgets($in_file2));
|
|
}
|
|
}
|
|
$first = true;
|
|
foreach($array2 as $k => $v)
|
|
{
|
|
if ($first)
|
|
{
|
|
fwrite($out_file, $eol);
|
|
fwrite($out_file, "###############################################################################".$eol);
|
|
fwrite($out_file, "# The Following values were removed from the config.".$eol);
|
|
$first = false;
|
|
}
|
|
fwrite($out_file, "# ".$k."=".$v.$eol);
|
|
}
|
|
unset($array1);
|
|
unset($array2);
|
|
fclose($in_file1);
|
|
fclose($in_file2);
|
|
fclose($out_file);
|
|
unlink($upload1);
|
|
unlink($upload2);
|
|
|
|
echo "Process done";
|
|
echo "<br /><a href=".$newconfig.">Click here to retrieve your merged conf</a>";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo "An error has occurred";
|
|
}
|
|
?>
|