XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
spamfilter.admin.controller.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
9 {
13  function init()
14  {
15  }
16 
18  {
19  // Get the default information
20  $argsConfig = Context::gets('limits','check_trackback');
21  $flag = Context::get('flag');
22  //interval, limit_count
23  if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
24  if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
25  // Create and insert the module Controller object
27  $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
28  if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
29 
30  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
31  $this->setRedirectUrl($returnUrl);
32  }
33 
35  {
36  //스팸IP 추가
37  $ipaddress_list = Context::get('ipaddress_list');
38  $oSpamfilterController = getController('spamfilter');
39  if($ipaddress_list)
40  {
41  $output = $oSpamfilterController->insertIP($ipaddress_list);
42  if(!$output->toBool() && !$output->get('fail_list')) return $output;
43 
44  if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
45  $this->setMessage(Context::getLang('success_registed').$message_fail);
46  }
47 
48 
49  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
50  $this->setRedirectUrl($returnUrl);
51  }
52 
54  {
55  //스팸 키워드 추가
56  $word_list = Context::get('word_list');
57  if($word_list)
58  {
59  $output = $this->insertWord($word_list);
60  if(!$output->toBool() && !$output->get('fail_list')) return $output;
61 
62  if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
63  $this->setMessage(Context::getLang('success_registed').$message_fail);
64  }
65 
66  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
67  $this->setRedirectUrl($returnUrl);
68  }
69 
74  {
75  $ipAddressList = Context::get('ipaddress');
76  if($ipAddressList) $this->deleteIP($ipAddressList);
77 
78  $this->setMessage(Context::getLang('success_deleted'));
79 
80  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
81  return $this->setRedirectUrl($returnUrl);
82  }
83 
88  {
89  $wordList = Context::get('word');
90  $this->deleteWord($wordList);
91 
92  $this->setMessage(Context::getLang('success_deleted'));
93 
94  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
95  return $this->setRedirectUrl($returnUrl);
96  }
97 
102  function deleteIP($ipaddress)
103  {
104  if(!$ipaddress) return;
105 
106  $args = new stdClass;
107  $args->ipaddress = $ipaddress;
108  return executeQuery('spamfilter.deleteDeniedIP', $args);
109  }
110 
115  function insertWord($word_list)
116  {
117 
118  $word_list = str_replace("\r","",$word_list);
119  $word_list = explode("\n",$word_list);
120 
121  foreach($word_list as $word)
122  {
123  if(!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word))
124  {
125  return new BaseObject(-1, 'msg_invalid');
126  }
127  }
128 
129  $fail_word = '';
130  foreach($word_list as $word)
131  {
132  $args = new stdClass;
133  if(trim($word)) $args->word = $word;
134  $output = executeQuery('spamfilter.insertDeniedWord', $args);
135  if(!$output->toBool()) $fail_word .= $word.'<br />';
136  }
137  $output->add('fail_list',$fail_word);
138  return $output;
139  }
140 
145  function deleteWord($word)
146  {
147  if(!$word) return;
148  $args = new stdClass;
149  $args->word = $word;
150  return executeQuery('spamfilter.deleteDeniedWord', $args);
151  }
152 }
153 /* End of file spamfilter.admin.controller.php */
154 /* Location: ./modules/spamfilter/spamfilter.admin.controller.php */
setMessage($message= 'success', $type=NULL)
getController($module_name)
Definition: func.inc.php:90
$output
Definition: ko.install.php:193
procSpamfilterAdminDeleteDeniedWord()
Delete the prohibited Word.
The parent class of the spamfilter module.
getNotEncodedUrl()
Definition: func.inc.php:316
insertWord($word_list)
Register the spam word The post, which contains the newly registered spam word, should be considered ...
$args
Definition: ko.install.php:185
setRedirectUrl($url= './', $output=NULL)
deleteWord($word)
Remove the spam word Remove the word which was previously registered as a spam word.
procSpamfilterAdminDeleteDeniedIP()
Delete the banned IP.
getLang($code)
deleteIP($ipaddress)
Delete IP Remove the IP address which was previously registered as a spammers.
The admin controller class of the spamfilter module.
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
$oModuleController
Definition: ko.install.php:287