Ejemplo n.º 1
0
/**
 * Anti-hammer protection
 *
 * @param int $hammer Hammer rate
 * @param string $action Action type
 * @param int $lastseen User last seen timestamp
 * @return int
 */
function cot_shield_hammer($hammer, $action, $lastseen)
{
    global $cfg, $sys;
    if ($action == 'Hammering') {
        cot_shield_protect();
        cot_shield_clearaction();
        cot_plugin_active('hits') && cot_stat_inc('totalantihammer');
    }
    if ($sys['now'] - $lastseen < 4) {
        $hammer++;
        if ($hammer > $cfg['shieldzhammer']) {
            cot_shield_update(180, 'Hammering');
            cot_log('IP banned 3 mins, was hammering', 'sec');
            $hammer = 0;
        }
    } else {
        if ($hammer > 0) {
            $hammer--;
        }
    }
    return $hammer;
}
Ejemplo n.º 2
0
                    $pmsql = $db->query("SELECT user_email, user_name, user_lang\n\t\t\t\t\t\tFROM {$db_users} WHERE user_id = {$userid} AND user_pmnotify = 1 AND user_maingrp > 3");
                    if ($row = $pmsql->fetch()) {
                        cot_send_translated_mail($row['user_lang'], $row['user_email'], htmlspecialchars($row['user_name']));
                        if ($stats_enabled) {
                            cot_stat_inc('totalmailpmnot');
                        }
                    }
                }
            }
            /* === Hook === */
            foreach (cot_getextplugins('pm.send.send.done') as $pl) {
                include $pl;
            }
            /* ===== */
            if ($stats_enabled) {
                cot_stat_inc('totalpms');
            }
            cot_shield_update(30, "New private message (" . $totalrecipients . ")");
            cot_redirect(cot_url('pm', 'f=sentbox', '', true));
        }
    }
}
if (!empty($to)) {
    $totalrecipients = 0;
    if (mb_substr(mb_strtolower($to), 0, 1) == 'g' && $usr['maingrp'] == 5) {
        $group = cot_import(mb_substr($to, 1, 8), 'D', 'INT');
        if ($group > 1) {
            $sql_pm_users = $db->query("SELECT user_id, user_name FROM {$db_users} WHERE user_maingrp = {$group} ORDER BY user_name ASC");
        }
    } else {
        $touser_src = explode('-', $to);
Ejemplo n.º 3
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=global
[END_COT_EXT]
==================== */
/**
 * Hits counter
 *
 * @package Hits
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!defined('COT_ADMIN') && ($cfg['plugin']['hits']['adminhits'] || $usr['maingrp'] != COT_GROUP_SUPERADMINS)) {
    require_once cot_incfile('hits', 'plug');
    if ($cache && $cache->mem) {
        $hits = $cache->mem->inc('hits', 'system');
        $cfg['plugin']['hits']['hit_precision'] > 0 || ($cfg['plugin']['hits']['hit_precision'] = 100);
        if ($hits % $cfg['plugin']['hits']['hit_precision'] == 0) {
            cot_stat_inc('totalpages', $cfg['plugin']['hits']['hit_precision']);
            cot_stat_inc($sys['day'], $cfg['plugin']['hits']['hit_precision']);
        }
    } else {
        cot_stat_inc('totalpages');
        cot_stat_update($sys['day']);
    }
}