module.php
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* 微信墙模块
*
* [WeEngine System] Copyright (c) 2013 WE7.CC
*/
defined('IN_IA') or exit('Access Denied');
class We7_wxwallModule extends WeModule {
public $tablename = 'wxwall_reply';
/**
* 规则表单附加额外字段
*/
public function fieldsFormDisplay($rid = 0) {
global $_W;
$accounts = uni_accounts();
if (!empty($rid)) {
$reply = pdo_fetch("SELECT * FROM ".tablename($this->tablename)." WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
$reply['syncwall'] = unserialize($reply['syncwall']);
} else {
$reply = array(
'isshow' => 0,
'timeout' => 0,
);
}
load()->func('tpl');
include $this->template('form');
}
/**
* 保存规则前调用, 验证附加字段有效性
*/
public function fieldsFormValidate($rid = 0) {
return true;
}
/**
* 规则保存成功后执行此方法,保存附加字段入库
*/
public function fieldsFormSubmit($rid = 0) {
global $_GPC, $_W;
$id = intval($_GPC['reply_id']);
$insert = array(
'rid' => $rid,
'acid'=> $_GPC['acid'],
'enter_tips' => $_GPC['enter-tips'],
'quit_tips' => $_GPC['quit-tips'],
'send_tips' => $_GPC['send-tips'],
'timeout' => $_GPC['timeout'],
'isshow' => intval($_GPC['isshow']),
'quit_command' => $_GPC['quit-command'],
'logo' => $_GPC['logo'],
'background' => $_GPC['background'],
'syncwall' => array(
'tx' => array(
'status' => intval($_GPC['walls']['tx']['status']),
'subject' => $_GPC['walls']['tx']['subject'],
),
),
);
$insert['syncwall'] = serialize($insert['syncwall']);
if (empty($id)) {
pdo_insert($this->tablename, $insert);
} else {
pdo_update($this->tablename, $insert, array('id' => $id));
}
}
/**
* 卸载模块时执行的附加数据库清理操作
*/
public function ruleDeleted($rid = 0) {
}
}