3 * Ajax Chat for TRPG ver.2.0
4 * (c)2007-2008 Cake All rights reserved.
5 * Mail : cake_67@users.sourceforge.jp
6 * Home : http://trpgtools-onweb.sourceforge.jp/
10 require_once './trpgchat-ini.php';
11 require_once './lib/trpgchat.php';
12 require_once './lib/admin.php';
13 require_once './lib/config.php';
20 set_config(read_config_one(CONFIG_IMPORTANT));
29 if (!$request = request()) {
34 $lines = config_mode($request['mode']);
36 if ($request['mode'] =='重要な') {
37 $target = CONFIG_IMPORTANT;
38 } elseif ($request['mode'] == '全般') {
39 $target = CONFIG_MAIN;
40 } elseif ($request['mode'] == 'TRPG機能関連') {
41 $target = CONFIG_TRPG;
42 } elseif ($request['mode'] == 'タグ') {
44 } elseif ($request['mode'] == '全体の配色') {
45 $target = CONFIG_BASE_COLOR;
46 } elseif ($request['mode'] == 'チャット画面の配色') {
47 $target = CONFIG_MAIN_COLOR;
48 } elseif ($request['mode'] == 'アイコン') {
49 $target = CONFIG_ICON;
53 foreach ($lines as $k1 => $v1) {
56 $config = explode("<>", $v1);
61 if ($config[3] == 1) {
62 for ($i=0;$i<count($request[$config[2]]);$i++) {
63 if ($request[$config[2]] && trim($request[$config[2]][$i])) {
64 if ($i!=0) $data .= "</>";
65 $data .= htmlspecialchars($request[$config[2]][$i]);
69 } elseif ($config[3] == 2) {
70 foreach ($request['tag'] as $k2 => $v2) {
71 if ($k2 != "b") $data .= "<>";
73 for ($i=1;$i<count($v2)+1;$i++) {
75 $data .= htmlspecialchars($v2[$i]);
80 if (trim($request[$config[2]])) {
82 if ($config[2] == 'OFFWINDOW_MSG') {
83 $data .= str_replace("<>", "<>", $request[$config[2]]);
85 $data .= htmlspecialchars($request[$config[2]]);
89 $lines[$k1] = $config[0]."<>".$config[1]."<>".$config[2]."<>".$config[3]."<>".$config[4]."<>".$config[5].$data."\n";
94 error('設定ファイルが読みだせません');
99 $lfp = fopen(LOCK,"w");
100 stream_set_write_buffer($lfp, 0);
104 $fp = @fopen($target, "w") or error("設定ファイルを開けません。");
106 foreach($lines as $v) {
116 $url = str_replace('write_config.php', 'admin.php', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']).'?msg='.$request['mode']."設定を変更しました";
117 header('Location: '. $url);