-
Notifications
You must be signed in to change notification settings - Fork 1
/
newposts.class.php
140 lines (126 loc) · 4.34 KB
/
newposts.class.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
<?php
/**
* vi:set sw=4 ts=4 noexpandtab fileencoding=utf8:
* @class newposts
* @author NURIGO ([email protected])
* @brief newposts
*/
class newposts extends ModuleObject
{
/**
* @brief Object를 텍스트의 %...% 와 치환.
**/
function mergeKeywords($text, &$obj)
{
if (!is_object($obj)) return $text;
foreach ($obj as $key => $val)
{
if (is_array($val)) $val = join($val);
if (is_string($key) && is_string($val))
{
if (substr($key,0,10)=='extra_vars')
{
$val = str_replace('|@|', '-', $val);
}
elseif(!$val)
{
$val = "";
}
$text = preg_replace("/%" . preg_quote($key) . "%/", $val, $text);
}
}
return $text;
}
/**
* @brief 모듈 설치 실행
**/
function moduleInstall()
{
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
// Document Registration Trigger
$oModuleController->insertTrigger('document.insertDocument', 'newposts', 'controller', 'triggerInsertDocument', 'after');
}
/**
* @brief 설치가 이상없는지 체크
**/
function checkUpdate()
{
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// Document Registration Trigger
if (!$oModuleModel->getTrigger('document.insertDocument', 'newposts', 'controller', 'triggerInsertDocument', 'after'))
{
return true;
}
// 2012.03.06 add newposts_config.sender_name
if(!$oDB->isColumnExists("newposts_config","sender_name")) return true;
// 2012.03.06 add newposts_config.sender_email
if(!$oDB->isColumnExists("newposts_config","sender_email")) return true;
// 2014.06.16 add newposts_config.sender_phones
if(!$oDB->isColumnExists("newposts_config","sender_phone")) return true;
// 2015. 06. 09 add newposts_config.sms_method
if(!$oDB->isColumnExists("newposts_config","sms_method")) return true;
// 2015. 06. 09 add newposts_config.time_switch
if(!$oDB->isColumnExists("newposts_config","time_switch")) return true;
// 2015. 06. 09 add newposts_config.time_start
if(!$oDB->isColumnExists("newposts_config","time_start")) return true;
// 2015. 06. 09 add newposts_config.time_end
if(!$oDB->isColumnExists("newposts_config","time_end")) return true;
// 2015. 06. 09 add newposts_config.reserv_switch
if(!$oDB->isColumnExists("newposts_config","reserv_switch")) return true;
// 2015. 06. 12 add newposts_config.selected_days
if(!$oDB->isColumnExists("newposts_config","selected_days")) return true;
return false;
}
/**
* @brief 업데이트(업그레이드)
**/
function moduleUpdate()
{
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// Document Registration Trigger
if (!$oModuleModel->getTrigger('document.insertDocument', 'newposts', 'controller', 'triggerInsertDocument', 'after'))
{
$oModuleController->insertTrigger('document.insertDocument', 'newposts', 'controller', 'triggerInsertDocument', 'after');
}
if(!$oDB->isColumnExists("newposts_config","sender_name")) {
$oDB->addColumn("newposts_config","sender_name", "varchar","80");
}
if(!$oDB->isColumnExists("newposts_config","sender_email")) {
$oDB->addColumn("newposts_config","sender_email", "varchar","250");
}
if(!$oDB->isColumnExists("newposts_config","sender_phone")) {
$oDB->addColumn("newposts_config", "sender_phone", "varchar", "250");
}
if(!$oDB->isColumnExists("newposts_config","sms_method")) {
$oDB->addColumn("newposts_config", "sms_method", "char", "1");
}
if(!$oDB->isColumnExists("newposts_config","time_switch")) {
$oDB->addColumn("newposts_config", "time_switch", "varchar", "10");
}
if(!$oDB->isColumnExists("newposts_config","time_start")) {
$oDB->addColumn("newposts_config", "time_start", "number", "10");
}
if(!$oDB->isColumnExists("newposts_config","time_end")) {
$oDB->addColumn("newposts_config", "time_end", "number", "10");
}
if(!$oDB->isColumnExists("newposts_config","reserv_switch")) {
$oDB->addColumn("newposts_config", "reserv_switch", "varchar", "10");
}
if(!$oDB->isColumnExists("newposts_config","selected_days")) {
$oDB->addColumn("newposts_config", "selected_days", "varchar", "30");
}
}
/**
* @brief 캐시파일 재생성
**/
function recompileCache()
{
}
}
/* End of file newposts.class.php */
/* Location: ./modules/newposts/newposts.class.php */