@@ -162,6 +162,9 @@ |
||
162 | 162 | $output = executeQuery('syndication.deleteLog', $args); |
163 | 163 | } |
164 | 164 | |
165 | + /** |
|
166 | + * @param string $type |
|
167 | + */ |
|
165 | 168 | function ping($id, $type, $page=1) { |
166 | 169 | $this->ping_message = ''; |
167 | 170 | $oSyndicationModel = getModel('syndication'); |
@@ -12,17 +12,17 @@ discard block |
||
12 | 12 | var $ping_message = ''; |
13 | 13 | |
14 | 14 | function triggerInsertDocument(&$obj) { |
15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
16 | - if($obj->status !== 'PUBLIC') return $this->makeObject(); |
|
15 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
16 | + if ($obj->status !== 'PUBLIC') return $this->makeObject(); |
|
17 | 17 | |
18 | 18 | $oSyndicationModel = getModel('syndication'); |
19 | 19 | $oModuleModel = getModel('module'); |
20 | 20 | |
21 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
21 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
22 | 22 | |
23 | 23 | $config = $oModuleModel->getModuleConfig('syndication'); |
24 | 24 | |
25 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
25 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
26 | 26 | |
27 | 27 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
28 | 28 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -32,22 +32,22 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | function triggerUpdateDocument(&$obj) { |
35 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
35 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
36 | 36 | |
37 | 37 | $oSyndicationModel = getModel('syndication'); |
38 | 38 | $oModuleModel = getModel('module'); |
39 | 39 | |
40 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
40 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
41 | 41 | |
42 | 42 | $config = $oModuleModel->getModuleConfig('syndication'); |
43 | 43 | |
44 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
44 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
45 | 45 | |
46 | 46 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
47 | 47 | $id = $oSyndicationModel->getID('article', $target_id); |
48 | 48 | |
49 | 49 | // PUBLIC 외 삭제 |
50 | - if($obj->status === 'PUBLIC') |
|
50 | + if ($obj->status === 'PUBLIC') |
|
51 | 51 | { |
52 | 52 | $this->ping($id, 'article'); |
53 | 53 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | function triggerDeleteDocument(&$obj) { |
63 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
63 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
64 | 64 | |
65 | 65 | $oModuleModel = getModel('module'); |
66 | 66 | $oSyndicationModel = getModel('syndication'); |
67 | 67 | |
68 | 68 | $config = $oModuleModel->getModuleConfig('syndication'); |
69 | - if($config->syndication_use != 'Y') return $this->makeObject(); |
|
70 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
69 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
70 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
71 | 71 | |
72 | 72 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
73 | 73 | |
@@ -85,25 +85,25 @@ discard block |
||
85 | 85 | |
86 | 86 | function triggerMoveDocumentModule(&$obj) |
87 | 87 | { |
88 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
88 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
89 | 89 | |
90 | 90 | $oSyndicationModel = getModel('syndication'); |
91 | 91 | $oModuleModel = getModel('module'); |
92 | 92 | |
93 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
93 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
94 | 94 | |
95 | 95 | $config = $oModuleModel->getModuleConfig('syndication'); |
96 | 96 | |
97 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
97 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
98 | 98 | |
99 | 99 | $arr_document_srl = explode(',', $obj->document_srls); |
100 | - if(!$arr_document_srl) return $this->makeObject(); |
|
100 | + if (!$arr_document_srl) return $this->makeObject(); |
|
101 | 101 | |
102 | - foreach($arr_document_srl as $document_srl) |
|
102 | + foreach ($arr_document_srl as $document_srl) |
|
103 | 103 | { |
104 | 104 | // 기존 문서 삭제 |
105 | 105 | $source_module_srl = $obj->source_module_srl[$document_srl]; |
106 | - if(!!$source_module_srl) |
|
106 | + if (!!$source_module_srl) |
|
107 | 107 | { |
108 | 108 | $target_id = sprintf('%s-%s', $source_module_srl, $document_srl); |
109 | 109 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | $oSyndicationModel = getModel('syndication'); |
124 | 124 | $oModuleModel = getModel('module'); |
125 | 125 | |
126 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
126 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
127 | 127 | |
128 | 128 | $config = $oModuleModel->getModuleConfig('syndication'); |
129 | 129 | |
130 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
130 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
131 | 131 | |
132 | 132 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
133 | 133 | |
@@ -162,21 +162,21 @@ discard block |
||
162 | 162 | $output = executeQuery('syndication.deleteLog', $args); |
163 | 163 | } |
164 | 164 | |
165 | - function ping($id, $type, $page=1) { |
|
165 | + function ping($id, $type, $page = 1) { |
|
166 | 166 | $this->ping_message = ''; |
167 | 167 | $oSyndicationModel = getModel('syndication'); |
168 | 168 | |
169 | 169 | $oModuleModel = getModel('module'); |
170 | 170 | $config = $oModuleModel->getModuleConfig('syndication'); |
171 | 171 | |
172 | - if(!$config->syndication_token) |
|
172 | + if (!$config->syndication_token) |
|
173 | 173 | { |
174 | 174 | $this->ping_message = 'Syndication Token empty'; |
175 | 175 | $oSyndicationModel->setResentPingLog($this->ping_message); |
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | |
179 | - if(!$this->checkOpenSSLSupport()) |
|
179 | + if (!$this->checkOpenSSLSupport()) |
|
180 | 180 | { |
181 | 181 | $lang = Context::get('lang'); |
182 | 182 | $this->ping_message = $lang->msg_need_openssl_support; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
187 | - if(substr($config->site_url,-1)!='/') |
|
187 | + if (substr($config->site_url, -1) != '/') |
|
188 | 188 | { |
189 | 189 | $config->site_url .= '/'; |
190 | 190 | } |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | $buff = FileHandler::getRemoteResource($ping_url, null, 10, 'POST', 'application/x-www-form-urlencoded', $ping_header, array(), array('ping_url'=>$ping_body), $request_config); |
205 | 205 | |
206 | 206 | $xml = new XmlParser(); |
207 | - $xmlDoc= $xml->parse($buff); |
|
207 | + $xmlDoc = $xml->parse($buff); |
|
208 | 208 | |
209 | - if($xmlDoc->result->error_code->body != '000') |
|
209 | + if ($xmlDoc->result->error_code->body != '000') |
|
210 | 210 | { |
211 | - if(!$buff) |
|
211 | + if (!$buff) |
|
212 | 212 | { |
213 | 213 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
214 | 214 | } |
@@ -12,17 +12,25 @@ discard block |
||
12 | 12 | var $ping_message = ''; |
13 | 13 | |
14 | 14 | function triggerInsertDocument(&$obj) { |
15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
16 | - if($obj->status !== 'PUBLIC') return $this->makeObject(); |
|
15 | + if($obj->module_srl < 1) { |
|
16 | + return $this->makeObject(); |
|
17 | + } |
|
18 | + if($obj->status !== 'PUBLIC') { |
|
19 | + return $this->makeObject(); |
|
20 | + } |
|
17 | 21 | |
18 | 22 | $oSyndicationModel = getModel('syndication'); |
19 | 23 | $oModuleModel = getModel('module'); |
20 | 24 | |
21 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
25 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
26 | + return $this->makeObject(); |
|
27 | + } |
|
22 | 28 | |
23 | 29 | $config = $oModuleModel->getModuleConfig('syndication'); |
24 | 30 | |
25 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
31 | + if($config->syndication_use!='Y') { |
|
32 | + return $this->makeObject(); |
|
33 | + } |
|
26 | 34 | |
27 | 35 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
28 | 36 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -32,16 +40,22 @@ discard block |
||
32 | 40 | } |
33 | 41 | |
34 | 42 | function triggerUpdateDocument(&$obj) { |
35 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
43 | + if($obj->module_srl < 1) { |
|
44 | + return $this->makeObject(); |
|
45 | + } |
|
36 | 46 | |
37 | 47 | $oSyndicationModel = getModel('syndication'); |
38 | 48 | $oModuleModel = getModel('module'); |
39 | 49 | |
40 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
50 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
51 | + return $this->makeObject(); |
|
52 | + } |
|
41 | 53 | |
42 | 54 | $config = $oModuleModel->getModuleConfig('syndication'); |
43 | 55 | |
44 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
56 | + if($config->syndication_use!='Y') { |
|
57 | + return $this->makeObject(); |
|
58 | + } |
|
45 | 59 | |
46 | 60 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
47 | 61 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -50,8 +64,7 @@ discard block |
||
50 | 64 | if($obj->status === 'PUBLIC') |
51 | 65 | { |
52 | 66 | $this->ping($id, 'article'); |
53 | - } |
|
54 | - else |
|
67 | + } else |
|
55 | 68 | { |
56 | 69 | $this->ping($id, 'deleted'); |
57 | 70 | } |
@@ -60,14 +73,20 @@ discard block |
||
60 | 73 | } |
61 | 74 | |
62 | 75 | function triggerDeleteDocument(&$obj) { |
63 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
76 | + if($obj->module_srl < 1) { |
|
77 | + return $this->makeObject(); |
|
78 | + } |
|
64 | 79 | |
65 | 80 | $oModuleModel = getModel('module'); |
66 | 81 | $oSyndicationModel = getModel('syndication'); |
67 | 82 | |
68 | 83 | $config = $oModuleModel->getModuleConfig('syndication'); |
69 | - if($config->syndication_use != 'Y') return $this->makeObject(); |
|
70 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
84 | + if($config->syndication_use != 'Y') { |
|
85 | + return $this->makeObject(); |
|
86 | + } |
|
87 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
88 | + return $this->makeObject(); |
|
89 | + } |
|
71 | 90 | |
72 | 91 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
73 | 92 | |
@@ -85,19 +104,27 @@ discard block |
||
85 | 104 | |
86 | 105 | function triggerMoveDocumentModule(&$obj) |
87 | 106 | { |
88 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
107 | + if($obj->module_srl < 1) { |
|
108 | + return $this->makeObject(); |
|
109 | + } |
|
89 | 110 | |
90 | 111 | $oSyndicationModel = getModel('syndication'); |
91 | 112 | $oModuleModel = getModel('module'); |
92 | 113 | |
93 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
114 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
115 | + return $this->makeObject(); |
|
116 | + } |
|
94 | 117 | |
95 | 118 | $config = $oModuleModel->getModuleConfig('syndication'); |
96 | 119 | |
97 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
120 | + if($config->syndication_use!='Y') { |
|
121 | + return $this->makeObject(); |
|
122 | + } |
|
98 | 123 | |
99 | 124 | $arr_document_srl = explode(',', $obj->document_srls); |
100 | - if(!$arr_document_srl) return $this->makeObject(); |
|
125 | + if(!$arr_document_srl) { |
|
126 | + return $this->makeObject(); |
|
127 | + } |
|
101 | 128 | |
102 | 129 | foreach($arr_document_srl as $document_srl) |
103 | 130 | { |
@@ -123,11 +150,15 @@ discard block |
||
123 | 150 | $oSyndicationModel = getModel('syndication'); |
124 | 151 | $oModuleModel = getModel('module'); |
125 | 152 | |
126 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
153 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
154 | + return $this->makeObject(); |
|
155 | + } |
|
127 | 156 | |
128 | 157 | $config = $oModuleModel->getModuleConfig('syndication'); |
129 | 158 | |
130 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
159 | + if($config->syndication_use!='Y') { |
|
160 | + return $this->makeObject(); |
|
161 | + } |
|
131 | 162 | |
132 | 163 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
133 | 164 | |
@@ -211,8 +242,7 @@ discard block |
||
211 | 242 | if(!$buff) |
212 | 243 | { |
213 | 244 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
214 | - } |
|
215 | - else |
|
245 | + } else |
|
216 | 246 | { |
217 | 247 | $this->ping_message = $xmlDoc->result->message->body; |
218 | 248 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
39 | 39 | |
40 | 40 | $oAddonAdminModel = getAdminModel('addon'); |
41 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
41 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
42 | 42 | $oAddonAdminController = &addonAdminController::getInstance(); |
43 | 43 | $oAddonAdminController->doActivate('catpcha'); |
44 | 44 | $oAddonAdminController->makeCacheFile(); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | function checkUpdate() { |
49 | 49 | $oModuleModel = getModel('module'); |
50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
50 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | 51 | // if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
52 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
53 | 53 | |
54 | 54 | return false; |
55 | 55 | } |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | $oModuleModel = getModel('module'); |
59 | 59 | $oModuleController = getController('module'); |
60 | 60 | |
61 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')){ |
|
61 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
62 | 62 | $oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after'); |
63 | 63 | } |
64 | 64 | // if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')){ |
65 | 65 | // $oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after'); |
66 | 66 | // } |
67 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')){ |
|
67 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
68 | 68 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
69 | 69 | } |
70 | 70 | |
71 | 71 | $oAddonAdminModel = getAdminModel('addon'); |
72 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
72 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
73 | 73 | $oAddonAdminController = &addonAdminController::getInstance(); |
74 | 74 | $oAddonAdminController->doActivate('catpcha'); |
75 | 75 | $oAddonAdminController->makeCacheFile(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | function checkOpenSSLSupport() |
83 | 83 | { |
84 | - if(!in_array('ssl', stream_get_transports())) { |
|
84 | + if (!in_array('ssl', stream_get_transports())) { |
|
85 | 85 | return FALSE; |
86 | 86 | } |
87 | 87 | return TRUE; |
@@ -47,9 +47,13 @@ |
||
47 | 47 | |
48 | 48 | function checkUpdate() { |
49 | 49 | $oModuleModel = getModel('module'); |
50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
50 | + if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
51 | + return true; |
|
52 | + } |
|
51 | 53 | // if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
54 | + if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
55 | + return true; |
|
56 | + } |
|
53 | 57 | |
54 | 58 | return false; |
55 | 59 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | private $site_url = null; |
13 | 13 | private $uri_scheme = 'http://'; |
14 | - private $syndication_password= null; |
|
14 | + private $syndication_password = null; |
|
15 | 15 | private $year = null; |
16 | 16 | private $langs = array(); |
17 | 17 | private $granted_modules = array(); |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | function init() { |
21 | 21 | $oModuleModel = getModel('module'); |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
23 | + if (Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
24 | 24 | |
25 | 25 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
26 | 26 | $this->syndication_password = $config->syndication_password; |
27 | 27 | $this->year = $config->year; |
28 | 28 | |
29 | 29 | $output = executeQueryArray('syndication.getGrantedModules'); |
30 | - if($output->data) { |
|
31 | - foreach($output->data as $key => $val) { |
|
30 | + if ($output->data) { |
|
31 | + foreach ($output->data as $key => $val) { |
|
32 | 32 | $this->granted_modules[] = $val->module_srl; |
33 | 33 | } |
34 | 34 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $args->module_srl = $module_srl; |
42 | 42 | |
43 | 43 | $output = executeQuery('syndication.getExceptModule', $args); |
44 | - if($output->data->count) return TRUE; |
|
44 | + if ($output->data->count) return TRUE; |
|
45 | 45 | |
46 | 46 | $output = executeQuery('syndication.getGrantedModule', $args); |
47 | - if($output->data->count) return TRUE; |
|
47 | + if ($output->data->count) return TRUE; |
|
48 | 48 | |
49 | 49 | return FALSE; |
50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $module_srls = array(); |
56 | 56 | if (is_array($output->data)) |
57 | 57 | { |
58 | - foreach($output->data as $val) |
|
58 | + foreach ($output->data as $val) |
|
59 | 59 | { |
60 | 60 | $module_srls[] = $val->module_srl; |
61 | 61 | } |
@@ -65,21 +65,21 @@ discard block |
||
65 | 65 | |
66 | 66 | function getLang($key, $site_srl) |
67 | 67 | { |
68 | - if(!$this->langs[$site_srl]) |
|
68 | + if (!$this->langs[$site_srl]) |
|
69 | 69 | { |
70 | 70 | $this->langs[$site_srl] = array(); |
71 | 71 | $args = new stdClass; |
72 | 72 | $args->site_srl = $site_srl; |
73 | 73 | $args->lang_code = Context::getLangType(); |
74 | 74 | $output = executeQueryArray("syndication.getLang", $args); |
75 | - if(!$output->toBool() || !$output->data) return $key; |
|
75 | + if (!$output->toBool() || !$output->data) return $key; |
|
76 | 76 | |
77 | - foreach($output->data as $value) |
|
77 | + foreach ($output->data as $value) |
|
78 | 78 | { |
79 | 79 | $this->langs[$site_srl][$value->name] = $value->value; |
80 | 80 | } |
81 | 81 | } |
82 | - if($this->langs[$site_srl][$key]) |
|
82 | + if ($this->langs[$site_srl][$key]) |
|
83 | 83 | { |
84 | 84 | return $this->langs[$site_srl][$key]; |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | function handleLang($title, $site_srl) |
90 | 90 | { |
91 | 91 | $matches = NULL; |
92 | - if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
92 | + if (!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
93 | 93 | { |
94 | 94 | return $title; |
95 | 95 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | function getSyndicationList() { |
103 | 103 | $oModuleModel = getModel('module'); |
104 | 104 | $config = $oModuleModel->getModuleConfig('syndication'); |
105 | - if(!$config->year || !$config->site_url || !$config->syndication_token) |
|
105 | + if (!$config->year || !$config->site_url || !$config->syndication_token) |
|
106 | 106 | { |
107 | - return $this->makeObject(-1,'msg_check_syndication_config'); |
|
107 | + return $this->makeObject(-1, 'msg_check_syndication_config'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $id = Context::get('id'); |
@@ -114,49 +114,49 @@ discard block |
||
114 | 114 | $endTime = Context::get('end-time'); |
115 | 115 | |
116 | 116 | $page = Context::get('page'); |
117 | - if(!$page) |
|
117 | + if (!$page) |
|
118 | 118 | { |
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | $vars = Context::getRequestVars(); |
122 | - if(!$id || !$type) |
|
122 | + if (!$id || !$type) |
|
123 | 123 | { |
124 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
124 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
125 | 125 | } |
126 | 126 | |
127 | - if(!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i',$id,$matches)) |
|
127 | + if (!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i', $id, $matches)) |
|
128 | 128 | { |
129 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
129 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
130 | 130 | } |
131 | 131 | |
132 | - if($config->syndication_password != Context::get('syndication_password')) |
|
132 | + if ($config->syndication_password != Context::get('syndication_password')) |
|
133 | 133 | { |
134 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
134 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $url = $matches[1]; |
138 | 138 | $year = $matches[2]; |
139 | 139 | $target = $matches[3]; |
140 | 140 | $id = $matches[4]; |
141 | - if($id && $id{0}==':') |
|
141 | + if ($id && $id{0} == ':') |
|
142 | 142 | { |
143 | 143 | $id = substr($id, 1); |
144 | 144 | } |
145 | 145 | |
146 | 146 | $module_srl = null; |
147 | 147 | $document_srl = null; |
148 | - if($id && strpos($id,'-')!==false) |
|
148 | + if ($id && strpos($id, '-') !== false) |
|
149 | 149 | { |
150 | 150 | list($module_srl, $document_srl) = explode('-', $id); |
151 | 151 | } |
152 | - elseif($id) |
|
152 | + elseif ($id) |
|
153 | 153 | { |
154 | 154 | $module_srl = $id; |
155 | 155 | } |
156 | 156 | |
157 | - if(!$url || !$year || !$target) |
|
157 | + if (!$url || !$year || !$target) |
|
158 | 158 | { |
159 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
159 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | |
165 | 165 | $site_module_info = Context::get('site_module_info'); |
166 | 166 | |
167 | - if($target == 'channel' && !$module_srl) |
|
167 | + if ($target == 'channel' && !$module_srl) |
|
168 | 168 | { |
169 | 169 | $target = 'site'; |
170 | 170 | } |
171 | 171 | |
172 | - if($module_srl) |
|
172 | + if ($module_srl) |
|
173 | 173 | { |
174 | 174 | $args = new stdClass; |
175 | 175 | $args->module_srls = $module_srl; |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | self::$modules[$module_srl] = $output->data; |
179 | 179 | } |
180 | 180 | |
181 | - if($target == 'channel' && $module_srl) |
|
181 | + if ($target == 'channel' && $module_srl) |
|
182 | 182 | { |
183 | - if($module_info) |
|
183 | + if ($module_info) |
|
184 | 184 | { |
185 | 185 | $args->module_srl = $module_srl; |
186 | 186 | $output = executeQuery('syndication.getExceptModules', $args); |
187 | - if($output->data->count) |
|
187 | + if ($output->data->count) |
|
188 | 188 | { |
189 | 189 | $error = 'target is not founded'; |
190 | 190 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | unset($args); |
198 | 198 | } |
199 | 199 | |
200 | - if(!$error) |
|
200 | + if (!$error) |
|
201 | 201 | { |
202 | 202 | Context::set('target', $target); |
203 | 203 | Context::set('type', $type); |
@@ -208,20 +208,20 @@ discard block |
||
208 | 208 | $oModuleModel = getModel('module'); |
209 | 209 | $site_config = $oModuleModel->getModuleConfig('module'); |
210 | 210 | |
211 | - switch($target) |
|
211 | + switch ($target) |
|
212 | 212 | { |
213 | 213 | case 'site' : |
214 | 214 | $site_info = new stdClass; |
215 | 215 | $site_info->id = $this->getID('site'); |
216 | - $site_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
216 | + $site_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
217 | 217 | $site_info->site_title = $this->handleLang($site_module_info->browser_title, $site_module_info->site_srl); |
218 | 218 | $site_info->title = $site_info->site_title; |
219 | 219 | |
220 | - if($module_srl) |
|
220 | + if ($module_srl) |
|
221 | 221 | { |
222 | 222 | $args->module_srl = $module_srl; |
223 | 223 | $site_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
224 | - if(!$site_info->title) |
|
224 | + if (!$site_info->title) |
|
225 | 225 | { |
226 | 226 | $site_info->title = $site_info->site_title; |
227 | 227 | } |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | else |
230 | 230 | { |
231 | 231 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
232 | - if(is_array($except_module_output->data)) |
|
232 | + if (is_array($except_module_output->data)) |
|
233 | 233 | { |
234 | 234 | $except_module_srls = array(); |
235 | - foreach($except_module_output->data as $val) |
|
235 | + foreach ($except_module_output->data as $val) |
|
236 | 236 | { |
237 | 237 | $except_module_srls[] = $val->module_srl; |
238 | 238 | } |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | |
243 | 243 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
244 | 244 | |
245 | - if($output->data) |
|
245 | + if ($output->data) |
|
246 | 246 | { |
247 | 247 | $site_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
248 | 248 | } |
249 | 249 | |
250 | - $site_info->self_href = $this->getSelfHref($site_info->id,$type); |
|
250 | + $site_info->self_href = $this->getSelfHref($site_info->id, $type); |
|
251 | 251 | Context::set('site_info', $site_info); |
252 | 252 | |
253 | 253 | $this->setTemplateFile('site'); |
254 | - switch($type) { |
|
254 | + switch ($type) { |
|
255 | 255 | case 'article' : |
256 | 256 | // 문서 전체를 신디케이션에 추가 |
257 | - Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article',$site_info->id)); |
|
257 | + Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $site_info->id)); |
|
258 | 258 | $next_url = Context::get('articles')->next_url; |
259 | 259 | |
260 | 260 | break; |
261 | 261 | case 'deleted' : |
262 | 262 | // 문서 전체를 신디케이션에서 삭제 |
263 | - Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted',$site_info->id)); |
|
263 | + Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted', $site_info->id)); |
|
264 | 264 | $next_url = Context::get('deleted')->next_url; |
265 | 265 | break; |
266 | 266 | default : |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | // 다음 페이지가 있다면 다시 신디케이션 호출 |
272 | - if($next_url) |
|
272 | + if ($next_url) |
|
273 | 273 | { |
274 | 274 | $oSyndicationController = getController('syndication'); |
275 | 275 | $oSyndicationController->ping(Context::get('id'), Context::get('type'), ++$page); |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
283 | 283 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
284 | 284 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
285 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
285 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
286 | 286 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
287 | 287 | $channel_info->summary = $module_info->description; |
288 | - if($module_info->module == "textyle") |
|
288 | + if ($module_info->module == "textyle") |
|
289 | 289 | { |
290 | 290 | $channel_info->type = "blog"; |
291 | 291 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | $channel_info->type = "web"; |
296 | 296 | } |
297 | 297 | $except_module_srls = $this->getExceptModuleSrls(); |
298 | - if($except_module_srls) |
|
298 | + if ($except_module_srls) |
|
299 | 299 | { |
300 | - $args->except_modules = implode(',',$except_module_srls); |
|
300 | + $args->except_modules = implode(',', $except_module_srls); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
304 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
305 | 305 | Context::set('channel_info', $channel_info); |
306 | 306 | |
307 | 307 | $this->setTemplateFile('channel'); |
308 | - switch($type) { |
|
308 | + switch ($type) { |
|
309 | 309 | case 'article' : |
310 | 310 | Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $channel_info->id)); |
311 | 311 | break; |
@@ -323,29 +323,29 @@ discard block |
||
323 | 323 | $channel_info->id = $this->getID('channel', $module_info->module_srl); |
324 | 324 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
325 | 325 | $channel_info->site_title = $site_config->siteTitle; |
326 | - if(!$channel_info->site_title) { |
|
326 | + if (!$channel_info->site_title) { |
|
327 | 327 | $channel_info->site_title = $channel_info->title; |
328 | 328 | } |
329 | 329 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
330 | 330 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
331 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
331 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
332 | 332 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
333 | 333 | $channel_info->webmaster_name = $member_config->webmaster_name; |
334 | 334 | $channel_info->webmaster_email = $member_config->webmaster_email; |
335 | 335 | |
336 | 336 | $except_module_srls = $this->getExceptModuleSrls(); |
337 | - if($except_module_srls) |
|
337 | + if ($except_module_srls) |
|
338 | 338 | { |
339 | - $args->except_modules = implode(',',$except_module_srls); |
|
339 | + $args->except_modules = implode(',', $except_module_srls); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
343 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
344 | 344 | Context::set('channel_info', $channel_info); |
345 | 345 | Context::set('member_config', $member_config); |
346 | 346 | |
347 | 347 | $this->setTemplateFile('channel'); |
348 | - switch($type) { |
|
348 | + switch ($type) { |
|
349 | 349 | case "article" : |
350 | 350 | $articles = new stdClass; |
351 | 351 | $articles->list = array($this->getArticle($document_srl)); |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | |
372 | 372 | // @DEPRECATED |
373 | 373 | function getChannels() { |
374 | - if($module_srls) $args->module_srls = $module_srls; |
|
375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
374 | + if ($module_srls) $args->module_srls = $module_srls; |
|
375 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
376 | 376 | $output = executeQueryArray('syndication.getModules', $args); |
377 | 377 | |
378 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
378 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
379 | 379 | Context::set('time_zone', $time_zone); |
380 | 380 | |
381 | - if($output->data) { |
|
382 | - foreach($output->data as $module_info) { |
|
381 | + if ($output->data) { |
|
382 | + foreach ($output->data as $module_info) { |
|
383 | 383 | unset($obj); |
384 | 384 | $obj = new stdClass; |
385 | 385 | $obj->id = $this->getID('channel', $module_info->module_srl); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $obj->self_href = $this->getSelfHref($obj->id, 'channel'); |
389 | 389 | $obj->alternative_href = $this->getChannelAlternativeHref($module_info); |
390 | 390 | $obj->summary = $module_info->description; |
391 | - if($module_info->module == "textyle") |
|
391 | + if ($module_info->module == "textyle") |
|
392 | 392 | { |
393 | 393 | $obj->type = "blog"; |
394 | 394 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | function getArticle($document_srl) { |
408 | - if($this->site_url==null) $this->init(); |
|
408 | + if ($this->site_url == null) $this->init(); |
|
409 | 409 | |
410 | 410 | $oDocumentModel = getModel('document'); |
411 | - $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
|
412 | - if(!$oDocument->isExists()) return; |
|
411 | + $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
|
412 | + if (!$oDocument->isExists()) return; |
|
413 | 413 | |
414 | 414 | $val = $oDocument->getObjectVars(); |
415 | 415 | |
416 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
416 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
417 | 417 | Context::set('time_zone', $time_zone); |
418 | 418 | |
419 | 419 | $mdoule_info = self::$modules[$oDocument->get('module_srl')]; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $article->nick_name = (!$oDocument->get('nick_name')) ? $oDocument->get('user_name') : $oDocument->get('nick_name'); |
428 | 428 | $article->title = $oDocument->getTitle(); |
429 | 429 | $article->content = $oDocument->get('content'); |
430 | - if($val->category_srl) { |
|
430 | + if ($val->category_srl) { |
|
431 | 431 | $category = $oDocumentModel->getCategory($val->category_srl); |
432 | 432 | $category_title = $category->title; |
433 | 433 | $article->category = new stdClass(); |
@@ -438,14 +438,14 @@ discard block |
||
438 | 438 | return $article; |
439 | 439 | } |
440 | 440 | |
441 | - function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
442 | - if($this->site_url==null) $this->init(); |
|
441 | + function getArticles($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
442 | + if ($this->site_url == null) $this->init(); |
|
443 | 443 | |
444 | 444 | $args = new stdClass; |
445 | - if($module_srl) $args->module_srl = $module_srl; |
|
446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
445 | + if ($module_srl) $args->module_srl = $module_srl; |
|
446 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
449 | 449 | $args->page = $page; |
450 | 450 | $output = executeQueryArray('syndication.getDocumentList', $args); |
451 | 451 | $cur_page = $output->page_navigation->cur_page; |
@@ -455,23 +455,23 @@ discard block |
||
455 | 455 | $result->next_url = null; |
456 | 456 | $result->list = array(); |
457 | 457 | |
458 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
458 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
459 | 459 | Context::set('time_zone', $time_zone); |
460 | 460 | |
461 | - if($cur_page<$total_page) { |
|
461 | + if ($cur_page < $total_page) { |
|
462 | 462 | $next_url = $this->getSelfHref($id, $type); |
463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
465 | - $result->next_url = $next_url.'&page='.($cur_page+1); |
|
463 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
465 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
466 | 466 | } |
467 | 467 | |
468 | - if($output->data) { |
|
469 | - foreach($output->data as $key => $val) { |
|
468 | + if ($output->data) { |
|
469 | + foreach ($output->data as $key => $val) { |
|
470 | 470 | $article = new stdClass(); |
471 | 471 | $article->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
472 | 472 | $article->updated = date("Y-m-d\\TH:i:s", ztime($val->last_update)).$time_zone; |
473 | 473 | $article->published = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
474 | - $article->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
474 | + $article->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
475 | 475 | $article->channel_alternative_href = $this->getChannelAlternativeHref($val->module_srl); |
476 | 476 | $article->nick_name = (!$val->nick_name) ? $val->user_name : $val->nick_name; |
477 | 477 | $article->content = $val->content; |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | - if($this->site_url==null) $this->init(); |
|
485 | + if ($this->site_url == null) $this->init(); |
|
486 | 486 | |
487 | 487 | $args = new stdClass; |
488 | - if($module_srl) $args->module_srl= $module_srl; |
|
489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
488 | + if ($module_srl) $args->module_srl = $module_srl; |
|
489 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
491 | 491 | $args->page = $page; |
492 | 492 | |
493 | 493 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -499,21 +499,21 @@ discard block |
||
499 | 499 | $result->next_url = null; |
500 | 500 | $result->list = array(); |
501 | 501 | |
502 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
502 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
503 | 503 | Context::set('time_zone', $time_zone); |
504 | 504 | |
505 | - if($cur_page<$total_page) { |
|
505 | + if ($cur_page < $total_page) { |
|
506 | 506 | $next_url = $this->getSelfHref($id, $type); |
507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
509 | - $result->next_url = $next_url . '&page='.($cur_page+1); |
|
507 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
509 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
510 | 510 | } |
511 | 511 | |
512 | - if($output->data) { |
|
513 | - foreach($output->data as $key => $val) { |
|
512 | + if ($output->data) { |
|
513 | + foreach ($output->data as $key => $val) { |
|
514 | 514 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
515 | 515 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
516 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
516 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
517 | 517 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
518 | 518 | $output->data[$key] = $val; |
519 | 519 | } |
@@ -530,25 +530,25 @@ discard block |
||
530 | 530 | $args->document_srl = $document_srl; |
531 | 531 | $output = executeQueryArray('syndication.getDeletedList', $args); |
532 | 532 | |
533 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
533 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
534 | 534 | Context::set('time_zone', $time_zone); |
535 | 535 | |
536 | - foreach($output->data as $key => $val) |
|
536 | + foreach ($output->data as $key => $val) |
|
537 | 537 | { |
538 | 538 | $module_srl = $val->module_srl; |
539 | 539 | |
540 | - if(!isset($module_info[$module_srl])) |
|
540 | + if (!isset($module_info[$module_srl])) |
|
541 | 541 | { |
542 | 542 | $args = new stdClass; |
543 | 543 | $args->module_srl = $module_srl; |
544 | 544 | $module_output = executeQuery('syndication.getModuleSiteInfo', $args); |
545 | - if($module_output->data) $module_info[$module_srl] = $module_output->data; |
|
545 | + if ($module_output->data) $module_info[$module_srl] = $module_output->data; |
|
546 | 546 | else $module_info[$module_srl] = null; |
547 | 547 | } |
548 | 548 | |
549 | 549 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
550 | 550 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
551 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'mid', $module_info[$module_srl]->mid, 'document_srl', $val->document_srl); |
|
551 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'mid', $module_info[$module_srl]->mid, 'document_srl', $val->document_srl); |
|
552 | 552 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
553 | 553 | $output->data[$key] = $val; |
554 | 554 | } |
@@ -557,42 +557,42 @@ discard block |
||
557 | 557 | } |
558 | 558 | |
559 | 559 | function getID($type, $target_id = null) { |
560 | - if($this->site_url==null) $this->init(); |
|
560 | + if ($this->site_url == null) $this->init(); |
|
561 | 561 | |
562 | - return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
|
562 | + return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type).($target_id ? ':'.$target_id : ''); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | function getChannelAlternativeHref($module_srl) { |
566 | 566 | static $module_info = array(); |
567 | - if(!isset($module_info[$module_srl])) { |
|
567 | + if (!isset($module_info[$module_srl])) { |
|
568 | 568 | $args = new stdClass; |
569 | 569 | $args->module_srl = $module_srl; |
570 | 570 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
571 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
571 | + if ($output->data) $module_info[$module_srl] = $output->data; |
|
572 | 572 | else $module_info[$module_srl] = null; |
573 | 573 | } |
574 | 574 | |
575 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
575 | + if (is_null($module_info[$module_srl])) return $this->site_url; |
|
576 | 576 | |
577 | 577 | $domain = $module_info[$module_srl]->domain; |
578 | 578 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
579 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
579 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
580 | 580 | return $url; |
581 | 581 | } |
582 | 582 | |
583 | 583 | function getSelfHref($id, $type = null) { |
584 | - if($this->site_url==null) $this->init(); |
|
584 | + if ($this->site_url == null) $this->init(); |
|
585 | 585 | |
586 | - return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
|
586 | + return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme.$this->site_url, $id, $type, $this->syndication_password); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
590 | 590 | * 문서의 고유 URL 반환 |
591 | 591 | */ |
592 | 592 | function getAlternativeHref($document_srl, $module_srl) { |
593 | - if($this->site_url==null) $this->init(); |
|
593 | + if ($this->site_url == null) $this->init(); |
|
594 | 594 | |
595 | - if(!self::$modules[$module_srl]) { |
|
595 | + if (!self::$modules[$module_srl]) { |
|
596 | 596 | $args = new stdClass; |
597 | 597 | $args->module_srls = $module_srl; |
598 | 598 | $output = executeQuery('syndication.getModules', $args); |
@@ -604,20 +604,20 @@ discard block |
||
604 | 604 | |
605 | 605 | $domain = $module_info->domain; |
606 | 606 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
607 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
607 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
608 | 608 | return $url; |
609 | 609 | } |
610 | 610 | |
611 | 611 | function getDate($date) { |
612 | 612 | $time = strtotime($date); |
613 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
613 | + if ($time == -1) $time = ztime(str_replace(array('-', 'T', ':'), '', $date)); |
|
614 | 614 | return date('YmdHis', $time); |
615 | 615 | } |
616 | 616 | |
617 | 617 | function getResentPingLogPath() |
618 | 618 | { |
619 | 619 | $target_filename = _XE_PATH_.'files/cache/tmp/syndication_ping_log'; |
620 | - if(!file_exists($target_filename)) |
|
620 | + if (!file_exists($target_filename)) |
|
621 | 621 | { |
622 | 622 | FileHandler::writeFile($target_filename, ''); |
623 | 623 | } |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | $args->message = urlencode($msg); |
634 | 634 | |
635 | 635 | $list = $this->getResentPingLog(); |
636 | - if(count($list)>=10) |
|
636 | + if (count($list) >= 10) |
|
637 | 637 | { |
638 | 638 | array_pop($list); |
639 | 639 | } |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $file_path = $this->getResentPingLogPath(); |
649 | 649 | $str = FileHandler::readFile($file_path); |
650 | 650 | $list = array(); |
651 | - if($str) |
|
651 | + if ($str) |
|
652 | 652 | { |
653 | 653 | $list = unserialize($str); |
654 | 654 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | function init() { |
21 | 21 | $oModuleModel = getModel('module'); |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
23 | + if(Context::getSslStatus() == 'always') { |
|
24 | + $this->uri_scheme = 'https://'; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
26 | 28 | $this->syndication_password = $config->syndication_password; |
@@ -41,10 +43,14 @@ discard block |
||
41 | 43 | $args->module_srl = $module_srl; |
42 | 44 | |
43 | 45 | $output = executeQuery('syndication.getExceptModule', $args); |
44 | - if($output->data->count) return TRUE; |
|
46 | + if($output->data->count) { |
|
47 | + return TRUE; |
|
48 | + } |
|
45 | 49 | |
46 | 50 | $output = executeQuery('syndication.getGrantedModule', $args); |
47 | - if($output->data->count) return TRUE; |
|
51 | + if($output->data->count) { |
|
52 | + return TRUE; |
|
53 | + } |
|
48 | 54 | |
49 | 55 | return FALSE; |
50 | 56 | } |
@@ -72,7 +78,9 @@ discard block |
||
72 | 78 | $args->site_srl = $site_srl; |
73 | 79 | $args->lang_code = Context::getLangType(); |
74 | 80 | $output = executeQueryArray("syndication.getLang", $args); |
75 | - if(!$output->toBool() || !$output->data) return $key; |
|
81 | + if(!$output->toBool() || !$output->data) { |
|
82 | + return $key; |
|
83 | + } |
|
76 | 84 | |
77 | 85 | foreach($output->data as $value) |
78 | 86 | { |
@@ -82,8 +90,9 @@ discard block |
||
82 | 90 | if($this->langs[$site_srl][$key]) |
83 | 91 | { |
84 | 92 | return $this->langs[$site_srl][$key]; |
93 | + } else { |
|
94 | + return $key; |
|
85 | 95 | } |
86 | - else return $key; |
|
87 | 96 | } |
88 | 97 | |
89 | 98 | function handleLang($title, $site_srl) |
@@ -92,8 +101,7 @@ discard block |
||
92 | 101 | if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
93 | 102 | { |
94 | 103 | return $title; |
95 | - } |
|
96 | - else |
|
104 | + } else |
|
97 | 105 | { |
98 | 106 | return $this->getLang($matches[1], $site_srl); |
99 | 107 | } |
@@ -148,8 +156,7 @@ discard block |
||
148 | 156 | if($id && strpos($id,'-')!==false) |
149 | 157 | { |
150 | 158 | list($module_srl, $document_srl) = explode('-', $id); |
151 | - } |
|
152 | - elseif($id) |
|
159 | + } elseif($id) |
|
153 | 160 | { |
154 | 161 | $module_srl = $id; |
155 | 162 | } |
@@ -188,8 +195,7 @@ discard block |
||
188 | 195 | { |
189 | 196 | $error = 'target is not founded'; |
190 | 197 | } |
191 | - } |
|
192 | - else |
|
198 | + } else |
|
193 | 199 | { |
194 | 200 | $error = 'target is not founded'; |
195 | 201 | } |
@@ -225,8 +231,7 @@ discard block |
||
225 | 231 | { |
226 | 232 | $site_info->title = $site_info->site_title; |
227 | 233 | } |
228 | - } |
|
229 | - else |
|
234 | + } else |
|
230 | 235 | { |
231 | 236 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
232 | 237 | if(is_array($except_module_output->data)) |
@@ -289,8 +294,7 @@ discard block |
||
289 | 294 | { |
290 | 295 | $channel_info->type = "blog"; |
291 | 296 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
292 | - } |
|
293 | - else |
|
297 | + } else |
|
294 | 298 | { |
295 | 299 | $channel_info->type = "web"; |
296 | 300 | } |
@@ -301,7 +305,9 @@ discard block |
||
301 | 305 | } |
302 | 306 | |
303 | 307 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
308 | + if($output->data) { |
|
309 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
310 | + } |
|
305 | 311 | Context::set('channel_info', $channel_info); |
306 | 312 | |
307 | 313 | $this->setTemplateFile('channel'); |
@@ -340,7 +346,9 @@ discard block |
||
340 | 346 | } |
341 | 347 | |
342 | 348 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
349 | + if($output->data) { |
|
350 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
351 | + } |
|
344 | 352 | Context::set('channel_info', $channel_info); |
345 | 353 | Context::set('member_config', $member_config); |
346 | 354 | |
@@ -371,8 +379,12 @@ discard block |
||
371 | 379 | |
372 | 380 | // @DEPRECATED |
373 | 381 | function getChannels() { |
374 | - if($module_srls) $args->module_srls = $module_srls; |
|
375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
382 | + if($module_srls) { |
|
383 | + $args->module_srls = $module_srls; |
|
384 | + } |
|
385 | + if(count($this->granted_modules)) { |
|
386 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
387 | + } |
|
376 | 388 | $output = executeQueryArray('syndication.getModules', $args); |
377 | 389 | |
378 | 390 | $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
@@ -392,8 +404,7 @@ discard block |
||
392 | 404 | { |
393 | 405 | $obj->type = "blog"; |
394 | 406 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
395 | - } |
|
396 | - else |
|
407 | + } else |
|
397 | 408 | { |
398 | 409 | $obj->type = "web"; |
399 | 410 | } |
@@ -405,11 +416,15 @@ discard block |
||
405 | 416 | } |
406 | 417 | |
407 | 418 | function getArticle($document_srl) { |
408 | - if($this->site_url==null) $this->init(); |
|
419 | + if($this->site_url==null) { |
|
420 | + $this->init(); |
|
421 | + } |
|
409 | 422 | |
410 | 423 | $oDocumentModel = getModel('document'); |
411 | 424 | $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
412 | - if(!$oDocument->isExists()) return; |
|
425 | + if(!$oDocument->isExists()) { |
|
426 | + return; |
|
427 | + } |
|
413 | 428 | |
414 | 429 | $val = $oDocument->getObjectVars(); |
415 | 430 | |
@@ -439,13 +454,23 @@ discard block |
||
439 | 454 | } |
440 | 455 | |
441 | 456 | function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
442 | - if($this->site_url==null) $this->init(); |
|
457 | + if($this->site_url==null) { |
|
458 | + $this->init(); |
|
459 | + } |
|
443 | 460 | |
444 | 461 | $args = new stdClass; |
445 | - if($module_srl) $args->module_srl = $module_srl; |
|
446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
462 | + if($module_srl) { |
|
463 | + $args->module_srl = $module_srl; |
|
464 | + } |
|
465 | + if($startTime) { |
|
466 | + $args->start_date = $this->getDate($startTime); |
|
467 | + } |
|
468 | + if($endTime) { |
|
469 | + $args->end_date = $this->getDate($endTime); |
|
470 | + } |
|
471 | + if(count($this->granted_modules)) { |
|
472 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
473 | + } |
|
449 | 474 | $args->page = $page; |
450 | 475 | $output = executeQueryArray('syndication.getDocumentList', $args); |
451 | 476 | $cur_page = $output->page_navigation->cur_page; |
@@ -460,8 +485,12 @@ discard block |
||
460 | 485 | |
461 | 486 | if($cur_page<$total_page) { |
462 | 487 | $next_url = $this->getSelfHref($id, $type); |
463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
488 | + if($startTime) { |
|
489 | + $next_url .= '&startTime='.$startTime; |
|
490 | + } |
|
491 | + if($endTime) { |
|
492 | + $next_url .= '&endTime='.$endTime; |
|
493 | + } |
|
465 | 494 | $result->next_url = $next_url.'&page='.($cur_page+1); |
466 | 495 | } |
467 | 496 | |
@@ -482,12 +511,20 @@ discard block |
||
482 | 511 | } |
483 | 512 | |
484 | 513 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | - if($this->site_url==null) $this->init(); |
|
514 | + if($this->site_url==null) { |
|
515 | + $this->init(); |
|
516 | + } |
|
486 | 517 | |
487 | 518 | $args = new stdClass; |
488 | - if($module_srl) $args->module_srl= $module_srl; |
|
489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
519 | + if($module_srl) { |
|
520 | + $args->module_srl= $module_srl; |
|
521 | + } |
|
522 | + if($startTime) { |
|
523 | + $args->start_date = $this->getDate($startTime); |
|
524 | + } |
|
525 | + if($endTime) { |
|
526 | + $args->end_date = $this->getDate($endTime); |
|
527 | + } |
|
491 | 528 | $args->page = $page; |
492 | 529 | |
493 | 530 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -504,8 +541,12 @@ discard block |
||
504 | 541 | |
505 | 542 | if($cur_page<$total_page) { |
506 | 543 | $next_url = $this->getSelfHref($id, $type); |
507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
544 | + if($startTime) { |
|
545 | + $next_url .= '&startTime='.$startTime; |
|
546 | + } |
|
547 | + if($endTime) { |
|
548 | + $next_url .= '&endTime='.$endTime; |
|
549 | + } |
|
509 | 550 | $result->next_url = $next_url . '&page='.($cur_page+1); |
510 | 551 | } |
511 | 552 | |
@@ -542,8 +583,11 @@ discard block |
||
542 | 583 | $args = new stdClass; |
543 | 584 | $args->module_srl = $module_srl; |
544 | 585 | $module_output = executeQuery('syndication.getModuleSiteInfo', $args); |
545 | - if($module_output->data) $module_info[$module_srl] = $module_output->data; |
|
546 | - else $module_info[$module_srl] = null; |
|
586 | + if($module_output->data) { |
|
587 | + $module_info[$module_srl] = $module_output->data; |
|
588 | + } else { |
|
589 | + $module_info[$module_srl] = null; |
|
590 | + } |
|
547 | 591 | } |
548 | 592 | |
549 | 593 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
@@ -557,7 +601,9 @@ discard block |
||
557 | 601 | } |
558 | 602 | |
559 | 603 | function getID($type, $target_id = null) { |
560 | - if($this->site_url==null) $this->init(); |
|
604 | + if($this->site_url==null) { |
|
605 | + $this->init(); |
|
606 | + } |
|
561 | 607 | |
562 | 608 | return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
563 | 609 | } |
@@ -568,20 +614,29 @@ discard block |
||
568 | 614 | $args = new stdClass; |
569 | 615 | $args->module_srl = $module_srl; |
570 | 616 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
571 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
572 | - else $module_info[$module_srl] = null; |
|
617 | + if($output->data) { |
|
618 | + $module_info[$module_srl] = $output->data; |
|
619 | + } else { |
|
620 | + $module_info[$module_srl] = null; |
|
621 | + } |
|
573 | 622 | } |
574 | 623 | |
575 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
624 | + if(is_null($module_info[$module_srl])) { |
|
625 | + return $this->site_url; |
|
626 | + } |
|
576 | 627 | |
577 | 628 | $domain = $module_info[$module_srl]->domain; |
578 | 629 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
579 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
630 | + if(substr($url,0,1)=='/') { |
|
631 | + $domain = $this->uri_scheme . $this->site_url . $url; |
|
632 | + } |
|
580 | 633 | return $url; |
581 | 634 | } |
582 | 635 | |
583 | 636 | function getSelfHref($id, $type = null) { |
584 | - if($this->site_url==null) $this->init(); |
|
637 | + if($this->site_url==null) { |
|
638 | + $this->init(); |
|
639 | + } |
|
585 | 640 | |
586 | 641 | return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
587 | 642 | } |
@@ -590,7 +645,9 @@ discard block |
||
590 | 645 | * 문서의 고유 URL 반환 |
591 | 646 | */ |
592 | 647 | function getAlternativeHref($document_srl, $module_srl) { |
593 | - if($this->site_url==null) $this->init(); |
|
648 | + if($this->site_url==null) { |
|
649 | + $this->init(); |
|
650 | + } |
|
594 | 651 | |
595 | 652 | if(!self::$modules[$module_srl]) { |
596 | 653 | $args = new stdClass; |
@@ -604,13 +661,17 @@ discard block |
||
604 | 661 | |
605 | 662 | $domain = $module_info->domain; |
606 | 663 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
607 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
664 | + if(substr($url,0,1)=='/') { |
|
665 | + $domain = $this->uri_scheme . $this->site_url.$url; |
|
666 | + } |
|
608 | 667 | return $url; |
609 | 668 | } |
610 | 669 | |
611 | 670 | function getDate($date) { |
612 | 671 | $time = strtotime($date); |
613 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
672 | + if($time == -1) { |
|
673 | + $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
674 | + } |
|
614 | 675 | return date('YmdHis', $time); |
615 | 676 | } |
616 | 677 |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | { |
28 | 28 | // error appears if no doc is selected |
29 | 29 | $cart = Context::get('cart'); |
30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
31 | - $document_srl_list= explode('|@|', $cart); |
|
30 | + if (!$cart) return $this->stop('msg_cart_is_null'); |
|
31 | + $document_srl_list = explode('|@|', $cart); |
|
32 | 32 | $document_count = count($document_srl_list); |
33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
33 | + if (!$document_count) return $this->stop('msg_cart_is_null'); |
|
34 | 34 | // Delete a doc |
35 | 35 | $oDocumentController = getController('document'); |
36 | - for($i=0;$i<$document_count;$i++) |
|
36 | + for ($i = 0; $i < $document_count; $i++) |
|
37 | 37 | { |
38 | 38 | $document_srl = trim($document_srl_list[$i]); |
39 | - if(!$document_srl) continue; |
|
39 | + if (!$document_srl) continue; |
|
40 | 40 | |
41 | 41 | $oDocumentController->deleteDocument($document_srl, true); |
42 | 42 | } |
43 | 43 | |
44 | - $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) ); |
|
44 | + $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count)); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
55 | 55 | { |
56 | - if(!count($document_srl_list)) return; |
|
56 | + if (!count($document_srl_list)) return; |
|
57 | 57 | |
58 | 58 | $oDocumentModel = getModel('document'); |
59 | 59 | $oDocumentController = getController('document'); |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | $oDB->begin(); |
63 | 63 | |
64 | 64 | $triggerObj = new stdClass(); |
65 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
65 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
66 | 66 | $triggerObj->module_srl = $module_srl; |
67 | 67 | $triggerObj->source_module_srl = array(); |
68 | 68 | $triggerObj->category_srl = $category_srl; |
69 | 69 | |
70 | 70 | // Call a trigger (before) |
71 | 71 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj); |
72 | - if(!$output->toBool()) |
|
72 | + if (!$output->toBool()) |
|
73 | 73 | { |
74 | 74 | $oDB->rollback(); |
75 | 75 | return $output; |
76 | 76 | } |
77 | 77 | |
78 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
78 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
79 | 79 | { |
80 | 80 | $document_srl = $document_srl_list[$i]; |
81 | 81 | $oDocument = $oDocumentModel->getDocument($document_srl); |
82 | - if(!$oDocument->isExists()) continue; |
|
82 | + if (!$oDocument->isExists()) continue; |
|
83 | 83 | |
84 | 84 | $triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl'); |
85 | 85 | |
@@ -94,27 +94,27 @@ discard block |
||
94 | 94 | $obj->content = $output_ori->data->content; |
95 | 95 | |
96 | 96 | // Move the attached file if the target module is different |
97 | - if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
97 | + if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
98 | 98 | { |
99 | 99 | $oFileController = getController('file'); |
100 | 100 | |
101 | 101 | $files = $oDocument->getUploadedFiles(); |
102 | 102 | $delete_file_srls = array(); |
103 | - if(is_array($files)) |
|
103 | + if (is_array($files)) |
|
104 | 104 | { |
105 | - foreach($files as $val) |
|
105 | + foreach ($files as $val) |
|
106 | 106 | { |
107 | 107 | $file_info = array(); |
108 | 108 | $file_info['tmp_name'] = $val->uploaded_filename; |
109 | 109 | $file_info['name'] = $val->source_filename; |
110 | 110 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true); |
111 | - if($inserted_file && $inserted_file->toBool()) |
|
111 | + if ($inserted_file && $inserted_file->toBool()) |
|
112 | 112 | { |
113 | 113 | // for image/video files |
114 | - if($val->direct_download == 'Y') |
|
114 | + if ($val->direct_download == 'Y') |
|
115 | 115 | { |
116 | - $source_filename = substr($val->uploaded_filename,2); |
|
117 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
116 | + $source_filename = substr($val->uploaded_filename, 2); |
|
117 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
118 | 118 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
119 | 119 | // For binary files |
120 | 120 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $oFileController->setFilesValid($obj->document_srl); |
134 | 134 | } |
135 | 135 | |
136 | - if($module_srl != $obj->module_srl) |
|
136 | + if ($module_srl != $obj->module_srl) |
|
137 | 137 | { |
138 | 138 | $oDocumentController->deleteDocumentAliasByDocument($obj->document_srl); |
139 | 139 | } |
@@ -141,48 +141,48 @@ discard block |
||
141 | 141 | $obj->module_srl = $module_srl; |
142 | 142 | $obj->category_srl = $category_srl; |
143 | 143 | $output = executeQuery('document.updateDocumentModule', $obj); |
144 | - if(!$output->toBool()) { |
|
144 | + if (!$output->toBool()) { |
|
145 | 145 | $oDB->rollback(); |
146 | 146 | return $output; |
147 | 147 | } |
148 | 148 | |
149 | 149 | //Move a module of the extra vars |
150 | 150 | $output = executeQuery('document.moveDocumentExtraVars', $obj); |
151 | - if(!$output->toBool()) { |
|
151 | + if (!$output->toBool()) { |
|
152 | 152 | $oDB->rollback(); |
153 | 153 | return $output; |
154 | 154 | } |
155 | 155 | // Set 0 if a new category doesn't exist after catergory change |
156 | - if($source_category_srl != $category_srl) |
|
156 | + if ($source_category_srl != $category_srl) |
|
157 | 157 | { |
158 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
159 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
158 | + if ($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
159 | + if ($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | $args = new stdClass(); |
164 | - $args->document_srls = implode(',',$document_srl_list); |
|
164 | + $args->document_srls = implode(',', $document_srl_list); |
|
165 | 165 | $args->module_srl = $module_srl; |
166 | 166 | // move the comment |
167 | 167 | $output = executeQuery('comment.updateCommentModule', $args); |
168 | - if(!$output->toBool()) |
|
168 | + if (!$output->toBool()) |
|
169 | 169 | { |
170 | 170 | $oDB->rollback(); |
171 | 171 | return $output; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $output = executeQuery('comment.updateCommentListModule', $args); |
175 | - if(!$output->toBool()) |
|
175 | + if (!$output->toBool()) |
|
176 | 176 | { |
177 | 177 | $oDB->rollback(); |
178 | 178 | return $output; |
179 | 179 | } |
180 | 180 | |
181 | 181 | // move the trackback |
182 | - if(getClass('trackback')) |
|
182 | + if (getClass('trackback')) |
|
183 | 183 | { |
184 | 184 | $output = executeQuery('trackback.updateTrackbackModule', $args); |
185 | - if(!$output->toBool()) |
|
185 | + if (!$output->toBool()) |
|
186 | 186 | { |
187 | 187 | $oDB->rollback(); |
188 | 188 | return $output; |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | |
192 | 192 | // Tags |
193 | 193 | $output = executeQuery('tag.updateTagModule', $args); |
194 | - if(!$output->toBool()) |
|
194 | + if (!$output->toBool()) |
|
195 | 195 | { |
196 | 196 | $oDB->rollback(); |
197 | 197 | return $output; |
198 | 198 | } |
199 | 199 | // Call a trigger (before) |
200 | 200 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj); |
201 | - if(!$output->toBool()) |
|
201 | + if (!$output->toBool()) |
|
202 | 202 | { |
203 | 203 | $oDB->rollback(); |
204 | 204 | return $output; |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | $oDB->commit(); |
208 | 208 | //remove from cache |
209 | 209 | $oCacheHandler = CacheHandler::getInstance('object'); |
210 | - if($oCacheHandler->isSupport()) |
|
210 | + if ($oCacheHandler->isSupport()) |
|
211 | 211 | { |
212 | - foreach($document_srl_list as $document_srl) |
|
212 | + foreach ($document_srl_list as $document_srl) |
|
213 | 213 | { |
214 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
214 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
215 | 215 | $oCacheHandler->delete($cache_key_item); |
216 | 216 | } |
217 | 217 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
229 | 229 | { |
230 | - if(count($document_srl_list) < 1) return; |
|
230 | + if (count($document_srl_list) < 1) return; |
|
231 | 231 | |
232 | 232 | $oDocumentModel = getModel('document'); |
233 | 233 | $oDocumentController = getController('document'); |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | $oDB->begin(); |
239 | 239 | |
240 | 240 | $triggerObj = new stdClass(); |
241 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
241 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
242 | 242 | $triggerObj->module_srl = $module_srl; |
243 | 243 | $triggerObj->category_srl = $category_srl; |
244 | 244 | // Call a trigger (before) |
245 | 245 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj); |
246 | - if(!$output->toBool()) |
|
246 | + if (!$output->toBool()) |
|
247 | 247 | { |
248 | 248 | $oDB->rollback(); |
249 | 249 | return $output; |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | |
252 | 252 | $extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list); |
253 | 253 | $extraVarsListByDocumentSrl = array(); |
254 | - if(is_array($extraVarsList->data)) |
|
254 | + if (is_array($extraVarsList->data)) |
|
255 | 255 | { |
256 | - foreach($extraVarsList->data as $value) |
|
256 | + foreach ($extraVarsList->data as $value) |
|
257 | 257 | { |
258 | - if(!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
258 | + if (!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
259 | 259 | { |
260 | 260 | $extraVarsListByDocumentSrl[$value->document_srl] = array(); |
261 | 261 | } |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
267 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
268 | 268 | { |
269 | 269 | $document_srl = $document_srl_list[$i]; |
270 | 270 | $oDocument = $oDocumentModel->getDocument($document_srl); |
271 | - if(!$oDocument->isExists()) continue; |
|
271 | + if (!$oDocument->isExists()) continue; |
|
272 | 272 | |
273 | 273 | $obj = $oDocument->getObjectVars(); |
274 | 274 | |
275 | 275 | $extraVars = $extraVarsListByDocumentSrl[$document_srl]; |
276 | - if($module_srl == $obj->module_srl) |
|
276 | + if ($module_srl == $obj->module_srl) |
|
277 | 277 | { |
278 | - if(is_array($extraVars)) |
|
278 | + if (is_array($extraVars)) |
|
279 | 279 | { |
280 | - foreach($extraVars as $extraItem) |
|
280 | + foreach ($extraVars as $extraItem) |
|
281 | 281 | { |
282 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
282 | + if ($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | $obj->trackback_count = 0; |
292 | 292 | |
293 | 293 | // Pre-register the attachment |
294 | - if($oDocument->hasUploadedFiles()) |
|
294 | + if ($oDocument->hasUploadedFiles()) |
|
295 | 295 | { |
296 | 296 | $files = $oDocument->getUploadedFiles(); |
297 | - foreach($files as $val) |
|
297 | + foreach ($files as $val) |
|
298 | 298 | { |
299 | 299 | $file_info = array(); |
300 | 300 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | $oFileController = getController('file'); |
303 | 303 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true); |
304 | 304 | // if image/video files |
305 | - if($val->direct_download == 'Y') |
|
305 | + if ($val->direct_download == 'Y') |
|
306 | 306 | { |
307 | - $source_filename = substr($val->uploaded_filename,2); |
|
308 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
307 | + $source_filename = substr($val->uploaded_filename, 2); |
|
308 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
309 | 309 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
310 | 310 | // If binary file |
311 | 311 | } |
@@ -319,23 +319,23 @@ discard block |
||
319 | 319 | |
320 | 320 | // Write a post |
321 | 321 | $output = $oDocumentController->insertDocument($obj, true, true); |
322 | - if(!$output->toBool()) |
|
322 | + if (!$output->toBool()) |
|
323 | 323 | { |
324 | 324 | $oDB->rollback(); |
325 | 325 | return $output; |
326 | 326 | } |
327 | 327 | |
328 | 328 | // copy multi language contents |
329 | - if(is_array($extraVars)) |
|
329 | + if (is_array($extraVars)) |
|
330 | 330 | { |
331 | - foreach($extraVars as $value) |
|
331 | + foreach ($extraVars as $value) |
|
332 | 332 | { |
333 | - if($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
333 | + if ($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
334 | 334 | { |
335 | 335 | continue; |
336 | 336 | } |
337 | 337 | |
338 | - if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) ) |
|
338 | + if ($value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0)) |
|
339 | 339 | { |
340 | 340 | $oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code); |
341 | 341 | } |
@@ -343,26 +343,26 @@ discard block |
||
343 | 343 | } |
344 | 344 | |
345 | 345 | // Move the comments |
346 | - if($oDocument->getCommentCount()) |
|
346 | + if ($oDocument->getCommentCount()) |
|
347 | 347 | { |
348 | 348 | $oCommentModel = getModel('comment'); |
349 | 349 | $comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999); |
350 | 350 | $comments = $comment_output->data; |
351 | - if(count($comments) > 0) |
|
351 | + if (count($comments) > 0) |
|
352 | 352 | { |
353 | 353 | $oCommentController = getController('comment'); |
354 | 354 | $success_count = 0; |
355 | 355 | $p_comment_srl = array(); |
356 | - foreach($comments as $comment_obj) |
|
356 | + foreach ($comments as $comment_obj) |
|
357 | 357 | { |
358 | 358 | $comment_srl = getNextSequence(); |
359 | 359 | $p_comment_srl[$comment_obj->comment_srl] = $comment_srl; |
360 | 360 | |
361 | 361 | // Pre-register the attachment |
362 | - if($comment_obj->uploaded_count) |
|
362 | + if ($comment_obj->uploaded_count) |
|
363 | 363 | { |
364 | 364 | $files = $oFileModel->getFiles($comment_obj->comment_srl, true); |
365 | - foreach($files as $val) |
|
365 | + foreach ($files as $val) |
|
366 | 366 | { |
367 | 367 | $file_info = array(); |
368 | 368 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -370,10 +370,10 @@ discard block |
||
370 | 370 | $oFileController = getController('file'); |
371 | 371 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true); |
372 | 372 | // if image/video files |
373 | - if($val->direct_download == 'Y') |
|
373 | + if ($val->direct_download == 'Y') |
|
374 | 374 | { |
375 | - $source_filename = substr($val->uploaded_filename,2); |
|
376 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
375 | + $source_filename = substr($val->uploaded_filename, 2); |
|
376 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
377 | 377 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
378 | 378 | // If binary file |
379 | 379 | } |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $comment_obj->document_srl = $obj->document_srl; |
390 | 390 | $comment_obj->comment_srl = $comment_srl; |
391 | 391 | |
392 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
392 | + if ($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
393 | 393 | |
394 | 394 | $output = $oCommentController->insertComment($comment_obj, true); |
395 | - if($output->toBool()) $success_count ++; |
|
395 | + if ($output->toBool()) $success_count++; |
|
396 | 396 | } |
397 | 397 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
398 | 398 | } |
@@ -400,19 +400,19 @@ discard block |
||
400 | 400 | |
401 | 401 | // Move the trackbacks |
402 | 402 | $oTrackbackModel = getModel('trackback'); |
403 | - if($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
403 | + if ($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
404 | 404 | { |
405 | 405 | $trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl); |
406 | - if(count($trackbacks)) |
|
406 | + if (count($trackbacks)) |
|
407 | 407 | { |
408 | 408 | $success_count = 0; |
409 | - foreach($trackbacks as $trackback_obj) |
|
409 | + foreach ($trackbacks as $trackback_obj) |
|
410 | 410 | { |
411 | 411 | $trackback_obj->trackback_srl = getNextSequence(); |
412 | 412 | $trackback_obj->module_srl = $obj->module_srl; |
413 | 413 | $trackback_obj->document_srl = $obj->document_srl; |
414 | 414 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
415 | - if($output->toBool()) $success_count++; |
|
415 | + if ($output->toBool()) $success_count++; |
|
416 | 416 | } |
417 | 417 | // Update the number of trackbacks |
418 | 418 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | // Call a trigger (before) |
426 | 426 | $triggerObj->copied_srls = $copied_srls; |
427 | 427 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj); |
428 | - if(!$output->toBool()) |
|
428 | + if (!$output->toBool()) |
|
429 | 429 | { |
430 | 430 | $oDB->rollback(); |
431 | 431 | return $output; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $document_list = $oDocumentModel->getDocumentList($args); |
453 | 453 | $documents = $document_list->data; |
454 | 454 | $output = executeQuery('document.deleteModuleDocument', $args); |
455 | - if(is_array($documents)) |
|
455 | + if (is_array($documents)) |
|
456 | 456 | { |
457 | 457 | foreach ($documents as $oDocument) |
458 | 458 | { |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | } |
462 | 462 | //remove from cache |
463 | 463 | $oCacheHandler = CacheHandler::getInstance('object'); |
464 | - if($oCacheHandler->isSupport()) |
|
464 | + if ($oCacheHandler->isSupport()) |
|
465 | 465 | { |
466 | - if(is_array($document_srl_list)) |
|
466 | + if (is_array($document_srl_list)) |
|
467 | 467 | { |
468 | - foreach($document_srl_list as $document_srl) |
|
468 | + foreach ($document_srl_list as $document_srl) |
|
469 | 469 | { |
470 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
470 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
471 | 471 | $oCacheHandler->delete($cache_key_item); |
472 | 472 | } |
473 | 473 | } |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | $config = getModel('document')->getDocumentConfig(); |
487 | 487 | $config->icons = Context::get('icons'); |
488 | 488 | $config->micons = Context::get('micons'); |
489 | - $output = $oModuleController->insertModuleConfig('document',$config); |
|
490 | - if(!$output->toBool()) |
|
489 | + $output = $oModuleController->insertModuleConfig('document', $config); |
|
490 | + if (!$output->toBool()) |
|
491 | 491 | { |
492 | 492 | return $output; |
493 | 493 | } |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | { |
507 | 507 | $document_srl = trim(Context::get('document_srl')); |
508 | 508 | |
509 | - if($document_srl) |
|
509 | + if ($document_srl) |
|
510 | 510 | { |
511 | 511 | $args->document_srl = $document_srl; |
512 | 512 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
513 | - if(!$output->toBool()) return $output; |
|
513 | + if (!$output->toBool()) return $output; |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | function procDocumentAdminDeleteAllThumbnail() |
522 | 522 | { |
523 | - $temp_cache_dir = './files/thumbnails_' . $_SERVER['REQUEST_TIME']; |
|
523 | + $temp_cache_dir = './files/thumbnails_'.$_SERVER['REQUEST_TIME']; |
|
524 | 524 | FileHandler::rename('./files/thumbnails', $temp_cache_dir); |
525 | 525 | FileHandler::makeDir('./files/thumbnails'); |
526 | 526 | |
@@ -536,12 +536,12 @@ discard block |
||
536 | 536 | function deleteThumbnailFile($path) |
537 | 537 | { |
538 | 538 | $directory = dir($path); |
539 | - while($entry = $directory->read()) { |
|
539 | + while ($entry = $directory->read()) { |
|
540 | 540 | if ($entry != "." && $entry != "..") { |
541 | 541 | if (is_dir($path."/".$entry)) { |
542 | 542 | $this->deleteThumbnailFile($path."/".$entry); |
543 | 543 | } else { |
544 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
544 | + if (!preg_match('/^thumbnail_([^\.]*)\.jpg$/i', $entry)) continue; |
|
545 | 545 | FileHandler::removeFile($path.'/'.$entry); |
546 | 546 | } |
547 | 547 | } |
@@ -566,13 +566,13 @@ discard block |
||
566 | 566 | $eid = Context::get('eid'); |
567 | 567 | $obj = new stdClass(); |
568 | 568 | |
569 | - if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
569 | + if (!$module_srl || !$name || !$eid) return new BaseObject(-1, 'msg_invalid_request'); |
|
570 | 570 | // set the max value if idx is not specified |
571 | - if(!$var_idx) |
|
571 | + if (!$var_idx) |
|
572 | 572 | { |
573 | 573 | $obj->module_srl = $module_srl; |
574 | 574 | $output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj); |
575 | - $var_idx = $output->data->var_idx+1; |
|
575 | + $var_idx = $output->data->var_idx + 1; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | // Check if the module name already exists |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $obj->var_idx = $var_idx; |
581 | 581 | $obj->eid = $eid; |
582 | 582 | $output = executeQuery('document.isExistsExtraKey', $obj); |
583 | - if(!$output->toBool() || $output->data->count) |
|
583 | + if (!$output->toBool() || $output->data->count) |
|
584 | 584 | { |
585 | 585 | return new BaseObject(-1, 'msg_extra_name_exists'); |
586 | 586 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | // insert or update |
589 | 589 | $oDocumentController = getController('document'); |
590 | 590 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
591 | - if(!$output->toBool()) return $output; |
|
591 | + if (!$output->toBool()) return $output; |
|
592 | 592 | |
593 | 593 | $this->setMessage('success_registed'); |
594 | 594 | |
@@ -604,11 +604,11 @@ discard block |
||
604 | 604 | { |
605 | 605 | $module_srl = Context::get('module_srl'); |
606 | 606 | $var_idx = Context::get('var_idx'); |
607 | - if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
607 | + if (!$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request'); |
|
608 | 608 | |
609 | 609 | $oDocumentController = getController('document'); |
610 | 610 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
611 | - if(!$output->toBool()) return $output; |
|
611 | + if (!$output->toBool()) return $output; |
|
612 | 612 | |
613 | 613 | $this->setMessage('success_deleted'); |
614 | 614 | } |
@@ -623,19 +623,19 @@ discard block |
||
623 | 623 | $module_srl = Context::get('module_srl'); |
624 | 624 | $var_idx = Context::get('var_idx'); |
625 | 625 | |
626 | - if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
626 | + if (!$type || !$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request'); |
|
627 | 627 | |
628 | 628 | $oModuleModel = getModel('module'); |
629 | 629 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
630 | - if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
630 | + if (!$module_info->module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
631 | 631 | |
632 | 632 | $oDocumentModel = getModel('document'); |
633 | 633 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
634 | - if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request'); |
|
634 | + if (!$extra_keys[$var_idx]) return new BaseObject(-1, 'msg_invalid_request'); |
|
635 | 635 | |
636 | - if($type == 'up') $new_idx = $var_idx-1; |
|
637 | - else $new_idx = $var_idx+1; |
|
638 | - if($new_idx<1) return new BaseObject(-1,'msg_invalid_request'); |
|
636 | + if ($type == 'up') $new_idx = $var_idx - 1; |
|
637 | + else $new_idx = $var_idx + 1; |
|
638 | + if ($new_idx < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
639 | 639 | |
640 | 640 | $args = new stdClass(); |
641 | 641 | $args->module_srl = $module_srl; |
@@ -646,16 +646,16 @@ discard block |
||
646 | 646 | unset($args); |
647 | 647 | |
648 | 648 | // update immediately if there is no idx to change |
649 | - if(!$extra_keys[$new_idx]) |
|
649 | + if (!$extra_keys[$new_idx]) |
|
650 | 650 | { |
651 | 651 | $args = new stdClass(); |
652 | 652 | $args->module_srl = $module_srl; |
653 | 653 | $args->var_idx = $var_idx; |
654 | 654 | $args->new_idx = $new_idx; |
655 | 655 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
656 | - if(!$output->toBool()) return $output; |
|
656 | + if (!$output->toBool()) return $output; |
|
657 | 657 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
658 | - if(!$output->toBool()) return $output; |
|
658 | + if (!$output->toBool()) return $output; |
|
659 | 659 | // replace if exists |
660 | 660 | } |
661 | 661 | else |
@@ -665,27 +665,27 @@ discard block |
||
665 | 665 | $args->var_idx = $new_idx; |
666 | 666 | $args->new_idx = -10000; |
667 | 667 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
668 | - if(!$output->toBool()) return $output; |
|
668 | + if (!$output->toBool()) return $output; |
|
669 | 669 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
670 | - if(!$output->toBool()) return $output; |
|
670 | + if (!$output->toBool()) return $output; |
|
671 | 671 | |
672 | 672 | $args->var_idx = $var_idx; |
673 | 673 | $args->new_idx = $new_idx; |
674 | 674 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
675 | - if(!$output->toBool()) return $output; |
|
675 | + if (!$output->toBool()) return $output; |
|
676 | 676 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
677 | - if(!$output->toBool()) return $output; |
|
677 | + if (!$output->toBool()) return $output; |
|
678 | 678 | |
679 | 679 | $args->var_idx = -10000; |
680 | 680 | $args->new_idx = $var_idx; |
681 | 681 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
682 | - if(!$output->toBool()) return $output; |
|
682 | + if (!$output->toBool()) return $output; |
|
683 | 683 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
684 | - if(!$output->toBool()) return $output; |
|
684 | + if (!$output->toBool()) return $output; |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
688 | - if($oCacheHandler->isSupport()) |
|
688 | + if ($oCacheHandler->isSupport()) |
|
689 | 689 | { |
690 | 690 | $object_key = 'module_document_extra_keys:'.$module_srl; |
691 | 691 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -699,9 +699,9 @@ discard block |
||
699 | 699 | */ |
700 | 700 | function procDocumentAdminInsertAlias() |
701 | 701 | { |
702 | - $args = Context::gets('module_srl','document_srl', 'alias_title'); |
|
702 | + $args = Context::gets('module_srl', 'document_srl', 'alias_title'); |
|
703 | 703 | $alias_srl = Context::get('alias_srl'); |
704 | - if(!$alias_srl) |
|
704 | + if (!$alias_srl) |
|
705 | 705 | { |
706 | 706 | $args->alias_srl = getNextSequence(); |
707 | 707 | $query = "document.insertAlias"; |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | $oDocumentModel = getModel('document'); |
745 | 745 | $oDocumentController = getController('document'); |
746 | 746 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
747 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
747 | + if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
748 | 748 | |
749 | 749 | $oModuleModel = getModel('module'); |
750 | 750 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -756,31 +756,31 @@ discard block |
||
756 | 756 | $oDocumentController->moveDocumentToTrash($args); |
757 | 757 | |
758 | 758 | $returnUrl = Context::get('success_return_url'); |
759 | - if(!$returnUrl) |
|
759 | + if (!$returnUrl) |
|
760 | 760 | { |
761 | 761 | $arrUrl = parse_url(Context::get('cur_url')); |
762 | 762 | $query = ""; |
763 | 763 | |
764 | - if($arrUrl['query']) |
|
764 | + if ($arrUrl['query']) |
|
765 | 765 | { |
766 | 766 | parse_str($arrUrl['query'], $arrQuery); |
767 | 767 | |
768 | 768 | // set query |
769 | - if(isset($arrQuery['document_srl'])) |
|
769 | + if (isset($arrQuery['document_srl'])) |
|
770 | 770 | unset($arrQuery['document_srl']); |
771 | 771 | |
772 | 772 | $searchArgs = new stdClass; |
773 | - foreach($arrQuery as $key=>$val) |
|
773 | + foreach ($arrQuery as $key=>$val) |
|
774 | 774 | { |
775 | 775 | $searchArgs->{$key} = $val; |
776 | 776 | } |
777 | 777 | |
778 | - if(!isset($searchArgs->sort_index)) |
|
778 | + if (!isset($searchArgs->sort_index)) |
|
779 | 779 | $searchArgs->sort_index = $module_info->order_target; |
780 | 780 | |
781 | - foreach($module_info as $key=>$val) |
|
781 | + foreach ($module_info as $key=>$val) |
|
782 | 782 | { |
783 | - if(!isset($searchArgs->{$key})) |
|
783 | + if (!isset($searchArgs->{$key})) |
|
784 | 784 | $searchArgs->{$key} = $val; |
785 | 785 | } |
786 | 786 | |
@@ -788,20 +788,20 @@ discard block |
||
788 | 788 | $output = $oDocumentModel->getDocumentList($searchArgs, $module_info->except_notice, TRUE, array('document_srl')); |
789 | 789 | |
790 | 790 | $cur_page = 1; |
791 | - if(isset($arrQuery['page'])) { |
|
792 | - $cur_page = (int)$arrQuery['page']; |
|
791 | + if (isset($arrQuery['page'])) { |
|
792 | + $cur_page = (int) $arrQuery['page']; |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | |
796 | - if($cur_page>1 && count($output->data) == 0) |
|
796 | + if ($cur_page > 1 && count($output->data) == 0) |
|
797 | 797 | $arrQuery['page'] = $cur_page - 1; |
798 | 798 | |
799 | 799 | $query = "?"; |
800 | - foreach($arrQuery as $key=>$val) |
|
800 | + foreach ($arrQuery as $key=>$val) |
|
801 | 801 | $query .= sprintf("%s=%s&", $key, $val); |
802 | 802 | $query = substr($query, 0, -1); |
803 | 803 | } |
804 | - $returnUrl = $arrUrl['path'] . $query; |
|
804 | + $returnUrl = $arrUrl['path'].$query; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | $this->add('redirect_url', $returnUrl); |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | */ |
879 | 879 | function restoreTrash($originObject) |
880 | 880 | { |
881 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
881 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
882 | 882 | |
883 | 883 | $oDocumentController = getController('document'); |
884 | 884 | $oDocumentModel = getModel('document'); |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | |
889 | 889 | //DB restore |
890 | 890 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
891 | - if(!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
891 | + if (!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
892 | 892 | |
893 | 893 | //FILE restore |
894 | 894 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
895 | 895 | // If the post was not temorarily saved, set the attachment's status to be valid |
896 | - if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
896 | + if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
897 | 897 | { |
898 | 898 | $args = new stdClass(); |
899 | 899 | $args->upload_target_srl = $oDocument->document_srl; |
@@ -902,10 +902,10 @@ discard block |
||
902 | 902 | } |
903 | 903 | |
904 | 904 | // call a trigger (after) |
905 | - if($output->toBool()) |
|
905 | + if ($output->toBool()) |
|
906 | 906 | { |
907 | 907 | $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject); |
908 | - if(!$trigger_output->toBool()) |
|
908 | + if (!$trigger_output->toBool()) |
|
909 | 909 | { |
910 | 910 | $oDB->rollback(); |
911 | 911 | return $trigger_output; |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | function emptyTrash($originObject) |
927 | 927 | { |
928 | 928 | $originObject = unserialize($originObject); |
929 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
929 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
930 | 930 | |
931 | 931 | $oDocument = new documentItem(); |
932 | 932 | $oDocument->setAttribute($originObject); |
@@ -27,16 +27,22 @@ discard block |
||
27 | 27 | { |
28 | 28 | // error appears if no doc is selected |
29 | 29 | $cart = Context::get('cart'); |
30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
30 | + if(!$cart) { |
|
31 | + return $this->stop('msg_cart_is_null'); |
|
32 | + } |
|
31 | 33 | $document_srl_list= explode('|@|', $cart); |
32 | 34 | $document_count = count($document_srl_list); |
33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
35 | + if(!$document_count) { |
|
36 | + return $this->stop('msg_cart_is_null'); |
|
37 | + } |
|
34 | 38 | // Delete a doc |
35 | 39 | $oDocumentController = getController('document'); |
36 | 40 | for($i=0;$i<$document_count;$i++) |
37 | 41 | { |
38 | 42 | $document_srl = trim($document_srl_list[$i]); |
39 | - if(!$document_srl) continue; |
|
43 | + if(!$document_srl) { |
|
44 | + continue; |
|
45 | + } |
|
40 | 46 | |
41 | 47 | $oDocumentController->deleteDocument($document_srl, true); |
42 | 48 | } |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | */ |
54 | 60 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
55 | 61 | { |
56 | - if(!count($document_srl_list)) return; |
|
62 | + if(!count($document_srl_list)) { |
|
63 | + return; |
|
64 | + } |
|
57 | 65 | |
58 | 66 | $oDocumentModel = getModel('document'); |
59 | 67 | $oDocumentController = getController('document'); |
@@ -79,7 +87,9 @@ discard block |
||
79 | 87 | { |
80 | 88 | $document_srl = $document_srl_list[$i]; |
81 | 89 | $oDocument = $oDocumentModel->getDocument($document_srl); |
82 | - if(!$oDocument->isExists()) continue; |
|
90 | + if(!$oDocument->isExists()) { |
|
91 | + continue; |
|
92 | + } |
|
83 | 93 | |
84 | 94 | $triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl'); |
85 | 95 | |
@@ -117,8 +127,7 @@ discard block |
||
117 | 127 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
118 | 128 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
119 | 129 | // For binary files |
120 | - } |
|
121 | - else |
|
130 | + } else |
|
122 | 131 | { |
123 | 132 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
124 | 133 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -155,8 +164,12 @@ discard block |
||
155 | 164 | // Set 0 if a new category doesn't exist after catergory change |
156 | 165 | if($source_category_srl != $category_srl) |
157 | 166 | { |
158 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
159 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
167 | + if($source_category_srl) { |
|
168 | + $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
169 | + } |
|
170 | + if($category_srl) { |
|
171 | + $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
172 | + } |
|
160 | 173 | } |
161 | 174 | } |
162 | 175 | |
@@ -227,7 +240,9 @@ discard block |
||
227 | 240 | */ |
228 | 241 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
229 | 242 | { |
230 | - if(count($document_srl_list) < 1) return; |
|
243 | + if(count($document_srl_list) < 1) { |
|
244 | + return; |
|
245 | + } |
|
231 | 246 | |
232 | 247 | $oDocumentModel = getModel('document'); |
233 | 248 | $oDocumentController = getController('document'); |
@@ -268,7 +283,9 @@ discard block |
||
268 | 283 | { |
269 | 284 | $document_srl = $document_srl_list[$i]; |
270 | 285 | $oDocument = $oDocumentModel->getDocument($document_srl); |
271 | - if(!$oDocument->isExists()) continue; |
|
286 | + if(!$oDocument->isExists()) { |
|
287 | + continue; |
|
288 | + } |
|
272 | 289 | |
273 | 290 | $obj = $oDocument->getObjectVars(); |
274 | 291 | |
@@ -279,7 +296,9 @@ discard block |
||
279 | 296 | { |
280 | 297 | foreach($extraVars as $extraItem) |
281 | 298 | { |
282 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
299 | + if($extraItem->var_idx >= 0) { |
|
300 | + $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
301 | + } |
|
283 | 302 | } |
284 | 303 | } |
285 | 304 | } |
@@ -308,8 +327,7 @@ discard block |
||
308 | 327 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
309 | 328 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
310 | 329 | // If binary file |
311 | - } |
|
312 | - else |
|
330 | + } else |
|
313 | 331 | { |
314 | 332 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
315 | 333 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -376,8 +394,7 @@ discard block |
||
376 | 394 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
377 | 395 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
378 | 396 | // If binary file |
379 | - } |
|
380 | - else |
|
397 | + } else |
|
381 | 398 | { |
382 | 399 | $comment_obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $comment_obj->content); |
383 | 400 | $comment_obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $comment_obj->content); |
@@ -389,10 +406,14 @@ discard block |
||
389 | 406 | $comment_obj->document_srl = $obj->document_srl; |
390 | 407 | $comment_obj->comment_srl = $comment_srl; |
391 | 408 | |
392 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
409 | + if($comment_obj->parent_srl) { |
|
410 | + $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
411 | + } |
|
393 | 412 | |
394 | 413 | $output = $oCommentController->insertComment($comment_obj, true); |
395 | - if($output->toBool()) $success_count ++; |
|
414 | + if($output->toBool()) { |
|
415 | + $success_count ++; |
|
416 | + } |
|
396 | 417 | } |
397 | 418 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
398 | 419 | } |
@@ -412,7 +433,9 @@ discard block |
||
412 | 433 | $trackback_obj->module_srl = $obj->module_srl; |
413 | 434 | $trackback_obj->document_srl = $obj->document_srl; |
414 | 435 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
415 | - if($output->toBool()) $success_count++; |
|
436 | + if($output->toBool()) { |
|
437 | + $success_count++; |
|
438 | + } |
|
416 | 439 | } |
417 | 440 | // Update the number of trackbacks |
418 | 441 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -510,7 +533,9 @@ discard block |
||
510 | 533 | { |
511 | 534 | $args->document_srl = $document_srl; |
512 | 535 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
513 | - if(!$output->toBool()) return $output; |
|
536 | + if(!$output->toBool()) { |
|
537 | + return $output; |
|
538 | + } |
|
514 | 539 | } |
515 | 540 | } |
516 | 541 | |
@@ -541,7 +566,9 @@ discard block |
||
541 | 566 | if (is_dir($path."/".$entry)) { |
542 | 567 | $this->deleteThumbnailFile($path."/".$entry); |
543 | 568 | } else { |
544 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
569 | + if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) { |
|
570 | + continue; |
|
571 | + } |
|
545 | 572 | FileHandler::removeFile($path.'/'.$entry); |
546 | 573 | } |
547 | 574 | } |
@@ -566,7 +593,9 @@ discard block |
||
566 | 593 | $eid = Context::get('eid'); |
567 | 594 | $obj = new stdClass(); |
568 | 595 | |
569 | - if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
596 | + if(!$module_srl || !$name || !$eid) { |
|
597 | + return new BaseObject(-1,'msg_invalid_request'); |
|
598 | + } |
|
570 | 599 | // set the max value if idx is not specified |
571 | 600 | if(!$var_idx) |
572 | 601 | { |
@@ -588,7 +617,9 @@ discard block |
||
588 | 617 | // insert or update |
589 | 618 | $oDocumentController = getController('document'); |
590 | 619 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
591 | - if(!$output->toBool()) return $output; |
|
620 | + if(!$output->toBool()) { |
|
621 | + return $output; |
|
622 | + } |
|
592 | 623 | |
593 | 624 | $this->setMessage('success_registed'); |
594 | 625 | |
@@ -604,11 +635,15 @@ discard block |
||
604 | 635 | { |
605 | 636 | $module_srl = Context::get('module_srl'); |
606 | 637 | $var_idx = Context::get('var_idx'); |
607 | - if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
638 | + if(!$module_srl || !$var_idx) { |
|
639 | + return new BaseObject(-1,'msg_invalid_request'); |
|
640 | + } |
|
608 | 641 | |
609 | 642 | $oDocumentController = getController('document'); |
610 | 643 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
611 | - if(!$output->toBool()) return $output; |
|
644 | + if(!$output->toBool()) { |
|
645 | + return $output; |
|
646 | + } |
|
612 | 647 | |
613 | 648 | $this->setMessage('success_deleted'); |
614 | 649 | } |
@@ -623,26 +658,41 @@ discard block |
||
623 | 658 | $module_srl = Context::get('module_srl'); |
624 | 659 | $var_idx = Context::get('var_idx'); |
625 | 660 | |
626 | - if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
661 | + if(!$type || !$module_srl || !$var_idx) { |
|
662 | + return new BaseObject(-1,'msg_invalid_request'); |
|
663 | + } |
|
627 | 664 | |
628 | 665 | $oModuleModel = getModel('module'); |
629 | 666 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
630 | - if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
667 | + if(!$module_info->module_srl) { |
|
668 | + return new BaseObject(-1,'msg_invalid_request'); |
|
669 | + } |
|
631 | 670 | |
632 | 671 | $oDocumentModel = getModel('document'); |
633 | 672 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
634 | - if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request'); |
|
673 | + if(!$extra_keys[$var_idx]) { |
|
674 | + return new BaseObject(-1,'msg_invalid_request'); |
|
675 | + } |
|
635 | 676 | |
636 | - if($type == 'up') $new_idx = $var_idx-1; |
|
637 | - else $new_idx = $var_idx+1; |
|
638 | - if($new_idx<1) return new BaseObject(-1,'msg_invalid_request'); |
|
677 | + if($type == 'up') { |
|
678 | + $new_idx = $var_idx-1; |
|
679 | + } else { |
|
680 | + $new_idx = $var_idx+1; |
|
681 | + } |
|
682 | + if($new_idx<1) { |
|
683 | + return new BaseObject(-1,'msg_invalid_request'); |
|
684 | + } |
|
639 | 685 | |
640 | 686 | $args = new stdClass(); |
641 | 687 | $args->module_srl = $module_srl; |
642 | 688 | $args->var_idx = $new_idx; |
643 | 689 | $output = executeQuery('document.getDocumentExtraKeys', $args); |
644 | - if (!$output->toBool()) return $output; |
|
645 | - if (!$output->data) return new BaseObject(-1, 'msg_invalid_request'); |
|
690 | + if (!$output->toBool()) { |
|
691 | + return $output; |
|
692 | + } |
|
693 | + if (!$output->data) { |
|
694 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
695 | + } |
|
646 | 696 | unset($args); |
647 | 697 | |
648 | 698 | // update immediately if there is no idx to change |
@@ -653,35 +703,50 @@ discard block |
||
653 | 703 | $args->var_idx = $var_idx; |
654 | 704 | $args->new_idx = $new_idx; |
655 | 705 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
656 | - if(!$output->toBool()) return $output; |
|
706 | + if(!$output->toBool()) { |
|
707 | + return $output; |
|
708 | + } |
|
657 | 709 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
658 | - if(!$output->toBool()) return $output; |
|
710 | + if(!$output->toBool()) { |
|
711 | + return $output; |
|
712 | + } |
|
659 | 713 | // replace if exists |
660 | - } |
|
661 | - else |
|
714 | + } else |
|
662 | 715 | { |
663 | 716 | $args = new stdClass(); |
664 | 717 | $args->module_srl = $module_srl; |
665 | 718 | $args->var_idx = $new_idx; |
666 | 719 | $args->new_idx = -10000; |
667 | 720 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
668 | - if(!$output->toBool()) return $output; |
|
721 | + if(!$output->toBool()) { |
|
722 | + return $output; |
|
723 | + } |
|
669 | 724 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
670 | - if(!$output->toBool()) return $output; |
|
725 | + if(!$output->toBool()) { |
|
726 | + return $output; |
|
727 | + } |
|
671 | 728 | |
672 | 729 | $args->var_idx = $var_idx; |
673 | 730 | $args->new_idx = $new_idx; |
674 | 731 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
675 | - if(!$output->toBool()) return $output; |
|
732 | + if(!$output->toBool()) { |
|
733 | + return $output; |
|
734 | + } |
|
676 | 735 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
677 | - if(!$output->toBool()) return $output; |
|
736 | + if(!$output->toBool()) { |
|
737 | + return $output; |
|
738 | + } |
|
678 | 739 | |
679 | 740 | $args->var_idx = -10000; |
680 | 741 | $args->new_idx = $var_idx; |
681 | 742 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
682 | - if(!$output->toBool()) return $output; |
|
743 | + if(!$output->toBool()) { |
|
744 | + return $output; |
|
745 | + } |
|
683 | 746 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
684 | - if(!$output->toBool()) return $output; |
|
747 | + if(!$output->toBool()) { |
|
748 | + return $output; |
|
749 | + } |
|
685 | 750 | } |
686 | 751 | |
687 | 752 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
@@ -705,8 +770,7 @@ discard block |
||
705 | 770 | { |
706 | 771 | $args->alias_srl = getNextSequence(); |
707 | 772 | $query = "document.insertAlias"; |
708 | - } |
|
709 | - else |
|
773 | + } else |
|
710 | 774 | { |
711 | 775 | $args->alias_srl = $alias_srl; |
712 | 776 | $query = "document.updateAlias"; |
@@ -744,7 +808,9 @@ discard block |
||
744 | 808 | $oDocumentModel = getModel('document'); |
745 | 809 | $oDocumentController = getController('document'); |
746 | 810 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
747 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
811 | + if(!$oDocument->isGranted()) { |
|
812 | + return $this->stop('msg_not_permitted'); |
|
813 | + } |
|
748 | 814 | |
749 | 815 | $oModuleModel = getModel('module'); |
750 | 816 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -766,8 +832,9 @@ discard block |
||
766 | 832 | parse_str($arrUrl['query'], $arrQuery); |
767 | 833 | |
768 | 834 | // set query |
769 | - if(isset($arrQuery['document_srl'])) |
|
770 | - unset($arrQuery['document_srl']); |
|
835 | + if(isset($arrQuery['document_srl'])) { |
|
836 | + unset($arrQuery['document_srl']); |
|
837 | + } |
|
771 | 838 | |
772 | 839 | $searchArgs = new stdClass; |
773 | 840 | foreach($arrQuery as $key=>$val) |
@@ -775,13 +842,15 @@ discard block |
||
775 | 842 | $searchArgs->{$key} = $val; |
776 | 843 | } |
777 | 844 | |
778 | - if(!isset($searchArgs->sort_index)) |
|
779 | - $searchArgs->sort_index = $module_info->order_target; |
|
845 | + if(!isset($searchArgs->sort_index)) { |
|
846 | + $searchArgs->sort_index = $module_info->order_target; |
|
847 | + } |
|
780 | 848 | |
781 | 849 | foreach($module_info as $key=>$val) |
782 | 850 | { |
783 | - if(!isset($searchArgs->{$key})) |
|
784 | - $searchArgs->{$key} = $val; |
|
851 | + if(!isset($searchArgs->{$key})) { |
|
852 | + $searchArgs->{$key} = $val; |
|
853 | + } |
|
785 | 854 | } |
786 | 855 | |
787 | 856 | $oDocumentModel = getModel('document'); |
@@ -793,12 +862,14 @@ discard block |
||
793 | 862 | } |
794 | 863 | |
795 | 864 | |
796 | - if($cur_page>1 && count($output->data) == 0) |
|
797 | - $arrQuery['page'] = $cur_page - 1; |
|
865 | + if($cur_page>1 && count($output->data) == 0) { |
|
866 | + $arrQuery['page'] = $cur_page - 1; |
|
867 | + } |
|
798 | 868 | |
799 | 869 | $query = "?"; |
800 | - foreach($arrQuery as $key=>$val) |
|
801 | - $query .= sprintf("%s=%s&", $key, $val); |
|
870 | + foreach($arrQuery as $key=>$val) { |
|
871 | + $query .= sprintf("%s=%s&", $key, $val); |
|
872 | + } |
|
802 | 873 | $query = substr($query, 0, -1); |
803 | 874 | } |
804 | 875 | $returnUrl = $arrUrl['path'] . $query; |
@@ -878,7 +949,9 @@ discard block |
||
878 | 949 | */ |
879 | 950 | function restoreTrash($originObject) |
880 | 951 | { |
881 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
952 | + if(is_array($originObject)) { |
|
953 | + $originObject = (object)$originObject; |
|
954 | + } |
|
882 | 955 | |
883 | 956 | $oDocumentController = getController('document'); |
884 | 957 | $oDocumentModel = getModel('document'); |
@@ -888,7 +961,9 @@ discard block |
||
888 | 961 | |
889 | 962 | //DB restore |
890 | 963 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
891 | - if(!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
964 | + if(!$output->toBool()) { |
|
965 | + return new BaseObject(-1, $output->getMessage()); |
|
966 | + } |
|
892 | 967 | |
893 | 968 | //FILE restore |
894 | 969 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
@@ -926,7 +1001,9 @@ discard block |
||
926 | 1001 | function emptyTrash($originObject) |
927 | 1002 | { |
928 | 1003 | $originObject = unserialize($originObject); |
929 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
1004 | + if(is_array($originObject)) { |
|
1005 | + $originObject = (object) $originObject; |
|
1006 | + } |
|
930 | 1007 | |
931 | 1008 | $oDocument = new documentItem(); |
932 | 1009 | $oDocument->setAttribute($originObject); |