1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
/** |
4
|
|
|
* @class memberView |
5
|
|
|
* @author NAVER ([email protected]) |
6
|
|
|
* @brief View class of member module |
7
|
|
|
*/ |
8
|
|
|
class memberView extends member |
9
|
|
|
{ |
10
|
|
|
var $group_list = NULL; // /< Group list information |
11
|
|
|
var $member_info = NULL; // /< Member information of the user |
12
|
|
|
var $skin = 'default'; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @brief Initialization |
16
|
|
|
*/ |
17
|
|
|
function init() |
18
|
|
|
{ |
19
|
|
|
// Get the member configuration |
20
|
|
|
$oMemberModel = getModel('member'); |
21
|
|
|
$this->member_config = $oMemberModel->getMemberConfig(); |
|
|
|
|
22
|
|
|
Context::set('member_config', $this->member_config); |
23
|
|
|
$oSecurity = new Security(); |
24
|
|
|
$oSecurity->encodeHTML('member_config.signupForm..'); |
25
|
|
|
|
26
|
|
|
$skin = $this->member_config->skin; |
27
|
|
|
// Set the template path |
28
|
|
|
if(!$skin) |
29
|
|
|
{ |
30
|
|
|
$skin = 'default'; |
31
|
|
|
$template_path = sprintf('%sskins/%s', $this->module_path, $skin); |
32
|
|
|
} |
33
|
|
|
else |
34
|
|
|
{ |
35
|
|
|
//check theme |
36
|
|
|
$config_parse = explode('|@|', $skin); |
37
|
|
|
if (count($config_parse) > 1) |
38
|
|
|
{ |
39
|
|
|
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]); |
40
|
|
|
} |
41
|
|
|
else |
42
|
|
|
{ |
43
|
|
|
$template_path = sprintf('%sskins/%s', $this->module_path, $skin); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
// Template path |
47
|
|
|
$this->setTemplatePath($template_path); |
48
|
|
|
|
49
|
|
|
$oLayoutModel = getModel('layout'); |
50
|
|
|
$layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl); |
|
|
|
|
51
|
|
|
if($layout_info) |
52
|
|
|
{ |
53
|
|
|
$this->module_info->layout_srl = $this->member_config->layout_srl; |
54
|
|
|
$this->setLayoutPath($layout_info->path); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @brief Display member information |
60
|
|
|
*/ |
61
|
|
|
function dispMemberInfo() |
62
|
|
|
{ |
63
|
|
|
$oMemberModel = getModel('member'); |
64
|
|
|
$logged_info = Context::get('logged_info'); |
65
|
|
|
// Don't display member info to non-logged user |
66
|
|
|
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted'); |
67
|
|
|
|
68
|
|
|
$member_srl = Context::get('member_srl'); |
69
|
|
|
if(!$member_srl && Context::get('is_logged')) |
70
|
|
|
{ |
71
|
|
|
$member_srl = $logged_info->member_srl; |
72
|
|
|
} |
73
|
|
|
elseif(!$member_srl) |
74
|
|
|
{ |
75
|
|
|
return $this->dispMemberSignUpForm(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
$site_module_info = Context::get('site_module_info'); |
79
|
|
|
$columnList = array('member_srl', 'user_id', 'email_address', 'user_name', 'nick_name', 'homepage', 'blog', 'birthday', 'regdate', 'last_login', 'extra_vars'); |
80
|
|
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, $site_module_info->site_srl, $columnList); |
81
|
|
|
unset($member_info->password); |
82
|
|
|
unset($member_info->email_id); |
83
|
|
|
unset($member_info->email_host); |
84
|
|
|
|
85
|
|
|
if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) |
86
|
|
|
{ |
87
|
|
|
$start = strpos($member_info->email_address, '@')+1; |
88
|
|
|
$replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start)); |
89
|
|
|
$member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
if(!$member_info->member_srl) return $this->dispMemberSignUpForm(); |
93
|
|
|
|
94
|
|
|
Context::set('memberInfo', get_object_vars($member_info)); |
95
|
|
|
|
96
|
|
|
$extendForm = $oMemberModel->getCombineJoinForm($member_info); |
97
|
|
|
unset($extendForm->find_member_account); |
98
|
|
|
unset($extendForm->find_member_answer); |
99
|
|
|
Context::set('extend_form_list', $extendForm); |
100
|
|
|
|
101
|
|
|
$this->_getDisplayedMemberInfo($member_info, $extendForm, $this->member_config); |
102
|
|
|
|
103
|
|
|
$this->setTemplateFile('member_info'); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
function _getDisplayedMemberInfo($memberInfo, $extendFormInfo, $memberConfig) |
107
|
|
|
{ |
108
|
|
|
$logged_info = Context::get('logged_info'); |
109
|
|
|
$displayDatas = array(); |
110
|
|
|
foreach($memberConfig->signupForm as $no=>$formInfo) |
111
|
|
|
{ |
112
|
|
|
if(!$formInfo->isUse) |
113
|
|
|
{ |
114
|
|
|
continue; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
if($formInfo->name == 'password' || $formInfo->name == 'find_account_question') |
118
|
|
|
{ |
119
|
|
|
continue; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
if($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y') |
123
|
|
|
{ |
124
|
|
|
continue; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
$item = $formInfo; |
128
|
|
|
|
129
|
|
|
if($formInfo->isDefaultForm) |
130
|
|
|
{ |
131
|
|
|
$item->title = Context::getLang($formInfo->name); |
132
|
|
|
$item->value = $memberInfo->{$formInfo->name}; |
133
|
|
|
|
134
|
|
|
if($formInfo->name == 'profile_image' && $memberInfo->profile_image) |
135
|
|
|
{ |
136
|
|
|
$target = $memberInfo->profile_image; |
137
|
|
|
$item->value = '<img src="'.$target->src.'" />'; |
138
|
|
|
} |
139
|
|
View Code Duplication |
elseif($formInfo->name == 'image_name' && $memberInfo->image_name) |
140
|
|
|
{ |
141
|
|
|
$target = $memberInfo->image_name; |
142
|
|
|
$item->value = '<img src="'.$target->src.'" />'; |
143
|
|
|
} |
144
|
|
View Code Duplication |
elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
145
|
|
|
{ |
146
|
|
|
$target = $memberInfo->image_mark; |
147
|
|
|
$item->value = '<img src="'.$target->src.'" />'; |
148
|
|
|
} |
149
|
|
|
elseif($formInfo->name == 'birthday' && $memberInfo->birthday) |
150
|
|
|
{ |
151
|
|
|
$item->value = zdate($item->value, 'Y-m-d'); |
152
|
|
|
} |
153
|
|
|
} |
154
|
|
|
else |
155
|
|
|
{ |
156
|
|
|
$item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title; |
157
|
|
|
$orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value; |
158
|
|
|
if($formInfo->type=='tel' && is_array($orgValue)) |
159
|
|
|
{ |
160
|
|
|
$item->value = implode('-', $orgValue); |
161
|
|
|
} |
162
|
|
View Code Duplication |
elseif($formInfo->type=='kr_zip' && is_array($orgValue)) |
163
|
|
|
{ |
164
|
|
|
$item->value = implode(' ', $orgValue); |
165
|
|
|
} |
166
|
|
View Code Duplication |
elseif($formInfo->type=='checkbox' && is_array($orgValue)) |
167
|
|
|
{ |
168
|
|
|
$item->value = implode(", ",$orgValue); |
169
|
|
|
} |
170
|
|
|
elseif($formInfo->type=='date') |
171
|
|
|
{ |
172
|
|
|
$item->value = zdate($orgValue, "Y-m-d"); |
173
|
|
|
} |
174
|
|
|
else |
175
|
|
|
{ |
176
|
|
|
$item->value = nl2br($orgValue); |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
$displayDatas[] = $item; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
Context::set('displayDatas', $displayDatas); |
184
|
|
|
$oSecurity = new Security(); |
185
|
|
|
$oSecurity->encodeHTML('displayDatas..title', 'displayDatas..description'); |
186
|
|
|
return $displayDatas; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @brief Display member join form |
191
|
|
|
*/ |
192
|
|
|
function dispMemberSignUpForm() |
193
|
|
|
{ |
194
|
|
|
//setcookie for redirect url in case of going to member sign up |
195
|
|
|
setcookie("XE_REDIRECT_URL", $_SERVER['HTTP_REFERER']); |
196
|
|
|
|
197
|
|
|
$member_config = $this->member_config; |
198
|
|
|
|
199
|
|
|
$oMemberModel = getModel('member'); |
200
|
|
|
// Get the member information if logged-in |
201
|
|
|
if($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); |
202
|
|
|
// call a trigger (before) |
203
|
|
|
$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); |
204
|
|
|
if(!$trigger_output->toBool()) return $trigger_output; |
205
|
|
|
// Error appears if the member is not allowed to join |
206
|
|
|
if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
207
|
|
|
|
208
|
|
|
$oMemberAdminView = getAdminView('member'); |
209
|
|
|
$formTags = $oMemberAdminView->_getMemberInputTag($member_info); |
|
|
|
|
210
|
|
|
Context::set('formTags', $formTags); |
211
|
|
|
|
212
|
|
|
global $lang; |
213
|
|
|
$identifierForm = new stdClass(); |
214
|
|
|
$identifierForm->title = $lang->{$member_config->identifier}; |
215
|
|
|
$identifierForm->name = $member_config->identifier; |
216
|
|
|
$identifierForm->value = $member_info->{$member_config->identifier}; |
217
|
|
|
Context::set('identifierForm', $identifierForm); |
218
|
|
|
|
219
|
|
|
$this->addExtraFormValidatorMessage(); |
220
|
|
|
|
221
|
|
|
// Set a template file |
222
|
|
|
$this->setTemplateFile('signup_form'); |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
function dispMemberModifyInfoBefore() |
226
|
|
|
{ |
227
|
|
|
$logged_info = Context::get('logged_info'); |
228
|
|
|
$oMemberModel = getModel('member'); |
229
|
|
|
if(!$oMemberModel->isLogged() || empty($logged_info)) |
230
|
|
|
{ |
231
|
|
|
return $this->stop('msg_not_logged'); |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
$_SESSION['rechecked_password_step'] = 'INPUT_PASSWORD'; |
235
|
|
|
|
236
|
|
|
$templateFile = $this->getTemplatePath().'rechecked_password.html'; |
237
|
|
|
if(!is_readable($templateFile)) |
238
|
|
|
{ |
239
|
|
|
$templatePath = sprintf('%sskins/default', $this->module_path); |
240
|
|
|
$this->setTemplatePath($templatePath); |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
if ($this->member_config->identifier == 'email_address') |
244
|
|
|
{ |
245
|
|
|
Context::set('identifierTitle', Context::getLang('email_address')); |
246
|
|
|
Context::set('identifierValue', $logged_info->email_address); |
247
|
|
|
} |
248
|
|
|
else |
249
|
|
|
{ |
250
|
|
|
Context::set('identifierTitle', Context::getLang('user_id')); |
251
|
|
|
Context::set('identifierValue', $logged_info->user_id); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
$this->setTemplateFile('rechecked_password'); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @brief Modify member information |
259
|
|
|
*/ |
260
|
|
|
function dispMemberModifyInfo() |
261
|
|
|
{ |
262
|
|
|
if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
263
|
|
|
{ |
264
|
|
|
$this->dispMemberModifyInfoBefore(); |
265
|
|
|
return; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
$_SESSION['rechecked_password_step'] = 'INPUT_DATA'; |
269
|
|
|
|
270
|
|
|
$member_config = $this->member_config; |
271
|
|
|
|
272
|
|
|
$oMemberModel = getModel('member'); |
273
|
|
|
// A message appears if the user is not logged-in |
274
|
|
|
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
275
|
|
|
|
276
|
|
|
$logged_info = Context::get('logged_info'); |
277
|
|
|
$member_srl = $logged_info->member_srl; |
278
|
|
|
|
279
|
|
|
$columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address', 'find_account_answer', 'homepage', 'blog', 'birthday', 'allow_mailing'); |
280
|
|
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
281
|
|
|
$member_info->signature = $oMemberModel->getSignature($member_srl); |
282
|
|
|
Context::set('member_info',$member_info); |
283
|
|
|
|
284
|
|
|
// Get a list of extend join form |
285
|
|
|
Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info)); |
286
|
|
|
|
287
|
|
|
// Editor of the module set for signing by calling getEditor |
288
|
|
|
if($member_info->member_srl) |
289
|
|
|
{ |
290
|
|
|
$oEditorModel = getModel('editor'); |
291
|
|
|
$option = new stdClass(); |
292
|
|
|
$option->primary_key_name = 'member_srl'; |
293
|
|
|
$option->content_key_name = 'signature'; |
294
|
|
|
$option->allow_fileupload = false; |
295
|
|
|
$option->enable_autosave = false; |
296
|
|
|
$option->enable_default_component = true; |
297
|
|
|
$option->enable_component = false; |
298
|
|
|
$option->resizable = false; |
299
|
|
|
$option->disable_html = true; |
300
|
|
|
$option->height = 200; |
301
|
|
|
$option->skin = $member_config->signature_editor_skin; |
302
|
|
|
$option->colorset = $member_config->sel_editor_colorset; |
303
|
|
|
$editor = $oEditorModel->getEditor($member_info->member_srl, $option); |
304
|
|
|
Context::set('editor', $editor); |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
$this->member_info = $member_info; |
308
|
|
|
|
309
|
|
|
$oMemberAdminView = getAdminView('member'); |
310
|
|
|
$formTags = $oMemberAdminView->_getMemberInputTag($member_info); |
311
|
|
|
Context::set('formTags', $formTags); |
312
|
|
|
|
313
|
|
|
global $lang; |
314
|
|
|
$identifierForm = new stdClass(); |
315
|
|
|
$identifierForm->title = $lang->{$member_config->identifier}; |
316
|
|
|
$identifierForm->name = $member_config->identifier; |
317
|
|
|
$identifierForm->value = $member_info->{$member_config->identifier}; |
318
|
|
|
Context::set('identifierForm', $identifierForm); |
319
|
|
|
|
320
|
|
|
$this->addExtraFormValidatorMessage(); |
321
|
|
|
|
322
|
|
|
// Set a template file |
323
|
|
|
$this->setTemplateFile('modify_info'); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* @brief Display documents written by the member |
328
|
|
|
*/ |
329
|
|
|
function dispMemberOwnDocument() |
330
|
|
|
{ |
331
|
|
|
$oMemberModel = getModel('member'); |
332
|
|
|
// A message appears if the user is not logged-in |
333
|
|
|
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
334
|
|
|
|
335
|
|
|
$logged_info = Context::get('logged_info'); |
336
|
|
|
$member_srl = $logged_info->member_srl; |
337
|
|
|
|
338
|
|
|
$module_srl = Context::get('module_srl'); |
339
|
|
|
Context::set('module_srl',Context::get('selected_module_srl')); |
340
|
|
|
Context::set('search_target','member_srls'); |
341
|
|
|
Context::set('search_keyword', implode(',', array($member_srl, $member_srl * -1))); |
342
|
|
|
|
343
|
|
|
|
344
|
|
|
$oDocumentAdminView = getAdminView('document'); |
345
|
|
|
$oDocumentAdminView->dispDocumentAdminList(); |
346
|
|
|
|
347
|
|
|
$oSecurity = new Security(); |
348
|
|
|
$oSecurity->encodeHTML('document_list...title', 'search_target', 'search_keyword'); |
349
|
|
|
|
350
|
|
|
Context::set('module_srl', $module_srl); |
351
|
|
|
$this->setTemplateFile('document_list'); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* @brief Display documents scrapped by the member |
356
|
|
|
*/ |
357
|
|
View Code Duplication |
function dispMemberScrappedDocument() |
|
|
|
|
358
|
|
|
{ |
359
|
|
|
$oMemberModel = getModel('member'); |
360
|
|
|
// A message appears if the user is not logged-in |
361
|
|
|
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
362
|
|
|
|
363
|
|
|
$logged_info = Context::get('logged_info'); |
364
|
|
|
$args = new stdClass(); |
365
|
|
|
$args->member_srl = $logged_info->member_srl; |
366
|
|
|
$args->page = (int)Context::get('page'); |
367
|
|
|
|
368
|
|
|
$output = executeQuery('member.getScrapDocumentList', $args); |
369
|
|
|
Context::set('total_count', $output->total_count); |
370
|
|
|
Context::set('total_page', $output->total_page); |
371
|
|
|
Context::set('page', $output->page); |
372
|
|
|
Context::set('document_list', $output->data); |
373
|
|
|
Context::set('page_navigation', $output->page_navigation); |
374
|
|
|
|
375
|
|
|
$security = new Security($output->data); |
376
|
|
|
$security->encodeHTML('..nick_name'); |
377
|
|
|
|
378
|
|
|
$this->setTemplateFile('scrapped_list'); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* @brief Display documents saved by the member |
383
|
|
|
*/ |
384
|
|
View Code Duplication |
function dispMemberSavedDocument() |
|
|
|
|
385
|
|
|
{ |
386
|
|
|
$oMemberModel = getModel('member'); |
387
|
|
|
// A message appears if the user is not logged-in |
388
|
|
|
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
389
|
|
|
// Get the saved document(module_srl is set to member_srl instead) |
390
|
|
|
$logged_info = Context::get('logged_info'); |
391
|
|
|
$args = new stdClass(); |
392
|
|
|
$args->member_srl = $logged_info->member_srl; |
393
|
|
|
$args->page = (int)Context::get('page'); |
394
|
|
|
$args->statusList = array('TEMP'); |
395
|
|
|
|
396
|
|
|
$oDocumentModel = getModel('document'); |
397
|
|
|
$output = $oDocumentModel->getDocumentList($args, true); |
398
|
|
|
Context::set('total_count', $output->total_count); |
399
|
|
|
Context::set('total_page', $output->total_page); |
400
|
|
|
Context::set('page', $output->page); |
401
|
|
|
Context::set('document_list', $output->data); |
402
|
|
|
Context::set('page_navigation', $output->page_navigation); |
403
|
|
|
|
404
|
|
|
$this->setTemplateFile('saved_list'); |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @brief Display the login form |
409
|
|
|
*/ |
410
|
|
|
function dispMemberLoginForm() |
411
|
|
|
{ |
412
|
|
|
if(Context::get('is_logged')) |
413
|
|
|
{ |
414
|
|
|
Context::set('redirect_url', getNotEncodedUrl('act','')); |
415
|
|
|
$this->setTemplatePath($this->module_path.'tpl'); |
416
|
|
|
$this->setTemplateFile('redirect.html'); |
417
|
|
|
return; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
// get member module configuration. |
421
|
|
|
$oMemberModel = getModel('member'); |
|
|
|
|
422
|
|
|
$config = $this->member_config; |
423
|
|
|
Context::set('identifier', $config->identifier); |
424
|
|
|
|
425
|
|
|
$XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE'); |
426
|
|
|
$XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR'); |
427
|
|
|
if($XE_VALIDATOR_ERROR == -11) |
428
|
|
|
Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description); |
429
|
|
|
|
430
|
|
|
if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) |
431
|
|
|
Context::set('referer_url', getUrl('')); |
432
|
|
|
else |
433
|
|
|
Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
434
|
|
|
|
435
|
|
|
// Set a template file |
436
|
|
|
$this->setTemplateFile('login_form'); |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* @brief Change the user password |
441
|
|
|
*/ |
442
|
|
|
function dispMemberModifyPassword() |
443
|
|
|
{ |
444
|
|
|
$oMemberModel = getModel('member'); |
445
|
|
|
// A message appears if the user is not logged-in |
446
|
|
|
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
447
|
|
|
|
448
|
|
|
$memberConfig = $this->member_config; |
449
|
|
|
|
450
|
|
|
$logged_info = Context::get('logged_info'); |
451
|
|
|
$member_srl = $logged_info->member_srl; |
452
|
|
|
|
453
|
|
|
$columnList = array('member_srl', 'user_id'); |
454
|
|
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
455
|
|
|
Context::set('member_info',$member_info); |
456
|
|
|
|
457
|
|
View Code Duplication |
if($memberConfig->identifier == 'user_id') |
458
|
|
|
{ |
459
|
|
|
Context::set('identifier', 'user_id'); |
460
|
|
|
Context::set('formValue', $member_info->user_id); |
461
|
|
|
} |
462
|
|
|
else |
463
|
|
|
{ |
464
|
|
|
Context::set('identifier', 'email_address'); |
465
|
|
|
Context::set('formValue', $member_info->email_address); |
466
|
|
|
} |
467
|
|
|
// Set a template file |
468
|
|
|
$this->setTemplateFile('modify_password'); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @brief Member withdrawl |
473
|
|
|
*/ |
474
|
|
|
function dispMemberLeave() |
475
|
|
|
{ |
476
|
|
|
$oMemberModel = getModel('member'); |
477
|
|
|
// A message appears if the user is not logged-in |
478
|
|
|
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
479
|
|
|
|
480
|
|
|
$memberConfig = $this->member_config; |
481
|
|
|
|
482
|
|
|
$logged_info = Context::get('logged_info'); |
483
|
|
|
$member_srl = $logged_info->member_srl; |
484
|
|
|
|
485
|
|
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
486
|
|
|
Context::set('member_info',$member_info); |
487
|
|
|
|
488
|
|
View Code Duplication |
if($memberConfig->identifier == 'user_id') |
489
|
|
|
{ |
490
|
|
|
Context::set('identifier', 'user_id'); |
491
|
|
|
Context::set('formValue', $member_info->user_id); |
492
|
|
|
} |
493
|
|
|
else |
494
|
|
|
{ |
495
|
|
|
Context::set('identifier', 'email_address'); |
496
|
|
|
Context::set('formValue', $member_info->email_address); |
497
|
|
|
} |
498
|
|
|
// Set a template file |
499
|
|
|
$this->setTemplateFile('leave_form'); |
500
|
|
|
} |
501
|
|
|
|
502
|
|
|
/** |
503
|
|
|
* @brief Member log-out |
504
|
|
|
*/ |
505
|
|
|
function dispMemberLogout() |
506
|
|
|
{ |
507
|
|
|
$oMemberController = getController('member'); |
508
|
|
|
$output = $oMemberController->procMemberLogout(); |
509
|
|
|
if(!$output->redirect_url) |
510
|
|
|
$this->setRedirectUrl(getNotEncodedUrl('act', '')); |
511
|
|
|
else |
512
|
|
|
$this->setRedirectUrl($output->redirect_url); |
513
|
|
|
|
514
|
|
|
return; |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* @brief Display a list of saved articles |
519
|
|
|
* @Deplicated - instead Document View - dispTempSavedList method use |
520
|
|
|
*/ |
521
|
|
|
function dispSavedDocumentList() |
522
|
|
|
{ |
523
|
|
|
return new BaseObject(0, 'Deplicated method'); |
524
|
|
|
} |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* @brief Find user ID and password |
528
|
|
|
*/ |
529
|
|
|
function dispMemberFindAccount() |
530
|
|
|
{ |
531
|
|
|
if(Context::get('is_logged')) return $this->stop('already_logged'); |
532
|
|
|
|
533
|
|
|
$config = $this->member_config; |
534
|
|
|
|
535
|
|
|
Context::set('identifier', $config->identifier); |
536
|
|
|
|
537
|
|
|
$this->setTemplateFile('find_member_account'); |
538
|
|
|
} |
539
|
|
|
|
540
|
|
|
/** |
541
|
|
|
* @brief Generate a temporary password |
542
|
|
|
*/ |
543
|
|
|
function dispMemberGetTempPassword() |
544
|
|
|
{ |
545
|
|
|
if(Context::get('is_logged')) return $this->stop('already_logged'); |
546
|
|
|
|
547
|
|
|
$user_id = Context::get('user_id'); |
548
|
|
|
$temp_password = $_SESSION['xe_temp_password_'.$user_id]; |
549
|
|
|
unset($_SESSION['xe_temp_password_'.$user_id]); |
550
|
|
|
|
551
|
|
|
if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request'); |
552
|
|
|
|
553
|
|
|
Context::set('temp_password', $temp_password); |
554
|
|
|
|
555
|
|
|
$this->setTemplateFile('find_temp_password'); |
556
|
|
|
} |
557
|
|
|
|
558
|
|
|
/** |
559
|
|
|
* @brief Page of re-sending an authentication mail |
560
|
|
|
*/ |
561
|
|
|
function dispMemberResendAuthMail() |
562
|
|
|
{ |
563
|
|
|
$authMemberSrl = $_SESSION['auth_member_srl']; |
564
|
|
|
unset($_SESSION['auth_member_srl']); |
565
|
|
|
|
566
|
|
|
if(Context::get('is_logged')) |
567
|
|
|
{ |
568
|
|
|
return $this->stop('already_logged'); |
569
|
|
|
} |
570
|
|
|
|
571
|
|
|
if($authMemberSrl) |
572
|
|
|
{ |
573
|
|
|
$oMemberModel = getModel('member'); |
574
|
|
|
$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($authMemberSrl); |
575
|
|
|
|
576
|
|
|
$_SESSION['auth_member_info'] = $memberInfo; |
577
|
|
|
Context::set('memberInfo', $memberInfo); |
578
|
|
|
$this->setTemplateFile('reset_mail'); |
579
|
|
|
} |
580
|
|
|
else |
581
|
|
|
{ |
582
|
|
|
$this->setTemplateFile('resend_auth_mail'); |
583
|
|
|
} |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
function dispMemberModifyEmailAddress() |
587
|
|
|
{ |
588
|
|
|
if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
589
|
|
|
{ |
590
|
|
|
Context::set('success_return_url', getUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyEmailAddress')); |
591
|
|
|
$this->dispMemberModifyInfoBefore(); |
592
|
|
|
return; |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
$_SESSION['rechecked_password_step'] = 'INPUT_DATA'; |
596
|
|
|
|
597
|
|
|
$this->setTemplateFile('modify_email_address'); |
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
/** |
601
|
|
|
* Add javascript codes into the header by checking values of member join form, required and others |
602
|
|
|
* @return void |
603
|
|
|
*/ |
604
|
|
|
function addExtraFormValidatorMessage() |
605
|
|
|
{ |
606
|
|
|
$oMemberModel = getModel('member'); |
607
|
|
|
$extraList = $oMemberModel->getUsedJoinFormList(); |
608
|
|
|
|
609
|
|
|
$js_code = array(); |
610
|
|
|
$js_code[] = '<script>//<![CDATA['; |
611
|
|
|
$js_code[] = '(function($){'; |
612
|
|
|
$js_code[] = 'var validator = xe.getApp("validator")[0];'; |
613
|
|
|
$js_code[] = 'if(!validator) return false;'; |
614
|
|
|
|
615
|
|
|
$errorLang = array(); |
616
|
|
|
foreach($extraList as $val) |
617
|
|
|
{ |
618
|
|
|
$title = str_ireplace(array('<script', '</script'), array('<scr"+"ipt', '</scr"+"ipt'), addslashes($val->column_title)); |
619
|
|
|
if($val->column_type == 'kr_zip' || $val->column_type == 'tel') |
620
|
|
|
{ |
621
|
|
|
$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title); |
622
|
|
|
} |
623
|
|
|
else |
624
|
|
|
{ |
625
|
|
|
$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s","%s"]);', $val->column_name, $title); |
626
|
|
|
} |
627
|
|
|
$errorLang[$val->column_name] = $val->column_title; |
628
|
|
|
} |
629
|
|
|
$_SESSION['XE_VALIDATOR_ERROR_LANG'] = $errorLang; |
630
|
|
|
|
631
|
|
|
$js_code[] = '})(jQuery);'; |
632
|
|
|
$js_code[] = '//]]></script>'; |
633
|
|
|
$js_code = implode("\n", $js_code); |
634
|
|
|
|
635
|
|
|
Context::addHtmlHeader($js_code); |
636
|
|
|
} |
637
|
|
|
|
638
|
|
|
/** |
639
|
|
|
* Spammer manage popup |
640
|
|
|
* |
641
|
|
|
* @return void |
642
|
|
|
**/ |
643
|
|
|
function dispMemberSpammer() |
644
|
|
|
{ |
645
|
|
|
if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
646
|
|
|
|
647
|
|
|
$member_srl = Context::get('member_srl'); |
648
|
|
|
$module_srl = Context::get('module_srl'); |
649
|
|
|
|
650
|
|
|
// check grant |
651
|
|
|
$oModuleModel = getModel('module'); |
652
|
|
|
$columnList = array('module_srl', 'module'); |
653
|
|
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
654
|
|
|
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
655
|
|
|
|
656
|
|
|
if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
657
|
|
|
|
658
|
|
|
$oMemberModel = getModel('member'); |
659
|
|
|
|
660
|
|
|
Context::loadLang('modules/document/lang/'); |
661
|
|
|
Context::set('spammer_info', $oMemberModel->getMemberInfoByMemberSrl($member_srl)); |
662
|
|
|
Context::set('module_srl', $module_srl); |
663
|
|
|
|
664
|
|
|
// Select Pop-up layout |
665
|
|
|
$this->setLayoutPath('./common/tpl'); |
666
|
|
|
$this->setLayoutFile('popup_layout'); |
667
|
|
|
|
668
|
|
|
$this->setTemplatePath($this->module_path.'tpl'); |
669
|
|
|
$this->setTemplateFile('spammer'); |
670
|
|
|
} |
671
|
|
|
|
672
|
|
|
} |
673
|
|
|
/* End of file member.view.php */ |
674
|
|
|
/* Location: ./modules/member/member.view.php */ |
675
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: