| 90 | | |
| | 91 | /* Format human readable filesize */ |
| | 92 | static function formatSize($size, $round = 0) { |
| | 93 | //Size must be bytes! |
| | 94 | $sizes = array(_('B'), _('kB'), _('MB'), _('GB'), _('TB'), _('PB'), _('EB'), _('ZB'), _('YB')); |
| | 95 | for ($i=0; $size > 1024 && $i < count($sizes) - 1; $i++) $size /= 1024; |
| | 96 | return round($size,$round).$sizes[$i]; |
| | 97 | } |
| 105 | | |
| 106 | | if($current_node){ |
| 107 | | $abuseControlReport = User::getAbuseControlConnectionHistory($user, null, $current_node); |
| 108 | | if($abuseControlReport) { |
| 109 | | //pretty_print_r($abuseControlReport); |
| | 112 | if ($user) { |
| | 113 | if($current_node){ |
| | 114 | $abuseControlReport = User::getAbuseControlConnectionHistory($user, null, $current_node); |
| | 115 | if($abuseControlReport) { |
| | 116 | //pretty_print_r($abuseControlReport); |
| | 117 | $db = AbstractDb::getObject(); |
| | 118 | $html .= sprintf(_("During the last %s period, you transfered %s / %s and were connected %s / %s at this node. Throughout the network, you transfered %s / %s and were connected %s / %s"), |
| | 119 | $abuseControlReport['connection_limit_window']?$db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['connection_limit_window'])):_("Unknown"), |
| | 120 | self::formatSize($abuseControlReport['node_total_bytes']), |
| | 121 | $abuseControlReport['connection_limit_node_max_total_bytes']?self::formatSize($abuseControlReport['connection_limit_node_max_total_bytes']):_("Unlimited"), |
| | 122 | $abuseControlReport['node_duration']?$abuseControlReport['node_duration']:_("None"), |
| | 123 | $abuseControlReport['connection_limit_node_max_usage_duration']?$abuseControlReport['connection_limit_node_max_usage_duration']:_("Unlimited"), |
| | 124 | self::formatSize($abuseControlReport['network_total_bytes']), |
| | 125 | $abuseControlReport['connection_limit_network_max_total_bytes']?self::formatSize($abuseControlReport['connection_limit_network_max_total_bytes']):_("Unlimited"), |
| | 126 | $abuseControlReport['network_duration']?$abuseControlReport['network_duration']:_("None"), |
| | 127 | $abuseControlReport['connection_limit_network_max_usage_duration']?$abuseControlReport['connection_limit_network_max_usage_duration']:_("Unlimited") |
| | 128 | ); |
| 111 | | $html .= sprintf(_("During the last %s period, you transfered %s / %s bytes and were connected %s / %s at this node. Throughout the network, you transfered %s / %s bytes and were connected %s / %s"), |
| 112 | | $abuseControlReport['connection_limit_window']?$abuseControlReport['connection_limit_window']:_("Unknown"), |
| 113 | | $abuseControlReport['node_total_bytes']?$abuseControlReport['node_total_bytes']:_("Unknown"), |
| 114 | | $abuseControlReport['connection_limit_node_max_total_bytes']?$abuseControlReport['connection_limit_node_max_total_bytes']:_("Unlimited"), |
| 115 | | $abuseControlReport['node_duration']?$abuseControlReport['node_duration']:_("Unknown"), |
| 116 | | $abuseControlReport['connection_limit_node_max_usage_duration']?$abuseControlReport['connection_limit_node_max_usage_duration']:_("Unlimited"), |
| 117 | | $abuseControlReport['network_total_bytes']?$abuseControlReport['network_total_bytes']:_("Unknown"), |
| 118 | | $abuseControlReport['connection_limit_network_max_total_bytes']?$abuseControlReport['connection_limit_network_max_total_bytes']:_("Unlimited"), |
| 119 | | $abuseControlReport['network_duration']?$abuseControlReport['network_duration']:_("Unknown"), |
| 120 | | $abuseControlReport['connection_limit_network_max_usage_duration']?$abuseControlReport['connection_limit_network_max_usage_duration']:_("Unlimited") |
| 121 | | ); |
| 122 | | |
| | 130 | } |
| | 131 | else { |
| | 132 | $html .= _("Abuse control is currently disabled"); |
| | 133 | } |