mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Register spamfilter, tag, widget module triggers in module.xml
This commit is contained in:
parent
ad1241fbb5
commit
e81d0500eb
6 changed files with 43 additions and 158 deletions
|
|
@ -6,7 +6,7 @@
|
|||
<action name="dispSpamfilterAdminDeniedWordList" type="view" menu_name="spamFilter" />
|
||||
<action name="dispSpamfilterAdminConfigBlock" type="view" menu_name="spamFilter" />
|
||||
<action name="dispSpamfilterAdminConfigCaptcha" type="view" menu_name="spamFilter" />
|
||||
|
||||
|
||||
<action name="procSpamfilterAdminInsertDeniedIP" type="controller" />
|
||||
<action name="procSpamfilterAdminUpdateDeniedIP" type="controller" />
|
||||
<action name="procSpamfilterAdminDeleteDeniedIP" type="controller" />
|
||||
|
|
@ -16,6 +16,15 @@
|
|||
<action name="procSpamfilterAdminInsertConfig" type="controller" />
|
||||
<action name="procSpamfilterAdminInsertConfigCaptcha" type="controller" />
|
||||
</actions>
|
||||
<eventHandlers>
|
||||
<eventHandler before="document.insertDocument" class="controller" method="triggerInsertDocument" />
|
||||
<eventHandler before="document.updateDocument" class="controller" method="triggerInsertDocument" />
|
||||
<eventHandler before="document.manage" class="controller" method="triggerManageDocument" />
|
||||
<eventHandler before="comment.insertComment" class="controller" method="triggerInsertComment" />
|
||||
<eventHandler before="comment.updateComment" class="controller" method="triggerInsertComment" />
|
||||
<eventHandler before="communication.sendMessage" class="controller" method="triggerSendMessage" />
|
||||
<eventHandler before="moduleObject.proc" class="controller" method="triggerCheckCaptcha" />
|
||||
</eventHandlers>
|
||||
<menus>
|
||||
<menu name="spamFilter" tyle="super">
|
||||
<title xml:lang="en">Spam Filter</title>
|
||||
|
|
|
|||
|
|
@ -7,51 +7,12 @@
|
|||
*/
|
||||
class spamfilter extends ModuleObject
|
||||
{
|
||||
protected static $_insert_triggers = array(
|
||||
array('document.insertDocument', 'before', 'controller', 'triggerInsertDocument'),
|
||||
array('document.updateDocument', 'before', 'controller', 'triggerInsertDocument'),
|
||||
array('document.manage', 'before', 'controller', 'triggerManageDocument'),
|
||||
array('comment.insertComment', 'before', 'controller', 'triggerInsertComment'),
|
||||
array('comment.updateComment', 'before', 'controller', 'triggerInsertComment'),
|
||||
array('communication.sendMessage', 'before', 'controller', 'triggerSendMessage'),
|
||||
array('moduleObject.proc', 'before', 'controller', 'triggerCheckCaptcha'),
|
||||
);
|
||||
|
||||
protected static $_delete_triggers = array(
|
||||
array('trackback.insertTrackback', 'before', 'controller', 'triggerInsertTrackback'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Register all triggers.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function registerTriggers()
|
||||
{
|
||||
$oModuleController = getController('module');
|
||||
foreach (self::$_insert_triggers as $trigger)
|
||||
{
|
||||
if (!ModuleModel::getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||
{
|
||||
$oModuleController->insertTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]);
|
||||
}
|
||||
}
|
||||
foreach (self::$_delete_triggers as $trigger)
|
||||
{
|
||||
if (ModuleModel::getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||
{
|
||||
$oModuleController->deleteTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]);
|
||||
}
|
||||
}
|
||||
return new BaseObject(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Additional tasks required to accomplish during the installation
|
||||
*/
|
||||
public function moduleInstall()
|
||||
{
|
||||
return $this->registerTriggers();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,21 +20,6 @@ class spamfilter extends ModuleObject
|
|||
*/
|
||||
public function checkUpdate()
|
||||
{
|
||||
foreach (self::$_insert_triggers as $trigger)
|
||||
{
|
||||
if (!ModuleModel::getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
foreach (self::$_delete_triggers as $trigger)
|
||||
{
|
||||
if (ModuleModel::getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true;
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true;
|
||||
|
|
@ -100,12 +46,6 @@ class spamfilter extends ModuleObject
|
|||
*/
|
||||
public function moduleUpdate()
|
||||
{
|
||||
$output = $this->registerTriggers();
|
||||
if (!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit'))
|
||||
{
|
||||
|
|
@ -168,7 +108,7 @@ class spamfilter extends ModuleObject
|
|||
$config->captcha->type = 'none';
|
||||
}
|
||||
|
||||
$output = getController('module')->insertModuleConfig($this->module, $config);
|
||||
$output = ModuleController::getInstance()->insertModuleConfig($this->module, $config);
|
||||
if (!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
|
|
@ -176,14 +116,6 @@ class spamfilter extends ModuleObject
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
*/
|
||||
public function recompileCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Import configuration from reCAPTCHA addon.
|
||||
*/
|
||||
|
|
@ -223,7 +155,7 @@ class spamfilter extends ModuleObject
|
|||
}
|
||||
$output->target_modules_type = ($config->xe_run_method === 'run_selected') ? '+' : '-';
|
||||
|
||||
$oAddonAdminController = getAdminController('addon');
|
||||
$oAddonAdminController = AddonAdminController::getInstance();
|
||||
if ($output->target_devices['pc'])
|
||||
{
|
||||
$oAddonAdminController->doDeactivate('recaptcha', 0, 'pc');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue