-
Notifications
You must be signed in to change notification settings - Fork 0
/
ncenterlite.admin.controller.php
147 lines (130 loc) · 4.82 KB
/
ncenterlite.admin.controller.php
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
class ncenterliteAdminController extends ncenterlite
{
function procNcenterliteAdminInsertConfig()
{
$oModuleController = getController('module');
$config->use = Context::get('use');
$config->display_use = Context::get('display_use');
$config->user_config_list = Context::get('user_config_list');
$config->mention_format = Context::get('mention_format');
$config->mention_names = Context::get('mention_names');
$config->document_notify = Context::get('document_notify');
$config->message_notify = Context::get('message_notify');
$config->hide_module_srls = Context::get('hide_module_srls');
$config->android_format = Context::get('android_format');
if(!$config->mention_format && !is_array($config->mention_format))
{
$config->mention_format = array();
}
$config->admin_comment_module_srls = Context::get('admin_comment_module_srls');
$config->skin = Context::get('skin');
$config->mskin = Context::get('mskin');
$config->mcolorset = Context::get('mcolorset');
$config->colorset = Context::get('colorset');
$config->zindex = Context::get('zindex');
$config->anonymous_name = Context::get('anonymous_name');
$config->document_read = Context::get('document_read');
$config->layout_srl = Context::get('layout_srl');
$config->mlayout_srl = Context::get('mlayout_srl');
$config->voted_format = Context::get('voted_format');
if(!$config->document_notify)
{
$config->document_notify = 'direct-comment';
}
$this->setMessage('success_updated');
$oModuleController->updateModuleConfig('ncenterlite', $config);
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNcenterliteAdminConfig');
header('location: ' . $returnUrl);
return;
}
}
/**
* @brief 스킨 테스트를 위한 더미 데이터 생성 5개 생성
**/
function procNcenterliteAdminInsertDummyData()
{
$oNcenterliteController = getController('ncenterlite');
$logged_info = Context::get('logged_info');
for($i = 1; $i <= 5; $i++)
{
$args = new stdClass();
$args->member_srl = $logged_info->member_srl;
$args->srl = 1;
$args->target_srl = 1;
$args->type = $this->_TYPE_TEST;
$args->target_type = $this->_TYPE_TEST;
$args->target_url = getUrl('');
$args->target_summary = '[*] 시험용 알림입니다' . rand();
$args->target_nick_name = $logged_info->nick_name;
$args->regdate = date('YmdHis');
$args->notify = $oNcenterliteController->_getNotifyId($args);
$output = $oNcenterliteController->_insertNotify($args);
}
}
/**
* @brief 모듈 푸시 테스트를 위한 더미 데이터 생성 1개 생성
**/
function procNcenterliteAdminInsertPushData()
{
$oNcenterliteController = getController('ncenterlite');
$logged_info = Context::get('logged_info');
$args = new stdClass();
$args->member_srl = $logged_info->member_srl;
$args->srl = 1;
$args->target_srl = 1;
$args->type = $this->_TYPE_DOCUMENT;
$args->target_type = $this->_TYPE_COMMENT;
$args->target_url = getUrl('');
$args->target_summary = '[*] 시험용 알림입니다' . rand();
$args->target_nick_name = $logged_info->nick_name;
$args->regdate = date('YmdHis');
$args->notify = $oNcenterliteController->_getNotifyId($args);
$output = $oNcenterliteController->_insertNotify($args);
}
function procNcenterliteAdminDeleteNofity()
{
$old_date = Context::get('old_date');
$args = new stdClass;
if($old_date)
{
$args->old_date = $old_date;
}
$output = executeQuery('ncenterlite.deleteNotifyAll', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
if($old_date)
{
$this->setMessage('1달 이전 정보를 삭제하였습니다.');
}
else
{
$this->setMessage('모든 정보를 삭제하였습니다.');
}
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNcenterliteAdminList');
header('location: ' .$returnUrl);
return;
}
}
function procNcenterliteAdminEnviromentGatheringAgreement()
{
$vars = Context::getRequestVars();
$oModuleModel = getModel('module');
$ncenterlite_module_info = $oModuleModel->getModuleInfoXml('ncenterlite');
$agreement_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite-', $ncenterlite_module_info->version));
FileHandler::writeFile($agreement_file, $vars->is_agree);
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNcenterliteAdminConfig');
header('location: ' . $returnUrl);
return;
}
}
}