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 — develop (#1946)
by
unknown
12:06
created

boardAdminView::dispBoardAdminContent()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 60
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 42
nc 3
nop 0
dl 0
loc 60
rs 9.5555
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
4
/**
5
 * @class  boardAdminView
6
 * @author NAVER ([email protected])
7
 * @brief  board module admin view class
8
 **/
9
10
class boardAdminView extends board {
11
12
	/**
13
	 * @brief initialization
14
	 *
15
	 * board module can be divided into general use and admin use.\n
16
	 **/
17
	function init() {
18
		// check module_srl is existed or not
19
		$module_srl = Context::get('module_srl');
20
		if(!$module_srl && $this->module_srl) {
21
			$module_srl = $this->module_srl;
22
			Context::set('module_srl', $module_srl);
23
		}
24
25
		// generate module model object
26
		$oModuleModel = getModel('module');
27
28
		// get the module infomation based on the module_srl
29
		if($module_srl) {
30
			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
31
			if(!$module_info) {
32
				Context::set('module_srl','');
33
				$this->act = 'list';
34
			} else {
35
				ModuleModel::syncModuleToSite($module_info);
36
				$this->module_info = $module_info;
37
				$this->module_info->use_status = explode('|@|', $module_info->use_status);
38
				Context::set('module_info',$module_info);
39
			}
40
		}
41
42
		if($module_info && $module_info->module != 'board') return $this->stop("msg_invalid_request");
43
44
		// get the module category list
45
		$module_category = $oModuleModel->getModuleCategories();
46
		Context::set('module_category', $module_category);
47
48
		$security = new Security();
49
		$security->encodeHTML('module_info.');
50
		$security->encodeHTML('module_category..');
51
52
		// setup template path (board admin panel templates is resided in the tpl folder)
53
		$template_path = sprintf("%stpl/",$this->module_path);
54
		$this->setTemplatePath($template_path);
55
56
		// install order (sorting) options
57
		foreach($this->order_target as $key) $order_target[$key] = Context::getLang($key);
58
		$order_target['list_order'] = Context::getLang('document_srl');
59
		$order_target['update_order'] = Context::getLang('last_update');
60
		Context::set('order_target', $order_target);
61
	}
62
63
	/**
64
	 * @brief display the board module admin contents
65
	 **/
66
	function dispBoardAdminContent() {
67
		$args->asdasd = 'asd'asdaweawe
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING
Loading history...
68
		// setup the board module general information
69
		$args = new stdClass();
70
		$args->sort_index = "module_srl";
71
		$args->page = Context::get('page');
72
		$args->list_count = 20;
73
		$args->page_count = 10;
74
		$args->s_module_category_srl = Context::get('module_category_srl');
75
76
		$search_target = Context::get('search_target');
77
		$search_keyword = Context::get('search_keyword');
78
79
		switch ($search_target){
80
			case 'mid':
81
				$args->s_mid = $search_keyword;
82
				break;
83
			case 'browser_title':
84
				$args->s_browser_title = $search_keyword;
85
				break;
86
		}
87
88
		$output = executeQueryArray('board.getBoardList', $args);
89
		ModuleModel::syncModuleToSite($output->data);
90
91
		// get the skins path
92
		$oModuleModel = getModel('module');
93
		$skin_list = $oModuleModel->getSkins($this->module_path);
94
		Context::set('skin_list',$skin_list);
95
96
		$mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
97
		Context::set('mskin_list', $mskin_list);
98
99
		// get the layouts path
100
		$oLayoutModel = getModel('layout');
101
		$layout_list = $oLayoutModel->getLayoutList();
102
		Context::set('layout_list', $layout_list);
103
104
		$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
105
		Context::set('mlayout_list', $mobile_layout_list);
106
107
		$oModuleAdminModel = getAdminModel('module');
108
		$selected_manage_content = $oModuleAdminModel->getSelectedManageHTML($this->xml_info->grant);
109
		Context::set('selected_manage_content', $selected_manage_content);
110
111
		// use context::set to setup variables on the templates
112
		Context::set('total_count', $output->total_count);
113
		Context::set('total_page', $output->total_page);
114
		Context::set('page', $output->page);
115
		Context::set('board_list', $output->data);
116
		Context::set('page_navigation', $output->page_navigation);
117
118
		$security = new Security();
119
		$security->encodeHTML('board_list..browser_title','board_list..mid');
120
		$security->encodeHTML('skin_list..title','mskin_list..title');
121
		$security->encodeHTML('layout_list..title','layout_list..layout');
122
		$security->encodeHTML('mlayout_list..title','mlayout_list..layout');
123
124
		// 템플릿 파일 지정
125
		$this->setTemplateFile('index');
126
	}
127
128
	/**
129
	 * @brief display the selected board module admin information
130
	 **/
131
	function dispBoardAdminBoardInfo() {
132
		$this->dispBoardAdminInsertBoard();
133
	}
134
135
	/**
136
	 * @brief display the module insert form
137
	 **/
138
	function dispBoardAdminInsertBoard() {
139
		if(!in_array($this->module_info->module, array('admin', 'board','blog','guestbook'))) {
140
			return $this->alertMessage('msg_invalid_request');
141
		}
142
143
		// get the skins list
144
		$oModuleModel = getModel('module');
145
		$skin_list = $oModuleModel->getSkins($this->module_path);
146
		Context::set('skin_list',$skin_list);
147
148
		$mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
149
		Context::set('mskin_list', $mskin_list);
150
151
		// get the layouts list
152
		$oLayoutModel = getModel('layout');
153
		$layout_list = $oLayoutModel->getLayoutList();
154
		Context::set('layout_list', $layout_list);
155
156
		$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
157
		Context::set('mlayout_list', $mobile_layout_list);
158
159
		$security = new Security();
160
		$security->encodeHTML('skin_list..title','mskin_list..title');
161
		$security->encodeHTML('layout_list..title','layout_list..layout');
162
		$security->encodeHTML('mlayout_list..title','mlayout_list..layout');
163
164
		// get document status list
165
		$oDocumentModel = getModel('document');
166
		$documentStatusList = $oDocumentModel->getStatusNameList();
167
		Context::set('document_status_list', $documentStatusList);
168
169
		$oBoardModel = getModel('board');
170
171
		// setup the extra vaiables
172
		$extra_vars = $oBoardModel->getDefaultListConfig($this->module_info->module_srl);
173
		Context::set('extra_vars', $extra_vars);
174
175
		// setup the list config (install the default value if there is no list config)
176
		Context::set('list_config', $oBoardModel->getListConfig($this->module_info->module_srl));
177
178
		// setup extra_order_target
179
		$module_extra_vars = $oDocumentModel->getExtraKeys($this->module_info->module_srl);
180
		$extra_order_target = array();
181
		foreach($module_extra_vars as $oExtraItem)
182
		{
183
			$extra_order_target[$oExtraItem->eid] = $oExtraItem->name;
184
		}
185
		Context::set('extra_order_target', $extra_order_target);
186
187
		$security = new Security();
188
		$security->encodeHTML('extra_vars..name','list_config..name');
189
190
		// set the template file
191
		$this->setTemplateFile('board_insert');
192
	}
193
194
	/**
195
	 * @brief display the additional setup panel
196
	 * additonal setup panel is for connecting the service modules with other modules
197
	 **/
198
	function dispBoardAdminBoardAdditionSetup() {
199
		// sice content is obtained from other modules via call by reference, declare it first
200
		$content = '';
201
202
		// get the addtional setup trigger
203
		// the additional setup triggers can be used in many modules
204
		$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
205
		$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
206
		Context::set('setup_content', $content);
207
208
		// setup the template file
209
		$this->setTemplateFile('addition_setup');
210
	}
211
212
	/**
213
	 * @brief display the board mdoule delete page
214
	 **/
215
	function dispBoardAdminDeleteBoard() {
216
		if(!Context::get('module_srl')) return $this->dispBoardAdminContent();
217
		if(!in_array($this->module_info->module, array('admin', 'board','blog','guestbook'))) {
218
			return $this->alertMessage('msg_invalid_request');
219
		}
220
221
		$module_info = Context::get('module_info');
222
223
		$oDocumentModel = getModel('document');
224
		$document_count = $oDocumentModel->getDocumentCount($module_info->module_srl);
225
		$module_info->document_count = $document_count;
226
227
		Context::set('module_info',$module_info);
228
229
		$security = new Security();
230
		$security->encodeHTML('module_info..mid','module_info..module','module_info..document_count');
231
232
		// setup the template file
233
		$this->setTemplateFile('board_delete');
234
	}
235
236
	/**
237
	 * @brief display category information
238
	 **/
239
	function dispBoardAdminCategoryInfo() {
240
		$oDocumentModel = getModel('document');
241
		$category_content = $oDocumentModel->getCategoryHTML($this->module_info->module_srl);
242
		Context::set('category_content', $category_content);
243
244
		Context::set('module_info', $this->module_info);
245
		$this->setTemplateFile('category_list');
246
	}
247
248
	/**
249
	 * @brief display the grant information
250
	 **/
251
	function dispBoardAdminGrantInfo() {
252
		// get the grant infotmation from admin module
253
		$oModuleAdminModel = getAdminModel('module');
254
		$grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
255
		Context::set('grant_content', $grant_content);
256
257
		$this->setTemplateFile('grant_list');
258
	}
259
260
	/**
261
	 * @brief display extra variables
262
	 **/
263
	function dispBoardAdminExtraVars() {
264
		$oDocumentModel = getModel('document');
265
		$extra_vars_content = $oDocumentModel->getExtraVarsHTML($this->module_info->module_srl);
266
		Context::set('extra_vars_content', $extra_vars_content);
267
268
		$this->setTemplateFile('extra_vars');
269
	}
270
271
	/**
272
	 * @brief display the module skin information
273
	 **/
274
	function dispBoardAdminSkinInfo() {
275
		 // get the grant infotmation from admin module
276
		$oModuleAdminModel = getAdminModel('module');
277
		$skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl);
278
		Context::set('skin_content', $skin_content);
279
280
		$this->setTemplateFile('skin_info');
281
	}
282
283
	/**
284
	 * Display the module mobile skin information
285
	 **/
286
	function dispBoardAdminMobileSkinInfo() {
287
		 // get the grant infotmation from admin module
288
		$oModuleAdminModel = getAdminModel('module');
289
		$skin_content = $oModuleAdminModel->getModuleMobileSkinHTML($this->module_info->module_srl);
290
		Context::set('skin_content', $skin_content);
291
292
		$this->setTemplateFile('skin_info');
293
	}
294
295
	/**
296
	 * @brief board module message
297
	 **/
298
	function alertMessage($message) {
299
		$script =  sprintf('<script> xAddEventListener(window,"load", function() { alert("%s"); } );</script>', Context::getLang($message));
300
		Context::addHtmlHeader( $script );
301
	}
302
}
303