GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#1809)
by
unknown
62:34 queued 46:33
created
modules/document/document.class.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -351,6 +351,7 @@
 block discarded – undo
351 351
 
352 352
 	/**
353 353
 	 * Return status by key
354
+	 * @param string $key
354 355
 	 * @return string
355 356
 	 */
356 357
 	function getConfigStatus($key)
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3
-require_once(_XE_PATH_.'modules/document/document.item.php');
3
+require_once(_XE_PATH_ . 'modules/document/document.item.php');
4 4
 
5 5
 /**
6 6
  * document class
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 * Search option to use in admin page
18 18
 	 * @var array
19 19
 	 */
20
-	var $search_option = array('title','content','title_content','user_name',); // /< Search options
20
+	var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options
21 21
 	/**
22 22
 	 * Status list
23 23
 	 * @var array
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 		$oModuleController = getController('module');
35 35
 
36 36
 		$oDB = &DB::getInstance();
37
-		$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
38
-		$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
39
-		$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
40
-		$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
41
-		$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
42
-		$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
43
-		$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
44
-		$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true);
45
-		$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
37
+		$oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order"));
38
+		$oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order"));
39
+		$oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count"));
40
+		$oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count"));
41
+		$oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice"));
42
+		$oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl"));
43
+		$oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count"));
44
+		$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true);
45
+		$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true);
46 46
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
47 47
 		$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
48 48
 
@@ -61,68 +61,68 @@  discard block
 block discarded – undo
61 61
 		$oModuleModel = getModel('module');
62 62
 
63 63
 		// 2007. 7. 25: Add a column(notify_message) for notification
64
-		if(!$oDB->isColumnExists("documents","notify_message")) return true;
64
+		if (!$oDB->isColumnExists("documents", "notify_message")) return true;
65 65
 
66 66
 		// 2007. 8. 23: create a clustered index in the document table
67
-		if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
68
-		if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
69
-		if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
70
-		if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
67
+		if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true;
68
+		if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true;
69
+		if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true;
70
+		if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true;
71 71
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
72
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
72
+		if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
73 73
 		// 2007. 10. 25 add parent_srl, expand to the document category
74
-		if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
75
-		if(!$oDB->isColumnExists("document_categories","expand")) return true;
76
-		if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
74
+		if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true;
75
+		if (!$oDB->isColumnExists("document_categories", "expand")) return true;
76
+		if (!$oDB->isColumnExists("document_categories", "group_srls")) return true;
77 77
 		// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
78
-		if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
78
+		if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true;
79 79
 		// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
80
-		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
80
+		if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true;
81 81
 
82 82
 		// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
83
-		if(!$oDB->isColumnExists("documents","extra_vars")) return true;
83
+		if (!$oDB->isColumnExists("documents", "extra_vars")) return true;
84 84
 		// 2008. 04. 23 Add a column(blamed_count)
85
-		if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
86
-		if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
87
-		if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
85
+		if (!$oDB->isColumnExists("documents", "blamed_count")) return true;
86
+		if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true;
87
+		if (!$oDB->isColumnExists("document_voted_log", "point")) return true;
88 88
 		// 2008-12-15 Add a column(color)
89
-		if(!$oDB->isColumnExists("document_categories", "color")) return true;
89
+		if (!$oDB->isColumnExists("document_categories", "color")) return true;
90 90
 
91 91
 		/**
92 92
 		 * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
93 93
 		 */
94
-		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
94
+		if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true;
95 95
 
96
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
96
+		if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
97 97
 		// 2009. 03. 09 Add a column(lang_code) to the documnets table
98
-		if(!$oDB->isColumnExists("documents","lang_code")) return true;
98
+		if (!$oDB->isColumnExists("documents", "lang_code")) return true;
99 99
 		// 2009. 03. 11 check the index in the document_extra_vars table
100
-		if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
100
+		if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
101 101
 
102 102
 		// 2009. 03. 19: Add a column(eid) if not exist in the table
103
-		if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
104
-		if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
103
+		if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true;
104
+		if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true;
105 105
 
106 106
 		// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
107
-		if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
107
+		if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
108 108
 
109 109
 		//2011. 04. 07 adding description column to document categories
110
-		if(!$oDB->isColumnExists("document_categories","description")) return true;
110
+		if (!$oDB->isColumnExists("document_categories", "description")) return true;
111 111
 
112 112
 		//2011. 05. 23 adding status column to document
113
-		if(!$oDB->isColumnExists('documents', 'status')) return true;
113
+		if (!$oDB->isColumnExists('documents', 'status')) return true;
114 114
 
115 115
 		//2011. 06. 07 check comment status update
116
-		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
116
+		if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
117 117
 
118 118
 		// 2011. 10. 25 status index check
119
-		if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
119
+		if (!$oDB->isIndexExists("documents", "idx_module_status")) return true;
120 120
 
121 121
 		// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
122
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
122
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
123 123
 
124 124
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
125
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
125
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
126 126
 
127 127
 		return false;
128 128
 	}
@@ -138,134 +138,134 @@  discard block
 block discarded – undo
138 138
 		$oModuleController = getController('module');
139 139
 
140 140
 		// 2007. 7. 25: Add a column(notify_message) for notification
141
-		if(!$oDB->isColumnExists("documents","notify_message"))
141
+		if (!$oDB->isColumnExists("documents", "notify_message"))
142 142
 		{
143
-			$oDB->addColumn('documents',"notify_message","char",1);
143
+			$oDB->addColumn('documents', "notify_message", "char", 1);
144 144
 		}
145 145
 
146 146
 		// 2007. 8. 23: create a clustered index in the document table
147
-		if(!$oDB->isIndexExists("documents","idx_module_list_order"))
147
+		if (!$oDB->isIndexExists("documents", "idx_module_list_order"))
148 148
 		{
149
-			$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
149
+			$oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order"));
150 150
 		}
151 151
 
152
-		if(!$oDB->isIndexExists("documents","idx_module_update_order"))
152
+		if (!$oDB->isIndexExists("documents", "idx_module_update_order"))
153 153
 		{
154
-			$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
154
+			$oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order"));
155 155
 		}
156 156
 
157
-		if(!$oDB->isIndexExists("documents","idx_module_readed_count"))
157
+		if (!$oDB->isIndexExists("documents", "idx_module_readed_count"))
158 158
 		{
159
-			$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
159
+			$oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count"));
160 160
 		}
161 161
 
162
-		if(!$oDB->isIndexExists("documents","idx_module_voted_count"))
162
+		if (!$oDB->isIndexExists("documents", "idx_module_voted_count"))
163 163
 		{
164
-			$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
164
+			$oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count"));
165 165
 		}
166 166
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
167
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
167
+		if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
168 168
 			$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
169 169
 		// 2007. 10. 25 add columns(parent_srl, expand) 
170
-		if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
171
-		if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
172
-		if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
170
+		if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0);
171
+		if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N");
172
+		if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text");
173 173
 		// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
174
-		if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
174
+		if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice"));
175 175
 
176 176
 		// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
177
-		if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
177
+		if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text');
178 178
 
179 179
 		// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
180
-		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
180
+		if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl"));
181 181
 		// 2008. 04. 23 Add a column(blamed count)
182
-		if(!$oDB->isColumnExists("documents", "blamed_count"))
182
+		if (!$oDB->isColumnExists("documents", "blamed_count"))
183 183
 		{
184 184
 			$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
185 185
 			$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
186 186
 		}
187 187
 
188
-		if(!$oDB->isIndexExists("documents","idx_module_blamed_count"))
188
+		if (!$oDB->isIndexExists("documents", "idx_module_blamed_count"))
189 189
 		{
190 190
 			$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
191 191
 		}
192 192
 
193
-		if(!$oDB->isColumnExists("document_voted_log", "point"))
193
+		if (!$oDB->isColumnExists("document_voted_log", "point"))
194 194
 			$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
195 195
 
196 196
 
197
-		if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
197
+		if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7);
198 198
 
199 199
 		// 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
200
-		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
200
+		if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10);
201 201
 
202 202
 		// 2009. 01. 29 Added a trigger for additional setup
203
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
203
+		if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
204 204
 			$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
205 205
 		// 2009. 03. 09 Add a column(lang_code) to the documnets table
206
-		if(!$oDB->isColumnExists("documents","lang_code"))
206
+		if (!$oDB->isColumnExists("documents", "lang_code"))
207 207
 		{
208 208
 			$db_info = Context::getDBInfo();
209
-			$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
209
+			$oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code);
210 210
 			$obj->lang_code = $db_info->lang_type;
211 211
 			executeQuery('document.updateDocumentsLangCode', $obj);
212 212
 		}
213 213
 		// 2009. 03. 11 Check the index in the document_extra_vars table
214
-		if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
214
+		if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
215 215
 		{
216
-			$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
216
+			$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true);
217 217
 		}
218 218
 
219
-		if($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
219
+		if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
220 220
 		{
221 221
 			$oDB->dropIndex("document_extra_vars", "unique_module_vars", true);
222 222
 		}
223 223
 
224 224
 		// 2009. 03. 19: Add a column(eid)
225 225
 		// 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
226
-		if(!$oDB->isColumnExists("document_extra_keys","eid"))
226
+		if (!$oDB->isColumnExists("document_extra_keys", "eid"))
227 227
 		{
228
-			$oDB->addColumn("document_extra_keys","eid","varchar",40);
228
+			$oDB->addColumn("document_extra_keys", "eid", "varchar", 40);
229 229
 
230 230
 			$output = executeQuery('document.getGroupsExtraKeys', $obj);
231
-			if($output->toBool() && $output->data && count($output->data)) {
232
-				foreach($output->data as $extra_keys) {
231
+			if ($output->toBool() && $output->data && count($output->data)) {
232
+				foreach ($output->data as $extra_keys) {
233 233
 					$args->module_srl = $extra_keys->module_srl;
234 234
 					$args->var_idx = $extra_keys->idx;
235
-					$args->new_eid = "extra_vars".$extra_keys->idx;
235
+					$args->new_eid = "extra_vars" . $extra_keys->idx;
236 236
 					$output = executeQuery('document.updateDocumentExtraKeyEid', $args);
237 237
 				}
238 238
 			}
239 239
 		}
240 240
 
241
-		if(!$oDB->isColumnExists("document_extra_vars","eid"))
241
+		if (!$oDB->isColumnExists("document_extra_vars", "eid"))
242 242
 		{
243
-			$oDB->addColumn("document_extra_vars","eid","varchar",40);
243
+			$oDB->addColumn("document_extra_vars", "eid", "varchar", 40);
244 244
 			$obj->var_idx = '-1,-2';
245 245
 			$output = executeQuery('document.getGroupsExtraVars', $obj);
246
-			if($output->toBool() && $output->data && count($output->data))
246
+			if ($output->toBool() && $output->data && count($output->data))
247 247
 			{
248
-				foreach($output->data as $extra_vars)
248
+				foreach ($output->data as $extra_vars)
249 249
 				{
250 250
 					$args->module_srl = $extra_vars->module_srl;
251 251
 					$args->var_idx = $extra_vars->idx;
252
-					$args->new_eid = "extra_vars".$extra_vars->idx;
252
+					$args->new_eid = "extra_vars" . $extra_vars->idx;
253 253
 					$output = executeQuery('document.updateDocumentExtraVarEid', $args);
254 254
 				}
255 255
 			}
256 256
 		}
257 257
 
258 258
 		// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
259
-		if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
259
+		if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
260 260
 		{
261
-			$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false);
261
+			$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false);
262 262
 		}
263 263
 
264 264
 		//2011. 04. 07 adding description column to document categories
265
-		if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0);
265
+		if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0);
266 266
 
267 267
 		//2011. 05. 23 adding status column to document
268
-		if(!$oDB->isColumnExists('documents', 'status'))
268
+		if (!$oDB->isColumnExists('documents', 'status'))
269 269
 		{
270 270
 			$oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC');
271 271
 			$args->is_secret = 'Y';
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
 		}
274 274
 
275 275
 		// 2011. 09. 08 drop column document is_secret
276
-		if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
276
+		if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
277 277
 			$oDB->dropColumn('documents', 'is_secret');
278 278
 
279 279
 		//2011. 06. 07 merge column, allow_comment and lock_comment
280
-		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
280
+		if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
281 281
 		{
282 282
 			$oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW');
283 283
 
@@ -299,28 +299,28 @@  discard block
 block discarded – undo
299 299
 			$output = executeQuery('document.updateDocumentCommentStatus', $args);
300 300
 		}
301 301
 
302
-		if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
302
+		if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
303 303
 			$oDB->dropColumn('documents', 'allow_comment');
304 304
 
305
-		if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
305
+		if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
306 306
 			$oDB->dropColumn('documents', 'lock_comment');
307 307
 
308
-		if(!$oDB->isIndexExists("documents", "idx_module_status"))
309
-			$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
308
+		if (!$oDB->isIndexExists("documents", "idx_module_status"))
309
+			$oDB->addIndex("documents", "idx_module_status", array("module_srl", "status"));
310 310
 
311 311
 		// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
312
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
312
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
313 313
 		{
314 314
 			$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
315 315
 		}
316 316
 
317 317
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
318
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
318
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
319 319
 		{
320 320
 			$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
321 321
 		}
322 322
 
323
-		return new Object(0,'success_updated');
323
+		return new Object(0, 'success_updated');
324 324
 	}
325 325
 
326 326
 	/**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	function getConfigStatus($key)
357 357
 	{
358
-		if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
358
+		if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
359 359
 		else $this->getDefaultStatus();
360 360
 	}
361 361
 }
Please login to merge, or discard this patch.
Braces   +140 added lines, -54 removed lines patch added patch discarded remove patch
@@ -61,68 +61,126 @@  discard block
 block discarded – undo
61 61
 		$oModuleModel = getModel('module');
62 62
 
63 63
 		// 2007. 7. 25: Add a column(notify_message) for notification
64
-		if(!$oDB->isColumnExists("documents","notify_message")) return true;
64
+		if(!$oDB->isColumnExists("documents","notify_message")) {
65
+			return true;
66
+		}
65 67
 
66 68
 		// 2007. 8. 23: create a clustered index in the document table
67
-		if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
68
-		if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
69
-		if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
70
-		if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
69
+		if(!$oDB->isIndexExists("documents","idx_module_list_order")) {
70
+			return true;
71
+		}
72
+		if(!$oDB->isIndexExists("documents","idx_module_update_order")) {
73
+			return true;
74
+		}
75
+		if(!$oDB->isIndexExists("documents","idx_module_readed_count")) {
76
+			return true;
77
+		}
78
+		if(!$oDB->isIndexExists("documents","idx_module_voted_count")) {
79
+			return true;
80
+		}
71 81
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
72
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
82
+		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) {
83
+			return true;
84
+		}
73 85
 		// 2007. 10. 25 add parent_srl, expand to the document category
74
-		if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
75
-		if(!$oDB->isColumnExists("document_categories","expand")) return true;
76
-		if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
86
+		if(!$oDB->isColumnExists("document_categories","parent_srl")) {
87
+			return true;
88
+		}
89
+		if(!$oDB->isColumnExists("document_categories","expand")) {
90
+			return true;
91
+		}
92
+		if(!$oDB->isColumnExists("document_categories","group_srls")) {
93
+			return true;
94
+		}
77 95
 		// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
78
-		if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
96
+		if(!$oDB->isIndexExists("documents","idx_module_notice")) {
97
+			return true;
98
+		}
79 99
 		// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
80
-		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
100
+		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) {
101
+			return true;
102
+		}
81 103
 
82 104
 		// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
83
-		if(!$oDB->isColumnExists("documents","extra_vars")) return true;
105
+		if(!$oDB->isColumnExists("documents","extra_vars")) {
106
+			return true;
107
+		}
84 108
 		// 2008. 04. 23 Add a column(blamed_count)
85
-		if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
86
-		if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
87
-		if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
109
+		if(!$oDB->isColumnExists("documents", "blamed_count")) {
110
+			return true;
111
+		}
112
+		if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) {
113
+			return true;
114
+		}
115
+		if(!$oDB->isColumnExists("document_voted_log", "point")) {
116
+			return true;
117
+		}
88 118
 		// 2008-12-15 Add a column(color)
89
-		if(!$oDB->isColumnExists("document_categories", "color")) return true;
119
+		if(!$oDB->isColumnExists("document_categories", "color")) {
120
+			return true;
121
+		}
90 122
 
91 123
 		/**
92 124
 		 * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
93 125
 		 */
94
-		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
126
+		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) {
127
+			return true;
128
+		}
95 129
 
96
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
130
+		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) {
131
+			return true;
132
+		}
97 133
 		// 2009. 03. 09 Add a column(lang_code) to the documnets table
98
-		if(!$oDB->isColumnExists("documents","lang_code")) return true;
134
+		if(!$oDB->isColumnExists("documents","lang_code")) {
135
+			return true;
136
+		}
99 137
 		// 2009. 03. 11 check the index in the document_extra_vars table
100
-		if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
138
+		if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) {
139
+			return true;
140
+		}
101 141
 
102 142
 		// 2009. 03. 19: Add a column(eid) if not exist in the table
103
-		if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
104
-		if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
143
+		if(!$oDB->isColumnExists("document_extra_keys","eid")) {
144
+			return true;
145
+		}
146
+		if(!$oDB->isColumnExists("document_extra_vars","eid")) {
147
+			return true;
148
+		}
105 149
 
106 150
 		// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
107
-		if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
151
+		if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) {
152
+			return true;
153
+		}
108 154
 
109 155
 		//2011. 04. 07 adding description column to document categories
110
-		if(!$oDB->isColumnExists("document_categories","description")) return true;
156
+		if(!$oDB->isColumnExists("document_categories","description")) {
157
+			return true;
158
+		}
111 159
 
112 160
 		//2011. 05. 23 adding status column to document
113
-		if(!$oDB->isColumnExists('documents', 'status')) return true;
161
+		if(!$oDB->isColumnExists('documents', 'status')) {
162
+			return true;
163
+		}
114 164
 
115 165
 		//2011. 06. 07 check comment status update
116
-		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
166
+		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) {
167
+			return true;
168
+		}
117 169
 
118 170
 		// 2011. 10. 25 status index check
119
-		if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
171
+		if(!$oDB->isIndexExists("documents", "idx_module_status")) {
172
+			return true;
173
+		}
120 174
 
121 175
 		// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
122
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
176
+		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) {
177
+			return true;
178
+		}
123 179
 
124 180
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
125
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
181
+		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) {
182
+			return true;
183
+		}
126 184
 
127 185
 		return false;
128 186
 	}
@@ -164,20 +222,33 @@  discard block
 block discarded – undo
164 222
 			$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
165 223
 		}
166 224
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
167
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
168
-			$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
225
+		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) {
226
+					$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
227
+		}
169 228
 		// 2007. 10. 25 add columns(parent_srl, expand) 
170
-		if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
171
-		if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
172
-		if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
229
+		if(!$oDB->isColumnExists("document_categories","parent_srl")) {
230
+			$oDB->addColumn('document_categories',"parent_srl","number",12,0);
231
+		}
232
+		if(!$oDB->isColumnExists("document_categories","expand")) {
233
+			$oDB->addColumn('document_categories',"expand","char",1,"N");
234
+		}
235
+		if(!$oDB->isColumnExists("document_categories","group_srls")) {
236
+			$oDB->addColumn('document_categories',"group_srls","text");
237
+		}
173 238
 		// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
174
-		if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
239
+		if(!$oDB->isIndexExists("documents","idx_module_notice")) {
240
+			$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
241
+		}
175 242
 
176 243
 		// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
177
-		if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
244
+		if(!$oDB->isColumnExists("documents","extra_vars")) {
245
+			$oDB->addColumn('documents','extra_vars','text');
246
+		}
178 247
 
179 248
 		// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
180
-		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
249
+		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) {
250
+			$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
251
+		}
181 252
 		// 2008. 04. 23 Add a column(blamed count)
182 253
 		if(!$oDB->isColumnExists("documents", "blamed_count"))
183 254
 		{
@@ -190,18 +261,24 @@  discard block
 block discarded – undo
190 261
 			$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
191 262
 		}
192 263
 
193
-		if(!$oDB->isColumnExists("document_voted_log", "point"))
194
-			$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
264
+		if(!$oDB->isColumnExists("document_voted_log", "point")) {
265
+					$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
266
+		}
195 267
 
196 268
 
197
-		if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
269
+		if(!$oDB->isColumnExists("document_categories","color")) {
270
+			$oDB->addColumn('document_categories',"color","char",7);
271
+		}
198 272
 
199 273
 		// 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
200
-		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
274
+		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) {
275
+			$oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
276
+		}
201 277
 
202 278
 		// 2009. 01. 29 Added a trigger for additional setup
203
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
204
-			$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
279
+		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) {
280
+					$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
281
+		}
205 282
 		// 2009. 03. 09 Add a column(lang_code) to the documnets table
206 283
 		if(!$oDB->isColumnExists("documents","lang_code"))
207 284
 		{
@@ -262,7 +339,9 @@  discard block
 block discarded – undo
262 339
 		}
263 340
 
264 341
 		//2011. 04. 07 adding description column to document categories
265
-		if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0);
342
+		if(!$oDB->isColumnExists("document_categories","description")) {
343
+			$oDB->addColumn('document_categories',"description","varchar",200,0);
344
+		}
266 345
 
267 346
 		//2011. 05. 23 adding status column to document
268 347
 		if(!$oDB->isColumnExists('documents', 'status'))
@@ -273,8 +352,9 @@  discard block
 block discarded – undo
273 352
 		}
274 353
 
275 354
 		// 2011. 09. 08 drop column document is_secret
276
-		if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
277
-			$oDB->dropColumn('documents', 'is_secret');
355
+		if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) {
356
+					$oDB->dropColumn('documents', 'is_secret');
357
+		}
278 358
 
279 359
 		//2011. 06. 07 merge column, allow_comment and lock_comment
280 360
 		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
@@ -299,14 +379,17 @@  discard block
 block discarded – undo
299 379
 			$output = executeQuery('document.updateDocumentCommentStatus', $args);
300 380
 		}
301 381
 
302
-		if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
303
-			$oDB->dropColumn('documents', 'allow_comment');
382
+		if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) {
383
+					$oDB->dropColumn('documents', 'allow_comment');
384
+		}
304 385
 
305
-		if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
306
-			$oDB->dropColumn('documents', 'lock_comment');
386
+		if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) {
387
+					$oDB->dropColumn('documents', 'lock_comment');
388
+		}
307 389
 
308
-		if(!$oDB->isIndexExists("documents", "idx_module_status"))
309
-			$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
390
+		if(!$oDB->isIndexExists("documents", "idx_module_status")) {
391
+					$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
392
+		}
310 393
 
311 394
 		// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
312 395
 		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
@@ -355,8 +438,11 @@  discard block
 block discarded – undo
355 438
 	 */
356 439
 	function getConfigStatus($key)
357 440
 	{
358
-		if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
359
-		else $this->getDefaultStatus();
441
+		if(array_key_exists(strtolower($key), $this->statusList)) {
442
+			return $this->statusList[$key];
443
+		} else {
444
+			$this->getDefaultStatus();
445
+		}
360 446
 	}
361 447
 }
362 448
 /* End of file document.class.php */
Please login to merge, or discard this patch.
modules/document/document.controller.php 4 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
 	/**
714 714
 	 * Move the doc into the trash
715
-	 * @param object $obj
715
+	 * @param stdClass $obj
716 716
 	 * @return object
717 717
 	 */
718 718
 	function moveDocumentToTrash($obj)
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	 * @param mixed $value
1018 1018
 	 * @param int $eid
1019 1019
 	 * @param string $lang_code
1020
-	 * @return Object|void
1020
+	 * @return Object|null
1021 1021
 	 */
1022 1022
 	function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
1023 1023
 	{
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 	 * Occasionally the xml file is not generated after menu is configued on the admin page \n
1808 1808
 	 * The administrator can manually update the file in this case \n
1809 1809
 	 * Although the issue is not currently reproduced, it is unnecessay to remove.
1810
-	 * @return void
1810
+	 * @return Object|null
1811 1811
 	 */
1812 1812
 	function procDocumentMakeXmlFile()
1813 1813
 	{
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
 
2140 2140
 	/**
2141 2141
 	 * Saved in the session when an administrator selects a post
2142
-	 * @return void|Object
2142
+	 * @return Object|null
2143 2143
 	 */
2144 2144
 	function procDocumentAddCart()
2145 2145
 	{
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
 
2213 2213
 	/**
2214 2214
 	 * Move/ Delete the document in the seession
2215
-	 * @return void|Object
2215
+	 * @return Object|null
2216 2216
 	 */
2217 2217
 	function procDocumentManageCheckedDocument()
2218 2218
 	{
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
 
2375 2375
 	/**
2376 2376
 	 * Document temporary save
2377
-	 * @return void|Object
2377
+	 * @return Object|null
2378 2378
 	 */
2379 2379
 	function procDocumentTempSave()
2380 2380
 	{
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
 
2441 2441
 	/**
2442 2442
 	 * Return Document List for exec_xml
2443
-	 * @return void|Object
2443
+	 * @return Object|null
2444 2444
 	 */
2445 2445
 	function procDocumentGetList()
2446 2446
 	{
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * documentController class
5
- * document the module's controller class
6
- *
7
- * @author NAVER ([email protected])
8
- * @package /modules/document
9
- * @version 0.1
10
- */
4
+	 * documentController class
5
+	 * document the module's controller class
6
+	 *
7
+	 * @author NAVER ([email protected])
8
+	 * @package /modules/document
9
+	 * @version 0.1
10
+	 */
11 11
 class documentController extends document
12 12
 {
13 13
 	/**
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 		if(!$obj->email_address) $obj->email_address = '';
220 220
 		if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
221 221
 
222
-                // can modify regdate only manager
223
-                $grant = Context::get('grant');
222
+				// can modify regdate only manager
223
+				$grant = Context::get('grant');
224 224
 		if(!$grant->manager)
225 225
 		{
226 226
 			unset($obj->regdate);
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
423 423
 		
424 424
 		// can modify regdate only manager
425
-                $grant = Context::get('grant');
425
+				$grant = Context::get('grant');
426 426
 		if(!$grant->manager)
427 427
 		{
428 428
 			unset($obj->regdate);
Please login to merge, or discard this patch.
Spacing   +425 added lines, -425 removed lines patch added patch discarded remove patch
@@ -25,33 +25,33 @@  discard block
 block discarded – undo
25 25
 		$oModuleModel = getModel('module');
26 26
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl(Context::get('module_srl'), $columnList);
27 27
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
28
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
28
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
29 29
 		
30
-		if(!Context::get('is_logged'))
30
+		if (!Context::get('is_logged'))
31 31
 			return new Object(-1, 'msg_invalid_request');
32 32
 		
33 33
 		$document_srl = Context::get('documentsrl');
34 34
 
35 35
 		$point = Context::get('point');
36 36
 		
37
-		if(!$document_srl) return;
37
+		if (!$document_srl) return;
38 38
 		
39
-		if($point > 10)
39
+		if ($point > 10)
40 40
 			return;
41
-		if($point > 0)
41
+		if ($point > 0)
42 42
 			$failed_voted = 'failed_voted';
43 43
 		else
44 44
 			return;
45 45
 		
46 46
 		// Return fail if session already has information about votes
47
-		if($_SESSION['rate_document'][$document_srl])
47
+		if ($_SESSION['rate_document'][$document_srl])
48 48
 			return new Object(-1, $failed_voted);
49 49
 		
50 50
 		// Get the original document
51 51
 		$oDocumentModel = getModel('document');
52 52
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
53 53
 		// Pass if the author's IP address is as same as visitor's.
54
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
54
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
55 55
 		{
56 56
 			$_SESSION['rate_document'][$document_srl] = true;
57 57
 			return new Object(-1, $failed_voted);
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 		$member_srl = $oMemberModel->getLoggedMemberSrl();
63 63
 
64 64
 		// Check if document's author is a member.
65
-		if($oDocument->get('member_srl'))
65
+		if ($oDocument->get('member_srl'))
66 66
 		{
67 67
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
68
-			if($member_srl && $member_srl == $oDocument->get('member_srl'))
68
+			if ($member_srl && $member_srl == $oDocument->get('member_srl'))
69 69
 			{
70 70
 				$_SESSION['rate_document'][$document_srl] = true;
71 71
 				return new Object(-1, $failed_voted);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// Use member_srl for logged-in members and IP address for non-members.
76 76
 		$args = new stdClass;
77
-		if($member_srl)
77
+		if ($member_srl)
78 78
 		{
79 79
 			$args->member_srl = $member_srl;
80 80
 		}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$args->document_srl = $document_srl;
86 86
 		$output = executeQuery('document.getDocumentRateLogInfo', $args);
87 87
 		// Pass after registering a session if log information has vote-up logs
88
-		if($output->data->count)
88
+		if ($output->data->count)
89 89
 		{
90 90
 			$_SESSION['rate_document'][$document_srl] = true;
91 91
 			return new Object(-1, $failed_voted);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$oDB->begin();
97 97
 
98 98
 		// Update the voted count
99
-		if($point < 0)
99
+		if ($point < 0)
100 100
 		{
101 101
 			return $point;
102 102
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			$args->rateval = $oDocument->get('rateval') + $point;
106 106
 			$output = executeQuery('document.updateRateCount', $args);
107 107
 		}
108
-		if(!$output->toBool()) return $output;
108
+		if (!$output->toBool()) return $output;
109 109
 		// Leave logs
110 110
 		$args->point = $point;
111 111
 		$output = executeQuery('document.insertDocumentRateLog', $args);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		$obj->before_point = $oDocument->get('rateval');
121 121
 		$obj->after_point = $args->rateval;
122 122
 		$trigger_output = ModuleHandler::triggerCall('document.updateRateCount', 'after', $obj);
123
-		if(!$trigger_output->toBool())
123
+		if (!$trigger_output->toBool())
124 124
 		{
125 125
 			$oDB->rollback();
126 126
 			return $trigger_output;
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 		$oDB->commit();
130 130
 
131 131
 		$oCacheHandler = CacheHandler::getInstance('object');
132
-		if($oCacheHandler->isSupport())
132
+		if ($oCacheHandler->isSupport())
133 133
 		{
134 134
 			//remove document item from cache
135
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
135
+			$cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
136 136
 			$oCacheHandler->delete($cache_key);
137 137
 		}
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 		// Return result
143 143
 		$output = new Object();
144
-		if($point > 0)
144
+		if ($point > 0)
145 145
 		{
146 146
 			$output->setMessage('success_voted');
147 147
 			$output->add('rateval', $obj->after_point);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		
154 154
 		
155 155
 		// Update the voted count
156
-		if($point < 0)
156
+		if ($point < 0)
157 157
 		{
158 158
 			return $point;
159 159
 		}
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 		$output->add('ratecnt', $oDocument->get('ratecnt') + 1);
167 167
 		
168 168
 		// Update the voted count
169
-		if($point < 0)
169
+		if ($point < 0)
170 170
 		{
171 171
 			return $point;
172 172
 		}
173 173
 		else
174 174
 		{
175
-			$args->ratecalc = ($oDocument->get('rateval') + $point)/($oDocument->get('ratecnt') + 1);
175
+			$args->ratecalc = ($oDocument->get('rateval') + $point) / ($oDocument->get('ratecnt') + 1);
176 176
 			$output = executeQuery('document.updateRatecalcCount', $args);
177 177
 		}
178 178
 		
179
-		$output->add('ratecalc', ($oDocument->get('rateval')+$point)/($oDocument->get('ratecnt') + 1));
179
+		$output->add('ratecalc', ($oDocument->get('rateval') + $point) / ($oDocument->get('ratecnt') + 1));
180 180
 		
181 181
 		return $output;
182 182
 	}
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	function procDocumentVoteUp()
190 190
 	{
191
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
191
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
192 192
 
193 193
 		$document_srl = Context::get('target_srl');
194
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
194
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
195 195
 
196 196
 		$oDocumentModel = getModel('document');
197 197
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
198 198
 		$module_srl = $oDocument->get('module_srl');
199
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
199
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
200 200
 
201 201
 		$oModuleModel = getModel('module');
202
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
203
-		if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request');
202
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
203
+		if ($document_config->use_vote_up == 'N') return new Object(-1, 'msg_invalid_request');
204 204
 
205 205
 		$point = 1;
206 206
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -233,19 +233,19 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	function procDocumentVoteDown()
235 235
 	{
236
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
236
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
237 237
 
238 238
 		$document_srl = Context::get('target_srl');
239
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
239
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
240 240
 
241 241
 		$oDocumentModel = getModel('document');
242 242
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
243 243
 		$module_srl = $oDocument->get('module_srl');
244
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
244
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
245 245
 
246 246
 		$oModuleModel = getModel('module');
247
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
248
-		if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request');
247
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
248
+		if ($document_config->use_vote_down == 'N') return new Object(-1, 'msg_invalid_request');
249 249
 
250 250
 		$point = -1;
251 251
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	function procDocumentDeclare()
261 261
 	{
262
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
262
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
263 263
 
264 264
 		$document_srl = Context::get('target_srl');
265
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
265
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
266 266
 
267 267
 		return $this->declaredDocument($document_srl);
268 268
 	}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$args->history_srl = $history_srl;
305 305
 		$args->module_srl = $module_srl;
306 306
 		$args->document_srl = $document_srl;
307
-		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
307
+		if (!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
308 308
 		executeQuery("document.deleteHistory", $args);
309 309
 	}
310 310
 
@@ -316,15 +316,15 @@  discard block
 block discarded – undo
316 316
 	function triggerDeleteModuleDocuments(&$obj)
317 317
 	{
318 318
 		$module_srl = $obj->module_srl;
319
-		if(!$module_srl) return new Object();
319
+		if (!$module_srl) return new Object();
320 320
 		// Delete the document
321 321
 		$oDocumentAdminController = getAdminController('document');
322 322
 		$output = $oDocumentAdminController->deleteModuleDocument($module_srl);
323
-		if(!$output->toBool()) return $output;
323
+		if (!$output->toBool()) return $output;
324 324
 		// Delete the category
325 325
 		$oDocumentController = getController('document');
326 326
 		$output = $oDocumentController->deleteModuleCategory($module_srl);
327
-		if(!$output->toBool()) return $output;
327
+		if (!$output->toBool()) return $output;
328 328
 		// Delete extra key and variable, because module deleted
329 329
 		$this->deleteDocumentExtraKeys($module_srl);
330 330
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true)
359 359
 	{
360
-		if(!$manual_inserted && !checkCSRF())
360
+		if (!$manual_inserted && !checkCSRF())
361 361
 		{
362 362
 			return new Object(-1, 'msg_invalid_request');
363 363
 		}
@@ -366,32 +366,32 @@  discard block
 block discarded – undo
366 366
 		$oDB = &DB::getInstance();
367 367
 		$oDB->begin();
368 368
 		// List variables
369
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
370
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
371
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
372
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
373
-		if($obj->homepage) 
369
+		if ($obj->comment_status) $obj->commentStatus = $obj->comment_status;
370
+		if (!$obj->commentStatus) $obj->commentStatus = 'DENY';
371
+		if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
372
+		if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N';
373
+		if ($obj->homepage) 
374 374
 		{
375 375
 			$obj->homepage = removeHackTag($obj->homepage);
376
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
376
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
377 377
 			{
378
-				$obj->homepage = 'http://'.$obj->homepage;
378
+				$obj->homepage = 'http://' . $obj->homepage;
379 379
 			}
380 380
 		}
381 381
 		
382
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
383
-		if(!$obj->email_address) $obj->email_address = '';
384
-		if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
382
+		if ($obj->notify_message != 'Y') $obj->notify_message = 'N';
383
+		if (!$obj->email_address) $obj->email_address = '';
384
+		if (!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
385 385
 
386 386
                 // can modify regdate only manager
387 387
                 $grant = Context::get('grant');
388
-		if(!$grant->manager)
388
+		if (!$grant->manager)
389 389
 		{
390 390
 			unset($obj->regdate);
391 391
 		}
392 392
 		
393 393
 		// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
394
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
394
+		if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
395 395
 		// Remove the columns for automatic saving
396 396
 		unset($obj->_saved_doc_srl);
397 397
 		unset($obj->_saved_doc_title);
@@ -399,34 +399,34 @@  discard block
 block discarded – undo
399 399
 		unset($obj->_saved_doc_message);
400 400
 		// Call a trigger (before)
401 401
 		$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
402
-		if(!$output->toBool()) return $output;
402
+		if (!$output->toBool()) return $output;
403 403
 		// Register it if no given document_srl exists
404
-		if(!$obj->document_srl) $obj->document_srl = getNextSequence();
405
-		elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted');
404
+		if (!$obj->document_srl) $obj->document_srl = getNextSequence();
405
+		elseif (!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted');
406 406
 
407 407
 		$oDocumentModel = getModel('document');
408 408
 		// Set to 0 if the category_srl doesn't exist
409
-		if($obj->category_srl)
409
+		if ($obj->category_srl)
410 410
 		{
411 411
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
412
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
412
+			if (count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
413 413
 			{
414 414
 				return new Object(-1, 'msg_not_permitted');
415 415
 			}
416
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
416
+			if (count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
417 417
 		}
418 418
 		// Set the read counts and update order.
419
-		if(!$obj->readed_count) $obj->readed_count = 0;
420
-		if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
419
+		if (!$obj->readed_count) $obj->readed_count = 0;
420
+		if ($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
421 421
 		else $obj->update_order = $obj->list_order;
422 422
 		// Check the status of password hash for manually inserting. Apply hashing for otherwise.
423
-		if($obj->password && !$obj->password_is_hashed)
423
+		if ($obj->password && !$obj->password_is_hashed)
424 424
 		{
425 425
 			$obj->password = getModel('member')->hashPassword($obj->password);
426 426
 		}
427 427
 		// Insert member's information only if the member is logged-in and not manually registered.
428 428
 		$logged_info = Context::get('logged_info');
429
-		if(Context::get('is_logged') && !$manual_inserted && !$isRestore)
429
+		if (Context::get('is_logged') && !$manual_inserted && !$isRestore)
430 430
 		{
431 431
 			$obj->member_srl = $logged_info->member_srl;
432 432
 
@@ -440,61 +440,61 @@  discard block
 block discarded – undo
440 440
 		// If the tile is empty, extract string from the contents.
441 441
 		$obj->title = htmlspecialchars($obj->title);
442 442
 		settype($obj->title, "string");
443
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
443
+		if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...');
444 444
 		// If no tile extracted from the contents, leave it untitled.
445
-		if($obj->title == '') $obj->title = 'Untitled';
445
+		if ($obj->title == '') $obj->title = 'Untitled';
446 446
 		// Remove XE's own tags from the contents.
447 447
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
448
-		if(Mobile::isFromMobilePhone())
448
+		if (Mobile::isFromMobilePhone())
449 449
 		{
450
-			if($obj->use_html != 'Y')
450
+			if ($obj->use_html != 'Y')
451 451
 			{
452 452
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
453 453
 			}
454 454
 			$obj->content = nl2br($obj->content);
455 455
 		}
456 456
 		// Remove iframe and script if not a top adminisrator in the session.
457
-		if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
457
+		if ($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
458 458
 		// An error appears if both log-in info and user name don't exist.
459
-		if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request');
459
+		if (!$logged_info->member_srl && !$obj->nick_name) return new Object(-1, 'msg_invalid_request');
460 460
 
461 461
 		$obj->lang_code = Context::getLangType();
462 462
 		// Insert data into the DB
463
-		if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
463
+		if (!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
464 464
 		$output = executeQuery('document.insertDocument', $obj);
465
-		if(!$output->toBool())
465
+		if (!$output->toBool())
466 466
 		{
467 467
 			$oDB->rollback();
468 468
 			return $output;
469 469
 		}
470 470
 		// Insert extra variables if the document successfully inserted.
471 471
 		$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
472
-		if(count($extra_keys))
472
+		if (count($extra_keys))
473 473
 		{
474
-			foreach($extra_keys as $idx => $extra_item)
474
+			foreach ($extra_keys as $idx => $extra_item)
475 475
 			{
476 476
 				$value = NULL;
477
-				if(isset($obj->{'extra_vars'.$idx}))
477
+				if (isset($obj->{'extra_vars' . $idx}))
478 478
 				{
479
-					$tmp = $obj->{'extra_vars'.$idx};
480
-					if(is_array($tmp))
479
+					$tmp = $obj->{'extra_vars' . $idx};
480
+					if (is_array($tmp))
481 481
 						$value = implode('|@|', $tmp);
482 482
 					else
483 483
 						$value = trim($tmp);
484 484
 				}
485
-				else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
486
-				if($value == NULL) continue;
485
+				else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
486
+				if ($value == NULL) continue;
487 487
 
488 488
 				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
489 489
 			}
490 490
 		}
491 491
 		// Update the category if the category_srl exists.
492
-		if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
492
+		if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
493 493
 		// Call a trigger (after)
494
-		if($output->toBool())
494
+		if ($output->toBool())
495 495
 		{
496 496
 			$trigger_output = ModuleHandler::triggerCall('document.insertDocument', 'after', $obj);
497
-			if(!$trigger_output->toBool())
497
+			if (!$trigger_output->toBool())
498 498
 			{
499 499
 				$oDB->rollback();
500 500
 				return $trigger_output;
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
 		$oDB->commit();
506 506
 
507 507
 		// return
508
-		if(!$manual_inserted)
508
+		if (!$manual_inserted)
509 509
 		{
510 510
 			$this->addGrant($obj->document_srl);
511 511
 		}
512
-		$output->add('document_srl',$obj->document_srl);
513
-		$output->add('category_srl',$obj->category_srl);
512
+		$output->add('document_srl', $obj->document_srl);
513
+		$output->add('category_srl', $obj->category_srl);
514 514
 
515 515
 		return $output;
516 516
 	}
@@ -524,41 +524,41 @@  discard block
 block discarded – undo
524 524
 	 */
525 525
 	function updateDocument($source_obj, $obj, $manual_updated = FALSE)
526 526
 	{
527
-		if(!$manual_updated && !checkCSRF())
527
+		if (!$manual_updated && !checkCSRF())
528 528
 		{
529 529
 			return new Object(-1, 'msg_invalid_request');
530 530
 		}
531 531
 
532
-		if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request');
533
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
534
-		if(!$obj->status) $obj->status = 'PUBLIC';
532
+		if (!$source_obj->document_srl || !$obj->document_srl) return new Object(-1, 'msg_invalied_request');
533
+		if (!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
534
+		if (!$obj->status) $obj->status = 'PUBLIC';
535 535
 
536 536
 		// Call a trigger (before)
537 537
 		$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
538
-		if(!$output->toBool()) return $output;
538
+		if (!$output->toBool()) return $output;
539 539
 
540 540
 		// begin transaction
541 541
 		$oDB = &DB::getInstance();
542 542
 		$oDB->begin();
543 543
 
544 544
 		$oModuleModel = getModel('module');
545
-		if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
545
+		if (!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
546 546
 		$module_srl = $obj->module_srl;
547 547
 		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
548
-		if(!$document_config)
548
+		if (!$document_config)
549 549
 		{
550 550
 			$document_config = new stdClass();
551 551
 		}
552
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
552
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
553 553
 		$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
554 554
 
555
-		if($bUseHistory)
555
+		if ($bUseHistory)
556 556
 		{
557 557
 			$args = new stdClass;
558 558
 			$args->history_srl = getNextSequence();
559 559
 			$args->document_srl = $obj->document_srl;
560 560
 			$args->module_srl = $module_srl;
561
-			if($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
561
+			if ($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
562 562
 			$args->nick_name = $source_obj->get('nick_name');
563 563
 			$args->member_srl = $source_obj->get('member_srl');
564 564
 			$args->regdate = $source_obj->get('last_update');
@@ -570,30 +570,30 @@  discard block
 block discarded – undo
570 570
 			$obj->ipaddress = $source_obj->get('ipaddress');
571 571
 		}
572 572
 		// List variables
573
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
574
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
575
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
576
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
577
-		if($obj->homepage)
573
+		if ($obj->comment_status) $obj->commentStatus = $obj->comment_status;
574
+		if (!$obj->commentStatus) $obj->commentStatus = 'DENY';
575
+		if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
576
+		if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N';
577
+		if ($obj->homepage)
578 578
 		{
579 579
 			$obj->homepage = removeHackTag($obj->homepage);
580
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
580
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
581 581
 			{
582
-				$obj->homepage = 'http://'.$obj->homepage;
582
+				$obj->homepage = 'http://' . $obj->homepage;
583 583
 			}
584 584
 		}
585 585
 		
586
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
586
+		if ($obj->notify_message != 'Y') $obj->notify_message = 'N';
587 587
 		
588 588
 		// can modify regdate only manager
589 589
                 $grant = Context::get('grant');
590
-		if(!$grant->manager)
590
+		if (!$grant->manager)
591 591
 		{
592 592
 			unset($obj->regdate);
593 593
 		}
594 594
 		
595 595
 		// Serialize the $extra_vars
596
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
596
+		if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
597 597
 		// Remove the columns for automatic saving
598 598
 		unset($obj->_saved_doc_srl);
599 599
 		unset($obj->_saved_doc_title);
@@ -602,23 +602,23 @@  discard block
 block discarded – undo
602 602
 
603 603
 		$oDocumentModel = getModel('document');
604 604
 		// Set the category_srl to 0 if the changed category is not exsiting.
605
-		if($source_obj->get('category_srl')!=$obj->category_srl)
605
+		if ($source_obj->get('category_srl') != $obj->category_srl)
606 606
 		{
607 607
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
608
-			if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
608
+			if (!$category_list[$obj->category_srl]) $obj->category_srl = 0;
609 609
 		}
610 610
 		// Change the update order
611 611
 		$obj->update_order = getNextSequence() * -1;
612 612
 		// Hash the password if it exists
613
-		if($obj->password)
613
+		if ($obj->password)
614 614
 		{
615 615
 			$obj->password = getModel('member')->hashPassword($obj->password);
616 616
 		}
617 617
 		// If an author is identical to the modifier or history is used, use the logged-in user's information.
618
-		if(Context::get('is_logged'))
618
+		if (Context::get('is_logged'))
619 619
 		{
620 620
 			$logged_info = Context::get('logged_info');
621
-			if($source_obj->get('member_srl')==$logged_info->member_srl)
621
+			if ($source_obj->get('member_srl') == $logged_info->member_srl)
622 622
 			{
623 623
 				$obj->member_srl = $logged_info->member_srl;
624 624
 				$obj->user_name = htmlspecialchars_decode($logged_info->user_name);
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 			}
629 629
 		}
630 630
 		// For the document written by logged-in user however no nick_name exists
631
-		if($source_obj->get('member_srl')&& !$obj->nick_name)
631
+		if ($source_obj->get('member_srl') && !$obj->nick_name)
632 632
 		{
633 633
 			$obj->member_srl = $source_obj->get('member_srl');
634 634
 			$obj->user_name = $source_obj->get('user_name');
@@ -638,24 +638,24 @@  discard block
 block discarded – undo
638 638
 		}
639 639
 		// If the tile is empty, extract string from the contents.
640 640
 		settype($obj->title, "string");
641
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
641
+		if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...');
642 642
 		// If no tile extracted from the contents, leave it untitled.
643
-		if($obj->title == '') $obj->title = 'Untitled';
643
+		if ($obj->title == '') $obj->title = 'Untitled';
644 644
 		// Remove XE's own tags from the contents.
645 645
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
646
-		if(Mobile::isFromMobilePhone())
646
+		if (Mobile::isFromMobilePhone())
647 647
 		{
648
-			if($obj->use_html != 'Y')
648
+			if ($obj->use_html != 'Y')
649 649
 			{
650 650
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
651 651
 			}
652 652
 			$obj->content = nl2br($obj->content);
653 653
 		}
654 654
 		// Change not extra vars but language code of the original document if document's lang_code is different from author's setting.
655
-		if($source_obj->get('lang_code') != Context::getLangType())
655
+		if ($source_obj->get('lang_code') != Context::getLangType())
656 656
 		{
657 657
 			// Change not extra vars but language code of the original document if document's lang_code doesn't exist.
658
-			if(!$source_obj->get('lang_code'))
658
+			if (!$source_obj->get('lang_code'))
659 659
 			{
660 660
 				$lang_code_args->document_srl = $source_obj->get('document_srl');
661 661
 				$lang_code_args->lang_code = Context::getLangType();
@@ -675,59 +675,59 @@  discard block
 block discarded – undo
675 675
 			}
676 676
 		}
677 677
 		// Remove iframe and script if not a top adminisrator in the session.
678
-		if($logged_info->is_admin != 'Y')
678
+		if ($logged_info->is_admin != 'Y')
679 679
 		{
680 680
 			$obj->content = removeHackTag($obj->content);
681 681
 		}
682 682
 		// if temporary document, regdate is now setting
683
-		if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
683
+		if ($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
684 684
 
685 685
 		// Insert data into the DB
686 686
 		$output = executeQuery('document.updateDocument', $obj);
687
-		if(!$output->toBool())
687
+		if (!$output->toBool())
688 688
 		{
689 689
 			$oDB->rollback();
690 690
 			return $output;
691 691
 		}
692 692
 		// Remove all extra variables
693
-		if(Context::get('act')!='procFileDelete')
693
+		if (Context::get('act') != 'procFileDelete')
694 694
 		{
695 695
 			$this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType());
696 696
 			// Insert extra variables if the document successfully inserted.
697 697
 			$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
698
-			if(count($extra_keys))
698
+			if (count($extra_keys))
699 699
 			{
700
-				foreach($extra_keys as $idx => $extra_item)
700
+				foreach ($extra_keys as $idx => $extra_item)
701 701
 				{
702 702
 					$value = NULL;
703
-					if(isset($obj->{'extra_vars'.$idx}))
703
+					if (isset($obj->{'extra_vars' . $idx}))
704 704
 					{
705
-						$tmp = $obj->{'extra_vars'.$idx};
706
-						if(is_array($tmp))
705
+						$tmp = $obj->{'extra_vars' . $idx};
706
+						if (is_array($tmp))
707 707
 							$value = implode('|@|', $tmp);
708 708
 						else
709 709
 							$value = trim($tmp);
710 710
 					}
711
-					else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
712
-					if($value == NULL) continue;
711
+					else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
712
+					if ($value == NULL) continue;
713 713
 					$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
714 714
 				}
715 715
 			}
716 716
 			// Inert extra vars for multi-language support of title and contents.
717
-			if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
718
-			if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
717
+			if ($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_' . Context::getLangType());
718
+			if ($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_' . Context::getLangType());
719 719
 		}
720 720
 		// Update the category if the category_srl exists.
721
-		if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
721
+		if ($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
722 722
 		{
723
-			if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
724
-			if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
723
+			if ($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
724
+			if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
725 725
 		}
726 726
 		// Call a trigger (after)
727
-		if($output->toBool())
727
+		if ($output->toBool())
728 728
 		{
729 729
 			$trigger_output = ModuleHandler::triggerCall('document.updateDocument', 'after', $obj);
730
-			if(!$trigger_output->toBool())
730
+			if (!$trigger_output->toBool())
731 731
 			{
732 732
 				$oDB->rollback();
733 733
 				return $trigger_output;
@@ -737,15 +737,15 @@  discard block
 block discarded – undo
737 737
 		// commit
738 738
 		$oDB->commit();
739 739
 		// Remove the thumbnail file
740
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
740
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
741 741
 
742
-		$output->add('document_srl',$obj->document_srl);
742
+		$output->add('document_srl', $obj->document_srl);
743 743
 		//remove from cache
744 744
 		$oCacheHandler = CacheHandler::getInstance('object');
745
-		if($oCacheHandler->isSupport())
745
+		if ($oCacheHandler->isSupport())
746 746
 		{
747 747
 			//remove document item from cache
748
-			$cache_key = 'document_item:'. getNumberingPath($obj->document_srl) . $obj->document_srl;
748
+			$cache_key = 'document_item:' . getNumberingPath($obj->document_srl) . $obj->document_srl;
749 749
 			$oCacheHandler->delete($cache_key);
750 750
 		}
751 751
 
@@ -766,33 +766,33 @@  discard block
 block discarded – undo
766 766
 		$trigger_obj = new stdClass();
767 767
 		$trigger_obj->document_srl = $document_srl;
768 768
 		$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
769
-		if(!$output->toBool()) return $output;
769
+		if (!$output->toBool()) return $output;
770 770
 
771 771
 		// begin transaction
772 772
 		$oDB = &DB::getInstance();
773 773
 		$oDB->begin();
774 774
 
775
-		if(!$isEmptyTrash)
775
+		if (!$isEmptyTrash)
776 776
 		{
777 777
 			// get model object of the document
778 778
 			$oDocumentModel = getModel('document');
779 779
 			// Check if the documnet exists
780 780
 			$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
781 781
 		}
782
-		else if($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
782
+		else if ($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
783 783
 
784
-		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
784
+		if (!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
785 785
 		// Check if a permossion is granted
786
-		if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
786
+		if (!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
787 787
 
788 788
 		//if empty trash, document already deleted, therefore document not delete
789 789
 		$args = new stdClass();
790 790
 		$args->document_srl = $document_srl;
791
-		if(!$isEmptyTrash)
791
+		if (!$isEmptyTrash)
792 792
 		{
793 793
 			// Delete the document
794 794
 			$output = executeQuery('document.deleteDocument', $args);
795
-			if(!$output->toBool())
795
+			if (!$output->toBool())
796 796
 			{
797 797
 				$oDB->rollback();
798 798
 				return $output;
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
 		$this->deleteDocumentHistory(null, $document_srl, null);
805 805
 		// Update category information if the category_srl exists.
806
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
806
+		if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
807 807
 		// Delete a declared list
808 808
 		executeQuery('document.deleteDeclared', $args);
809 809
 		// Delete extra variable
@@ -811,11 +811,11 @@  discard block
 block discarded – undo
811 811
 
812 812
 		//this
813 813
 		// Call a trigger (after)
814
-		if($output->toBool())
814
+		if ($output->toBool())
815 815
 		{
816 816
 			$trigger_obj = $oDocument->getObjectVars();
817 817
 			$trigger_output = ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
818
-			if(!$trigger_output->toBool())
818
+			if (!$trigger_output->toBool())
819 819
 			{
820 820
 				$oDB->rollback();
821 821
 				return $trigger_output;
@@ -827,16 +827,16 @@  discard block
 block discarded – undo
827 827
 		$this->_deleteDocumentVotedLog($args);
828 828
 
829 829
 		// Remove the thumbnail file
830
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($document_srl, 3)));
830
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($document_srl, 3)));
831 831
 
832 832
 		// commit
833 833
 		$oDB->commit();
834 834
 
835 835
 		//remove from cache
836 836
 		$oCacheHandler = CacheHandler::getInstance('object');
837
-		if($oCacheHandler->isSupport())
837
+		if ($oCacheHandler->isSupport())
838 838
 		{
839
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
839
+			$cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
840 840
 			$oCacheHandler->delete($cache_key);
841 841
 		}
842 842
 
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 	{
884 884
 		$trash_args = new stdClass();
885 885
 		// Get trash_srl if a given trash_srl doesn't exist
886
-		if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
886
+		if (!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
887 887
 		else $trash_args->trash_srl = $obj->trash_srl;
888 888
 		// Get its module_srl which the document belongs to
889 889
 		$oDocumentModel = getModel('document');
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
 		$trash_args->module_srl = $oDocument->get('module_srl');
893 893
 		$obj->module_srl = $oDocument->get('module_srl');
894 894
 		// Cannot throw data from the trash to the trash
895
-		if($trash_args->module_srl == 0) return false;
895
+		if ($trash_args->module_srl == 0) return false;
896 896
 		// Data setting
897 897
 		$trash_args->document_srl = $obj->document_srl;
898 898
 		$trash_args->description = $obj->description;
899 899
 		// Insert member's information only if the member is logged-in and not manually registered.
900
-		if(Context::get('is_logged')&&!$manual_inserted)
900
+		if (Context::get('is_logged') && !$manual_inserted)
901 901
 		{
902 902
 			$logged_info = Context::get('logged_info');
903 903
 			$trash_args->member_srl = $logged_info->member_srl;
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 		  }*/
924 924
 
925 925
 		// new trash module
926
-		require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
926
+		require_once(_XE_PATH_ . 'modules/trash/model/TrashVO.php');
927 927
 		$oTrashVO = new TrashVO();
928 928
 		$oTrashVO->setTrashSrl(getNextSequence());
929 929
 		$oTrashVO->setTitle($oDocument->variables['title']);
@@ -933,14 +933,14 @@  discard block
 block discarded – undo
933 933
 
934 934
 		$oTrashAdminController = getAdminController('trash');
935 935
 		$output = $oTrashAdminController->insertTrash($oTrashVO);
936
-		if(!$output->toBool())
936
+		if (!$output->toBool())
937 937
 		{
938 938
 			$oDB->rollback();
939 939
 			return $output;
940 940
 		}
941 941
 
942 942
 		$output = executeQuery('document.deleteDocument', $trash_args);
943
-		if(!$output->toBool())
943
+		if (!$output->toBool())
944 944
 		{
945 945
 			$oDB->rollback();
946 946
 			return $output;
@@ -953,12 +953,12 @@  discard block
 block discarded – undo
953 953
 		  }*/
954 954
 
955 955
 		// update category
956
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
956
+		if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
957 957
 
958 958
 		// remove thumbnails
959
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
959
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
960 960
 		// Set the attachment to be invalid state
961
-		if($oDocument->hasUploadedFiles())
961
+		if ($oDocument->hasUploadedFiles())
962 962
 		{
963 963
 			$args = new stdClass();
964 964
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 			executeQuery('file.updateFileValid', $args);
967 967
 		}
968 968
 		// Call a trigger (after)
969
-		if($output->toBool())
969
+		if ($output->toBool())
970 970
 		{
971 971
 			$trigger_output = ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj);
972
-			if(!$trigger_output->toBool())
972
+			if (!$trigger_output->toBool())
973 973
 			{
974 974
 				$oDB->rollback();
975 975
 				return $trigger_output;
@@ -981,9 +981,9 @@  discard block
 block discarded – undo
981 981
 
982 982
 		// Clear cache
983 983
 		$oCacheHandler = CacheHandler::getInstance('object');
984
-		if($oCacheHandler->isSupport())
984
+		if ($oCacheHandler->isSupport())
985 985
 		{
986
-			$cache_key = 'document_item:'. getNumberingPath($oDocument->document_srl) . $oDocument->document_srl;
986
+			$cache_key = 'document_item:' . getNumberingPath($oDocument->document_srl) . $oDocument->document_srl;
987 987
 			$oCacheHandler->delete($cache_key);
988 988
 		}
989 989
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	function updateReadedCount(&$oDocument)
999 999
 	{
1000 1000
 		// Pass if Crawler access
1001
-		if(isCrawler()) return false;
1001
+		if (isCrawler()) return false;
1002 1002
 		
1003 1003
 		$document_srl = $oDocument->document_srl;
1004 1004
 		$member_srl = $oDocument->get('member_srl');
@@ -1006,19 +1006,19 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 		// Call a trigger when the read count is updated (before)
1008 1008
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
1009
-		if(!$trigger_output->toBool()) return $trigger_output;
1009
+		if (!$trigger_output->toBool()) return $trigger_output;
1010 1010
 
1011 1011
 		// Pass if read count is increaded on the session information
1012
-		if($_SESSION['readed_document'][$document_srl]) return false;
1012
+		if ($_SESSION['readed_document'][$document_srl]) return false;
1013 1013
 
1014 1014
 		// Pass if the author's IP address is as same as visitor's.
1015
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1015
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1016 1016
 		{
1017 1017
 			$_SESSION['readed_document'][$document_srl] = true;
1018 1018
 			return false;
1019 1019
 		}
1020 1020
 		// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
1021
-		if($member_srl && $logged_info->member_srl == $member_srl)
1021
+		if ($member_srl && $logged_info->member_srl == $member_srl)
1022 1022
 		{
1023 1023
 			$_SESSION['readed_document'][$document_srl] = true;
1024 1024
 			return false;
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 		// Call a trigger when the read count is updated (after)
1036 1036
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
1037
-		if(!$trigger_output->toBool())
1037
+		if (!$trigger_output->toBool())
1038 1038
 		{
1039 1039
 			$oDB->rollback();
1040 1040
 			return $trigger_output;
@@ -1043,15 +1043,15 @@  discard block
 block discarded – undo
1043 1043
 		$oDB->commit();
1044 1044
 
1045 1045
 		$oCacheHandler = CacheHandler::getInstance('object');
1046
-		if($oCacheHandler->isSupport())
1046
+		if ($oCacheHandler->isSupport())
1047 1047
 		{
1048 1048
 			//remove document item from cache
1049
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1049
+			$cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
1050 1050
 			$oCacheHandler->delete($cache_key);
1051 1051
 		}
1052 1052
 
1053 1053
 		// Register session
1054
-		if(!$_SESSION['banned_document'][$document_srl]) 
1054
+		if (!$_SESSION['banned_document'][$document_srl]) 
1055 1055
 		{
1056 1056
 			$_SESSION['readed_document'][$document_srl] = true;
1057 1057
 		}
@@ -1074,21 +1074,21 @@  discard block
 block discarded – undo
1074 1074
 	 */
1075 1075
 	function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid)
1076 1076
 	{
1077
-		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request');
1077
+		if (!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1, 'msg_invalid_request');
1078 1078
 
1079 1079
 		$obj = new stdClass();
1080 1080
 		$obj->module_srl = $module_srl;
1081 1081
 		$obj->var_idx = $var_idx;
1082 1082
 		$obj->var_name = $var_name;
1083 1083
 		$obj->var_type = $var_type;
1084
-		$obj->var_is_required = $var_is_required=='Y'?'Y':'N';
1085
-		$obj->var_search = $var_search=='Y'?'Y':'N';
1084
+		$obj->var_is_required = $var_is_required == 'Y' ? 'Y' : 'N';
1085
+		$obj->var_search = $var_search == 'Y' ? 'Y' : 'N';
1086 1086
 		$obj->var_default = $var_default;
1087 1087
 		$obj->var_desc = $var_desc;
1088 1088
 		$obj->eid = $eid;
1089 1089
 
1090 1090
 		$output = executeQuery('document.getDocumentExtraKeys', $obj);
1091
-		if(!$output->data)
1091
+		if (!$output->data)
1092 1092
 		{
1093 1093
 			$output = executeQuery('document.insertDocumentExtraKey', $obj);
1094 1094
 		}
@@ -1100,9 +1100,9 @@  discard block
 block discarded – undo
1100 1100
 		}
1101 1101
 
1102 1102
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
1103
-		if($oCacheHandler->isSupport())
1103
+		if ($oCacheHandler->isSupport())
1104 1104
 		{
1105
-			$object_key = 'module_document_extra_keys:'.$module_srl;
1105
+			$object_key = 'module_document_extra_keys:' . $module_srl;
1106 1106
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1107 1107
 			$oCacheHandler->delete($cache_key);
1108 1108
 		}
@@ -1118,42 +1118,42 @@  discard block
 block discarded – undo
1118 1118
 	 */
1119 1119
 	function deleteDocumentExtraKeys($module_srl, $var_idx = null)
1120 1120
 	{
1121
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
1121
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
1122 1122
 		$obj = new stdClass();
1123 1123
 		$obj->module_srl = $module_srl;
1124
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1124
+		if (!is_null($var_idx)) $obj->var_idx = $var_idx;
1125 1125
 
1126 1126
 		$oDB = DB::getInstance();
1127 1127
 		$oDB->begin();
1128 1128
 
1129 1129
 		$output = $oDB->executeQuery('document.deleteDocumentExtraKeys', $obj);
1130
-		if(!$output->toBool())
1130
+		if (!$output->toBool())
1131 1131
 		{
1132 1132
 			$oDB->rollback();
1133 1133
 			return $output;
1134 1134
 		}
1135 1135
 
1136
-		if($var_idx != NULL)
1136
+		if ($var_idx != NULL)
1137 1137
 		{
1138 1138
 			$output = $oDB->executeQuery('document.updateDocumentExtraKeyIdxOrder', $obj);
1139
-			if(!$output->toBool())
1139
+			if (!$output->toBool())
1140 1140
 			{
1141 1141
 				$oDB->rollback();
1142 1142
 				return $output;
1143 1143
 			}
1144 1144
 		}
1145 1145
 
1146
-		$output =  executeQuery('document.deleteDocumentExtraVars', $obj);
1147
-		if(!$output->toBool())
1146
+		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
1147
+		if (!$output->toBool())
1148 1148
 		{
1149 1149
 			$oDB->rollback();
1150 1150
 			return $output;
1151 1151
 		}
1152 1152
 
1153
-		if($var_idx != NULL)
1153
+		if ($var_idx != NULL)
1154 1154
 		{
1155 1155
 			$output = $oDB->executeQuery('document.updateDocumentExtraVarIdxOrder', $obj);
1156
-			if(!$output->toBool())
1156
+			if (!$output->toBool())
1157 1157
 			{
1158 1158
 				$oDB->rollback();
1159 1159
 				return $output;
@@ -1163,9 +1163,9 @@  discard block
 block discarded – undo
1163 1163
 		$oDB->commit();
1164 1164
 
1165 1165
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
1166
-		if($oCacheHandler->isSupport())
1166
+		if ($oCacheHandler->isSupport())
1167 1167
 		{
1168
-			$object_key = 'module_document_extra_keys:'.$module_srl;
1168
+			$object_key = 'module_document_extra_keys:' . $module_srl;
1169 1169
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1170 1170
 			$oCacheHandler->delete($cache_key);
1171 1171
 		}
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
 	 */
1186 1186
 	function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
1187 1187
 	{
1188
-		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request');
1189
-		if(!$lang_code) $lang_code = Context::getLangType();
1188
+		if (!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1, 'msg_invalid_request');
1189
+		if (!$lang_code) $lang_code = Context::getLangType();
1190 1190
 
1191 1191
 		$obj = new stdClass;
1192 1192
 		$obj->module_srl = $module_srl;
@@ -1212,10 +1212,10 @@  discard block
 block discarded – undo
1212 1212
 	{
1213 1213
 		$obj = new stdClass();
1214 1214
 		$obj->module_srl = $module_srl;
1215
-		if(!is_null($document_srl)) $obj->document_srl = $document_srl;
1216
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1217
-		if(!is_null($lang_code)) $obj->lang_code = $lang_code;
1218
-		if(!is_null($eid)) $obj->eid = $eid;
1215
+		if (!is_null($document_srl)) $obj->document_srl = $document_srl;
1216
+		if (!is_null($var_idx)) $obj->var_idx = $var_idx;
1217
+		if (!is_null($lang_code)) $obj->lang_code = $lang_code;
1218
+		if (!is_null($eid)) $obj->eid = $eid;
1219 1219
 		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
1220 1220
 		return $output;
1221 1221
 	}
@@ -1229,10 +1229,10 @@  discard block
 block discarded – undo
1229 1229
 	 */
1230 1230
 	function updateVotedCount($document_srl, $point = 1)
1231 1231
 	{
1232
-		if($point > 0) $failed_voted = 'failed_voted';
1232
+		if ($point > 0) $failed_voted = 'failed_voted';
1233 1233
 		else $failed_voted = 'failed_blamed';
1234 1234
 		// Return fail if session already has information about votes
1235
-		if($_SESSION['voted_document'][$document_srl])
1235
+		if ($_SESSION['voted_document'][$document_srl])
1236 1236
 		{
1237 1237
 			return new Object(-1, $failed_voted);
1238 1238
 		}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 		$oDocumentModel = getModel('document');
1241 1241
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
1242 1242
 		// Pass if the author's IP address is as same as visitor's.
1243
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1243
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1244 1244
 		{
1245 1245
 			$_SESSION['voted_document'][$document_srl] = true;
1246 1246
 			return new Object(-1, $failed_voted);
@@ -1251,10 +1251,10 @@  discard block
 block discarded – undo
1251 1251
 		$member_srl = $oMemberModel->getLoggedMemberSrl();
1252 1252
 
1253 1253
 		// Check if document's author is a member.
1254
-		if($oDocument->get('member_srl'))
1254
+		if ($oDocument->get('member_srl'))
1255 1255
 		{
1256 1256
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
1257
-			if($member_srl && $member_srl == $oDocument->get('member_srl'))
1257
+			if ($member_srl && $member_srl == $oDocument->get('member_srl'))
1258 1258
 			{
1259 1259
 				$_SESSION['voted_document'][$document_srl] = true;
1260 1260
 				return new Object(-1, $failed_voted);
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
 		// Use member_srl for logged-in members and IP address for non-members.
1265 1265
 		$args = new stdClass;
1266
-		if($member_srl)
1266
+		if ($member_srl)
1267 1267
 		{
1268 1268
 			$args->member_srl = $member_srl;
1269 1269
 		}
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
 		$args->document_srl = $document_srl;
1275 1275
 		$output = executeQuery('document.getDocumentVotedLogInfo', $args);
1276 1276
 		// Pass after registering a session if log information has vote-up logs
1277
-		if($output->data->count)
1277
+		if ($output->data->count)
1278 1278
 		{
1279 1279
 			$_SESSION['voted_document'][$document_srl] = true;
1280 1280
 			return new Object(-1, $failed_voted);
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 		$oDB->begin();
1286 1286
 
1287 1287
 		// Update the voted count
1288
-		if($point < 0)
1288
+		if ($point < 0)
1289 1289
 		{
1290 1290
 			$args->blamed_count = $oDocument->get('blamed_count') + $point;
1291 1291
 			$output = executeQuery('document.updateBlamedCount', $args);
@@ -1295,11 +1295,11 @@  discard block
 block discarded – undo
1295 1295
 			$args->voted_count = $oDocument->get('voted_count') + $point;
1296 1296
 			$output = executeQuery('document.updateVotedCount', $args);
1297 1297
 		}
1298
-		if(!$output->toBool()) return $output;
1298
+		if (!$output->toBool()) return $output;
1299 1299
 		// Leave logs
1300 1300
 		$args->point = $point;
1301 1301
 		$output = executeQuery('document.insertDocumentVotedLog', $args);
1302
-		if(!$output->toBool()) return $output;
1302
+		if (!$output->toBool()) return $output;
1303 1303
 
1304 1304
 		$obj = new stdClass;
1305 1305
 		$obj->member_srl = $oDocument->get('member_srl');
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		$obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count');
1311 1311
 		$obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count;
1312 1312
 		$trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj);
1313
-		if(!$trigger_output->toBool())
1313
+		if (!$trigger_output->toBool())
1314 1314
 		{
1315 1315
 			$oDB->rollback();
1316 1316
 			return $trigger_output;
@@ -1319,10 +1319,10 @@  discard block
 block discarded – undo
1319 1319
 		$oDB->commit();
1320 1320
 
1321 1321
 		$oCacheHandler = CacheHandler::getInstance('object');
1322
-		if($oCacheHandler->isSupport())
1322
+		if ($oCacheHandler->isSupport())
1323 1323
 		{
1324 1324
 			//remove document item from cache
1325
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1325
+			$cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
1326 1326
 			$oCacheHandler->delete($cache_key);
1327 1327
 		}
1328 1328
 
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 
1332 1332
 		// Return result
1333 1333
 		$output = new Object();
1334
-		if($point > 0)
1334
+		if ($point > 0)
1335 1335
 		{
1336 1336
 			$output->setMessage('success_voted');
1337 1337
 			$output->add('voted_count', $obj->after_point);
@@ -1353,13 +1353,13 @@  discard block
 block discarded – undo
1353 1353
 	function declaredDocument($document_srl)
1354 1354
 	{
1355 1355
 		// Fail if session information already has a reported document
1356
-		if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
1356
+		if ($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
1357 1357
 
1358 1358
 		// Check if previously reported
1359 1359
 		$args = new stdClass();
1360 1360
 		$args->document_srl = $document_srl;
1361 1361
 		$output = executeQuery('document.getDeclaredDocument', $args);
1362
-		if(!$output->toBool()) return $output;
1362
+		if (!$output->toBool()) return $output;
1363 1363
 
1364 1364
 		$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
1365 1365
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 
1370 1370
 		// Call a trigger (before)
1371 1371
 		$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj);
1372
-		if(!$trigger_output->toBool())
1372
+		if (!$trigger_output->toBool())
1373 1373
 		{
1374 1374
 			return $trigger_output;
1375 1375
 		}
@@ -1379,19 +1379,19 @@  discard block
 block discarded – undo
1379 1379
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
1380 1380
 
1381 1381
 		// Pass if the author's IP address is as same as visitor's.
1382
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
1382
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
1383 1383
 			$_SESSION['declared_document'][$document_srl] = true;
1384 1384
 			return new Object(-1, 'failed_declared');
1385 1385
 		}
1386 1386
 
1387 1387
 		// Check if document's author is a member.
1388
-		if($oDocument->get('member_srl'))
1388
+		if ($oDocument->get('member_srl'))
1389 1389
 		{
1390 1390
 			// Create a member model object
1391 1391
 			$oMemberModel = getModel('member');
1392 1392
 			$member_srl = $oMemberModel->getLoggedMemberSrl();
1393 1393
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
1394
-			if($member_srl && $member_srl == $oDocument->get('member_srl'))
1394
+			if ($member_srl && $member_srl == $oDocument->get('member_srl'))
1395 1395
 			{
1396 1396
 				$_SESSION['declared_document'][$document_srl] = true;
1397 1397
 				return new Object(-1, 'failed_declared');
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 		// Use member_srl for logged-in members and IP address for non-members.
1402 1402
 		$args = new stdClass;
1403
-		if($member_srl)
1403
+		if ($member_srl)
1404 1404
 		{
1405 1405
 			$args->member_srl = $member_srl;
1406 1406
 		}
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 		$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
1414 1414
 
1415 1415
 		// Pass after registering a sesson if reported/declared documents are in the logs.
1416
-		if($output->data->count)
1416
+		if ($output->data->count)
1417 1417
 		{
1418 1418
 			$_SESSION['declared_document'][$document_srl] = true;
1419 1419
 			return new Object(-1, 'failed_declared');
@@ -1424,23 +1424,23 @@  discard block
 block discarded – undo
1424 1424
 		$oDB->begin();
1425 1425
 
1426 1426
 		// Add the declared document
1427
-		if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1427
+		if ($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1428 1428
 		else $output = executeQuery('document.insertDeclaredDocument', $args);
1429
-		if(!$output->toBool()) return $output;
1429
+		if (!$output->toBool()) return $output;
1430 1430
 		// Leave logs
1431 1431
 		$output = executeQuery('document.insertDocumentDeclaredLog', $args);
1432
-		if(!$output->toBool())
1432
+		if (!$output->toBool())
1433 1433
 		{
1434 1434
 			$oDB->rollback();
1435 1435
 			return $output;
1436 1436
 		}
1437 1437
 
1438
-		$this->add('declared_count', $declared_count+1);
1438
+		$this->add('declared_count', $declared_count + 1);
1439 1439
 
1440 1440
 		// Call a trigger (after)
1441 1441
 		$trigger_obj->declared_count = $declared_count + 1;
1442 1442
 		$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj);
1443
-		if(!$trigger_output->toBool())
1443
+		if (!$trigger_output->toBool())
1444 1444
 		{
1445 1445
 			$oDB->rollback();
1446 1446
 			return $trigger_output;
@@ -1470,16 +1470,16 @@  discard block
 block discarded – undo
1470 1470
 		$args->document_srl = $document_srl;
1471 1471
 		$args->comment_count = $comment_count;
1472 1472
 
1473
-		if($comment_inserted)
1473
+		if ($comment_inserted)
1474 1474
 		{
1475
-			$args->update_order = -1*getNextSequence();
1475
+			$args->update_order = -1 * getNextSequence();
1476 1476
 			$args->last_updater = $last_updater;
1477 1477
 
1478 1478
 			$oCacheHandler = CacheHandler::getInstance('object');
1479
-			if($oCacheHandler->isSupport())
1479
+			if ($oCacheHandler->isSupport())
1480 1480
 			{
1481 1481
 				//remove document item from cache
1482
-				$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1482
+				$cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
1483 1483
 				$oCacheHandler->delete($cache_key);
1484 1484
 			}
1485 1485
 		}
@@ -1500,10 +1500,10 @@  discard block
 block discarded – undo
1500 1500
 		$args->trackback_count = $trackback_count;
1501 1501
 
1502 1502
 		$oCacheHandler = CacheHandler::getInstance('object');
1503
-		if($oCacheHandler->isSupport())
1503
+		if ($oCacheHandler->isSupport())
1504 1504
 		{
1505 1505
 			//remove document item from cache
1506
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1506
+			$cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
1507 1507
 			$oCacheHandler->delete($cache_key);
1508 1508
 		}
1509 1509
 
@@ -1518,14 +1518,14 @@  discard block
 block discarded – undo
1518 1518
 	function insertCategory($obj)
1519 1519
 	{
1520 1520
 		// Sort the order to display if a child category is added
1521
-		if($obj->parent_srl)
1521
+		if ($obj->parent_srl)
1522 1522
 		{
1523 1523
 			// Get its parent category
1524 1524
 			$oDocumentModel = getModel('document');
1525 1525
 			$parent_category = $oDocumentModel->getCategory($obj->parent_srl);
1526 1526
 			$obj->list_order = $parent_category->list_order;
1527
-			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1);
1528
-			if(!$obj->category_srl) $obj->category_srl = getNextSequence();
1527
+			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order + 1);
1528
+			if (!$obj->category_srl) $obj->category_srl = getNextSequence();
1529 1529
 		}
1530 1530
 		else
1531 1531
 		{
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 		}
1534 1534
 
1535 1535
 		$output = executeQuery('document.insertCategory', $obj);
1536
-		if($output->toBool())
1536
+		if ($output->toBool())
1537 1537
 		{
1538 1538
 			$output->add('category_srl', $obj->category_srl);
1539 1539
 			$this->makeCategoryFile($obj->module_srl);
@@ -1567,13 +1567,13 @@  discard block
 block discarded – undo
1567 1567
 	{
1568 1568
 		// Create a document model object
1569 1569
 		$oDocumentModel = getModel('document');
1570
-		if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1570
+		if (!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl, $category_srl);
1571 1571
 
1572 1572
 		$args = new stdClass;
1573 1573
 		$args->category_srl = $category_srl;
1574 1574
 		$args->document_count = $document_count;
1575 1575
 		$output = executeQuery('document.updateCategoryCount', $args);
1576
-		if($output->toBool()) $this->makeCategoryFile($module_srl);
1576
+		if ($output->toBool()) $this->makeCategoryFile($module_srl);
1577 1577
 
1578 1578
 		return $output;
1579 1579
 	}
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 	function updateCategory($obj)
1587 1587
 	{
1588 1588
 		$output = executeQuery('document.updateCategory', $obj);
1589
-		if($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1589
+		if ($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1590 1590
 		return $output;
1591 1591
 	}
1592 1592
 
@@ -1603,32 +1603,32 @@  discard block
 block discarded – undo
1603 1603
 		$category_info = $oDocumentModel->getCategory($category_srl);
1604 1604
 		// Display an error that the category cannot be deleted if it has a child
1605 1605
 		$output = executeQuery('document.getChildCategoryCount', $args);
1606
-		if(!$output->toBool()) return $output;
1607
-		if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
1606
+		if (!$output->toBool()) return $output;
1607
+		if ($output->data->count > 0) return new Object(-1, 'msg_cannot_delete_for_child');
1608 1608
 		// Delete a category information
1609 1609
 		$output = executeQuery('document.deleteCategory', $args);
1610
-		if(!$output->toBool()) return $output;
1610
+		if (!$output->toBool()) return $output;
1611 1611
 
1612 1612
 		$this->makeCategoryFile($category_info->module_srl);
1613 1613
 		// remvove cache
1614 1614
 		$oCacheHandler = CacheHandler::getInstance('object');
1615
-		if($oCacheHandler->isSupport())
1615
+		if ($oCacheHandler->isSupport())
1616 1616
 		{
1617 1617
 			$page = 0;
1618
-			while(true) {
1618
+			while (true) {
1619 1619
 				$args = new stdClass();
1620 1620
 				$args->category_srl = $category_srl;
1621 1621
 				$args->list_count = 100;
1622 1622
 				$args->page = ++$page;
1623 1623
 				$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
1624 1624
 
1625
-				if($output->data == array())
1625
+				if ($output->data == array())
1626 1626
 					break;
1627 1627
 
1628
-				foreach($output->data as $val)
1628
+				foreach ($output->data as $val)
1629 1629
 				{
1630 1630
 					//remove document item from cache
1631
-					$cache_key = 'document_item:'. getNumberingPath($val->document_srl) . $val->document_srl;
1631
+					$cache_key = 'document_item:' . getNumberingPath($val->document_srl) . $val->document_srl;
1632 1632
 					$oCacheHandler->delete($cache_key);
1633 1633
 				}
1634 1634
 			}
@@ -1675,18 +1675,18 @@  discard block
 block discarded – undo
1675 1675
 		// Seek a full list of categories
1676 1676
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1677 1677
 		$category_srl_list = array_keys($category_list);
1678
-		if(count($category_srl_list)<2) return new Object();
1678
+		if (count($category_srl_list) < 2) return new Object();
1679 1679
 
1680 1680
 		$prev_category = NULL;
1681
-		foreach($category_list as $key => $val)
1681
+		foreach ($category_list as $key => $val)
1682 1682
 		{
1683
-			if($key==$category_srl) break;
1683
+			if ($key == $category_srl) break;
1684 1684
 			$prev_category = $val;
1685 1685
 		}
1686 1686
 		// Return if the previous category doesn't exist
1687
-		if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved'));
1687
+		if (!$prev_category) return new Object(-1, Context::getLang('msg_category_not_moved'));
1688 1688
 		// Return if the selected category is the top level
1689
-		if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
1689
+		if ($category_srl_list[0] == $category_srl) return new Object(-1, Context::getLang('msg_category_not_moved'));
1690 1690
 		// Information of the selected category
1691 1691
 		$cur_args = new stdClass;
1692 1692
 		$cur_args->category_srl = $category_srl;
@@ -1722,15 +1722,15 @@  discard block
 block discarded – undo
1722 1722
 		// Seek a full list of categories
1723 1723
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1724 1724
 		$category_srl_list = array_keys($category_list);
1725
-		if(count($category_srl_list)<2) return new Object();
1725
+		if (count($category_srl_list) < 2) return new Object();
1726 1726
 
1727
-		for($i=0;$i<count($category_srl_list);$i++)
1727
+		for ($i = 0; $i < count($category_srl_list); $i++)
1728 1728
 		{
1729
-			if($category_srl_list[$i]==$category_srl) break;
1729
+			if ($category_srl_list[$i] == $category_srl) break;
1730 1730
 		}
1731 1731
 
1732
-		$next_category_srl = $category_srl_list[$i+1];
1733
-		if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
1732
+		$next_category_srl = $category_srl_list[$i + 1];
1733
+		if (!$category_list[$next_category_srl]) return new Object(-1, Context::getLang('msg_category_not_moved'));
1734 1734
 		$next_category = $category_list[$next_category_srl];
1735 1735
 		// Information of the selected category
1736 1736
 		$cur_args = new stdClass;
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 	{
1758 1758
 		$oDocumentModel = getModel('document');
1759 1759
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
1760
-		if(!count($extra_keys)) return;
1760
+		if (!count($extra_keys)) return;
1761 1761
 
1762 1762
 		$js_code = array();
1763 1763
 		$js_code[] = '<script>//<![CDATA[';
@@ -1767,16 +1767,16 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
 		$logged_info = Context::get('logged_info');
1769 1769
 
1770
-		foreach($extra_keys as $idx => $val)
1770
+		foreach ($extra_keys as $idx => $val)
1771 1771
 		{
1772 1772
 			$idx = $val->idx;
1773
-			if($val->type == 'kr_zip')
1773
+			if ($val->type == 'kr_zip')
1774 1774
 			{
1775 1775
 				$idx .= '[]';
1776 1776
 			}
1777 1777
 			$name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name);
1778 1778
 			$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name);
1779
-			if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1779
+			if ($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1780 1780
 		}
1781 1781
 
1782 1782
 		$js_code[] = '})(jQuery);';
@@ -1794,12 +1794,12 @@  discard block
 block discarded – undo
1794 1794
 	function procDocumentInsertCategory($args = null)
1795 1795
 	{
1796 1796
 		// List variables
1797
-		if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
1797
+		if (!$args) $args = Context::gets('module_srl', 'category_srl', 'parent_srl', 'category_title', 'category_description', 'expand', 'group_srls', 'category_color', 'mid');
1798 1798
 		$args->title = $args->category_title;
1799 1799
 		$args->description = $args->category_description;
1800 1800
 		$args->color = $args->category_color;
1801 1801
 
1802
-		if(!$args->module_srl && $args->mid)
1802
+		if (!$args->module_srl && $args->mid)
1803 1803
 		{
1804 1804
 			$mid = $args->mid;
1805 1805
 			unset($args->mid);
@@ -1810,28 +1810,28 @@  discard block
 block discarded – undo
1810 1810
 		$columnList = array('module_srl', 'module');
1811 1811
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1812 1812
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1813
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1813
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1814 1814
 
1815
-		if($args->expand !="Y") $args->expand = "N";
1816
-		if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls);
1815
+		if ($args->expand != "Y") $args->expand = "N";
1816
+		if (!is_array($args->group_srls)) $args->group_srls = str_replace('|@|', ',', $args->group_srls);
1817 1817
 		else $args->group_srls = implode(',', $args->group_srls);
1818
-		$args->parent_srl = (int)$args->parent_srl;
1818
+		$args->parent_srl = (int) $args->parent_srl;
1819 1819
 
1820 1820
 		$oDocumentModel = getModel('document');
1821 1821
 
1822 1822
 		$oDB = &DB::getInstance();
1823 1823
 		$oDB->begin();
1824 1824
 		// Check if already exists
1825
-		if($args->category_srl)
1825
+		if ($args->category_srl)
1826 1826
 		{
1827 1827
 			$category_info = $oDocumentModel->getCategory($args->category_srl);
1828
-			if($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1828
+			if ($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1829 1829
 		}
1830 1830
 		// Update if exists
1831
-		if($args->category_srl)
1831
+		if ($args->category_srl)
1832 1832
 		{
1833 1833
 			$output = $this->updateCategory($args);
1834
-			if(!$output->toBool())
1834
+			if (!$output->toBool())
1835 1835
 			{
1836 1836
 				$oDB->rollback();
1837 1837
 				return $output;
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 		else
1842 1842
 		{
1843 1843
 			$output = $this->insertCategory($args);
1844
-			if(!$output->toBool())
1844
+			if (!$output->toBool())
1845 1845
 			{
1846 1846
 				$oDB->rollback();
1847 1847
 				return $output;
@@ -1880,11 +1880,11 @@  discard block
 block discarded – undo
1880 1880
 		$columnList = array('module_srl', 'module');
1881 1881
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
1882 1882
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1883
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1883
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1884 1884
 
1885 1885
 		// First child of the parent_category_srl
1886 1886
 		$source_args = new stdClass;
1887
-		if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
1887
+		if ($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
1888 1888
 		{
1889 1889
 			$parent_category = $oDocumentModel->getCategory($parent_category_srl);
1890 1890
 
@@ -1893,30 +1893,30 @@  discard block
 block discarded – undo
1893 1893
 			$args->parent_srl = $parent_category_srl;
1894 1894
 			$output = executeQuery('document.getChildCategoryMinListOrder', $args);
1895 1895
 
1896
-			if(!$output->toBool()) return $output;
1897
-			$args->list_order = (int)$output->data->list_order;
1898
-			if(!$args->list_order) $args->list_order = 0;
1896
+			if (!$output->toBool()) return $output;
1897
+			$args->list_order = (int) $output->data->list_order;
1898
+			if (!$args->list_order) $args->list_order = 0;
1899 1899
 			$args->list_order--;
1900 1900
 
1901 1901
 			$source_args->category_srl = $source_category_srl;
1902 1902
 			$source_args->parent_srl = $parent_category_srl;
1903 1903
 			$source_args->list_order = $args->list_order;
1904 1904
 			$output = $this->updateCategory($source_args);
1905
-			if(!$output->toBool()) return $output;
1905
+			if (!$output->toBool()) return $output;
1906 1906
 			// Sibling of the $target_category_srl
1907 1907
 		}
1908
-		else if($target_category_srl > 0)
1908
+		else if ($target_category_srl > 0)
1909 1909
 		{
1910 1910
 			$target_category = $oDocumentModel->getCategory($target_category_srl);
1911 1911
 			// Move all siblings of the $target_category down
1912
-			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1);
1913
-			if(!$output->toBool()) return $output;
1912
+			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order + 1);
1913
+			if (!$output->toBool()) return $output;
1914 1914
 
1915 1915
 			$source_args->category_srl = $source_category_srl;
1916 1916
 			$source_args->parent_srl = $target_category->parent_srl;
1917
-			$source_args->list_order = $target_category->list_order+1;
1917
+			$source_args->list_order = $target_category->list_order + 1;
1918 1918
 			$output = $this->updateCategory($source_args);
1919
-			if(!$output->toBool()) return $output;
1919
+			if (!$output->toBool()) return $output;
1920 1920
 		}
1921 1921
 		// Re-generate the xml file
1922 1922
 		$xml_file = $this->makeCategoryFile($source_category->module_srl);
@@ -1932,7 +1932,7 @@  discard block
 block discarded – undo
1932 1932
 	function procDocumentDeleteCategory()
1933 1933
 	{
1934 1934
 		// List variables
1935
-		$args = Context::gets('module_srl','category_srl');
1935
+		$args = Context::gets('module_srl', 'category_srl');
1936 1936
 
1937 1937
 		$oDB = &DB::getInstance();
1938 1938
 		$oDB->begin();
@@ -1941,17 +1941,17 @@  discard block
 block discarded – undo
1941 1941
 		$columnList = array('module_srl', 'module');
1942 1942
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1943 1943
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1944
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1944
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1945 1945
 
1946 1946
 		$oDocumentModel = getModel('document');
1947 1947
 		// Get original information
1948 1948
 		$category_info = $oDocumentModel->getCategory($args->category_srl);
1949
-		if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
1949
+		if ($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
1950 1950
 		// Display an error that the category cannot be deleted if it has a child node
1951
-		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
1951
+		if ($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
1952 1952
 		// Remove from the DB
1953 1953
 		$output = $this->deleteCategory($args->category_srl);
1954
-		if(!$output->toBool())
1954
+		if (!$output->toBool())
1955 1955
 		{
1956 1956
 			$oDB->rollback();
1957 1957
 			return $output;
@@ -1982,11 +1982,11 @@  discard block
 block discarded – undo
1982 1982
 		$columnList = array('module_srl', 'module');
1983 1983
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1984 1984
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1985
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1985
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1986 1986
 
1987 1987
 		$xml_file = $this->makeCategoryFile($module_srl);
1988 1988
 		// Set return value
1989
-		$this->add('xml_file',$xml_file);
1989
+		$this->add('xml_file', $xml_file);
1990 1990
 	}
1991 1991
 
1992 1992
 	/**
@@ -1997,14 +1997,14 @@  discard block
 block discarded – undo
1997 1997
 	function makeCategoryFile($module_srl)
1998 1998
 	{
1999 1999
 		// Return if there is no information you need for creating a cache file
2000
-		if(!$module_srl) return false;
2000
+		if (!$module_srl) return false;
2001 2001
 		// Get module information (to obtain mid)
2002 2002
 		$oModuleModel = getModel('module');
2003 2003
 		$columnList = array('module_srl', 'mid', 'site_srl');
2004 2004
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
2005 2005
 		$mid = $module_info->mid;
2006 2006
 
2007
-		if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
2007
+		if (!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
2008 2008
 		// Cache file's name
2009 2009
 		$xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl);
2010 2010
 		$php_file = sprintf("./files/cache/document_category/%s.php", $module_srl);
@@ -2016,17 +2016,17 @@  discard block
 block discarded – undo
2016 2016
 
2017 2017
 		$category_list = $output->data;
2018 2018
 
2019
-		if(!is_array($category_list)) $category_list = array($category_list);
2019
+		if (!is_array($category_list)) $category_list = array($category_list);
2020 2020
 
2021 2021
 		$category_count = count($category_list);
2022
-		for($i=0;$i<$category_count;$i++)
2022
+		for ($i = 0; $i < $category_count; $i++)
2023 2023
 		{
2024 2024
 			$category_srl = $category_list[$i]->category_srl;
2025
-			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
2025
+			if (!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
2026 2026
 			$list[$category_srl] = $category_list[$i];
2027 2027
 		}
2028 2028
 		// Create the xml file without node data if no data is obtained
2029
-		if(!$list)
2029
+		if (!$list)
2030 2030
 		{
2031 2031
 			$xml_buff = "<root />";
2032 2032
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -2034,47 +2034,47 @@  discard block
 block discarded – undo
2034 2034
 			return $xml_file;
2035 2035
 		}
2036 2036
 		// Change to an array if only a single data is obtained
2037
-		if(!is_array($list)) $list = array($list);
2037
+		if (!is_array($list)) $list = array($list);
2038 2038
 		// Create a tree for loop
2039
-		foreach($list as $category_srl => $node)
2039
+		foreach ($list as $category_srl => $node)
2040 2040
 		{
2041 2041
 			$node->mid = $mid;
2042
-			$parent_srl = (int)$node->parent_srl;
2042
+			$parent_srl = (int) $node->parent_srl;
2043 2043
 			$tree[$parent_srl][$category_srl] = $node;
2044 2044
 		}
2045 2045
 		// A common header to set permissions and groups of the cache file
2046 2046
 		$header_script =
2047
-			'$lang_type = Context::getLangType(); '.
2048
-			'$is_logged = Context::get(\'is_logged\'); '.
2049
-			'$logged_info = Context::get(\'logged_info\'); '.
2050
-			'if($is_logged) {'.
2051
-			'if($logged_info->is_admin=="Y") $is_admin = true; '.
2052
-			'else $is_admin = false; '.
2053
-			'$group_srls = array_keys($logged_info->group_list); '.
2054
-			'} else { '.
2055
-			'$is_admin = false; '.
2056
-			'$group_srsl = array(); '.
2057
-			'} '."\n";
2047
+			'$lang_type = Context::getLangType(); ' .
2048
+			'$is_logged = Context::get(\'is_logged\'); ' .
2049
+			'$logged_info = Context::get(\'logged_info\'); ' .
2050
+			'if($is_logged) {' .
2051
+			'if($logged_info->is_admin=="Y") $is_admin = true; ' .
2052
+			'else $is_admin = false; ' .
2053
+			'$group_srls = array_keys($logged_info->group_list); ' .
2054
+			'} else { ' .
2055
+			'$is_admin = false; ' .
2056
+			'$group_srsl = array(); ' .
2057
+			'} ' . "\n";
2058 2058
 
2059 2059
 		// Create the xml cache file (a separate session is needed for xml cache)
2060 2060
 		$xml_header_buff = '';
2061 2061
 		$xml_body_buff = $this->getXmlTree($tree[0], $tree, $module_info->site_srl, $xml_header_buff);
2062 2062
 		$xml_buff = sprintf(
2063
-			'<?php '.
2064
-			'define(\'__XE__\', true); '.
2065
-			'require_once(\''.FileHandler::getRealPath('./config/config.inc.php').'\'); '.
2066
-			'$oContext = &Context::getInstance(); '.
2067
-			'$oContext->init(); '.
2068
-			'header("Content-Type: text/xml; charset=UTF-8"); '.
2069
-			'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); '.
2070
-			'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); '.
2071
-			'header("Cache-Control: no-store, no-cache, must-revalidate"); '.
2072
-			'header("Cache-Control: post-check=0, pre-check=0", false); '.
2073
-			'header("Pragma: no-cache"); '.
2074
-			'%s'.
2075
-			'%s '.
2076
-			'$oContext->close();'.
2077
-			'?>'.
2063
+			'<?php ' .
2064
+			'define(\'__XE__\', true); ' .
2065
+			'require_once(\'' . FileHandler::getRealPath('./config/config.inc.php') . '\'); ' .
2066
+			'$oContext = &Context::getInstance(); ' .
2067
+			'$oContext->init(); ' .
2068
+			'header("Content-Type: text/xml; charset=UTF-8"); ' .
2069
+			'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); ' .
2070
+			'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); ' .
2071
+			'header("Cache-Control: no-store, no-cache, must-revalidate"); ' .
2072
+			'header("Cache-Control: post-check=0, pre-check=0", false); ' .
2073
+			'header("Pragma: no-cache"); ' .
2074
+			'%s' .
2075
+			'%s ' .
2076
+			'$oContext->close();' .
2077
+			'?>' .
2078 2078
 			'<root>%s</root>',
2079 2079
 			$header_script,
2080 2080
 			$xml_header_buff,
@@ -2085,11 +2085,11 @@  discard block
 block discarded – undo
2085 2085
 		$php_header_buff .= '$_descriptions = array();';
2086 2086
 		$php_output = $this->getPhpCacheCode($tree[0], $tree, $module_info->site_srl, $php_header_buff);
2087 2087
 		$php_buff = sprintf(
2088
-			'<?php '.
2089
-			'if(!defined("__XE__")) exit(); '.
2090
-			'%s'.
2091
-			'%s'.
2092
-			'$menu = new stdClass;'.
2088
+			'<?php ' .
2089
+			'if(!defined("__XE__")) exit(); ' .
2090
+			'%s' .
2091
+			'%s' .
2092
+			'$menu = new stdClass;' .
2093 2093
 			'$menu->list = array(%s); ',
2094 2094
 			$header_script,
2095 2095
 			$php_header_buff,
@@ -2113,13 +2113,13 @@  discard block
 block discarded – undo
2113 2113
 	 */
2114 2114
 	function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff)
2115 2115
 	{
2116
-		if(!$source_node) return;
2116
+		if (!$source_node) return;
2117 2117
 
2118
-		foreach($source_node as $category_srl => $node)
2118
+		foreach ($source_node as $category_srl => $node)
2119 2119
 		{
2120 2120
 			$child_buff = "";
2121 2121
 			// Get data of the child nodes
2122
-			if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
2122
+			if ($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
2123 2123
 			// List variables
2124 2124
 			$expand = $node->expand;
2125 2125
 			$group_srls = $node->group_srls;
@@ -2129,27 +2129,27 @@  discard block
 block discarded – undo
2129 2129
 			$color = $node->color;
2130 2130
 			$description = $node->description;
2131 2131
 			// If node->group_srls value exists
2132
-			if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
2132
+			if ($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $group_srls);
2133 2133
 			else $group_check_code = "true";
2134 2134
 
2135 2135
 			$title = $node->title;
2136 2136
 			$oModuleAdminModel = getAdminModel('module');
2137 2137
 
2138 2138
 			$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
2139
-			if(count($langs))
2139
+			if (count($langs))
2140 2140
 			{
2141
-				foreach($langs as $key => $val)
2141
+				foreach ($langs as $key => $val)
2142 2142
 				{
2143
-					$xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
2143
+					$xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
2144 2144
 				}
2145 2145
 			}
2146 2146
 
2147 2147
 			$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
2148
-			if(count($langx))
2148
+			if (count($langx))
2149 2149
 			{
2150
-				foreach($langx as $key => $val)
2150
+				foreach ($langx as $key => $val)
2151 2151
 				{
2152
-					$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
2152
+					$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
2153 2153
 				}
2154 2154
 			}
2155 2155
 
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
 				$category_srl,
2163 2163
 				$group_check_code,
2164 2164
 				$category_srl,
2165
-				getUrl('','mid',$node->mid,'category',$category_srl),
2165
+				getUrl('', 'mid', $node->mid, 'category', $category_srl),
2166 2166
 				$expand,
2167 2167
 				htmlspecialchars($color, ENT_COMPAT | ENT_HTML401, 'UTF-8', false),
2168 2168
 				$group_check_code,
@@ -2170,8 +2170,8 @@  discard block
 block discarded – undo
2170 2170
 				$node->document_count
2171 2171
 			);
2172 2172
 
2173
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2174
-			else $buff .=  sprintf('<node %s />', $attribute);
2173
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2174
+			else $buff .= sprintf('<node %s />', $attribute);
2175 2175
 		}
2176 2176
 		return $buff;
2177 2177
 	}
@@ -2190,13 +2190,13 @@  discard block
 block discarded – undo
2190 2190
 	function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff)
2191 2191
 	{
2192 2192
 		$output = array("buff"=>"", "category_srl_list"=>array());
2193
-		if(!$source_node) return $output;
2193
+		if (!$source_node) return $output;
2194 2194
 
2195 2195
 		// Set to an arraty for looping and then generate php script codes to be included
2196
-		foreach($source_node as $category_srl => $node)
2196
+		foreach ($source_node as $category_srl => $node)
2197 2197
 		{
2198 2198
 			// Get data from child nodes first if exist.
2199
-			if($category_srl && $tree[$category_srl]){
2199
+			if ($category_srl && $tree[$category_srl]) {
2200 2200
 				$child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff);
2201 2201
 			} else {
2202 2202
 				$child_output = array("buff"=>"", "category_srl_list"=>array());
@@ -2207,8 +2207,8 @@  discard block
 block discarded – undo
2207 2207
 			$output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']);
2208 2208
 
2209 2209
 			// If node->group_srls value exists
2210
-			if($node->group_srls) {
2211
-				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls);
2210
+			if ($node->group_srls) {
2211
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $node->group_srls);
2212 2212
 			} else {
2213 2213
 				$group_check_code = "true";
2214 2214
 			}
@@ -2223,32 +2223,32 @@  discard block
 block discarded – undo
2223 2223
 			$oModuleAdminModel = getAdminModel('module');
2224 2224
 			$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
2225 2225
 
2226
-			if(count($langs))
2226
+			if (count($langs))
2227 2227
 			{
2228
-				foreach($langs as $key => $val)
2228
+				foreach ($langs as $key => $val)
2229 2229
 				{
2230 2230
 					$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2231 2231
 					$php_header_buff .= sprintf(
2232 2232
 						'$_titles[%d]["%s"] = "%s"; ',
2233 2233
 						$category_srl,
2234 2234
 						$key,
2235
-						str_replace('"','\\"', $val)
2235
+						str_replace('"', '\\"', $val)
2236 2236
 					);
2237 2237
 				}
2238 2238
 			}
2239 2239
 
2240 2240
 			$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
2241 2241
 
2242
-			if(count($langx))
2242
+			if (count($langx))
2243 2243
 			{
2244
-				foreach($langx as $key => $val)
2244
+				foreach ($langx as $key => $val)
2245 2245
 				{
2246 2246
 					$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2247 2247
 					$php_header_buff .= sprintf(
2248 2248
 						'$_descriptions[%d]["%s"] = "%s"; ',
2249 2249
 						$category_srl,
2250 2250
 						$key,
2251
-						str_replace('"','\\"', $val)
2251
+						str_replace('"', '\\"', $val)
2252 2252
 					);
2253 2253
 				}
2254 2254
 			}
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 			);
2273 2273
 
2274 2274
 			// Generate buff data
2275
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->category_srl, $attribute);
2275
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute);
2276 2276
 		}
2277 2277
 
2278 2278
 		return $output;
@@ -2289,7 +2289,7 @@  discard block
 block discarded – undo
2289 2289
 	function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self')
2290 2290
 	{
2291 2291
 		$document_popup_menu_list = Context::get('document_popup_menu_list');
2292
-		if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2292
+		if (!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2293 2293
 
2294 2294
 		$obj = new stdClass();
2295 2295
 		$obj->url = $url;
@@ -2307,68 +2307,68 @@  discard block
 block discarded – undo
2307 2307
 	 */
2308 2308
 	function procDocumentAddCart()
2309 2309
 	{
2310
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2310
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2311 2311
 
2312 2312
 		// Get document_srl
2313
-		$srls = explode(',',Context::get('srls'));
2314
-		for($i = 0; $i < count($srls); $i++)
2313
+		$srls = explode(',', Context::get('srls'));
2314
+		for ($i = 0; $i < count($srls); $i++)
2315 2315
 		{
2316 2316
 			$srl = trim($srls[$i]);
2317 2317
 
2318
-			if(!$srl) continue;
2318
+			if (!$srl) continue;
2319 2319
 
2320 2320
 			$document_srls[] = $srl;
2321 2321
 		}
2322
-		if(!count($document_srls)) return;
2322
+		if (!count($document_srls)) return;
2323 2323
 
2324 2324
 		// Get module_srl of the documents
2325 2325
 		$args = new stdClass;
2326 2326
 		$args->list_count = count($document_srls);
2327
-		$args->document_srls = implode(',',$document_srls);
2327
+		$args->document_srls = implode(',', $document_srls);
2328 2328
 		$args->order_type = 'asc';
2329 2329
 		$output = executeQueryArray('document.getDocuments', $args);
2330
-		if(!$output->data) return new Object();
2330
+		if (!$output->data) return new Object();
2331 2331
 
2332 2332
 		unset($document_srls);
2333
-		foreach($output->data as $key => $val)
2333
+		foreach ($output->data as $key => $val)
2334 2334
 		{
2335 2335
 			$document_srls[$val->module_srl][] = $val->document_srl;
2336 2336
 		}
2337
-		if(!$document_srls || !count($document_srls)) return new Object();
2337
+		if (!$document_srls || !count($document_srls)) return new Object();
2338 2338
 
2339 2339
 		// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
2340 2340
 		$oModuleModel = getModel('module');
2341 2341
 		$module_srls = array_keys($document_srls);
2342
-		for($i=0;$i<count($module_srls);$i++)
2342
+		for ($i = 0; $i < count($module_srls); $i++)
2343 2343
 		{
2344 2344
 			$module_srl = $module_srls[$i];
2345 2345
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
2346 2346
 			$logged_info = Context::get('logged_info');
2347
-			if($logged_info->is_admin != 'Y')
2347
+			if ($logged_info->is_admin != 'Y')
2348 2348
 			{
2349
-				if(!$module_info)
2349
+				if (!$module_info)
2350 2350
 				{
2351 2351
 					unset($document_srls[$module_srl]);
2352 2352
 					continue;
2353 2353
 				}
2354 2354
 				$grant = $oModuleModel->getGrant($module_info, $logged_info);
2355
-				if(!$grant->manager)
2355
+				if (!$grant->manager)
2356 2356
 				{
2357 2357
 					unset($document_srls[$module_srl]);
2358 2358
 					continue;
2359 2359
 				}
2360 2360
 			}
2361 2361
 		}
2362
-		if(!count($document_srls)) return new Object();
2362
+		if (!count($document_srls)) return new Object();
2363 2363
 
2364
-		foreach($document_srls as $module_srl => $documents)
2364
+		foreach ($document_srls as $module_srl => $documents)
2365 2365
 		{
2366 2366
 			$cnt = count($documents);
2367
-			for($i=0;$i<$cnt;$i++)
2367
+			for ($i = 0; $i < $cnt; $i++)
2368 2368
 			{
2369
-				$document_srl = (int)trim($documents[$i]);
2370
-				if(!$document_srls) continue;
2371
-				if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2369
+				$document_srl = (int) trim($documents[$i]);
2370
+				if (!$document_srls) continue;
2371
+				if ($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2372 2372
 				else $_SESSION['document_management'][$document_srl] = true;
2373 2373
 			}
2374 2374
 		}
@@ -2381,9 +2381,9 @@  discard block
 block discarded – undo
2381 2381
 	function procDocumentManageCheckedDocument()
2382 2382
 	{
2383 2383
 		@set_time_limit(0);
2384
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2384
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2385 2385
 
2386
-		if(!checkCSRF())
2386
+		if (!checkCSRF())
2387 2387
 		{
2388 2388
 			return new Object(-1, 'msg_invalid_request');
2389 2389
 		}
@@ -2391,44 +2391,44 @@  discard block
 block discarded – undo
2391 2391
 		$type = Context::get('type');
2392 2392
 		$target_module = Context::get('target_module');
2393 2393
 		$module_srl = Context::get('module_srl');
2394
-		if($target_module && !$module_srl) $module_srl = $target_module;
2394
+		if ($target_module && !$module_srl) $module_srl = $target_module;
2395 2395
 		$category_srl = Context::get('target_category');
2396 2396
 		$message_content = Context::get('message_content');
2397
-		if($message_content) $message_content = nl2br($message_content);
2397
+		if ($message_content) $message_content = nl2br($message_content);
2398 2398
 
2399 2399
 		$cart = Context::get('cart');
2400
-		if(!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2400
+		if (!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2401 2401
 		else $document_srl_list = $cart;
2402 2402
 
2403 2403
 		$document_srl_count = count($document_srl_list);
2404 2404
 
2405 2405
 		$oDocumentModel = getModel('document');
2406 2406
 		$document_items = array();
2407
-		foreach($document_srl_list as $document_srl)
2407
+		foreach ($document_srl_list as $document_srl)
2408 2408
 		{
2409 2409
 			$oDocument = $oDocumentModel->getDocument($document_srl);
2410 2410
 			$document_items[] = $oDocument;
2411
-			if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2411
+			if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2412 2412
 		}
2413 2413
 
2414 2414
 		// Send a message
2415
-		if($message_content)
2415
+		if ($message_content)
2416 2416
 		{
2417 2417
 
2418 2418
 			$oCommunicationController = getController('communication');
2419 2419
 
2420 2420
 			$logged_info = Context::get('logged_info');
2421 2421
 
2422
-			$title = cut_str($message_content,10,'...');
2422
+			$title = cut_str($message_content, 10, '...');
2423 2423
 			$sender_member_srl = $logged_info->member_srl;
2424 2424
 
2425
-			foreach($document_items as $oDocument)
2425
+			foreach ($document_items as $oDocument)
2426 2426
 			{
2427
-				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
2427
+				if (!$oDocument->get('member_srl') || $oDocument->get('member_srl') == $sender_member_srl) continue;
2428 2428
 
2429
-				if($type=='move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2429
+				if ($type == 'move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2430 2430
 				else $purl = "";
2431
-				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2431
+				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s", $message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2432 2432
 
2433 2433
 				$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
2434 2434
 			}
@@ -2438,54 +2438,54 @@  discard block
 block discarded – undo
2438 2438
 		$oSpamController->setAvoidLog();
2439 2439
 
2440 2440
 		$oDocumentAdminController = getAdminController('document');
2441
-		if($type == 'move')
2441
+		if ($type == 'move')
2442 2442
 		{
2443
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2443
+			if (!$module_srl) return new Object(-1, 'fail_to_move');
2444 2444
 
2445 2445
 			$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
2446
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2446
+			if (!$output->toBool()) return new Object(-1, 'fail_to_move');
2447 2447
 
2448 2448
 			$msg_code = 'success_moved';
2449 2449
 
2450 2450
 		}
2451
-		else if($type == 'copy')
2451
+		else if ($type == 'copy')
2452 2452
 		{
2453
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2453
+			if (!$module_srl) return new Object(-1, 'fail_to_move');
2454 2454
 
2455 2455
 			$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
2456
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2456
+			if (!$output->toBool()) return new Object(-1, 'fail_to_move');
2457 2457
 
2458 2458
 			$msg_code = 'success_copied';
2459 2459
 		}
2460
-		else if($type =='delete')
2460
+		else if ($type == 'delete')
2461 2461
 		{
2462 2462
 			$oDB = &DB::getInstance();
2463 2463
 			$oDB->begin();
2464
-			for($i=0;$i<$document_srl_count;$i++)
2464
+			for ($i = 0; $i < $document_srl_count; $i++)
2465 2465
 			{
2466 2466
 				$document_srl = $document_srl_list[$i];
2467 2467
 				$output = $this->deleteDocument($document_srl, true);
2468
-				if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
2468
+				if (!$output->toBool()) return new Object(-1, 'fail_to_delete');
2469 2469
 			}
2470 2470
 			$oDB->commit();
2471 2471
 			$msg_code = 'success_deleted';
2472 2472
 		}
2473
-		else if($type == 'trash')
2473
+		else if ($type == 'trash')
2474 2474
 		{
2475 2475
 			$args = new stdClass();
2476 2476
 			$args->description = $message_content;
2477 2477
 
2478 2478
 			$oDB = &DB::getInstance();
2479 2479
 			$oDB->begin();
2480
-			for($i=0;$i<$document_srl_count;$i++) {
2480
+			for ($i = 0; $i < $document_srl_count; $i++) {
2481 2481
 				$args->document_srl = $document_srl_list[$i];
2482 2482
 				$output = $this->moveDocumentToTrash($args);
2483
-				if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
2483
+				if (!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
2484 2484
 			}
2485 2485
 			$oDB->commit();
2486 2486
 			$msg_code = 'success_trashed';
2487 2487
 		}
2488
-		else if($type == 'cancelDeclare')
2488
+		else if ($type == 'cancelDeclare')
2489 2489
 		{
2490 2490
 			$args->document_srl = $document_srl_list;
2491 2491
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
@@ -2507,27 +2507,27 @@  discard block
 block discarded – undo
2507 2507
 	function procDocumentInsertModuleConfig()
2508 2508
 	{
2509 2509
 		$module_srl = Context::get('target_module_srl');
2510
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
2510
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
2511 2511
 		else $module_srl = array($module_srl);
2512 2512
 
2513 2513
 		$document_config = new stdClass();
2514 2514
 		$document_config->use_history = Context::get('use_history');
2515
-		if(!$document_config->use_history) $document_config->use_history = 'N';
2515
+		if (!$document_config->use_history) $document_config->use_history = 'N';
2516 2516
 
2517 2517
 		$document_config->use_vote_up = Context::get('use_vote_up');
2518
-		if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2518
+		if (!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2519 2519
 
2520 2520
 		$document_config->use_vote_down = Context::get('use_vote_down');
2521
-		if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2521
+		if (!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2522 2522
 
2523 2523
 		$document_config->use_status = Context::get('use_status');
2524 2524
 
2525 2525
 		$oModuleController = getController('module');
2526
-		for($i=0;$i<count($module_srl);$i++)
2526
+		for ($i = 0; $i < count($module_srl); $i++)
2527 2527
 		{
2528 2528
 			$srl = trim($module_srl[$i]);
2529
-			if(!$srl) continue;
2530
-			$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
2529
+			if (!$srl) continue;
2530
+			$output = $oModuleController->insertModulePartConfig('document', $srl, $document_config);
2531 2531
 		}
2532 2532
 		$this->setError(-1);
2533 2533
 		$this->setMessage('success_updated', 'info');
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 	function procDocumentTempSave()
2544 2544
 	{
2545 2545
 		// Check login information
2546
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
2546
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
2547 2547
 		$module_info = Context::get('module_info');
2548 2548
 		$logged_info = Context::get('logged_info');
2549 2549
 
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
 		unset($obj->is_notice);
2556 2556
 
2557 2557
 		// Extract from beginning part of contents in the guestbook
2558
-		if(!$obj->title)
2558
+		if (!$obj->title)
2559 2559
 		{
2560 2560
 			$obj->title = cut_str(strip_tags($obj->content), 20, '...');
2561 2561
 		}
@@ -2566,13 +2566,13 @@  discard block
 block discarded – undo
2566 2566
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
2567 2567
 
2568 2568
 		// Update if already exists
2569
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
2569
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
2570 2570
 		{
2571
-			if($oDocument->get('module_srl') != $obj->module_srl)
2571
+			if ($oDocument->get('module_srl') != $obj->module_srl)
2572 2572
 			{
2573 2573
 				return new Object(-1, 'msg_invalid_request');
2574 2574
 			}
2575
-			if(!$oDocument->isGranted())
2575
+			if (!$oDocument->isGranted())
2576 2576
 			{
2577 2577
 				return new Object(-1, 'msg_invalid_request');
2578 2578
 			}
@@ -2590,7 +2590,7 @@  discard block
 block discarded – undo
2590 2590
 			$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
2591 2591
 		}
2592 2592
 		// Set the attachment to be invalid state
2593
-		if($oDocument->hasUploadedFiles())
2593
+		if ($oDocument->hasUploadedFiles())
2594 2594
 		{
2595 2595
 			$args = new stdClass;
2596 2596
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -2608,11 +2608,11 @@  discard block
 block discarded – undo
2608 2608
 	 */
2609 2609
 	function procDocumentGetList()
2610 2610
 	{
2611
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2611
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2612 2612
 		$documentSrls = Context::get('document_srls');
2613
-		if($documentSrls) $documentSrlList = explode(',', $documentSrls);
2613
+		if ($documentSrls) $documentSrlList = explode(',', $documentSrls);
2614 2614
 
2615
-		if(count($documentSrlList) > 0)
2615
+		if (count($documentSrlList) > 0)
2616 2616
 		{
2617 2617
 			$oDocumentModel = getModel('document');
2618 2618
 			$columnList = array('document_srl', 'title', 'nick_name', 'status');
@@ -2636,10 +2636,10 @@  discard block
 block discarded – undo
2636 2636
 	 */
2637 2637
 	function _checkCommentStatusForOldVersion(&$obj)
2638 2638
 	{
2639
-		if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2640
-		if(!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2639
+		if (!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2640
+		if (!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2641 2641
 
2642
-		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2642
+		if ($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2643 2643
 		else $obj->commentStatus = 'DENY';
2644 2644
 	}
2645 2645
 
@@ -2650,8 +2650,8 @@  discard block
 block discarded – undo
2650 2650
 	 */
2651 2651
 	function _checkDocumentStatusForOldVersion(&$obj)
2652 2652
 	{
2653
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2654
-		if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2653
+		if (!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2654
+		if (!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2655 2655
 	}
2656 2656
 
2657 2657
 	public function updateUploaedCount($documentSrlList)
@@ -2659,10 +2659,10 @@  discard block
 block discarded – undo
2659 2659
 		$oDocumentModel = getModel('document');
2660 2660
 		$oFileModel = getModel('file');
2661 2661
 
2662
-		if(is_array($documentSrlList))
2662
+		if (is_array($documentSrlList))
2663 2663
 		{
2664 2664
 			$documentSrlList = array_unique($documentSrlList);
2665
-			foreach($documentSrlList AS $key => $documentSrl)
2665
+			foreach ($documentSrlList AS $key => $documentSrl)
2666 2666
 			{
2667 2667
 				$fileCount = $oFileModel->getFilesCount($documentSrl);
2668 2668
 				$args = new stdClass();
@@ -2683,14 +2683,14 @@  discard block
 block discarded – undo
2683 2683
 		$oDocumentModel = getModel('document');
2684 2684
 		$documentExtraKeys = $oDocumentModel->getExtraKeys($obj->originModuleSrl);
2685 2685
 
2686
-		if(is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
2686
+		if (is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
2687 2687
 		{
2688
-			$oDocumentController=getController('document');
2689
-			foreach($obj->moduleSrlList AS $key=>$value)
2688
+			$oDocumentController = getController('document');
2689
+			foreach ($obj->moduleSrlList AS $key=>$value)
2690 2690
 			{
2691
-				foreach($documentExtraKeys AS $extraItem)
2691
+				foreach ($documentExtraKeys AS $extraItem)
2692 2692
 				{
2693
-					$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required , $extraItem->search , $extraItem->default , $extraItem->desc, $extraItem->eid) ;
2693
+					$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required, $extraItem->search, $extraItem->default, $extraItem->desc, $extraItem->eid);
2694 2694
 				}
2695 2695
 			}
2696 2696
 		}
@@ -2702,9 +2702,9 @@  discard block
 block discarded – undo
2702 2702
 		$documentConfig = $oModuleModel->getModulePartConfig('document', $obj->originModuleSrl);
2703 2703
 
2704 2704
 		$oModuleController = getController('module');
2705
-		if(is_array($obj->moduleSrlList))
2705
+		if (is_array($obj->moduleSrlList))
2706 2706
 		{
2707
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
2707
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
2708 2708
 			{
2709 2709
 				$oModuleController->insertModulePartConfig('document', $moduleSrl, $documentConfig);
2710 2710
 			}
Please login to merge, or discard this patch.
Braces   +563 added lines, -239 removed lines patch added patch discarded remove patch
@@ -25,27 +25,35 @@  discard block
 block discarded – undo
25 25
 		$oModuleModel = getModel('module');
26 26
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl(Context::get('module_srl'), $columnList);
27 27
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
28
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
28
+		if(!$grant->manager) {
29
+			return new Object(-1,'msg_not_permitted');
30
+		}
29 31
 		
30
-		if(!Context::get('is_logged'))
31
-			return new Object(-1, 'msg_invalid_request');
32
+		if(!Context::get('is_logged')) {
33
+					return new Object(-1, 'msg_invalid_request');
34
+		}
32 35
 		
33 36
 		$document_srl = Context::get('documentsrl');
34 37
 
35 38
 		$point = Context::get('point');
36 39
 		
37
-		if(!$document_srl) return;
38
-		
39
-		if($point > 10)
40
-			return;
41
-		if($point > 0)
42
-			$failed_voted = 'failed_voted';
43
-		else
40
+		if(!$document_srl) {
44 41
 			return;
42
+		}
43
+		
44
+		if($point > 10) {
45
+					return;
46
+		}
47
+		if($point > 0) {
48
+					$failed_voted = 'failed_voted';
49
+		} else {
50
+					return;
51
+		}
45 52
 		
46 53
 		// Return fail if session already has information about votes
47
-		if($_SESSION['rate_document'][$document_srl])
48
-			return new Object(-1, $failed_voted);
54
+		if($_SESSION['rate_document'][$document_srl]) {
55
+					return new Object(-1, $failed_voted);
56
+		}
49 57
 		
50 58
 		// Get the original document
51 59
 		$oDocumentModel = getModel('document');
@@ -77,8 +85,7 @@  discard block
 block discarded – undo
77 85
 		if($member_srl)
78 86
 		{
79 87
 			$args->member_srl = $member_srl;
80
-		}
81
-		else
88
+		} else
82 89
 		{
83 90
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
84 91
 		}
@@ -99,13 +106,14 @@  discard block
 block discarded – undo
99 106
 		if($point < 0)
100 107
 		{
101 108
 			return $point;
102
-		}
103
-		else
109
+		} else
104 110
 		{
105 111
 			$args->rateval = $oDocument->get('rateval') + $point;
106 112
 			$output = executeQuery('document.updateRateCount', $args);
107 113
 		}
108
-		if(!$output->toBool()) return $output;
114
+		if(!$output->toBool()) {
115
+			return $output;
116
+		}
109 117
 		// Leave logs
110 118
 		$args->point = $point;
111 119
 		$output = executeQuery('document.insertDocumentRateLog', $args);
@@ -145,8 +153,7 @@  discard block
 block discarded – undo
145 153
 		{
146 154
 			$output->setMessage('success_voted');
147 155
 			$output->add('rateval', $obj->after_point);
148
-		}
149
-		else
156
+		} else
150 157
 		{
151 158
 			return $point;
152 159
 		}
@@ -156,8 +163,7 @@  discard block
 block discarded – undo
156 163
 		if($point < 0)
157 164
 		{
158 165
 			return $point;
159
-		}
160
-		else
166
+		} else
161 167
 		{
162 168
 			$args->ratecnt = $oDocument->get('ratecnt') + 1;
163 169
 			$output = executeQuery('document.updateRatecntCount', $args);
@@ -169,8 +175,7 @@  discard block
 block discarded – undo
169 175
 		if($point < 0)
170 176
 		{
171 177
 			return $point;
172
-		}
173
-		else
178
+		} else
174 179
 		{
175 180
 			$args->ratecalc = ($oDocument->get('rateval') + $point)/($oDocument->get('ratecnt') + 1);
176 181
 			$output = executeQuery('document.updateRatecalcCount', $args);
@@ -188,19 +193,27 @@  discard block
 block discarded – undo
188 193
 	 */
189 194
 	function procDocumentVoteUp()
190 195
 	{
191
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
196
+		if(!Context::get('is_logged')) {
197
+			return new Object(-1, 'msg_invalid_request');
198
+		}
192 199
 
193 200
 		$document_srl = Context::get('target_srl');
194
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
201
+		if(!$document_srl) {
202
+			return new Object(-1, 'msg_invalid_request');
203
+		}
195 204
 
196 205
 		$oDocumentModel = getModel('document');
197 206
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
198 207
 		$module_srl = $oDocument->get('module_srl');
199
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
208
+		if(!$module_srl) {
209
+			return new Object(-1, 'msg_invalid_request');
210
+		}
200 211
 
201 212
 		$oModuleModel = getModel('module');
202 213
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
203
-		if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request');
214
+		if($document_config->use_vote_up=='N') {
215
+			return new Object(-1, 'msg_invalid_request');
216
+		}
204 217
 
205 218
 		$point = 1;
206 219
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -233,19 +246,27 @@  discard block
 block discarded – undo
233 246
 	 */
234 247
 	function procDocumentVoteDown()
235 248
 	{
236
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
249
+		if(!Context::get('is_logged')) {
250
+			return new Object(-1, 'msg_invalid_request');
251
+		}
237 252
 
238 253
 		$document_srl = Context::get('target_srl');
239
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
254
+		if(!$document_srl) {
255
+			return new Object(-1, 'msg_invalid_request');
256
+		}
240 257
 
241 258
 		$oDocumentModel = getModel('document');
242 259
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
243 260
 		$module_srl = $oDocument->get('module_srl');
244
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
261
+		if(!$module_srl) {
262
+			return new Object(-1, 'msg_invalid_request');
263
+		}
245 264
 
246 265
 		$oModuleModel = getModel('module');
247 266
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
248
-		if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request');
267
+		if($document_config->use_vote_down=='N') {
268
+			return new Object(-1, 'msg_invalid_request');
269
+		}
249 270
 
250 271
 		$point = -1;
251 272
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -259,10 +280,14 @@  discard block
 block discarded – undo
259 280
 	 */
260 281
 	function procDocumentDeclare()
261 282
 	{
262
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
283
+		if(!Context::get('is_logged')) {
284
+			return new Object(-1, 'msg_invalid_request');
285
+		}
263 286
 
264 287
 		$document_srl = Context::get('target_srl');
265
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
288
+		if(!$document_srl) {
289
+			return new Object(-1, 'msg_invalid_request');
290
+		}
266 291
 
267 292
 		return $this->declaredDocument($document_srl);
268 293
 	}
@@ -304,7 +329,9 @@  discard block
 block discarded – undo
304 329
 		$args->history_srl = $history_srl;
305 330
 		$args->module_srl = $module_srl;
306 331
 		$args->document_srl = $document_srl;
307
-		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
332
+		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) {
333
+			return;
334
+		}
308 335
 		executeQuery("document.deleteHistory", $args);
309 336
 	}
310 337
 
@@ -316,15 +343,21 @@  discard block
 block discarded – undo
316 343
 	function triggerDeleteModuleDocuments(&$obj)
317 344
 	{
318 345
 		$module_srl = $obj->module_srl;
319
-		if(!$module_srl) return new Object();
346
+		if(!$module_srl) {
347
+			return new Object();
348
+		}
320 349
 		// Delete the document
321 350
 		$oDocumentAdminController = getAdminController('document');
322 351
 		$output = $oDocumentAdminController->deleteModuleDocument($module_srl);
323
-		if(!$output->toBool()) return $output;
352
+		if(!$output->toBool()) {
353
+			return $output;
354
+		}
324 355
 		// Delete the category
325 356
 		$oDocumentController = getController('document');
326 357
 		$output = $oDocumentController->deleteModuleCategory($module_srl);
327
-		if(!$output->toBool()) return $output;
358
+		if(!$output->toBool()) {
359
+			return $output;
360
+		}
328 361
 		// Delete extra key and variable, because module deleted
329 362
 		$this->deleteDocumentExtraKeys($module_srl);
330 363
 
@@ -366,10 +399,18 @@  discard block
 block discarded – undo
366 399
 		$oDB = &DB::getInstance();
367 400
 		$oDB->begin();
368 401
 		// List variables
369
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
370
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
371
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
372
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
402
+		if($obj->comment_status) {
403
+			$obj->commentStatus = $obj->comment_status;
404
+		}
405
+		if(!$obj->commentStatus) {
406
+			$obj->commentStatus = 'DENY';
407
+		}
408
+		if($obj->commentStatus == 'DENY') {
409
+			$this->_checkCommentStatusForOldVersion($obj);
410
+		}
411
+		if($obj->allow_trackback!='Y') {
412
+			$obj->allow_trackback = 'N';
413
+		}
373 414
 		if($obj->homepage) 
374 415
 		{
375 416
 			$obj->homepage = removeHackTag($obj->homepage);
@@ -379,9 +420,15 @@  discard block
 block discarded – undo
379 420
 			}
380 421
 		}
381 422
 		
382
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
383
-		if(!$obj->email_address) $obj->email_address = '';
384
-		if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
423
+		if($obj->notify_message != 'Y') {
424
+			$obj->notify_message = 'N';
425
+		}
426
+		if(!$obj->email_address) {
427
+			$obj->email_address = '';
428
+		}
429
+		if(!$isRestore) {
430
+			$obj->ipaddress = $_SERVER['REMOTE_ADDR'];
431
+		}
385 432
 
386 433
                 // can modify regdate only manager
387 434
                 $grant = Context::get('grant');
@@ -391,7 +438,9 @@  discard block
 block discarded – undo
391 438
 		}
392 439
 		
393 440
 		// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
394
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
441
+		if(!is_string($obj->extra_vars)) {
442
+			$obj->extra_vars = serialize($obj->extra_vars);
443
+		}
395 444
 		// Remove the columns for automatic saving
396 445
 		unset($obj->_saved_doc_srl);
397 446
 		unset($obj->_saved_doc_title);
@@ -399,10 +448,15 @@  discard block
 block discarded – undo
399 448
 		unset($obj->_saved_doc_message);
400 449
 		// Call a trigger (before)
401 450
 		$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
402
-		if(!$output->toBool()) return $output;
451
+		if(!$output->toBool()) {
452
+			return $output;
453
+		}
403 454
 		// Register it if no given document_srl exists
404
-		if(!$obj->document_srl) $obj->document_srl = getNextSequence();
405
-		elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted');
455
+		if(!$obj->document_srl) {
456
+			$obj->document_srl = getNextSequence();
457
+		} elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) {
458
+			return new Object(-1, 'msg_not_permitted');
459
+		}
406 460
 
407 461
 		$oDocumentModel = getModel('document');
408 462
 		// Set to 0 if the category_srl doesn't exist
@@ -413,12 +467,19 @@  discard block
 block discarded – undo
413 467
 			{
414 468
 				return new Object(-1, 'msg_not_permitted');
415 469
 			}
416
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
470
+			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) {
471
+				$obj->category_srl = 0;
472
+			}
417 473
 		}
418 474
 		// Set the read counts and update order.
419
-		if(!$obj->readed_count) $obj->readed_count = 0;
420
-		if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
421
-		else $obj->update_order = $obj->list_order;
475
+		if(!$obj->readed_count) {
476
+			$obj->readed_count = 0;
477
+		}
478
+		if($isLatest) {
479
+			$obj->update_order = $obj->list_order = $obj->document_srl * -1;
480
+		} else {
481
+			$obj->update_order = $obj->list_order;
482
+		}
422 483
 		// Check the status of password hash for manually inserting. Apply hashing for otherwise.
423 484
 		if($obj->password && !$obj->password_is_hashed)
424 485
 		{
@@ -440,9 +501,13 @@  discard block
 block discarded – undo
440 501
 		// If the tile is empty, extract string from the contents.
441 502
 		$obj->title = htmlspecialchars($obj->title);
442 503
 		settype($obj->title, "string");
443
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
504
+		if($obj->title == '') {
505
+			$obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
506
+		}
444 507
 		// If no tile extracted from the contents, leave it untitled.
445
-		if($obj->title == '') $obj->title = 'Untitled';
508
+		if($obj->title == '') {
509
+			$obj->title = 'Untitled';
510
+		}
446 511
 		// Remove XE's own tags from the contents.
447 512
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
448 513
 		if(Mobile::isFromMobilePhone())
@@ -454,13 +519,19 @@  discard block
 block discarded – undo
454 519
 			$obj->content = nl2br($obj->content);
455 520
 		}
456 521
 		// Remove iframe and script if not a top adminisrator in the session.
457
-		if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
522
+		if($logged_info->is_admin != 'Y') {
523
+			$obj->content = removeHackTag($obj->content);
524
+		}
458 525
 		// An error appears if both log-in info and user name don't exist.
459
-		if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request');
526
+		if(!$logged_info->member_srl && !$obj->nick_name) {
527
+			return new Object(-1,'msg_invalid_request');
528
+		}
460 529
 
461 530
 		$obj->lang_code = Context::getLangType();
462 531
 		// Insert data into the DB
463
-		if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
532
+		if(!$obj->status) {
533
+			$this->_checkDocumentStatusForOldVersion($obj);
534
+		}
464 535
 		$output = executeQuery('document.insertDocument', $obj);
465 536
 		if(!$output->toBool())
466 537
 		{
@@ -477,19 +548,25 @@  discard block
 block discarded – undo
477 548
 				if(isset($obj->{'extra_vars'.$idx}))
478 549
 				{
479 550
 					$tmp = $obj->{'extra_vars'.$idx};
480
-					if(is_array($tmp))
481
-						$value = implode('|@|', $tmp);
482
-					else
483
-						$value = trim($tmp);
551
+					if(is_array($tmp)) {
552
+											$value = implode('|@|', $tmp);
553
+					} else {
554
+											$value = trim($tmp);
555
+					}
556
+				} else if(isset($obj->{$extra_item->name})) {
557
+					$value = trim($obj->{$extra_item->name});
558
+				}
559
+				if($value == NULL) {
560
+					continue;
484 561
 				}
485
-				else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
486
-				if($value == NULL) continue;
487 562
 
488 563
 				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
489 564
 			}
490 565
 		}
491 566
 		// Update the category if the category_srl exists.
492
-		if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
567
+		if($obj->category_srl) {
568
+			$this->updateCategoryCount($obj->module_srl, $obj->category_srl);
569
+		}
493 570
 		// Call a trigger (after)
494 571
 		if($output->toBool())
495 572
 		{
@@ -529,27 +606,39 @@  discard block
 block discarded – undo
529 606
 			return new Object(-1, 'msg_invalid_request');
530 607
 		}
531 608
 
532
-		if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request');
533
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
534
-		if(!$obj->status) $obj->status = 'PUBLIC';
609
+		if(!$source_obj->document_srl || !$obj->document_srl) {
610
+			return new Object(-1,'msg_invalied_request');
611
+		}
612
+		if(!$obj->status && $obj->is_secret == 'Y') {
613
+			$obj->status = 'SECRET';
614
+		}
615
+		if(!$obj->status) {
616
+			$obj->status = 'PUBLIC';
617
+		}
535 618
 
536 619
 		// Call a trigger (before)
537 620
 		$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
538
-		if(!$output->toBool()) return $output;
621
+		if(!$output->toBool()) {
622
+			return $output;
623
+		}
539 624
 
540 625
 		// begin transaction
541 626
 		$oDB = &DB::getInstance();
542 627
 		$oDB->begin();
543 628
 
544 629
 		$oModuleModel = getModel('module');
545
-		if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
630
+		if(!$obj->module_srl) {
631
+			$obj->module_srl = $source_obj->get('module_srl');
632
+		}
546 633
 		$module_srl = $obj->module_srl;
547 634
 		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
548 635
 		if(!$document_config)
549 636
 		{
550 637
 			$document_config = new stdClass();
551 638
 		}
552
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
639
+		if(!isset($document_config->use_history)) {
640
+			$document_config->use_history = 'N';
641
+		}
553 642
 		$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
554 643
 
555 644
 		if($bUseHistory)
@@ -558,22 +647,31 @@  discard block
 block discarded – undo
558 647
 			$args->history_srl = getNextSequence();
559 648
 			$args->document_srl = $obj->document_srl;
560 649
 			$args->module_srl = $module_srl;
561
-			if($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
650
+			if($document_config->use_history == 'Y') {
651
+				$args->content = $source_obj->get('content');
652
+			}
562 653
 			$args->nick_name = $source_obj->get('nick_name');
563 654
 			$args->member_srl = $source_obj->get('member_srl');
564 655
 			$args->regdate = $source_obj->get('last_update');
565 656
 			$args->ipaddress = $source_obj->get('ipaddress');
566 657
 			$output = executeQuery("document.insertHistory", $args);
567
-		}
568
-		else
658
+		} else
569 659
 		{
570 660
 			$obj->ipaddress = $source_obj->get('ipaddress');
571 661
 		}
572 662
 		// List variables
573
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
574
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
575
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
576
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
663
+		if($obj->comment_status) {
664
+			$obj->commentStatus = $obj->comment_status;
665
+		}
666
+		if(!$obj->commentStatus) {
667
+			$obj->commentStatus = 'DENY';
668
+		}
669
+		if($obj->commentStatus == 'DENY') {
670
+			$this->_checkCommentStatusForOldVersion($obj);
671
+		}
672
+		if($obj->allow_trackback!='Y') {
673
+			$obj->allow_trackback = 'N';
674
+		}
577 675
 		if($obj->homepage)
578 676
 		{
579 677
 			$obj->homepage = removeHackTag($obj->homepage);
@@ -583,7 +681,9 @@  discard block
 block discarded – undo
583 681
 			}
584 682
 		}
585 683
 		
586
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
684
+		if($obj->notify_message != 'Y') {
685
+			$obj->notify_message = 'N';
686
+		}
587 687
 		
588 688
 		// can modify regdate only manager
589 689
                 $grant = Context::get('grant');
@@ -593,7 +693,9 @@  discard block
 block discarded – undo
593 693
 		}
594 694
 		
595 695
 		// Serialize the $extra_vars
596
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
696
+		if(!is_string($obj->extra_vars)) {
697
+			$obj->extra_vars = serialize($obj->extra_vars);
698
+		}
597 699
 		// Remove the columns for automatic saving
598 700
 		unset($obj->_saved_doc_srl);
599 701
 		unset($obj->_saved_doc_title);
@@ -605,7 +707,9 @@  discard block
 block discarded – undo
605 707
 		if($source_obj->get('category_srl')!=$obj->category_srl)
606 708
 		{
607 709
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
608
-			if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
710
+			if(!$category_list[$obj->category_srl]) {
711
+				$obj->category_srl = 0;
712
+			}
609 713
 		}
610 714
 		// Change the update order
611 715
 		$obj->update_order = getNextSequence() * -1;
@@ -638,9 +742,13 @@  discard block
 block discarded – undo
638 742
 		}
639 743
 		// If the tile is empty, extract string from the contents.
640 744
 		settype($obj->title, "string");
641
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
745
+		if($obj->title == '') {
746
+			$obj->title = cut_str(strip_tags($obj->content),20,'...');
747
+		}
642 748
 		// If no tile extracted from the contents, leave it untitled.
643
-		if($obj->title == '') $obj->title = 'Untitled';
749
+		if($obj->title == '') {
750
+			$obj->title = 'Untitled';
751
+		}
644 752
 		// Remove XE's own tags from the contents.
645 753
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
646 754
 		if(Mobile::isFromMobilePhone())
@@ -660,8 +768,7 @@  discard block
 block discarded – undo
660 768
 				$lang_code_args->document_srl = $source_obj->get('document_srl');
661 769
 				$lang_code_args->lang_code = Context::getLangType();
662 770
 				$output = executeQuery('document.updateDocumentsLangCode', $lang_code_args);
663
-			}
664
-			else
771
+			} else
665 772
 			{
666 773
 				$extra_content = new stdClass;
667 774
 				$extra_content->title = $obj->title;
@@ -680,7 +787,9 @@  discard block
 block discarded – undo
680 787
 			$obj->content = removeHackTag($obj->content);
681 788
 		}
682 789
 		// if temporary document, regdate is now setting
683
-		if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
790
+		if($source_obj->get('status') == $this->getConfigStatus('temp')) {
791
+			$obj->regdate = date('YmdHis');
792
+		}
684 793
 
685 794
 		// Insert data into the DB
686 795
 		$output = executeQuery('document.updateDocument', $obj);
@@ -703,25 +812,37 @@  discard block
 block discarded – undo
703 812
 					if(isset($obj->{'extra_vars'.$idx}))
704 813
 					{
705 814
 						$tmp = $obj->{'extra_vars'.$idx};
706
-						if(is_array($tmp))
707
-							$value = implode('|@|', $tmp);
708
-						else
709
-							$value = trim($tmp);
815
+						if(is_array($tmp)) {
816
+													$value = implode('|@|', $tmp);
817
+						} else {
818
+													$value = trim($tmp);
819
+						}
820
+					} else if(isset($obj->{$extra_item->name})) {
821
+						$value = trim($obj->{$extra_item->name});
822
+					}
823
+					if($value == NULL) {
824
+						continue;
710 825
 					}
711
-					else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
712
-					if($value == NULL) continue;
713 826
 					$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
714 827
 				}
715 828
 			}
716 829
 			// Inert extra vars for multi-language support of title and contents.
717
-			if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
718
-			if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
830
+			if($extra_content->title) {
831
+				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
832
+			}
833
+			if($extra_content->content) {
834
+				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
835
+			}
719 836
 		}
720 837
 		// Update the category if the category_srl exists.
721 838
 		if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
722 839
 		{
723
-			if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
724
-			if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
840
+			if($source_obj->get('category_srl') != $obj->category_srl) {
841
+				$this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
842
+			}
843
+			if($obj->category_srl) {
844
+				$this->updateCategoryCount($obj->module_srl, $obj->category_srl);
845
+			}
725 846
 		}
726 847
 		// Call a trigger (after)
727 848
 		if($output->toBool())
@@ -766,7 +887,9 @@  discard block
 block discarded – undo
766 887
 		$trigger_obj = new stdClass();
767 888
 		$trigger_obj->document_srl = $document_srl;
768 889
 		$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
769
-		if(!$output->toBool()) return $output;
890
+		if(!$output->toBool()) {
891
+			return $output;
892
+		}
770 893
 
771 894
 		// begin transaction
772 895
 		$oDB = &DB::getInstance();
@@ -778,12 +901,17 @@  discard block
 block discarded – undo
778 901
 			$oDocumentModel = getModel('document');
779 902
 			// Check if the documnet exists
780 903
 			$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
904
+		} else if($isEmptyTrash && $oDocument == null) {
905
+			return new Object(-1, 'document is not exists');
781 906
 		}
782
-		else if($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
783 907
 
784
-		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
908
+		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) {
909
+			return new Object(-1, 'msg_invalid_document');
910
+		}
785 911
 		// Check if a permossion is granted
786
-		if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
912
+		if(!$oDocument->isGranted()) {
913
+			return new Object(-1, 'msg_not_permitted');
914
+		}
787 915
 
788 916
 		//if empty trash, document already deleted, therefore document not delete
789 917
 		$args = new stdClass();
@@ -803,7 +931,9 @@  discard block
 block discarded – undo
803 931
 
804 932
 		$this->deleteDocumentHistory(null, $document_srl, null);
805 933
 		// Update category information if the category_srl exists.
806
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
934
+		if($oDocument->get('category_srl')) {
935
+			$this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
936
+		}
807 937
 		// Delete a declared list
808 938
 		executeQuery('document.deleteDeclared', $args);
809 939
 		// Delete extra variable
@@ -883,8 +1013,11 @@  discard block
 block discarded – undo
883 1013
 	{
884 1014
 		$trash_args = new stdClass();
885 1015
 		// Get trash_srl if a given trash_srl doesn't exist
886
-		if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
887
-		else $trash_args->trash_srl = $obj->trash_srl;
1016
+		if(!$obj->trash_srl) {
1017
+			$trash_args->trash_srl = getNextSequence();
1018
+		} else {
1019
+			$trash_args->trash_srl = $obj->trash_srl;
1020
+		}
888 1021
 		// Get its module_srl which the document belongs to
889 1022
 		$oDocumentModel = getModel('document');
890 1023
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl);
@@ -892,7 +1025,9 @@  discard block
 block discarded – undo
892 1025
 		$trash_args->module_srl = $oDocument->get('module_srl');
893 1026
 		$obj->module_srl = $oDocument->get('module_srl');
894 1027
 		// Cannot throw data from the trash to the trash
895
-		if($trash_args->module_srl == 0) return false;
1028
+		if($trash_args->module_srl == 0) {
1029
+			return false;
1030
+		}
896 1031
 		// Data setting
897 1032
 		$trash_args->document_srl = $obj->document_srl;
898 1033
 		$trash_args->description = $obj->description;
@@ -953,7 +1088,9 @@  discard block
 block discarded – undo
953 1088
 		  }*/
954 1089
 
955 1090
 		// update category
956
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
1091
+		if($oDocument->get('category_srl')) {
1092
+			$this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
1093
+		}
957 1094
 
958 1095
 		// remove thumbnails
959 1096
 		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
@@ -998,7 +1135,9 @@  discard block
 block discarded – undo
998 1135
 	function updateReadedCount(&$oDocument)
999 1136
 	{
1000 1137
 		// Pass if Crawler access
1001
-		if(isCrawler()) return false;
1138
+		if(isCrawler()) {
1139
+			return false;
1140
+		}
1002 1141
 		
1003 1142
 		$document_srl = $oDocument->document_srl;
1004 1143
 		$member_srl = $oDocument->get('member_srl');
@@ -1006,10 +1145,14 @@  discard block
 block discarded – undo
1006 1145
 
1007 1146
 		// Call a trigger when the read count is updated (before)
1008 1147
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
1009
-		if(!$trigger_output->toBool()) return $trigger_output;
1148
+		if(!$trigger_output->toBool()) {
1149
+			return $trigger_output;
1150
+		}
1010 1151
 
1011 1152
 		// Pass if read count is increaded on the session information
1012
-		if($_SESSION['readed_document'][$document_srl]) return false;
1153
+		if($_SESSION['readed_document'][$document_srl]) {
1154
+			return false;
1155
+		}
1013 1156
 
1014 1157
 		// Pass if the author's IP address is as same as visitor's.
1015 1158
 		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
@@ -1074,7 +1217,9 @@  discard block
 block discarded – undo
1074 1217
 	 */
1075 1218
 	function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid)
1076 1219
 	{
1077
-		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request');
1220
+		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) {
1221
+			return new Object(-1,'msg_invalid_request');
1222
+		}
1078 1223
 
1079 1224
 		$obj = new stdClass();
1080 1225
 		$obj->module_srl = $module_srl;
@@ -1091,8 +1236,7 @@  discard block
 block discarded – undo
1091 1236
 		if(!$output->data)
1092 1237
 		{
1093 1238
 			$output = executeQuery('document.insertDocumentExtraKey', $obj);
1094
-		}
1095
-		else
1239
+		} else
1096 1240
 		{
1097 1241
 			$output = executeQuery('document.updateDocumentExtraKey', $obj);
1098 1242
 			// Update the extra var(eid)
@@ -1118,10 +1262,14 @@  discard block
 block discarded – undo
1118 1262
 	 */
1119 1263
 	function deleteDocumentExtraKeys($module_srl, $var_idx = null)
1120 1264
 	{
1121
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
1265
+		if(!$module_srl) {
1266
+			return new Object(-1,'msg_invalid_request');
1267
+		}
1122 1268
 		$obj = new stdClass();
1123 1269
 		$obj->module_srl = $module_srl;
1124
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1270
+		if(!is_null($var_idx)) {
1271
+			$obj->var_idx = $var_idx;
1272
+		}
1125 1273
 
1126 1274
 		$oDB = DB::getInstance();
1127 1275
 		$oDB->begin();
@@ -1185,8 +1333,12 @@  discard block
 block discarded – undo
1185 1333
 	 */
1186 1334
 	function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
1187 1335
 	{
1188
-		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request');
1189
-		if(!$lang_code) $lang_code = Context::getLangType();
1336
+		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) {
1337
+			return new Object(-1,'msg_invalid_request');
1338
+		}
1339
+		if(!$lang_code) {
1340
+			$lang_code = Context::getLangType();
1341
+		}
1190 1342
 
1191 1343
 		$obj = new stdClass;
1192 1344
 		$obj->module_srl = $module_srl;
@@ -1212,10 +1364,18 @@  discard block
 block discarded – undo
1212 1364
 	{
1213 1365
 		$obj = new stdClass();
1214 1366
 		$obj->module_srl = $module_srl;
1215
-		if(!is_null($document_srl)) $obj->document_srl = $document_srl;
1216
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1217
-		if(!is_null($lang_code)) $obj->lang_code = $lang_code;
1218
-		if(!is_null($eid)) $obj->eid = $eid;
1367
+		if(!is_null($document_srl)) {
1368
+			$obj->document_srl = $document_srl;
1369
+		}
1370
+		if(!is_null($var_idx)) {
1371
+			$obj->var_idx = $var_idx;
1372
+		}
1373
+		if(!is_null($lang_code)) {
1374
+			$obj->lang_code = $lang_code;
1375
+		}
1376
+		if(!is_null($eid)) {
1377
+			$obj->eid = $eid;
1378
+		}
1219 1379
 		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
1220 1380
 		return $output;
1221 1381
 	}
@@ -1229,8 +1389,11 @@  discard block
 block discarded – undo
1229 1389
 	 */
1230 1390
 	function updateVotedCount($document_srl, $point = 1)
1231 1391
 	{
1232
-		if($point > 0) $failed_voted = 'failed_voted';
1233
-		else $failed_voted = 'failed_blamed';
1392
+		if($point > 0) {
1393
+			$failed_voted = 'failed_voted';
1394
+		} else {
1395
+			$failed_voted = 'failed_blamed';
1396
+		}
1234 1397
 		// Return fail if session already has information about votes
1235 1398
 		if($_SESSION['voted_document'][$document_srl])
1236 1399
 		{
@@ -1266,8 +1429,7 @@  discard block
 block discarded – undo
1266 1429
 		if($member_srl)
1267 1430
 		{
1268 1431
 			$args->member_srl = $member_srl;
1269
-		}
1270
-		else
1432
+		} else
1271 1433
 		{
1272 1434
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1273 1435
 		}
@@ -1289,17 +1451,20 @@  discard block
 block discarded – undo
1289 1451
 		{
1290 1452
 			$args->blamed_count = $oDocument->get('blamed_count') + $point;
1291 1453
 			$output = executeQuery('document.updateBlamedCount', $args);
1292
-		}
1293
-		else
1454
+		} else
1294 1455
 		{
1295 1456
 			$args->voted_count = $oDocument->get('voted_count') + $point;
1296 1457
 			$output = executeQuery('document.updateVotedCount', $args);
1297 1458
 		}
1298
-		if(!$output->toBool()) return $output;
1459
+		if(!$output->toBool()) {
1460
+			return $output;
1461
+		}
1299 1462
 		// Leave logs
1300 1463
 		$args->point = $point;
1301 1464
 		$output = executeQuery('document.insertDocumentVotedLog', $args);
1302
-		if(!$output->toBool()) return $output;
1465
+		if(!$output->toBool()) {
1466
+			return $output;
1467
+		}
1303 1468
 
1304 1469
 		$obj = new stdClass;
1305 1470
 		$obj->member_srl = $oDocument->get('member_srl');
@@ -1335,8 +1500,7 @@  discard block
 block discarded – undo
1335 1500
 		{
1336 1501
 			$output->setMessage('success_voted');
1337 1502
 			$output->add('voted_count', $obj->after_point);
1338
-		}
1339
-		else
1503
+		} else
1340 1504
 		{
1341 1505
 			$output->setMessage('success_blamed');
1342 1506
 			$output->add('blamed_count', $obj->after_point);
@@ -1353,13 +1517,17 @@  discard block
 block discarded – undo
1353 1517
 	function declaredDocument($document_srl)
1354 1518
 	{
1355 1519
 		// Fail if session information already has a reported document
1356
-		if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
1520
+		if($_SESSION['declared_document'][$document_srl]) {
1521
+			return new Object(-1, 'failed_declared');
1522
+		}
1357 1523
 
1358 1524
 		// Check if previously reported
1359 1525
 		$args = new stdClass();
1360 1526
 		$args->document_srl = $document_srl;
1361 1527
 		$output = executeQuery('document.getDeclaredDocument', $args);
1362
-		if(!$output->toBool()) return $output;
1528
+		if(!$output->toBool()) {
1529
+			return $output;
1530
+		}
1363 1531
 
1364 1532
 		$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
1365 1533
 
@@ -1403,8 +1571,7 @@  discard block
 block discarded – undo
1403 1571
 		if($member_srl)
1404 1572
 		{
1405 1573
 			$args->member_srl = $member_srl;
1406
-		}
1407
-		else
1574
+		} else
1408 1575
 		{
1409 1576
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1410 1577
 		}
@@ -1424,9 +1591,14 @@  discard block
 block discarded – undo
1424 1591
 		$oDB->begin();
1425 1592
 
1426 1593
 		// Add the declared document
1427
-		if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1428
-		else $output = executeQuery('document.insertDeclaredDocument', $args);
1429
-		if(!$output->toBool()) return $output;
1594
+		if($declared_count > 0) {
1595
+			$output = executeQuery('document.updateDeclaredDocument', $args);
1596
+		} else {
1597
+			$output = executeQuery('document.insertDeclaredDocument', $args);
1598
+		}
1599
+		if(!$output->toBool()) {
1600
+			return $output;
1601
+		}
1430 1602
 		// Leave logs
1431 1603
 		$output = executeQuery('document.insertDocumentDeclaredLog', $args);
1432 1604
 		if(!$output->toBool())
@@ -1525,9 +1697,10 @@  discard block
 block discarded – undo
1525 1697
 			$parent_category = $oDocumentModel->getCategory($obj->parent_srl);
1526 1698
 			$obj->list_order = $parent_category->list_order;
1527 1699
 			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1);
1528
-			if(!$obj->category_srl) $obj->category_srl = getNextSequence();
1529
-		}
1530
-		else
1700
+			if(!$obj->category_srl) {
1701
+				$obj->category_srl = getNextSequence();
1702
+			}
1703
+		} else
1531 1704
 		{
1532 1705
 			$obj->list_order = $obj->category_srl = getNextSequence();
1533 1706
 		}
@@ -1567,13 +1740,17 @@  discard block
 block discarded – undo
1567 1740
 	{
1568 1741
 		// Create a document model object
1569 1742
 		$oDocumentModel = getModel('document');
1570
-		if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1743
+		if(!$document_count) {
1744
+			$document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1745
+		}
1571 1746
 
1572 1747
 		$args = new stdClass;
1573 1748
 		$args->category_srl = $category_srl;
1574 1749
 		$args->document_count = $document_count;
1575 1750
 		$output = executeQuery('document.updateCategoryCount', $args);
1576
-		if($output->toBool()) $this->makeCategoryFile($module_srl);
1751
+		if($output->toBool()) {
1752
+			$this->makeCategoryFile($module_srl);
1753
+		}
1577 1754
 
1578 1755
 		return $output;
1579 1756
 	}
@@ -1586,7 +1763,9 @@  discard block
 block discarded – undo
1586 1763
 	function updateCategory($obj)
1587 1764
 	{
1588 1765
 		$output = executeQuery('document.updateCategory', $obj);
1589
-		if($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1766
+		if($output->toBool()) {
1767
+			$this->makeCategoryFile($obj->module_srl);
1768
+		}
1590 1769
 		return $output;
1591 1770
 	}
1592 1771
 
@@ -1603,11 +1782,17 @@  discard block
 block discarded – undo
1603 1782
 		$category_info = $oDocumentModel->getCategory($category_srl);
1604 1783
 		// Display an error that the category cannot be deleted if it has a child
1605 1784
 		$output = executeQuery('document.getChildCategoryCount', $args);
1606
-		if(!$output->toBool()) return $output;
1607
-		if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
1785
+		if(!$output->toBool()) {
1786
+			return $output;
1787
+		}
1788
+		if($output->data->count>0) {
1789
+			return new Object(-1, 'msg_cannot_delete_for_child');
1790
+		}
1608 1791
 		// Delete a category information
1609 1792
 		$output = executeQuery('document.deleteCategory', $args);
1610
-		if(!$output->toBool()) return $output;
1793
+		if(!$output->toBool()) {
1794
+			return $output;
1795
+		}
1611 1796
 
1612 1797
 		$this->makeCategoryFile($category_info->module_srl);
1613 1798
 		// remvove cache
@@ -1622,8 +1807,9 @@  discard block
 block discarded – undo
1622 1807
 				$args->page = ++$page;
1623 1808
 				$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
1624 1809
 
1625
-				if($output->data == array())
1626
-					break;
1810
+				if($output->data == array()) {
1811
+									break;
1812
+				}
1627 1813
 
1628 1814
 				foreach($output->data as $val)
1629 1815
 				{
@@ -1675,18 +1861,26 @@  discard block
 block discarded – undo
1675 1861
 		// Seek a full list of categories
1676 1862
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1677 1863
 		$category_srl_list = array_keys($category_list);
1678
-		if(count($category_srl_list)<2) return new Object();
1864
+		if(count($category_srl_list)<2) {
1865
+			return new Object();
1866
+		}
1679 1867
 
1680 1868
 		$prev_category = NULL;
1681 1869
 		foreach($category_list as $key => $val)
1682 1870
 		{
1683
-			if($key==$category_srl) break;
1871
+			if($key==$category_srl) {
1872
+				break;
1873
+			}
1684 1874
 			$prev_category = $val;
1685 1875
 		}
1686 1876
 		// Return if the previous category doesn't exist
1687
-		if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved'));
1877
+		if(!$prev_category) {
1878
+			return new Object(-1,Context::getLang('msg_category_not_moved'));
1879
+		}
1688 1880
 		// Return if the selected category is the top level
1689
-		if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
1881
+		if($category_srl_list[0]==$category_srl) {
1882
+			return new Object(-1,Context::getLang('msg_category_not_moved'));
1883
+		}
1690 1884
 		// Information of the selected category
1691 1885
 		$cur_args = new stdClass;
1692 1886
 		$cur_args->category_srl = $category_srl;
@@ -1722,15 +1916,21 @@  discard block
 block discarded – undo
1722 1916
 		// Seek a full list of categories
1723 1917
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1724 1918
 		$category_srl_list = array_keys($category_list);
1725
-		if(count($category_srl_list)<2) return new Object();
1919
+		if(count($category_srl_list)<2) {
1920
+			return new Object();
1921
+		}
1726 1922
 
1727 1923
 		for($i=0;$i<count($category_srl_list);$i++)
1728 1924
 		{
1729
-			if($category_srl_list[$i]==$category_srl) break;
1925
+			if($category_srl_list[$i]==$category_srl) {
1926
+				break;
1927
+			}
1730 1928
 		}
1731 1929
 
1732 1930
 		$next_category_srl = $category_srl_list[$i+1];
1733
-		if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
1931
+		if(!$category_list[$next_category_srl]) {
1932
+			return new Object(-1,Context::getLang('msg_category_not_moved'));
1933
+		}
1734 1934
 		$next_category = $category_list[$next_category_srl];
1735 1935
 		// Information of the selected category
1736 1936
 		$cur_args = new stdClass;
@@ -1757,7 +1957,9 @@  discard block
 block discarded – undo
1757 1957
 	{
1758 1958
 		$oDocumentModel = getModel('document');
1759 1959
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
1760
-		if(!count($extra_keys)) return;
1960
+		if(!count($extra_keys)) {
1961
+			return;
1962
+		}
1761 1963
 
1762 1964
 		$js_code = array();
1763 1965
 		$js_code[] = '<script>//<![CDATA[';
@@ -1776,7 +1978,9 @@  discard block
 block discarded – undo
1776 1978
 			}
1777 1979
 			$name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name);
1778 1980
 			$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name);
1779
-			if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1981
+			if($val->is_required == 'Y') {
1982
+				$js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1983
+			}
1780 1984
 		}
1781 1985
 
1782 1986
 		$js_code[] = '})(jQuery);';
@@ -1794,7 +1998,9 @@  discard block
 block discarded – undo
1794 1998
 	function procDocumentInsertCategory($args = null)
1795 1999
 	{
1796 2000
 		// List variables
1797
-		if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
2001
+		if(!$args) {
2002
+			$args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
2003
+		}
1798 2004
 		$args->title = $args->category_title;
1799 2005
 		$args->description = $args->category_description;
1800 2006
 		$args->color = $args->category_color;
@@ -1810,11 +2016,18 @@  discard block
 block discarded – undo
1810 2016
 		$columnList = array('module_srl', 'module');
1811 2017
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1812 2018
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1813
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2019
+		if(!$grant->manager) {
2020
+			return new Object(-1,'msg_not_permitted');
2021
+		}
1814 2022
 
1815
-		if($args->expand !="Y") $args->expand = "N";
1816
-		if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls);
1817
-		else $args->group_srls = implode(',', $args->group_srls);
2023
+		if($args->expand !="Y") {
2024
+			$args->expand = "N";
2025
+		}
2026
+		if(!is_array($args->group_srls)) {
2027
+			$args->group_srls = str_replace('|@|',',',$args->group_srls);
2028
+		} else {
2029
+			$args->group_srls = implode(',', $args->group_srls);
2030
+		}
1818 2031
 		$args->parent_srl = (int)$args->parent_srl;
1819 2032
 
1820 2033
 		$oDocumentModel = getModel('document');
@@ -1825,7 +2038,9 @@  discard block
 block discarded – undo
1825 2038
 		if($args->category_srl)
1826 2039
 		{
1827 2040
 			$category_info = $oDocumentModel->getCategory($args->category_srl);
1828
-			if($category_info->category_srl != $args->category_srl) $args->category_srl = null;
2041
+			if($category_info->category_srl != $args->category_srl) {
2042
+				$args->category_srl = null;
2043
+			}
1829 2044
 		}
1830 2045
 		// Update if exists
1831 2046
 		if($args->category_srl)
@@ -1837,8 +2052,7 @@  discard block
 block discarded – undo
1837 2052
 				return $output;
1838 2053
 			}
1839 2054
 			// Insert if not exist
1840
-		}
1841
-		else
2055
+		} else
1842 2056
 		{
1843 2057
 			$output = $this->insertCategory($args);
1844 2058
 			if(!$output->toBool())
@@ -1880,7 +2094,9 @@  discard block
 block discarded – undo
1880 2094
 		$columnList = array('module_srl', 'module');
1881 2095
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
1882 2096
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1883
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2097
+		if(!$grant->manager) {
2098
+			return new Object(-1,'msg_not_permitted');
2099
+		}
1884 2100
 
1885 2101
 		// First child of the parent_category_srl
1886 2102
 		$source_args = new stdClass;
@@ -1893,30 +2109,39 @@  discard block
 block discarded – undo
1893 2109
 			$args->parent_srl = $parent_category_srl;
1894 2110
 			$output = executeQuery('document.getChildCategoryMinListOrder', $args);
1895 2111
 
1896
-			if(!$output->toBool()) return $output;
2112
+			if(!$output->toBool()) {
2113
+				return $output;
2114
+			}
1897 2115
 			$args->list_order = (int)$output->data->list_order;
1898
-			if(!$args->list_order) $args->list_order = 0;
2116
+			if(!$args->list_order) {
2117
+				$args->list_order = 0;
2118
+			}
1899 2119
 			$args->list_order--;
1900 2120
 
1901 2121
 			$source_args->category_srl = $source_category_srl;
1902 2122
 			$source_args->parent_srl = $parent_category_srl;
1903 2123
 			$source_args->list_order = $args->list_order;
1904 2124
 			$output = $this->updateCategory($source_args);
1905
-			if(!$output->toBool()) return $output;
2125
+			if(!$output->toBool()) {
2126
+				return $output;
2127
+			}
1906 2128
 			// Sibling of the $target_category_srl
1907
-		}
1908
-		else if($target_category_srl > 0)
2129
+		} else if($target_category_srl > 0)
1909 2130
 		{
1910 2131
 			$target_category = $oDocumentModel->getCategory($target_category_srl);
1911 2132
 			// Move all siblings of the $target_category down
1912 2133
 			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1);
1913
-			if(!$output->toBool()) return $output;
2134
+			if(!$output->toBool()) {
2135
+				return $output;
2136
+			}
1914 2137
 
1915 2138
 			$source_args->category_srl = $source_category_srl;
1916 2139
 			$source_args->parent_srl = $target_category->parent_srl;
1917 2140
 			$source_args->list_order = $target_category->list_order+1;
1918 2141
 			$output = $this->updateCategory($source_args);
1919
-			if(!$output->toBool()) return $output;
2142
+			if(!$output->toBool()) {
2143
+				return $output;
2144
+			}
1920 2145
 		}
1921 2146
 		// Re-generate the xml file
1922 2147
 		$xml_file = $this->makeCategoryFile($source_category->module_srl);
@@ -1941,14 +2166,20 @@  discard block
 block discarded – undo
1941 2166
 		$columnList = array('module_srl', 'module');
1942 2167
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1943 2168
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1944
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2169
+		if(!$grant->manager) {
2170
+			return new Object(-1,'msg_not_permitted');
2171
+		}
1945 2172
 
1946 2173
 		$oDocumentModel = getModel('document');
1947 2174
 		// Get original information
1948 2175
 		$category_info = $oDocumentModel->getCategory($args->category_srl);
1949
-		if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
2176
+		if($category_info->parent_srl) {
2177
+			$parent_srl = $category_info->parent_srl;
2178
+		}
1950 2179
 		// Display an error that the category cannot be deleted if it has a child node
1951
-		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
2180
+		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) {
2181
+			return new Object(-1, 'msg_cannot_delete_for_child');
2182
+		}
1952 2183
 		// Remove from the DB
1953 2184
 		$output = $this->deleteCategory($args->category_srl);
1954 2185
 		if(!$output->toBool())
@@ -1982,7 +2213,9 @@  discard block
 block discarded – undo
1982 2213
 		$columnList = array('module_srl', 'module');
1983 2214
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1984 2215
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1985
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2216
+		if(!$grant->manager) {
2217
+			return new Object(-1,'msg_not_permitted');
2218
+		}
1986 2219
 
1987 2220
 		$xml_file = $this->makeCategoryFile($module_srl);
1988 2221
 		// Set return value
@@ -1997,14 +2230,18 @@  discard block
 block discarded – undo
1997 2230
 	function makeCategoryFile($module_srl)
1998 2231
 	{
1999 2232
 		// Return if there is no information you need for creating a cache file
2000
-		if(!$module_srl) return false;
2233
+		if(!$module_srl) {
2234
+			return false;
2235
+		}
2001 2236
 		// Get module information (to obtain mid)
2002 2237
 		$oModuleModel = getModel('module');
2003 2238
 		$columnList = array('module_srl', 'mid', 'site_srl');
2004 2239
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
2005 2240
 		$mid = $module_info->mid;
2006 2241
 
2007
-		if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
2242
+		if(!is_dir('./files/cache/document_category')) {
2243
+			FileHandler::makeDir('./files/cache/document_category');
2244
+		}
2008 2245
 		// Cache file's name
2009 2246
 		$xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl);
2010 2247
 		$php_file = sprintf("./files/cache/document_category/%s.php", $module_srl);
@@ -2016,13 +2253,17 @@  discard block
 block discarded – undo
2016 2253
 
2017 2254
 		$category_list = $output->data;
2018 2255
 
2019
-		if(!is_array($category_list)) $category_list = array($category_list);
2256
+		if(!is_array($category_list)) {
2257
+			$category_list = array($category_list);
2258
+		}
2020 2259
 
2021 2260
 		$category_count = count($category_list);
2022 2261
 		for($i=0;$i<$category_count;$i++)
2023 2262
 		{
2024 2263
 			$category_srl = $category_list[$i]->category_srl;
2025
-			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
2264
+			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) {
2265
+				$category_list[$i]->group_srls = '';
2266
+			}
2026 2267
 			$list[$category_srl] = $category_list[$i];
2027 2268
 		}
2028 2269
 		// Create the xml file without node data if no data is obtained
@@ -2034,7 +2275,9 @@  discard block
 block discarded – undo
2034 2275
 			return $xml_file;
2035 2276
 		}
2036 2277
 		// Change to an array if only a single data is obtained
2037
-		if(!is_array($list)) $list = array($list);
2278
+		if(!is_array($list)) {
2279
+			$list = array($list);
2280
+		}
2038 2281
 		// Create a tree for loop
2039 2282
 		foreach($list as $category_srl => $node)
2040 2283
 		{
@@ -2113,13 +2356,17 @@  discard block
 block discarded – undo
2113 2356
 	 */
2114 2357
 	function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff)
2115 2358
 	{
2116
-		if(!$source_node) return;
2359
+		if(!$source_node) {
2360
+			return;
2361
+		}
2117 2362
 
2118 2363
 		foreach($source_node as $category_srl => $node)
2119 2364
 		{
2120 2365
 			$child_buff = "";
2121 2366
 			// Get data of the child nodes
2122
-			if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
2367
+			if($category_srl && $tree[$category_srl]) {
2368
+				$child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
2369
+			}
2123 2370
 			// List variables
2124 2371
 			$expand = $node->expand;
2125 2372
 			$group_srls = $node->group_srls;
@@ -2129,8 +2376,11 @@  discard block
 block discarded – undo
2129 2376
 			$color = $node->color;
2130 2377
 			$description = $node->description;
2131 2378
 			// If node->group_srls value exists
2132
-			if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
2133
-			else $group_check_code = "true";
2379
+			if($group_srls) {
2380
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
2381
+			} else {
2382
+				$group_check_code = "true";
2383
+			}
2134 2384
 
2135 2385
 			$title = $node->title;
2136 2386
 			$oModuleAdminModel = getAdminModel('module');
@@ -2170,8 +2420,11 @@  discard block
 block discarded – undo
2170 2420
 				$node->document_count
2171 2421
 			);
2172 2422
 
2173
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2174
-			else $buff .=  sprintf('<node %s />', $attribute);
2423
+			if($child_buff) {
2424
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2425
+			} else {
2426
+				$buff .=  sprintf('<node %s />', $attribute);
2427
+			}
2175 2428
 		}
2176 2429
 		return $buff;
2177 2430
 	}
@@ -2190,7 +2443,9 @@  discard block
 block discarded – undo
2190 2443
 	function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff)
2191 2444
 	{
2192 2445
 		$output = array("buff"=>"", "category_srl_list"=>array());
2193
-		if(!$source_node) return $output;
2446
+		if(!$source_node) {
2447
+			return $output;
2448
+		}
2194 2449
 
2195 2450
 		// Set to an arraty for looping and then generate php script codes to be included
2196 2451
 		foreach($source_node as $category_srl => $node)
@@ -2289,7 +2544,9 @@  discard block
 block discarded – undo
2289 2544
 	function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self')
2290 2545
 	{
2291 2546
 		$document_popup_menu_list = Context::get('document_popup_menu_list');
2292
-		if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2547
+		if(!is_array($document_popup_menu_list)) {
2548
+			$document_popup_menu_list = array();
2549
+		}
2293 2550
 
2294 2551
 		$obj = new stdClass();
2295 2552
 		$obj->url = $url;
@@ -2307,7 +2564,9 @@  discard block
 block discarded – undo
2307 2564
 	 */
2308 2565
 	function procDocumentAddCart()
2309 2566
 	{
2310
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2567
+		if(!Context::get('is_logged')) {
2568
+			return new Object(-1, 'msg_not_permitted');
2569
+		}
2311 2570
 
2312 2571
 		// Get document_srl
2313 2572
 		$srls = explode(',',Context::get('srls'));
@@ -2315,11 +2574,15 @@  discard block
 block discarded – undo
2315 2574
 		{
2316 2575
 			$srl = trim($srls[$i]);
2317 2576
 
2318
-			if(!$srl) continue;
2577
+			if(!$srl) {
2578
+				continue;
2579
+			}
2319 2580
 
2320 2581
 			$document_srls[] = $srl;
2321 2582
 		}
2322
-		if(!count($document_srls)) return;
2583
+		if(!count($document_srls)) {
2584
+			return;
2585
+		}
2323 2586
 
2324 2587
 		// Get module_srl of the documents
2325 2588
 		$args = new stdClass;
@@ -2327,14 +2590,18 @@  discard block
 block discarded – undo
2327 2590
 		$args->document_srls = implode(',',$document_srls);
2328 2591
 		$args->order_type = 'asc';
2329 2592
 		$output = executeQueryArray('document.getDocuments', $args);
2330
-		if(!$output->data) return new Object();
2593
+		if(!$output->data) {
2594
+			return new Object();
2595
+		}
2331 2596
 
2332 2597
 		unset($document_srls);
2333 2598
 		foreach($output->data as $key => $val)
2334 2599
 		{
2335 2600
 			$document_srls[$val->module_srl][] = $val->document_srl;
2336 2601
 		}
2337
-		if(!$document_srls || !count($document_srls)) return new Object();
2602
+		if(!$document_srls || !count($document_srls)) {
2603
+			return new Object();
2604
+		}
2338 2605
 
2339 2606
 		// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
2340 2607
 		$oModuleModel = getModel('module');
@@ -2359,7 +2626,9 @@  discard block
 block discarded – undo
2359 2626
 				}
2360 2627
 			}
2361 2628
 		}
2362
-		if(!count($document_srls)) return new Object();
2629
+		if(!count($document_srls)) {
2630
+			return new Object();
2631
+		}
2363 2632
 
2364 2633
 		foreach($document_srls as $module_srl => $documents)
2365 2634
 		{
@@ -2367,9 +2636,14 @@  discard block
 block discarded – undo
2367 2636
 			for($i=0;$i<$cnt;$i++)
2368 2637
 			{
2369 2638
 				$document_srl = (int)trim($documents[$i]);
2370
-				if(!$document_srls) continue;
2371
-				if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2372
-				else $_SESSION['document_management'][$document_srl] = true;
2639
+				if(!$document_srls) {
2640
+					continue;
2641
+				}
2642
+				if($_SESSION['document_management'][$document_srl]) {
2643
+					unset($_SESSION['document_management'][$document_srl]);
2644
+				} else {
2645
+					$_SESSION['document_management'][$document_srl] = true;
2646
+				}
2373 2647
 			}
2374 2648
 		}
2375 2649
 	}
@@ -2381,7 +2655,9 @@  discard block
 block discarded – undo
2381 2655
 	function procDocumentManageCheckedDocument()
2382 2656
 	{
2383 2657
 		@set_time_limit(0);
2384
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2658
+		if(!Context::get('is_logged')) {
2659
+			return new Object(-1,'msg_not_permitted');
2660
+		}
2385 2661
 
2386 2662
 		if(!checkCSRF())
2387 2663
 		{
@@ -2391,14 +2667,21 @@  discard block
 block discarded – undo
2391 2667
 		$type = Context::get('type');
2392 2668
 		$target_module = Context::get('target_module');
2393 2669
 		$module_srl = Context::get('module_srl');
2394
-		if($target_module && !$module_srl) $module_srl = $target_module;
2670
+		if($target_module && !$module_srl) {
2671
+			$module_srl = $target_module;
2672
+		}
2395 2673
 		$category_srl = Context::get('target_category');
2396 2674
 		$message_content = Context::get('message_content');
2397
-		if($message_content) $message_content = nl2br($message_content);
2675
+		if($message_content) {
2676
+			$message_content = nl2br($message_content);
2677
+		}
2398 2678
 
2399 2679
 		$cart = Context::get('cart');
2400
-		if(!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2401
-		else $document_srl_list = $cart;
2680
+		if(!is_array($cart)) {
2681
+			$document_srl_list = explode('|@|', $cart);
2682
+		} else {
2683
+			$document_srl_list = $cart;
2684
+		}
2402 2685
 
2403 2686
 		$document_srl_count = count($document_srl_list);
2404 2687
 
@@ -2408,7 +2691,9 @@  discard block
 block discarded – undo
2408 2691
 		{
2409 2692
 			$oDocument = $oDocumentModel->getDocument($document_srl);
2410 2693
 			$document_items[] = $oDocument;
2411
-			if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2694
+			if(!$oDocument->isGranted()) {
2695
+				return $this->stop('msg_not_permitted');
2696
+			}
2412 2697
 		}
2413 2698
 
2414 2699
 		// Send a message
@@ -2424,10 +2709,15 @@  discard block
 block discarded – undo
2424 2709
 
2425 2710
 			foreach($document_items as $oDocument)
2426 2711
 			{
2427
-				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
2712
+				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) {
2713
+					continue;
2714
+				}
2428 2715
 
2429
-				if($type=='move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2430
-				else $purl = "";
2716
+				if($type=='move') {
2717
+					$purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2718
+				} else {
2719
+					$purl = "";
2720
+				}
2431 2721
 				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2432 2722
 
2433 2723
 				$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
@@ -2440,24 +2730,30 @@  discard block
 block discarded – undo
2440 2730
 		$oDocumentAdminController = getAdminController('document');
2441 2731
 		if($type == 'move')
2442 2732
 		{
2443
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2733
+			if(!$module_srl) {
2734
+				return new Object(-1, 'fail_to_move');
2735
+			}
2444 2736
 
2445 2737
 			$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
2446
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2738
+			if(!$output->toBool()) {
2739
+				return new Object(-1, 'fail_to_move');
2740
+			}
2447 2741
 
2448 2742
 			$msg_code = 'success_moved';
2449 2743
 
2450
-		}
2451
-		else if($type == 'copy')
2744
+		} else if($type == 'copy')
2452 2745
 		{
2453
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2746
+			if(!$module_srl) {
2747
+				return new Object(-1, 'fail_to_move');
2748
+			}
2454 2749
 
2455 2750
 			$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
2456
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2751
+			if(!$output->toBool()) {
2752
+				return new Object(-1, 'fail_to_move');
2753
+			}
2457 2754
 
2458 2755
 			$msg_code = 'success_copied';
2459
-		}
2460
-		else if($type =='delete')
2756
+		} else if($type =='delete')
2461 2757
 		{
2462 2758
 			$oDB = &DB::getInstance();
2463 2759
 			$oDB->begin();
@@ -2465,12 +2761,13 @@  discard block
 block discarded – undo
2465 2761
 			{
2466 2762
 				$document_srl = $document_srl_list[$i];
2467 2763
 				$output = $this->deleteDocument($document_srl, true);
2468
-				if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
2764
+				if(!$output->toBool()) {
2765
+					return new Object(-1, 'fail_to_delete');
2766
+				}
2469 2767
 			}
2470 2768
 			$oDB->commit();
2471 2769
 			$msg_code = 'success_deleted';
2472
-		}
2473
-		else if($type == 'trash')
2770
+		} else if($type == 'trash')
2474 2771
 		{
2475 2772
 			$args = new stdClass();
2476 2773
 			$args->description = $message_content;
@@ -2480,12 +2777,13 @@  discard block
 block discarded – undo
2480 2777
 			for($i=0;$i<$document_srl_count;$i++) {
2481 2778
 				$args->document_srl = $document_srl_list[$i];
2482 2779
 				$output = $this->moveDocumentToTrash($args);
2483
-				if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
2780
+				if(!$output || !$output->toBool()) {
2781
+					return new Object(-1, 'fail_to_trash');
2782
+				}
2484 2783
 			}
2485 2784
 			$oDB->commit();
2486 2785
 			$msg_code = 'success_trashed';
2487
-		}
2488
-		else if($type == 'cancelDeclare')
2786
+		} else if($type == 'cancelDeclare')
2489 2787
 		{
2490 2788
 			$args->document_srl = $document_srl_list;
2491 2789
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
@@ -2507,18 +2805,27 @@  discard block
 block discarded – undo
2507 2805
 	function procDocumentInsertModuleConfig()
2508 2806
 	{
2509 2807
 		$module_srl = Context::get('target_module_srl');
2510
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
2511
-		else $module_srl = array($module_srl);
2808
+		if(preg_match('/^([0-9,]+)$/',$module_srl)) {
2809
+			$module_srl = explode(',',$module_srl);
2810
+		} else {
2811
+			$module_srl = array($module_srl);
2812
+		}
2512 2813
 
2513 2814
 		$document_config = new stdClass();
2514 2815
 		$document_config->use_history = Context::get('use_history');
2515
-		if(!$document_config->use_history) $document_config->use_history = 'N';
2816
+		if(!$document_config->use_history) {
2817
+			$document_config->use_history = 'N';
2818
+		}
2516 2819
 
2517 2820
 		$document_config->use_vote_up = Context::get('use_vote_up');
2518
-		if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2821
+		if(!$document_config->use_vote_up) {
2822
+			$document_config->use_vote_up = 'Y';
2823
+		}
2519 2824
 
2520 2825
 		$document_config->use_vote_down = Context::get('use_vote_down');
2521
-		if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2826
+		if(!$document_config->use_vote_down) {
2827
+			$document_config->use_vote_down = 'Y';
2828
+		}
2522 2829
 
2523 2830
 		$document_config->use_status = Context::get('use_status');
2524 2831
 
@@ -2526,7 +2833,9 @@  discard block
 block discarded – undo
2526 2833
 		for($i=0;$i<count($module_srl);$i++)
2527 2834
 		{
2528 2835
 			$srl = trim($module_srl[$i]);
2529
-			if(!$srl) continue;
2836
+			if(!$srl) {
2837
+				continue;
2838
+			}
2530 2839
 			$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
2531 2840
 		}
2532 2841
 		$this->setError(-1);
@@ -2543,7 +2852,9 @@  discard block
 block discarded – undo
2543 2852
 	function procDocumentTempSave()
2544 2853
 	{
2545 2854
 		// Check login information
2546
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
2855
+		if(!Context::get('is_logged')) {
2856
+			return new Object(-1, 'msg_not_logged');
2857
+		}
2547 2858
 		$module_info = Context::get('module_info');
2548 2859
 		$logged_info = Context::get('logged_info');
2549 2860
 
@@ -2581,8 +2892,7 @@  discard block
 block discarded – undo
2581 2892
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
2582 2893
 			$msg_code = 'success_updated';
2583 2894
 			// Otherwise, get a new
2584
-		}
2585
-		else
2895
+		} else
2586 2896
 		{
2587 2897
 			$output = $oDocumentController->insertDocument($obj);
2588 2898
 			$msg_code = 'success_registed';
@@ -2608,17 +2918,20 @@  discard block
 block discarded – undo
2608 2918
 	 */
2609 2919
 	function procDocumentGetList()
2610 2920
 	{
2611
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2921
+		if(!Context::get('is_logged')) {
2922
+			return new Object(-1,'msg_not_permitted');
2923
+		}
2612 2924
 		$documentSrls = Context::get('document_srls');
2613
-		if($documentSrls) $documentSrlList = explode(',', $documentSrls);
2925
+		if($documentSrls) {
2926
+			$documentSrlList = explode(',', $documentSrls);
2927
+		}
2614 2928
 
2615 2929
 		if(count($documentSrlList) > 0)
2616 2930
 		{
2617 2931
 			$oDocumentModel = getModel('document');
2618 2932
 			$columnList = array('document_srl', 'title', 'nick_name', 'status');
2619 2933
 			$documentList = $oDocumentModel->getDocuments($documentSrlList, $this->grant->is_admin, false, $columnList);
2620
-		}
2621
-		else
2934
+		} else
2622 2935
 		{
2623 2936
 			global $lang;
2624 2937
 			$documentList = array();
@@ -2636,11 +2949,18 @@  discard block
 block discarded – undo
2636 2949
 	 */
2637 2950
 	function _checkCommentStatusForOldVersion(&$obj)
2638 2951
 	{
2639
-		if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2640
-		if(!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2952
+		if(!isset($obj->allow_comment)) {
2953
+			$obj->allow_comment = 'N';
2954
+		}
2955
+		if(!isset($obj->lock_comment)) {
2956
+			$obj->lock_comment = 'N';
2957
+		}
2641 2958
 
2642
-		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2643
-		else $obj->commentStatus = 'DENY';
2959
+		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') {
2960
+			$obj->commentStatus = 'ALLOW';
2961
+		} else {
2962
+			$obj->commentStatus = 'DENY';
2963
+		}
2644 2964
 	}
2645 2965
 
2646 2966
 	/**
@@ -2650,8 +2970,12 @@  discard block
 block discarded – undo
2650 2970
 	 */
2651 2971
 	function _checkDocumentStatusForOldVersion(&$obj)
2652 2972
 	{
2653
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2654
-		if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2973
+		if(!$obj->status && $obj->is_secret == 'Y') {
2974
+			$obj->status = $this->getConfigStatus('secret');
2975
+		}
2976
+		if(!$obj->status && $obj->is_secret != 'Y') {
2977
+			$obj->status = $this->getConfigStatus('public');
2978
+		}
2655 2979
 	}
2656 2980
 
2657 2981
 	public function updateUploaedCount($documentSrlList)
Please login to merge, or discard this patch.
modules/document/document.item.php 4 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1106,8 +1106,7 @@
 block discarded – undo
1106 1106
 
1107 1107
 	/**
1108 1108
 	 * Check accessible by document status
1109
-	 * @param array $matches
1110
-	 * @return mixed
1109
+	 * @return boolean
1111 1110
 	 */
1112 1111
 	function _checkAccessibleFromStatus()
1113 1112
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * documentItem class
5
- * document object
6
- *
7
- * @author NAVER ([email protected])
8
- * @package /modules/document
9
- * @version 0.1
10
- */
4
+	 * documentItem class
5
+	 * document object
6
+	 *
7
+	 * @author NAVER ([email protected])
8
+	 * @package /modules/document
9
+	 * @version 0.1
10
+	 */
11 11
 class documentItem extends Object
12 12
 {
13 13
 	/**
Please login to merge, or discard this patch.
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function _loadFromDB($load_extra_vars = true)
76 76
 	{
77
-		if(!$this->document_srl) return;
77
+		if (!$this->document_srl) return;
78 78
 
79 79
 		$document_item = false;
80 80
 		$cache_put = false;
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 		// cache controll
85 85
 		$oCacheHandler = CacheHandler::getInstance('object');
86
-		if($oCacheHandler->isSupport())
86
+		if ($oCacheHandler->isSupport())
87 87
 		{
88 88
 			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
89 89
 			$document_item = $oCacheHandler->get($cache_key);
90
-			if($document_item !== false)
90
+			if ($document_item !== false)
91 91
 			{
92 92
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
93 93
 			}
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 		$args->document_srl = $this->document_srl;
98 98
 		$output = executeQuery('document.getDocument', $args, $columnList);
99 99
 
100
-		if($document_item === false)
100
+		if ($document_item === false)
101 101
 		{
102 102
 			$document_item = $output->data;
103 103
 
104 104
 				//insert in cache
105
-			if($document_item && $oCacheHandler->isSupport())
105
+			if ($document_item && $oCacheHandler->isSupport())
106 106
 			{
107 107
 				$oCacheHandler->put($cache_key, $document_item);
108 108
 			}
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 		$this->setAttribute($document_item, $load_extra_vars);
120 120
 	}
121 121
 
122
-	function setAttribute($attribute, $load_extra_vars=true)
122
+	function setAttribute($attribute, $load_extra_vars = true)
123 123
 	{
124
-		if(!$attribute->document_srl)
124
+		if (!$attribute->document_srl)
125 125
 		{
126 126
 			$this->document_srl = null;
127 127
 			return;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$this->adds($attribute);
132 132
 
133 133
 		// Tags
134
-		if($this->get('tags'))
134
+		if ($this->get('tags'))
135 135
 		{
136 136
 			$tag_list = explode(',', $this->get('tags'));
137 137
 			$tag_list = array_map('trim', $tag_list);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 
141 141
 		$oDocumentModel = getModel('document');
142
-		if($load_extra_vars)
142
+		if ($load_extra_vars)
143 143
 		{
144 144
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
145 145
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 
155 155
 	function isGranted()
156 156
 	{
157
-		if($_SESSION['own_document'][$this->document_srl]) return true;
157
+		if ($_SESSION['own_document'][$this->document_srl]) return true;
158 158
 
159
-		if(!Context::get('is_logged')) return false;
159
+		if (!Context::get('is_logged')) return false;
160 160
 
161 161
 		$logged_info = Context::get('logged_info');
162
-		if($logged_info->is_admin == 'Y') return true;
162
+		if ($logged_info->is_admin == 'Y') return true;
163 163
 
164 164
 		$oModuleModel = getModel('module');
165 165
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
166
-		if($grant->manager) return true;
166
+		if ($grant->manager) return true;
167 167
 
168
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true;
168
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return true;
169 169
 
170 170
 		return false;
171 171
 	}
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 
178 178
 	function isAccessible()
179 179
 	{
180
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
180
+		return $_SESSION['accessible'][$this->document_srl] == true ? true : false;
181 181
 	}
182 182
 
183 183
 	function allowComment()
184 184
 	{
185 185
 		// init write, document is not exists. so allow comment status is true
186
-		if(!$this->isExists()) return true;
186
+		if (!$this->isExists()) return true;
187 187
 
188 188
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
189 189
 	}
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	function allowTrackback()
192 192
 	{
193 193
 		static $allow_trackback_status = null;
194
-		if(is_null($allow_trackback_status))
194
+		if (is_null($allow_trackback_status))
195 195
 		{
196 196
 			
197 197
 			// Check the tarckback module exist
198
-			if(!getClass('trackback'))
198
+			if (!getClass('trackback'))
199 199
 			{
200 200
 				$allow_trackback_status = false;
201 201
 			}
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
 				$oModuleModel = getModel('module');
206 206
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
207 207
 				
208
-				if(!$trackback_config)
208
+				if (!$trackback_config)
209 209
 				{
210 210
 					$trackback_config = new stdClass();
211 211
 				}
212 212
 				
213
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
213
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
215 215
 				else
216 216
 				{
217 217
 					$module_srl = $this->get('module_srl');
218 218
 					// Check settings of each module
219 219
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
220
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
220
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
222 222
 				}
223 223
 			}
224 224
 		}
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 
228 228
 	function isLocked()
229 229
 	{
230
-		if(!$this->isExists()) return false;
230
+		if (!$this->isExists()) return false;
231 231
 
232 232
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
233 233
 	}
234 234
 
235 235
 	function isEditable()
236 236
 	{
237
-		if($this->isGranted() || !$this->get('member_srl')) return true;
237
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
238 238
 		return false;
239 239
 	}
240 240
 
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 
252 252
 	function useNotify()
253 253
 	{
254
-		return $this->get('notify_message')=='Y' ? true : false;
254
+		return $this->get('notify_message') == 'Y' ? true : false;
255 255
 	}
256 256
 
257 257
 	function doCart()
258 258
 	{
259
-		if(!$this->document_srl) return false;
260
-		if($this->isCarted()) $this->removeCart();
259
+		if (!$this->document_srl) return false;
260
+		if ($this->isCarted()) $this->removeCart();
261 261
 		else $this->addCart();
262 262
 	}
263 263
 
@@ -284,18 +284,18 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function notify($type, $content)
286 286
 	{
287
-		if(!$this->document_srl) return;
287
+		if (!$this->document_srl) return;
288 288
 		// return if it is not useNotify
289
-		if(!$this->useNotify()) return;
289
+		if (!$this->useNotify()) return;
290 290
 		// Pass if an author is not a logged-in user
291
-		if(!$this->get('member_srl')) return;
291
+		if (!$this->get('member_srl')) return;
292 292
 		// Return if the currently logged-in user is an author
293 293
 		$logged_info = Context::get('logged_info');
294
-		if($logged_info->member_srl == $this->get('member_srl')) return;
294
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
295 295
 		// List variables
296
-		if($type) $title = "[".$type."] ";
296
+		if ($type) $title = "[" . $type . "] ";
297 297
 		$title .= cut_str(strip_tags($content), 10, '...');
298
-		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
298
+		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
299 299
 		$receiver_srl = $this->get('member_srl');
300 300
 		$sender_member_srl = $logged_info->member_srl;
301 301
 		// Send a message
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 	function getIpAddress()
312 312
 	{
313
-		if($this->isGranted())
313
+		if ($this->isGranted())
314 314
 		{
315 315
 			return $this->get('ipaddress');
316 316
 		}
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
 
321 321
 	function isExistsHomepage()
322 322
 	{
323
-		if(trim($this->get('homepage'))) return true;
323
+		if (trim($this->get('homepage'))) return true;
324 324
 		return false;
325 325
 	}
326 326
 
327 327
 	function getHomepageUrl()
328 328
 	{
329 329
 		$url = trim($this->get('homepage'));
330
-		if(!$url) return;
330
+		if (!$url) return;
331 331
 
332
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
332
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
333 333
 
334 334
 		return $url;
335 335
 	}
@@ -359,54 +359,54 @@  discard block
 block discarded – undo
359 359
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
360 360
 	}
361 361
 
362
-	function getTitleText($cut_size = 0, $tail='...')
362
+	function getTitleText($cut_size = 0, $tail = '...')
363 363
 	{
364
-		if(!$this->document_srl) return;
364
+		if (!$this->document_srl) return;
365 365
 
366
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
366
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
367 367
 		else $title = $this->get('title');
368 368
 
369 369
 		return $title;
370 370
 	}
371 371
 
372
-	function getTitle($cut_size = 0, $tail='...')
372
+	function getTitle($cut_size = 0, $tail = '...')
373 373
 	{
374
-		if(!$this->document_srl) return;
374
+		if (!$this->document_srl) return;
375 375
 
376 376
 		$title = $this->getTitleText($cut_size, $tail);
377 377
 
378 378
 		$attrs = array();
379 379
 		$this->add('title_color', trim($this->get('title_color')));
380
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
381
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
380
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
381
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#" . $this->get('title_color');
382 382
 
383
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
383
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
384 384
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
385 385
 	}
386 386
 
387 387
 	function getContentText($strlen = 0)
388 388
 	{
389
-		if(!$this->document_srl) return;
389
+		if (!$this->document_srl) return;
390 390
 
391
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
391
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
392 392
 
393 393
 		$result = $this->_checkAccessibleFromStatus();
394
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
394
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
395 395
 
396 396
 		$content = $this->get('content');
397 397
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
398 398
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
399 399
 
400
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
400
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
401 401
 
402 402
 		return htmlspecialchars($content);
403 403
 	}
404 404
 
405 405
 	function _addAllowScriptAccess($m)
406 406
 	{
407
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
407
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
408 408
 		{
409
-			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
409
+			$m[0] = $m[0] . '<param name="allowscriptaccess" value="never"></param>';
410 410
 		}
411 411
 		$this->allowscriptaccessKey++;
412 412
 		return $m[0];
@@ -414,26 +414,26 @@  discard block
 block discarded – undo
414 414
 
415 415
 	function _checkAllowScriptAccess($m)
416 416
 	{
417
-		if($m[1] == 'object')
417
+		if ($m[1] == 'object')
418 418
 		{
419 419
 			$this->allowscriptaccessList[] = 1;
420 420
 		}
421 421
 
422
-		if($m[1] == 'param')
422
+		if ($m[1] == 'param')
423 423
 		{
424
-			if(stripos($m[0], 'allowscriptaccess'))
424
+			if (stripos($m[0], 'allowscriptaccess'))
425 425
 			{
426 426
 				$m[0] = '<param name="allowscriptaccess" value="never"';
427
-				if(substr($m[0], -1) == '/')
427
+				if (substr($m[0], -1) == '/')
428 428
 				{
429 429
 					$m[0] .= '/';
430 430
 				}
431
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
431
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
432 432
 			}
433 433
 		}
434
-		else if($m[1] == 'embed')
434
+		else if ($m[1] == 'embed')
435 435
 		{
436
-			if(stripos($m[0], 'allowscriptaccess'))
436
+			if (stripos($m[0], 'allowscriptaccess'))
437 437
 			{
438 438
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
439 439
 			}
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 
448 448
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
449 449
 	{
450
-		if(!$this->document_srl) return;
450
+		if (!$this->document_srl) return;
451 451
 
452
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
452
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
453 453
 
454 454
 		$result = $this->_checkAccessibleFromStatus();
455
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
455
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
456 456
 
457 457
 		$content = $this->get('content');
458
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
458
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
459 459
 
460 460
 		// Define a link if using a rewrite module
461 461
 		$oContext = &Context::getInstance();
462
-		if($oContext->allow_rewrite)
462
+		if ($oContext->allow_rewrite)
463 463
 		{
464
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
464
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2" . Context::getRequestUri() . "?", $content);
465 465
 		}
466 466
 		// To display a pop-up menu
467
-		if($add_popup_menu)
467
+		if ($add_popup_menu)
468 468
 		{
469 469
 			$content = sprintf(
470 470
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 			);
474 474
 		}
475 475
 		// If additional content information is set
476
-		if($add_content_info)
476
+		if ($add_content_info)
477 477
 		{
478 478
 			$memberSrl = $this->get('member_srl');
479
-			if($memberSrl < 0)
479
+			if ($memberSrl < 0)
480 480
 			{
481 481
 				$memberSrl = 0;
482 482
 			}
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 		else
494 494
 		{
495
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
495
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
496 496
 		}
497 497
 		// Change the image path to a valid absolute path if resource_realpath is true
498
-		if($resource_realpath)
498
+		if ($resource_realpath)
499 499
 		{
500
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
500
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
501 501
 		}
502 502
 
503 503
 		return $content;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		$content = trim(cut_str($content, $str_size, $tail));
547 547
 
548 548
 		// Replace back < , <, "
549
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
549
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
550 550
 
551 551
 		return $content;
552 552
 	}
@@ -559,23 +559,23 @@  discard block
 block discarded – undo
559 559
 	function getRegdateTime()
560 560
 	{
561 561
 		$regdate = $this->get('regdate');
562
-		$year = substr($regdate,0,4);
563
-		$month = substr($regdate,4,2);
564
-		$day = substr($regdate,6,2);
565
-		$hour = substr($regdate,8,2);
566
-		$min = substr($regdate,10,2);
567
-		$sec = substr($regdate,12,2);
568
-		return mktime($hour,$min,$sec,$month,$day,$year);
562
+		$year = substr($regdate, 0, 4);
563
+		$month = substr($regdate, 4, 2);
564
+		$day = substr($regdate, 6, 2);
565
+		$hour = substr($regdate, 8, 2);
566
+		$min = substr($regdate, 10, 2);
567
+		$sec = substr($regdate, 12, 2);
568
+		return mktime($hour, $min, $sec, $month, $day, $year);
569 569
 	}
570 570
 
571 571
 	function getRegdateGM()
572 572
 	{
573
-		return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
573
+		return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone'];
574 574
 	}
575 575
 
576 576
 	function getRegdateDT()
577 577
 	{
578
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
578
+		return $this->getRegdate('Y-m-d') . 'T' . $this->getRegdate('H:i:s') . substr($GLOBALS['_time_zone'], 0, 3) . ':' . substr($GLOBALS['_time_zone'], 3, 2);
579 579
 	}
580 580
 
581 581
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 
586 586
 	function getUpdateTime()
587 587
 	{
588
-		$year = substr($this->get('last_update'),0,4);
589
-		$month = substr($this->get('last_update'),4,2);
590
-		$day = substr($this->get('last_update'),6,2);
591
-		$hour = substr($this->get('last_update'),8,2);
592
-		$min = substr($this->get('last_update'),10,2);
593
-		$sec = substr($this->get('last_update'),12,2);
594
-		return mktime($hour,$min,$sec,$month,$day,$year);
588
+		$year = substr($this->get('last_update'), 0, 4);
589
+		$month = substr($this->get('last_update'), 4, 2);
590
+		$day = substr($this->get('last_update'), 6, 2);
591
+		$hour = substr($this->get('last_update'), 8, 2);
592
+		$min = substr($this->get('last_update'), 10, 2);
593
+		$sec = substr($this->get('last_update'), 12, 2);
594
+		return mktime($hour, $min, $sec, $month, $day, $year);
595 595
 	}
596 596
 
597 597
 	function getUpdateGM()
@@ -601,21 +601,21 @@  discard block
 block discarded – undo
601 601
 
602 602
 	function getUpdateDT()
603 603
 	{
604
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
604
+		return $this->getUpdate('Y-m-d') . 'T' . $this->getUpdate('H:i:s') . substr($GLOBALS['_time_zone'], 0, 3) . ':' . substr($GLOBALS['_time_zone'], 3, 2);
605 605
 	}
606 606
 
607 607
 	function getPermanentUrl()
608 608
 	{
609
-		return getFullUrl('','document_srl',$this->get('document_srl'));
609
+		return getFullUrl('', 'document_srl', $this->get('document_srl'));
610 610
 	}
611 611
 
612 612
 	function getTrackbackUrl()
613 613
 	{
614
-		if(!$this->document_srl) return;
614
+		if (!$this->document_srl) return;
615 615
 
616 616
 		// Generate a key to prevent spams
617 617
 		$oTrackbackModel = getModel('trackback');
618
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
618
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
619 619
 	}
620 620
 
621 621
 	/**
@@ -625,24 +625,24 @@  discard block
 block discarded – undo
625 625
 	function updateReadedCount()
626 626
 	{
627 627
 		$oDocumentController = getController('document');
628
-		if($oDocumentController->updateReadedCount($this))
628
+		if ($oDocumentController->updateReadedCount($this))
629 629
 		{
630 630
 			$readed_count = $this->get('readed_count');
631
-			$this->add('readed_count', $readed_count+1);
631
+			$this->add('readed_count', $readed_count + 1);
632 632
 		}
633 633
 	}
634 634
 
635 635
 	function isExtraVarsExists()
636 636
 	{
637
-		if(!$this->get('module_srl')) return false;
637
+		if (!$this->get('module_srl')) return false;
638 638
 		$oDocumentModel = getModel('document');
639 639
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
640
-		return count($extra_keys)?true:false;
640
+		return count($extra_keys) ? true : false;
641 641
 	}
642 642
 
643 643
 	function getExtraVars()
644 644
 	{
645
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
645
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
646 646
 
647 647
 		$oDocumentModel = getModel('document');
648 648
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	function getExtraValue($idx)
652 652
 	{
653 653
 		$extra_vars = $this->getExtraVars();
654
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
654
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
655 655
 		{
656 656
 			return $extra_vars[$idx]->getValue();
657 657
 		}
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	function getExtraValueHTML($idx)
665 665
 	{
666 666
 		$extra_vars = $this->getExtraVars();
667
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
667
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
668 668
 		{
669 669
 			return $extra_vars[$idx]->getValueHTML();
670 670
 		}
@@ -678,16 +678,16 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		$extra_vars = $this->getExtraVars();
680 680
 
681
-		if($extra_vars)
681
+		if ($extra_vars)
682 682
 		{
683 683
 			// Handle extra variable(eid)
684
-			foreach($extra_vars as $idx => $key)
684
+			foreach ($extra_vars as $idx => $key)
685 685
 			{
686 686
 				$extra_eid[$key->eid] = $key;
687 687
 			}
688 688
 		}
689 689
 		
690
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
690
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
691 691
 		{
692 692
 			return $extra_eid[$eid]->getValue();
693 693
 		}
@@ -701,12 +701,12 @@  discard block
 block discarded – undo
701 701
 	{
702 702
 		$extra_vars = $this->getExtraVars();
703 703
 		// Handle extra variable(eid)
704
-		foreach($extra_vars as $idx => $key)
704
+		foreach ($extra_vars as $idx => $key)
705 705
 		{
706 706
 			$extra_eid[$key->eid] = $key;
707 707
 		}
708 708
 		
709
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
709
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
710 710
 		{
711 711
 			return $extra_eid[$eid]->getValueHTML();
712 712
 		}
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
 
731 731
 	function getComments()
732 732
 	{
733
-		if(!$this->getCommentCount()) return;
734
-		if(!$this->isGranted() && $this->isSecret()) return;
733
+		if (!$this->getCommentCount()) return;
734
+		if (!$this->isGranted() && $this->isSecret()) return;
735 735
 		// cpage is a number of comment pages
736 736
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
737 737
 		$cpage = Context::get($cpageStr);
738 738
 
739
-		if(!$cpage)
739
+		if (!$cpage)
740 740
 		{
741 741
 			$cpage = Context::get('cpage');
742 742
 		}
@@ -744,19 +744,19 @@  discard block
 block discarded – undo
744 744
 		// Get a list of comments
745 745
 		$oCommentModel = getModel('comment');
746 746
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
747
-		if(!$output->toBool() || !count($output->data)) return;
747
+		if (!$output->toBool() || !count($output->data)) return;
748 748
 		// Create commentItem object from a comment list
749 749
 		// If admin priviledge is granted on parent posts, you can read its child posts.
750 750
 		$accessible = array();
751 751
 		$comment_list = array();
752
-		foreach($output->data as $key => $val)
752
+		foreach ($output->data as $key => $val)
753 753
 		{
754 754
 			$oCommentItem = new commentItem();
755 755
 			$oCommentItem->setAttribute($val);
756 756
 			// If permission is granted to the post, you can access it temporarily
757
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
757
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
758 758
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
759
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
759
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
760 760
 			{
761 761
 				$oCommentItem->setAccessible();
762 762
 			}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		// Variable setting to be displayed on the skin
766 766
 		Context::set($cpageStr, $output->page_navigation->cur_page);
767 767
 		Context::set('cpage', $output->page_navigation->cur_page);
768
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
768
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
769 769
 
770 770
 		return $comment_list;
771 771
 	}
@@ -777,9 +777,9 @@  discard block
 block discarded – undo
777 777
 
778 778
 	function getTrackbacks()
779 779
 	{
780
-		if(!$this->document_srl) return;
780
+		if (!$this->document_srl) return;
781 781
 
782
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
782
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
783 783
 
784 784
 		$oTrackbackModel = getModel('trackback');
785 785
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -787,30 +787,30 @@  discard block
 block discarded – undo
787 787
 
788 788
 	function thumbnailExists($width = 80, $height = 0, $type = '')
789 789
 	{
790
-		if(!$this->document_srl) return false;
791
-		if(!$this->getThumbnail($width, $height, $type)) return false;
790
+		if (!$this->document_srl) return false;
791
+		if (!$this->getThumbnail($width, $height, $type)) return false;
792 792
 		return true;
793 793
 	}
794 794
 
795 795
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
796 796
 	{
797 797
 		// Return false if the document doesn't exist
798
-		if(!$this->document_srl) return;
798
+		if (!$this->document_srl) return;
799 799
 
800
-		if($this->isSecret() && !$this->isGranted())
800
+		if ($this->isSecret() && !$this->isGranted())
801 801
 		{
802 802
 			return;
803 803
 		}
804 804
 
805 805
 		// If not specify its height, create a square
806
-		if(!$height) $height = $width;
806
+		if (!$height) $height = $width;
807 807
 		// Return false if neither attachement nor image files in the document
808
-		if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
808
+		if (!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
809 809
 		// Get thumbnai_type information from document module's configuration
810
-		if(!in_array($thumbnail_type, array('crop','ratio')))
810
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
811 811
 		{
812 812
 			$config = $GLOBALS['__document_config__'];
813
-			if(!$config)
813
+			if (!$config)
814 814
 			{
815 815
 				$oDocumentModel = getModel('document');
816 816
 				$config = $oDocumentModel->getDocumentConfig();
@@ -819,13 +819,13 @@  discard block
 block discarded – undo
819 819
 			$thumbnail_type = $config->thumbnail_type;
820 820
 		}
821 821
 		// Define thumbnail information
822
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
822
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
823 823
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
824
-		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
824
+		$thumbnail_url  = Context::getRequestUri() . $thumbnail_file;
825 825
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
826
-		if(file_exists($thumbnail_file))
826
+		if (file_exists($thumbnail_file))
827 827
 		{
828
-			if(filesize($thumbnail_file)<1) return false;
828
+			if (filesize($thumbnail_file) < 1) return false;
829 829
 			else return $thumbnail_url;
830 830
 		}
831 831
 
@@ -834,62 +834,62 @@  discard block
 block discarded – undo
834 834
 		$is_tmp_file = false;
835 835
 
836 836
 		// Find an iamge file among attached files if exists
837
-		if($this->hasUploadedFiles())
837
+		if ($this->hasUploadedFiles())
838 838
 		{
839 839
 			$file_list = $this->getUploadedFiles();
840 840
 
841 841
 			$first_image = null;
842
-			foreach($file_list as $file)
842
+			foreach ($file_list as $file)
843 843
 			{
844
-				if($file->direct_download !== 'Y') continue;
844
+				if ($file->direct_download !== 'Y') continue;
845 845
 
846
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
846
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
847 847
 				{
848 848
 					$source_file = $file->uploaded_filename;
849 849
 					break;
850 850
 				}
851 851
 
852
-				if($first_image) continue;
852
+				if ($first_image) continue;
853 853
 
854
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
854
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
855 855
 				{
856
-					if(file_exists($file->uploaded_filename))
856
+					if (file_exists($file->uploaded_filename))
857 857
 					{
858 858
 						$first_image = $file->uploaded_filename;
859 859
 					}
860 860
 				}
861 861
 			}
862 862
 
863
-			if(!$source_file && $first_image)
863
+			if (!$source_file && $first_image)
864 864
 			{
865 865
 				$source_file = $first_image;
866 866
 			}
867 867
 		}
868 868
 
869 869
 		// If not exists, file an image file from the content
870
-		if(!$source_file)
870
+		if (!$source_file)
871 871
 		{
872 872
 			$content = $this->get('content');
873 873
 			$target_src = null;
874 874
 			preg_match_all("!src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER);
875 875
 			$cnt = count($matches);
876
-			for($i=0;$i<$cnt;$i++)
876
+			for ($i = 0; $i < $cnt; $i++)
877 877
 			{
878 878
 				$target_src = trim($matches[$i][2]);
879
-				if(!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i",$target_src)) continue;
880
-				if(preg_match('/\/(common|modules|widgets|addons|layouts)\//i', $target_src)) continue;
879
+				if (!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i", $target_src)) continue;
880
+				if (preg_match('/\/(common|modules|widgets|addons|layouts)\//i', $target_src)) continue;
881 881
 				else
882 882
 				{
883
-					if(!preg_match('/^(http|https):\/\//i',$target_src)) $target_src = Context::getRequestUri().$target_src;
883
+					if (!preg_match('/^(http|https):\/\//i', $target_src)) $target_src = Context::getRequestUri() . $target_src;
884 884
 
885
-					$tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111,999999).$this->document_srl));
886
-					if(!is_dir('./files/cache/tmp')) FileHandler::makeDir('./files/cache/tmp');
885
+					$tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111, 999999) . $this->document_srl));
886
+					if (!is_dir('./files/cache/tmp')) FileHandler::makeDir('./files/cache/tmp');
887 887
 					FileHandler::getRemoteFile($target_src, $tmp_file);
888
-					if(!file_exists($tmp_file)) continue;
888
+					if (!file_exists($tmp_file)) continue;
889 889
 					else
890 890
 					{
891 891
 						list($_w, $_h, $_t, $_a) = @getimagesize($tmp_file);
892
-						if($_w<$width || $_h<$height) continue;
892
+						if ($_w < $width || $_h < $height) continue;
893 893
 
894 894
 						$source_file = $tmp_file;
895 895
 						$is_tmp_file = true;
@@ -899,15 +899,15 @@  discard block
 block discarded – undo
899 899
 			}
900 900
 		}
901 901
 
902
-		if($source_file)
902
+		if ($source_file)
903 903
 		{
904 904
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
905 905
 		}
906
-		if($is_tmp_file) FileHandler::removeFile($source_file);
906
+		if ($is_tmp_file) FileHandler::removeFile($source_file);
907 907
 		// Return its path if a thumbnail is successfully genetated
908
-		if($output) return $thumbnail_url;
908
+		if ($output) return $thumbnail_url;
909 909
 		// Create an empty file not to re-generate the thumbnail
910
-		else FileHandler::writeFile($thumbnail_file, '','w');
910
+		else FileHandler::writeFile($thumbnail_file, '', 'w');
911 911
 
912 912
 		return;
913 913
 	}
@@ -920,21 +920,21 @@  discard block
 block discarded – undo
920 920
 	 */
921 921
 	function getExtraImages($time_interval = 43200)
922 922
 	{
923
-		if(!$this->document_srl) return;
923
+		if (!$this->document_srl) return;
924 924
 		// variables for icon list
925 925
 		$buffs = array();
926 926
 
927 927
 		$check_files = false;
928 928
 
929 929
 		// Check if secret post is
930
-		if($this->isSecret()) $buffs[] = "secret";
930
+		if ($this->isSecret()) $buffs[] = "secret";
931 931
 
932 932
 		// Set the latest time
933
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
933
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
934 934
 
935 935
 		// Check new post
936
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
937
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
936
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
937
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
938 938
 
939 939
 		/*
940 940
 		   $content = $this->get('content');
@@ -957,14 +957,14 @@  discard block
 block discarded – undo
957 957
 		 */
958 958
 
959 959
 		// Check the attachment
960
-		if($this->hasUploadedFiles()) $buffs[] = "file";
960
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
961 961
 
962 962
 		return $buffs;
963 963
 	}
964 964
 
965 965
 	function getStatus()
966 966
 	{
967
-		if(!$this->get('status')) return $this->getDefaultStatus();
967
+		if (!$this->get('status')) return $this->getDefaultStatus();
968 968
 		return $this->get('status');
969 969
 	}
970 970
 
@@ -975,15 +975,15 @@  discard block
 block discarded – undo
975 975
 	 */
976 976
 	function printExtraImages($time_check = 43200)
977 977
 	{
978
-		if(!$this->document_srl) return;
978
+		if (!$this->document_srl) return;
979 979
 		// Get the icon directory
980
-		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
980
+		$path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
981 981
 
982 982
 		$buffs = $this->getExtraImages($time_check);
983
-		if(!count($buffs)) return;
983
+		if (!count($buffs)) return;
984 984
 
985 985
 		$buff = array();
986
-		foreach($buffs as $key => $val)
986
+		foreach ($buffs as $key => $val)
987 987
 		{
988 988
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
989 989
 		}
@@ -992,20 +992,20 @@  discard block
 block discarded – undo
992 992
 
993 993
 	function hasUploadedFiles()
994 994
 	{
995
-		if(!$this->document_srl) return;
995
+		if (!$this->document_srl) return;
996 996
 
997
-		if($this->isSecret() && !$this->isGranted()) return false;
998
-		return $this->get('uploaded_count')? true : false;
997
+		if ($this->isSecret() && !$this->isGranted()) return false;
998
+		return $this->get('uploaded_count') ? true : false;
999 999
 	}
1000 1000
 
1001 1001
 	function getUploadedFiles($sortIndex = 'file_srl')
1002 1002
 	{
1003
-		if(!$this->document_srl) return;
1003
+		if (!$this->document_srl) return;
1004 1004
 
1005
-		if($this->isSecret() && !$this->isGranted()) return;
1006
-		if(!$this->get('uploaded_count')) return;
1005
+		if ($this->isSecret() && !$this->isGranted()) return;
1006
+		if (!$this->get('uploaded_count')) return;
1007 1007
 
1008
-		if(!$this->uploadedFiles[$sortIndex])
1008
+		if (!$this->uploadedFiles[$sortIndex])
1009 1009
 		{
1010 1010
 			$oFileModel = getModel('file');
1011 1011
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	function getEditor()
1022 1022
 	{
1023 1023
 		$module_srl = $this->get('module_srl');
1024
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1024
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1025 1025
 
1026 1026
 		$oEditorModel = getModel('editor');
1027 1027
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 	{
1037 1037
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1038 1038
 		if (!$this->allowComment()) return false;
1039
-		if(!$this->isGranted() && $this->isSecret()) return false;
1039
+		if (!$this->isGranted() && $this->isSecret()) return false;
1040 1040
 
1041 1041
 		return true;
1042 1042
 	}
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 	 */
1048 1048
 	function getCommentEditor()
1049 1049
 	{
1050
-		if(!$this->isEnableComment()) return;
1050
+		if (!$this->isEnableComment()) return;
1051 1051
 
1052 1052
 		$oEditorModel = getModel('editor');
1053 1053
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1059,10 +1059,10 @@  discard block
 block discarded – undo
1059 1059
 	 */
1060 1060
 	function getProfileImage()
1061 1061
 	{
1062
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1062
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1063 1063
 		$oMemberModel = getModel('member');
1064 1064
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1065
-		if(!$profile_info) return;
1065
+		if (!$profile_info) return;
1066 1066
 
1067 1067
 		return $profile_info->src;
1068 1068
 	}
@@ -1074,21 +1074,21 @@  discard block
 block discarded – undo
1074 1074
 	function getSignature()
1075 1075
 	{
1076 1076
 		// Pass if a document doesn't exist
1077
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1077
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1078 1078
 		// Get signature information
1079 1079
 		$oMemberModel = getModel('member');
1080 1080
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1081 1081
 		// Check if a maximum height of signiture is set in the member module
1082
-		if(!isset($GLOBALS['__member_signature_max_height']))
1082
+		if (!isset($GLOBALS['__member_signature_max_height']))
1083 1083
 		{
1084 1084
 			$oModuleModel = getModel('module');
1085 1085
 			$member_config = $oModuleModel->getModuleConfig('member');
1086 1086
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1087 1087
 		}
1088
-		if($signature)
1088
+		if ($signature)
1089 1089
 		{
1090 1090
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1091
-			if($max_signature_height) $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);
1091
+			if ($max_signature_height) $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);
1092 1092
 		}
1093 1093
 
1094 1094
 		return $signature;
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 	 */
1102 1102
 	function replaceResourceRealPath($matches)
1103 1103
 	{
1104
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1104
+		return preg_replace('/src=(["\']?)files/i', 'src=$1' . Context::getRequestUri() . 'files', $matches[0]);
1105 1105
 	}
1106 1106
 
1107 1107
 	/**
@@ -1112,19 +1112,19 @@  discard block
 block discarded – undo
1112 1112
 	function _checkAccessibleFromStatus()
1113 1113
 	{
1114 1114
 		$logged_info = Context::get('logged_info');
1115
-		if($logged_info->is_admin == 'Y') return true;
1115
+		if ($logged_info->is_admin == 'Y') return true;
1116 1116
 
1117 1117
 		$status = $this->get('status');
1118
-		if(empty($status)) return false;
1118
+		if (empty($status)) return false;
1119 1119
 
1120 1120
 		$oDocumentModel = getModel('document');
1121 1121
 		$configStatusList = $oDocumentModel->getStatusList();
1122 1122
 
1123
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1123
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1124 1124
 			return true;
1125
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1125
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1126 1126
 		{
1127
-			if($this->get('member_srl') == $logged_info->member_srl)
1127
+			if ($this->get('member_srl') == $logged_info->member_srl)
1128 1128
 				return true;
1129 1129
 		}
1130 1130
 		return false;
Please login to merge, or discard this patch.
Braces   +288 added lines, -119 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function _loadFromDB($load_extra_vars = true)
76 76
 	{
77
-		if(!$this->document_srl) return;
77
+		if(!$this->document_srl) {
78
+			return;
79
+		}
78 80
 
79 81
 		$document_item = false;
80 82
 		$cache_put = false;
@@ -106,8 +108,7 @@  discard block
 block discarded – undo
106 108
 			{
107 109
 				$oCacheHandler->put($cache_key, $document_item);
108 110
 			}
109
-		}
110
-		else
111
+		} else
111 112
 		{
112 113
 			$document_item->readed_count = $output->data->readed_count;
113 114
 			$document_item->voted_count = $output->data->voted_count;
@@ -154,18 +155,28 @@  discard block
 block discarded – undo
154 155
 
155 156
 	function isGranted()
156 157
 	{
157
-		if($_SESSION['own_document'][$this->document_srl]) return true;
158
+		if($_SESSION['own_document'][$this->document_srl]) {
159
+			return true;
160
+		}
158 161
 
159
-		if(!Context::get('is_logged')) return false;
162
+		if(!Context::get('is_logged')) {
163
+			return false;
164
+		}
160 165
 
161 166
 		$logged_info = Context::get('logged_info');
162
-		if($logged_info->is_admin == 'Y') return true;
167
+		if($logged_info->is_admin == 'Y') {
168
+			return true;
169
+		}
163 170
 
164 171
 		$oModuleModel = getModel('module');
165 172
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
166
-		if($grant->manager) return true;
173
+		if($grant->manager) {
174
+			return true;
175
+		}
167 176
 
168
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true;
177
+		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) {
178
+			return true;
179
+		}
169 180
 
170 181
 		return false;
171 182
 	}
@@ -183,7 +194,9 @@  discard block
 block discarded – undo
183 194
 	function allowComment()
184 195
 	{
185 196
 		// init write, document is not exists. so allow comment status is true
186
-		if(!$this->isExists()) return true;
197
+		if(!$this->isExists()) {
198
+			return true;
199
+		}
187 200
 
188 201
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
189 202
 	}
@@ -198,8 +211,7 @@  discard block
 block discarded – undo
198 211
 			if(!getClass('trackback'))
199 212
 			{
200 213
 				$allow_trackback_status = false;
201
-			}
202
-			else
214
+			} else
203 215
 			{
204 216
 				// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
205 217
 				$oModuleModel = getModel('module');
@@ -210,15 +222,21 @@  discard block
 block discarded – undo
210 222
 					$trackback_config = new stdClass();
211 223
 				}
212 224
 				
213
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
215
-				else
225
+				if(!isset($trackback_config->enable_trackback)) {
226
+					$trackback_config->enable_trackback = 'Y';
227
+				}
228
+				if($trackback_config->enable_trackback != 'Y') {
229
+					$allow_trackback_status = false;
230
+				} else
216 231
 				{
217 232
 					$module_srl = $this->get('module_srl');
218 233
 					// Check settings of each module
219 234
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
220
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
235
+					if($module_config->enable_trackback == 'N') {
236
+						$allow_trackback_status = false;
237
+					} else if($this->get('allow_trackback')=='Y' || !$this->isExists()) {
238
+						$allow_trackback_status = true;
239
+					}
222 240
 				}
223 241
 			}
224 242
 		}
@@ -227,14 +245,18 @@  discard block
 block discarded – undo
227 245
 
228 246
 	function isLocked()
229 247
 	{
230
-		if(!$this->isExists()) return false;
248
+		if(!$this->isExists()) {
249
+			return false;
250
+		}
231 251
 
232 252
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
233 253
 	}
234 254
 
235 255
 	function isEditable()
236 256
 	{
237
-		if($this->isGranted() || !$this->get('member_srl')) return true;
257
+		if($this->isGranted() || !$this->get('member_srl')) {
258
+			return true;
259
+		}
238 260
 		return false;
239 261
 	}
240 262
 
@@ -256,9 +278,14 @@  discard block
 block discarded – undo
256 278
 
257 279
 	function doCart()
258 280
 	{
259
-		if(!$this->document_srl) return false;
260
-		if($this->isCarted()) $this->removeCart();
261
-		else $this->addCart();
281
+		if(!$this->document_srl) {
282
+			return false;
283
+		}
284
+		if($this->isCarted()) {
285
+			$this->removeCart();
286
+		} else {
287
+			$this->addCart();
288
+		}
262 289
 	}
263 290
 
264 291
 	function addCart()
@@ -284,16 +311,26 @@  discard block
 block discarded – undo
284 311
 	 */
285 312
 	function notify($type, $content)
286 313
 	{
287
-		if(!$this->document_srl) return;
314
+		if(!$this->document_srl) {
315
+			return;
316
+		}
288 317
 		// return if it is not useNotify
289
-		if(!$this->useNotify()) return;
318
+		if(!$this->useNotify()) {
319
+			return;
320
+		}
290 321
 		// Pass if an author is not a logged-in user
291
-		if(!$this->get('member_srl')) return;
322
+		if(!$this->get('member_srl')) {
323
+			return;
324
+		}
292 325
 		// Return if the currently logged-in user is an author
293 326
 		$logged_info = Context::get('logged_info');
294
-		if($logged_info->member_srl == $this->get('member_srl')) return;
327
+		if($logged_info->member_srl == $this->get('member_srl')) {
328
+			return;
329
+		}
295 330
 		// List variables
296
-		if($type) $title = "[".$type."] ";
331
+		if($type) {
332
+			$title = "[".$type."] ";
333
+		}
297 334
 		$title .= cut_str(strip_tags($content), 10, '...');
298 335
 		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
299 336
 		$receiver_srl = $this->get('member_srl');
@@ -320,16 +357,22 @@  discard block
 block discarded – undo
320 357
 
321 358
 	function isExistsHomepage()
322 359
 	{
323
-		if(trim($this->get('homepage'))) return true;
360
+		if(trim($this->get('homepage'))) {
361
+			return true;
362
+		}
324 363
 		return false;
325 364
 	}
326 365
 
327 366
 	function getHomepageUrl()
328 367
 	{
329 368
 		$url = trim($this->get('homepage'));
330
-		if(!$url) return;
369
+		if(!$url) {
370
+			return;
371
+		}
331 372
 
332
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
373
+		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) {
374
+			$url = 'http://' . $url;
375
+		}
333 376
 
334 377
 		return $url;
335 378
 	}
@@ -361,43 +404,65 @@  discard block
 block discarded – undo
361 404
 
362 405
 	function getTitleText($cut_size = 0, $tail='...')
363 406
 	{
364
-		if(!$this->document_srl) return;
407
+		if(!$this->document_srl) {
408
+			return;
409
+		}
365 410
 
366
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
367
-		else $title = $this->get('title');
411
+		if($cut_size) {
412
+			$title = cut_str($this->get('title'), $cut_size, $tail);
413
+		} else {
414
+			$title = $this->get('title');
415
+		}
368 416
 
369 417
 		return $title;
370 418
 	}
371 419
 
372 420
 	function getTitle($cut_size = 0, $tail='...')
373 421
 	{
374
-		if(!$this->document_srl) return;
422
+		if(!$this->document_srl) {
423
+			return;
424
+		}
375 425
 
376 426
 		$title = $this->getTitleText($cut_size, $tail);
377 427
 
378 428
 		$attrs = array();
379 429
 		$this->add('title_color', trim($this->get('title_color')));
380
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
381
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
430
+		if($this->get('title_bold')=='Y') {
431
+			$attrs[] = "font-weight:bold;";
432
+		}
433
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
434
+			$attrs[] = "color:#".$this->get('title_color');
435
+		}
382 436
 
383
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
384
-		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
437
+		if(count($attrs)) {
438
+			return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
439
+		} else {
440
+			return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
441
+		}
385 442
 	}
386 443
 
387 444
 	function getContentText($strlen = 0)
388 445
 	{
389
-		if(!$this->document_srl) return;
446
+		if(!$this->document_srl) {
447
+			return;
448
+		}
390 449
 
391
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
450
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
451
+			return Context::getLang('msg_is_secret');
452
+		}
392 453
 
393 454
 		$result = $this->_checkAccessibleFromStatus();
394
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
455
+		if($result) {
456
+			$_SESSION['accessible'][$this->document_srl] = true;
457
+		}
395 458
 
396 459
 		$content = $this->get('content');
397 460
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
398 461
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
399 462
 
400
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
463
+		if($strlen) {
464
+			return cut_str(strip_tags($content),$strlen,'...');
465
+		}
401 466
 
402 467
 		return htmlspecialchars($content);
403 468
 	}
@@ -430,14 +495,12 @@  discard block
 block discarded – undo
430 495
 				}
431 496
 				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
432 497
 			}
433
-		}
434
-		else if($m[1] == 'embed')
498
+		} else if($m[1] == 'embed')
435 499
 		{
436 500
 			if(stripos($m[0], 'allowscriptaccess'))
437 501
 			{
438 502
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
439
-			}
440
-			else
503
+			} else
441 504
 			{
442 505
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
443 506
 			}
@@ -447,15 +510,23 @@  discard block
 block discarded – undo
447 510
 
448 511
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
449 512
 	{
450
-		if(!$this->document_srl) return;
513
+		if(!$this->document_srl) {
514
+			return;
515
+		}
451 516
 
452
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
517
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
518
+			return Context::getLang('msg_is_secret');
519
+		}
453 520
 
454 521
 		$result = $this->_checkAccessibleFromStatus();
455
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
522
+		if($result) {
523
+			$_SESSION['accessible'][$this->document_srl] = true;
524
+		}
456 525
 
457 526
 		$content = $this->get('content');
458
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
527
+		if(!$stripEmbedTagException) {
528
+			stripEmbedTagForAdmin($content, $this->get('member_srl'));
529
+		}
459 530
 
460 531
 		// Define a link if using a rewrite module
461 532
 		$oContext = &Context::getInstance();
@@ -489,10 +560,11 @@  discard block
 block discarded – undo
489 560
 				$this->document_srl, $memberSrl
490 561
 			);
491 562
 			// Add xe_content class although accessing content is not required
492
-		}
493
-		else
563
+		} else
494 564
 		{
495
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
565
+			if($add_xe_content_class) {
566
+				$content = sprintf('<div class="xe_content">%s</div>', $content);
567
+			}
496 568
 		}
497 569
 		// Change the image path to a valid absolute path if resource_realpath is true
498 570
 		if($resource_realpath)
@@ -611,11 +683,15 @@  discard block
 block discarded – undo
611 683
 
612 684
 	function getTrackbackUrl()
613 685
 	{
614
-		if(!$this->document_srl) return;
686
+		if(!$this->document_srl) {
687
+			return;
688
+		}
615 689
 
616 690
 		// Generate a key to prevent spams
617 691
 		$oTrackbackModel = getModel('trackback');
618
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
692
+		if($oTrackbackModel) {
693
+			return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
694
+		}
619 695
 	}
620 696
 
621 697
 	/**
@@ -634,7 +710,9 @@  discard block
 block discarded – undo
634 710
 
635 711
 	function isExtraVarsExists()
636 712
 	{
637
-		if(!$this->get('module_srl')) return false;
713
+		if(!$this->get('module_srl')) {
714
+			return false;
715
+		}
638 716
 		$oDocumentModel = getModel('document');
639 717
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
640 718
 		return count($extra_keys)?true:false;
@@ -642,7 +720,9 @@  discard block
 block discarded – undo
642 720
 
643 721
 	function getExtraVars()
644 722
 	{
645
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
723
+		if(!$this->get('module_srl') || !$this->document_srl) {
724
+			return null;
725
+		}
646 726
 
647 727
 		$oDocumentModel = getModel('document');
648 728
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -654,8 +734,7 @@  discard block
 block discarded – undo
654 734
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
655 735
 		{
656 736
 			return $extra_vars[$idx]->getValue();
657
-		}
658
-		else
737
+		} else
659 738
 		{
660 739
 			return '';
661 740
 		}
@@ -667,8 +746,7 @@  discard block
 block discarded – undo
667 746
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
668 747
 		{
669 748
 			return $extra_vars[$idx]->getValueHTML();
670
-		}
671
-		else
749
+		} else
672 750
 		{
673 751
 			return '';
674 752
 		}
@@ -690,8 +768,7 @@  discard block
 block discarded – undo
690 768
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
691 769
 		{
692 770
 			return $extra_eid[$eid]->getValue();
693
-		}
694
-		else
771
+		} else
695 772
 		{
696 773
 			return '';
697 774
 		}
@@ -709,8 +786,7 @@  discard block
 block discarded – undo
709 786
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
710 787
 		{
711 788
 			return $extra_eid[$eid]->getValueHTML();
712
-		}
713
-		else
789
+		} else
714 790
 		{
715 791
 			return '';
716 792
 		}
@@ -730,8 +806,12 @@  discard block
 block discarded – undo
730 806
 
731 807
 	function getComments()
732 808
 	{
733
-		if(!$this->getCommentCount()) return;
734
-		if(!$this->isGranted() && $this->isSecret()) return;
809
+		if(!$this->getCommentCount()) {
810
+			return;
811
+		}
812
+		if(!$this->isGranted() && $this->isSecret()) {
813
+			return;
814
+		}
735 815
 		// cpage is a number of comment pages
736 816
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
737 817
 		$cpage = Context::get($cpageStr);
@@ -744,7 +824,9 @@  discard block
 block discarded – undo
744 824
 		// Get a list of comments
745 825
 		$oCommentModel = getModel('comment');
746 826
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
747
-		if(!$output->toBool() || !count($output->data)) return;
827
+		if(!$output->toBool() || !count($output->data)) {
828
+			return;
829
+		}
748 830
 		// Create commentItem object from a comment list
749 831
 		// If admin priviledge is granted on parent posts, you can read its child posts.
750 832
 		$accessible = array();
@@ -754,7 +836,9 @@  discard block
 block discarded – undo
754 836
 			$oCommentItem = new commentItem();
755 837
 			$oCommentItem->setAttribute($val);
756 838
 			// If permission is granted to the post, you can access it temporarily
757
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
839
+			if($oCommentItem->isGranted()) {
840
+				$accessible[$val->comment_srl] = true;
841
+			}
758 842
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
759 843
 			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
760 844
 			{
@@ -765,7 +849,9 @@  discard block
 block discarded – undo
765 849
 		// Variable setting to be displayed on the skin
766 850
 		Context::set($cpageStr, $output->page_navigation->cur_page);
767 851
 		Context::set('cpage', $output->page_navigation->cur_page);
768
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
852
+		if($output->total_page>1) {
853
+			$this->comment_page_navigation = $output->page_navigation;
854
+		}
769 855
 
770 856
 		return $comment_list;
771 857
 	}
@@ -777,9 +863,13 @@  discard block
 block discarded – undo
777 863
 
778 864
 	function getTrackbacks()
779 865
 	{
780
-		if(!$this->document_srl) return;
866
+		if(!$this->document_srl) {
867
+			return;
868
+		}
781 869
 
782
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
870
+		if(!$this->allowTrackback() || !$this->get('trackback_count')) {
871
+			return;
872
+		}
783 873
 
784 874
 		$oTrackbackModel = getModel('trackback');
785 875
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -787,15 +877,21 @@  discard block
 block discarded – undo
787 877
 
788 878
 	function thumbnailExists($width = 80, $height = 0, $type = '')
789 879
 	{
790
-		if(!$this->document_srl) return false;
791
-		if(!$this->getThumbnail($width, $height, $type)) return false;
880
+		if(!$this->document_srl) {
881
+			return false;
882
+		}
883
+		if(!$this->getThumbnail($width, $height, $type)) {
884
+			return false;
885
+		}
792 886
 		return true;
793 887
 	}
794 888
 
795 889
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
796 890
 	{
797 891
 		// Return false if the document doesn't exist
798
-		if(!$this->document_srl) return;
892
+		if(!$this->document_srl) {
893
+			return;
894
+		}
799 895
 
800 896
 		if($this->isSecret() && !$this->isGranted())
801 897
 		{
@@ -803,9 +899,13 @@  discard block
 block discarded – undo
803 899
 		}
804 900
 
805 901
 		// If not specify its height, create a square
806
-		if(!$height) $height = $width;
902
+		if(!$height) {
903
+			$height = $width;
904
+		}
807 905
 		// Return false if neither attachement nor image files in the document
808
-		if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
906
+		if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) {
907
+			return;
908
+		}
809 909
 		// Get thumbnai_type information from document module's configuration
810 910
 		if(!in_array($thumbnail_type, array('crop','ratio')))
811 911
 		{
@@ -825,8 +925,11 @@  discard block
 block discarded – undo
825 925
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
826 926
 		if(file_exists($thumbnail_file))
827 927
 		{
828
-			if(filesize($thumbnail_file)<1) return false;
829
-			else return $thumbnail_url;
928
+			if(filesize($thumbnail_file)<1) {
929
+				return false;
930
+			} else {
931
+				return $thumbnail_url;
932
+			}
830 933
 		}
831 934
 
832 935
 		// Target File
@@ -841,7 +944,9 @@  discard block
 block discarded – undo
841 944
 			$first_image = null;
842 945
 			foreach($file_list as $file)
843 946
 			{
844
-				if($file->direct_download !== 'Y') continue;
947
+				if($file->direct_download !== 'Y') {
948
+					continue;
949
+				}
845 950
 
846 951
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
847 952
 				{
@@ -849,7 +954,9 @@  discard block
 block discarded – undo
849 954
 					break;
850 955
 				}
851 956
 
852
-				if($first_image) continue;
957
+				if($first_image) {
958
+					continue;
959
+				}
853 960
 
854 961
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
855 962
 				{
@@ -876,20 +983,30 @@  discard block
 block discarded – undo
876 983
 			for($i=0;$i<$cnt;$i++)
877 984
 			{
878 985
 				$target_src = trim($matches[$i][2]);
879
-				if(!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i",$target_src)) continue;
880
-				if(preg_match('/\/(common|modules|widgets|addons|layouts)\//i', $target_src)) continue;
881
-				else
986
+				if(!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i",$target_src)) {
987
+					continue;
988
+				}
989
+				if(preg_match('/\/(common|modules|widgets|addons|layouts)\//i', $target_src)) {
990
+					continue;
991
+				} else
882 992
 				{
883
-					if(!preg_match('/^(http|https):\/\//i',$target_src)) $target_src = Context::getRequestUri().$target_src;
993
+					if(!preg_match('/^(http|https):\/\//i',$target_src)) {
994
+						$target_src = Context::getRequestUri().$target_src;
995
+					}
884 996
 
885 997
 					$tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111,999999).$this->document_srl));
886
-					if(!is_dir('./files/cache/tmp')) FileHandler::makeDir('./files/cache/tmp');
998
+					if(!is_dir('./files/cache/tmp')) {
999
+						FileHandler::makeDir('./files/cache/tmp');
1000
+					}
887 1001
 					FileHandler::getRemoteFile($target_src, $tmp_file);
888
-					if(!file_exists($tmp_file)) continue;
889
-					else
1002
+					if(!file_exists($tmp_file)) {
1003
+						continue;
1004
+					} else
890 1005
 					{
891 1006
 						list($_w, $_h, $_t, $_a) = @getimagesize($tmp_file);
892
-						if($_w<$width || $_h<$height) continue;
1007
+						if($_w<$width || $_h<$height) {
1008
+							continue;
1009
+						}
893 1010
 
894 1011
 						$source_file = $tmp_file;
895 1012
 						$is_tmp_file = true;
@@ -903,11 +1020,17 @@  discard block
 block discarded – undo
903 1020
 		{
904 1021
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
905 1022
 		}
906
-		if($is_tmp_file) FileHandler::removeFile($source_file);
1023
+		if($is_tmp_file) {
1024
+			FileHandler::removeFile($source_file);
1025
+		}
907 1026
 		// Return its path if a thumbnail is successfully genetated
908
-		if($output) return $thumbnail_url;
1027
+		if($output) {
1028
+			return $thumbnail_url;
1029
+		}
909 1030
 		// Create an empty file not to re-generate the thumbnail
910
-		else FileHandler::writeFile($thumbnail_file, '','w');
1031
+		else {
1032
+			FileHandler::writeFile($thumbnail_file, '','w');
1033
+		}
911 1034
 
912 1035
 		return;
913 1036
 	}
@@ -920,21 +1043,28 @@  discard block
 block discarded – undo
920 1043
 	 */
921 1044
 	function getExtraImages($time_interval = 43200)
922 1045
 	{
923
-		if(!$this->document_srl) return;
1046
+		if(!$this->document_srl) {
1047
+			return;
1048
+		}
924 1049
 		// variables for icon list
925 1050
 		$buffs = array();
926 1051
 
927 1052
 		$check_files = false;
928 1053
 
929 1054
 		// Check if secret post is
930
-		if($this->isSecret()) $buffs[] = "secret";
1055
+		if($this->isSecret()) {
1056
+			$buffs[] = "secret";
1057
+		}
931 1058
 
932 1059
 		// Set the latest time
933 1060
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
934 1061
 
935 1062
 		// Check new post
936
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
937
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1063
+		if($this->get('regdate')>$time_check) {
1064
+			$buffs[] = "new";
1065
+		} else if($this->get('last_update')>$time_check) {
1066
+			$buffs[] = "update";
1067
+		}
938 1068
 
939 1069
 		/*
940 1070
 		   $content = $this->get('content');
@@ -957,14 +1087,18 @@  discard block
 block discarded – undo
957 1087
 		 */
958 1088
 
959 1089
 		// Check the attachment
960
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1090
+		if($this->hasUploadedFiles()) {
1091
+			$buffs[] = "file";
1092
+		}
961 1093
 
962 1094
 		return $buffs;
963 1095
 	}
964 1096
 
965 1097
 	function getStatus()
966 1098
 	{
967
-		if(!$this->get('status')) return $this->getDefaultStatus();
1099
+		if(!$this->get('status')) {
1100
+			return $this->getDefaultStatus();
1101
+		}
968 1102
 		return $this->get('status');
969 1103
 	}
970 1104
 
@@ -975,12 +1109,16 @@  discard block
 block discarded – undo
975 1109
 	 */
976 1110
 	function printExtraImages($time_check = 43200)
977 1111
 	{
978
-		if(!$this->document_srl) return;
1112
+		if(!$this->document_srl) {
1113
+			return;
1114
+		}
979 1115
 		// Get the icon directory
980 1116
 		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
981 1117
 
982 1118
 		$buffs = $this->getExtraImages($time_check);
983
-		if(!count($buffs)) return;
1119
+		if(!count($buffs)) {
1120
+			return;
1121
+		}
984 1122
 
985 1123
 		$buff = array();
986 1124
 		foreach($buffs as $key => $val)
@@ -992,18 +1130,28 @@  discard block
 block discarded – undo
992 1130
 
993 1131
 	function hasUploadedFiles()
994 1132
 	{
995
-		if(!$this->document_srl) return;
1133
+		if(!$this->document_srl) {
1134
+			return;
1135
+		}
996 1136
 
997
-		if($this->isSecret() && !$this->isGranted()) return false;
1137
+		if($this->isSecret() && !$this->isGranted()) {
1138
+			return false;
1139
+		}
998 1140
 		return $this->get('uploaded_count')? true : false;
999 1141
 	}
1000 1142
 
1001 1143
 	function getUploadedFiles($sortIndex = 'file_srl')
1002 1144
 	{
1003
-		if(!$this->document_srl) return;
1145
+		if(!$this->document_srl) {
1146
+			return;
1147
+		}
1004 1148
 
1005
-		if($this->isSecret() && !$this->isGranted()) return;
1006
-		if(!$this->get('uploaded_count')) return;
1149
+		if($this->isSecret() && !$this->isGranted()) {
1150
+			return;
1151
+		}
1152
+		if(!$this->get('uploaded_count')) {
1153
+			return;
1154
+		}
1007 1155
 
1008 1156
 		if(!$this->uploadedFiles[$sortIndex])
1009 1157
 		{
@@ -1021,7 +1169,9 @@  discard block
 block discarded – undo
1021 1169
 	function getEditor()
1022 1170
 	{
1023 1171
 		$module_srl = $this->get('module_srl');
1024
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1172
+		if(!$module_srl) {
1173
+			$module_srl = Context::get('module_srl');
1174
+		}
1025 1175
 
1026 1176
 		$oEditorModel = getModel('editor');
1027 1177
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1035,8 +1185,12 @@  discard block
 block discarded – undo
1035 1185
 	function isEnableComment()
1036 1186
 	{
1037 1187
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1038
-		if (!$this->allowComment()) return false;
1039
-		if(!$this->isGranted() && $this->isSecret()) return false;
1188
+		if (!$this->allowComment()) {
1189
+			return false;
1190
+		}
1191
+		if(!$this->isGranted() && $this->isSecret()) {
1192
+			return false;
1193
+		}
1040 1194
 
1041 1195
 		return true;
1042 1196
 	}
@@ -1047,7 +1201,9 @@  discard block
 block discarded – undo
1047 1201
 	 */
1048 1202
 	function getCommentEditor()
1049 1203
 	{
1050
-		if(!$this->isEnableComment()) return;
1204
+		if(!$this->isEnableComment()) {
1205
+			return;
1206
+		}
1051 1207
 
1052 1208
 		$oEditorModel = getModel('editor');
1053 1209
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1059,10 +1215,14 @@  discard block
 block discarded – undo
1059 1215
 	 */
1060 1216
 	function getProfileImage()
1061 1217
 	{
1062
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1218
+		if(!$this->isExists() || !$this->get('member_srl')) {
1219
+			return;
1220
+		}
1063 1221
 		$oMemberModel = getModel('member');
1064 1222
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1065
-		if(!$profile_info) return;
1223
+		if(!$profile_info) {
1224
+			return;
1225
+		}
1066 1226
 
1067 1227
 		return $profile_info->src;
1068 1228
 	}
@@ -1074,7 +1234,9 @@  discard block
 block discarded – undo
1074 1234
 	function getSignature()
1075 1235
 	{
1076 1236
 		// Pass if a document doesn't exist
1077
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1237
+		if(!$this->isExists() || !$this->get('member_srl')) {
1238
+			return;
1239
+		}
1078 1240
 		// Get signature information
1079 1241
 		$oMemberModel = getModel('member');
1080 1242
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1088,7 +1250,9 @@  discard block
 block discarded – undo
1088 1250
 		if($signature)
1089 1251
 		{
1090 1252
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1091
-			if($max_signature_height) $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);
1253
+			if($max_signature_height) {
1254
+				$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);
1255
+			}
1092 1256
 		}
1093 1257
 
1094 1258
 		return $signature;
@@ -1112,20 +1276,25 @@  discard block
 block discarded – undo
1112 1276
 	function _checkAccessibleFromStatus()
1113 1277
 	{
1114 1278
 		$logged_info = Context::get('logged_info');
1115
-		if($logged_info->is_admin == 'Y') return true;
1279
+		if($logged_info->is_admin == 'Y') {
1280
+			return true;
1281
+		}
1116 1282
 
1117 1283
 		$status = $this->get('status');
1118
-		if(empty($status)) return false;
1284
+		if(empty($status)) {
1285
+			return false;
1286
+		}
1119 1287
 
1120 1288
 		$oDocumentModel = getModel('document');
1121 1289
 		$configStatusList = $oDocumentModel->getStatusList();
1122 1290
 
1123
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1124
-			return true;
1125
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1291
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1292
+					return true;
1293
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1126 1294
 		{
1127
-			if($this->get('member_srl') == $logged_info->member_srl)
1128
-				return true;
1295
+			if($this->get('member_srl') == $logged_info->member_srl) {
1296
+							return true;
1297
+			}
1129 1298
 		}
1130 1299
 		return false;
1131 1300
 	}
Please login to merge, or discard this patch.
modules/document/document.model.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	/**
473 473
 	 * Show pop-up menu of the selected posts
474 474
 	 * Printing, scrap, recommendations and negative, reported the Add Features
475
-	 * @return void
475
+	 * @return Object|null
476 476
 	 */
477 477
 	function getDocumentMenu()
478 478
 	{
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 
885 885
 	/**
886 886
 	 * Get a list for a particular module
887
-	 * @return void|Object
887
+	 * @return Object|null
888 888
 	 */
889 889
 	function getDocumentCategories()
890 890
 	{
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 	/**
971 971
 	 * Certain categories of information, return the template guhanhu
972 972
 	 * Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
973
-	 * @return void|Object
973
+	 * @return Object|null
974 974
 	 */
975 975
 	function getDocumentCategoryTplInfo()
976 976
 	{
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 	 * Setting sort index
1228 1228
 	 * @param object $obj
1229 1229
 	 * @param bool $load_extra_vars
1230
-	 * @return object
1230
+	 * @return stdClass
1231 1231
 	 */
1232 1232
 	function _setSortIndex($obj, $load_extra_vars)
1233 1233
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * documentModel class
5
- * model class of the module document
6
- *
7
- * @author NAVER ([email protected])
8
- * @package /modules/document
9
- * @version 0.1
10
- */
4
+	 * documentModel class
5
+	 * model class of the module document
6
+	 *
7
+	 * @author NAVER ([email protected])
8
+	 * @package /modules/document
9
+	 * @version 0.1
10
+	 */
11 11
 class documentModel extends document
12 12
 {
13 13
 	/**
Please login to merge, or discard this patch.
Spacing   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	function getDocumentExtraVarsFromDB($documentSrls)
37 37
 	{
38
-		if(!is_array($documentSrls) || count($documentSrls) == 0)
38
+		if (!is_array($documentSrls) || count($documentSrls) == 0)
39 39
 		{
40 40
 			return new Object(-1, 'msg_invalid_request');
41 41
 		}
@@ -56,52 +56,52 @@  discard block
 block discarded – undo
56 56
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
57 57
 
58 58
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
59
-		if(count($_document_list) <= 0) return;
59
+		if (count($_document_list) <= 0) return;
60 60
 
61 61
 		// Find all called the document object variable has been set extension
62 62
 		$document_srls = array();
63
-		foreach($_document_list as $key => $val)
63
+		foreach ($_document_list as $key => $val)
64 64
 		{
65
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
65
+			if (!$val->document_srl || $checked_documents[$val->document_srl]) continue;
66 66
 			$checked_documents[$val->document_srl] = true;
67 67
 			$document_srls[] = $val->document_srl;
68 68
 		}
69 69
 		// If the document number, return detected
70
-		if(!count($document_srls)) return;
70
+		if (!count($document_srls)) return;
71 71
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
72 72
 		//$obj->document_srl = implode(',',$document_srls);
73 73
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
74
-		if($output->toBool() && $output->data)
74
+		if ($output->toBool() && $output->data)
75 75
 		{
76
-			foreach($output->data as $key => $val)
76
+			foreach ($output->data as $key => $val)
77 77
 			{
78
-				if(!isset($val->value)) continue;
79
-				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
78
+				if (!isset($val->value)) continue;
79
+				if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
80 80
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
81 81
 			}
82 82
 		}
83 83
 
84 84
 		$user_lang_code = Context::getLangType();
85
-		for($i=0,$c=count($document_srls);$i<$c;$i++)
85
+		for ($i = 0, $c = count($document_srls); $i < $c; $i++)
86 86
 		{
87 87
 			$document_srl = $document_srls[$i];
88 88
 			unset($vars);
89 89
 
90
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
90
+			if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
91 91
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
92 92
 			$extra_keys = $this->getExtraKeys($module_srl);
93 93
 			$vars = $extra_vars[$document_srl];
94 94
 			$document_lang_code = $_document_list[$document_srl]->get('lang_code');
95 95
 			// Expand the variable processing
96
-			if(count($extra_keys))
96
+			if (count($extra_keys))
97 97
 			{
98
-				foreach($extra_keys as $idx => $key)
98
+				foreach ($extra_keys as $idx => $key)
99 99
 				{
100 100
 					$extra_keys[$idx] = clone($key);
101 101
 					$val = $vars[$idx];
102
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
103
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
104
-					else if(isset($val[0])) $v = $val[0];
102
+					if (isset($val[$user_lang_code])) $v = $val[$user_lang_code];
103
+					else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code];
104
+					else if (isset($val[0])) $v = $val[0];
105 105
 					else $v = null;
106 106
 					$extra_keys[$idx]->value = $v;
107 107
 				}
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 			$evars = new ExtraVar($module_srl);
112 112
 			$evars->setExtraVarKeys($extra_keys);
113 113
 			// Title Processing
114
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
114
+			if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]);
115 115
 			// Information processing
116
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
116
+			if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]);
117 117
 
118
-			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
118
+			if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
119 119
 			{
120 120
 				unset($checked_documents[$document_srl]);
121 121
 			}
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 	 * @param array $columnList
133 133
 	 * @return documentItem
134 134
 	 */
135
-	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
135
+	function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
136 136
 	{
137
-		if(!$document_srl) return new documentItem();
137
+		if (!$document_srl) return new documentItem();
138 138
 
139
-		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
139
+		if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
140 140
 		{
141 141
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
142 142
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
143
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
143
+			if ($load_extra_vars) $this->setToAllDocumentExtraVars();
144 144
 		}
145
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
145
+		if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
146 146
 
147 147
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
148 148
 	}
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 	 * @param array $columnList
156 156
 	 * @return array value type is documentItem
157 157
 	 */
158
-	function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
158
+	function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
159 159
 	{
160
-		if(is_array($document_srls))
160
+		if (is_array($document_srls))
161 161
 		{
162 162
 			$list_count = count($document_srls);
163
-			$document_srls = implode(',',$document_srls);
163
+			$document_srls = implode(',', $document_srls);
164 164
 		}
165 165
 		else
166 166
 		{
@@ -173,33 +173,33 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$output = executeQuery('document.getDocuments', $args, $columnList);
175 175
 		$document_list = $output->data;
176
-		if(!$document_list) return;
177
-		if(!is_array($document_list)) $document_list = array($document_list);
176
+		if (!$document_list) return;
177
+		if (!is_array($document_list)) $document_list = array($document_list);
178 178
 
179 179
 		$document_count = count($document_list);
180
-		foreach($document_list as $key => $attribute)
180
+		foreach ($document_list as $key => $attribute)
181 181
 		{
182 182
 			$document_srl = $attribute->document_srl;
183
-			if(!$document_srl) continue;
183
+			if (!$document_srl) continue;
184 184
 
185
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
185
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
186 186
 			{
187 187
 				$oDocument = null;
188 188
 				$oDocument = new documentItem();
189 189
 				$oDocument->setAttribute($attribute, false);
190
-				if($is_admin) $oDocument->setGrant();
190
+				if ($is_admin) $oDocument->setGrant();
191 191
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
192 192
 			}
193 193
 
194 194
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
195 195
 		}
196 196
 
197
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
197
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
198 198
 
199 199
 		$output = null;
200
-		if(count($result))
200
+		if (count($result))
201 201
 		{
202
-			foreach($result as $document_srl => $val)
202
+			foreach ($result as $document_srl => $val)
203 203
 			{
204 204
 				$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
205 205
 			}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param array $columnList
217 217
 	 * @return Object
218 218
 	 */
219
-	function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
219
+	function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
220 220
 	{
221 221
 		$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
222 222
 		$obj->sort_index = $sort_check->sort_index;
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 
225 225
 		$this->_setSearchOption($obj, $args, $query_id, $use_division);
226 226
 
227
-		if ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
227
+		if ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars'))
228 228
 		{
229 229
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
230
-			$args->sort_index = str_replace('documents.','',$args->sort_index);
230
+			$args->sort_index = str_replace('documents.', '', $args->sort_index);
231 231
 			$output = executeQueryArray($query_id, $args);
232 232
 		}
233 233
 		elseif ($sort_check->isExtraVars)
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 			// document.getDocumentList query execution
240 240
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
241 241
 			$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
242
-			if(isset($groupByQuery[$query_id]))
242
+			if (isset($groupByQuery[$query_id]))
243 243
 			{
244 244
 				$group_args = clone($args);
245
-				$group_args->sort_index = 'documents.'.$args->sort_index;
245
+				$group_args->sort_index = 'documents.' . $args->sort_index;
246 246
 				$output = executeQueryArray($query_id, $group_args);
247
-				if(!$output->toBool()||!count($output->data)) return $output;
247
+				if (!$output->toBool() || !count($output->data)) return $output;
248 248
 
249
-				foreach($output->data as $key => $val)
249
+				foreach ($output->data as $key => $val)
250 250
 				{
251
-					if($val->document_srl) $target_srls[] = $val->document_srl;
251
+					if ($val->document_srl) $target_srls[] = $val->document_srl;
252 252
 				}
253 253
 
254 254
 				$page_navigation = $output->page_navigation;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 				$virtual_number = $keys[0];
257 257
 
258 258
 				$target_args = new stdClass();
259
-				$target_args->document_srls = implode(',',$target_srls);
259
+				$target_args->document_srls = implode(',', $target_srls);
260 260
 				$target_args->list_order = $args->sort_index;
261 261
 				$target_args->order_type = $args->order_type;
262 262
 				$target_args->list_count = $args->list_count;
@@ -273,35 +273,35 @@  discard block
 block discarded – undo
273 273
 			}
274 274
 		}
275 275
 		// Return if no result or an error occurs
276
-		if(!$output->toBool()||!count($output->data)) return $output;
276
+		if (!$output->toBool() || !count($output->data)) return $output;
277 277
 		$idx = 0;
278 278
 		$data = $output->data;
279 279
 		unset($output->data);
280 280
 
281
-		if(!isset($virtual_number))
281
+		if (!isset($virtual_number))
282 282
 		{
283 283
 			$keys = array_keys($data);
284 284
 			$virtual_number = $keys[0];
285 285
 		}
286 286
 
287
-		if($except_notice)
287
+		if ($except_notice)
288 288
 		{
289
-			foreach($data as $key => $attribute)
289
+			foreach ($data as $key => $attribute)
290 290
 			{
291
-				if($attribute->is_notice == 'Y') $virtual_number --;
291
+				if ($attribute->is_notice == 'Y') $virtual_number--;
292 292
 			}
293 293
 		}
294 294
 
295
-		foreach($data as $key => $attribute)
295
+		foreach ($data as $key => $attribute)
296 296
 		{
297
-			if($except_notice && $attribute->is_notice == 'Y') continue;
297
+			if ($except_notice && $attribute->is_notice == 'Y') continue;
298 298
 			$document_srl = $attribute->document_srl;
299
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
299
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
300 300
 			{
301 301
 				$oDocument = null;
302 302
 				$oDocument = new documentItem();
303 303
 				$oDocument->setAttribute($attribute, false);
304
-				if($is_admin) $oDocument->setGrant();
304
+				if ($is_admin) $oDocument->setGrant();
305 305
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
306 306
 			}
307 307
 
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 			$virtual_number--;
310 310
 		}
311 311
 
312
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
312
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
313 313
 
314
-		if(count($output->data))
314
+		if (count($output->data))
315 315
 		{
316
-			foreach($output->data as $number => $document)
316
+			foreach ($output->data as $number => $document)
317 317
 			{
318 318
 				$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
319 319
 			}
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 	{
333 333
 		$args = new stdClass();
334 334
 		$args->module_srl = $obj->module_srl;
335
-		$args->category_srl= $obj->category_srl;
335
+		$args->category_srl = $obj->category_srl;
336 336
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
337
-		if(!$output->toBool()||!$output->data) return;
337
+		if (!$output->toBool() || !$output->data) return;
338 338
 
339
-		foreach($output->data as $key => $val)
339
+		foreach ($output->data as $key => $val)
340 340
 		{
341 341
 			$document_srl = $val->document_srl;
342
-			if(!$document_srl) continue;
342
+			if (!$document_srl) continue;
343 343
 
344
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
344
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
345 345
 			{
346 346
 				$oDocument = null;
347 347
 				$oDocument = new documentItem();
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		}
353 353
 		$this->setToAllDocumentExtraVars();
354 354
 
355
-		foreach($result->data as $document_srl => $val)
355
+		foreach ($result->data as $document_srl => $val)
356 356
 		{
357 357
 			$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
358 358
 		}
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	function getExtraKeys($module_srl)
370 370
 	{
371
-		if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
371
+		if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
372 372
 		{
373 373
 			$keys = false;
374 374
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
375
-			if($oCacheHandler->isSupport())
375
+			if ($oCacheHandler->isSupport())
376 376
 			{
377 377
 				$object_key = 'module_document_extra_keys:' . $module_srl;
378 378
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
 			$oExtraVar = ExtraVar::getInstance($module_srl);
383 383
 
384
-			if($keys === false)
384
+			if ($keys === false)
385 385
 			{
386 386
 				$obj = new stdClass();
387 387
 				$obj->module_srl = $module_srl;
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 
392 392
 				// correcting index order
393 393
 				$isFixed = FALSE;
394
-				if(is_array($output->data))
394
+				if (is_array($output->data))
395 395
 				{
396 396
 					$prevIdx = 0;
397
-					foreach($output->data as $no => $value)
397
+					foreach ($output->data as $no => $value)
398 398
 					{
399 399
 						// case first
400
-						if($prevIdx == 0 && $value->idx != 1)
400
+						if ($prevIdx == 0 && $value->idx != 1)
401 401
 						{
402 402
 							$args = new stdClass();
403 403
 							$args->module_srl = $module_srl;
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						}
412 412
 
413 413
 						// case others
414
-						if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
414
+						if ($prevIdx > 0 && $prevIdx + 1 != $value->idx)
415 415
 						{
416 416
 							$args = new stdClass();
417 417
 							$args->module_srl = $module_srl;
@@ -428,16 +428,16 @@  discard block
 block discarded – undo
428 428
 					}
429 429
 				}
430 430
 
431
-				if($isFixed)
431
+				if ($isFixed)
432 432
 				{
433 433
 					$output = executeQueryArray('document.getDocumentExtraKeys', $obj);
434 434
 				}
435 435
 
436 436
 				$oExtraVar->setExtraVarKeys($output->data);
437 437
 				$keys = $oExtraVar->getExtraVars();
438
-				if(!$keys) $keys = array();
438
+				if (!$keys) $keys = array();
439 439
 
440
-				if($oCacheHandler->isSupport())
440
+				if ($oCacheHandler->isSupport())
441 441
 				{
442 442
 					$oCacheHandler->put($cache_key, $keys);
443 443
 				}
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 	 */
459 459
 	function getExtraVars($module_srl, $document_srl)
460 460
 	{
461
-		if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
461
+		if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
462 462
 		{
463 463
 			// Extended to extract the values of variables set
464 464
 			$oDocument = $this->getDocument($document_srl, false);
465 465
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
466 466
 			$this->setToAllDocumentExtraVars();
467 467
 		}
468
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
468
+		if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
469 469
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
470 470
 	}
471 471
 
@@ -488,71 +488,71 @@  discard block
 block discarded – undo
488 488
 
489 489
 		$oDocumentController = getController('document');
490 490
 		// Members must be a possible feature
491
-		if($logged_info->member_srl)
491
+		if ($logged_info->member_srl)
492 492
 		{
493 493
 			$oDocumentModel = getModel('document');
494 494
 			$columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
495 495
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
496 496
 			$module_srl = $oDocument->get('module_srl');
497 497
 			$member_srl = $oDocument->get('member_srl');
498
-			if(!$module_srl) return new Object(-1, 'msg_invalid_request');
498
+			if (!$module_srl) return new Object(-1, 'msg_invalid_request');
499 499
 
500 500
 			$oModuleModel = getModel('module');
501
-			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
502
-			if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
501
+			$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
502
+			if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
503 503
 			{
504 504
 				// Add a Referral Button
505 505
 				$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
506
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
506
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript');
507 507
 			}
508 508
 
509
-			if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
509
+			if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
510 510
 			{
511 511
 				// Add button to negative
512
-				$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
513
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
512
+				$url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
513
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
514 514
 			}
515 515
 
516 516
 			// Adding Report
517 517
 			$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
518
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
518
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript');
519 519
 
520 520
 			// Add Bookmark button
521 521
 			$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
522
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
522
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript');
523 523
 		}
524 524
 		// Add print button
525
-		$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
526
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
525
+		$url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl);
526
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument');
527 527
 		// Call a trigger (after)
528 528
 		ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
529
-		if($this->grant->manager)
529
+		if ($this->grant->manager)
530 530
 		{
531 531
 			$str_confirm = Context::getLang('confirm_move');
532 532
 			$url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl);
533
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
533
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript');
534 534
 		}
535 535
 
536 536
 		// If you are managing to find posts by ip
537
-		if($logged_info->is_admin == 'Y')
537
+		if ($logged_info->is_admin == 'Y')
538 538
 		{
539 539
 			$oDocumentModel = getModel('document');
540
-			$oDocument = $oDocumentModel->getDocument($document_srl);	//before setting document recycle
540
+			$oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
541 541
 
542
-			if($oDocument->isExists())
542
+			if ($oDocument->isExists())
543 543
 			{
544 544
 				// Find a post equivalent to ip address
545
-				$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
546
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
545
+				$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress());
546
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
547 547
 
548 548
 				$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
549
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
549
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
550 550
 			}
551 551
 		}
552 552
 		// Changing the language of pop-up menu
553 553
 		$menus = Context::get('document_popup_menu_list');
554 554
 		$menus_count = count($menus);
555
-		for($i=0;$i<$menus_count;$i++)
555
+		for ($i = 0; $i < $menus_count; $i++)
556 556
 		{
557 557
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
558 558
 		}
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 	 */
569 569
 	function getDocumentCount($module_srl, $search_obj = NULL)
570 570
 	{
571
-		if(is_null($search_obj)) $search_obj = new stdClass();
571
+		if (is_null($search_obj)) $search_obj = new stdClass();
572 572
 		$search_obj->module_srl = $module_srl;
573 573
 
574 574
 		$output = executeQuery('document.getDocumentCount', $search_obj);
575 575
 		// Return total number of
576 576
 		$total_count = $output->data->count;
577
-		return (int)$total_count;
577
+		return (int) $total_count;
578 578
 	}
579 579
 
580 580
 	/**
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	function getDocumentCountByGroupStatus($search_obj = NULL)
586 586
 	{
587 587
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
588
-		if(!$output->toBool()) return array();
588
+		if (!$output->toBool()) return array();
589 589
 
590 590
 		return $output->data;
591 591
 	}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		$output = executeQuery('document.getDocumentExtraVarsCount', $args);
605 605
 		// Return total number of
606 606
 		$total_count = $output->data->count;
607
-		return (int)$total_count;
607
+		return (int) $total_count;
608 608
 	}
609 609
 
610 610
 	/**
@@ -621,15 +621,15 @@  discard block
 block discarded – undo
621 621
 
622 622
 		$this->_setSearchOption($opt, $args, $query_id, $use_division);
623 623
 
624
-		if($sort_check->isExtraVars)
624
+		if ($sort_check->isExtraVars)
625 625
 		{
626 626
 			return 1;
627 627
 		}
628 628
 		else
629 629
 		{
630
-			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
630
+			if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
631 631
 			{
632
-				if($args->order_type === 'desc')
632
+				if ($args->order_type === 'desc')
633 633
 				{
634 634
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
635 635
 				}
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		// Guhanhu total number of the article search page
648 648
 		$output = executeQuery($query_id . 'Page', $args);
649 649
 		$count = $output->data->count;
650
-		$page = (int)(($count-1)/$opt->list_count)+1;
650
+		$page = (int) (($count - 1) / $opt->list_count) + 1;
651 651
 		return $page;
652 652
 	}
653 653
 
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	function getCategory($category_srl, $columnList = array())
661 661
 	{
662
-		$args =new stdClass();
662
+		$args = new stdClass();
663 663
 		$args->category_srl = $category_srl;
664 664
 		$output = executeQuery('document.getCategory', $args, $columnList);
665 665
 
666 666
 		$node = $output->data;
667
-		if(!$node) return;
667
+		if (!$node) return;
668 668
 
669
-		if($node->group_srls)
669
+		if ($node->group_srls)
670 670
 		{
671
-			$group_srls = explode(',',$node->group_srls);
671
+			$group_srls = explode(',', $node->group_srls);
672 672
 			unset($node->group_srls);
673 673
 			$node->group_srls = $group_srls;
674 674
 		}
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
 	{
690 690
 		$args = new stdClass();
691 691
 		$args->category_srl = $category_srl;
692
-		$output = executeQuery('document.getChildCategoryCount',$args);
693
-		if($output->data->count > 0) return true;
692
+		$output = executeQuery('document.getChildCategoryCount', $args);
693
+		if ($output->data->count > 0) return true;
694 694
 		return false;
695 695
 	}
696 696
 
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 		// Category of the target module file swollen
707 707
 		$filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
708 708
 		// If the target file to the cache file regeneration category
709
-		if(!file_exists($filename))
709
+		if (!file_exists($filename))
710 710
 		{
711 711
 			$oDocumentController = getController('document');
712
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
712
+			if (!$oDocumentController->makeCategoryFile($module_srl)) return array();
713 713
 		}
714 714
 
715 715
 		include($filename);
@@ -729,10 +729,10 @@  discard block
 block discarded – undo
729 729
 	 */
730 730
 	function _arrangeCategory(&$document_category, $list, $depth)
731 731
 	{
732
-		if(!count($list)) return;
732
+		if (!count($list)) return;
733 733
 		$idx = 0;
734 734
 		$list_order = array();
735
-		foreach($list as $key => $val)
735
+		foreach ($list as $key => $val)
736 736
 		{
737 737
 			$obj = new stdClass;
738 738
 			$obj->mid = $val['mid'];
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 			$obj->parent_srl = $val['parent_srl'];
742 742
 			$obj->title = $obj->text = $val['text'];
743 743
 			$obj->description = $val['description'];
744
-			$obj->expand = $val['expand']=='Y'?true:false;
744
+			$obj->expand = $val['expand'] == 'Y' ? true : false;
745 745
 			$obj->color = $val['color'];
746 746
 			$obj->document_count = $val['document_count'];
747 747
 			$obj->depth = $depth;
@@ -749,26 +749,26 @@  discard block
 block discarded – undo
749 749
 			$obj->childs = array();
750 750
 			$obj->grant = $val['grant'];
751 751
 
752
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
752
+			if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
753 753
 			else $selected = false;
754 754
 
755 755
 			$obj->selected = $selected;
756 756
 
757 757
 			$list_order[$idx++] = $obj->category_srl;
758 758
 			// If you have a parent category of child nodes apply data
759
-			if($obj->parent_srl)
759
+			if ($obj->parent_srl)
760 760
 			{
761 761
 				$parent_srl = $obj->parent_srl;
762 762
 				$document_count = $obj->document_count;
763 763
 				$expand = $obj->expand;
764
-				if($selected) $expand = true;
764
+				if ($selected) $expand = true;
765 765
 
766
-				while($parent_srl)
766
+				while ($parent_srl)
767 767
 				{
768 768
 					$document_category[$parent_srl]->document_count += $document_count;
769 769
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
770 770
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
771
-					if($expand) $document_category[$parent_srl]->expand = $expand;
771
+					if ($expand) $document_category[$parent_srl]->expand = $expand;
772 772
 
773 773
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
774 774
 				}
@@ -776,10 +776,10 @@  discard block
 block discarded – undo
776 776
 
777 777
 			$document_category[$key] = $obj;
778 778
 
779
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
779
+			if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1);
780 780
 		}
781 781
 		$document_category[$list_order[0]]->first = true;
782
-		$document_category[$list_order[count($list_order)-1]]->last = true;
782
+		$document_category[$list_order[count($list_order) - 1]]->last = true;
783 783
 	}
784 784
 
785 785
 	/**
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 		$args->module_srl = $module_srl;
795 795
 		$args->category_srl = $category_srl;
796 796
 		$output = executeQuery('document.getCategoryDocumentCount', $args);
797
-		return (int)$output->data->count;
797
+		return (int) $output->data->count;
798 798
 	}
799 799
 
800 800
 	/**
@@ -804,8 +804,8 @@  discard block
 block discarded – undo
804 804
 	 */
805 805
 	function getCategoryXmlFile($module_srl)
806 806
 	{
807
-		$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
808
-		if(!file_exists($xml_file))
807
+		$xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl);
808
+		if (!file_exists($xml_file))
809 809
 		{
810 810
 			$oDocumentController = getController('document');
811 811
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
 	 */
821 821
 	function getCategoryPhpFile($module_srl)
822 822
 	{
823
-		$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
824
-		if(!file_exists($php_file))
823
+		$php_file = sprintf('files/cache/document_category/%s.php', $module_srl);
824
+		if (!file_exists($php_file))
825 825
 		{
826 826
 			$oDocumentController = getController('document');
827 827
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 	 */
837 837
 	function getMonthlyArchivedList($obj)
838 838
 	{
839
-		if($obj->mid)
839
+		if ($obj->mid)
840 840
 		{
841 841
 			$oModuleModel = getModel('module');
842 842
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -844,13 +844,13 @@  discard block
 block discarded – undo
844 844
 		}
845 845
 		// Module_srl passed the array may be a check whether the array
846 846
 		$args = new stdClass;
847
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
847
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
848 848
 		else $args->module_srl = $obj->module_srl;
849 849
 
850 850
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
851
-		if(!$output->toBool()||!$output->data) return $output;
851
+		if (!$output->toBool() || !$output->data) return $output;
852 852
 
853
-		if(!is_array($output->data)) $output->data = array($output->data);
853
+		if (!is_array($output->data)) $output->data = array($output->data);
854 854
 
855 855
 		return $output;
856 856
 	}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 */
863 863
 	function getDailyArchivedList($obj)
864 864
 	{
865
-		if($obj->mid)
865
+		if ($obj->mid)
866 866
 		{
867 867
 			$oModuleModel = getModel('module');
868 868
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -870,14 +870,14 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 		// Module_srl passed the array may be a check whether the array
872 872
 		$args = new stdClass;
873
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
873
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
874 874
 		else $args->module_srl = $obj->module_srl;
875 875
 		$args->regdate = $obj->regdate;
876 876
 
877 877
 		$output = executeQuery('document.getDailyArchivedList', $args);
878
-		if(!$output->toBool()) return $output;
878
+		if (!$output->toBool()) return $output;
879 879
 
880
-		if(!is_array($output->data)) $output->data = array($output->data);
880
+		if (!is_array($output->data)) $output->data = array($output->data);
881 881
 
882 882
 		return $output;
883 883
 	}
@@ -888,17 +888,17 @@  discard block
 block discarded – undo
888 888
 	 */
889 889
 	function getDocumentCategories()
890 890
 	{
891
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
891
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
892 892
 		$module_srl = Context::get('module_srl');
893
-		$categories= $this->getCategoryList($module_srl);
893
+		$categories = $this->getCategoryList($module_srl);
894 894
 		$lang = Context::get('lang');
895 895
 		// No additional category
896 896
 		$output = "0,0,{$lang->none_category}\n";
897
-		if($categories)
897
+		if ($categories)
898 898
 		{
899
-			foreach($categories as $category_srl => $category)
899
+			foreach ($categories as $category_srl => $category)
900 900
 			{
901
-				$output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
901
+				$output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title);
902 902
 			}
903 903
 		}
904 904
 		$this->add('categories', $output);
@@ -910,13 +910,13 @@  discard block
 block discarded – undo
910 910
 	 */
911 911
 	function getDocumentConfig()
912 912
 	{
913
-		if(!$GLOBALS['__document_config__'])
913
+		if (!$GLOBALS['__document_config__'])
914 914
 		{
915 915
 			$oModuleModel = getModel('module');
916 916
 			$config = $oModuleModel->getModuleConfig('document');
917 917
 
918
-			if(!$config) $config = new stdClass();
919
-			if(!$config->thumbnail_type) $config->thumbnail_type = 'crop';
918
+			if (!$config) $config = new stdClass();
919
+			if (!$config->thumbnail_type) $config->thumbnail_type = 'crop';
920 920
 			$GLOBALS['__document_config__'] = $config;
921 921
 		}
922 922
 		return $GLOBALS['__document_config__'];
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 
939 939
 		// Get information of module_grants
940 940
 		$oTemplate = &TemplateHandler::getInstance();
941
-		return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
941
+		return $oTemplate->compile($this->module_path . 'tpl', 'extra_keys');
942 942
 	}
943 943
 
944 944
 	/**
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 
965 965
 		// Get information of module_grants
966 966
 		$oTemplate = &TemplateHandler::getInstance();
967
-		return $oTemplate->compile($this->module_path.'tpl', 'category_list');
967
+		return $oTemplate->compile($this->module_path . 'tpl', 'category_list');
968 968
 	}
969 969
 
970 970
 	/**
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
982 982
 		// Check permissions
983 983
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
984
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
984
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
985 985
 
986 986
 		$category_srl = Context::get('category_srl');
987 987
 		$category_info = $this->getCategory($category_srl);
988
-		if(!$category_info)
988
+		if (!$category_info)
989 989
 		{
990 990
 			return new Object(-1, 'msg_invalid_request');
991 991
 		}
@@ -1001,14 +1001,14 @@  discard block
 block discarded – undo
1001 1001
 	 */
1002 1002
 	function getDocumentSrlByAlias($mid, $alias)
1003 1003
 	{
1004
-		if(!$mid || !$alias) return null;
1004
+		if (!$mid || !$alias) return null;
1005 1005
 		$site_module_info = Context::get('site_module_info');
1006 1006
 		$args = new stdClass;
1007 1007
 		$args->mid = $mid;
1008 1008
 		$args->alias_title = $alias;
1009 1009
 		$args->site_srl = $site_module_info->site_srl;
1010 1010
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1011
-		if(!$output->data) return null;
1011
+		if (!$output->data) return null;
1012 1012
 		else return $output->data->document_srl;
1013 1013
 	}
1014 1014
 
@@ -1020,15 +1020,15 @@  discard block
 block discarded – undo
1020 1020
 	 */
1021 1021
 	function getDocumentSrlByTitle($module_srl, $title)
1022 1022
 	{
1023
-		if(!$module_srl || !$title) return null;
1023
+		if (!$module_srl || !$title) return null;
1024 1024
 		$args = new stdClass;
1025 1025
 		$args->module_srl = $module_srl;
1026 1026
 		$args->title = $title;
1027 1027
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1028
-		if(!$output->data) return null;
1028
+		if (!$output->data) return null;
1029 1029
 		else
1030 1030
 		{
1031
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1031
+			if (is_array($output->data)) return $output->data[0]->document_srl;
1032 1032
 			return $output->data->document_srl;
1033 1033
 		}
1034 1034
 	}
@@ -1040,12 +1040,12 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	function getAlias($document_srl)
1042 1042
 	{
1043
-		if(!$document_srl) return null;
1043
+		if (!$document_srl) return null;
1044 1044
 		$args = new stdClass;
1045 1045
 		$args->document_srl = $document_srl;
1046 1046
 		$output = executeQueryArray('document.getAliases', $args);
1047 1047
 
1048
-		if(!$output->data) return null;
1048
+		if (!$output->data) return null;
1049 1049
 		else return $output->data[0]->alias_title;
1050 1050
 	}
1051 1051
 
@@ -1088,46 +1088,46 @@  discard block
 block discarded – undo
1088 1088
 	{
1089 1089
 		// Variable check
1090 1090
 		$args = new stdClass;
1091
-		$args->category_srl = $obj->category_srl?$obj->category_srl:null;
1091
+		$args->category_srl = $obj->category_srl ? $obj->category_srl : null;
1092 1092
 		$args->sort_index = $obj->sort_index;
1093
-		$args->order_type = $obj->order_type?$obj->order_type:'desc';
1094
-		$args->page = $obj->page?$obj->page:1;
1095
-		$args->list_count = $obj->list_count?$obj->list_count:20;
1096
-		$args->page_count = $obj->page_count?$obj->page_count:10;
1093
+		$args->order_type = $obj->order_type ? $obj->order_type : 'desc';
1094
+		$args->page = $obj->page ? $obj->page : 1;
1095
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
1096
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
1097 1097
 		// Search options
1098 1098
 		$search_target = $obj->search_target;
1099 1099
 		$search_keyword = $obj->search_keyword;
1100
-		if($search_target && $search_keyword)
1100
+		if ($search_target && $search_keyword)
1101 1101
 		{
1102
-			switch($search_target)
1102
+			switch ($search_target)
1103 1103
 			{
1104 1104
 				case 'title' :
1105 1105
 				case 'content' :
1106
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1107
-					$args->{"s_".$search_target} = $search_keyword;
1106
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1107
+					$args->{"s_" . $search_target} = $search_keyword;
1108 1108
 					$use_division = true;
1109 1109
 					break;
1110 1110
 				case 'title_content' :
1111
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1111
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1112 1112
 					$args->s_title = $search_keyword;
1113 1113
 					$args->s_content = $search_keyword;
1114 1114
 					break;
1115 1115
 				case 'user_id' :
1116
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1116
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1117 1117
 					$args->s_user_id = $search_keyword;
1118
-					$args->sort_index = 'documents.'.$args->sort_index;
1118
+					$args->sort_index = 'documents.' . $args->sort_index;
1119 1119
 					break;
1120 1120
 				case 'user_name' :
1121 1121
 				case 'nick_name' :
1122 1122
 				case 'email_address' :
1123 1123
 				case 'homepage' :
1124
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1125
-					$args->{"s_".$search_target} = $search_keyword;
1124
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1125
+					$args->{"s_" . $search_target} = $search_keyword;
1126 1126
 					break;
1127 1127
 				case 'is_notice' :
1128 1128
 				case 'is_secret' :
1129
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1130
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1129
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1130
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1131 1131
 					break;
1132 1132
 				case 'member_srl' :
1133 1133
 				case 'readed_count' :
@@ -1136,21 +1136,21 @@  discard block
 block discarded – undo
1136 1136
 				case 'comment_count' :
1137 1137
 				case 'trackback_count' :
1138 1138
 				case 'uploaded_count' :
1139
-					$args->{"s_".$search_target} = (int)$search_keyword;
1139
+					$args->{"s_" . $search_target} = (int) $search_keyword;
1140 1140
 					break;
1141 1141
 				case 'regdate' :
1142 1142
 				case 'last_update' :
1143 1143
 				case 'ipaddress' :
1144 1144
 				case 'tag' :
1145
-					$args->{"s_".$search_target} = $search_keyword;
1145
+					$args->{"s_" . $search_target} = $search_keyword;
1146 1146
 					break;
1147 1147
 			}
1148 1148
 		}
1149 1149
 
1150 1150
 		$output = executeQueryArray('document.getTrashList', $args);
1151
-		if($output->data)
1151
+		if ($output->data)
1152 1152
 		{
1153
-			foreach($output->data as $key => $attribute)
1153
+			foreach ($output->data as $key => $attribute)
1154 1154
 			{
1155 1155
 				$oDocument = null;
1156 1156
 				$oDocument = new documentItem();
@@ -1169,46 +1169,46 @@  discard block
 block discarded – undo
1169 1169
 	{
1170 1170
 		$args = new stdClass;
1171 1171
 		$document_srl = Context::get('document_srl');
1172
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
1172
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
1173 1173
 
1174 1174
 		$point = Context::get('point');
1175
-		if($point != -1) $point = 1;
1175
+		if ($point != -1) $point = 1;
1176 1176
 
1177 1177
 		$oDocumentModel = getModel('document');
1178 1178
 		$columnList = array('document_srl', 'module_srl');
1179 1179
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1180 1180
 		$module_srl = $oDocument->get('module_srl');
1181
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
1181
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
1182 1182
 
1183 1183
 		$oModuleModel = getModel('module');
1184
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1185
-		if($point == -1)
1184
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
1185
+		if ($point == -1)
1186 1186
 		{
1187
-			if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request');
1187
+			if ($document_config->use_vote_down != 'S') return new Object(-1, 'msg_invalid_request');
1188 1188
 			$args->below_point = 0;
1189 1189
 		}
1190 1190
 		else
1191 1191
 		{
1192
-			if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request');
1192
+			if ($document_config->use_vote_up != 'S') return new Object(-1, 'msg_invalid_request');
1193 1193
 			$args->more_point = 0;
1194 1194
 		}
1195 1195
 
1196 1196
 		$args->document_srl = $document_srl;
1197 1197
 
1198
-		$output = executeQueryArray('document.getVotedMemberList',$args);
1199
-		if(!$output->toBool()) return $output;
1198
+		$output = executeQueryArray('document.getVotedMemberList', $args);
1199
+		if (!$output->toBool()) return $output;
1200 1200
 
1201 1201
 		$oMemberModel = getModel('member');
1202
-		if($output->data)
1202
+		if ($output->data)
1203 1203
 		{
1204
-			foreach($output->data as $k => $d)
1204
+			foreach ($output->data as $k => $d)
1205 1205
 			{
1206 1206
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1207 1207
 				$output->data[$k]->src = $profile_image->src;
1208 1208
 			}
1209 1209
 		}
1210 1210
 
1211
-		$this->add('voted_member_list',$output->data);
1211
+		$this->add('voted_member_list', $output->data);
1212 1212
 	}
1213 1213
 
1214 1214
 	/**
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 	function getStatusNameList()
1219 1219
 	{
1220 1220
 		global $lang;
1221
-		if(!isset($lang->status_name_list))
1221
+		if (!isset($lang->status_name_list))
1222 1222
 			return array_flip($this->getStatusList());
1223 1223
 		else return $lang->status_name_list;
1224 1224
 	}
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 	{
1234 1234
 		$sortIndex = $obj->sort_index;
1235 1235
 		$isExtraVars = false;
1236
-		if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl')))
1236
+		if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl')))
1237 1237
 		{
1238 1238
 			// get module_srl extra_vars list
1239 1239
 			if ($load_extra_vars)
@@ -1248,11 +1248,11 @@  discard block
 block discarded – undo
1248 1248
 				else
1249 1249
 				{
1250 1250
 					$check_array = array();
1251
-					foreach($extra_output->data as $val)
1251
+					foreach ($extra_output->data as $val)
1252 1252
 					{
1253 1253
 						$check_array[] = $val->eid;
1254 1254
 					}
1255
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1255
+					if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1256 1256
 					else $isExtraVars = true;
1257 1257
 				}
1258 1258
 			}
@@ -1280,13 +1280,13 @@  discard block
 block discarded – undo
1280 1280
 	{
1281 1281
 		// Variable check
1282 1282
 		$args = new stdClass();
1283
-		$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1283
+		$args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null;
1284 1284
 		$args->order_type = $searchOpt->order_type;
1285
-		$args->page = $searchOpt->page?$searchOpt->page:1;
1286
-		$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1287
-		$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1288
-		$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1289
-		$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1285
+		$args->page = $searchOpt->page ? $searchOpt->page : 1;
1286
+		$args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20;
1287
+		$args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10;
1288
+		$args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null;
1289
+		$args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null;
1290 1290
 		$args->member_srl = $searchOpt->member_srl;
1291 1291
 
1292 1292
 		$logged_info = Context::get('logged_info');
@@ -1295,10 +1295,10 @@  discard block
 block discarded – undo
1295 1295
 		
1296 1296
 		// Check the target and sequence alignment
1297 1297
 		$orderType = array('desc' => 1, 'asc' => 1);
1298
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1298
+		if (!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1299 1299
 
1300 1300
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1301
-		if($searchOpt->mid)
1301
+		if ($searchOpt->mid)
1302 1302
 		{
1303 1303
 			$oModuleModel = getModel('module');
1304 1304
 			$args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -1306,30 +1306,30 @@  discard block
 block discarded – undo
1306 1306
 		}
1307 1307
 
1308 1308
 		// Module_srl passed the array may be a check whether the array
1309
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1309
+		if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1310 1310
 		else $args->module_srl = $searchOpt->module_srl;
1311 1311
 
1312 1312
 		// Except for the test module_srl
1313
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1313
+		if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1314 1314
 		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1315 1315
 
1316 1316
 		// only admin document list, temp document showing
1317
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1317
+		if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1318 1318
 		else
1319 1319
 		{
1320
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1320
+			if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1321 1321
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1322 1322
 			else
1323 1323
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1324 1324
 		}
1325 1325
 
1326 1326
 		// Category is selected, further sub-categories until all conditions
1327
-		if($args->category_srl)
1327
+		if ($args->category_srl)
1328 1328
 		{
1329 1329
 			$category_list = $this->getCategoryList($args->module_srl);
1330 1330
 			$category_info = $category_list[$args->category_srl];
1331 1331
 			$category_info->childs[] = $args->category_srl;
1332
-			$args->category_srl = implode(',',$category_info->childs);
1332
+			$args->category_srl = implode(',', $category_info->childs);
1333 1333
 		}
1334 1334
 
1335 1335
 		// Used to specify the default query id (based on several search options to query id modified)
@@ -1342,43 +1342,43 @@  discard block
 block discarded – undo
1342 1342
 		$search_target = $searchOpt->search_target;
1343 1343
 		$search_keyword = $searchOpt->search_keyword;
1344 1344
 
1345
-		if($search_target && $search_keyword)
1345
+		if ($search_target && $search_keyword)
1346 1346
 		{
1347
-			switch($search_target)
1347
+			switch ($search_target)
1348 1348
 			{
1349 1349
 				case 'title' :
1350 1350
 				case 'content' :
1351
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1352
-					$args->{"s_".$search_target} = $search_keyword;
1351
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1352
+					$args->{"s_" . $search_target} = $search_keyword;
1353 1353
 					$use_division = true;
1354 1354
 					break;
1355 1355
 				case 'title_content' :
1356
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1356
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1357 1357
 					$args->s_title = $search_keyword;
1358 1358
 					$args->s_content = $search_keyword;
1359 1359
 					$use_division = true;
1360 1360
 					break;
1361 1361
 				case 'user_id' :
1362
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1362
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1363 1363
 					$args->s_user_id = $search_keyword;
1364
-					$args->sort_index = 'documents.'.$args->sort_index;
1364
+					$args->sort_index = 'documents.' . $args->sort_index;
1365 1365
 					break;
1366 1366
 				case 'user_name' :
1367 1367
 				case 'nick_name' :
1368 1368
 				case 'email_address' :
1369 1369
 				case 'homepage' :
1370
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1371
-					$args->{"s_".$search_target} = $search_keyword;
1370
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1371
+					$args->{"s_" . $search_target} = $search_keyword;
1372 1372
 					break;
1373 1373
 				case 'is_notice' :
1374
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1375
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1376
-					else $args->{"s_".$search_target} = '';
1374
+					if ($search_keyword == 'N') $args->{"s_" . $search_target} = 'N';
1375
+					elseif ($search_keyword == 'Y') $args->{"s_" . $search_target} = 'Y';
1376
+					else $args->{"s_" . $search_target} = '';
1377 1377
 					break;
1378 1378
 				case 'is_secret' :
1379
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1380
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1381
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1379
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1380
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1381
+					elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp'));
1382 1382
 					break;
1383 1383
 				case 'member_srl' :
1384 1384
 				case 'readed_count' :
@@ -1386,15 +1386,15 @@  discard block
 block discarded – undo
1386 1386
 				case 'comment_count' :
1387 1387
 				case 'trackback_count' :
1388 1388
 				case 'uploaded_count' :
1389
-					$args->{"s_".$search_target} = (int)$search_keyword;
1389
+					$args->{"s_" . $search_target} = (int) $search_keyword;
1390 1390
 					break;
1391 1391
 				case 'blamed_count' :
1392
-					$args->{"s_".$search_target} = (int)$search_keyword * -1;
1392
+					$args->{"s_" . $search_target} = (int) $search_keyword * -1;
1393 1393
 					break;
1394 1394
 				case 'regdate' :
1395 1395
 				case 'last_update' :
1396 1396
 				case 'ipaddress' :
1397
-					$args->{"s_".$search_target} = $search_keyword;
1397
+					$args->{"s_" . $search_target} = $search_keyword;
1398 1398
 					break;
1399 1399
 				case 'comment' :
1400 1400
 					$args->s_comment = $search_keyword;
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 					$use_division = true;
1403 1403
 					break;
1404 1404
 				case 'tag' :
1405
-					$args->s_tags = str_replace(' ','%',$search_keyword);
1405
+					$args->s_tags = str_replace(' ', '%', $search_keyword);
1406 1406
 					$query_id = 'document.getDocumentListWithinTag';
1407 1407
 					break;
1408 1408
 				case 'extra_vars':
@@ -1410,10 +1410,10 @@  discard block
 block discarded – undo
1410 1410
 					$query_id = 'document.getDocumentListWithinExtraVars';
1411 1411
 					break;
1412 1412
 				default :
1413
-					if(strpos($search_target,'extra_vars')!==false) {
1413
+					if (strpos($search_target, 'extra_vars') !== false) {
1414 1414
 						$args->var_idx = substr($search_target, strlen('extra_vars'));
1415
-						$args->var_value = str_replace(' ','%',$search_keyword);
1416
-						$args->sort_index = 'documents.'.$args->sort_index;
1415
+						$args->var_value = str_replace(' ', '%', $search_keyword);
1416
+						$args->sort_index = 'documents.' . $args->sort_index;
1417 1417
 						$query_id = 'document.getDocumentListWithExtraVars';
1418 1418
 					}
1419 1419
 					break;
@@ -1429,18 +1429,18 @@  discard block
 block discarded – undo
1429 1429
 			/**
1430 1430
 			 * list_order asc sort of division that can be used only when
1431 1431
 			 */
1432
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1432
+			if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1433 1433
 
1434 1434
 			/**
1435 1435
 			 * If it is true, use_division changed to use the document division
1436 1436
 			 */
1437
-			if($use_division)
1437
+			if ($use_division)
1438 1438
 			{
1439 1439
 				// Division begins
1440
-				$division = (int)Context::get('division');
1440
+				$division = (int) Context::get('division');
1441 1441
 
1442 1442
 				// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1443
-				if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1443
+				if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1444 1444
 				{
1445 1445
 					$listSqlID = 'document.getDocumentListUseIndex';
1446 1446
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 				}
1453 1453
 
1454 1454
 				// If you do not value the best division top
1455
-				if(!$division)
1455
+				if (!$division)
1456 1456
 				{
1457 1457
 					$division_args = new stdClass();
1458 1458
 					$division_args->module_srl = $args->module_srl;
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 					$division_args->statusList = $args->statusList;
1464 1464
 
1465 1465
 					$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1466
-					if($output->data)
1466
+					if ($output->data)
1467 1467
 					{
1468 1468
 						$item = array_pop($output->data);
1469 1469
 						$division = $item->list_order;
@@ -1472,10 +1472,10 @@  discard block
 block discarded – undo
1472 1472
 				}
1473 1473
 
1474 1474
 				// The last division
1475
-				$last_division = (int)Context::get('last_division');
1475
+				$last_division = (int) Context::get('last_division');
1476 1476
 
1477 1477
 				// Division after division from the 5000 value of the specified Wanted
1478
-				if(!$last_division)
1478
+				if (!$last_division)
1479 1479
 				{
1480 1480
 					$last_division_args = new stdClass();
1481 1481
 					$last_division_args->module_srl = $args->module_srl;
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 					$last_division_args->page = 5001;
1488 1488
 
1489 1489
 					$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1490
-					if($output->data)
1490
+					if ($output->data)
1491 1491
 					{
1492 1492
 						$item = array_pop($output->data);
1493 1493
 						$last_division = $item->list_order;
@@ -1495,14 +1495,14 @@  discard block
 block discarded – undo
1495 1495
 				}
1496 1496
 
1497 1497
 				// Make sure that after last_division article
1498
-				if($last_division)
1498
+				if ($last_division)
1499 1499
 				{
1500 1500
 					$last_division_args = new stdClass();
1501 1501
 					$last_division_args->module_srl = $args->module_srl;
1502 1502
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1503 1503
 					$last_division_args->list_order = $last_division;
1504 1504
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1505
-					if($output->data->count<1) $last_division = null;
1505
+					if ($output->data->count < 1) $last_division = null;
1506 1506
 				}
1507 1507
 
1508 1508
 				$args->division = $division;
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
 	 * @param int $count
1536 1536
 	 * @return object
1537 1537
 	 */
1538
-	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1538
+	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0)
1539 1539
 	{
1540 1540
 		$args = new stdClass();
1541 1541
 		$args->member_srl = $member_srl;
@@ -1543,8 +1543,8 @@  discard block
 block discarded – undo
1543 1543
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1544 1544
 		$document_list = $output->data;
1545 1545
 		
1546
-		if(!$document_list) return array();
1547
-		if(!is_array($document_list)) $document_list = array($document_list);
1546
+		if (!$document_list) return array();
1547
+		if (!is_array($document_list)) $document_list = array($document_list);
1548 1548
 
1549 1549
 		return $document_list;	
1550 1550
 	}
Please login to merge, or discard this patch.
Braces   +302 added lines, -133 removed lines patch added patch discarded remove patch
@@ -56,18 +56,24 @@  discard block
 block discarded – undo
56 56
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
57 57
 
58 58
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
59
-		if(count($_document_list) <= 0) return;
59
+		if(count($_document_list) <= 0) {
60
+			return;
61
+		}
60 62
 
61 63
 		// Find all called the document object variable has been set extension
62 64
 		$document_srls = array();
63 65
 		foreach($_document_list as $key => $val)
64 66
 		{
65
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
67
+			if(!$val->document_srl || $checked_documents[$val->document_srl]) {
68
+				continue;
69
+			}
66 70
 			$checked_documents[$val->document_srl] = true;
67 71
 			$document_srls[] = $val->document_srl;
68 72
 		}
69 73
 		// If the document number, return detected
70
-		if(!count($document_srls)) return;
74
+		if(!count($document_srls)) {
75
+			return;
76
+		}
71 77
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
72 78
 		//$obj->document_srl = implode(',',$document_srls);
73 79
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
@@ -75,8 +81,12 @@  discard block
 block discarded – undo
75 81
 		{
76 82
 			foreach($output->data as $key => $val)
77 83
 			{
78
-				if(!isset($val->value)) continue;
79
-				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
84
+				if(!isset($val->value)) {
85
+					continue;
86
+				}
87
+				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) {
88
+					$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
89
+				}
80 90
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
81 91
 			}
82 92
 		}
@@ -87,7 +97,9 @@  discard block
 block discarded – undo
87 97
 			$document_srl = $document_srls[$i];
88 98
 			unset($vars);
89 99
 
90
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
100
+			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) {
101
+				continue;
102
+			}
91 103
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
92 104
 			$extra_keys = $this->getExtraKeys($module_srl);
93 105
 			$vars = $extra_vars[$document_srl];
@@ -99,10 +111,15 @@  discard block
 block discarded – undo
99 111
 				{
100 112
 					$extra_keys[$idx] = clone($key);
101 113
 					$val = $vars[$idx];
102
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
103
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
104
-					else if(isset($val[0])) $v = $val[0];
105
-					else $v = null;
114
+					if(isset($val[$user_lang_code])) {
115
+						$v = $val[$user_lang_code];
116
+					} else if(isset($val[$document_lang_code])) {
117
+						$v = $val[$document_lang_code];
118
+					} else if(isset($val[0])) {
119
+						$v = $val[0];
120
+					} else {
121
+						$v = null;
122
+					}
106 123
 					$extra_keys[$idx]->value = $v;
107 124
 				}
108 125
 			}
@@ -111,9 +128,13 @@  discard block
 block discarded – undo
111 128
 			$evars = new ExtraVar($module_srl);
112 129
 			$evars->setExtraVarKeys($extra_keys);
113 130
 			// Title Processing
114
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
131
+			if($vars[-1][$user_lang_code]) {
132
+				$_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
133
+			}
115 134
 			// Information processing
116
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
135
+			if($vars[-2][$user_lang_code]) {
136
+				$_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
137
+			}
117 138
 
118 139
 			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
119 140
 			{
@@ -134,15 +155,21 @@  discard block
 block discarded – undo
134 155
 	 */
135 156
 	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
136 157
 	{
137
-		if(!$document_srl) return new documentItem();
158
+		if(!$document_srl) {
159
+			return new documentItem();
160
+		}
138 161
 
139 162
 		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
140 163
 		{
141 164
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
142 165
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
143
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
166
+			if($load_extra_vars) {
167
+				$this->setToAllDocumentExtraVars();
168
+			}
169
+		}
170
+		if($is_admin) {
171
+			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
144 172
 		}
145
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
146 173
 
147 174
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
148 175
 	}
@@ -161,8 +188,7 @@  discard block
 block discarded – undo
161 188
 		{
162 189
 			$list_count = count($document_srls);
163 190
 			$document_srls = implode(',',$document_srls);
164
-		}
165
-		else
191
+		} else
166 192
 		{
167 193
 			$list_count = 1;
168 194
 		}
@@ -173,28 +199,38 @@  discard block
 block discarded – undo
173 199
 
174 200
 		$output = executeQuery('document.getDocuments', $args, $columnList);
175 201
 		$document_list = $output->data;
176
-		if(!$document_list) return;
177
-		if(!is_array($document_list)) $document_list = array($document_list);
202
+		if(!$document_list) {
203
+			return;
204
+		}
205
+		if(!is_array($document_list)) {
206
+			$document_list = array($document_list);
207
+		}
178 208
 
179 209
 		$document_count = count($document_list);
180 210
 		foreach($document_list as $key => $attribute)
181 211
 		{
182 212
 			$document_srl = $attribute->document_srl;
183
-			if(!$document_srl) continue;
213
+			if(!$document_srl) {
214
+				continue;
215
+			}
184 216
 
185 217
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
186 218
 			{
187 219
 				$oDocument = null;
188 220
 				$oDocument = new documentItem();
189 221
 				$oDocument->setAttribute($attribute, false);
190
-				if($is_admin) $oDocument->setGrant();
222
+				if($is_admin) {
223
+					$oDocument->setGrant();
224
+				}
191 225
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
192 226
 			}
193 227
 
194 228
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
195 229
 		}
196 230
 
197
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
231
+		if($load_extra_vars) {
232
+			$this->setToAllDocumentExtraVars();
233
+		}
198 234
 
199 235
 		$output = null;
200 236
 		if(count($result))
@@ -229,12 +265,10 @@  discard block
 block discarded – undo
229 265
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
230 266
 			$args->sort_index = str_replace('documents.','',$args->sort_index);
231 267
 			$output = executeQueryArray($query_id, $args);
232
-		}
233
-		elseif ($sort_check->isExtraVars)
268
+		} elseif ($sort_check->isExtraVars)
234 269
 		{
235 270
 			$output = executeQueryArray($query_id, $args);
236
-		}
237
-		else
271
+		} else
238 272
 		{
239 273
 			// document.getDocumentList query execution
240 274
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
@@ -244,11 +278,15 @@  discard block
 block discarded – undo
244 278
 				$group_args = clone($args);
245 279
 				$group_args->sort_index = 'documents.'.$args->sort_index;
246 280
 				$output = executeQueryArray($query_id, $group_args);
247
-				if(!$output->toBool()||!count($output->data)) return $output;
281
+				if(!$output->toBool()||!count($output->data)) {
282
+					return $output;
283
+				}
248 284
 
249 285
 				foreach($output->data as $key => $val)
250 286
 				{
251
-					if($val->document_srl) $target_srls[] = $val->document_srl;
287
+					if($val->document_srl) {
288
+						$target_srls[] = $val->document_srl;
289
+					}
252 290
 				}
253 291
 
254 292
 				$page_navigation = $output->page_navigation;
@@ -266,14 +304,15 @@  discard block
 block discarded – undo
266 304
 				$output->total_count = $page_navigation->total_count;
267 305
 				$output->total_page = $page_navigation->total_page;
268 306
 				$output->page = $page_navigation->cur_page;
269
-			}
270
-			else
307
+			} else
271 308
 			{
272 309
 				$output = executeQueryArray($query_id, $args, $columnList);
273 310
 			}
274 311
 		}
275 312
 		// Return if no result or an error occurs
276
-		if(!$output->toBool()||!count($output->data)) return $output;
313
+		if(!$output->toBool()||!count($output->data)) {
314
+			return $output;
315
+		}
277 316
 		$idx = 0;
278 317
 		$data = $output->data;
279 318
 		unset($output->data);
@@ -288,20 +327,26 @@  discard block
 block discarded – undo
288 327
 		{
289 328
 			foreach($data as $key => $attribute)
290 329
 			{
291
-				if($attribute->is_notice == 'Y') $virtual_number --;
330
+				if($attribute->is_notice == 'Y') {
331
+					$virtual_number --;
332
+				}
292 333
 			}
293 334
 		}
294 335
 
295 336
 		foreach($data as $key => $attribute)
296 337
 		{
297
-			if($except_notice && $attribute->is_notice == 'Y') continue;
338
+			if($except_notice && $attribute->is_notice == 'Y') {
339
+				continue;
340
+			}
298 341
 			$document_srl = $attribute->document_srl;
299 342
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
300 343
 			{
301 344
 				$oDocument = null;
302 345
 				$oDocument = new documentItem();
303 346
 				$oDocument->setAttribute($attribute, false);
304
-				if($is_admin) $oDocument->setGrant();
347
+				if($is_admin) {
348
+					$oDocument->setGrant();
349
+				}
305 350
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
306 351
 			}
307 352
 
@@ -309,7 +354,9 @@  discard block
 block discarded – undo
309 354
 			$virtual_number--;
310 355
 		}
311 356
 
312
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
357
+		if($load_extra_vars) {
358
+			$this->setToAllDocumentExtraVars();
359
+		}
313 360
 
314 361
 		if(count($output->data))
315 362
 		{
@@ -334,12 +381,16 @@  discard block
 block discarded – undo
334 381
 		$args->module_srl = $obj->module_srl;
335 382
 		$args->category_srl= $obj->category_srl;
336 383
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
337
-		if(!$output->toBool()||!$output->data) return;
384
+		if(!$output->toBool()||!$output->data) {
385
+			return;
386
+		}
338 387
 
339 388
 		foreach($output->data as $key => $val)
340 389
 		{
341 390
 			$document_srl = $val->document_srl;
342
-			if(!$document_srl) continue;
391
+			if(!$document_srl) {
392
+				continue;
393
+			}
343 394
 
344 395
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
345 396
 			{
@@ -435,7 +486,9 @@  discard block
 block discarded – undo
435 486
 
436 487
 				$oExtraVar->setExtraVarKeys($output->data);
437 488
 				$keys = $oExtraVar->getExtraVars();
438
-				if(!$keys) $keys = array();
489
+				if(!$keys) {
490
+					$keys = array();
491
+				}
439 492
 
440 493
 				if($oCacheHandler->isSupport())
441 494
 				{
@@ -465,7 +518,9 @@  discard block
 block discarded – undo
465 518
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
466 519
 			$this->setToAllDocumentExtraVars();
467 520
 		}
468
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
521
+		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
522
+			ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
523
+		}
469 524
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
470 525
 	}
471 526
 
@@ -495,7 +550,9 @@  discard block
 block discarded – undo
495 550
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
496 551
 			$module_srl = $oDocument->get('module_srl');
497 552
 			$member_srl = $oDocument->get('member_srl');
498
-			if(!$module_srl) return new Object(-1, 'msg_invalid_request');
553
+			if(!$module_srl) {
554
+				return new Object(-1, 'msg_invalid_request');
555
+			}
499 556
 
500 557
 			$oModuleModel = getModel('module');
501 558
 			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
@@ -568,7 +625,9 @@  discard block
 block discarded – undo
568 625
 	 */
569 626
 	function getDocumentCount($module_srl, $search_obj = NULL)
570 627
 	{
571
-		if(is_null($search_obj)) $search_obj = new stdClass();
628
+		if(is_null($search_obj)) {
629
+			$search_obj = new stdClass();
630
+		}
572 631
 		$search_obj->module_srl = $module_srl;
573 632
 
574 633
 		$output = executeQuery('document.getDocumentCount', $search_obj);
@@ -585,7 +644,9 @@  discard block
 block discarded – undo
585 644
 	function getDocumentCountByGroupStatus($search_obj = NULL)
586 645
 	{
587 646
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
588
-		if(!$output->toBool()) return array();
647
+		if(!$output->toBool()) {
648
+			return array();
649
+		}
589 650
 
590 651
 		return $output->data;
591 652
 	}
@@ -624,21 +685,18 @@  discard block
 block discarded – undo
624 685
 		if($sort_check->isExtraVars)
625 686
 		{
626 687
 			return 1;
627
-		}
628
-		else
688
+		} else
629 689
 		{
630 690
 			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
631 691
 			{
632 692
 				if($args->order_type === 'desc')
633 693
 				{
634 694
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
635
-				}
636
-				else
695
+				} else
637 696
 				{
638 697
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
639 698
 				}
640
-			}
641
-			else
699
+			} else
642 700
 			{
643 701
 				return 1;
644 702
 			}
@@ -664,15 +722,16 @@  discard block
 block discarded – undo
664 722
 		$output = executeQuery('document.getCategory', $args, $columnList);
665 723
 
666 724
 		$node = $output->data;
667
-		if(!$node) return;
725
+		if(!$node) {
726
+			return;
727
+		}
668 728
 
669 729
 		if($node->group_srls)
670 730
 		{
671 731
 			$group_srls = explode(',',$node->group_srls);
672 732
 			unset($node->group_srls);
673 733
 			$node->group_srls = $group_srls;
674
-		}
675
-		else
734
+		} else
676 735
 		{
677 736
 			unset($node->group_srls);
678 737
 			$node->group_srls = array();
@@ -690,7 +749,9 @@  discard block
 block discarded – undo
690 749
 		$args = new stdClass();
691 750
 		$args->category_srl = $category_srl;
692 751
 		$output = executeQuery('document.getChildCategoryCount',$args);
693
-		if($output->data->count > 0) return true;
752
+		if($output->data->count > 0) {
753
+			return true;
754
+		}
694 755
 		return false;
695 756
 	}
696 757
 
@@ -709,7 +770,9 @@  discard block
 block discarded – undo
709 770
 		if(!file_exists($filename))
710 771
 		{
711 772
 			$oDocumentController = getController('document');
712
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
773
+			if(!$oDocumentController->makeCategoryFile($module_srl)) {
774
+				return array();
775
+			}
713 776
 		}
714 777
 
715 778
 		include($filename);
@@ -729,7 +792,9 @@  discard block
 block discarded – undo
729 792
 	 */
730 793
 	function _arrangeCategory(&$document_category, $list, $depth)
731 794
 	{
732
-		if(!count($list)) return;
795
+		if(!count($list)) {
796
+			return;
797
+		}
733 798
 		$idx = 0;
734 799
 		$list_order = array();
735 800
 		foreach($list as $key => $val)
@@ -749,8 +814,11 @@  discard block
 block discarded – undo
749 814
 			$obj->childs = array();
750 815
 			$obj->grant = $val['grant'];
751 816
 
752
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
753
-			else $selected = false;
817
+			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) {
818
+				$selected = true;
819
+			} else {
820
+				$selected = false;
821
+			}
754 822
 
755 823
 			$obj->selected = $selected;
756 824
 
@@ -761,14 +829,18 @@  discard block
 block discarded – undo
761 829
 				$parent_srl = $obj->parent_srl;
762 830
 				$document_count = $obj->document_count;
763 831
 				$expand = $obj->expand;
764
-				if($selected) $expand = true;
832
+				if($selected) {
833
+					$expand = true;
834
+				}
765 835
 
766 836
 				while($parent_srl)
767 837
 				{
768 838
 					$document_category[$parent_srl]->document_count += $document_count;
769 839
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
770 840
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
771
-					if($expand) $document_category[$parent_srl]->expand = $expand;
841
+					if($expand) {
842
+						$document_category[$parent_srl]->expand = $expand;
843
+					}
772 844
 
773 845
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
774 846
 				}
@@ -776,7 +848,9 @@  discard block
 block discarded – undo
776 848
 
777 849
 			$document_category[$key] = $obj;
778 850
 
779
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
851
+			if(count($val['list'])) {
852
+				$this->_arrangeCategory($document_category, $val['list'], $depth+1);
853
+			}
780 854
 		}
781 855
 		$document_category[$list_order[0]]->first = true;
782 856
 		$document_category[$list_order[count($list_order)-1]]->last = true;
@@ -844,13 +918,20 @@  discard block
 block discarded – undo
844 918
 		}
845 919
 		// Module_srl passed the array may be a check whether the array
846 920
 		$args = new stdClass;
847
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
848
-		else $args->module_srl = $obj->module_srl;
921
+		if(is_array($obj->module_srl)) {
922
+			$args->module_srl = implode(',', $obj->module_srl);
923
+		} else {
924
+			$args->module_srl = $obj->module_srl;
925
+		}
849 926
 
850 927
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
851
-		if(!$output->toBool()||!$output->data) return $output;
928
+		if(!$output->toBool()||!$output->data) {
929
+			return $output;
930
+		}
852 931
 
853
-		if(!is_array($output->data)) $output->data = array($output->data);
932
+		if(!is_array($output->data)) {
933
+			$output->data = array($output->data);
934
+		}
854 935
 
855 936
 		return $output;
856 937
 	}
@@ -870,14 +951,21 @@  discard block
 block discarded – undo
870 951
 		}
871 952
 		// Module_srl passed the array may be a check whether the array
872 953
 		$args = new stdClass;
873
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
874
-		else $args->module_srl = $obj->module_srl;
954
+		if(is_array($obj->module_srl)) {
955
+			$args->module_srl = implode(',', $obj->module_srl);
956
+		} else {
957
+			$args->module_srl = $obj->module_srl;
958
+		}
875 959
 		$args->regdate = $obj->regdate;
876 960
 
877 961
 		$output = executeQuery('document.getDailyArchivedList', $args);
878
-		if(!$output->toBool()) return $output;
962
+		if(!$output->toBool()) {
963
+			return $output;
964
+		}
879 965
 
880
-		if(!is_array($output->data)) $output->data = array($output->data);
966
+		if(!is_array($output->data)) {
967
+			$output->data = array($output->data);
968
+		}
881 969
 
882 970
 		return $output;
883 971
 	}
@@ -888,7 +976,9 @@  discard block
 block discarded – undo
888 976
 	 */
889 977
 	function getDocumentCategories()
890 978
 	{
891
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
979
+		if(!Context::get('is_logged')) {
980
+			return new Object(-1,'msg_not_permitted');
981
+		}
892 982
 		$module_srl = Context::get('module_srl');
893 983
 		$categories= $this->getCategoryList($module_srl);
894 984
 		$lang = Context::get('lang');
@@ -915,8 +1005,12 @@  discard block
 block discarded – undo
915 1005
 			$oModuleModel = getModel('module');
916 1006
 			$config = $oModuleModel->getModuleConfig('document');
917 1007
 
918
-			if(!$config) $config = new stdClass();
919
-			if(!$config->thumbnail_type) $config->thumbnail_type = 'crop';
1008
+			if(!$config) {
1009
+				$config = new stdClass();
1010
+			}
1011
+			if(!$config->thumbnail_type) {
1012
+				$config->thumbnail_type = 'crop';
1013
+			}
920 1014
 			$GLOBALS['__document_config__'] = $config;
921 1015
 		}
922 1016
 		return $GLOBALS['__document_config__'];
@@ -981,7 +1075,9 @@  discard block
 block discarded – undo
981 1075
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
982 1076
 		// Check permissions
983 1077
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
984
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1078
+		if(!$grant->manager) {
1079
+			return new Object(-1,'msg_not_permitted');
1080
+		}
985 1081
 
986 1082
 		$category_srl = Context::get('category_srl');
987 1083
 		$category_info = $this->getCategory($category_srl);
@@ -1001,15 +1097,20 @@  discard block
 block discarded – undo
1001 1097
 	 */
1002 1098
 	function getDocumentSrlByAlias($mid, $alias)
1003 1099
 	{
1004
-		if(!$mid || !$alias) return null;
1100
+		if(!$mid || !$alias) {
1101
+			return null;
1102
+		}
1005 1103
 		$site_module_info = Context::get('site_module_info');
1006 1104
 		$args = new stdClass;
1007 1105
 		$args->mid = $mid;
1008 1106
 		$args->alias_title = $alias;
1009 1107
 		$args->site_srl = $site_module_info->site_srl;
1010 1108
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1011
-		if(!$output->data) return null;
1012
-		else return $output->data->document_srl;
1109
+		if(!$output->data) {
1110
+			return null;
1111
+		} else {
1112
+			return $output->data->document_srl;
1113
+		}
1013 1114
 	}
1014 1115
 
1015 1116
 	/**
@@ -1020,15 +1121,20 @@  discard block
 block discarded – undo
1020 1121
 	 */
1021 1122
 	function getDocumentSrlByTitle($module_srl, $title)
1022 1123
 	{
1023
-		if(!$module_srl || !$title) return null;
1124
+		if(!$module_srl || !$title) {
1125
+			return null;
1126
+		}
1024 1127
 		$args = new stdClass;
1025 1128
 		$args->module_srl = $module_srl;
1026 1129
 		$args->title = $title;
1027 1130
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1028
-		if(!$output->data) return null;
1029
-		else
1131
+		if(!$output->data) {
1132
+			return null;
1133
+		} else
1030 1134
 		{
1031
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1135
+			if(is_array($output->data)) {
1136
+				return $output->data[0]->document_srl;
1137
+			}
1032 1138
 			return $output->data->document_srl;
1033 1139
 		}
1034 1140
 	}
@@ -1040,13 +1146,18 @@  discard block
 block discarded – undo
1040 1146
 	 */
1041 1147
 	function getAlias($document_srl)
1042 1148
 	{
1043
-		if(!$document_srl) return null;
1149
+		if(!$document_srl) {
1150
+			return null;
1151
+		}
1044 1152
 		$args = new stdClass;
1045 1153
 		$args->document_srl = $document_srl;
1046 1154
 		$output = executeQueryArray('document.getAliases', $args);
1047 1155
 
1048
-		if(!$output->data) return null;
1049
-		else return $output->data[0]->alias_title;
1156
+		if(!$output->data) {
1157
+			return null;
1158
+		} else {
1159
+			return $output->data[0]->alias_title;
1160
+		}
1050 1161
 	}
1051 1162
 
1052 1163
 	/**
@@ -1103,17 +1214,23 @@  discard block
 block discarded – undo
1103 1214
 			{
1104 1215
 				case 'title' :
1105 1216
 				case 'content' :
1106
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1217
+					if($search_keyword) {
1218
+						$search_keyword = str_replace(' ','%',$search_keyword);
1219
+					}
1107 1220
 					$args->{"s_".$search_target} = $search_keyword;
1108 1221
 					$use_division = true;
1109 1222
 					break;
1110 1223
 				case 'title_content' :
1111
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1224
+					if($search_keyword) {
1225
+						$search_keyword = str_replace(' ','%',$search_keyword);
1226
+					}
1112 1227
 					$args->s_title = $search_keyword;
1113 1228
 					$args->s_content = $search_keyword;
1114 1229
 					break;
1115 1230
 				case 'user_id' :
1116
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1231
+					if($search_keyword) {
1232
+						$search_keyword = str_replace(' ','%',$search_keyword);
1233
+					}
1117 1234
 					$args->s_user_id = $search_keyword;
1118 1235
 					$args->sort_index = 'documents.'.$args->sort_index;
1119 1236
 					break;
@@ -1121,13 +1238,18 @@  discard block
 block discarded – undo
1121 1238
 				case 'nick_name' :
1122 1239
 				case 'email_address' :
1123 1240
 				case 'homepage' :
1124
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1241
+					if($search_keyword) {
1242
+						$search_keyword = str_replace(' ','%',$search_keyword);
1243
+					}
1125 1244
 					$args->{"s_".$search_target} = $search_keyword;
1126 1245
 					break;
1127 1246
 				case 'is_notice' :
1128 1247
 				case 'is_secret' :
1129
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1130
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1248
+					if($search_keyword=='N') {
1249
+						$args->statusList = array($this->getConfigStatus('public'));
1250
+					} elseif($search_keyword=='Y') {
1251
+						$args->statusList = array($this->getConfigStatus('secret'));
1252
+					}
1131 1253
 					break;
1132 1254
 				case 'member_srl' :
1133 1255
 				case 'readed_count' :
@@ -1169,34 +1291,45 @@  discard block
 block discarded – undo
1169 1291
 	{
1170 1292
 		$args = new stdClass;
1171 1293
 		$document_srl = Context::get('document_srl');
1172
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
1294
+		if(!$document_srl) {
1295
+			return new Object(-1,'msg_invalid_request');
1296
+		}
1173 1297
 
1174 1298
 		$point = Context::get('point');
1175
-		if($point != -1) $point = 1;
1299
+		if($point != -1) {
1300
+			$point = 1;
1301
+		}
1176 1302
 
1177 1303
 		$oDocumentModel = getModel('document');
1178 1304
 		$columnList = array('document_srl', 'module_srl');
1179 1305
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1180 1306
 		$module_srl = $oDocument->get('module_srl');
1181
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
1307
+		if(!$module_srl) {
1308
+			return new Object(-1, 'msg_invalid_request');
1309
+		}
1182 1310
 
1183 1311
 		$oModuleModel = getModel('module');
1184 1312
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1185 1313
 		if($point == -1)
1186 1314
 		{
1187
-			if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request');
1315
+			if($document_config->use_vote_down!='S') {
1316
+				return new Object(-1, 'msg_invalid_request');
1317
+			}
1188 1318
 			$args->below_point = 0;
1189
-		}
1190
-		else
1319
+		} else
1191 1320
 		{
1192
-			if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request');
1321
+			if($document_config->use_vote_up!='S') {
1322
+				return new Object(-1, 'msg_invalid_request');
1323
+			}
1193 1324
 			$args->more_point = 0;
1194 1325
 		}
1195 1326
 
1196 1327
 		$args->document_srl = $document_srl;
1197 1328
 
1198 1329
 		$output = executeQueryArray('document.getVotedMemberList',$args);
1199
-		if(!$output->toBool()) return $output;
1330
+		if(!$output->toBool()) {
1331
+			return $output;
1332
+		}
1200 1333
 
1201 1334
 		$oMemberModel = getModel('member');
1202 1335
 		if($output->data)
@@ -1218,9 +1351,11 @@  discard block
 block discarded – undo
1218 1351
 	function getStatusNameList()
1219 1352
 	{
1220 1353
 		global $lang;
1221
-		if(!isset($lang->status_name_list))
1222
-			return array_flip($this->getStatusList());
1223
-		else return $lang->status_name_list;
1354
+		if(!isset($lang->status_name_list)) {
1355
+					return array_flip($this->getStatusList());
1356
+		} else {
1357
+			return $lang->status_name_list;
1358
+		}
1224 1359
 	}
1225 1360
 
1226 1361
 	/**
@@ -1244,20 +1379,22 @@  discard block
 block discarded – undo
1244 1379
 				if (!$extra_output->data || !$extra_output->toBool())
1245 1380
 				{
1246 1381
 					$sortIndex = 'list_order';
1247
-				}
1248
-				else
1382
+				} else
1249 1383
 				{
1250 1384
 					$check_array = array();
1251 1385
 					foreach($extra_output->data as $val)
1252 1386
 					{
1253 1387
 						$check_array[] = $val->eid;
1254 1388
 					}
1255
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1256
-					else $isExtraVars = true;
1389
+					if(!in_array($sortIndex, $check_array)) {
1390
+						$sortIndex = 'list_order';
1391
+					} else {
1392
+						$isExtraVars = true;
1393
+					}
1257 1394
 				}
1395
+			} else {
1396
+							$sortIndex = 'list_order';
1258 1397
 			}
1259
-			else
1260
-				$sortIndex = 'list_order';
1261 1398
 		}
1262 1399
 		$returnObj = new stdClass();
1263 1400
 		$returnObj->sort_index = $sortIndex;
@@ -1295,7 +1432,9 @@  discard block
 block discarded – undo
1295 1432
 		
1296 1433
 		// Check the target and sequence alignment
1297 1434
 		$orderType = array('desc' => 1, 'asc' => 1);
1298
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1435
+		if(!isset($orderType[$args->order_type])) {
1436
+			$args->order_type = 'asc';
1437
+		}
1299 1438
 
1300 1439
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1301 1440
 		if($searchOpt->mid)
@@ -1306,21 +1445,29 @@  discard block
 block discarded – undo
1306 1445
 		}
1307 1446
 
1308 1447
 		// Module_srl passed the array may be a check whether the array
1309
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1310
-		else $args->module_srl = $searchOpt->module_srl;
1448
+		if(is_array($searchOpt->module_srl)) {
1449
+			$args->module_srl = implode(',', $searchOpt->module_srl);
1450
+		} else {
1451
+			$args->module_srl = $searchOpt->module_srl;
1452
+		}
1311 1453
 
1312 1454
 		// Except for the test module_srl
1313
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1314
-		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1455
+		if(is_array($searchOpt->exclude_module_srl)) {
1456
+			$args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1457
+		} else {
1458
+			$args->exclude_module_srl = $searchOpt->exclude_module_srl;
1459
+		}
1315 1460
 
1316 1461
 		// only admin document list, temp document showing
1317
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1318
-		else
1462
+		if($searchOpt->statusList) {
1463
+			$args->statusList = $searchOpt->statusList;
1464
+		} else
1319 1465
 		{
1320
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1321
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1322
-			else
1323
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1466
+			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) {
1467
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1468
+			} else {
1469
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1470
+			}
1324 1471
 		}
1325 1472
 
1326 1473
 		// Category is selected, further sub-categories until all conditions
@@ -1348,18 +1495,24 @@  discard block
 block discarded – undo
1348 1495
 			{
1349 1496
 				case 'title' :
1350 1497
 				case 'content' :
1351
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1498
+					if($search_keyword) {
1499
+						$search_keyword = str_replace(' ','%',$search_keyword);
1500
+					}
1352 1501
 					$args->{"s_".$search_target} = $search_keyword;
1353 1502
 					$use_division = true;
1354 1503
 					break;
1355 1504
 				case 'title_content' :
1356
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1505
+					if($search_keyword) {
1506
+						$search_keyword = str_replace(' ','%',$search_keyword);
1507
+					}
1357 1508
 					$args->s_title = $search_keyword;
1358 1509
 					$args->s_content = $search_keyword;
1359 1510
 					$use_division = true;
1360 1511
 					break;
1361 1512
 				case 'user_id' :
1362
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1513
+					if($search_keyword) {
1514
+						$search_keyword = str_replace(' ','%',$search_keyword);
1515
+					}
1363 1516
 					$args->s_user_id = $search_keyword;
1364 1517
 					$args->sort_index = 'documents.'.$args->sort_index;
1365 1518
 					break;
@@ -1367,18 +1520,28 @@  discard block
 block discarded – undo
1367 1520
 				case 'nick_name' :
1368 1521
 				case 'email_address' :
1369 1522
 				case 'homepage' :
1370
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1523
+					if($search_keyword) {
1524
+						$search_keyword = str_replace(' ','%',$search_keyword);
1525
+					}
1371 1526
 					$args->{"s_".$search_target} = $search_keyword;
1372 1527
 					break;
1373 1528
 				case 'is_notice' :
1374
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1375
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1376
-					else $args->{"s_".$search_target} = '';
1529
+					if($search_keyword=='N') {
1530
+						$args->{"s_".$search_target} = 'N';
1531
+					} elseif($search_keyword=='Y') {
1532
+						$args->{"s_".$search_target} = 'Y';
1533
+					} else {
1534
+						$args->{"s_".$search_target} = '';
1535
+					}
1377 1536
 					break;
1378 1537
 				case 'is_secret' :
1379
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1380
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1381
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1538
+					if($search_keyword=='N') {
1539
+						$args->statusList = array($this->getConfigStatus('public'));
1540
+					} elseif($search_keyword=='Y') {
1541
+						$args->statusList = array($this->getConfigStatus('secret'));
1542
+					} elseif($search_keyword=='temp') {
1543
+						$args->statusList = array($this->getConfigStatus('temp'));
1544
+					}
1382 1545
 					break;
1383 1546
 				case 'member_srl' :
1384 1547
 				case 'readed_count' :
@@ -1423,13 +1586,14 @@  discard block
 block discarded – undo
1423 1586
 		if ($searchOpt->isExtraVars)
1424 1587
 		{
1425 1588
 			$query_id = 'document.getDocumentListExtraSort';
1426
-		}
1427
-		else
1589
+		} else
1428 1590
 		{
1429 1591
 			/**
1430 1592
 			 * list_order asc sort of division that can be used only when
1431 1593
 			 */
1432
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1594
+			if($args->sort_index != 'list_order' || $args->order_type != 'asc') {
1595
+				$use_division = false;
1596
+			}
1433 1597
 
1434 1598
 			/**
1435 1599
 			 * If it is true, use_division changed to use the document division
@@ -1444,8 +1608,7 @@  discard block
 block discarded – undo
1444 1608
 				{
1445 1609
 					$listSqlID = 'document.getDocumentListUseIndex';
1446 1610
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
1447
-				}
1448
-				else
1611
+				} else
1449 1612
 				{
1450 1613
 					$listSqlID = 'document.getDocumentList';
1451 1614
 					$divisionSqlID = 'document.getDocumentDivision';
@@ -1502,7 +1665,9 @@  discard block
 block discarded – undo
1502 1665
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1503 1666
 					$last_division_args->list_order = $last_division;
1504 1667
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1505
-					if($output->data->count<1) $last_division = null;
1668
+					if($output->data->count<1) {
1669
+						$last_division = null;
1670
+					}
1506 1671
 				}
1507 1672
 
1508 1673
 				$args->division = $division;
@@ -1543,8 +1708,12 @@  discard block
 block discarded – undo
1543 1708
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1544 1709
 		$document_list = $output->data;
1545 1710
 		
1546
-		if(!$document_list) return array();
1547
-		if(!is_array($document_list)) $document_list = array($document_list);
1711
+		if(!$document_list) {
1712
+			return array();
1713
+		}
1714
+		if(!is_array($document_list)) {
1715
+			$document_list = array($document_list);
1716
+		}
1548 1717
 
1549 1718
 		return $document_list;	
1550 1719
 	}
Please login to merge, or discard this patch.
modules/document/document.view.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * Document printing
23 23
 	 * I make it out to find the geulman;;
24
-	 * @return void|Object
24
+	 * @return Object|null
25 25
 	 */
26 26
 	function dispDocumentPrint()
27 27
 	{
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 	/**
67 67
 	 * Selected by the administrator for the document management
68
-	 * @return void|Object
68
+	 * @return Object|null
69 69
 	 */
70 70
 	function dispDocumentManageDocument()
71 71
 	{
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 	/**
148 148
 	 * Document temp saved list
149
-	 * @return void
149
+	 * @return ModuleObject|null
150 150
 	 */
151 151
 	function dispTempSavedList()
152 152
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * documentView class
5
- * View class of the module document
6
- *
7
- * @author NAVER ([email protected])
8
- * @package /modules/document
9
- * @version 0.1
10
- */
4
+	 * documentView class
5
+	 * View class of the module document
6
+	 *
7
+	 * @author NAVER ([email protected])
8
+	 * @package /modules/document
9
+	 * @version 0.1
10
+	 */
11 11
 class documentView extends document
12 12
 {
13 13
 	/**
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 		$oDocumentModel = getModel('document');
37 37
 		// Creates an object for displaying the selected document
38 38
 		$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39
-		if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
39
+		if (!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request');
40 40
 		// Check permissions
41
-		if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
41
+		if (!$oDocument->isAccessible()) return new Object(-1, 'msg_not_permitted');
42 42
 		// Information setting module
43 43
 		//Context::set('module_info', $module_info);	//module_info not use in UI
44 44
 		// Browser title settings
45 45
 		Context::setBrowserTitle($oDocument->getTitleText());
46 46
 		Context::set('oDocument', $oDocument);
47 47
 
48
-		Context::set('layout','none');
49
-		$this->setTemplatePath($this->module_path.'tpl');
48
+		Context::set('layout', 'none');
49
+		$this->setTemplatePath($this->module_path . 'tpl');
50 50
 		$this->setTemplateFile('print_page');
51 51
 	}
52 52
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
59
-		Context::set('layout','none');
59
+		Context::set('layout', 'none');
60 60
 
61 61
 		$content = Context::get('content');
62
-		$this->setTemplatePath($this->module_path.'tpl');
62
+		$this->setTemplatePath($this->module_path . 'tpl');
63 63
 		$this->setTemplateFile('preview_page');
64 64
 	}
65 65
 
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	function dispDocumentManageDocument()
71 71
 	{
72
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
72
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
73 73
 		// Taken from a list of selected sessions
74 74
 		$flag_list = $_SESSION['document_management'];
75
-		if(count($flag_list))
75
+		if (count($flag_list))
76 76
 		{
77
-			foreach($flag_list as $key => $val)
77
+			foreach ($flag_list as $key => $val)
78 78
 			{
79
-				if(!is_bool($val)) continue;
79
+				if (!is_bool($val)) continue;
80 80
 				$document_srl_list[] = $key;
81 81
 			}
82 82
 		}
83 83
 
84
-		if(count($document_srl_list))
84
+		if (count($document_srl_list))
85 85
 		{
86 86
 			$oDocumentModel = getModel('document');
87 87
 			$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$oModuleModel = getModel('module');
92 92
 		// The combination of module categories list and the list of modules
93
-		if(count($module_list)>1) Context::set('module_list', $module_categories);
93
+		if (count($module_list) > 1) Context::set('module_list', $module_categories);
94 94
 
95
-		$module_srl=Context::get('module_srl');
96
-		Context::set('module_srl',$module_srl);
95
+		$module_srl = Context::get('module_srl');
96
+		Context::set('module_srl', $module_srl);
97 97
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
98
-		Context::set('mid',$module_info->mid);
99
-		Context::set('browser_title',$module_info->browser_title);
98
+		Context::set('mid', $module_info->mid);
99
+		Context::set('browser_title', $module_info->browser_title);
100 100
 
101 101
 		// Select Pop-up layout
102 102
 		$this->setLayoutPath('./common/tpl');
103 103
 		$this->setLayoutFile('popup_layout');
104 104
 
105
-		$this->setTemplatePath($this->module_path.'tpl');
105
+		$this->setTemplatePath($this->module_path . 'tpl');
106 106
 		$this->setTemplateFile('checked_list');
107 107
 	}
108 108
 
@@ -117,28 +117,28 @@  discard block
 block discarded – undo
117 117
 		$current_module_srl = Context::get('module_srl');
118 118
 		$current_module_srls = Context::get('module_srls');
119 119
 
120
-		if(!$current_module_srl && !$current_module_srls)
120
+		if (!$current_module_srl && !$current_module_srls)
121 121
 		{
122 122
 			// Get information of the current module
123 123
 			$current_module_info = Context::get('current_module_info');
124 124
 			$current_module_srl = $current_module_info->module_srl;
125
-			if(!$current_module_srl) return new Object();
125
+			if (!$current_module_srl) return new Object();
126 126
 		}
127 127
 
128 128
 		$oModuleModel = getModel('module');
129
-		if($current_module_srl)
129
+		if ($current_module_srl)
130 130
 		{
131 131
 			$document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
132 132
 		}
133
-		if(!$document_config)
133
+		if (!$document_config)
134 134
 		{
135 135
 			$document_config = new stdClass();
136 136
 		}
137
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
137
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
138 138
 		Context::set('document_config', $document_config);
139 139
 
140 140
 		$oTemplate = &TemplateHandler::getInstance();
141
-		$tpl = $oTemplate->compile($this->module_path.'tpl', 'document_module_config');
141
+		$tpl = $oTemplate->compile($this->module_path . 'tpl', 'document_module_config');
142 142
 		$obj .= $tpl;
143 143
 
144 144
 		return new Object();
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 
155 155
 		$oMemberModel = getModel('member');
156 156
 		// A message appears if the user is not logged-in
157
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
157
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
158 158
 		// Get the saved document (module_srl is set to member_srl instead)
159 159
 		$logged_info = Context::get('logged_info');
160 160
 		$args = new stdClass();
161 161
 		$args->member_srl = $logged_info->member_srl;
162 162
 		$args->statusList = array($this->getConfigStatus('temp'));
163
-		$args->page = (int)Context::get('page');
163
+		$args->page = (int) Context::get('page');
164 164
 		$args->list_count = 10;
165 165
 
166 166
 		$oDocumentModel = getModel('document');
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		Context::set('document_list', $output->data);
172 172
 		Context::set('page_navigation', $output->page_navigation);
173 173
 
174
-		$this->setTemplatePath($this->module_path.'tpl');
174
+		$this->setTemplatePath($this->module_path . 'tpl');
175 175
 		$this->setTemplateFile('saved_list_popup');
176 176
 	}
177 177
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,9 +36,13 @@  discard block
 block discarded – undo
36 36
 		$oDocumentModel = getModel('document');
37 37
 		// Creates an object for displaying the selected document
38 38
 		$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39
-		if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
39
+		if(!$oDocument->isExists()) {
40
+			return new Object(-1,'msg_invalid_request');
41
+		}
40 42
 		// Check permissions
41
-		if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
43
+		if(!$oDocument->isAccessible()) {
44
+			return new Object(-1,'msg_not_permitted');
45
+		}
42 46
 		// Information setting module
43 47
 		//Context::set('module_info', $module_info);	//module_info not use in UI
44 48
 		// Browser title settings
@@ -69,14 +73,18 @@  discard block
 block discarded – undo
69 73
 	 */
70 74
 	function dispDocumentManageDocument()
71 75
 	{
72
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
76
+		if(!Context::get('is_logged')) {
77
+			return new Object(-1,'msg_not_permitted');
78
+		}
73 79
 		// Taken from a list of selected sessions
74 80
 		$flag_list = $_SESSION['document_management'];
75 81
 		if(count($flag_list))
76 82
 		{
77 83
 			foreach($flag_list as $key => $val)
78 84
 			{
79
-				if(!is_bool($val)) continue;
85
+				if(!is_bool($val)) {
86
+					continue;
87
+				}
80 88
 				$document_srl_list[] = $key;
81 89
 			}
82 90
 		}
@@ -90,7 +98,9 @@  discard block
 block discarded – undo
90 98
 
91 99
 		$oModuleModel = getModel('module');
92 100
 		// The combination of module categories list and the list of modules
93
-		if(count($module_list)>1) Context::set('module_list', $module_categories);
101
+		if(count($module_list)>1) {
102
+			Context::set('module_list', $module_categories);
103
+		}
94 104
 
95 105
 		$module_srl=Context::get('module_srl');
96 106
 		Context::set('module_srl',$module_srl);
@@ -122,7 +132,9 @@  discard block
 block discarded – undo
122 132
 			// Get information of the current module
123 133
 			$current_module_info = Context::get('current_module_info');
124 134
 			$current_module_srl = $current_module_info->module_srl;
125
-			if(!$current_module_srl) return new Object();
135
+			if(!$current_module_srl) {
136
+				return new Object();
137
+			}
126 138
 		}
127 139
 
128 140
 		$oModuleModel = getModel('module');
@@ -134,7 +146,9 @@  discard block
 block discarded – undo
134 146
 		{
135 147
 			$document_config = new stdClass();
136 148
 		}
137
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
149
+		if(!isset($document_config->use_history)) {
150
+			$document_config->use_history = 'N';
151
+		}
138 152
 		Context::set('document_config', $document_config);
139 153
 
140 154
 		$oTemplate = &TemplateHandler::getInstance();
@@ -154,7 +168,9 @@  discard block
 block discarded – undo
154 168
 
155 169
 		$oMemberModel = getModel('member');
156 170
 		// A message appears if the user is not logged-in
157
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
171
+		if(!$oMemberModel->isLogged()) {
172
+			return $this->stop('msg_not_logged');
173
+		}
158 174
 		// Get the saved document (module_srl is set to member_srl instead)
159 175
 		$logged_info = Context::get('logged_info');
160 176
 		$args = new stdClass();
Please login to merge, or discard this patch.
modules/editor/editor.controller.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -238,6 +238,7 @@
 block discarded – undo
238 238
 
239 239
 	/**
240 240
 	 * @brief AutoSave
241
+	 * @param stdClass $args
241 242
 	 */
242 243
 	function doSaveDoc($args)
243 244
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  editor
5
- * @author NAVER ([email protected])
6
- * @brief editor module's controller class
7
- */
4
+	 * @class  editor
5
+	 * @author NAVER ([email protected])
6
+	 * @brief editor module's controller class
7
+	 */
8 8
 class editorController extends editor
9 9
 {
10 10
 	/**
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$component = Context::get('component');
49 49
 		$method = Context::get('method');
50
-		if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
50
+		if (!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
51 51
 
52 52
 		$oEditorModel = getModel('editor');
53 53
 		$oComponent = &$oEditorModel->getComponentObject($component);
54
-		if(!$oComponent->toBool()) return $oComponent;
54
+		if (!$oComponent->toBool()) return $oComponent;
55 55
 
56
-		if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
56
+		if (!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
57 57
 
58 58
 		//$output = call_user_method($method, $oComponent);
59 59
 		//$output = call_user_func(array($oComponent, $method));
60
-		if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
-		else return new Object(-1,sprintf('%s method is not exists', $method));
60
+		if (method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
+		else return new Object(-1, sprintf('%s method is not exists', $method));
62 62
 
63
-		if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
63
+		if ((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
64 64
 
65 65
 		$this->setError($oComponent->getError());
66 66
 		$this->setMessage($oComponent->getMessage());
67 67
 
68 68
 		$vars = $oComponent->getVariables();
69
-		if(count($vars))
69
+		if (count($vars))
70 70
 		{
71
-			foreach($vars as $key => $val)
71
+			foreach ($vars as $key => $val)
72 72
 			{
73 73
 				$this->add($key, $val);
74 74
 			}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	{
83 83
 		$module_srl = Context::get('target_module_srl');
84 84
 		// To configure many of modules at once
85
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
85
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
86 86
 		else $module_srl = array($module_srl);
87 87
 
88 88
 		$editor_config = new stdClass;
@@ -91,32 +91,32 @@  discard block
 block discarded – undo
91 91
 		$editor_config->content_style = Context::get('content_style');
92 92
 		$editor_config->comment_content_style = Context::get('comment_content_style');
93 93
 		$editor_config->content_font = Context::get('content_font');
94
-		if($editor_config->content_font)
94
+		if ($editor_config->content_font)
95 95
 		{
96 96
 			$font_list = array();
97
-			$fonts = explode(',',$editor_config->content_font);
98
-			for($i=0,$c=count($fonts);$i<$c;$i++)
97
+			$fonts = explode(',', $editor_config->content_font);
98
+			for ($i = 0, $c = count($fonts); $i < $c; $i++)
99 99
 			{
100
-				$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
101
-				if(!$font) continue;
100
+				$font = trim(str_replace(array('"', '\''), '', $fonts[$i]));
101
+				if (!$font) continue;
102 102
 				$font_list[] = $font;
103 103
 			}
104
-			if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
104
+			if (count($font_list)) $editor_config->content_font = '"' . implode('","', $font_list) . '"';
105 105
 		}
106 106
 		$editor_config->content_font_size = Context::get('content_font_size');
107 107
 		$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
108 108
 		$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
109 109
 
110
-		$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant');
110
+		$grants = array('enable_html_grant', 'enable_comment_html_grant', 'upload_file_grant', 'comment_upload_file_grant', 'enable_default_component_grant', 'enable_comment_default_component_grant', 'enable_component_grant', 'enable_comment_component_grant');
111 111
 
112
-		foreach($grants as $key)
112
+		foreach ($grants as $key)
113 113
 		{
114 114
 			$grant = Context::get($key);
115
-			if(!$grant)
115
+			if (!$grant)
116 116
 			{
117 117
 				$editor_config->{$key} = array();
118 118
 			}
119
-			else if(is_array($grant))
119
+			else if (is_array($grant))
120 120
 			{
121 121
 				$editor_config->{$key} = $grant;
122 122
 			}
@@ -126,17 +126,17 @@  discard block
 block discarded – undo
126 126
 			}
127 127
 		}
128 128
 
129
-		$editor_config->editor_height = (int)Context::get('editor_height');
130
-		$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
129
+		$editor_config->editor_height = (int) Context::get('editor_height');
130
+		$editor_config->comment_editor_height = (int) Context::get('comment_editor_height');
131 131
 		$editor_config->enable_autosave = Context::get('enable_autosave');
132
-		if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
132
+		if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
133 133
 
134 134
 		$oModuleController = getController('module');
135
-		for($i=0;$i<count($module_srl);$i++)
135
+		for ($i = 0; $i < count($module_srl); $i++)
136 136
 		{
137 137
 			$srl = trim($module_srl[$i]);
138
-			if(!$srl) continue;
139
-			$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
138
+			if (!$srl) continue;
139
+			$oModuleController->insertModulePartConfig('editor', $srl, $editor_config);
140 140
 		}
141 141
 
142 142
 		$this->setError(-1);
@@ -151,45 +151,45 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	function triggerEditorComponentCompile(&$content)
153 153
 	{
154
-		if(Context::getResponseMethod()!='HTML') return new Object();
154
+		if (Context::getResponseMethod() != 'HTML') return new Object();
155 155
 
156 156
 		$module_info = Context::get('module_info');
157 157
 		$module_srl = $module_info->module_srl;
158
-		if($module_srl)
158
+		if ($module_srl)
159 159
 		{
160 160
 			$oEditorModel = getModel('editor');
161 161
 			$editor_config = $oEditorModel->getEditorConfig($module_srl);
162 162
 			$content_style = $editor_config->content_style;
163
-			if($content_style)
163
+			if ($content_style)
164 164
 			{
165
-				$path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/';
166
-				if(is_dir($path) && file_exists($path . 'style.ini'))
165
+				$path = _XE_PATH_ . 'modules/editor/styles/' . $content_style . '/';
166
+				if (is_dir($path) && file_exists($path . 'style.ini'))
167 167
 				{
168
-					$ini = file($path.'style.ini');
169
-					for($i = 0, $c = count($ini); $i < $c; $i++)
168
+					$ini = file($path . 'style.ini');
169
+					for ($i = 0, $c = count($ini); $i < $c; $i++)
170 170
 					{
171 171
 						$file = trim($ini[$i]);
172
-						if(!$file) continue;
172
+						if (!$file) continue;
173 173
 
174
-						if(substr_compare($file, '.css', -4) === 0)
174
+						if (substr_compare($file, '.css', -4) === 0)
175 175
 						{
176
-							Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
176
+							Context::addCSSFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
177 177
 						}
178
-						elseif(substr_compare($file, '.js', -3) === 0)
178
+						elseif (substr_compare($file, '.js', -3) === 0)
179 179
 						{
180
-							Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
180
+							Context::addJsFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
181 181
 						}
182 182
 					}
183 183
 				}
184 184
 			}
185 185
 			$content_font = $editor_config->content_font;
186 186
 			$content_font_size = $editor_config->content_font_size;
187
-			if($content_font || $content_font_size)
187
+			if ($content_font || $content_font_size)
188 188
 			{
189 189
 				$buff = array();
190 190
 				$buff[] = '<style> .xe_content { ';
191
-				if($content_font) $buff[] = 'font-family:'.$content_font.';';
192
-				if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
191
+				if ($content_font) $buff[] = 'font-family:' . $content_font . ';';
192
+				if ($content_font_size) $buff[] = 'font-size:' . $content_font_size . ';';
193 193
 				$buff[] = ' }</style>';
194 194
 				Context::addHtmlHeader(implode('', $buff));
195 195
 			}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	function transComponent($content)
206 206
 	{
207
-		$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content);
207
+		$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content);
208 208
 		return $content;
209 209
 	}
210 210
 
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$xml_obj = new stdClass;
221 221
 		$xml_obj->attrs = new stdClass;
222
-		for($i=0,$c=count($m[0]);$i<$c;$i++)
222
+		for ($i = 0, $c = count($m[0]); $i < $c; $i++)
223 223
 		{
224
-			if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
224
+			if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
225 225
 			$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
226 226
 		}
227 227
 		$xml_obj->body = $match[4];
228 228
 
229
-		if(!$xml_obj->attrs->editor_component) return $match[0];
229
+		if (!$xml_obj->attrs->editor_component) return $match[0];
230 230
 
231 231
 		// Get converted codes by using component::transHTML()
232 232
 		$oEditorModel = getModel('editor');
233 233
 		$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
234
-		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
234
+		if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0];
235 235
 
236 236
 		return $oComponent->transHTML($xml_obj);
237 237
 	}
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	function doSaveDoc($args)
243 243
 	{
244
-		if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
245
-		if(Context::get('is_logged'))
244
+		if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
245
+		if (Context::get('is_logged'))
246 246
 		{
247 247
 			$logged_info = Context::get('logged_info');
248 248
 			$args->member_srl = $logged_info->member_srl;
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 		}
254 254
 
255 255
 		// Get the current module if module_srl doesn't exist
256
-		if(!$args->module_srl)
256
+		if (!$args->module_srl)
257 257
 		{
258 258
 			$args->module_srl = Context::get('module_srl');
259 259
 		}
260
-		if(!$args->module_srl)
260
+		if (!$args->module_srl)
261 261
 		{
262 262
 			$current_module_info = Context::get('current_module_info');
263 263
 			$args->module_srl = $current_module_info->module_srl;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	function deleteSavedDoc($mode = false)
304 304
 	{
305 305
 		$args = new stdClass();
306
-		if(Context::get('is_logged'))
306
+		if (Context::get('is_logged'))
307 307
 		{
308 308
 			$logged_info = Context::get('logged_info');
309 309
 			$args->member_srl = $logged_info->member_srl;
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		}
315 315
 		$args->module_srl = Context::get('module_srl');
316 316
 		// Get the current module if module_srl doesn't exist
317
-		if(!$args->module_srl)
317
+		if (!$args->module_srl)
318 318
 		{
319 319
 			$current_module_info = Context::get('current_module_info');
320 320
 			$args->module_srl = $current_module_info->module_srl;
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 		// Check if the auto-saved document already exists
323 323
 		$output = executeQuery('editor.getSavedDocument', $args);
324 324
 		$saved_doc = $output->data;
325
-		if(!$saved_doc) return;
325
+		if (!$saved_doc) return;
326 326
 
327 327
 		$oDocumentModel = getModel('document');
328 328
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
329
-		if(!$oSaved->isExists())
329
+		if (!$oSaved->isExists())
330 330
 		{
331
-			if($mode)
331
+			if ($mode)
332 332
 			{
333 333
 				$output = executeQuery('editor.getSavedDocument', $args);
334 334
 				$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 		$oEditorModel = getModel('editor');
357 357
 		$args = new stdClass;
358 358
 
359
-		if($filter_enabled) $args->enabled = "Y";
359
+		if ($filter_enabled) $args->enabled = "Y";
360 360
 
361
-		if($site_srl)
361
+		if ($site_srl)
362 362
 		{
363 363
 			$args->site_srl = $site_srl;
364 364
 			$output = executeQuery('editor.getSiteComponentList', $args);
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 		$db_list = $output->data;
368 368
 
369 369
 		// Get a list of files
370
-		$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
370
+		$downloaded_list = FileHandler::readDir(_XE_PATH_ . 'modules/editor/components');
371 371
 
372 372
 		// Get information about log-in status and its group
373 373
 		$is_logged = Context::get('is_logged');
374
-		if($is_logged)
374
+		if ($is_logged)
375 375
 		{
376 376
 			$logged_info = Context::get('logged_info');
377
-			if($logged_info->group_list && is_array($logged_info->group_list))
377
+			if ($logged_info->group_list && is_array($logged_info->group_list))
378 378
 			{
379 379
 				$group_list = array_keys($logged_info->group_list);
380 380
 			}
@@ -382,30 +382,30 @@  discard block
 block discarded – undo
382 382
 		}
383 383
 
384 384
 		// Get xml information for looping DB list
385
-		if(!is_array($db_list)) $db_list = array($db_list);
385
+		if (!is_array($db_list)) $db_list = array($db_list);
386 386
 		$component_list = new stdClass();
387
-		foreach($db_list as $component)
387
+		foreach ($db_list as $component)
388 388
 		{
389
-			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
389
+			if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue;
390 390
 
391 391
 			$component_name = $component->component_name;
392
-			if(!$component_name) continue;
392
+			if (!$component_name) continue;
393 393
 
394
-			if(!in_array($component_name, $downloaded_list)) continue;
394
+			if (!in_array($component_name, $downloaded_list)) continue;
395 395
 
396 396
 			unset($xml_info);
397 397
 			$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
398 398
 			$xml_info->enabled = $component->enabled;
399 399
 
400
-			if($component->extra_vars)
400
+			if ($component->extra_vars)
401 401
 			{
402 402
 				$extra_vars = unserialize($component->extra_vars);
403
-				if($extra_vars->target_group)
403
+				if ($extra_vars->target_group)
404 404
 				{
405 405
 					$xml_info->target_group = $extra_vars->target_group;
406 406
 				}
407 407
 
408
-				if($extra_vars->mid_list && count($extra_vars->mid_list))
408
+				if ($extra_vars->mid_list && count($extra_vars->mid_list))
409 409
 				{
410 410
 					$xml_info->mid_list = $extra_vars->mid_list;
411 411
 				}
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
 				if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
433 433
 				}*/
434 434
 				// Check the configuration of the editor component
435
-				if($xml_info->extra_vars)
435
+				if ($xml_info->extra_vars)
436 436
 				{
437
-					foreach($xml_info->extra_vars as $key => $val)
437
+					foreach ($xml_info->extra_vars as $key => $val)
438 438
 					{
439 439
 						$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
440 440
 					}
@@ -443,27 +443,27 @@  discard block
 block discarded – undo
443 443
 
444 444
 			$component_list->{$component_name} = $xml_info;
445 445
 			// Get buttons, icons, images
446
-			$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
447
-			$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
448
-			if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
449
-			if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
446
+			$icon_file = _XE_PATH_ . 'modules/editor/components/' . $component_name . '/icon.gif';
447
+			$component_icon_file = _XE_PATH_ . 'modules/editor/components/' . $component_name . '/component_icon.gif';
448
+			if (file_exists($icon_file)) $component_list->{$component_name}->icon = true;
449
+			if (file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
450 450
 		}
451 451
 
452 452
 		// Return if it checks enabled only
453
-		if($filter_enabled)
453
+		if ($filter_enabled)
454 454
 		{
455 455
 			$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
456
-			$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
456
+			$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list)));
457 457
 			FileHandler::writeFile($cache_file, $buff);
458 458
 			return $component_list;
459 459
 		}
460 460
 
461 461
 		// Get xml_info of downloaded list
462
-		foreach($downloaded_list as $component_name)
462
+		foreach ($downloaded_list as $component_name)
463 463
 		{
464
-			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
464
+			if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue;
465 465
 			// Pass if configured
466
-			if($component_list->{$component_name}) continue;
466
+			if ($component_list->{$component_name}) continue;
467 467
 			// Insert data into the DB
468 468
 			$oEditorController = getAdminController('editor');
469 469
 			$oEditorController->insertComponent($component_name, false, $site_srl);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
479
-		$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
479
+		$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list)));
480 480
 		FileHandler::writeFile($cache_file, $buff);
481 481
 
482 482
 		return $component_list;
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
 		$editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl);
499 499
 
500 500
 		$oModuleController = getController('module');
501
-		if(is_array($obj->moduleSrlList))
501
+		if (is_array($obj->moduleSrlList))
502 502
 		{
503
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
503
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
504 504
 			{
505 505
 				$oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig);
506 506
 			}
Please login to merge, or discard this patch.
Braces   +97 added lines, -42 removed lines patch added patch discarded remove patch
@@ -47,20 +47,31 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$component = Context::get('component');
49 49
 		$method = Context::get('method');
50
-		if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
50
+		if(!$component) {
51
+			return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
52
+		}
51 53
 
52 54
 		$oEditorModel = getModel('editor');
53 55
 		$oComponent = &$oEditorModel->getComponentObject($component);
54
-		if(!$oComponent->toBool()) return $oComponent;
56
+		if(!$oComponent->toBool()) {
57
+			return $oComponent;
58
+		}
55 59
 
56
-		if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
60
+		if(!method_exists($oComponent, $method)) {
61
+			return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
62
+		}
57 63
 
58 64
 		//$output = call_user_method($method, $oComponent);
59 65
 		//$output = call_user_func(array($oComponent, $method));
60
-		if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
-		else return new Object(-1,sprintf('%s method is not exists', $method));
66
+		if(method_exists($oComponent, $method)) {
67
+			$output = $oComponent->{$method}();
68
+		} else {
69
+			return new Object(-1,sprintf('%s method is not exists', $method));
70
+		}
62 71
 
63
-		if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
72
+		if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) {
73
+			return $output;
74
+		}
64 75
 
65 76
 		$this->setError($oComponent->getError());
66 77
 		$this->setMessage($oComponent->getMessage());
@@ -82,8 +93,11 @@  discard block
 block discarded – undo
82 93
 	{
83 94
 		$module_srl = Context::get('target_module_srl');
84 95
 		// To configure many of modules at once
85
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
86
-		else $module_srl = array($module_srl);
96
+		if(preg_match('/^([0-9,]+)$/',$module_srl)) {
97
+			$module_srl = explode(',',$module_srl);
98
+		} else {
99
+			$module_srl = array($module_srl);
100
+		}
87 101
 
88 102
 		$editor_config = new stdClass;
89 103
 		$editor_config->editor_skin = Context::get('editor_skin');
@@ -98,10 +112,14 @@  discard block
 block discarded – undo
98 112
 			for($i=0,$c=count($fonts);$i<$c;$i++)
99 113
 			{
100 114
 				$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
101
-				if(!$font) continue;
115
+				if(!$font) {
116
+					continue;
117
+				}
102 118
 				$font_list[] = $font;
103 119
 			}
104
-			if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
120
+			if(count($font_list)) {
121
+				$editor_config->content_font = '"'.implode('","',$font_list).'"';
122
+			}
105 123
 		}
106 124
 		$editor_config->content_font_size = Context::get('content_font_size');
107 125
 		$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
@@ -115,12 +133,10 @@  discard block
 block discarded – undo
115 133
 			if(!$grant)
116 134
 			{
117 135
 				$editor_config->{$key} = array();
118
-			}
119
-			else if(is_array($grant))
136
+			} else if(is_array($grant))
120 137
 			{
121 138
 				$editor_config->{$key} = $grant;
122
-			}
123
-			else
139
+			} else
124 140
 			{
125 141
 				$editor_config->{$key} = explode('|@|', $grant);
126 142
 			}
@@ -129,13 +145,17 @@  discard block
 block discarded – undo
129 145
 		$editor_config->editor_height = (int)Context::get('editor_height');
130 146
 		$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
131 147
 		$editor_config->enable_autosave = Context::get('enable_autosave');
132
-		if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
148
+		if($editor_config->enable_autosave != 'Y') {
149
+			$editor_config->enable_autosave = 'N';
150
+		}
133 151
 
134 152
 		$oModuleController = getController('module');
135 153
 		for($i=0;$i<count($module_srl);$i++)
136 154
 		{
137 155
 			$srl = trim($module_srl[$i]);
138
-			if(!$srl) continue;
156
+			if(!$srl) {
157
+				continue;
158
+			}
139 159
 			$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
140 160
 		}
141 161
 
@@ -151,7 +171,9 @@  discard block
 block discarded – undo
151 171
 	 */
152 172
 	function triggerEditorComponentCompile(&$content)
153 173
 	{
154
-		if(Context::getResponseMethod()!='HTML') return new Object();
174
+		if(Context::getResponseMethod()!='HTML') {
175
+			return new Object();
176
+		}
155 177
 
156 178
 		$module_info = Context::get('module_info');
157 179
 		$module_srl = $module_info->module_srl;
@@ -169,13 +191,14 @@  discard block
 block discarded – undo
169 191
 					for($i = 0, $c = count($ini); $i < $c; $i++)
170 192
 					{
171 193
 						$file = trim($ini[$i]);
172
-						if(!$file) continue;
194
+						if(!$file) {
195
+							continue;
196
+						}
173 197
 
174 198
 						if(substr_compare($file, '.css', -4) === 0)
175 199
 						{
176 200
 							Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
177
-						}
178
-						elseif(substr_compare($file, '.js', -3) === 0)
201
+						} elseif(substr_compare($file, '.js', -3) === 0)
179 202
 						{
180 203
 							Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
181 204
 						}
@@ -188,8 +211,12 @@  discard block
 block discarded – undo
188 211
 			{
189 212
 				$buff = array();
190 213
 				$buff[] = '<style> .xe_content { ';
191
-				if($content_font) $buff[] = 'font-family:'.$content_font.';';
192
-				if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
214
+				if($content_font) {
215
+					$buff[] = 'font-family:'.$content_font.';';
216
+				}
217
+				if($content_font_size) {
218
+					$buff[] = 'font-size:'.$content_font_size.';';
219
+				}
193 220
 				$buff[] = ' }</style>';
194 221
 				Context::addHtmlHeader(implode('', $buff));
195 222
 			}
@@ -221,17 +248,23 @@  discard block
 block discarded – undo
221 248
 		$xml_obj->attrs = new stdClass;
222 249
 		for($i=0,$c=count($m[0]);$i<$c;$i++)
223 250
 		{
224
-			if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
251
+			if(!isset($xml_obj->attrs)) {
252
+				$xml_obj->attrs = new stdClass;
253
+			}
225 254
 			$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
226 255
 		}
227 256
 		$xml_obj->body = $match[4];
228 257
 
229
-		if(!$xml_obj->attrs->editor_component) return $match[0];
258
+		if(!$xml_obj->attrs->editor_component) {
259
+			return $match[0];
260
+		}
230 261
 
231 262
 		// Get converted codes by using component::transHTML()
232 263
 		$oEditorModel = getModel('editor');
233 264
 		$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
234
-		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
265
+		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) {
266
+			return $match[0];
267
+		}
235 268
 
236 269
 		return $oComponent->transHTML($xml_obj);
237 270
 	}
@@ -241,13 +274,14 @@  discard block
 block discarded – undo
241 274
 	 */
242 275
 	function doSaveDoc($args)
243 276
 	{
244
-		if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
277
+		if(!$args->document_srl) {
278
+			$args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
279
+		}
245 280
 		if(Context::get('is_logged'))
246 281
 		{
247 282
 			$logged_info = Context::get('logged_info');
248 283
 			$args->member_srl = $logged_info->member_srl;
249
-		}
250
-		else
284
+		} else
251 285
 		{
252 286
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
253 287
 		}
@@ -307,8 +341,7 @@  discard block
 block discarded – undo
307 341
 		{
308 342
 			$logged_info = Context::get('logged_info');
309 343
 			$args->member_srl = $logged_info->member_srl;
310
-		}
311
-		else
344
+		} else
312 345
 		{
313 346
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
314 347
 		}
@@ -322,7 +355,9 @@  discard block
 block discarded – undo
322 355
 		// Check if the auto-saved document already exists
323 356
 		$output = executeQuery('editor.getSavedDocument', $args);
324 357
 		$saved_doc = $output->data;
325
-		if(!$saved_doc) return;
358
+		if(!$saved_doc) {
359
+			return;
360
+		}
326 361
 
327 362
 		$oDocumentModel = getModel('document');
328 363
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
@@ -356,14 +391,17 @@  discard block
 block discarded – undo
356 391
 		$oEditorModel = getModel('editor');
357 392
 		$args = new stdClass;
358 393
 
359
-		if($filter_enabled) $args->enabled = "Y";
394
+		if($filter_enabled) {
395
+			$args->enabled = "Y";
396
+		}
360 397
 
361 398
 		if($site_srl)
362 399
 		{
363 400
 			$args->site_srl = $site_srl;
364 401
 			$output = executeQuery('editor.getSiteComponentList', $args);
402
+		} else {
403
+			$output = executeQuery('editor.getComponentList', $args);
365 404
 		}
366
-		else $output = executeQuery('editor.getComponentList', $args);
367 405
 		$db_list = $output->data;
368 406
 
369 407
 		// Get a list of files
@@ -377,21 +415,30 @@  discard block
 block discarded – undo
377 415
 			if($logged_info->group_list && is_array($logged_info->group_list))
378 416
 			{
379 417
 				$group_list = array_keys($logged_info->group_list);
418
+			} else {
419
+				$group_list = array();
380 420
 			}
381
-			else $group_list = array();
382 421
 		}
383 422
 
384 423
 		// Get xml information for looping DB list
385
-		if(!is_array($db_list)) $db_list = array($db_list);
424
+		if(!is_array($db_list)) {
425
+			$db_list = array($db_list);
426
+		}
386 427
 		$component_list = new stdClass();
387 428
 		foreach($db_list as $component)
388 429
 		{
389
-			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
430
+			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) {
431
+				continue;
432
+			}
390 433
 
391 434
 			$component_name = $component->component_name;
392
-			if(!$component_name) continue;
435
+			if(!$component_name) {
436
+				continue;
437
+			}
393 438
 
394
-			if(!in_array($component_name, $downloaded_list)) continue;
439
+			if(!in_array($component_name, $downloaded_list)) {
440
+				continue;
441
+			}
395 442
 
396 443
 			unset($xml_info);
397 444
 			$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
@@ -445,8 +492,12 @@  discard block
 block discarded – undo
445 492
 			// Get buttons, icons, images
446 493
 			$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
447 494
 			$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
448
-			if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
449
-			if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
495
+			if(file_exists($icon_file)) {
496
+				$component_list->{$component_name}->icon = true;
497
+			}
498
+			if(file_exists($component_icon_file)) {
499
+				$component_list->{$component_name}->component_icon = true;
500
+			}
450 501
 		}
451 502
 
452 503
 		// Return if it checks enabled only
@@ -461,9 +512,13 @@  discard block
 block discarded – undo
461 512
 		// Get xml_info of downloaded list
462 513
 		foreach($downloaded_list as $component_name)
463 514
 		{
464
-			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
515
+			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) {
516
+				continue;
517
+			}
465 518
 			// Pass if configured
466
-			if($component_list->{$component_name}) continue;
519
+			if($component_list->{$component_name}) {
520
+				continue;
521
+			}
467 522
 			// Insert data into the DB
468 523
 			$oEditorController = getAdminController('editor');
469 524
 			$oEditorController->insertComponent($component_name, false, $site_srl);
Please login to merge, or discard this patch.
modules/editor/editor.model.php 4 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -113,6 +113,11 @@  discard block
 block discarded – undo
113 113
 		Context::set('drComponentList',$drComponentInfo);
114 114
 	}
115 115
 
116
+	/**
117
+	 * @param string $drComponentName
118
+	 *
119
+	 * @return string
120
+	 */
116 121
 	function getDrComponentXmlInfo($drComponentName)
117 122
 	{
118 123
 		$lang_type = Context::getLangType();
@@ -191,6 +196,7 @@  discard block
 block discarded – undo
191 196
 	 * @brief Return the editor template
192 197
 	 * You can call upload_target_srl when modifying content
193 198
 	 * The upload_target_srl is used for a routine to check if an attachment exists
199
+	 * @param stdClass $option
194 200
 	 */
195 201
 	function getEditor($upload_target_srl = 0, $option = null)
196 202
 	{
@@ -486,6 +492,8 @@  discard block
 block discarded – undo
486 492
 
487 493
 	/**
488 494
 	 * @brief Get information which has been auto-saved
495
+	 * @param integer $upload_target_srl
496
+	 * @return string
489 497
 	 */
490 498
 	function getSavedDoc($upload_target_srl)
491 499
 	{
@@ -586,6 +594,7 @@  discard block
 block discarded – undo
586 594
 
587 595
 	/**
588 596
 	 * @brief Return a component list (DB Information included)
597
+	 * @return string
589 598
 	 */
590 599
 	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
591 600
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * @class  editorModel
5
- * @author NAVER ([email protected])
6
- * @brief model class of the editor odule
7
- */
4
+	 * @class  editorModel
5
+	 * @author NAVER ([email protected])
6
+	 * @brief model class of the editor odule
7
+	 */
8 8
 class editorModel extends editor
9 9
 {
10 10
 	var $loaded_component_list = array();
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getEditorConfig($module_srl = null)
25 25
 	{
26
-		if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
26
+		if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
27 27
 		{
28 28
 			// Get trackback settings of the selected module
29 29
 			$oModuleModel = getModel('module');
@@ -34,55 +34,55 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
37
+		if (!is_object($editor_config)) $editor_config = new stdClass();
38 38
 
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
39
+		if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
+		if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
+		if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
+		if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
+		if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
+		if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
+		if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
+		if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
+		if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array();
48 48
 
49
-		if(!$editor_config->editor_height)
49
+		if (!$editor_config->editor_height)
50 50
 		{
51 51
 			$editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500;
52 52
 		}
53
-		if(!$editor_config->comment_editor_height)
53
+		if (!$editor_config->comment_editor_height)
54 54
 		{
55 55
 			$editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120;
56 56
 		}
57
-		if(!$editor_config->editor_skin)
57
+		if (!$editor_config->editor_skin)
58 58
 		{
59 59
 			$editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor';
60 60
 		}
61
-		if(!$editor_config->comment_editor_skin)
61
+		if (!$editor_config->comment_editor_skin)
62 62
 		{
63 63
 			$editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor';
64 64
 		}
65
-		if(!$editor_config->content_style)
65
+		if (!$editor_config->content_style)
66 66
 		{
67 67
 			$editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light';
68 68
 		}
69
-		if(!$editor_config->content_font && $editor_default_config->content_font)
69
+		if (!$editor_config->content_font && $editor_default_config->content_font)
70 70
 		{
71 71
 			$editor_config->content_font = $editor_default_config->content_font;
72 72
 		}
73
-		if(!$editor_config->content_font_size && $editor_default_config->content_font_size)
73
+		if (!$editor_config->content_font_size && $editor_default_config->content_font_size)
74 74
 		{
75 75
 			$editor_config->content_font_size = $editor_default_config->content_font_size;
76 76
 		}
77
-		if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
77
+		if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
78 78
 		{
79 79
 			$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
80 80
 		}
81
-		if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
81
+		if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
82 82
 		{
83 83
 			$editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset;
84 84
 		}
85
-		if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
85
+		if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
86 86
 		{
87 87
 			$editor_config->comment_content_style = $editor_default_config->comment_content_style;
88 88
 		}
@@ -98,19 +98,19 @@  discard block
 block discarded – undo
98 98
 		$oTemplate = &TemplateHandler::getInstance();
99 99
 
100 100
 		$drComponentInfo = array();
101
-		if($drComponentList)
101
+		if ($drComponentList)
102 102
 		{
103
-			foreach($drComponentList as $i => $drComponent)
103
+			foreach ($drComponentList as $i => $drComponent)
104 104
 			{
105 105
 				unset($obj);
106 106
 				$obj = $this->getDrComponentXmlInfo($drComponent);
107
-				Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent));
108
-				$path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent);
109
-				$obj->html = $oTemplate->compile($path,$drComponent);
107
+				Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent));
108
+				$path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent);
109
+				$obj->html = $oTemplate->compile($path, $drComponent);
110 110
 				$drComponentInfo[$drComponent] = $obj;
111 111
 			}
112 112
 		}
113
-		Context::set('drComponentList',$drComponentInfo);
113
+		Context::set('drComponentList', $drComponentInfo);
114 114
 	}
115 115
 
116 116
 	function getDrComponentXmlInfo($drComponentName)
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$xml_file = sprintf('%sinfo.xml', $component_path);
123 123
 		$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
124 124
 		// Return information after including it after cached xml file exists
125
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
125
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
126 126
 		{
127 127
 			include($cache_file);
128 128
 			return $xml_info;
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 152
 
153 153
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
154
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155 155
 		else $author_list = $xml_doc->component->author;
156 156
 
157
-		for($i=0; $i < count($author_list); $i++)
157
+		for ($i = 0; $i < count($author_list); $i++)
158 158
 		{
159
-			$buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
160
-			$buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
161
-			$buff .= sprintf('$xml_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
159
+			$buff .= sprintf('$xml_info->author[' . $i . ']->name = "%s";', $author_list[$i]->name->body);
160
+			$buff .= sprintf('$xml_info->author[' . $i . ']->email_address = "%s";', $author_list[$i]->attrs->email_address);
161
+			$buff .= sprintf('$xml_info->author[' . $i . ']->homepage = "%s";', $author_list[$i]->attrs->link);
162 162
 		}
163 163
 
164 164
 		// List extra variables (text type only in the editor component)
165 165
 		$extra_vars = $xml_doc->component->extra_vars->var;
166
-		if($extra_vars)
166
+		if ($extra_vars)
167 167
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
-			foreach($extra_vars as $key => $val)
168
+			if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
+			foreach ($extra_vars as $key => $val)
170 170
 			{
171 171
 				unset($obj);
172 172
 				$key = $val->attrs->name;
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 		 * Editor's default options
199 199
 		 */
200 200
 		// Option setting to allow file upload
201
-		if($upload_target_srl)
201
+		if ($upload_target_srl)
202 202
 		{
203 203
 			$option->editor_sequence = $upload_target_srl;
204 204
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
205
+		if (!$option->allow_fileupload) $allow_fileupload = false;
206 206
 		else $allow_fileupload = true;
207 207
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
208
+		if (!$option->content_style) $option->content_style = 'ckeditor_light';
209 209
 		Context::set('content_style', $option->content_style);
210 210
 		Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style);
211 211
 		// Default font setting
@@ -213,32 +213,32 @@  discard block
 block discarded – undo
213 213
 		Context::set('content_font_size', $option->content_font_size);
214 214
 
215 215
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
216
+		if (!$option->enable_autosave) $enable_autosave = false;
217
+		elseif (Context::get($option->primary_key_name)) $enable_autosave = false;
218 218
 		else $enable_autosave = true;
219 219
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
220
+		if (!$option->enable_default_component) $enable_default_component = false;
221 221
 		else $enable_default_component = true;
222 222
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
223
+		if (!$option->enable_component) $enable_component = false;
224 224
 		else $enable_component = true;
225 225
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
226
+		if ($option->disable_html) $html_mode = false;
227 227
 		else $html_mode = true;
228 228
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
229
+		if (!$option->height) $editor_height = 300;
230 230
 		else $editor_height = $option->height;
231 231
 		// Skin Setting
232 232
 		$skin = $option->skin;
233
-		if(!$skin) $skin = 'ckeditor';
233
+		if (!$skin) $skin = 'ckeditor';
234 234
 
235 235
 		$colorset = $option->colorset;
236
-		if(!$colorset) $colorset = 'moono';
236
+		if (!$colorset) $colorset = 'moono';
237 237
 		Context::set('colorset', $colorset);
238 238
 		Context::set('skin', $skin);
239 239
 		Context::set('module_type', $option->module_type);
240 240
 
241
-		if($skin=='dreditor')
241
+		if ($skin == 'dreditor')
242 242
 		{
243 243
 			$this->loadDrComponents();
244 244
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		/**
247 247
 		 * Check the automatic backup feature (do not use if the post is edited)
248 248
 		 */
249
-		if($enable_autosave)
249
+		if ($enable_autosave)
250 250
 		{
251 251
 			// Extract auto-saved data
252 252
 			$saved_doc = $this->getSavedDoc($upload_target_srl);
@@ -258,26 +258,26 @@  discard block
 block discarded – undo
258 258
 		/**
259 259
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
260 260
 		 */
261
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
261
+		if ($option->editor_sequence) $editor_sequence = $option->editor_sequence;
262 262
 		else
263 263
 		{
264
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
265
-			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
264
+			if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
265
+			$editor_sequence = $_SESSION['_editor_sequence_']++;
266 266
 		}
267 267
 
268 268
 		/**
269 269
 		 * Upload setting by using configuration of the file module internally
270 270
 		 */
271 271
 		$files_count = 0;
272
-		if($allow_fileupload)
272
+		if ($allow_fileupload)
273 273
 		{
274 274
 			$oFileModel = getModel('file');
275 275
 			// Get upload configuration to set on SWFUploader
276 276
 			$file_config = $oFileModel->getUploadConfig();
277
-			$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
278
-			$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
277
+			$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
278
+			$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
279 279
 
280
-			Context::set('file_config',$file_config);
280
+			Context::set('file_config', $file_config);
281 281
 			// Configure upload status such as file size
282 282
 			$upload_status = $oFileModel->getUploadStatus();
283 283
 			Context::set('upload_status', $upload_status);
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			$oFileController = getController('file');
286 286
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
287 287
 			// Check if the file already exists
288
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
288
+			if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
289 289
 		}
290
-		Context::set('files_count', (int)$files_count);
290
+		Context::set('files_count', (int) $files_count);
291 291
 
292 292
 		Context::set('allow_fileupload', $allow_fileupload);
293 293
 		// Set editor_sequence value
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		 * Check editor component
305 305
 		 */
306 306
 		$site_module_info = Context::get('site_module_info');
307
-		$site_srl = (int)$site_module_info->site_srl;
308
-		if($enable_component)
307
+		$site_srl = (int) $site_module_info->site_srl;
308
+		if ($enable_component)
309 309
 		{
310
-			if(!Context::get('component_list'))
310
+			if (!Context::get('component_list'))
311 311
 			{
312 312
 				$component_list = $this->getComponentList(true, $site_srl);
313 313
 				Context::set('component_list', $component_list);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
335 335
 		$tpl_file = 'editor.html';
336 336
 
337
-		if(!file_exists($tpl_path.$tpl_file))
337
+		if (!file_exists($tpl_path . $tpl_file))
338 338
 		{
339 339
 			$skin = 'ckeditor';
340 340
 			$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		Context::set('editor_path', $tpl_path);
343 343
 
344 344
 		// load editor skin lang
345
-		Context::loadLang($tpl_path.'lang');
345
+		Context::loadLang($tpl_path . 'lang');
346 346
 		// Return the compiled result from tpl file
347 347
 		$oTemplate = TemplateHandler::getInstance();
348 348
 		return $oTemplate->compile($tpl_path, $tpl_file);
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		$config->module_type = $type;
365 365
 
366 366
 		// Configurations listed according to a type
367
-		if($type == 'document')
367
+		if ($type == 'document')
368 368
 		{
369 369
 			$config->editor_skin = $editor_config->editor_skin;
370 370
 			$config->content_style = $editor_config->content_style;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			$config->enable_autosave = 'N';
394 394
 		}
395 395
 		// Check a group_list of the currently logged-in user for permission check
396
-		if(Context::get('is_logged'))
396
+		if (Context::get('is_logged'))
397 397
 		{
398 398
 			$logged_info = Context::get('logged_info');
399 399
 			$group_list = $logged_info->group_list;
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
 		$option->colorset = $config->sel_editor_colorset;
413 413
 		// Permission check for file upload
414 414
 		$option->allow_fileupload = false;
415
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
416
-		elseif(count($config->upload_file_grant))
415
+		if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true;
416
+		elseif (count($config->upload_file_grant))
417 417
 		{
418
-			foreach($group_list as $group_srl => $group_info)
418
+			foreach ($group_list as $group_srl => $group_info)
419 419
 			{
420
-				if(in_array($group_srl, $config->upload_file_grant))
420
+				if (in_array($group_srl, $config->upload_file_grant))
421 421
 				{
422 422
 					$option->allow_fileupload = true;
423 423
 					break;
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 		else $option->allow_fileupload = true;
428 428
 		// Permission check for using default components
429 429
 		$option->enable_default_component = false;
430
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
431
-		elseif(count($config->enable_default_component_grant))
430
+		if ($logged_info->is_admin == 'Y') $option->enable_default_component = true;
431
+		elseif (count($config->enable_default_component_grant))
432 432
 		{
433
-			foreach($group_list as $group_srl => $group_info)
433
+			foreach ($group_list as $group_srl => $group_info)
434 434
 			{
435
-				if(in_array($group_srl, $config->enable_default_component_grant))
435
+				if (in_array($group_srl, $config->enable_default_component_grant))
436 436
 				{
437 437
 					$option->enable_default_component = true;
438 438
 					break;
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 		else $option->enable_default_component = true;
443 443
 		// Permisshion check for using extended components
444 444
 		$option->enable_component = false;
445
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
446
-		elseif(count($config->enable_component_grant))
445
+		if ($logged_info->is_admin == 'Y') $option->enable_component = true;
446
+		elseif (count($config->enable_component_grant))
447 447
 		{
448
-			foreach($group_list as $group_srl => $group_info)
448
+			foreach ($group_list as $group_srl => $group_info)
449 449
 			{
450
-				if(in_array($group_srl, $config->enable_component_grant))
450
+				if (in_array($group_srl, $config->enable_component_grant))
451 451
 				{
452 452
 					$option->enable_component = true;
453 453
 					break;
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 		else $option->enable_component = true;
458 458
 		// HTML editing privileges
459 459
 		$enable_html = false;
460
-		if($logged_info->is_admin=='Y') $enable_html = true;
461
-		elseif(count($config->enable_html_grant))
460
+		if ($logged_info->is_admin == 'Y') $enable_html = true;
461
+		elseif (count($config->enable_html_grant))
462 462
 		{
463
-			foreach($group_list as $group_srl => $group_info)
463
+			foreach ($group_list as $group_srl => $group_info)
464 464
 			{
465
-				if(in_array($group_srl, $config->enable_html_grant))
465
+				if (in_array($group_srl, $config->enable_html_grant))
466 466
 				{
467 467
 					$enable_html = true;
468 468
 					break;
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 		else $enable_html = true;
473 473
 
474
-		if($enable_html) $option->disable_html = false;
474
+		if ($enable_html) $option->disable_html = false;
475 475
 		else $option->disable_html = true;
476 476
 		// Set Height
477 477
 		$option->height = $config->editor_height;
478 478
 		// Set an option for Auto-save
479
-		$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
479
+		$option->enable_autosave = $config->enable_autosave == 'Y' ? true : false;
480 480
 		// Other settings
481 481
 		$option->primary_key_name = $primary_key_name;
482 482
 		$option->content_key_name = $content_key_name;
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	{
492 492
 		$auto_save_args = new stdClass();
493 493
 		// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
494
-		if(Context::get('is_logged'))
494
+		if (Context::get('is_logged'))
495 495
 		{
496 496
 			$logged_info = Context::get('logged_info');
497 497
 			$auto_save_args->member_srl = $logged_info->member_srl;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 		}
503 503
 		$auto_save_args->module_srl = Context::get('module_srl');
504 504
 		// Get the current module if module_srl doesn't exist
505
-		if(!$auto_save_args->module_srl)
505
+		if (!$auto_save_args->module_srl)
506 506
 		{
507 507
 			$current_module_info = Context::get('current_module_info');
508 508
 			$auto_save_args->module_srl = $current_module_info->module_srl;
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
512 512
 		$saved_doc = $output->data;
513 513
 		// Return null if no result is auto-saved
514
-		if(!$saved_doc) return;
514
+		if (!$saved_doc) return;
515 515
 		// Check if the auto-saved document already exists
516 516
 		$oDocumentModel = getModel('document');
517 517
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
518
-		if($oSaved->isExists()) return;
518
+		if ($oSaved->isExists()) return;
519 519
 		// Move all the files if the auto-saved data contains document_srl and file
520 520
 		// Then set document_srl to editor_sequence
521
-		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
521
+		if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
522 522
 		{
523 523
 			$saved_doc->module_srl = $auto_save_args->module_srl;
524 524
 			$oFileController = getController('file');
525 525
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
526 526
 		}
527
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
527
+		else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
528 528
 		// Change auto-saved data
529 529
 		$oEditorController = getController('editor');
530 530
 		$oEditorController->deleteSavedDoc(false);
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
542 542
 	{
543
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
543
+		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
544 544
 
545
-		if(!$this->loaded_component_list[$component][$editor_sequence])
545
+		if (!$this->loaded_component_list[$component][$editor_sequence])
546 546
 		{
547 547
 			// Create an object of the component and execute
548 548
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
549 549
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
550
-			if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
550
+			if (!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
551 551
 			// Create an object after loading the class file
552 552
 			require_once($class_file);
553 553
 			$oComponent = new $component($editor_sequence, $class_path);
554
-			if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
554
+			if (!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
555 555
 			// Add configuration information
556 556
 			$component_info = $this->getComponent($component, $site_srl);
557 557
 			$oComponent->setInfo($component_info);
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 	/**
573 573
 	 * @brief Return the cache file name of editor component list
574 574
 	 */
575
-	function getCacheFile($filter_enabled= true, $site_srl = 0)
575
+	function getCacheFile($filter_enabled = true, $site_srl = 0)
576 576
 	{
577 577
 		$lang = Context::getLangType();
578
-		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
578
+		$cache_path = _XE_PATH_ . 'files/cache/editor/cache/';
579 579
 		FileHandler::makeDir($cache_path);
580
-		$cache_file = $cache_path.'component_list.' . $lang .'.';
581
-		if($filter_enabled) $cache_file .= 'filter.';
582
-		if($site_srl) $cache_file .= $site_srl.'.';
580
+		$cache_file = $cache_path . 'component_list.' . $lang . '.';
581
+		if ($filter_enabled) $cache_file .= 'filter.';
582
+		if ($site_srl) $cache_file .= $site_srl . '.';
583 583
 		$cache_file .= 'php';
584 584
 		return $cache_file;
585 585
 	}
@@ -587,19 +587,19 @@  discard block
 block discarded – undo
587 587
 	/**
588 588
 	 * @brief Return a component list (DB Information included)
589 589
 	 */
590
-	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
590
+	function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false)
591 591
 	{
592 592
 		$cache_file = $this->getCacheFile(false, $site_srl);
593
-		if($from_db || !file_exists($cache_file))
593
+		if ($from_db || !file_exists($cache_file))
594 594
 		{
595 595
 			$oEditorController = getController('editor');
596 596
 			$oEditorController->makeCache(false, $site_srl);
597 597
 		}
598 598
 
599
-		if(!file_exists($cache_file)) return;
599
+		if (!file_exists($cache_file)) return;
600 600
 		include($cache_file);
601 601
 		$logged_info = Context::get('logged_info');
602
-		if($logged_info && is_array($logged_info->group_list))
602
+		if ($logged_info && is_array($logged_info->group_list))
603 603
 		{
604 604
 			$group_list = array_keys($logged_info->group_list);
605 605
 		}
@@ -608,45 +608,45 @@  discard block
 block discarded – undo
608 608
 			$group_list = array();
609 609
 		}
610 610
 
611
-		if(count($component_list))
611
+		if (count($component_list))
612 612
 		{
613
-			foreach($component_list as $key => $val)
613
+			foreach ($component_list as $key => $val)
614 614
 			{
615
-				if(!trim($key)) continue;
616
-				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
615
+				if (!trim($key)) continue;
616
+				if (!is_dir(_XE_PATH_ . 'modules/editor/components/' . $key))
617 617
 				{
618 618
 					FileHandler::removeFile($cache_file);
619 619
 					return $this->getComponentList($filter_enabled, $site_srl);
620 620
 				}
621
-				if(!$filter_enabled) continue;
622
-				if($val->enabled == "N")
621
+				if (!$filter_enabled) continue;
622
+				if ($val->enabled == "N")
623 623
 				{
624 624
 					unset($component_list->{$key});
625 625
 					continue;
626 626
 				}
627
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
628
-				if($val->target_group)
627
+				if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
628
+				if ($val->target_group)
629 629
 				{
630
-					if(!$logged_info)
630
+					if (!$logged_info)
631 631
 					{
632 632
 						$val->enabled = "N";
633 633
 					}
634 634
 					else
635 635
 					{
636 636
 						$is_granted = false;
637
-						foreach($group_list as $group_srl)
637
+						foreach ($group_list as $group_srl)
638 638
 						{
639
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
639
+							if (in_array($group_srl, $val->target_group)) $is_granted = true;
640 640
 						}
641
-						if(!$is_granted) $val->enabled = "N";
641
+						if (!$is_granted) $val->enabled = "N";
642 642
 					}
643 643
 				}
644
-				if($val->enabled != "N" && $val->mid_list)
644
+				if ($val->enabled != "N" && $val->mid_list)
645 645
 				{
646 646
 					$mid = Context::get('mid');
647
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
647
+					if (!in_array($mid, $val->mid_list)) $val->enabled = "N";
648 648
 				}
649
-				if($val->enabled == "N")
649
+				if ($val->enabled == "N")
650 650
 				{
651 651
 					unset($component_list->{$key});
652 652
 					continue;
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		$args = new stdClass();
665 665
 		$args->component_name = $component_name;
666 666
 
667
-		if($site_srl)
667
+		if ($site_srl)
668 668
 		{
669 669
 			$args->site_srl = $site_srl;
670 670
 			$output = executeQuery('editor.getSiteComponent', $args);
@@ -685,25 +685,25 @@  discard block
 block discarded – undo
685 685
 
686 686
 		$xml_info->mid_list = array();
687 687
 
688
-		if($component->extra_vars)
688
+		if ($component->extra_vars)
689 689
 		{
690 690
 			$extra_vars = unserialize($component->extra_vars);
691 691
 
692
-			if($extra_vars->target_group)
692
+			if ($extra_vars->target_group)
693 693
 			{
694 694
 				$xml_info->target_group = $extra_vars->target_group;
695 695
 				unset($extra_vars->target_group);
696 696
 			}
697 697
 
698
-			if($extra_vars->mid_list)
698
+			if ($extra_vars->mid_list)
699 699
 			{
700 700
 				$xml_info->mid_list = $extra_vars->mid_list;
701 701
 				unset($extra_vars->mid_list);
702 702
 			}
703 703
 
704
-			if($xml_info->extra_vars)
704
+			if ($xml_info->extra_vars)
705 705
 			{
706
-				foreach($xml_info->extra_vars as $key => $val)
706
+				foreach ($xml_info->extra_vars as $key => $val)
707 707
 				{
708 708
 					$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
709 709
 				}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 		$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
728 728
 
729 729
 		// Include and return xml file information if cached file exists
730
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
730
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
731 731
 		{
732 732
 			include($cache_file);
733 733
 
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 		$component_info->component_name = $component;
745 745
 		$component_info->title = $xml_doc->component->title->body;
746 746
 
747
-		if($xml_doc->component->version)
747
+		if ($xml_doc->component->version)
748 748
 		{
749 749
 			$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
750 750
 			$component_info->version = $xml_doc->component->version->body;
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 
771 771
 		// Author information
772 772
 		$author_list = array();
773
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
773
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
774 774
 		else $author_list = $xml_doc->component->author;
775 775
 
776
-		for($i = 0; $i < count($author_list); $i++)
776
+		for ($i = 0; $i < count($author_list); $i++)
777 777
 		{
778 778
 			$author = new stdClass;
779 779
 			$author->name = $author_list[$i]->name->body;
@@ -784,39 +784,39 @@  discard block
 block discarded – undo
784 784
 
785 785
 		// List extra variables (text type only for editor component)
786 786
 		$extra_vars = $xml_doc->component->extra_vars;
787
-		if($extra_vars)
787
+		if ($extra_vars)
788 788
 		{
789 789
 			$extra_var_groups = $extra_vars->group;
790
-			if(!$extra_var_groups)
790
+			if (!$extra_var_groups)
791 791
 			{
792 792
 				$extra_var_groups = $extra_vars;
793 793
 			}
794
-			if(!is_array($extra_var_groups))
794
+			if (!is_array($extra_var_groups))
795 795
 			{
796 796
 				$extra_var_groups = array($extra_var_groups);
797 797
 			}
798 798
 
799
-			foreach($extra_var_groups as $group)
799
+			foreach ($extra_var_groups as $group)
800 800
 			{
801 801
 				$extra_vars = $group->var;
802
-				if(!is_array($group->var))
802
+				if (!is_array($group->var))
803 803
 				{
804 804
 					$extra_vars = array($group->var);
805 805
 				}
806 806
 
807
-				foreach($extra_vars as $key => $val)
807
+				foreach ($extra_vars as $key => $val)
808 808
 				{
809
-					if(!$val)
809
+					if (!$val)
810 810
 					{
811 811
 						continue;
812 812
 					}
813 813
 
814 814
 					$obj = new stdClass();
815
-					if(!$val->attrs)
815
+					if (!$val->attrs)
816 816
 					{
817 817
 						$val->attrs = new stdClass();
818 818
 					}
819
-					if(!$val->attrs->type)
819
+					if (!$val->attrs->type)
820 820
 					{
821 821
 						$val->attrs->type = 'text';
822 822
 					}
@@ -826,26 +826,26 @@  discard block
 block discarded – undo
826 826
 					$obj->title = $val->title->body;
827 827
 					$obj->type = $val->attrs->type;
828 828
 					$obj->description = $val->description->body;
829
-					if($obj->name)
829
+					if ($obj->name)
830 830
 					{
831 831
 						$obj->value = $extra_vals->{$obj->name};
832 832
 					}
833
-					if(strpos($obj->value, '|@|') != FALSE)
833
+					if (strpos($obj->value, '|@|') != FALSE)
834 834
 					{
835 835
 						$obj->value = explode('|@|', $obj->value);
836 836
 					}
837
-					if($obj->type == 'mid_list' && !is_array($obj->value))
837
+					if ($obj->type == 'mid_list' && !is_array($obj->value))
838 838
 					{
839 839
 						$obj->value = array($obj->value);
840 840
 					}
841 841
 
842 842
 					// 'Select'type obtained from the option list.
843
-					if($val->options && !is_array($val->options))
843
+					if ($val->options && !is_array($val->options))
844 844
 					{
845 845
 						$val->options = array($val->options);
846 846
 					}
847 847
 
848
-					for($i = 0, $c = count($val->options); $i < $c; $i++)
848
+					for ($i = 0, $c = count($val->options); $i < $c; $i++)
849 849
 					{
850 850
 						$obj->options[$i] = new stdClass();
851 851
 						$obj->options[$i]->title = $val->options[$i]->title->body;
Please login to merge, or discard this patch.
Braces   +170 added lines, -79 removed lines patch added patch discarded remove patch
@@ -34,17 +34,37 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
38
-
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
37
+		if(!is_object($editor_config)) {
38
+			$editor_config = new stdClass();
39
+		}
40
+
41
+		if($editor_config->enable_autosave != 'N') {
42
+			$editor_config->enable_autosave = 'Y';
43
+		}
44
+		if(!is_array($editor_config->enable_html_grant)) {
45
+			$editor_config->enable_html_grant = array();
46
+		}
47
+		if(!is_array($editor_config->enable_comment_html_grant)) {
48
+			$editor_config->enable_comment_html_grant = array();
49
+		}
50
+		if(!is_array($editor_config->upload_file_grant)) {
51
+			$editor_config->upload_file_grant = array();
52
+		}
53
+		if(!is_array($editor_config->comment_upload_file_grant)) {
54
+			$editor_config->comment_upload_file_grant = array();
55
+		}
56
+		if(!is_array($editor_config->enable_default_component_grant)) {
57
+			$editor_config->enable_default_component_grant = array();
58
+		}
59
+		if(!is_array($editor_config->enable_comment_default_component_grant)) {
60
+			$editor_config->enable_comment_default_component_grant = array();
61
+		}
62
+		if(!is_array($editor_config->enable_component_grant)) {
63
+			$editor_config->enable_component_grant = array();
64
+		}
65
+		if(!is_array($editor_config->enable_comment_component_grant)) {
66
+			$editor_config->enable_comment_component_grant= array();
67
+		}
48 68
 
49 69
 		if(!$editor_config->editor_height)
50 70
 		{
@@ -151,8 +171,11 @@  discard block
 block discarded – undo
151 171
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 172
 
153 173
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155
-		else $author_list = $xml_doc->component->author;
174
+		if(!is_array($xml_doc->component->author)) {
175
+			$author_list[] = $xml_doc->component->author;
176
+		} else {
177
+			$author_list = $xml_doc->component->author;
178
+		}
156 179
 
157 180
 		for($i=0; $i < count($author_list); $i++)
158 181
 		{
@@ -165,7 +188,9 @@  discard block
 block discarded – undo
165 188
 		$extra_vars = $xml_doc->component->extra_vars->var;
166 189
 		if($extra_vars)
167 190
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
191
+			if(!is_array($extra_vars)) {
192
+				$extra_vars = array($extra_vars);
193
+			}
169 194
 			foreach($extra_vars as $key => $val)
170 195
 			{
171 196
 				unset($obj);
@@ -202,10 +227,15 @@  discard block
 block discarded – undo
202 227
 		{
203 228
 			$option->editor_sequence = $upload_target_srl;
204 229
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
206
-		else $allow_fileupload = true;
230
+		if(!$option->allow_fileupload) {
231
+			$allow_fileupload = false;
232
+		} else {
233
+			$allow_fileupload = true;
234
+		}
207 235
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
236
+		if(!$option->content_style) {
237
+			$option->content_style = 'ckeditor_light';
238
+		}
209 239
 		Context::set('content_style', $option->content_style);
210 240
 		Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style);
211 241
 		// Default font setting
@@ -213,27 +243,47 @@  discard block
 block discarded – undo
213 243
 		Context::set('content_font_size', $option->content_font_size);
214 244
 
215 245
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
218
-		else $enable_autosave = true;
246
+		if(!$option->enable_autosave) {
247
+			$enable_autosave = false;
248
+		} elseif(Context::get($option->primary_key_name)) {
249
+			$enable_autosave = false;
250
+		} else {
251
+			$enable_autosave = true;
252
+		}
219 253
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
221
-		else $enable_default_component = true;
254
+		if(!$option->enable_default_component) {
255
+			$enable_default_component = false;
256
+		} else {
257
+			$enable_default_component = true;
258
+		}
222 259
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
224
-		else $enable_component = true;
260
+		if(!$option->enable_component) {
261
+			$enable_component = false;
262
+		} else {
263
+			$enable_component = true;
264
+		}
225 265
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
227
-		else $html_mode = true;
266
+		if($option->disable_html) {
267
+			$html_mode = false;
268
+		} else {
269
+			$html_mode = true;
270
+		}
228 271
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
230
-		else $editor_height = $option->height;
272
+		if(!$option->height) {
273
+			$editor_height = 300;
274
+		} else {
275
+			$editor_height = $option->height;
276
+		}
231 277
 		// Skin Setting
232 278
 		$skin = $option->skin;
233
-		if(!$skin) $skin = 'ckeditor';
279
+		if(!$skin) {
280
+			$skin = 'ckeditor';
281
+		}
234 282
 
235 283
 		$colorset = $option->colorset;
236
-		if(!$colorset) $colorset = 'moono';
284
+		if(!$colorset) {
285
+			$colorset = 'moono';
286
+		}
237 287
 		Context::set('colorset', $colorset);
238 288
 		Context::set('skin', $skin);
239 289
 		Context::set('module_type', $option->module_type);
@@ -258,10 +308,13 @@  discard block
 block discarded – undo
258 308
 		/**
259 309
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
260 310
 		 */
261
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
262
-		else
311
+		if($option->editor_sequence) {
312
+			$editor_sequence = $option->editor_sequence;
313
+		} else
263 314
 		{
264
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
315
+			if(!$_SESSION['_editor_sequence_']) {
316
+				$_SESSION['_editor_sequence_'] = 1;
317
+			}
265 318
 			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
266 319
 		}
267 320
 
@@ -285,7 +338,9 @@  discard block
 block discarded – undo
285 338
 			$oFileController = getController('file');
286 339
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
287 340
 			// Check if the file already exists
288
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
341
+			if($upload_target_srl) {
342
+				$files_count = $oFileModel->getFilesCount($upload_target_srl);
343
+			}
289 344
 		}
290 345
 		Context::set('files_count', (int)$files_count);
291 346
 
@@ -377,8 +432,7 @@  discard block
 block discarded – undo
377 432
 			$config->enable_html_grant = $editor_config->enable_html_grant;
378 433
 			$config->editor_height = $editor_config->editor_height;
379 434
 			$config->enable_autosave = $editor_config->enable_autosave;
380
-		}
381
-		else
435
+		} else
382 436
 		{
383 437
 			$config->editor_skin = $editor_config->comment_editor_skin;
384 438
 			$config->content_style = $editor_config->comment_content_style;
@@ -397,8 +451,7 @@  discard block
 block discarded – undo
397 451
 		{
398 452
 			$logged_info = Context::get('logged_info');
399 453
 			$group_list = $logged_info->group_list;
400
-		}
401
-		else
454
+		} else
402 455
 		{
403 456
 			$group_list = array();
404 457
 		}
@@ -412,8 +465,9 @@  discard block
 block discarded – undo
412 465
 		$option->colorset = $config->sel_editor_colorset;
413 466
 		// Permission check for file upload
414 467
 		$option->allow_fileupload = false;
415
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
416
-		elseif(count($config->upload_file_grant))
468
+		if($logged_info->is_admin=='Y') {
469
+			$option->allow_fileupload = true;
470
+		} elseif(count($config->upload_file_grant))
417 471
 		{
418 472
 			foreach($group_list as $group_srl => $group_info)
419 473
 			{
@@ -423,12 +477,14 @@  discard block
 block discarded – undo
423 477
 					break;
424 478
 				}
425 479
 			}
480
+		} else {
481
+			$option->allow_fileupload = true;
426 482
 		}
427
-		else $option->allow_fileupload = true;
428 483
 		// Permission check for using default components
429 484
 		$option->enable_default_component = false;
430
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
431
-		elseif(count($config->enable_default_component_grant))
485
+		if($logged_info->is_admin=='Y') {
486
+			$option->enable_default_component = true;
487
+		} elseif(count($config->enable_default_component_grant))
432 488
 		{
433 489
 			foreach($group_list as $group_srl => $group_info)
434 490
 			{
@@ -438,12 +494,14 @@  discard block
 block discarded – undo
438 494
 					break;
439 495
 				}
440 496
 			}
497
+		} else {
498
+			$option->enable_default_component = true;
441 499
 		}
442
-		else $option->enable_default_component = true;
443 500
 		// Permisshion check for using extended components
444 501
 		$option->enable_component = false;
445
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
446
-		elseif(count($config->enable_component_grant))
502
+		if($logged_info->is_admin=='Y') {
503
+			$option->enable_component = true;
504
+		} elseif(count($config->enable_component_grant))
447 505
 		{
448 506
 			foreach($group_list as $group_srl => $group_info)
449 507
 			{
@@ -453,12 +511,14 @@  discard block
 block discarded – undo
453 511
 					break;
454 512
 				}
455 513
 			}
514
+		} else {
515
+			$option->enable_component = true;
456 516
 		}
457
-		else $option->enable_component = true;
458 517
 		// HTML editing privileges
459 518
 		$enable_html = false;
460
-		if($logged_info->is_admin=='Y') $enable_html = true;
461
-		elseif(count($config->enable_html_grant))
519
+		if($logged_info->is_admin=='Y') {
520
+			$enable_html = true;
521
+		} elseif(count($config->enable_html_grant))
462 522
 		{
463 523
 			foreach($group_list as $group_srl => $group_info)
464 524
 			{
@@ -468,11 +528,15 @@  discard block
 block discarded – undo
468 528
 					break;
469 529
 				}
470 530
 			}
531
+		} else {
532
+			$enable_html = true;
471 533
 		}
472
-		else $enable_html = true;
473 534
 
474
-		if($enable_html) $option->disable_html = false;
475
-		else $option->disable_html = true;
535
+		if($enable_html) {
536
+			$option->disable_html = false;
537
+		} else {
538
+			$option->disable_html = true;
539
+		}
476 540
 		// Set Height
477 541
 		$option->height = $config->editor_height;
478 542
 		// Set an option for Auto-save
@@ -495,8 +559,7 @@  discard block
 block discarded – undo
495 559
 		{
496 560
 			$logged_info = Context::get('logged_info');
497 561
 			$auto_save_args->member_srl = $logged_info->member_srl;
498
-		}
499
-		else
562
+		} else
500 563
 		{
501 564
 			$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
502 565
 		}
@@ -511,11 +574,15 @@  discard block
 block discarded – undo
511 574
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
512 575
 		$saved_doc = $output->data;
513 576
 		// Return null if no result is auto-saved
514
-		if(!$saved_doc) return;
577
+		if(!$saved_doc) {
578
+			return;
579
+		}
515 580
 		// Check if the auto-saved document already exists
516 581
 		$oDocumentModel = getModel('document');
517 582
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
518
-		if($oSaved->isExists()) return;
583
+		if($oSaved->isExists()) {
584
+			return;
585
+		}
519 586
 		// Move all the files if the auto-saved data contains document_srl and file
520 587
 		// Then set document_srl to editor_sequence
521 588
 		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@@ -523,8 +590,9 @@  discard block
 block discarded – undo
523 590
 			$saved_doc->module_srl = $auto_save_args->module_srl;
524 591
 			$oFileController = getController('file');
525 592
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
593
+		} else if($upload_target_srl) {
594
+			$saved_doc->document_srl = $upload_target_srl;
526 595
 		}
527
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
528 596
 		// Change auto-saved data
529 597
 		$oEditorController = getController('editor');
530 598
 		$oEditorController->deleteSavedDoc(false);
@@ -540,18 +608,24 @@  discard block
 block discarded – undo
540 608
 	 */
541 609
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
542 610
 	{
543
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
611
+		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) {
612
+			return;
613
+		}
544 614
 
545 615
 		if(!$this->loaded_component_list[$component][$editor_sequence])
546 616
 		{
547 617
 			// Create an object of the component and execute
548 618
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
549 619
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
550
-			if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
620
+			if(!file_exists($class_file)) {
621
+				return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
622
+			}
551 623
 			// Create an object after loading the class file
552 624
 			require_once($class_file);
553 625
 			$oComponent = new $component($editor_sequence, $class_path);
554
-			if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
626
+			if(!$oComponent) {
627
+				return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
628
+			}
555 629
 			// Add configuration information
556 630
 			$component_info = $this->getComponent($component, $site_srl);
557 631
 			$oComponent->setInfo($component_info);
@@ -578,8 +652,12 @@  discard block
 block discarded – undo
578 652
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
579 653
 		FileHandler::makeDir($cache_path);
580 654
 		$cache_file = $cache_path.'component_list.' . $lang .'.';
581
-		if($filter_enabled) $cache_file .= 'filter.';
582
-		if($site_srl) $cache_file .= $site_srl.'.';
655
+		if($filter_enabled) {
656
+			$cache_file .= 'filter.';
657
+		}
658
+		if($site_srl) {
659
+			$cache_file .= $site_srl.'.';
660
+		}
583 661
 		$cache_file .= 'php';
584 662
 		return $cache_file;
585 663
 	}
@@ -596,14 +674,15 @@  discard block
 block discarded – undo
596 674
 			$oEditorController->makeCache(false, $site_srl);
597 675
 		}
598 676
 
599
-		if(!file_exists($cache_file)) return;
677
+		if(!file_exists($cache_file)) {
678
+			return;
679
+		}
600 680
 		include($cache_file);
601 681
 		$logged_info = Context::get('logged_info');
602 682
 		if($logged_info && is_array($logged_info->group_list))
603 683
 		{
604 684
 			$group_list = array_keys($logged_info->group_list);
605
-		}
606
-		else
685
+		} else
607 686
 		{
608 687
 			$group_list = array();
609 688
 		}
@@ -612,39 +691,50 @@  discard block
 block discarded – undo
612 691
 		{
613 692
 			foreach($component_list as $key => $val)
614 693
 			{
615
-				if(!trim($key)) continue;
694
+				if(!trim($key)) {
695
+					continue;
696
+				}
616 697
 				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
617 698
 				{
618 699
 					FileHandler::removeFile($cache_file);
619 700
 					return $this->getComponentList($filter_enabled, $site_srl);
620 701
 				}
621
-				if(!$filter_enabled) continue;
702
+				if(!$filter_enabled) {
703
+					continue;
704
+				}
622 705
 				if($val->enabled == "N")
623 706
 				{
624 707
 					unset($component_list->{$key});
625 708
 					continue;
626 709
 				}
627
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
710
+				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") {
711
+					continue;
712
+				}
628 713
 				if($val->target_group)
629 714
 				{
630 715
 					if(!$logged_info)
631 716
 					{
632 717
 						$val->enabled = "N";
633
-					}
634
-					else
718
+					} else
635 719
 					{
636 720
 						$is_granted = false;
637 721
 						foreach($group_list as $group_srl)
638 722
 						{
639
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
723
+							if(in_array($group_srl, $val->target_group)) {
724
+								$is_granted = true;
725
+							}
726
+						}
727
+						if(!$is_granted) {
728
+							$val->enabled = "N";
640 729
 						}
641
-						if(!$is_granted) $val->enabled = "N";
642 730
 					}
643 731
 				}
644 732
 				if($val->enabled != "N" && $val->mid_list)
645 733
 				{
646 734
 					$mid = Context::get('mid');
647
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
735
+					if(!in_array($mid, $val->mid_list)) {
736
+						$val->enabled = "N";
737
+					}
648 738
 				}
649 739
 				if($val->enabled == "N")
650 740
 				{
@@ -668,8 +758,7 @@  discard block
 block discarded – undo
668 758
 		{
669 759
 			$args->site_srl = $site_srl;
670 760
 			$output = executeQuery('editor.getSiteComponent', $args);
671
-		}
672
-		else
761
+		} else
673 762
 		{
674 763
 			$output = executeQuery('editor.getComponent', $args);
675 764
 		}
@@ -752,8 +841,7 @@  discard block
 block discarded – undo
752 841
 			$component_info->homepage = $xml_doc->component->link->body;
753 842
 			$component_info->license = $xml_doc->component->license->body;
754 843
 			$component_info->license_link = $xml_doc->component->license->attrs->link;
755
-		}
756
-		else
844
+		} else
757 845
 		{
758 846
 			sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
759 847
 			$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -770,8 +858,11 @@  discard block
 block discarded – undo
770 858
 
771 859
 		// Author information
772 860
 		$author_list = array();
773
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
774
-		else $author_list = $xml_doc->component->author;
861
+		if(!is_array($xml_doc->component->author)) {
862
+			$author_list[] = $xml_doc->component->author;
863
+		} else {
864
+			$author_list = $xml_doc->component->author;
865
+		}
775 866
 
776 867
 		for($i = 0; $i < count($author_list); $i++)
777 868
 		{
Please login to merge, or discard this patch.
modules/file/file.admin.controller.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * Delete selected files from the administrator page
58 58
 	 *
59
-	 * @return Object
59
+	 * @return ModuleObject|null
60 60
 	 */
61 61
 	function procFileAdminDeleteChecked()
62 62
 	{
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	/**
111 111
 	 * Add file information for each module
112 112
 	 *
113
-	 * @return void
113
+	 * @return Object|null
114 114
 	 */
115 115
 	function procFileAdminInsertModuleConfig()
116 116
 	{
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * admin controller class of the file module
5
- * @author NAVER ([email protected])
6
- */
4
+	 * admin controller class of the file module
5
+	 * @author NAVER ([email protected])
6
+	 */
7 7
 class fileAdminController extends file
8 8
 {
9 9
 	/**
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass();
27 27
 		$args->module_srl = $module_srl;
28 28
 		$columnList = array('file_srl', 'uploaded_filename');
29
-		$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
30
-		if(!$output) return $output;
29
+		$output = executeQueryArray('file.getModuleFiles', $args, $columnList);
30
+		if (!$output) return $output;
31 31
 		$files = $output->data;
32 32
 		// Remove from the DB
33 33
 		$args->module_srl = $module_srl;
34 34
 		$output = executeQuery('file.deleteModuleFiles', $args);
35
-		if(!$output->toBool()) return $output;
35
+		if (!$output->toBool()) return $output;
36 36
 		// Remove the file
37
-		FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
38
-		FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
37
+		FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl));
38
+		FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl));
39 39
 		// Remove the file list obtained from the DB
40 40
 		$path = array();
41 41
 		$cnt = count($files);
42
-		for($i=0;$i<$cnt;$i++)
42
+		for ($i = 0; $i < $cnt; $i++)
43 43
 		{
44 44
 			$uploaded_filename = $files[$i]->uploaded_filename;
45 45
 			FileHandler::removeFile($uploaded_filename);
46 46
 
47 47
 			$path_info = pathinfo($uploaded_filename);
48
-			if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
48
+			if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
49 49
 		}
50 50
 		// Remove a file directory of the document
51
-		for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
51
+		for ($i = 0; $i < count($path); $i++) FileHandler::removeBlankDir($path[$i]);
52 52
 
53 53
 		return $output;
54 54
 	}
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 	{
63 63
 		// An error appears if no document is selected
64 64
 		$cart = Context::get('cart');
65
-		if(!$cart) return $this->stop('msg_file_cart_is_null');
66
-		if(!is_array($cart)) $file_srl_list= explode('|@|', $cart);
65
+		if (!$cart) return $this->stop('msg_file_cart_is_null');
66
+		if (!is_array($cart)) $file_srl_list = explode('|@|', $cart);
67 67
 		else $file_srl_list = $cart;
68 68
 		$file_count = count($file_srl_list);
69
-		if(!$file_count) return $this->stop('msg_file_cart_is_null');
69
+		if (!$file_count) return $this->stop('msg_file_cart_is_null');
70 70
 
71 71
 		$oFileController = getController('file');
72 72
 		// Delete the post
73
-		for($i=0;$i<$file_count;$i++)
73
+		for ($i = 0; $i < $file_count; $i++)
74 74
 		{
75 75
 			$file_srl = trim($file_srl_list[$i]);
76
-			if(!$file_srl) continue;
76
+			if (!$file_srl) continue;
77 77
 
78 78
 			$oFileController->deleteFile($file_srl);
79 79
 		}
80 80
 
81
-		$this->setMessage( sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count) );
81
+		$this->setMessage(sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count));
82 82
 
83 83
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList');
84 84
 		$this->setRedirectUrl($returnUrl);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$config->allow_outlink_site = Context::get('allow_outlink_site');
102 102
 		// Create module Controller object
103 103
 		$oModuleController = getController('module');
104
-		$output = $oModuleController->insertModuleConfig('file',$config);
104
+		$output = $oModuleController->insertModuleConfig('file', $config);
105 105
 
106 106
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminConfig');
107 107
 		return $this->setRedirectUrl($returnUrl, $output);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		// Get variables
118 118
 		$module_srl = Context::get('target_module_srl');
119 119
 		// In order to configure multiple modules at once
120
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
120
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
121 121
 		else $module_srl = array($module_srl);
122 122
 
123 123
 		$download_grant = Context::get('download_grant');
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
 		$file_config->allowed_attach_size = Context::get('allowed_attach_size');
131 131
 		$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
132 132
 
133
-		if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant);
133
+		if (!is_array($download_grant)) $file_config->download_grant = explode('|@|', $download_grant);
134 134
 		else $file_config->download_grant = $download_grant;
135 135
 
136 136
 		//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
137
-		$userFileAllowSize = FileHandler::returnbytes($file_config->allowed_filesize.'M');
138
-		$userAttachAllowSize = FileHandler::returnbytes($file_config->allowed_attach_size.'M');
137
+		$userFileAllowSize = FileHandler::returnbytes($file_config->allowed_filesize . 'M');
138
+		$userAttachAllowSize = FileHandler::returnbytes($file_config->allowed_attach_size . 'M');
139 139
 		$iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size'));
140 140
 		$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
141 141
 		$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
142 142
 
143
-		if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
143
+		if ($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
144 144
 			return new Object(-1, 'input size over than config in php.ini');
145 145
 
146 146
 		$oModuleController = getController('module');
147
-		for($i=0;$i<count($module_srl);$i++)
147
+		for ($i = 0; $i < count($module_srl); $i++)
148 148
 		{
149 149
 			$srl = trim($module_srl[$i]);
150
-			if(!$srl) continue;
151
-			$oModuleController->insertModulePartConfig('file',$srl,$file_config);
150
+			if (!$srl) continue;
151
+			$oModuleController->insertModulePartConfig('file', $srl, $file_config);
152 152
 		}
153 153
 
154 154
 		$this->setError(-1);
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	function procFileAdminAddCart()
167 167
 	{
168
-		$file_srl = (int)Context::get('file_srl');
168
+		$file_srl = (int) Context::get('file_srl');
169 169
 		//$fileSrlList = array(500, 502);
170 170
 
171 171
 		$oFileModel = getModel('file');
172 172
 		$output = $oFileModel->getFile($file_srl);
173 173
 		//$output = $oFileModel->getFile($fileSrlList);
174 174
 
175
-		if($output->file_srl)
175
+		if ($output->file_srl)
176 176
 		{
177
-			if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
177
+			if ($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
178 178
 			else $_SESSION['file_management'][$output->file_srl] = true;
179 179
 		}
180 180
 	}
Please login to merge, or discard this patch.
Braces   +47 added lines, -18 removed lines patch added patch discarded remove patch
@@ -27,12 +27,16 @@  discard block
 block discarded – undo
27 27
 		$args->module_srl = $module_srl;
28 28
 		$columnList = array('file_srl', 'uploaded_filename');
29 29
 		$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
30
-		if(!$output) return $output;
30
+		if(!$output) {
31
+			return $output;
32
+		}
31 33
 		$files = $output->data;
32 34
 		// Remove from the DB
33 35
 		$args->module_srl = $module_srl;
34 36
 		$output = executeQuery('file.deleteModuleFiles', $args);
35
-		if(!$output->toBool()) return $output;
37
+		if(!$output->toBool()) {
38
+			return $output;
39
+		}
36 40
 		// Remove the file
37 41
 		FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
38 42
 		FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
@@ -45,10 +49,14 @@  discard block
 block discarded – undo
45 49
 			FileHandler::removeFile($uploaded_filename);
46 50
 
47 51
 			$path_info = pathinfo($uploaded_filename);
48
-			if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
52
+			if(!in_array($path_info['dirname'], $path)) {
53
+				$path[] = $path_info['dirname'];
54
+			}
49 55
 		}
50 56
 		// Remove a file directory of the document
51
-		for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
57
+		for($i=0;$i<count($path);$i++) {
58
+			FileHandler::removeBlankDir($path[$i]);
59
+		}
52 60
 
53 61
 		return $output;
54 62
 	}
@@ -62,18 +70,27 @@  discard block
 block discarded – undo
62 70
 	{
63 71
 		// An error appears if no document is selected
64 72
 		$cart = Context::get('cart');
65
-		if(!$cart) return $this->stop('msg_file_cart_is_null');
66
-		if(!is_array($cart)) $file_srl_list= explode('|@|', $cart);
67
-		else $file_srl_list = $cart;
73
+		if(!$cart) {
74
+			return $this->stop('msg_file_cart_is_null');
75
+		}
76
+		if(!is_array($cart)) {
77
+			$file_srl_list= explode('|@|', $cart);
78
+		} else {
79
+			$file_srl_list = $cart;
80
+		}
68 81
 		$file_count = count($file_srl_list);
69
-		if(!$file_count) return $this->stop('msg_file_cart_is_null');
82
+		if(!$file_count) {
83
+			return $this->stop('msg_file_cart_is_null');
84
+		}
70 85
 
71 86
 		$oFileController = getController('file');
72 87
 		// Delete the post
73 88
 		for($i=0;$i<$file_count;$i++)
74 89
 		{
75 90
 			$file_srl = trim($file_srl_list[$i]);
76
-			if(!$file_srl) continue;
91
+			if(!$file_srl) {
92
+				continue;
93
+			}
77 94
 
78 95
 			$oFileController->deleteFile($file_srl);
79 96
 		}
@@ -117,8 +134,11 @@  discard block
 block discarded – undo
117 134
 		// Get variables
118 135
 		$module_srl = Context::get('target_module_srl');
119 136
 		// In order to configure multiple modules at once
120
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
121
-		else $module_srl = array($module_srl);
137
+		if(preg_match('/^([0-9,]+)$/',$module_srl)) {
138
+			$module_srl = explode(',',$module_srl);
139
+		} else {
140
+			$module_srl = array($module_srl);
141
+		}
122 142
 
123 143
 		$download_grant = Context::get('download_grant');
124 144
 
@@ -130,8 +150,11 @@  discard block
 block discarded – undo
130 150
 		$file_config->allowed_attach_size = Context::get('allowed_attach_size');
131 151
 		$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
132 152
 
133
-		if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant);
134
-		else $file_config->download_grant = $download_grant;
153
+		if(!is_array($download_grant)) {
154
+			$file_config->download_grant = explode('|@|',$download_grant);
155
+		} else {
156
+			$file_config->download_grant = $download_grant;
157
+		}
135 158
 
136 159
 		//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
137 160
 		$userFileAllowSize = FileHandler::returnbytes($file_config->allowed_filesize.'M');
@@ -140,14 +163,17 @@  discard block
 block discarded – undo
140 163
 		$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
141 164
 		$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
142 165
 
143
-		if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
144
-			return new Object(-1, 'input size over than config in php.ini');
166
+		if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie) {
167
+					return new Object(-1, 'input size over than config in php.ini');
168
+		}
145 169
 
146 170
 		$oModuleController = getController('module');
147 171
 		for($i=0;$i<count($module_srl);$i++)
148 172
 		{
149 173
 			$srl = trim($module_srl[$i]);
150
-			if(!$srl) continue;
174
+			if(!$srl) {
175
+				continue;
176
+			}
151 177
 			$oModuleController->insertModulePartConfig('file',$srl,$file_config);
152 178
 		}
153 179
 
@@ -174,8 +200,11 @@  discard block
 block discarded – undo
174 200
 
175 201
 		if($output->file_srl)
176 202
 		{
177
-			if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
178
-			else $_SESSION['file_management'][$output->file_srl] = true;
203
+			if($_SESSION['file_management'][$output->file_srl]) {
204
+				unset($_SESSION['file_management'][$output->file_srl]);
205
+			} else {
206
+				$_SESSION['file_management'][$output->file_srl] = true;
207
+			}
179 208
 		}
180 209
 	}
181 210
 }
Please login to merge, or discard this patch.
modules/file/file.admin.model.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@
 block discarded – undo
144 144
 	 * Make search parameters from object(private)
145 145
 	 *
146 146
 	 * @param object $obj Original searach options
147
-	 * @param object $args Result searach options
147
+	 * @param stdClass $args Result searach options
148 148
 	 * @return void
149 149
 	 */
150 150
 	function _makeSearchParam(&$obj, &$args)
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 /**
4
- * Admin model class of the file module
5
- * @author NAVER ([email protected])
6
- */
4
+	 * Admin model class of the file module
5
+	 * @author NAVER ([email protected])
6
+	 */
7 7
 class fileAdminModel extends file
8 8
 {
9 9
 	/**
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
 		$this->_makeSearchParam($obj, $args);
69 69
 
70 70
 		// Set valid/invalid state
71
-		if($obj->isvalid == 'Y') $args->isvalid = 'Y';
72
-		elseif($obj->isvalid == 'N') $args->isvalid = 'N';
71
+		if ($obj->isvalid == 'Y') $args->isvalid = 'Y';
72
+		elseif ($obj->isvalid == 'N') $args->isvalid = 'N';
73 73
 		// Set multimedia/common file
74
-		if($obj->direct_download == 'Y') $args->direct_download = 'Y';
75
-		elseif($obj->direct_download == 'N') $args->direct_download= 'N';
74
+		if ($obj->direct_download == 'Y') $args->direct_download = 'Y';
75
+		elseif ($obj->direct_download == 'N') $args->direct_download = 'N';
76 76
 		// Set variables
77 77
 		$args->sort_index = $obj->sort_index;
78
-		$args->page = $obj->page?$obj->page:1;
79
-		$args->list_count = $obj->list_count?$obj->list_count:20;
80
-		$args->page_count = $obj->page_count?$obj->page_count:10;
78
+		$args->page = $obj->page ? $obj->page : 1;
79
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
80
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
81 81
 		$args->s_module_srl = $obj->module_srl;
82 82
 		$args->exclude_module_srl = $obj->exclude_module_srl;
83 83
 		// Execute the file.getFileList query
84 84
 		$output = executeQuery('file.getFileList', $args, $columnList);
85 85
 		// Return if no result or an error occurs
86
-		if(!$output->toBool()||!count($output->data)) return $output;
86
+		if (!$output->toBool() || !count($output->data)) return $output;
87 87
 
88 88
 		$oFileModel = getModel('file');
89 89
 
90
-		foreach($output->data as $key => $file)
90
+		foreach ($output->data as $key => $file)
91 91
 		{
92
-			if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
92
+			if ($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
93 93
 			else $file->isCarted = false;
94 94
 
95 95
 			$file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	function getFilesCountByDate($date = '')
134 134
 	{
135
-		if($date) $args->regDate = date('Ymd', strtotime($date));
135
+		if ($date) $args->regDate = date('Ymd', strtotime($date));
136 136
 
137 137
 		$output = executeQuery('file.getFilesCount', $args);
138
-		if(!$output->toBool()) return 0;
138
+		if (!$output->toBool()) return 0;
139 139
 
140 140
 		return $output->data->count;
141 141
 	}
@@ -150,31 +150,31 @@  discard block
 block discarded – undo
150 150
 	function _makeSearchParam(&$obj, &$args)
151 151
 	{
152 152
 		// Search options
153
-		$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
154
-		$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
153
+		$search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target'));
154
+		$search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword'));
155 155
 
156
-		if($search_target && $search_keyword)
156
+		if ($search_target && $search_keyword)
157 157
 		{
158
-			switch($search_target)
158
+			switch ($search_target)
159 159
 			{
160 160
 				case 'filename' :
161
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
161
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
162 162
 					$args->s_filename = $search_keyword;
163 163
 					break;
164 164
 				case 'filesize_more' :
165
-					$args->s_filesize_more = (int)$search_keyword;
165
+					$args->s_filesize_more = (int) $search_keyword;
166 166
 					break;
167 167
 				case 'filesize_mega_more' :
168
-					$args->s_filesize_more = (int)$search_keyword * 1024 * 1024;
168
+					$args->s_filesize_more = (int) $search_keyword * 1024 * 1024;
169 169
 					break;
170 170
 				case 'filesize_less' :
171
-					$args->s_filesize_less = (int)$search_keyword;
171
+					$args->s_filesize_less = (int) $search_keyword;
172 172
 					break;
173 173
 				case 'filesize_mega_less' :
174
-					$args->s_filesize_less = (int)$search_keyword * 1024 * 1024;
174
+					$args->s_filesize_less = (int) $search_keyword * 1024 * 1024;
175 175
 					break;
176 176
 				case 'download_count' :
177
-					$args->s_download_count = (int)$search_keyword;
177
+					$args->s_download_count = (int) $search_keyword;
178 178
 					break;
179 179
 				case 'regdate' :
180 180
 					$args->s_regdate = $search_keyword;
Please login to merge, or discard this patch.
Braces   +27 added lines, -10 removed lines patch added patch discarded remove patch
@@ -68,11 +68,17 @@  discard block
 block discarded – undo
68 68
 		$this->_makeSearchParam($obj, $args);
69 69
 
70 70
 		// Set valid/invalid state
71
-		if($obj->isvalid == 'Y') $args->isvalid = 'Y';
72
-		elseif($obj->isvalid == 'N') $args->isvalid = 'N';
71
+		if($obj->isvalid == 'Y') {
72
+			$args->isvalid = 'Y';
73
+		} elseif($obj->isvalid == 'N') {
74
+			$args->isvalid = 'N';
75
+		}
73 76
 		// Set multimedia/common file
74
-		if($obj->direct_download == 'Y') $args->direct_download = 'Y';
75
-		elseif($obj->direct_download == 'N') $args->direct_download= 'N';
77
+		if($obj->direct_download == 'Y') {
78
+			$args->direct_download = 'Y';
79
+		} elseif($obj->direct_download == 'N') {
80
+			$args->direct_download= 'N';
81
+		}
76 82
 		// Set variables
77 83
 		$args->sort_index = $obj->sort_index;
78 84
 		$args->page = $obj->page?$obj->page:1;
@@ -83,14 +89,19 @@  discard block
 block discarded – undo
83 89
 		// Execute the file.getFileList query
84 90
 		$output = executeQuery('file.getFileList', $args, $columnList);
85 91
 		// Return if no result or an error occurs
86
-		if(!$output->toBool()||!count($output->data)) return $output;
92
+		if(!$output->toBool()||!count($output->data)) {
93
+			return $output;
94
+		}
87 95
 
88 96
 		$oFileModel = getModel('file');
89 97
 
90 98
 		foreach($output->data as $key => $file)
91 99
 		{
92
-			if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
93
-			else $file->isCarted = false;
100
+			if($_SESSION['file_management'][$file->file_srl]) {
101
+				$file->isCarted = true;
102
+			} else {
103
+				$file->isCarted = false;
104
+			}
94 105
 
95 106
 			$file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl);
96 107
 			$output->data[$key] = $file;
@@ -132,10 +143,14 @@  discard block
 block discarded – undo
132 143
 	 */
133 144
 	function getFilesCountByDate($date = '')
134 145
 	{
135
-		if($date) $args->regDate = date('Ymd', strtotime($date));
146
+		if($date) {
147
+			$args->regDate = date('Ymd', strtotime($date));
148
+		}
136 149
 
137 150
 		$output = executeQuery('file.getFilesCount', $args);
138
-		if(!$output->toBool()) return 0;
151
+		if(!$output->toBool()) {
152
+			return 0;
153
+		}
139 154
 
140 155
 		return $output->data->count;
141 156
 	}
@@ -158,7 +173,9 @@  discard block
 block discarded – undo
158 173
 			switch($search_target)
159 174
 			{
160 175
 				case 'filename' :
161
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
176
+					if($search_keyword) {
177
+						$search_keyword = str_replace(' ','%',$search_keyword);
178
+					}
162 179
 					$args->s_filename = $search_keyword;
163 180
 					break;
164 181
 				case 'filesize_more' :
Please login to merge, or discard this patch.