1
|
|
|
<?php |
2
|
|
|
include_once __DIR__ . '/admin_header.php'; |
3
|
|
|
/* |
4
|
|
|
* 处理 |
5
|
|
|
**/ |
6
|
|
|
|
7
|
|
|
//头部 |
8
|
|
|
include "martin.header.php"; |
9
|
|
|
$currentFile = basename(__FILE__); |
10
|
|
|
$myModuleAdmin = new ModuleAdmin(); |
11
|
|
|
echo $myModuleAdmin->addNavigation($currentFile); |
12
|
|
|
|
13
|
|
|
// martin_adminMenu(0, "订房后台 > 支付方式配置"); |
14
|
|
|
global $xoopsModuleConfig; |
15
|
|
|
$line_pays = getModuleArray('line_pays', 'line_pays', true); |
16
|
|
|
$online_pays = getModuleArray('online_pays', 'online_pays', true); |
17
|
|
|
|
18
|
|
|
$action = isset($_POST['action']) ? $_POST['action'] : @$_GET['action']; |
19
|
|
|
$action = empty($action) ? 'list' : $action; |
20
|
|
|
$key = isset($_POST['key']) ? $_POST['key'] : @$_GET['key']; |
21
|
|
|
|
22
|
|
|
$config_path = MARTIN_ROOT_PATH . "pay/$key/config/"; |
23
|
|
|
$ini_file = $config_path . "ini.php"; |
24
|
|
|
$config_file = $config_path . "config.php"; |
25
|
|
|
|
26
|
|
|
switch ($action) { |
27
|
|
|
case "list": |
28
|
|
|
martin_collapsableBar('createtable', 'createtableicon', _AM_MARTIN_PAY_BY, ''); |
29
|
|
|
if (is_array($online_pays)) { |
30
|
|
|
echo "<table width='100%' cellspacing=1 cellpadding=2 border=0 class = outer>"; |
31
|
|
|
echo "<tr>"; |
32
|
|
|
echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_PAYMENT_KEY . "</b></td>"; |
33
|
|
|
echo "<td class='bg3' align='left'><b>" . _AM_MARTIN_PAYMENT_NAME . "</b></td>"; |
34
|
|
|
echo "<td width='60' class='bg3' align='center'><b>_AM_MARTIN_ACTIONS</b></td>"; |
35
|
|
|
echo "</tr>"; |
36
|
|
|
foreach ($online_pays as $key => $value) { |
37
|
|
|
$modify = "<a href='?action=modify&key=" . $key . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif'/></a>"; |
38
|
|
|
echo "<tr><td class='even' align='left'>" . $key . "</td>"; |
39
|
|
|
echo "<td class='even' align='left'>" . $value . "</td>"; |
40
|
|
|
echo "<td class='even' align='center'> $modify $delete </td></tr>"; |
41
|
|
|
} |
42
|
|
|
echo "</table>\n"; |
43
|
|
|
} |
44
|
|
|
martin_close_collapsable('createtable', 'createtableicon'); |
|
|
|
|
45
|
|
|
break; |
46
|
|
|
case "modify": |
47
|
|
|
$alipay = array(); |
48
|
|
|
if (file_exists($config_file) && is_readable($config_file)) { |
49
|
|
|
include $config_file; |
50
|
|
|
} elseif (file_exists($ini_file)) { |
51
|
|
|
include $ini_file; |
52
|
|
|
} else { |
53
|
|
|
redirect_header('javascript:history.go(-1);', 2, _AM_MARTIN_PAYMENT_NOT_POSSIBLE); |
54
|
|
|
} |
55
|
|
|
martin_collapsableBar('createtable', 'createtableicon', _AM_MARTIN_PAYMENT_CONFIGURATION, ''); |
56
|
|
|
// echo "<form name='op' id='op' action='?action=save' method='post' onsubmit='return xoopsFormValidate_op();' enctype='multipart/form-data'><table width='100%' class='outer' cellspacing='1'><tbody><tr><th colspan='2'>" . _AM_MARTIN_HOTEL_SERVICE . "</th></tr>"; |
57
|
|
|
echo "<form name='op' id='op' action='?action=save' method='post' enctype='multipart/form-data'><table width='100%' class='outer' cellspacing='1'><tbody><tr><th colspan='2'>" . _AM_MARTIN_HOTEL_SERVICE . "</th></tr>"; |
58
|
|
|
foreach ($$key as $k => $value) { |
59
|
|
|
echo "<tr valign='top' align='left'><td class='head'>$k</td><td class='even'><input type='text' name='config[$k]' size='45' value='$value' /></td></tr>"; |
60
|
|
|
} |
61
|
|
|
echo "<tr valign='top' align='left'><td class='head'></td><td class='even'><input type='submit' class='formButton' name='' id='' value=_EDIT onclick=\"this.form.elements.op.value='addcategory'\" /><input type='reset' class='formButton' name='' id='' value=_SUBMIT /><input type='button' class='formButton' name='' id='' value='cancel' onclick='history.go(-1)' /></td></tr></tbody></table><input type='hidden' name='key' id='key' value='$key' /></form></div>"; |
62
|
|
|
martin_close_collapsable('createtable', 'createtableicon'); |
|
|
|
|
63
|
|
|
|
64
|
|
|
break; |
65
|
|
|
case "save": |
66
|
|
|
$config = ($_POST['config']); |
67
|
|
|
$fileStr = "<?php \n"; |
68
|
|
|
foreach ($config as $k => $v) { |
69
|
|
|
$fileStr .= '$' . $key . "['$k'] = '$v';\n"; |
70
|
|
|
} |
71
|
|
|
$fileStr .= "?>"; |
72
|
|
|
//var_dump($fileStr);exit; |
73
|
|
|
if (!is_writable($config_path)) { |
74
|
|
|
xoops_error($config_path . _AM_MARTIN_CAN_NOT_WRITE_SET_777); |
75
|
|
|
exit(); |
76
|
|
|
} |
77
|
|
|
if (!file_exists($config_file)) { |
78
|
|
|
$config_handler = fopen($config_file, 'w+'); |
79
|
|
|
fclose($config_handler); |
80
|
|
|
file_put_contents($config_file, $fileStr); |
81
|
|
|
chmod($config_file, 0777); |
82
|
|
|
} elseif (file_exists($config_file) && is_writable($config_file)) { |
83
|
|
|
file_put_contents($config_file, $fileStr); |
84
|
|
|
chmod($config_file, 0777); |
85
|
|
|
//file_put_contents($config_file,$fileStr); |
86
|
|
|
} |
87
|
|
|
redirect_header('martin.pay.php', 2, _AM_MARTIN_MODIFIED_SUCCESSFULLY); |
88
|
|
|
break; |
89
|
|
|
default: |
90
|
|
|
redirect_header(XOOPS_URL, 2, _AM_MARTIN_UNAUTHORIZED_ACCESS); |
91
|
|
|
break; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
include_once __DIR__ . '/admin_footer.php'; |
95
|
|
|
|