Example #1
0
 function procBanRetrigger()
 {
     //global $pref;
     if (CRON_RETRIGGER_DEBUG) {
         $e107 = e107::getInstance();
         $e107->admin_log->e_log_event(10, debug_backtrace(), 'DEBUG', 'CRON Ban retrigger', 'Retrigger processing started', FALSE, LOG_TO_ROLLING);
     }
     require_once e_HANDLER . 'iphandler_class.php';
     $ipManager = new banlistManager();
     $ipManager->banRetriggerAction();
     if (CRON_RETRIGGER_DEBUG) {
         $e107->admin_log->e_log_event(10, debug_backtrace(), 'DEBUG', 'CRON Ban Retrigger', 'Retrigger processing completed', FALSE, LOG_TO_ROLLING);
     }
 }
Example #2
0
 /**
  *	Regenerate the text-based banlist files (called after a banlist table mod)
  */
 public function regenerateFiles()
 {
     // Now regenerate the text files - so accesses of this IP address don't use the DB
     $ipAdministrator = new banlistManager();
     $ipAdministrator->writeBanListFiles('ip,htaccess');
 }
Example #3
0
 function banlist_bantype($curVal, $mode)
 {
     $ipAdministrator = new banlistManager();
     // print_a($ipAdministrator->banTypes);
     switch ($mode) {
         case 'read':
             // List Page
             return "<div class='nowrap' title='" . $ipAdministrator->getBanTypeString($curVal, TRUE) . "'>" . $ipAdministrator->getBanTypeString($curVal, FALSE) . "</div>";
             break;
         case 'write':
             // Edit Page
             if ($this->getController()->getMode() == 'white') {
                 return $this->hidden('banlist_bantype', eIPHandler::BAN_TYPE_WHITELIST) . "<span class='label label-success'>" . BANLAN_120 . "</span>";
             } elseif ($this->getController()->getAction() == 'create') {
                 return $this->hidden('banlist_bantype', eIPHandler::BAN_TYPE_MANUAL) . "<span class='label label-important'>" . BANLAN_121 . "</span>";
             }
             return $this->selectbox('banlist_bantype', $ipAdministrator->banTypes, $curVal);
             break;
         case 'filter':
         case 'batch':
             return $ipAdministrator->banTypes;
             break;
     }
 }
Example #4
0
  $_POST['ban_types'] - array of 0..9
  $_POST['ban_separator'] - 1 or 2
  $_POST['ban_quote'] - 1,2,3
*/
require_once e_HANDLER . 'iphandler_class.php';
// This is probably already loaded in class2.php
// Uncomment what's going on to get debug data
//define('CSV_DEBUG',TRUE);
$separator_char = array(1 => ',', 2 => '|');
$quote_char = array(1 => '', 2 => "'", 3 => '"');
$format_array = array('banlist_ip' => 1, 'banlist_datestamp' => "%Y%m%d_%H%M%S", 'banlist_banexpires' => "%Y%m%d_%H%M%S", 'banlist_bantype' => 1, 'banlist_reason' => 1, 'banlist_notes' => 1);
$use_separator = varset($separator_char[intval($_POST['ban_separator'])], $separator_char[1]);
$use_quote = varset($quote_char[intval($_POST['ban_quote'])], $quote_char[2]);
$type_list = '';
if (is_array($_POST['ban_types'])) {
    $validBanTypes = banlistManager::getValidReasonList();
    $spacer = '';
    foreach ($_POST['ban_types'] as $b) {
        $b = trim($b);
        if (is_numeric($b) && in_array($b, $validBanTypes)) {
            $type_list .= $spacer . $b;
            $spacer = ',';
        }
    }
}
$filename = 'banlist_' . strftime("%Y%m%d_%H%M%S") . '.csv';
if ($error_string = do_export($filename, $type_list, $format_array, $use_separator, $use_quote)) {
    // Need to report an error here
    echo "Error report: {$error_string}<br />";
}
banlist_adminlog('06', 'File: ' . $filename . '<br />' . $error_string);
Example #5
0
}
require_once e_HANDLER . 'iphandler_class.php';
// This is probably already loaded in class2.php
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE);
$e_sub_cat = 'banlist';
require_once 'auth.php';
require_once e_HANDLER . 'form_handler.php';
$frm = new e_form(true);
require_once e_HANDLER . 'message_handler.php';
$emessage =& eMessage::getInstance();
$pref = e107::getPref();
// Set a default to avoid issues with legacy systems
if (!isset($pref['ban_date_format'])) {
    $pref['ban_date_format'] = '%H:%M %d-%m-%y';
}
$ipAdministrator = new banlistManager();
// Character options for import & export
$separator_char = array(1 => ',', 2 => '|');
$quote_char = array(1 => '(none)', 2 => "'", 3 => '"');
$action = 'list';
if (e_QUERY) {
    $tmp = explode('-', e_QUERY);
    // Use '-' instead of '.' to avoid confusion with IP addresses
    $action = $tmp[0];
    $sub_action = varset($tmp[1], '');
    if ($sub_action) {
        $sub_action = preg_replace('/[^\\w*@\\.:]*/', '', urldecode($sub_action));
    }
    $id = intval(varset($tmp[2], 0));
    unset($tmp);
}