1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* @class syndicationAdminController |
6
|
|
|
* @author NAVER ([email protected]) |
7
|
|
|
* @brief syndication module admin Controller class |
8
|
|
|
**/ |
9
|
|
|
|
10
|
|
|
class syndicationAdminController extends syndication { |
11
|
|
|
|
12
|
|
|
function init() |
13
|
|
|
{ |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
function procSyndicationAdminInsertConfig() |
17
|
|
|
{ |
18
|
|
|
$oModuleController = getController('module'); |
19
|
|
|
$oSyndicationController = getController('syndication'); |
|
|
|
|
20
|
|
|
$oSyndicationModel = getModel('syndication'); |
|
|
|
|
21
|
|
|
|
22
|
|
|
$config = new stdClass; |
23
|
|
|
$config->syndication_use = Context::get('syndication_use'); |
24
|
|
|
$config->site_url = preg_replace('/\/+$/is','',Context::get('site_url')); |
25
|
|
|
$config->year = Context::get('year'); |
26
|
|
|
$config->syndication_token = Context::get('syndication_token'); |
27
|
|
|
$config->syndication_password = urlencode(Context::get('syndication_password')); |
28
|
|
|
|
29
|
|
|
if(!$config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
30
|
|
|
if(!$config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
31
|
|
|
|
32
|
|
|
$oModuleController->updateModuleConfig('syndication',$config); |
33
|
|
|
|
34
|
|
|
$except_module = Context::get('except_module'); |
35
|
|
|
$output = executeQuery('syndication.deleteExceptModules'); |
36
|
|
|
if(!$output->toBool()) return $output; |
37
|
|
|
|
38
|
|
|
if ($except_module){ |
39
|
|
|
$modules = explode(',',$except_module); |
40
|
|
|
for($i=0,$c=count($modules);$i<$c;$i++) { |
41
|
|
|
$args->module_srl = $modules[$i]; |
|
|
|
|
42
|
|
|
$output = executeQuery('syndication.insertExceptModule',$args); |
43
|
|
|
if(!$output->toBool()) return $output; |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
if(!$this->checkOpenSSLSupport()) |
48
|
|
|
{ |
49
|
|
|
return $this->makeObject(-1, 'msg_need_openssl_support'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
$this->setMessage('success_applied'); |
53
|
|
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { |
54
|
|
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSyndicationAdminConfig'); |
55
|
|
|
$this->setRedirectUrl($returnUrl); |
56
|
|
|
return; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
function procSyndicationAdminCheckPingResult() |
61
|
|
|
{ |
62
|
|
|
$oModuleModel = getModel('module'); |
63
|
|
|
|
64
|
|
|
$oSyndicationController = getController('syndication'); |
65
|
|
|
$oSyndicationModel= getModel('syndication'); |
66
|
|
|
|
67
|
|
|
$module_config = $oModuleModel->getModuleConfig('syndication'); |
68
|
|
|
|
69
|
|
|
$site_url = trim(Context::get('site_url')); |
|
|
|
|
70
|
|
|
if(!$module_config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
71
|
|
|
if(!$module_config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
72
|
|
|
|
73
|
|
|
$id = $oSyndicationModel->getID('site'); |
74
|
|
|
|
75
|
|
|
// site_url 정보와 token 정보를 이용해서 ping 전송 테스트 |
76
|
|
|
if($oSyndicationController->ping($id, 'site')===FALSE) |
77
|
|
|
{ |
78
|
|
|
$this->setError(-1); |
79
|
|
|
$this->setMessage($oSyndicationController->ping_message); |
|
|
|
|
80
|
|
|
} |
81
|
|
|
else |
82
|
|
|
{ |
83
|
|
|
$this->setMessage('msg_success_ping_test'); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.