Esempio n. 1
0
 public static function getInstance()
 {
     if (!isset(self::$classInstance)) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Esempio n. 2
0
 public function process()
 {
     $service = WATCHDOG_BOL_WatchdogService::getInstance();
     $values = $this->getValues();
     $this->reset();
     $ip = $service->findWhiteIP($values['ip']);
     return $ip instanceof WATCHDOG_BOL_Ip ? array('result' => true, 'ip' => $ip) : array('result' => false);
 }
Esempio n. 3
0
function watchdog_after_route(OW_Event $event)
{
    $handlerAttributes = OW::getRequestHandler()->getHandlerAttributes();
    if ($handlerAttributes[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Join' && $handlerAttributes[OW_RequestHandler::ATTRS_KEY_ACTION] == 'index' || OW::getUser()->isAuthenticated() && !OW::getUser()->isAdmin()) {
        WATCHDOG_BOL_WatchdogService::getInstance()->checkRemoteIP();
        return;
    }
}
Esempio n. 4
0
 public function process()
 {
     $service = WATCHDOG_BOL_WatchdogService::getInstance();
     $values = $this->getValues();
     $this->reset();
     if ($service->findWhiteIP($values['ip']) instanceof WATCHDOG_BOL_Ip) {
         return array('result' => false);
     }
     $service->addNewWhiteIPAddr($values['ip']);
     return array('result' => true);
 }
Esempio n. 5
0
 public function updateDatabase()
 {
     WATCHDOG_BOL_WatchdogService::getInstance()->updateDatabaseFromStopForum();
 }
Esempio n. 6
0
}
if (!$config->configExists($pluginKey, WATCHDOG_BOL_WatchdogService::TIME_NEXT_UPDATE)) {
    $config->addConfig($pluginKey, WATCHDOG_BOL_WatchdogService::TIME_NEXT_UPDATE, strtotime('+1 day 00:00:00') + rand(1, 86400));
}
if (!$config->configExists($pluginKey, WATCHDOG_BOL_WatchdogService::TIME_RESET_SPAM_ATTEMPT)) {
    $config->addConfig($pluginKey, WATCHDOG_BOL_WatchdogService::TIME_RESET_SPAM_ATTEMPT, strtotime('+1 day 00:00:00'));
}
unset($config);
OW::getLanguage()->importPluginLangs($plugin->getRootDir() . 'langs.zip', $pluginKey, true);
$prefix = OW_DB_PREFIX;
/* ****************************** IP Black ist ****************************** */
$query = "\nCREATE TABLE IF NOT EXISTS `{$prefix}watchdog_black_list` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `ip` varchar(15) NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `ip` (`ip`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ";
OW::getDbo()->query($query);
$query = "\nCREATE TABLE IF NOT EXISTS `{$prefix}watchdog_white_list` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `ip` varchar(15) NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `ip` (`ip`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ";
OW::getDbo()->query($query);
$watchdogService = WATCHDOG_BOL_WatchdogService::getInstance();
copy($plugin->getStaticUrl() . WATCHDOG_BOL_WatchdogService::ZIP_IP_LIST, $plugin->getPluginFilesDir() . WATCHDOG_BOL_WatchdogService::ZIP_IP_LIST);
$enumIPBlackList = new WATCHDOG_BOL_EnumBlackList('IP_BLACKLIST');
$watchdogService->exctractFile($enumIPBlackList);
$watchdogService->insertFromStopForum($enumIPBlackList);
$watchdogService->setCountBlackList($enumIPBlackList);
unset($enumIPBlackList);
/* **************************** E-mail Black List *************************** */
$query = "\nCREATE TABLE IF NOT EXISTS `{$prefix}watchdog_email_list` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `email` varchar(128) NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `email` (`email`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
OW::getDbo()->query($query);
copy($plugin->getStaticUrl() . WATCHDOG_BOL_WatchdogService::INSTALL_EMAIL_ZIP, $plugin->getPluginFilesDir() . WATCHDOG_BOL_WatchdogService::INSTALL_EMAIL_ZIP);
$enumEmailBlackList = new WATCHDOG_BOL_EnumBlackList('INSTALL_EMAIL');
$watchdogService->exctractFile($enumEmailBlackList);
$watchdogService->insertFromStopForum($enumEmailBlackList);
$watchdogService->setCountBlackList($enumEmailBlackList);
@unlink($plugin->getPluginFilesDir() . WATCHDOG_BOL_WatchdogService::ZIP_IP_LIST);
Esempio n. 7
0
 public function truncateTable()
 {
     WATCHDOG_BOL_WatchdogService::getInstance()->truncateWhiteListTable();
     OW::getFeedback()->info(OW::getLanguage()->text('watchdog', 'white_list_clear'));
     $this->redirect(OW::getRouter()->urlForRoute('watchdog.admin_white_list'));
 }