-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.class.php
More file actions
110 lines (95 loc) · 3.28 KB
/
notification.class.php
File metadata and controls
110 lines (95 loc) · 3.28 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
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
<?php
/**
* vi:set sw=4 ts=4 noexpandtab fileencoding=utf8:
* @class notification
* @author diver(diver@coolsms.co.kr)
* @brief notification
*/
class notification 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);
$text = preg_replace("/%" . preg_quote($key) . "%/", $val, $text);
}
}
return $text;
}
function getJSON($name) {
// 1.1.2 이전 버젼은 무조건 stripslashes 되어 넘어온다.
// 1.1.2 버젼부터는 get_magic_quotes_gpc에 따라서 On이면 addslashes된 상태이고 Off이면 raw상태로 넘어온다.
$oModel = &getModel('notification');
$config = $oModel->getModuleConfig();
if ($config->force_strip=='Y') {
$json_string = stripslashes(Context::get($name));
} else {
if (get_magic_quotes_gpc()) {
$json_string = stripslashes(Context::get($name));
} else {
$json_string = Context::get($name);
}
}
require_once('JSON.php');
$json = new Services_JSON();
$decoded = $json->decode($json_string);
return $decoded;
}
/**
* @brief 모듈 설치 실행
**/
function moduleInstall() {
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
/*
// Document Registration Trigger
$oModuleController->insertTrigger('document.insertDocument', 'notification', 'controller', 'triggerInsertDocument', 'after');
*/
// Comment Registration Trigger
$oModuleController->insertTrigger('comment.insertComment', 'notification', 'controller', 'triggerInsertComment', 'after');
}
/**
* @brief 설치가 이상없는지 체크
**/
function checkUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
/*
// Document Registration Trigger
if (!$oModuleModel->getTrigger('document.insertDocument', 'notification', 'controller', 'triggerInsertDocument', 'after'))
return true;
*/
// Comment Registration Trigger
if (!$oModuleModel->getTrigger('comment.insertComment', 'notification', 'controller', 'triggerInsertComment', 'after'))
return true;
return false;
}
/**
* @brief 업데이트(업그레이드)
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
/*
// Document Registration Trigger
if (!$oModuleModel->getTrigger('document.insertDocument', 'notification', 'controller', 'triggerInsertDocument', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'notification', 'controller', 'triggerInsertDocument', 'after');
*/
// Comment Registration Trigger
if (!$oModuleModel->getTrigger('comment.insertComment', 'notification', 'controller', 'triggerInsertComment', 'after'))
$oModuleController->insertTrigger('comment.insertComment', 'notification', 'controller', 'triggerInsertComment', 'after');
}
/**
* @brief 캐시파일 재생성
**/
function recompileCache() {
}
}
?>