@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // set the template path |
20 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
20 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // set today's if no date is given |
31 | 31 | $selected_date = Context::get('selected_date'); |
32 | 32 | |
33 | - if(!$selected_date) |
|
33 | + if (!$selected_date) |
|
34 | 34 | { |
35 | 35 | $selected_date = date("Ymd"); |
36 | 36 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // get data by time, day, month, and year |
51 | 51 | $type = Context::get('type'); |
52 | 52 | |
53 | - if(!$type) |
|
53 | + if (!$type) |
|
54 | 54 | { |
55 | 55 | $type = 'day'; |
56 | 56 | Context::set('type', $type); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // get a list by using comment->getCommentList. |
53 | 53 | $oCommentModel = getModel('comment'); |
54 | 54 | $secretNameList = $oCommentModel->getSecretNameList(); |
55 | - $columnList = array('comment_srl', 'document_srl','module_srl','is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count'); |
|
55 | + $columnList = array('comment_srl', 'document_srl', 'module_srl', 'is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count'); |
|
56 | 56 | $output = $oCommentModel->getTotalCommentList($args, $columnList); |
57 | 57 | |
58 | 58 | // $modules = $oCommentModel->getDistinctModules(); |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | $oModuleModel = getModel('module'); |
71 | 71 | $module_list = array(); |
72 | 72 | $mod_srls = array(); |
73 | - foreach($output->data as $val) |
|
73 | + foreach ($output->data as $val) |
|
74 | 74 | { |
75 | 75 | $mod_srls[] = $val->module_srl; |
76 | 76 | } |
77 | 77 | $mod_srls = array_unique($mod_srls); |
78 | 78 | // Module List |
79 | 79 | $mod_srls_count = count($mod_srls); |
80 | - if($mod_srls_count) |
|
80 | + if ($mod_srls_count) |
|
81 | 81 | { |
82 | 82 | $columnList = array('module_srl', 'mid', 'browser_title'); |
83 | 83 | $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList); |
84 | - if($module_output && is_array($module_output)) |
|
84 | + if ($module_output && is_array($module_output)) |
|
85 | 85 | { |
86 | - foreach($module_output as $module) |
|
86 | + foreach ($module_output as $module) |
|
87 | 87 | { |
88 | 88 | $module_list[$module->module_srl] = $module; |
89 | 89 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | Context::set('module_list', $module_list); |
93 | 93 | |
94 | 94 | // set the template |
95 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
95 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
96 | 96 | $this->setTemplateFile('comment_list'); |
97 | 97 | } |
98 | 98 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $declared_output = executeQuery('comment.getDeclaredList', $args); |
115 | 115 | $oCommentModel = getModel('comment'); |
116 | 116 | |
117 | - if($declared_output->data && count($declared_output->data)) |
|
117 | + if ($declared_output->data && count($declared_output->data)) |
|
118 | 118 | { |
119 | 119 | $comment_list = array(); |
120 | 120 | |
121 | - foreach($declared_output->data as $key => $comment) |
|
121 | + foreach ($declared_output->data as $key => $comment) |
|
122 | 122 | { |
123 | 123 | $comment_list[$key] = new commentItem(); |
124 | 124 | $comment_list[$key]->setAttribute($comment); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | Context::set('page_navigation', $declared_output->page_navigation); |
137 | 137 | Context::set('secret_name_list', $secretNameList); |
138 | 138 | // set the template |
139 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
139 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
140 | 140 | $this->setTemplateFile('declared_list'); |
141 | 141 | } |
142 | 142 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | // Get configurations (using module model object) |
32 | 32 | $config = $oModuleModel->getModuleConfig('message'); |
33 | - Context::set('config',$config); |
|
33 | + Context::set('config', $config); |
|
34 | 34 | |
35 | 35 | // Set a template file |
36 | 36 | $this->setTemplatePath($this->module_path.'tpl'); |
@@ -4,7 +4,7 @@ |
||
4 | 4 | * This is a stub include that automatically configures the include path. |
5 | 5 | */ |
6 | 6 | |
7 | -set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); |
|
7 | +set_include_path(dirname(__FILE__).PATH_SEPARATOR.get_include_path()); |
|
8 | 8 | require_once 'HTMLPurifier/Bootstrap.php'; |
9 | 9 | require_once 'HTMLPurifier.autoload.php'; |
10 | 10 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -require_once(_XE_PATH_ . 'modules/comment/comment.item.php'); |
|
4 | +require_once(_XE_PATH_.'modules/comment/comment.item.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * comment |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // 2008. 02. 22 add comment setting when a new module added |
37 | 37 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); |
38 | 38 | |
39 | - if(!is_dir('./files/cache/tmp')) |
|
39 | + if (!is_dir('./files/cache/tmp')) |
|
40 | 40 | { |
41 | 41 | FileHandler::makeDir('./files/cache/tmp'); |
42 | 42 | } |
@@ -53,55 +53,55 @@ discard block |
||
53 | 53 | $oDB = DB::getInstance(); |
54 | 54 | $oModuleModel = getModel('module'); |
55 | 55 | // 2007. 10. 17 add a trigger to delete comments together with posting deleted |
56 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
56 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
57 | 57 | { |
58 | 58 | return TRUE; |
59 | 59 | } |
60 | 60 | // 2007. 10. 17 add a trigger to delete all of comments together with module deleted |
61 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
61 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
62 | 62 | { |
63 | 63 | return TRUE; |
64 | 64 | } |
65 | 65 | // 2007. 10. 23 add a column for recommendation votes or notification of the comments |
66 | - if(!$oDB->isColumnExists("comments", "voted_count")) |
|
66 | + if (!$oDB->isColumnExists("comments", "voted_count")) |
|
67 | 67 | { |
68 | 68 | return TRUE; |
69 | 69 | } |
70 | - if(!$oDB->isColumnExists("comments", "notify_message")) |
|
70 | + if (!$oDB->isColumnExists("comments", "notify_message")) |
|
71 | 71 | { |
72 | 72 | return TRUE; |
73 | 73 | } |
74 | 74 | // 2008. 02. 22 add comment setting when a new module added |
75 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
75 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
76 | 76 | { |
77 | 77 | return TRUE; |
78 | 78 | } |
79 | 79 | // 2008. 05. 14 add a column for blamed count |
80 | - if(!$oDB->isColumnExists("comments", "blamed_count")) |
|
80 | + if (!$oDB->isColumnExists("comments", "blamed_count")) |
|
81 | 81 | { |
82 | 82 | return TRUE; |
83 | 83 | } |
84 | - if(!$oDB->isColumnExists("comment_voted_log", "point")) |
|
84 | + if (!$oDB->isColumnExists("comment_voted_log", "point")) |
|
85 | 85 | { |
86 | 86 | return TRUE; |
87 | 87 | } |
88 | 88 | |
89 | - if(!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
89 | + if (!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
90 | 90 | { |
91 | 91 | return TRUE; |
92 | 92 | } |
93 | 93 | //2012. 02. 24 add comment published status column and index |
94 | - if(!$oDB->isColumnExists("comments", "status")) |
|
94 | + if (!$oDB->isColumnExists("comments", "status")) |
|
95 | 95 | { |
96 | 96 | return TRUE; |
97 | 97 | } |
98 | - if(!$oDB->isIndexExists("comments", "idx_status")) |
|
98 | + if (!$oDB->isIndexExists("comments", "idx_status")) |
|
99 | 99 | { |
100 | 100 | return TRUE; |
101 | 101 | } |
102 | 102 | |
103 | 103 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
104 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
104 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
105 | 105 | { |
106 | 106 | return TRUE; |
107 | 107 | } |
@@ -119,43 +119,43 @@ discard block |
||
119 | 119 | $oModuleModel = getModel('module'); |
120 | 120 | $oModuleController = getController('module'); |
121 | 121 | // 2007. 10. 17 add a trigger to delete comments together with posting deleted |
122 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
122 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
123 | 123 | { |
124 | 124 | $oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'); |
125 | 125 | } |
126 | 126 | // 2007. 10. 17 add a trigger to delete all of comments together with module deleted |
127 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
127 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
128 | 128 | { |
129 | 129 | $oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'); |
130 | 130 | } |
131 | 131 | // 2007. 10. 23 add a column for recommendation votes or notification of the comments |
132 | - if(!$oDB->isColumnExists("comments", "voted_count")) |
|
132 | + if (!$oDB->isColumnExists("comments", "voted_count")) |
|
133 | 133 | { |
134 | 134 | $oDB->addColumn("comments", "voted_count", "number", "11"); |
135 | 135 | $oDB->addIndex("comments", "idx_voted_count", array("voted_count")); |
136 | 136 | } |
137 | 137 | |
138 | - if(!$oDB->isColumnExists("comments", "notify_message")) |
|
138 | + if (!$oDB->isColumnExists("comments", "notify_message")) |
|
139 | 139 | { |
140 | 140 | $oDB->addColumn("comments", "notify_message", "char", "1"); |
141 | 141 | } |
142 | 142 | // 2008. 02. 22 add comment setting when a new module added |
143 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
143 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
144 | 144 | { |
145 | 145 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); |
146 | 146 | } |
147 | 147 | // 2008. 05. 14 add a column for blamed count |
148 | - if(!$oDB->isColumnExists("comments", "blamed_count")) |
|
148 | + if (!$oDB->isColumnExists("comments", "blamed_count")) |
|
149 | 149 | { |
150 | 150 | $oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, TRUE); |
151 | 151 | $oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count')); |
152 | 152 | } |
153 | - if(!$oDB->isColumnExists("comment_voted_log", "point")) |
|
153 | + if (!$oDB->isColumnExists("comment_voted_log", "point")) |
|
154 | 154 | { |
155 | 155 | $oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, TRUE); |
156 | 156 | } |
157 | 157 | |
158 | - if(!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
158 | + if (!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
159 | 159 | { |
160 | 160 | $oDB->addIndex( |
161 | 161 | "comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | //2012. 02. 24 add comment published status column and index |
166 | - if(!$oDB->isColumnExists("comments", "status")) |
|
166 | + if (!$oDB->isColumnExists("comments", "status")) |
|
167 | 167 | { |
168 | 168 | $oDB->addColumn("comments", "status", "number", 1, 1, TRUE); |
169 | 169 | } |
170 | - if(!$oDB->isIndexExists("comments", "idx_status")) |
|
170 | + if (!$oDB->isIndexExists("comments", "idx_status")) |
|
171 | 171 | { |
172 | 172 | $oDB->addIndex( |
173 | 173 | "comments", "idx_status", array("status", "comment_srl", "module_srl", "document_srl"), TRUE |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
178 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
178 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
179 | 179 | { |
180 | 180 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'); |
181 | 181 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | function recompileCache() |
191 | 191 | { |
192 | - if(!is_dir('./files/cache/tmp')) |
|
192 | + if (!is_dir('./files/cache/tmp')) |
|
193 | 193 | { |
194 | 194 | FileHandler::makeDir('./files/cache/tmp'); |
195 | 195 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function _loadFromDB() |
51 | 51 | { |
52 | - if(!$this->comment_srl) |
|
52 | + if (!$this->comment_srl) |
|
53 | 53 | { |
54 | 54 | return; |
55 | 55 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function setAttribute($attribute) |
69 | 69 | { |
70 | - if(!$attribute->comment_srl) |
|
70 | + if (!$attribute->comment_srl) |
|
71 | 71 | { |
72 | 72 | $this->comment_srl = NULL; |
73 | 73 | return; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $this->adds($attribute); |
78 | 78 | |
79 | 79 | // define vars on the object for backward compatibility of skins |
80 | - if(count($attribute)) |
|
80 | + if (count($attribute)) |
|
81 | 81 | { |
82 | - foreach($attribute as $key => $val) |
|
82 | + foreach ($attribute as $key => $val) |
|
83 | 83 | { |
84 | 84 | $this->{$key} = $val; |
85 | 85 | } |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | |
94 | 94 | function isGranted() |
95 | 95 | { |
96 | - if($_SESSION['own_comment'][$this->comment_srl]) |
|
96 | + if ($_SESSION['own_comment'][$this->comment_srl]) |
|
97 | 97 | { |
98 | 98 | return TRUE; |
99 | 99 | } |
100 | 100 | |
101 | - if(!Context::get('is_logged')) |
|
101 | + if (!Context::get('is_logged')) |
|
102 | 102 | { |
103 | 103 | return FALSE; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $logged_info = Context::get('logged_info'); |
107 | - if($logged_info->is_admin == 'Y') |
|
107 | + if ($logged_info->is_admin == 'Y') |
|
108 | 108 | { |
109 | 109 | return TRUE; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $grant = Context::get('grant'); |
113 | - if($grant->manager) |
|
113 | + if ($grant->manager) |
|
114 | 114 | { |
115 | 115 | return TRUE; |
116 | 116 | } |
117 | 117 | |
118 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
118 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
119 | 119 | { |
120 | 120 | return TRUE; |
121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | function isEditable() |
138 | 138 | { |
139 | - if($this->isGranted() || !$this->get('member_srl')) |
|
139 | + if ($this->isGranted() || !$this->get('member_srl')) |
|
140 | 140 | { |
141 | 141 | return TRUE; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | |
151 | 151 | function isAccessible() |
152 | 152 | { |
153 | - if($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
153 | + if ($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
154 | 154 | { |
155 | 155 | return TRUE; |
156 | 156 | } |
157 | 157 | |
158 | - if($this->isGranted() || !$this->isSecret()) |
|
158 | + if ($this->isGranted() || !$this->isSecret()) |
|
159 | 159 | { |
160 | 160 | $this->setAccessible(); |
161 | 161 | return TRUE; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $oDocumentModel = getModel('document'); |
165 | 165 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
166 | - if($oDocument->isGranted()) |
|
166 | + if ($oDocument->isGranted()) |
|
167 | 167 | { |
168 | 168 | $this->setAccessible(); |
169 | 169 | return TRUE; |
@@ -184,20 +184,20 @@ discard block |
||
184 | 184 | function notify($type, $content) |
185 | 185 | { |
186 | 186 | // return if not useNotify |
187 | - if(!$this->useNotify()) |
|
187 | + if (!$this->useNotify()) |
|
188 | 188 | { |
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // pass if the author is not logged-in user |
193 | - if(!$this->get('member_srl')) |
|
193 | + if (!$this->get('member_srl')) |
|
194 | 194 | { |
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // return if the currently logged-in user is an author of the comment. |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if($logged_info->member_srl == $this->get('member_srl')) |
|
200 | + if ($logged_info->member_srl == $this->get('member_srl')) |
|
201 | 201 | { |
202 | 202 | return; |
203 | 203 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
208 | 208 | |
209 | 209 | // Variables |
210 | - if($type) |
|
210 | + if ($type) |
|
211 | 211 | { |
212 | - $title = "[" . $type . "] "; |
|
212 | + $title = "[".$type."] "; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $title .= cut_str(strip_tags($content), 30, '...'); |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | |
225 | 225 | function getIpAddress() |
226 | 226 | { |
227 | - if($this->isGranted()) |
|
227 | + if ($this->isGranted()) |
|
228 | 228 | { |
229 | 229 | return $this->get('ipaddress'); |
230 | 230 | } |
231 | 231 | |
232 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
232 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | function isExistsHomepage() |
236 | 236 | { |
237 | - if(trim($this->get('homepage'))) |
|
237 | + if (trim($this->get('homepage'))) |
|
238 | 238 | { |
239 | 239 | return TRUE; |
240 | 240 | } |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | function getHomepageUrl() |
246 | 246 | { |
247 | 247 | $url = trim($this->get('homepage')); |
248 | - if(!$url) |
|
248 | + if (!$url) |
|
249 | 249 | { |
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | - if(strncasecmp('http://', $url, 7) !== 0) |
|
253 | + if (strncasecmp('http://', $url, 7) !== 0) |
|
254 | 254 | { |
255 | - $url = "http://" . $url; |
|
255 | + $url = "http://".$url; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function getContentText($strlen = 0) |
286 | 286 | { |
287 | - if($this->isSecret() && !$this->isAccessible()) |
|
287 | + if ($this->isSecret() && !$this->isAccessible()) |
|
288 | 288 | { |
289 | 289 | return Context::getLang('msg_is_secret'); |
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = $this->get('content'); |
293 | 293 | |
294 | - if($strlen) |
|
294 | + if ($strlen) |
|
295 | 295 | { |
296 | 296 | return cut_str(strip_tags($content), $strlen, '...'); |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE) |
307 | 307 | { |
308 | - if($this->isSecret() && !$this->isAccessible()) |
|
308 | + if ($this->isSecret() && !$this->isAccessible()) |
|
309 | 309 | { |
310 | 310 | return Context::getLang('msg_is_secret'); |
311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | stripEmbedTagForAdmin($content, $this->get('member_srl')); |
315 | 315 | |
316 | 316 | // when displaying the comment on the pop-up menu |
317 | - if($add_popup_menu && Context::get('is_logged')) |
|
317 | + if ($add_popup_menu && Context::get('is_logged')) |
|
318 | 318 | { |
319 | 319 | $content = sprintf( |
320 | 320 | '%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do') |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | // if additional information which can access contents is set |
325 | - if($add_content_info) |
|
325 | + if ($add_content_info) |
|
326 | 326 | { |
327 | 327 | $memberSrl = $this->get('member_srl'); |
328 | - if($memberSrl < 0) |
|
328 | + if ($memberSrl < 0) |
|
329 | 329 | { |
330 | 330 | $memberSrl = 0; |
331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | else |
338 | 338 | { |
339 | - if($add_xe_content_class) |
|
339 | + if ($add_xe_content_class) |
|
340 | 340 | { |
341 | 341 | $content = sprintf('<div class="xe_content">%s</div>', $content); |
342 | 342 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | function getRegdateGM() |
398 | 398 | { |
399 | - return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone']; |
|
399 | + return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone']; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | function getPermanentUrl() |
408 | 408 | { |
409 | - return getFullUrl('', 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl'); |
|
409 | + return getFullUrl('', 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl'); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | function getUpdateTime() |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | function hasUploadedFiles() |
429 | 429 | { |
430 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
430 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
431 | 431 | { |
432 | 432 | return FALSE; |
433 | 433 | } |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | |
437 | 437 | function getUploadedFiles() |
438 | 438 | { |
439 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
439 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
440 | 440 | { |
441 | 441 | return; |
442 | 442 | } |
443 | 443 | |
444 | - if(!$this->get('uploaded_count')) |
|
444 | + if (!$this->get('uploaded_count')) |
|
445 | 445 | { |
446 | 446 | return; |
447 | 447 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | function getEditor() |
459 | 459 | { |
460 | 460 | $module_srl = $this->get('module_srl'); |
461 | - if(!$module_srl) |
|
461 | + if (!$module_srl) |
|
462 | 462 | { |
463 | 463 | $module_srl = Context::get('module_srl'); |
464 | 464 | } |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | */ |
473 | 473 | function getProfileImage() |
474 | 474 | { |
475 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
475 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
476 | 476 | { |
477 | 477 | return; |
478 | 478 | } |
479 | 479 | $oMemberModel = getModel('member'); |
480 | 480 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
481 | - if(!$profile_info) |
|
481 | + if (!$profile_info) |
|
482 | 482 | { |
483 | 483 | return; |
484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | function getSignature() |
494 | 494 | { |
495 | 495 | // pass if the posting not exists. |
496 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
496 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
497 | 497 | { |
498 | 498 | return; |
499 | 499 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
504 | 504 | |
505 | 505 | // check if max height of the signiture is specified on the member module |
506 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
506 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
507 | 507 | { |
508 | 508 | $oModuleModel = getModel('module'); |
509 | 509 | $member_config = $oModuleModel->getModuleConfig('member'); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
514 | 514 | |
515 | - if($max_signature_height) |
|
515 | + if ($max_signature_height) |
|
516 | 516 | { |
517 | 517 | $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
518 | 518 | } |
@@ -522,12 +522,12 @@ discard block |
||
522 | 522 | |
523 | 523 | function thumbnailExists($width = 80, $height = 0, $type = '') |
524 | 524 | { |
525 | - if(!$this->comment_srl) |
|
525 | + if (!$this->comment_srl) |
|
526 | 526 | { |
527 | 527 | return FALSE; |
528 | 528 | } |
529 | 529 | |
530 | - if(!$this->getThumbnail($width, $height, $type)) |
|
530 | + if (!$this->getThumbnail($width, $height, $type)) |
|
531 | 531 | { |
532 | 532 | return FALSE; |
533 | 533 | } |
@@ -538,42 +538,42 @@ discard block |
||
538 | 538 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
539 | 539 | { |
540 | 540 | // return false if no doc exists |
541 | - if(!$this->comment_srl) |
|
541 | + if (!$this->comment_srl) |
|
542 | 542 | { |
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - if($this->isSecret() && !$this->isGranted()) |
|
546 | + if ($this->isSecret() && !$this->isGranted()) |
|
547 | 547 | { |
548 | 548 | return; |
549 | 549 | } |
550 | 550 | |
551 | 551 | // If signiture height setting is omitted, create a square |
552 | - if(!$height) |
|
552 | + if (!$height) |
|
553 | 553 | { |
554 | 554 | $height = $width; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $content = $this->get('content'); |
558 | - if(!$this->hasUploadedFiles()) |
|
558 | + if (!$this->hasUploadedFiles()) |
|
559 | 559 | { |
560 | - if(!$content) |
|
560 | + if (!$content) |
|
561 | 561 | { |
562 | 562 | $args = new stdClass(); |
563 | 563 | $args->comment_srl = $this->comment_srl; |
564 | 564 | $output = executeQuery('document.getComment', $args, array('content')); |
565 | - if($output->toBool() && $output->data) |
|
565 | + if ($output->toBool() && $output->data) |
|
566 | 566 | { |
567 | 567 | $content = $output->data->content; |
568 | 568 | $this->add('content', $content); |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
572 | + if (!preg_match("!<img!is", $content)) return; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | // get thumbail generation info on the doc module configuration. |
576 | - if(!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
576 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
577 | 577 | { |
578 | 578 | $thumbnail_type = 'crop'; |
579 | 579 | } |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | // Define thumbnail information |
582 | 582 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3)); |
583 | 583 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
584 | - $thumbnail_url = Context::getRequestUri() . $thumbnail_file; |
|
584 | + $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
|
585 | 585 | |
586 | 586 | // return false if a size of existing thumbnail file is 0. otherwise return the file path |
587 | - if(file_exists($thumbnail_file)) |
|
587 | + if (file_exists($thumbnail_file)) |
|
588 | 588 | { |
589 | - if(filesize($thumbnail_file) < 1) |
|
589 | + if (filesize($thumbnail_file) < 1) |
|
590 | 590 | { |
591 | 591 | return FALSE; |
592 | 592 | } |
@@ -601,33 +601,33 @@ discard block |
||
601 | 601 | $is_tmp_file = FALSE; |
602 | 602 | |
603 | 603 | // find an image file among attached files |
604 | - if($this->hasUploadedFiles()) |
|
604 | + if ($this->hasUploadedFiles()) |
|
605 | 605 | { |
606 | 606 | $file_list = $this->getUploadedFiles(); |
607 | 607 | |
608 | 608 | $first_image = null; |
609 | - foreach($file_list as $file) |
|
609 | + foreach ($file_list as $file) |
|
610 | 610 | { |
611 | - if($file->direct_download !== 'Y') continue; |
|
611 | + if ($file->direct_download !== 'Y') continue; |
|
612 | 612 | |
613 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
613 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
614 | 614 | { |
615 | 615 | $source_file = $file->uploaded_filename; |
616 | 616 | break; |
617 | 617 | } |
618 | 618 | |
619 | - if($first_image) continue; |
|
619 | + if ($first_image) continue; |
|
620 | 620 | |
621 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
621 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
622 | 622 | { |
623 | - if(file_exists($file->uploaded_filename)) |
|
623 | + if (file_exists($file->uploaded_filename)) |
|
624 | 624 | { |
625 | 625 | $first_image = $file->uploaded_filename; |
626 | 626 | } |
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | - if(!$source_file && $first_image) |
|
630 | + if (!$source_file && $first_image) |
|
631 | 631 | { |
632 | 632 | $source_file = $first_image; |
633 | 633 | } |
@@ -635,31 +635,31 @@ discard block |
||
635 | 635 | |
636 | 636 | // get an image file from the doc content if no file attached. |
637 | 637 | $is_tmp_file = false; |
638 | - if(!$source_file) |
|
638 | + if (!$source_file) |
|
639 | 639 | { |
640 | 640 | $random = new Password(); |
641 | 641 | |
642 | 642 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
643 | 643 | |
644 | - foreach($matches as $target_image) |
|
644 | + foreach ($matches as $target_image) |
|
645 | 645 | { |
646 | 646 | $target_src = trim($target_image[1]); |
647 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
647 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
648 | 648 | |
649 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
649 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
650 | 650 | { |
651 | 651 | $target_src = Context::getRequestUri().$target_src; |
652 | 652 | } |
653 | 653 | |
654 | 654 | $target_src = htmlspecialchars_decode($target_src); |
655 | 655 | |
656 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
656 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
657 | 657 | FileHandler::getRemoteFile($target_src, $tmp_file); |
658 | - if(!file_exists($tmp_file)) continue; |
|
658 | + if (!file_exists($tmp_file)) continue; |
|
659 | 659 | |
660 | 660 | $imageinfo = getimagesize($tmp_file); |
661 | 661 | list($_w, $_h) = $imageinfo; |
662 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
662 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
663 | 663 | FileHandler::removeFile($tmp_file); |
664 | 664 | continue; |
665 | 665 | } |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | |
673 | 673 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
674 | 674 | |
675 | - if($is_tmp_file) |
|
675 | + if ($is_tmp_file) |
|
676 | 676 | { |
677 | 677 | FileHandler::removeFile($source_file); |
678 | 678 | } |
679 | 679 | |
680 | 680 | // return the thumbnail path if successfully generated. |
681 | - if($output) |
|
681 | + if ($output) |
|
682 | 682 | { |
683 | 683 | return $thumbnail_url; |
684 | 684 | } |
@@ -333,8 +333,7 @@ discard block |
||
333 | 333 | '<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl |
334 | 334 | ); |
335 | 335 | // xe_content class name should be specified although content access is not necessary. |
336 | - } |
|
337 | - else |
|
336 | + } else |
|
338 | 337 | { |
339 | 338 | if($add_xe_content_class) |
340 | 339 | { |
@@ -569,7 +568,9 @@ discard block |
||
569 | 568 | } |
570 | 569 | } |
571 | 570 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
571 | + if(!preg_match("!<img!is", $content)) { |
|
572 | + return; |
|
573 | + } |
|
573 | 574 | } |
574 | 575 | |
575 | 576 | // get thumbail generation info on the doc module configuration. |
@@ -589,8 +590,7 @@ discard block |
||
589 | 590 | if(filesize($thumbnail_file) < 1) |
590 | 591 | { |
591 | 592 | return FALSE; |
592 | - } |
|
593 | - else |
|
593 | + } else |
|
594 | 594 | { |
595 | 595 | return $thumbnail_url; |
596 | 596 | } |
@@ -608,7 +608,9 @@ discard block |
||
608 | 608 | $first_image = null; |
609 | 609 | foreach($file_list as $file) |
610 | 610 | { |
611 | - if($file->direct_download !== 'Y') continue; |
|
611 | + if($file->direct_download !== 'Y') { |
|
612 | + continue; |
|
613 | + } |
|
612 | 614 | |
613 | 615 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
614 | 616 | { |
@@ -616,7 +618,9 @@ discard block |
||
616 | 618 | break; |
617 | 619 | } |
618 | 620 | |
619 | - if($first_image) continue; |
|
621 | + if($first_image) { |
|
622 | + continue; |
|
623 | + } |
|
620 | 624 | |
621 | 625 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
622 | 626 | { |
@@ -644,7 +648,9 @@ discard block |
||
644 | 648 | foreach($matches as $target_image) |
645 | 649 | { |
646 | 650 | $target_src = trim($target_image[1]); |
647 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
651 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
652 | + continue; |
|
653 | + } |
|
648 | 654 | |
649 | 655 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
650 | 656 | { |
@@ -655,7 +661,9 @@ discard block |
||
655 | 661 | |
656 | 662 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
657 | 663 | FileHandler::getRemoteFile($target_src, $tmp_file); |
658 | - if(!file_exists($tmp_file)) continue; |
|
664 | + if(!file_exists($tmp_file)) { |
|
665 | + continue; |
|
666 | + } |
|
659 | 667 | |
660 | 668 | $imageinfo = getimagesize($tmp_file); |
661 | 669 | list($_w, $_h) = $imageinfo; |
@@ -19,11 +19,11 @@ |
||
19 | 19 | { |
20 | 20 | $event = $subject->getLastEvent(); |
21 | 21 | |
22 | - switch($event['name']) |
|
22 | + switch ($event['name']) |
|
23 | 23 | { |
24 | 24 | case 'receivedHeaders': |
25 | 25 | $this->fp = @fopen($this->filename, 'wb'); |
26 | - if(!$this->fp) |
|
26 | + if (!$this->fp) |
|
27 | 27 | { |
28 | 28 | throw new Exception("Cannot open target file '{$filename}'"); |
29 | 29 | } |